repo_name stringlengths 7 65 | path stringlengths 5 186 | copies stringlengths 1 4 | size stringlengths 4 6 | content stringlengths 941 973k | license stringclasses 14
values | hash stringlengths 32 32 | line_mean float64 5 100 | line_max int64 26 999 | alpha_frac float64 0.25 0.93 | ratio float64 1.5 7.35 | autogenerated bool 1
class | config_or_test bool 2
classes | has_no_keywords bool 2
classes | has_few_assignments bool 1
class |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
matplotlib/basemap | packages/basemap/src/mpl_toolkits/basemap/__init__.py | 1 | 255110 | from __future__ import (absolute_import, division, print_function)
"""
Module for plotting data on maps with matplotlib.
Contains the :class:`Basemap` class (which does most of the
heavy lifting), and the following functions:
:func:`interp`: bilinear interpolation between rectilinear grids.
:func:`maskoceans`: ma... | mit | 9a6ddaf6d8ccb782ae47197ec32b42bb | 46.657388 | 172 | 0.527341 | 3.978324 | false | false | false | false |
pyannote/pyannote-audio | doc/gen_docs.py | 1 | 1233 | """
This script will generate the rst docs for the api
"""
import os
from os import path
bp = breakpoint
def capitalise(s):
news = ""
for word in s.split("_"):
news += word.capitalize()
return news
def process_dir(level, p):
md = ""
basename = path.basename(p)
title = capitalise(b... | mit | fa0f37ef84eae1763233af26c84aa924 | 18.571429 | 57 | 0.547445 | 3.463483 | false | false | false | false |
matplotlib/basemap | examples/plotprecip.py | 2 | 3131 | from __future__ import (absolute_import, division, print_function)
from mpl_toolkits.basemap import Basemap, cm
from netCDF4 import Dataset as NetCDFFile
import numpy as np
import matplotlib.pyplot as plt
import copy
from matplotlib import rcParams
# make tick labels smaller
rcParams['xtick.labelsize']=9
rcParams['yt... | mit | fd209790acaea96963ccf2e61ac74772 | 33.788889 | 80 | 0.730118 | 2.708478 | false | false | false | false |
matplotlib/basemap | packages/basemap/doc/users/figures/ortho_partial.py | 3 | 1264 | from mpl_toolkits.basemap import Basemap
import numpy as np
import matplotlib.pyplot as plt
fig = plt.figure()
# global ortho map centered on lon_0,lat_0
lat_0=10.; lon_0=57.
# resolution = None means don't process the boundary datasets.
m1 = Basemap(projection='ortho',lon_0=lon_0,lat_0=lat_0,resolution=None)
# add an ... | mit | be752d886628ab79c8fece73c093f405 | 44.142857 | 72 | 0.753165 | 2.695096 | false | false | true | false |
matplotlib/basemap | packages/basemap/doc/users/figures/hurrtracks.py | 6 | 1695 | """
draw Atlantic Hurricane Tracks for storms that reached Cat 4 or 5.
part of the track for which storm is cat 4 or 5 is shown red.
ESRI shapefile data from http://nationalatlas.gov/mld/huralll.html
"""
import numpy as np
import matplotlib.pyplot as plt
from mpl_toolkits.basemap import Basemap
# Lambert Conformal Con... | mit | 305fb6a58929e4b4905c55080b223e34 | 39.357143 | 88 | 0.671976 | 2.825 | false | false | false | false |
matplotlib/basemap | examples/geos_demo.py | 2 | 1402 | from __future__ import (absolute_import, division, print_function)
from mpl_toolkits.basemap import Basemap
import numpy as np
import matplotlib.pyplot as plt
import sys
def get_input(prompt):
if sys.hexversion > 0x03000000:
return input(prompt)
else:
return raw_input(prompt)
# create Basemap... | mit | dcc69308fa0a39c6fa925ce9bf02d3c9 | 33.195122 | 92 | 0.735378 | 2.826613 | false | false | false | false |
pyannote/pyannote-audio | pyannote/audio/utils/random.py | 1 | 2389 | # MIT License
#
# Copyright (c) 2020 CNRS
#
# 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, publish... | mit | 80b7888eef59459c193564c014b66d4e | 31.69863 | 83 | 0.687055 | 3.932455 | false | false | false | false |
matplotlib/basemap | examples/polarmaps.py | 2 | 2869 | from __future__ import (absolute_import, division, print_function)
# make plots of etopo bathymetry/topography data on
# various map projections, drawing coastlines, state and
# country boundaries, filling continents and drawing
# parallels/meridians
# illustrates special-case polar-centric projections.
from mpl_too... | mit | eeb89def27a09f46bf88abdc3478e7c3 | 37.253333 | 99 | 0.629139 | 3.202009 | false | false | false | false |
matplotlib/basemap | packages/basemap_data_hires/setup.py | 2 | 2926 | #! /usr/bin/env python
# -*- coding: utf-8 -*-
# flake8: noqa: E122
"""basemap_data_hires -- High-resolution data assets for matplotlib basemap."""
import io
import os
import itertools
from setuptools import setup
from setuptools import find_packages
def get_content(name, splitlines=False):
"""Return the file co... | mit | 3aa756daaf5949572863f39b26687fc7 | 24.426087 | 93 | 0.557798 | 3.645885 | false | false | false | false |
pyannote/pyannote-audio | pyannote/audio/utils/probe.py | 1 | 4426 | # MIT License
#
# Copyright (c) 2020 CNRS
#
# 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, publish... | mit | 1783baec8bc8173b7f7a483d58a7c036 | 32.530303 | 86 | 0.635111 | 3.648805 | false | false | false | false |
pypa/virtualenv | src/virtualenv/util/path/_sync.py | 5 | 1924 | import logging
import os
import shutil
from stat import S_IWUSR
def ensure_dir(path):
if not path.exists():
logging.debug("create folder %s", str(path))
os.makedirs(str(path))
def ensure_safe_to_do(src, dest):
if src == dest:
raise ValueError(f"source and destination is the same {src... | mit | e09874410f7c15351879117dda2ae695 | 23.666667 | 96 | 0.580561 | 3.217391 | false | false | false | false |
pypa/virtualenv | src/virtualenv/discovery/py_spec.py | 3 | 4514 | """A Python specification is an abstract requirement definition of an interpreter"""
import os
import re
from collections import OrderedDict
from virtualenv.info import fs_is_case_sensitive
PATTERN = re.compile(r"^(?P<impl>[a-zA-Z]+)?(?P<version>[0-9.]+)?(?:-(?P<arch>32|64))?$")
class PythonSpec:
"""Contains s... | mit | 66a8e3a5dc6bfb3a4bb3bd8b0a253821 | 38.252174 | 112 | 0.531458 | 4.478175 | false | false | false | false |
pypa/virtualenv | src/virtualenv/create/via_global_ref/builtin/ref.py | 2 | 5379 | """
Virtual environments in the traditional sense are built as reference to the host python. This file allows declarative
references to elements on the file system, allowing our system to automatically detect what modes it can support given
the constraints: e.g. can the file system symlink, can the files be read, execu... | mit | 0aba978d2375763f205501e5620fba5d | 29.5625 | 118 | 0.577245 | 3.798729 | false | false | false | false |
pypa/virtualenv | src/virtualenv/activation/activator.py | 5 | 1382 | import os
from abc import ABCMeta, abstractmethod
class Activator(metaclass=ABCMeta):
"""Generates activate script for the virtual environment"""
def __init__(self, options):
"""Create a new activator generator.
:param options: the parsed options as defined within :meth:`add_parser_arguments... | mit | f59e5cb6aa19d2b6b474194aa8a24593 | 29.711111 | 114 | 0.648336 | 4.637584 | false | false | false | false |
pypa/virtualenv | tests/unit/seed/wheels/test_bundle.py | 2 | 2654 | import os
from datetime import datetime
from pathlib import Path
import pytest
from virtualenv.app_data import AppDataDiskFolder
from virtualenv.seed.wheels.bundle import from_bundle
from virtualenv.seed.wheels.embed import get_embed_wheel
from virtualenv.seed.wheels.periodic_update import dump_datetime
from virtuale... | mit | f4c7ee2e40a653bcf3f03b8cf5241f60 | 35.356164 | 103 | 0.656368 | 3.346784 | false | true | false | false |
pypa/virtualenv | src/virtualenv/discovery/builtin.py | 3 | 6138 | import logging
import os
import sys
from virtualenv.info import IS_WIN
from .discover import Discover
from .py_info import PythonInfo
from .py_spec import PythonSpec
class Builtin(Discover):
def __init__(self, options):
super().__init__(options)
self.python_spec = options.python if options.pytho... | mit | 8b1109d81aaa1c07ade5c91941efc308 | 32.540984 | 112 | 0.585859 | 4.017016 | false | false | false | false |
pypa/virtualenv | src/virtualenv/seed/wheels/acquire.py | 5 | 4398 | """Bootstrap"""
import logging
import sys
from operator import eq, lt
from pathlib import Path
from subprocess import PIPE, CalledProcessError, Popen
from .bundle import from_bundle
from .periodic_update import add_wheel_to_update_log
from .util import Version, Wheel, discover_wheels
def get_wheel(distribution, ver... | mit | bf8b24579596aede7c8014ef550a07e3 | 35.04918 | 114 | 0.63256 | 3.698907 | false | false | false | false |
zarr-developers/numcodecs | setup.py | 1 | 8497 | import os
import sys
from glob import glob
import cpuinfo
from Cython.Distutils.build_ext import new_build_ext as build_ext
from setuptools import Extension, setup
from setuptools.errors import CCompilerError, ExecError, PlatformError
# determine CPU support for SSE2 and AVX2
cpu_info = cpuinfo.get_cpu_info()
flags =... | mit | 1b663d09220dd3fc7973cdebf3b12bef | 28.919014 | 90 | 0.598917 | 3.570168 | false | false | false | false |
zarr-developers/numcodecs | numcodecs/fixedscaleoffset.py | 1 | 4198 | import numpy as np
from .abc import Codec
from .compat import ensure_ndarray, ndarray_copy
class FixedScaleOffset(Codec):
"""Simplified version of the scale-offset filter available in HDF5.
Applies the transformation `(x - offset) * scale` to all chunks. Results
are rounded to the nearest integer but ar... | mit | fbb810308a6ece106d3afcb0d8fac899 | 29.867647 | 93 | 0.57051 | 3.527731 | false | false | false | false |
zarr-developers/numcodecs | numcodecs/msgpacks.py | 1 | 2552 | import numpy as np
import msgpack
from .abc import Codec
from .compat import ensure_contiguous_ndarray
class MsgPack(Codec):
"""Codec to encode data as msgpacked bytes. Useful for encoding an array of Python
objects.
.. versionchanged:: 0.6
The encoding format has been changed to include the ar... | mit | cee97c7213bc02d214b141aa51e7e1d4 | 30.121951 | 88 | 0.592476 | 3.797619 | false | false | false | false |
zarr-developers/numcodecs | numcodecs/pickles.py | 1 | 1310 | import pickle
import numpy as np
from .abc import Codec
from .compat import ensure_contiguous_ndarray
class Pickle(Codec):
"""Codec to encode data as as pickled bytes. Useful for encoding an array of Python string
objects.
Parameters
----------
protocol : int, defaults to pickle.HIGHEST_PROTOCO... | mit | 3141b3ba537b9d10844ce41d739368f2 | 22.392857 | 94 | 0.584733 | 4.04321 | false | false | false | false |
pypa/setuptools_scm | src/setuptools_scm/hacks.py | 2 | 1776 | from __future__ import annotations
import os
from typing import TYPE_CHECKING
if TYPE_CHECKING:
from . import _types as _t
from .config import Configuration
from .utils import data_from_mime
from .utils import trace
from .version import meta
from .version import ScmVersion
from .version import tag_to_version
_UN... | mit | 86a039e37f699e10177a9e81adf49f43 | 30.157895 | 81 | 0.666667 | 3.573441 | false | true | false | false |
mar10/wsgidav | wsgidav/util.py | 1 | 58023 | # -*- coding: utf-8 -*-
# (c) 2009-2022 Martin Wendt and contributors; see WsgiDAV https://github.com/m ar10/wsgidav
# Original PyFileServer (c) 2005 Ho Chun Wei.
# Licensed under the MIT license:
# http://www.opensource.org/licenses/mit-license.php
"""
Miscellaneous support functions for WsgiDAV.
"""
import base64
imp... | mit | 2d1e8d4eaba565581e4ce7d98125c9c7 | 32.346552 | 159 | 0.556417 | 3.894945 | false | false | false | false |
mar10/wsgidav | wsgidav/rw_lock.py | 1 | 10154 | # -*- coding: utf-8 -*-
"""
ReadWriteLock
Taken from http://code.activestate.com/recipes/502283/
locks.py - Read-Write lock thread lock implementation
See the class documentation for more info.
Copyright (C) 2007, Heiko Wundram.
Released under the BSD-license.
"""
# Imports
# -------
from threading import Conditi... | mit | bf1796733f39ca1e5893f6be4598c2fa | 43.731278 | 80 | 0.53703 | 5.272066 | false | false | false | false |
hall-lab/svtools | svtools/utils.py | 1 | 4858 | from __future__ import print_function
import sys
import re
import datetime
import os, hashlib, base64
import logzero
from logzero import logger
DEFAULT_FORMAT = '%(color)s[%(levelname)1.1s %(asctime)s %(module)s:%(lineno)d]%(end_color)s %(message)s'
logfmt = logzero.LogFormatter(fmt=DEFAULT_FORMAT, datefmt="%Y-%m-%d ... | mit | e79b975a3872500469910d4e14948ac2 | 35.80303 | 105 | 0.615068 | 4.018197 | false | false | false | false |
hall-lab/svtools | svtools/l_bp.py | 1 | 7236 | import sys, re, os
ar=os.path.dirname(os.path.realpath(__file__)).split('/')
svtpath='/'.join(ar[0:(len(ar)-1)])
sys.path.insert(1, svtpath)
from svtools.utils import parse_bnd_alt_string
def find_all(a_str, sub):
'''
Generator to find the coordinates of the start of all
occurrences of a substring
''... | mit | 68c0350bc1a3b283d1a4de24934ae36e | 26.101124 | 94 | 0.408098 | 3.179262 | false | false | false | false |
hall-lab/svtools | svtools/lmerge_ins.py | 1 | 21717 | import sys
import numpy as np
import argparse
import heapq
import re
import os
ar=os.path.dirname(os.path.realpath(__file__)).split('/')
svtpath='/'.join(ar[0:(len(ar)-1)])
sys.path.insert(1, svtpath)
import svtools.l_bp as l_bp
from svtools.breakpoint import Breakpoint
import svtools.logspace as ls
from svtools.vcf.... | mit | a8da0eb71238e018db41737f5362844c | 33.146226 | 243 | 0.535525 | 2.866552 | false | false | false | false |
hall-lab/svtools | tests/afreq_tests.py | 3 | 1914 | from unittest import TestCase, main
import os
import time
import svtools.afreq
import sys
import tempfile
import difflib
class IntegrationTest_afreq(TestCase):
def run_integration_test(self):
test_directory = os.path.dirname(os.path.abspath(__file__))
test_data_dir = os.path.join(test_directory, 't... | mit | 8dfcfbd891da32083b418c3058abf91c | 38.875 | 122 | 0.629049 | 3.638783 | false | true | false | false |
venth/aws-adfs | aws_adfs/commands.py | 1 | 1327 | # -*- coding: utf-8 -*-
import logging
import sys
import click
from . import list_profiles
from . import login
from . import reset
from . import __version__
def _print_version(ctx, param, value):
if not value or ctx.resilient_parsing:
return
click.echo(__version__)
ctx.exit()
@click.group()
@... | mit | 80a59833a14cd01bf27eea6ab53d5eea | 23.127273 | 84 | 0.62095 | 3.576819 | false | false | false | false |
venth/aws-adfs | aws_adfs/html_roles_fetcher.py | 1 | 4161 | import logging
import os
from platform import system
import requests
import hashlib
from . import helpers
from .helpers import trace_http_request
try:
import cookielib
except ImportError:
# python 3
import http.cookiejar as cookielib
_auth_provider = None
_headers = {'Accept-Language': 'en'}
try:
if... | mit | 0160174d7883b027d9b1597eaf2cb0d1 | 31.255814 | 151 | 0.648161 | 3.959087 | false | false | false | false |
ambitioninc/django-entity | entity/models.py | 1 | 24939 | from itertools import compress
from activatable_model.models import BaseActivatableModel, ActivatableManager, ActivatableQuerySet
from django.contrib.contenttypes.fields import GenericForeignKey
from django.contrib.contenttypes.models import ContentType
from django.contrib.postgres.fields import JSONField
from django.... | mit | 5277143bf2c5606e8c817a0cb45de20e | 38.77512 | 119 | 0.645174 | 4.185801 | false | false | false | false |
ambitioninc/django-entity | entity/migrations/0001_initial.py | 2 | 2594 | # -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.db import models, migrations
import django.db.models.deletion
import jsonfield.fields
class Migration(migrations.Migration):
dependencies = [
('contenttypes', '0001_initial'),
]
operations = [
migrations.CreateM... | mit | 176add9f638b1dd0a385b00c4f8256e0 | 37.716418 | 151 | 0.559368 | 4.472414 | false | false | false | false |
electron/libchromiumcontent | script/lib/util.py | 2 | 2607 | #!/usr/bin/env python
from __future__ import print_function
import contextlib
import itertools
import os
import subprocess
import sys
def validate_pair(ob):
if not (len(ob) == 2):
print("Unexpected result:", ob, file=sys.stderr)
return False
else:
return True
def consume(iter):
try:
while Tr... | mit | 4d9e2b43e8695c91da8ed50074b6c975 | 28.965517 | 105 | 0.695435 | 3.471372 | false | false | false | false |
pytest-dev/pytest-cov | tests/test_pytest_cov.py | 1 | 62190 | import collections
import glob
import os
import platform
import re
import subprocess
import sys
from itertools import chain
import coverage
import py
import pytest
import virtualenv
import xdist
from fields import Namespace
from process_tests import TestProcess as _TestProcess
from process_tests import dump_on_error
f... | mit | c146c4cb22b48f27f8e2424f0db2b5b3 | 30.584561 | 124 | 0.538238 | 3.960138 | false | true | false | false |
alorence/django-modern-rpc | modernrpc/introspection.py | 1 | 5874 | """Handle all introspection related features on rpc_methods:
- Help text
- Signature
"""
import inspect
import re
from typing import Callable, Dict, List
from django.utils.functional import cached_property
from modernrpc.conf import settings
# Define regular expressions used to parse docstring
PARAM_REXP = re.compil... | mit | 0e2dd927a7a31e380da113533e587e90 | 33.350877 | 116 | 0.623085 | 4.364042 | false | false | false | false |
alorence/django-modern-rpc | modernrpc/apps.py | 1 | 3731 | # coding: utf-8
import inspect
import logging
from importlib import import_module
from typing import List
from django.apps import AppConfig
from django.core import checks
from modernrpc.conf import settings
from modernrpc.core import registry
logger = logging.getLogger(__name__)
@checks.register()
def check_settin... | mit | e1174e3f524eef899c3e3751faa5c8e9 | 38.691489 | 116 | 0.629054 | 4.436385 | false | true | false | false |
python-openxml/python-docx | docx/image/image.py | 12 | 8029 | # encoding: utf-8
"""
Provides objects that can characterize image streams as to content type and
size, as a required step in including them in a document.
"""
from __future__ import absolute_import, division, print_function
import hashlib
import os
from ..compat import BytesIO, is_string
from .exceptions import Un... | mit | b60703670e74906b176e5583e6d66290 | 29.528517 | 77 | 0.598954 | 4.347049 | false | false | false | false |
python-openxml/python-docx | docx/text/paragraph.py | 11 | 4813 | # encoding: utf-8
"""
Paragraph-related proxy types.
"""
from __future__ import (
absolute_import, division, print_function, unicode_literals
)
from ..enum.style import WD_STYLE_TYPE
from .parfmt import ParagraphFormat
from .run import Run
from ..shared import Parented
class Paragraph(Parented):
"""
Pr... | mit | b64e4952ceadc352ca9b8a3d67412f82 | 32.193103 | 77 | 0.613131 | 4.37148 | false | false | false | false |
python-openxml/python-docx | docx/dml/color.py | 13 | 3978 | # encoding: utf-8
"""
DrawingML objects related to color, ColorFormat being the most prominent.
"""
from __future__ import (
absolute_import, division, print_function, unicode_literals
)
from ..enum.dml import MSO_COLOR_TYPE
from ..oxml.simpletypes import ST_HexColorAuto
from ..shared import ElementProxy
class... | mit | 8742d54c63fae8147ce1853e2f8655ec | 33.293103 | 77 | 0.61639 | 3.99799 | false | false | false | false |
python-openxml/python-docx | tests/unitdata.py | 11 | 4329 | # encoding: utf-8
"""
Shared code for unit test data builders
"""
from __future__ import absolute_import, print_function, unicode_literals
from docx.oxml import parse_xml
from docx.oxml.ns import nsdecls
class BaseBuilder(object):
"""
Provides common behavior for all data builders.
"""
def __init__... | mit | fad930d58801fc2961136b33c18dd3ba | 29.485915 | 78 | 0.544006 | 3.800702 | false | false | false | false |
python-openxml/python-docx | docx/enum/base.py | 1 | 11012 | # encoding: utf-8
"""
Base classes and other objects used by enumerations
"""
from __future__ import absolute_import, print_function
import sys
import textwrap
from ..exceptions import InvalidXmlError
def alias(*aliases):
"""
Decorating a class with @alias('FOO', 'BAR', ..) allows the class to
be refe... | mit | 18c116407254f4b8a0add7df68a1e137 | 29.336088 | 77 | 0.592445 | 4.225633 | false | false | false | false |
python-openxml/python-docx | docx/enum/text.py | 1 | 10689 | # encoding: utf-8
"""
Enumerations related to text in WordprocessingML files
"""
from __future__ import absolute_import, print_function, unicode_literals
from .base import alias, EnumMember, XmlEnumeration, XmlMappedEnumMember
@alias('WD_ALIGN_PARAGRAPH')
class WD_PARAGRAPH_ALIGNMENT(XmlEnumeration):
"""
a... | mit | ef8b8c2115b00445af7e3dd2f4fe33b7 | 29.366477 | 78 | 0.548227 | 3.777032 | false | false | false | false |
python-openxml/python-docx | tests/unitutil/cxml.py | 1 | 8334 | # encoding: utf-8
"""Parser for Compact XML Expression Language (CXEL) ('see-ex-ell').
CXEL is a compact XML specification language I made up that's useful for producing XML
element trees suitable for unit testing.
"""
from __future__ import absolute_import, division, print_function, unicode_literals
from pyparsing... | mit | 8437445a486320a2cc97c2b5160d6658 | 28.242105 | 86 | 0.541397 | 4.175351 | false | false | false | false |
python-openxml/python-docx | docx/enum/section.py | 1 | 2666 | # encoding: utf-8
"""
Enumerations related to the main document in WordprocessingML files
"""
from __future__ import absolute_import, print_function, unicode_literals
from .base import alias, XmlEnumeration, XmlMappedEnumMember
@alias('WD_HEADER_FOOTER')
class WD_HEADER_FOOTER_INDEX(XmlEnumeration):
"""
al... | mit | 5a4d9e14616f23e21671490dc957fe58 | 24.883495 | 88 | 0.602401 | 3.677241 | false | false | false | false |
python-openxml/python-docx | docx/oxml/document.py | 1 | 2513 | # encoding: utf-8
"""
Custom element classes that correspond to the document part, e.g.
<w:document>.
"""
from .xmlchemy import BaseOxmlElement, ZeroOrOne, ZeroOrMore
class CT_Document(BaseOxmlElement):
"""
``<w:document>`` element, the root element of a document.xml file.
"""
body = ZeroOrOne('w:bo... | mit | 81abb5cb65d28fff3ebc0af4e476ec74 | 36.507463 | 88 | 0.627139 | 3.790347 | false | false | false | false |
meine-stadt-transparent/meine-stadt-transparent | mainapp/models/file.py | 1 | 3109 | from datetime import datetime
from typing import Optional, List, Dict, Any
from dateutil import tz
from django.db import models
from django.urls import reverse
from mainapp.functions.minio import minio_client, minio_file_bucket
from .helper import DefaultFields
from .location import Location
from .person import Perso... | mit | d6a8bb0bb613a901a2e4286d9b1c83ab | 37.8625 | 94 | 0.687681 | 3.800733 | false | false | false | false |
meine-stadt-transparent/meine-stadt-transparent | mainapp/views/persons.py | 1 | 5724 | import json
from collections import defaultdict
from typing import List
from django.conf import settings
from django.db.models import Q, Prefetch
from django.shortcuts import get_object_or_404, render, redirect
from django.urls import reverse
from django.utils import timezone
from django.utils.translation import gette... | mit | a2381d3caa97cb38789b236b927b657a | 35.929032 | 114 | 0.670161 | 4.065341 | false | false | false | false |
meine-stadt-transparent/meine-stadt-transparent | importer/cli.py | 1 | 9861 | import json
import logging
import re
from typing import Tuple, List, Optional
from django import db
from django.core.exceptions import ValidationError
from django.core.validators import URLValidator
from importer import JSON
from importer.functions import requests_get
from importer.importer import Importer
from impor... | mit | 0f46bdabe0b546560457f100a1f61ed2 | 36.911538 | 118 | 0.565385 | 3.995541 | false | false | false | false |
meine-stadt-transparent/meine-stadt-transparent | mainapp/models/agenda_item.py | 1 | 1351 | from django.db import models
from mainapp.models.consultation import Consultation
from mainapp.models.file import File
from .helper import DefaultFields
from .meeting import Meeting
class AgendaItem(DefaultFields):
key = models.CharField(max_length=20, null=True, blank=True)
name = models.TextField()
mee... | mit | e782822a0abbed5baf67696b5c30df9f | 32.775 | 69 | 0.675796 | 3.816384 | false | false | false | false |
meine-stadt-transparent/meine-stadt-transparent | mainapp/views/feeds/search_results.py | 1 | 2275 | from typing import List
import dateutil.parser
from django.conf import settings
from django.contrib.syndication.views import Feed
from django.urls import reverse
from django.utils.feedgenerator import Enclosure
from django.utils.translation import gettext as _
from mainapp.functions.search import search_string_to_par... | mit | 6580b8b057719ad89a5a3726c30bef52 | 32.955224 | 86 | 0.663736 | 3.963415 | false | false | false | false |
meine-stadt-transparent/meine-stadt-transparent | mainapp/management/commands/report_import_status.py | 1 | 3064 | import inspect
import logging
from django.contrib.auth.models import User
from django.core.management.base import BaseCommand
from django.db.models import Count
from django.db.models import Model
from mainapp import models
from mainapp.functions.minio import minio_client, minio_file_bucket
from mainapp.models import ... | mit | e20a64313cd1bcf54d0cde04cb5f9a91 | 39.853333 | 93 | 0.619452 | 3.989583 | false | false | false | false |
meine-stadt-transparent/meine-stadt-transparent | meine_stadt_transparent/urls.py | 1 | 1174 | """meine-stadt-transparent URL Configuration
The `urlpatterns` list routes URLs to views. For more information please see:
https://docs.djangoproject.com/en/1.11/topics/http/urls/
Examples:
Function views
1. Add an import: from my_app import views
2. Add a URL to urlpatterns: url(r'^$', views.home, name=... | mit | 00019aa3ccb593dd506ab1a6f9daa332 | 33.529412 | 79 | 0.701874 | 3.568389 | false | false | false | false |
meine-stadt-transparent/meine-stadt-transparent | mainapp/models/organization.py | 1 | 2673 | from django.conf import settings
from django.db import models
from django.urls import reverse
from django.utils.translation import gettext as _
from django.utils.translation import pgettext
from .body import Body
from .helper import DefaultFields, ShortableNameFields, DummyInterface
from .legislative_term import Legis... | mit | 7e7e93bdb6556cb210a035edc83bb051 | 37.73913 | 108 | 0.690984 | 4.056146 | false | false | false | false |
meine-stadt-transparent/meine-stadt-transparent | mainapp/tests/live/test_persons.py | 1 | 2751 | import time
from mainapp.tests.live.chromedriver_test_case import ChromeDriverTestCase
class PersonsTest(ChromeDriverTestCase):
fixtures = ["initdata"]
def _get_pos_by_name(self, name: str):
# The position is identified by the tabindex
js = (
f'Array.from(document.querySelectorAl... | mit | 480faec47a1885553834b73b06976acb | 37.208333 | 87 | 0.621229 | 3.346715 | false | true | false | false |
meine-stadt-transparent/meine-stadt-transparent | mainapp/migrations/0012_auto_20180216_1617.py | 1 | 1776 | # -*- coding: utf-8 -*-
# Generated by Django 1.11.10 on 2018-02-16 15:17
from __future__ import unicode_literals
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('mainapp', '0011_auto_20180216_1226'),
]
operations = [
migrations.AddField(... | mit | 0b2cfd9398f7f61e8b6cf27808695fde | 31.888889 | 74 | 0.567005 | 4.238663 | false | false | false | false |
meine-stadt-transparent/meine-stadt-transparent | mainapp/tests/main/test_citytools.py | 1 | 1865 | import json
from unittest import skip
import pytest
import responses
from django.test import TestCase
from mainapp.functions.citytools import import_outline, import_streets
from mainapp.models import Body, SearchStreet
@skip
class TestCitytools(TestCase):
fixtures = ["initdata"]
ags_munich = "09162000"
... | mit | 01f99d40946167a4b975919bc4f7150b | 32.872727 | 118 | 0.659689 | 3.320856 | false | true | false | false |
meine-stadt-transparent/meine-stadt-transparent | mainapp/views/special.py | 1 | 2712 | """
Views that are special in that they normally shouldn't be user-facing
"""
from html import escape
from django.conf import settings
from django.http import HttpResponse
from django.shortcuts import render
from django.urls import reverse
from django.utils.translation import gettext as _
from mainapp.models import ... | mit | 1af875302f6f27996ea12e266804442b | 32.073171 | 108 | 0.657448 | 3.463602 | false | false | false | false |
meine-stadt-transparent/meine-stadt-transparent | cms/migrations/0001_initial.py | 1 | 2946 | # Generated by Django 2.1.7 on 2019-02-21 14:04
import django.db.models.deletion
import modelcluster.fields
import wagtail.core.fields
from django.db import migrations, models
class Migration(migrations.Migration):
initial = True
dependencies = [
('wagtailcore', '0041_group_collection_permissions_ve... | mit | b49d2f83e46890c5f303775da4f025b2 | 38.28 | 119 | 0.5241 | 4.66878 | false | false | false | false |
levlaz/braindump | migrations/versions/3a37e844b277_alter_constraints.py | 1 | 1358 | """Alter Constraints
Revision ID: 3a37e844b277
Revises: b237b9f6a2ce
Create Date: 2016-05-30 15:57:56.017519
"""
# revision identifiers, used by Alembic.
revision = '3a37e844b277'
down_revision = 'b237b9f6a2ce'
from alembic import op
import sqlalchemy as sa
def upgrade():
### commands auto generated by Alembi... | mit | 76f0c23ae9bbdb3b91f686640b15c7b6 | 32.975 | 111 | 0.65243 | 3.288136 | false | false | false | false |
levlaz/braindump | app/main/notebooks.py | 1 | 2184 | from datetime import datetime
from flask import render_template, redirect, \
url_for, flash, abort, current_app, request, \
jsonify
from flask_login import current_user, login_required
from . import main
from app import db, csrf
from app.main.forms import NotebookForm
from app.models import Notebook
@main.ro... | mit | 787be656c1352499fc1b1b356f427a6e | 29.774648 | 86 | 0.610348 | 3.970909 | false | false | false | false |
tox-dev/tox | tests/integration/test_parallel_inception.py | 2 | 1607 | def test_parallel_inception(initproj, cmd):
initproj(
"inception-1.2.3",
filedefs={
# the outer config just has one env: graham
"tox.ini": """
[tox]
envlist = graham
skipsdist = True
[testenv]
commands =
... | mit | 9d20f5685a3506c6bfcb042a34b21d65 | 29.903846 | 90 | 0.484132 | 4.414835 | false | true | false | false |
tox-dev/tox | src/tox/package/builder/isolated.py | 1 | 5465 | from __future__ import unicode_literals
import json
import os
from collections import namedtuple
import six
from packaging.requirements import Requirement
from packaging.utils import canonicalize_name
from tox import reporter
from tox.config import DepConfig, get_py_project_toml
from tox.constants import BUILD_ISOLA... | mit | 2f03db11fa955e4b7b7f236f00e1baa3 | 35.192053 | 97 | 0.655261 | 3.832398 | false | true | false | false |
tox-dev/tox | src/tox/session/commands/run/parallel.py | 2 | 5614 | import os
import sys
from collections import OrderedDict, deque
from threading import Event, Semaphore, Thread
from tox import reporter
from tox.config.parallel import ENV_VAR_KEY_PRIVATE as PARALLEL_ENV_VAR_KEY_PRIVATE
from tox.config.parallel import ENV_VAR_KEY_PUBLIC as PARALLEL_ENV_VAR_KEY_PUBLIC
from tox.exceptio... | mit | 9f31be402b044bb90657fc6cbda46ab2 | 38.258741 | 99 | 0.535625 | 4.403137 | false | true | false | false |
tox-dev/tox | tests/unit/util/test_spinner.py | 2 | 4932 | # -*- coding: utf-8 -*-
from __future__ import absolute_import, unicode_literals
import datetime
import os
import sys
import time
import pytest
from freezegun import freeze_time
from tox.util import spinner
@freeze_time("2012-01-14")
def test_spinner(capfd, monkeypatch):
monkeypatch.setattr(sys.stdout, "isatty... | mit | 80577248e70242ee1f2a2c1810ced92d | 30.780645 | 96 | 0.598051 | 3.209121 | false | true | false | false |
tox-dev/tox | src/tox/interpreters/py_spec.py | 1 | 2448 | from __future__ import unicode_literals
import os
import re
import sys
import six
import tox
class PythonSpec(object):
def __init__(self, name, major, minor, architecture, path, args=None):
self.name = name
self.major = major
self.minor = minor
self.architecture = architecture
... | mit | ae0050cccbebe8187b5591e700fdf459 | 31.210526 | 97 | 0.560049 | 3.801242 | false | false | false | false |
bbangert/velruse | velruse/providers/github.py | 3 | 5984 | """Github Authentication Views"""
import uuid
from pyramid.httpexceptions import HTTPFound
from pyramid.security import NO_PERMISSION_REQUIRED
import requests
from ..api import (
AuthenticationComplete,
AuthenticationDenied,
register_provider,
)
from ..compat import parse_qsl
from ..exceptions import CSR... | mit | 5d6a72f45a5ef467e7bfbc63bd768020 | 35.048193 | 79 | 0.55732 | 4.380673 | false | true | false | false |
coleifer/peewee | examples/analytics/app.py | 1 | 4355 | """
Example "Analytics" app. To start using this on your site, do the following:
* Create a postgresql database:
createdb analytics
* Create an account for each domain you intend to collect analytics for, e.g.
Account.create(domain='charlesleifer.com')
* Update configuration values marked "TODO", e.g. DOMA... | mit | 0e04154e0ba572c428d6b011d18099a8 | 28.033333 | 94 | 0.671183 | 3.623128 | false | false | false | false |
coleifer/peewee | playhouse/hybrid.py | 1 | 1528 | from peewee import ModelDescriptor
# Hybrid methods/attributes, based on similar functionality in SQLAlchemy:
# http://docs.sqlalchemy.org/en/improve_toc/orm/extensions/hybrid.html
class hybrid_method(ModelDescriptor):
def __init__(self, func, expr=None):
self.func = func
self.expr = expr or func
... | mit | ea47baeca5c855b09998bddbbd8ecd66 | 27.830189 | 76 | 0.614529 | 3.94832 | false | false | false | false |
coleifer/peewee | examples/hexastore.py | 1 | 5022 | try:
from functools import reduce
except ImportError:
pass
import operator
from peewee import *
class Hexastore(object):
def __init__(self, database=':memory:', **options):
if isinstance(database, str):
self.db = SqliteDatabase(database, **options)
elif isinstance(database, Da... | mit | 31835697cd0d8c5451498b3717a9dafb | 28.892857 | 76 | 0.485265 | 3.631236 | false | false | false | false |
coleifer/peewee | playhouse/kv.py | 1 | 5608 | import operator
from peewee import *
from peewee import sqlite3
from peewee import Expression
from playhouse.fields import PickleField
try:
from playhouse.sqlite_ext import CSqliteExtDatabase as SqliteExtDatabase
except ImportError:
from playhouse.sqlite_ext import SqliteExtDatabase
Sentinel = type('Sentinel... | mit | eaf94671c90d2840db92d53a9f3b8890 | 30.863636 | 80 | 0.569722 | 4.248485 | false | false | false | false |
coleifer/peewee | playhouse/sqlcipher_ext.py | 1 | 3632 | """
Peewee integration with pysqlcipher.
Project page: https://github.com/leapcode/pysqlcipher/
**WARNING!!! EXPERIMENTAL!!!**
* Although this extention's code is short, it has not been properly
peer-reviewed yet and may have introduced vulnerabilities.
Also note that this code relies on pysqlcipher and sqlcipher... | mit | fbf54342d3b5238f35ef8b2e3118cc19 | 33.264151 | 79 | 0.680617 | 4.150857 | false | false | false | false |
wechatpy/wechatpy | wechatpy/pay/api/micropay.py | 1 | 3021 | # -*- coding: utf-8 -*-
import random
from datetime import datetime
from wechatpy.pay.utils import get_external_ip
from wechatpy.pay.api.base import BaseWeChatPayAPI
class WeChatMicroPay(BaseWeChatPayAPI):
def create(
self,
body,
total_fee,
auth_code,
client_ip=None,
... | mit | 690388a3f6efd55fef3b4befca0a8003 | 30.48 | 102 | 0.564591 | 2.200373 | false | false | false | false |
ceph/teuthology | teuthology/provision/test/test_downburst.py | 4 | 3532 | from mock import Mock, MagicMock, patch
from teuthology import provision
class TestDownburst(object):
def setup(self):
self.ctx = Mock()
self.ctx.os_type = 'rhel'
self.ctx.os_version = '7.0'
self.ctx.config = dict()
self.name = 'vpm999'
self.status = dict(
... | mit | 87f9397d48847f182a4c70a559ecbb50 | 32.638095 | 75 | 0.593998 | 3.785638 | false | true | false | false |
ceph/teuthology | teuthology/suite/test/test_build_matrix.py | 2 | 27478 | import os
import random
from mock import patch, MagicMock
from teuthology.suite import build_matrix
from teuthology.test.fake_fs import make_fake_fstools
class TestBuildMatrixSimple(object):
def test_combine_path(self):
result = build_matrix.combine_path("/path/to/left", "right/side")
assert res... | mit | fa9be4782258f122a4e6d2ef47f87db7 | 32.715337 | 132 | 0.385217 | 3.84469 | false | false | false | false |
wechatpy/wechatpy | wechatpy/pay/api/coupon.py | 2 | 2680 | # -*- coding: utf-8 -*-
import random
from datetime import datetime
from wechatpy.pay.api.base import BaseWeChatPayAPI
class WeChatCoupon(BaseWeChatPayAPI):
def send(self, user_id, stock_id, op_user_id=None, device_info=None, out_trade_no=None):
"""
发放代金券
:param user_id: 用户在公众号下的 openid... | mit | b04fa7f114bac01a049ff39332bd6d67 | 29.906667 | 102 | 0.526316 | 2.604494 | false | false | false | false |
ceph/teuthology | teuthology/suite/test/test_util.py | 2 | 12539 | import os
import pytest
import tempfile
from copy import deepcopy
from mock import Mock, patch
from teuthology.config import config
from teuthology.orchestra.opsys import OS
from teuthology.suite import util
from teuthology.exceptions import ScheduleFailError
REPO_PROJECTS_AND_URLS = [
'ceph',
'https://gith... | mit | a33bf3ae464d2e779cbe1b9bd090c150 | 32.526738 | 87 | 0.569583 | 3.574401 | false | true | false | false |
ceph/teuthology | teuthology/orchestra/daemon/systemd.py | 2 | 7528 | import logging
import re
from teuthology.exceptions import CommandFailedError
from teuthology.orchestra import run
from teuthology.orchestra.daemon.state import DaemonState
log = logging.getLogger(__name__)
systemd_cmd_templ = 'sudo systemctl {action} {daemon}@{id_}'
class SystemDState(DaemonState):
def __init... | mit | aec919b17a5ba3d283c26f92c3eda706 | 31.873362 | 79 | 0.539718 | 3.962105 | false | false | false | false |
wechatpy/wechatpy | wechatpy/work/replies.py | 1 | 1968 | # -*- coding: utf-8 -*-
from wechatpy import replies
from wechatpy.fields import IntegerField, TaskCardField
REPLY_TYPES = {}
def register_reply(reply_type):
def register(cls):
REPLY_TYPES[reply_type] = cls
return cls
return register
@register_reply("text")
class TextReply(replies.TextRe... | mit | 9d455b5ebf7f6ec17545dfe8449c0975 | 23.405063 | 129 | 0.66027 | 3.202658 | false | false | false | false |
wechatpy/wechatpy | tests/test_events.py | 1 | 25929 | # -*- coding: utf-8 -*-
import unittest
from datetime import datetime
from wechatpy import events, parse_message
class EventsTestCase(unittest.TestCase):
def test_subscribe_event(self):
xml = """
<xml>
<ToUserName><![CDATA[toUser]]></ToUserName>
<FromUserName><![CDATA[From... | mit | ca25a849696c6a7335c99b4da714a664 | 37.86036 | 106 | 0.594297 | 3.557037 | false | true | false | false |
wechatpy/wechatpy | wechatpy/client/api/customservice.py | 1 | 7657 | # -*- coding: utf-8 -*-
import hashlib
import time
import datetime
from operator import itemgetter
from urllib.parse import quote
from optionaldict import optionaldict
from wechatpy.utils import to_binary
from wechatpy.client.api.base import BaseWeChatAPI
class WeChatCustomService(BaseWeChatAPI):
API_BASE_URL =... | mit | 015c3f96b82356c81e835d4f8dfcdd52 | 31.287805 | 186 | 0.596767 | 2.632856 | false | false | false | false |
ceph/teuthology | teuthology/orchestra/test/test_systemd.py | 4 | 1466 | import argparse
import os
from logging import debug
from teuthology import misc
from teuthology.orchestra import cluster
from teuthology.orchestra.run import quote
from teuthology.orchestra.daemon.group import DaemonGroup
import subprocess
class FakeRemote(object):
pass
def test_pid():
ctx = argparse.Names... | mit | 6c18a99bf4b622b25bc7b74902af94e1 | 26.148148 | 74 | 0.609141 | 3.524038 | false | false | false | false |
ceph/teuthology | teuthology/repo_utils.py | 2 | 16370 | import logging
import os
import re
import shutil
import subprocess
import time
from teuthology import misc
from teuthology.util.flock import FileLock
from teuthology.config import config
from teuthology.contextutil import MaxWhileTries, safe_while
from teuthology.exceptions import BootstrapError, BranchNotFoundError, ... | mit | e8977fa0f46c425a4131e797374134c8 | 34.509761 | 110 | 0.600244 | 3.897619 | false | false | false | false |
wechatpy/wechatpy | wechatpy/work/client/api/message.py | 1 | 9590 | # -*- coding: utf-8 -*-
from optionaldict import optionaldict
from wechatpy.client.api.base import BaseWeChatAPI
class WeChatMessage(BaseWeChatAPI):
"""
发送应用消息
https://work.weixin.qq.com/api/doc#90000/90135/90236
支持:
* 文本消息
* 图片消息
* 语音消息
* 视频消息
* 文件消息
* 文本卡片消息
* 图文消息
... | mit | f767e5d1aed31ab641dc564939efd7ff | 29.716981 | 108 | 0.499631 | 2.598978 | false | false | false | false |
ceph/teuthology | teuthology/orchestra/cluster.py | 2 | 6697 | """
Cluster definition
part of context, Cluster is used to save connection information.
"""
from teuthology.orchestra import run
class Cluster(object):
"""
Manage SSH connections to a cluster of machines.
"""
def __init__(self, remotes=None):
"""
:param remotes: A sequence of 2-tuples ... | mit | d836aa1f2ad3ec962da233dff068bece | 34.62234 | 84 | 0.547857 | 4.2146 | false | false | false | false |
ceph/teuthology | teuthology/test/fake_archive.py | 4 | 3478 | import os
import shutil
import yaml
import random
class FakeArchive(object):
def __init__(self, archive_base="./test_archive"):
self.archive_base = archive_base
def get_random_metadata(self, run_name, job_id=None, hung=False):
"""
Generate a random info dict for a fake job. If 'hung' ... | mit | dedaa5fb20d1edb2124199adfea9e104 | 31.504673 | 79 | 0.529902 | 3.805252 | false | false | false | false |
wechatpy/wechatpy | wechatpy/work/client/api/schedule.py | 1 | 7992 | # -*- coding: utf-8 -*-
import operator as op
from wechatpy.client.api.base import BaseWeChatAPI
class WeChatSchedule(BaseWeChatAPI):
def add(
self,
organizer,
start_time,
end_time,
attendees=(),
summary="",
description="",
is_remind=True,
... | mit | cccc36ee666d2f1c4de3d3ffeb496c06 | 29.643172 | 155 | 0.528752 | 2.629868 | false | false | false | false |
marcelm/cutadapt | tests/test_commandline.py | 1 | 29507 | import subprocess
import sys
import os
from io import StringIO, BytesIO
import dnaio
import pytest
from cutadapt.__main__ import main
from utils import assert_files_equal, datapath, cutpath
# pytest.mark.timeout will not fail even if pytest-timeout is not installed
try:
import pytest_timeout as _unused
except Im... | mit | de668d588d8604d01e127bf9b8334c3d | 25.653117 | 105 | 0.580715 | 3.146864 | false | true | false | false |
bottlepy/bottle | test/test_sendfile.py | 2 | 6558 | import unittest
from bottle import static_file, request, response, parse_date, parse_range_header, Bottle, tob
import bottle
import wsgiref.util
import os
import tempfile
import time
basename = os.path.basename(__file__)
root = os.path.dirname(__file__)
basename2 = os.path.basename(bottle.__file__)
root2 = os.path.di... | mit | 05ad63c14fb0426f311af59e88699b38 | 40.245283 | 114 | 0.60003 | 3.422756 | false | true | false | false |
marcelm/cutadapt | src/cutadapt/utils.py | 1 | 7203 | import io
import re
import sys
import time
import errno
import multiprocessing
import logging
from typing import Optional
from xopen import xopen
import dnaio
try:
import resource
except ImportError:
# Windows
resource = None # type: ignore
logger = logging.getLogger(__name__)
def available_cpu_count... | mit | b813f2430e04d8ec6ae9d3bef87da0fe | 29.133891 | 92 | 0.535823 | 3.939825 | false | false | false | false |
tooxie/shiva-server | shiva/lyrics/azlyrics.py | 2 | 1908 | import re
import urllib2
import requests
from shiva.lyrics import LyricScraper
from shiva.utils import get_logger
log = get_logger()
class AZLyrics(LyricScraper):
"""
"""
def __init__(self, artist, title):
self.artist = artist
self.title = title
self.lyrics = None
self.... | mit | 4fad3ca9e54ba1bd52264b6a3e9d82b5 | 27.058824 | 75 | 0.52673 | 3.500917 | false | false | false | false |
tooxie/shiva-server | shiva/indexer/lastfm.py | 2 | 3134 | # -*- coding: utf-8 -*-
from shiva.utils import ignored, get_logger
log = get_logger()
class LastFM(object):
def __init__(self, api_key, use_cache=True):
"""
Wrapper around LastFM's library, pylast. Simplifies handling and adds
caching.
Cache's schema:
self.cache[arti... | mit | d05d358a61a049cd668968a27cc129ac | 29.72549 | 77 | 0.520102 | 4.023107 | false | false | false | false |
tooxie/shiva-server | shiva/__init__.py | 1 | 2517 | # -*- coding: utf-8 -*-
# Shiva - A RESTful API to your music collection
#
# Copyright © 2015 Alvaro Mouriño
# Author: Alvaro Mouriño <alvaro@mourino.net>
# URL: <https://github.com/tooxie/shiva-server>
"""
Shiva
=====
Shiva is, technically speaking, a RESTful API to your music collection. It
indexes your music and ex... | mit | 5aa8ad61fcd1d21fa46df00346206500 | 35.779412 | 79 | 0.737705 | 3.068712 | false | false | false | false |
datasift/datasift-python | examples/historics_api.py | 1 | 1501 | # -*- coding: utf8 -*-
from __future__ import print_function
import time
from datasift import Client
datasift = Client("your username", "your API key")
stream = datasift.compile('interaction.content contains "datasift"')
stream = stream['hash']
start = time.time() - (7200 * 48) # 48hrs ago
end_time = start + 3600
... | mit | e79e6f768690e30b4a7df4f5a96472c6 | 26.796296 | 98 | 0.720853 | 3.140167 | false | false | false | false |
tooxie/shiva-server | shiva/auth/resource.py | 1 | 2332 | # -*- coding: utf-8 -*-
from flask import g, request
from flask.ext.restful import abort, Resource
from shiva.constants import HTTP
from shiva.models import User
def verify_credentials(app):
g.user = None
if request.path == '/users/login/':
return None
if app.config.get('ALLOW_ANONYMOUS_ACCESS'... | mit | 3ba0d4ac853791b2c40803503b319533 | 26.435294 | 79 | 0.563894 | 4.367041 | false | false | false | false |
datasift/datasift-python | setup.py | 1 | 1547 | # encoding: utf-8
from setuptools import setup
import os.path
setup(
name="datasift",
version="2.12.1",
author="DataSift",
author_email="opensource@datasift.com",
maintainer="DataSift",
maintainer_email="opensource@datasift.com",
description="The official DataSift API library for Python.",... | mit | 15a2340e2742eb686050d1aed9b186c1 | 30.571429 | 90 | 0.565611 | 3.437778 | false | false | false | false |
tooxie/shiva-server | tests/integration/resource-playlists-test.py | 2 | 7712 | # -*- coding: utf-8 -*-
from flask import json
from nose import tools as nose
from tests.integration.resource import ResourceTestCase
class PlaylistsResourceTestCase(ResourceTestCase):
"""
GET /playlists/ [user=<int>] [track=<int>]
200 OK
401 Unauthorized
POST /playlists/ name=<str>
... | mit | 9cb6e56752b226c77b83a98420a700cf | 32.530435 | 79 | 0.575467 | 3.491172 | false | true | false | false |
tooxie/shiva-server | shiva/resources/base.py | 1 | 17331 | # -*- coding: utf-8 -*-
from flask import current_app as app, g, request, url_for
from flask.ext.restful import abort, fields, marshal
from werkzeug.exceptions import NotFound
from shiva.auth import Roles
from shiva.constants import HTTP
from shiva.exceptions import (InvalidFileTypeError, IntegrityError,
... | mit | 80401c98d8b5e59e9fa9b1734099b744 | 28.984429 | 79 | 0.56096 | 4.115649 | false | false | false | false |
datasift/datasift-python | datasift/pylon_task.py | 1 | 3007 |
class PylonTask(object):
""" Represents the DataSift Pylon task 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('pylon')
def get(self, id, service='facebook', type='analy... | mit | 84796bc6e7fa6ffa6389cffa44bae6df | 38.565789 | 94 | 0.57865 | 4.515015 | false | false | false | false |
xgcm/xgcm | xgcm/gridops.py | 1 | 7534 | import numpy as np
from .grid_ufunc import as_grid_ufunc
"""
This module is intended to only contain "grid ufuncs".
(It is however fine to add other non-"grid ufunc" functions to this list, as xgcm.grid._select_grid_ufunc will ignore
anything that does not return an instance of the GridUFunc class.)
If adding a new... | mit | a47560916ee31389322a3d8da8b13272 | 26.003584 | 119 | 0.641757 | 2.768835 | false | false | false | false |
samuelcolvin/pydantic | pydantic/parse.py | 3 | 1810 | import json
import pickle
from enum import Enum
from pathlib import Path
from typing import Any, Callable, Union
from .types import StrBytes
class Protocol(str, Enum):
json = 'json'
pickle = 'pickle'
def load_str_bytes(
b: StrBytes,
*,
content_type: str = None,
encoding: str = 'utf8',
p... | mit | 5a106ce5026c853b921880c1786f46f7 | 26.424242 | 118 | 0.608287 | 3.810526 | false | false | false | false |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.