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 |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
globocom/database-as-a-service | dbaas/maintenance/admin/restart_database.py | 1 | 3427 | # -*- coding: utf-8 -*-
from __future__ import absolute_import, unicode_literals
from django.conf.urls import patterns, url
from django.contrib import messages
from django.core.urlresolvers import reverse
from django.http import HttpResponseRedirect
from django.shortcuts import get_object_or_404
from django.utils.html ... | bsd-3-clause | a8b4c2a4e9702254558be34745044dfe | 31.951923 | 79 | 0.583601 | 4.348985 | false | false | false | false |
globocom/database-as-a-service | dbaas/physical/migrations/0081_auto__chg_field_enginepatch_patch_version__chg_field_engine_major_vers.py | 1 | 26351 | # -*- 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):
# Changing field 'EnginePatch.patch_version'
db.alter_column(u'physical_... | bsd-3-clause | 8aac04b47754d82350342a1abc276894 | 90.5 | 227 | 0.567531 | 3.570596 | false | false | false | false |
globocom/database-as-a-service | dbaas/physical/migrations/0060_auto__add_field_host_identifier.py | 1 | 21469 | # -*- 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 'Host.identifier'
db.add_column(u'physical_host', 'identif... | bsd-3-clause | 671e77c424ac0e9766cbd8f3295c010c | 91.145923 | 227 | 0.565001 | 3.574592 | false | false | false | false |
globocom/database-as-a-service | dbaas/maintenance/admin/add_instances_to_database.py | 1 | 1619 | # -*- coding: utf-8 -*-
from __future__ import absolute_import, unicode_literals
from django.utils.html import format_html
from .database_maintenance_task import DatabaseMaintenanceTaskAdmin
class AddInstancesToDatabaseAdmin(DatabaseMaintenanceTaskAdmin):
list_filter = [
"database__team", "current_step",... | bsd-3-clause | 71fb2fe929374a24446d64dd6cc1cad8 | 38.487805 | 85 | 0.628783 | 3.756381 | false | false | false | false |
globocom/database-as-a-service | dbaas/system/tasks.py | 1 | 1030 | # -*- coding: utf-8 -*-
from dbaas.celery import app
from util.decorators import only_one
from models import CeleryHealthCheck
from notification.models import TaskHistory
from notification.tasks import get_worker_name
import logging
LOG = logging.getLogger(__name__)
@app.task(bind=True)
@only_one(key="celery_healthc... | bsd-3-clause | 0e17ee053ff1e3dc35e8052e22468f87 | 33.333333 | 76 | 0.679612 | 3.857678 | false | false | false | false |
globocom/database-as-a-service | dbaas/workflow/steps/util/disk.py | 1 | 4990 | # -*- coding: utf-8 -*-
import logging
from base import BaseInstanceStep
LOG = logging.getLogger(__name__)
class Disk(BaseInstanceStep):
OLD_DIRECTORY = '/data'
NEW_DIRECTORY = '/new_data'
@property
def is_valid(self):
return bool(self.instance.hostname.volumes.first())
@property
de... | bsd-3-clause | 99d043dcacc8ebb872ec9e878542570b | 23.10628 | 78 | 0.618437 | 4.037217 | false | false | false | false |
globocom/database-as-a-service | dbaas/logical/migrations/0026_auto__add_databaselock.py | 1 | 21078 | # -*- 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 model 'DatabaseLock'
db.create_table(u'logical_databaselock', (
... | bsd-3-clause | 372c6e7439015b34da8a8c4c34b90f22 | 89.467811 | 239 | 0.561913 | 3.561075 | false | false | false | false |
globocom/database-as-a-service | dbaas/dbaas_services/analyzing/models.py | 1 | 4398 | # -*- coding: utf-8 -*-
from django.db import models
from util.models import BaseModel
from django.utils.translation import ugettext_lazy as _
class AnalyzeRepository(BaseModel):
analyzed_at = models.DateTimeField(
verbose_name=_("Analyzed at"),
db_index=True
)
database_name = models.CharF... | bsd-3-clause | 49d1db96babaf2d99df2e810df9ab633 | 31.577778 | 79 | 0.607094 | 4.106443 | false | false | false | false |
globocom/database-as-a-service | dbaas/logical/migrations/0031_auto__add_field_credential_privileges.py | 1 | 27261 | # -*- 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 'Credential.privileges'
db.add_column(u'logical_credential... | bsd-3-clause | b91c3340d3acf02b295d060b01d2744a | 91.413559 | 227 | 0.558967 | 3.570063 | false | false | false | false |
globocom/database-as-a-service | dbaas/notification/tests/test_periodic_tasks/test_check_ssl_expire_at.py | 1 | 5994 | from django.test import TestCase
from mock import patch, MagicMock
from datetime import date, timedelta
from model_mommy import mommy
from physical.models import Instance
from dbaas.tests.helpers import InstanceHelper
from notification.tasks import check_ssl_expire_at
from maintenance.models import TaskSchedule
from ... | bsd-3-clause | 7d11806d3275f4129e86cd1b84334f49 | 37.670968 | 82 | 0.651318 | 3.897269 | false | true | false | false |
globocom/database-as-a-service | dbaas/maintenance/admin/database_maintenance_task.py | 1 | 2758 | # -*- coding: utf-8 -*-
from __future__ import absolute_import, unicode_literals
from django.contrib import admin
from django.core.urlresolvers import reverse
from django.utils.html import format_html
from ..models import DatabaseMaintenanceTask
class DatabaseMaintenanceTaskAdmin(admin.ModelAdmin):
list_select_re... | bsd-3-clause | d29a86660a30fb15a089eae1225175a6 | 36.27027 | 83 | 0.650471 | 4.079882 | false | false | false | false |
globocom/database-as-a-service | dbaas/account/forms/change_password_form.py | 1 | 1727 | # -*- coding:utf-8 -*-
from django import forms
from django.utils.translation import ugettext, ugettext_lazy as _
from ..backends import DbaasBackend
import ldap
class ChangePasswordForm(forms.Form):
"""
A form that lets a user change set his/her password without entering the
old password
"""
err... | bsd-3-clause | 73e0e46252a830b26b7a4919326d54be | 34.979167 | 76 | 0.585987 | 4.520942 | false | false | false | false |
globocom/database-as-a-service | dbaas/physical/ssh.py | 1 | 5956 | import socket
import logging
from time import sleep
from StringIO import StringIO
from uuid import uuid4
from io import BytesIO
import paramiko
LOG = logging.getLogger(__name__)
def connect_host(func):
def wrapper(self, *args, **kw):
# try:
# self.connect()
# return func(self, *... | bsd-3-clause | 62580d3f6c7ac03eb187bdbe2b71658c | 29.233503 | 77 | 0.524009 | 4.312817 | false | false | false | false |
globocom/database-as-a-service | dbaas/physical/migrations/0050_auto__add_field_plan_migrate_plan.py | 1 | 16854 | # -*- 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 'Plan.migrate_plan'
db.add_column(u'physical_plan', 'migra... | bsd-3-clause | 1359aa12fb81c09d0c63f21b02b10aff | 89.13369 | 227 | 0.56408 | 3.56246 | false | false | false | false |
globocom/database-as-a-service | dbaas/dbaas/middleware.py | 1 | 1390 | from datetime import datetime, timedelta
from threading import current_thread
from django.conf import settings
from django.contrib import auth
class AutoLogout:
def process_request(self, request):
if not request.user.is_authenticated():
return
if 'last_touch' in request.session:
... | bsd-3-clause | 424f73427879245b247ec6831743229d | 27.958333 | 77 | 0.646763 | 4.34375 | false | false | false | false |
globocom/database-as-a-service | dbaas/extra_dns/models.py | 1 | 1790 | # -*- coding: utf-8 -*-
from django.db import models
from django.utils.translation import ugettext_lazy as _
from util.models import BaseModel
from django.db.models.signals import post_delete, post_save
from django.dispatch import receiver
from dbaas_dbmonitor.provider import DBMonitorProvider
import logging
LOG = lo... | bsd-3-clause | f81669645bc9bd4c31e1edb04013f3f8 | 28.833333 | 81 | 0.641341 | 3.986637 | false | false | false | false |
globocom/database-as-a-service | dbaas/notification/admin/task_history.py | 1 | 3225 | # -*- coding: utf-8 -*-
from __future__ import absolute_import, unicode_literals
from django.contrib import admin
from django.utils.translation import ugettext_lazy as _
import logging
from ..models import TaskHistory
from dbaas import constants
from account.models import Team
LOG = logging.getLogger(__name__)
clas... | bsd-3-clause | 86e41c5ea0330363bfc1122359f755a6 | 36.941176 | 120 | 0.633488 | 3.758741 | false | false | false | false |
globocom/database-as-a-service | dbaas/maintenance/migrations/0026_auto__chg_field_databasecreate_plan__chg_field_databaseupgrade_target_.py | 1 | 44564 | # -*- 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):
# Changing field 'DatabaseCreate.plan'
db.alter_column(u'maintenance_dat... | bsd-3-clause | 10524a51f3c41fa5008c3026dbf9af9b | 94.83871 | 227 | 0.569092 | 3.576278 | false | false | false | false |
globocom/database-as-a-service | dbaas/physical/migrations/0021_auto__add_field_engine_engine_upgrade_option.py | 1 | 9942 | # -*- 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 'Engine.engine_upgrade_option'
db.add_column(u'physical_en... | bsd-3-clause | c5652bd7e22423d98b68ec073eb02dba | 81.858333 | 227 | 0.564474 | 3.567277 | false | false | false | false |
globocom/database-as-a-service | dbaas/maintenance/migrations/0027_auto__add_field_databaseresize_source_offer_name__add_field_databasere.py | 1 | 45919 | # -*- 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 'DatabaseResize.source_offer_name'
db.add_column(u'mainten... | bsd-3-clause | dc8243eb20163d65cfee4efa29ed62e1 | 93.680412 | 227 | 0.571267 | 3.596695 | false | false | false | false |
globocom/database-as-a-service | dbaas/account/migrations/0009_auto__add_roleenvironment.py | 1 | 9522 | # -*- 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 model 'RoleEnvironment'
db.create_table(u'account_roleenvironmen... | bsd-3-clause | 0a42b33400bb419daba24257b65cc24b | 73.984252 | 195 | 0.573199 | 3.639908 | false | false | false | false |
globocom/database-as-a-service | dbaas/physical/migrations/0051_auto__add_topologyparametercustomvalue__add_unique_topologyparametercu.py | 1 | 18812 | # -*- 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 model 'TopologyParameterCustomValue'
db.create_table(u'physical_... | bsd-3-clause | 3a00217dfd1a9edc7814ad89e69a2d10 | 89.447115 | 227 | 0.574314 | 3.597629 | false | false | false | false |
globocom/database-as-a-service | dbaas/maintenance/migrations/0020_auto__add_databasechangeparameter.py | 1 | 34232 | # -*- 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 model 'DatabaseChangeParameter'
db.create_table(u'maintenance_da... | bsd-3-clause | 6ef15fbd259e8ebcc7f723741acf7331 | 92.024457 | 227 | 0.566166 | 3.589389 | false | false | false | false |
globocom/database-as-a-service | dbaas/util/tests/test_email_notification/test_disk_resize.py | 1 | 3000 | from __future__ import absolute_import
from django.contrib.sites.models import Site
from django.core import mail
from model_mommy import mommy
from util.email_notifications import get_domain, email_from, email_to, \
disk_resize_notification
from .base import EmailBaseTest
from physical.models import DiskOffering
... | bsd-3-clause | afc7aaf62d721188e899bf74409b92ba | 29.612245 | 72 | 0.623667 | 3.708282 | false | true | false | false |
globocom/database-as-a-service | dbaas/api/zabbix_disk_size_alert.py | 1 | 3347 | # encoding: utf-8
from __future__ import absolute_import, unicode_literals
import logging
from rest_framework.authentication import BasicAuthentication
from rest_framework.permissions import IsAuthenticated
from rest_framework import views, serializers, status, permissions
from rest_framework.response import Response... | bsd-3-clause | b56ab3c380ded7868105374f86923764 | 37.45977 | 112 | 0.679617 | 4.230088 | false | false | false | false |
globocom/database-as-a-service | dbaas/physical/migrations/0048_auto__del_field_parameter_class_path__add_field_parameter_custom_metho.py | 1 | 16826 | # -*- 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):
# Deleting field 'Parameter.class_path'
db.delete_column(u'physical_param... | bsd-3-clause | 2bac97b70f30ca48d3b4f4c351f3f8dc | 86.186528 | 227 | 0.564305 | 3.583049 | false | false | false | false |
globocom/database-as-a-service | dbaas/backup/migrations/0011_auto__del_field_snapshot_identifier__del_field_snapshot_export_path.py | 1 | 22033 | # -*- 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):
# Deleting field 'Snapshot.identifier'
db.delete_column(u'backup_snapshot... | bsd-3-clause | a64a643d6dbf6ea741549452c4ce180e | 90.808333 | 227 | 0.561113 | 3.551991 | false | false | false | false |
wal-e/wal-e | wal_e/worker/prefetch.py | 3 | 6196 | """Manage WAL-prefetching
Normally, wal-fetch executed by Postgres, and then subsequently
Postgres replays the WAL segment. These are not pipelined, so the
time spent recovering is not also spent downloading more WAL.
Prefetch provides better performance by speculatively downloading WAL
segments in advance.
"""
im... | bsd-3-clause | d410f2cda0a92ec793c3c4a15ec59bf4 | 30.938144 | 78 | 0.570852 | 4.369535 | false | false | false | false |
wal-e/wal-e | setup.py | 1 | 1996 | #!/usr/bin/env python
import os.path
import sys
# Version file managment scheme and graceful degredation for
# setuptools borrowed and adapted from GitPython.
try:
from setuptools import setup, find_packages
# Silence pyflakes
assert setup
assert find_packages
except ImportError:
from ez_setup imp... | bsd-3-clause | 7fd44fb2f5fa156df1dc5c2809eec19b | 28.352941 | 77 | 0.634269 | 3.696296 | false | false | false | false |
wal-e/wal-e | wal_e/blobstore/wabs/calling_format.py | 1 | 1087 | from azure.storage.blob.blockblobservice import BlockBlobService
from wal_e import log_help
logger = log_help.WalELogger(__name__)
# WABS connection requirements are not quite this same as those of
# S3 and so this class is overkill. Implementing for the sake of
# consistency only
class CallingInfo(object):
"""E... | bsd-3-clause | 965c178fa695e3faca8cd5626862feaf | 30.057143 | 70 | 0.642134 | 4.213178 | false | false | false | false |
wal-e/wal-e | wal_e/worker/upload_pool.py | 13 | 3971 | import gc
import gevent
from wal_e import channel
from wal_e import tar_partition
from wal_e.exception import UserCritical
class TarUploadPool(object):
def __init__(self, uploader, max_concurrency,
max_members=tar_partition.PARTITION_MAX_MEMBERS):
# Injected upload mechanism
self... | bsd-3-clause | 1c0a5b1e961a5162072e928aead450d4 | 32.091667 | 73 | 0.564341 | 4.77858 | false | false | false | false |
wal-e/wal-e | wal_e/log_help.py | 3 | 6037 | """
A module to assist with using the Python logging module
"""
import datetime
import errno
import logging
import os
from logging import handlers
from os import path
# Global logging handlers created by configure.
HANDLERS = []
class IndentFormatter(logging.Formatter):
def format(self, record, *args, **kwar... | bsd-3-clause | a64b57c03c8d4c0299779d346ec079bd | 27.611374 | 78 | 0.599636 | 3.998013 | false | false | false | false |
mozilla/zamboni | mkt/site/models.py | 5 | 11210 | import contextlib
import threading
from django.db import models, transaction
from django.utils import translation
import multidb.pinning
from mkt.translations.hold import save_translations
_locals = threading.local()
class TransformQuerySet(models.query.QuerySet):
def __init__(self, *args, **kwargs):
... | bsd-3-clause | a052b48ca21edd85519052ff149bdf5d | 31.492754 | 79 | 0.59554 | 4.127393 | false | false | false | false |
mozilla/zamboni | mkt/stats/views.py | 6 | 13229 | from django import http
import commonware
import requests
from rest_framework.exceptions import ParseError
from rest_framework.generics import ListAPIView
from rest_framework.permissions import AllowAny, BasePermission
from rest_framework.response import Response
from rest_framework.views import APIView
import mkt
fr... | bsd-3-clause | 9fed36a72ac5fd728d41d034141da9ba | 31.664198 | 79 | 0.564366 | 4.140532 | false | false | false | false |
mozilla/zamboni | mkt/abuse/models.py | 1 | 1424 | import logging
from django.db import models
from mkt.extensions.models import Extension
from mkt.site.models import ModelBase
from mkt.users.models import UserProfile
from mkt.webapps.models import Webapp
from mkt.websites.models import Website
log = logging.getLogger('z.abuse')
class AbuseReport(ModelBase):
... | bsd-3-clause | 5e62d0aedb3dcdfd171249156b233af6 | 33.731707 | 78 | 0.66573 | 3.955556 | false | false | false | false |
mozilla/zamboni | mkt/versions/models.py | 7 | 12033 | # -*- coding: utf-8 -*-
import datetime
import json
import os
import django.dispatch
from django.conf import settings
from django.core.exceptions import ObjectDoesNotExist
from django.db import models
import commonware.log
import jinja2
import mkt
from mkt.files import utils
from mkt.files.models import cleanup_file... | bsd-3-clause | 8523b877569edb5564a55f84be68634c | 34.600592 | 79 | 0.62794 | 4.046066 | false | false | false | false |
mozilla/zamboni | mkt/developers/urls.py | 2 | 6621 | from django import http
from django.conf.urls import include, patterns, url
from django.core.urlresolvers import reverse
from rest_framework.routers import SimpleRouter
import mkt
from lib.misc.urlconf_decorator import decorate
from mkt.api.base import SubRouter
from mkt.developers.api_payments import (PaymentCheckVi... | bsd-3-clause | a6f11f554b6ee185bca4b02d9291f96e | 39.87037 | 78 | 0.652923 | 3.571197 | false | false | false | false |
mozilla/zamboni | mkt/reviewers/forms.py | 5 | 8951 | import logging
from datetime import timedelta
from django import forms
from django.forms import widgets
import happyforms
from django.utils.translation import ugettext as _
from django.utils.translation import ugettext_lazy as _lazy
import mkt
from mkt.api.forms import CustomNullBooleanSelect
from mkt.reviewers.mode... | bsd-3-clause | 513221adf1649b2a5b5016cb6e3f90da | 37.252137 | 79 | 0.62183 | 3.934505 | false | false | false | false |
mozilla/zamboni | mkt/comm/migrations/0002_auto_20150727_1017.py | 13 | 1816 | # -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.db import models, migrations
from django.conf import settings
class Migration(migrations.Migration):
dependencies = [
('comm', '0001_initial'),
migrations.swappable_dependency(settings.AUTH_USER_MODEL),
('version... | bsd-3-clause | 7b0599d3bccdb9add63c78c9d708fb40 | 33.923077 | 119 | 0.587004 | 4.483951 | false | false | false | false |
mozilla/zamboni | mkt/comm/forms.py | 6 | 2760 | from django import forms
from django.conf import settings
from django.forms import ValidationError
import happyforms
from jinja2.filters import do_filesizeformat
from django.utils.translation import ugettext as _, ugettext_lazy as _lazy
from mkt.api.forms import SluggableModelChoiceField
from mkt.comm.models import C... | bsd-3-clause | 668322fb85e7fc2685b111d04fa92cba | 36.297297 | 79 | 0.681159 | 4.08284 | false | false | false | false |
mozilla/zamboni | mkt/abuse/tests/test_views.py | 1 | 6887 | # -*- coding: utf-8 -*-
import json
from django.core.urlresolvers import reverse
from django.utils.http import urlencode
from nose.tools import eq_
from mkt.abuse.models import AbuseReport
from mkt.api.tests.test_oauth import RestOAuth
from mkt.constants.base import STATUS_PUBLIC
from mkt.extensions.models import Ex... | bsd-3-clause | 83c62412498e36f6810da97bdade5514 | 31.947368 | 77 | 0.588295 | 3.796031 | false | true | false | false |
mozilla/zamboni | mkt/feed/constants.py | 19 | 2421 | FEEDAPP_ICON = 'icon'
FEEDAPP_IMAGE = 'image'
FEEDAPP_DESC = 'description'
FEEDAPP_QUOTE = 'quote'
FEEDAPP_PREVIEW = 'preview'
FEEDAPP_TYPES = (
FEEDAPP_ICON,
FEEDAPP_IMAGE,
FEEDAPP_DESC,
FEEDAPP_QUOTE,
FEEDAPP_PREVIEW,
)
FEEDAPP_TYPE_CHOICES = [(c, c) for c in FEEDAPP_TYPES]
# Editorial Brand type... | bsd-3-clause | 95390eddd28c2ac6745cd6216f8e3d63 | 22.057143 | 77 | 0.638579 | 2.684035 | false | false | false | false |
mozilla/zamboni | mkt/regions/middleware.py | 16 | 2541 | from django.conf import settings
import commonware.log
from django_statsd.clients import statsd
from lib.geoip import GeoIP
import mkt
from mkt.regions.utils import parse_region
log = commonware.log.getLogger('mkt.regions')
class RegionMiddleware(object):
"""Figure out the user's region and set request.REGION... | bsd-3-clause | 75f5027ddad0650e878b47cd9b783d18 | 36.925373 | 79 | 0.639906 | 4.007886 | false | false | false | false |
mozilla/zamboni | mkt/access/acl.py | 5 | 3138 | import mkt
def match_rules(rules, app, action):
"""
This will match rules found in Group.
"""
for rule in rules.split(','):
rule_app, rule_action = rule.split(':')
if rule_app == '*' or rule_app == app:
if (rule_action == '*' or
rule_action == action or
... | bsd-3-clause | 9c93519e5474039f69f0bfa1157528ea | 33.483516 | 77 | 0.603888 | 4.156291 | false | false | false | false |
mozilla/zamboni | mkt/webapps/decorators.py | 17 | 1686 | import functools
from django.core.exceptions import PermissionDenied
from django.shortcuts import get_object_or_404
import commonware.log
from mkt.webapps.models import Webapp
log = commonware.log.getLogger('mkt.purchase')
def has_purchased(f):
"""
If the addon is premium, require a purchase.
Must be... | bsd-3-clause | 30b7d73499befe79c2d6bee2803ee530 | 28.068966 | 79 | 0.652432 | 3.594883 | false | false | false | false |
mozilla/zamboni | mkt/inapp/tests/test_serializers.py | 20 | 2406 | import mock
from nose.tools import eq_, ok_
from requests.exceptions import RequestException
from mkt.inapp.serializers import InAppProductSerializer
from .test_views import BaseInAppProductViewSetTests
class TestInAppProductSerializer(BaseInAppProductViewSetTests):
def post(self, **kw):
if 'data' not ... | bsd-3-clause | 7c7f87bbba5a58a409f7fd34a5a51e44 | 32.416667 | 67 | 0.62926 | 3.701538 | false | true | false | false |
mozilla/zamboni | mkt/constants/search.py | 19 | 2850 | # These two dicts are mapping between language codes in zamboni and language
# analyzers in elasticsearch.
#
# Each key value of ANALYZER_MAP is language analyzer supported by
# elasticsearch. See
# http://www.elasticsearch.org/guide/reference/index-modules/analysis/lang-analyzer.html
#
# Each value of ANALYZER_MAP is... | bsd-3-clause | 281a3d2a02ee3e5a47a3ae4cd71f27a0 | 29 | 88 | 0.592632 | 3.054662 | false | false | false | false |
mozilla/zamboni | mkt/translations/query.py | 5 | 5302 | import itertools
from django.conf import settings
from django.db import models
from django.db.models.sql.compiler import SQLCompiler
from django.db.models.sql.constants import LOUTER
from django.db.models.sql.datastructures import Join
from django.utils import translation as translation_utils
def order_by_translatio... | bsd-3-clause | 34af71d106180155a14e009be704b430 | 39.473282 | 79 | 0.631648 | 3.853198 | false | false | false | false |
mozilla/zamboni | mkt/site/helpers.py | 3 | 12157 | import json as jsonlib
import pytz
from urlparse import urljoin
from django.conf import settings
from django.core.urlresolvers import reverse
from django.forms import CheckboxInput
from django.template import defaultfilters
from django.utils import translation
from django.utils.encoding import smart_unicode
import co... | bsd-3-clause | 98fcb7e95a87ffd69b5c8e0604c37986 | 29.85533 | 79 | 0.643169 | 3.665059 | false | false | false | false |
mozilla/zamboni | mkt/receipts/utils.py | 20 | 5995 | import calendar
import time
from urllib import urlencode
from django.conf import settings
from django.core.exceptions import ObjectDoesNotExist
from django.core.urlresolvers import reverse
import jwt
from nose.tools import nottest
from receipts.receipts import Receipt
from lib.crypto import receipt
from lib.utils im... | bsd-3-clause | 04d280d7488d62a9a7be8130618fc508 | 32.305556 | 76 | 0.608841 | 3.931148 | false | false | false | false |
mozilla/zamboni | mkt/webapps/management/commands/list_packaged_apps.py | 18 | 1152 | from optparse import make_option
from django.core.exceptions import ObjectDoesNotExist
from django.core.management.base import BaseCommand
import mkt
from mkt.files.models import File
HELP = 'List all Marketplace packaged apps'
statuses = {'pending': mkt.STATUS_PENDING,
'public': mkt.STATUS_PUBLIC,
... | bsd-3-clause | 6d03b1c6880f36c93d86bd940d973b77 | 23.510638 | 69 | 0.598958 | 4.314607 | false | false | false | false |
gitpython-developers/gitpython | git/objects/tree.py | 2 | 14228 | # tree.py
# Copyright (C) 2008, 2009 Michael Trier (mtrier@gmail.com) and contributors
#
# This module is part of GitPython and is released under
# the BSD License: http://www.opensource.org/licenses/bsd-license.php
from git.util import IterableList, join_path
import git.diff as git_diff
from git.util import to_bin_sh... | bsd-3-clause | 95a14f50a2c6375c5622a2c34ee22d92 | 32.71564 | 114 | 0.569651 | 3.856872 | false | false | false | false |
gitpython-developers/gitpython | test/test_exc.py | 2 | 5255 | # -*- coding: utf-8 -*-
# test_exc.py
# Copyright (C) 2008, 2009, 2016 Michael Trier (mtrier@gmail.com) and contributors
#
# This module is part of GitPython and is released under
# the BSD License: http://www.opensource.org/licenses/bsd-license.php
import re
import ddt
from git.exc import (
InvalidGitRepository... | bsd-3-clause | 068e4b8e9dc5a1d72dc860a6d3382561 | 27.624309 | 90 | 0.545262 | 3.541353 | false | true | false | false |
gitpython-developers/gitpython | git/util.py | 2 | 39858 | # utils.py
# Copyright (C) 2008, 2009 Michael Trier (mtrier@gmail.com) and contributors
#
# This module is part of GitPython and is released under
# the BSD License: http://www.opensource.org/licenses/bsd-license.php
from abc import abstractmethod
import os.path as osp
from .compat import is_win
import contextlib
from... | bsd-3-clause | 85c6d99aa2d44495807d4e50d43fdea5 | 32.049751 | 120 | 0.586984 | 3.936981 | false | false | false | false |
gitpython-developers/gitpython | git/objects/util.py | 2 | 22234 | # util.py
# Copyright (C) 2008, 2009 Michael Trier (mtrier@gmail.com) and contributors
#
# This module is part of GitPython and is released under
# the BSD License: http://www.opensource.org/licenses/bsd-license.php
"""Module for general utility functions"""
# flake8: noqa F401
from abc import ABC, abstractmethod
imp... | bsd-3-clause | 468ea18ea4be458e4d2f0011bfbc4b52 | 34.124803 | 120 | 0.58442 | 3.939405 | false | false | false | false |
gitpython-developers/gitpython | git/objects/tag.py | 2 | 3840 | # objects.py
# Copyright (C) 2008, 2009 Michael Trier (mtrier@gmail.com) and contributors
#
# This module is part of GitPython and is released under
# the BSD License: http://www.opensource.org/licenses/bsd-license.php
""" Module containing all object based types. """
from . import base
from .util import get_object_typ... | bsd-3-clause | 16ca98bf1800a596b1f1310c30ef4a1d | 34.88785 | 97 | 0.583854 | 3.88664 | false | false | false | false |
cqlengine/cqlengine | cqlengine/models.py | 1 | 30054 | from collections import OrderedDict
import re
import warnings
from cqlengine import columns
from cqlengine.exceptions import ModelException, CQLEngineException, ValidationError
from cqlengine.query import ModelQuerySet, DMLQuery, AbstractQueryableColumn, NOT_SET
from cqlengine.query import DoesNotExist as _DoesNotExis... | bsd-3-clause | e2a7a81acdd459976404e6b31ba1cb12 | 34.357647 | 142 | 0.596327 | 4.501123 | false | false | false | false |
cqlengine/cqlengine | cqlengine/statements.py | 2 | 26897 | import time
from datetime import datetime, timedelta
import six
from cqlengine.functions import QueryValue
from cqlengine.operators import BaseWhereOperator, InOperator
class StatementException(Exception): pass
import sys
class UnicodeMixin(object):
if sys.version_info > (3, 0):
__str__ = lambda x: x.... | bsd-3-clause | d5f9b44ffb742bbcdf6bd6dd19be2e73 | 31.921665 | 118 | 0.563557 | 4.163622 | false | false | false | false |
datarobot/batch-scoring | datarobot_batch_scoring/consts.py | 1 | 1361 | import collections
Batch = collections.namedtuple('Batch', 'id rows fieldnames data rty_cnt')
SENTINEL = Batch(-1, 0, None, '', -1)
ERROR_SENTINEL = Batch(-1, 1, None, '', -1)
REPORT_INTERVAL = 5
DEPRECATION_WARNING = (
'{yellow}{bold}Deprecation Warning!{reset} '
'The Batch Scoring script is deprecated. It ... | bsd-3-clause | c0a192681db3f75e80d4f6e2a59b0783 | 27.354167 | 75 | 0.656135 | 3.179907 | false | false | false | false |
datarobot/batch-scoring | datarobot_batch_scoring/network/dry_run.py | 1 | 2708 | import collections
import logging
import signal
from concurrent.futures import FIRST_COMPLETED
from concurrent.futures import wait
from datarobot_batch_scoring.consts import (SENTINEL)
from six.moves import queue
from .base_network_worker import BaseNetworkWorker
logger = logging.getLogger(__name__)
FakeResponse =... | bsd-3-clause | 253340bc232407a79ad2f6dc12415fdb | 30.858824 | 76 | 0.50517 | 4.367742 | false | false | false | false |
altair-viz/altair | altair/examples/interactive_cross_highlight.py | 1 | 1231 | """
Interactive Chart with Cross-Highlight
======================================
This example shows an interactive chart where selections in one portion of
the chart affect what is shown in other panels. Click on the bar chart to
see a detail of the distribution in the upper panel.
"""
# category: interactive charts
i... | bsd-3-clause | 89d70b3929cf3c7068808b971a6db955 | 24.122449 | 81 | 0.652315 | 3.409972 | false | false | true | false |
altair-viz/altair | altair/sphinxext/altairgallery.py | 1 | 9580 | import hashlib
import os
import json
import random
import collections
from operator import itemgetter
import warnings
import jinja2
from docutils import nodes
from docutils.statemachine import ViewList
from docutils.parsers.rst import Directive
from docutils.parsers.rst.directives import flag
from sphinx.util.nodes ... | bsd-3-clause | 4746edfae221b71d81760ba26cdd80bb | 29.125786 | 191 | 0.590084 | 3.782077 | false | false | false | false |
altair-viz/altair | altair/utils/data.py | 2 | 8047 | import json
import os
import random
import hashlib
import warnings
import pandas as pd
from toolz import curried
from typing import Callable
from .core import sanitize_dataframe
from .core import sanitize_geo_interface
from .deprecation import AltairDeprecationWarning
from .plugin_registry import PluginRegistry
# =... | bsd-3-clause | 80c1d061e340a00aa0bfbe2b021c4cff | 31.979508 | 88 | 0.607431 | 4.135149 | false | false | false | false |
altair-viz/altair | altair/examples/ridgeline_plot.py | 1 | 1593 | """
Ridgeline plot
--------------
A `Ridgeline plot <https://serialmentor.com/blog/2017/9/15/goodbye-joyplots>`_
chart is a chart that lets you visualize distribution of a numeric value for
several groups.
Such a chart can be created in Altair by first transforming the data into a
suitable representation.
"""
# categ... | bsd-3-clause | 1858f1b4b45f229c7bfa527fba1294af | 24.285714 | 78 | 0.642185 | 3.237805 | false | false | true | false |
altair-viz/altair | altair/vega/v5/schema/core.py | 1 | 115906 | # The contents of this file are automatically written by
# tools/generate_schema_wrapper.py. Do not modify directly.
from altair.utils.schemapi import SchemaBase, Undefined, _subclasses
import pkgutil
import json
def load_schema():
"""Load the json schema associated with this module's functions"""
return jso... | bsd-3-clause | 6a4195d6e708eb79e8d0a1ff315a8caf | 32.239461 | 105 | 0.614731 | 4.026191 | false | false | false | false |
altair-viz/altair | altair/examples/candlestick_chart.py | 1 | 1251 | """
Candlestick Chart
=================
A candlestick chart inspired from `Protovis <http://mbostock.github.io/protovis/ex/candlestick.html>`_.
This example shows the performance of the Chicago Board Options Exchange `Volatility Index <https://en.wikipedia.org/wiki/VIX>`_ (VIX)
in the summer of 2009. The thick bar re... | bsd-3-clause | 6d7728a71e56b0ca74e20870c007dfb7 | 27.454545 | 141 | 0.603517 | 3.446281 | false | false | false | false |
altair-viz/altair | altair/examples/scatter_linked_table.py | 1 | 1360 | """
Brushing Scatter Plot to Show Data on a Table
---------------------------------------------
A scatter plot of the cars dataset, with data tables for horsepower, MPG, and origin.
The tables update to reflect the selection on the scatter plot.
"""
# category: scatter plots
import altair as alt
from vega_da... | bsd-3-clause | 23d787449c468072785ca7e8e24066ee | 25.755102 | 86 | 0.663971 | 3.126437 | false | false | false | false |
altair-viz/altair | altair/examples/select_detail.py | 1 | 1911 | """
Selection Detail
================
This example shows a selection that links two views of data: the left panel
contains one point per object, and the right panel contains one line per
object. Clicking on either the points or lines will select the corresponding
objects in both views of the data.
The challenge lies i... | bsd-3-clause | dbddfdbf822a587a899399b33d709a99 | 28.4 | 79 | 0.688645 | 3.443243 | false | false | false | false |
altair-viz/altair | altair/vegalite/v4/schema/core.py | 2 | 973217 | # The contents of this file are automatically written by
# tools/generate_schema_wrapper.py. Do not modify directly.
from altair.utils.schemapi import SchemaBase, Undefined, _subclasses
import pkgutil
import json
def load_schema():
"""Load the json schema associated with this module's functions"""
return jso... | bsd-3-clause | ca54c4686c1be0eeb6a7f55202a9e142 | 47.884853 | 118 | 0.623998 | 4.136145 | false | false | false | false |
mozilla/badges.mozilla.org | scripts/peep.py | 4 | 31176 | #!/usr/bin/env python
"""peep ("prudently examine every package") verifies that packages conform to a
trusted, locally stored hash and only then installs them::
peep install -r requirements.txt
This makes your deployments verifiably repeatable without having to maintain a
local PyPI mirror or use a vendor lib. Ju... | bsd-3-clause | f978abde1c75b2b45cb59884e7a21005 | 35.807556 | 157 | 0.609892 | 4.240479 | false | false | false | false |
alphacsc/alphacsc | benchmarks/function_benchmarks/convolve_ztz.py | 1 | 4302 | import time
import numba
import numpy as np
import pandas as pd
from joblib import Memory
import matplotlib.pyplot as plt
from scipy.stats.mstats import gmean
memory = Memory(location='', verbose=0)
@numba.jit((numba.float64[:, :, :], numba.float64[:, :]), cache=True)
def numpy_convolve_uv(ztz, uv):
"""Compute... | bsd-3-clause | 9f88a5aa7164c21c8ba0265323afcd0c | 26.056604 | 79 | 0.54556 | 3.00419 | false | false | false | false |
alphacsc/alphacsc | alphacsc/init_dict.py | 1 | 7413 | # Authors: Mainak Jas <mainak.jas@telecom-paristech.fr>
# Tom Dupre La Tour <tom.duprelatour@telecom-paristech.fr>
# Umut Simsekli <umut.simsekli@telecom-paristech.fr>
# Alexandre Gramfort <alexandre.gramfort@inria.fr>
# Thomas Moreau <thomas.moreau@inria.fr>
import numpy as np
from... | bsd-3-clause | da3e851ef1211daeb365c9d432af5d14 | 32.542986 | 79 | 0.605423 | 3.565657 | false | false | false | false |
alphacsc/alphacsc | examples/other/plot_simulate_swm.py | 1 | 3342 | """
=====================
SWM on simulated data
=====================
This example shows how the sliding window method (SWM) [1]
works on simulated data. The code is adapted from the
`neurodsp package <https://github.com/voytekresearch/neurodsp/>`_
from Voytek lab. Note that, at present, it does not
implement parallel... | bsd-3-clause | b92993429a6d8a53eccdb9803c8fa6bf | 35.326087 | 79 | 0.5383 | 3.908772 | false | false | false | false |
alphacsc/alphacsc | alphacsc/utils/convolution.py | 1 | 7825 | """Convolutional utilities for dictionary learning"""
# Authors: Thomas Moreau <thomas.moreau@inria.fr>
# Mainak Jas <mainak.jas@telecom-paristech.fr>
# Tom Dupre La Tour <tom.duprelatour@telecom-paristech.fr>
# Umut Simsekli <umut.simsekli@telecom-paristech.fr>
# Alexandre Gramfort... | bsd-3-clause | 89be8df55c889c3cc191ecf42aa3a535 | 29.686275 | 79 | 0.562684 | 2.876838 | false | false | false | false |
alphacsc/alphacsc | alphacsc/viz/epoch.py | 1 | 4256 | from copy import deepcopy
import mne
import numpy as np
from joblib import Parallel, delayed
def make_epochs(z_hat, info, t_lim, n_times_atom=1):
"""Make Epochs on the activations of atoms.
n_splits, n_atoms, n_times_valid = z_hat.shape
n_trials, n_atoms, n_times_epoch = z_hat_epoch.shape
"""
n_s... | bsd-3-clause | 022425eddd4fa5c3a8f32c4921aa8073 | 38.045872 | 79 | 0.624295 | 3.120235 | false | false | false | false |
alphacsc/alphacsc | benchmarks/scaling_channels_run.py | 1 | 7608 | """Benchmark the scaling of alphacsc algorithm with multiple channels.
This script needs the following packages:
conda install pandas
conda install -c conda-forge pyfftw
This script performs the computations and save the results in a pickled file
`figures/methods_scaling_reg*.pkl` which can be plotted using
`... | bsd-3-clause | de6dd03c54a25a3427ffa7d799fda612 | 35.228571 | 77 | 0.616062 | 3.336842 | false | false | false | false |
alphacsc/alphacsc | benchmarks/function_benchmarks/multivariate_convolve.py | 1 | 6979 | import time
import numba
import numpy as np
import pandas as pd
from joblib import Memory
import matplotlib.pyplot as plt
from scipy.signal import fftconvolve
from scipy.stats.mstats import gmean
memory = Memory(location='', verbose=0)
def scipy_fftconvolve(ztz, D):
"""
ztz.shape = n_atoms, n_atoms, 2 * n_t... | bsd-3-clause | cab04915509582fe3a7d844e10ce7976 | 27.369919 | 79 | 0.536037 | 2.949704 | false | false | false | false |
mozilla/badges.mozilla.org | badger/migrations/0001_initial.py | 10 | 11026 | # encoding: 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 model 'Badge'
db.create_table('badger_badge', (
('id', self.gf('django.db.models.fiel... | bsd-3-clause | f784b41c96c5c0dcd117a9de819d2b6f | 67.484472 | 182 | 0.57446 | 3.641347 | false | false | false | false |
aparo/pyes | docs/conf.py | 9 | 2564 | # -*- coding: utf-8 -*-
import sys
import os
# If your extensions are in another directory, add it here. If the directory
# is relative to the documentation root, use os.path.abspath to make it
# absolute, like shown here.
currpath = os.path.dirname(os.path.abspath(__file__))
pyespath = os.path.join(currpath, "pyes")... | bsd-3-clause | be7ae7216fd8c89abc607cf8a09e34ec | 29.891566 | 80 | 0.721139 | 3.657632 | false | false | false | false |
aparo/pyes | pyes/tests.py | 1 | 5813 | # -*- coding: utf-8 -*-
from __future__ import absolute_import
import os
import logging
import unittest
from pprint import pprint
from pyes.es import ES
from pyes.helpers import SettingsBuilder
"""
Unit tests for pyes.
"""
def get_conn(*args, **kwargs):
return ES(("http", "127.0.0.1", 9200), *args, **kwargs)
... | bsd-3-clause | 98f25d644ea8226b2200b2424a16953b | 33.194118 | 115 | 0.584208 | 3.716752 | false | true | false | false |
aparo/pyes | pyes/scriptfields.py | 6 | 1947 | # -*- coding: utf-8 -*-
from __future__ import absolute_import
from .exceptions import ScriptFieldsError
class ScriptField(object):
def __init__(self, script, lang="mvel", params=None, ignore_failure=False):
self.script = script
self.lang = lang
self.params = params
self.ignore_fa... | bsd-3-clause | ab1e678218c9135141e601e5c7f1c113 | 30.403226 | 114 | 0.588598 | 4.298013 | false | false | false | false |
mne-tools/mne-python | tutorials/epochs/30_epochs_metadata.py | 9 | 6938 | # -*- coding: utf-8 -*-
"""
.. _tut-epochs-metadata:
===========================
Working with Epoch metadata
===========================
This tutorial shows how to add metadata to `~mne.Epochs` objects, and
how to use :ref:`Pandas query strings <pandas:indexing.query>` to select and
plot epochs based on metadata prop... | bsd-3-clause | df8c6e3d538744d0691dcc365d3fd952 | 38.420455 | 79 | 0.71375 | 3.645822 | false | false | false | false |
mne-tools/mne-python | mne/tests/test_cov.py | 3 | 36001 | # Author: Alexandre Gramfort <alexandre.gramfort@inria.fr>
# Denis Engemann <denis.engemann@gmail.com>
#
# License: BSD-3-Clause
import os.path as op
import itertools as itt
import sys
from inspect import signature
from numpy.testing import (assert_array_almost_equal, assert_array_equal,
... | bsd-3-clause | 669d705e1eb03d21fc18661ccb100bed | 41.960621 | 79 | 0.615872 | 3.288063 | false | true | false | false |
mne-tools/mne-python | examples/time_frequency/source_power_spectrum_opm.py | 5 | 7692 | # -*- coding: utf-8 -*-
"""
.. _ex-opm-resting-state:
======================================================================
Compute source power spectral density (PSD) of VectorView and OPM data
======================================================================
Here we compute the resting state from raw for data... | bsd-3-clause | af5b1df0b3ccd9623e0b06b4eca7d2c8 | 37.653266 | 79 | 0.625195 | 3.046337 | false | false | false | false |
mne-tools/mne-python | mne/io/eeglab/eeglab.py | 1 | 27204 | # Authors: Mainak Jas <mainak.jas@telecom-paristech.fr>
# Jona Sassenhagen <jona.sassenhagen@gmail.com>
# Stefan Appelhoff <stefan.appelhoff@mailbox.org>
#
# License: BSD-3-Clause
import os.path as op
import numpy as np
from ._eeglab import _readmat
from .._digitization import _ensure_fiducials_hea... | bsd-3-clause | f96b659cb40f81183a82e7dcf6daf1fa | 38.483309 | 79 | 0.581275 | 3.64323 | false | false | false | false |
mne-tools/mne-python | examples/preprocessing/find_ref_artifacts.py | 13 | 4727 | # -*- coding: utf-8 -*-
"""
.. _ex-megnoise_processing:
====================================
Find MEG reference channel artifacts
====================================
Use ICA decompositions of MEG reference channels to remove intermittent noise.
Many MEG systems have an array of reference channels which are used to ... | bsd-3-clause | 4bd34718b1799f3ce99bbc75ce160d44 | 31.156463 | 79 | 0.710176 | 3.23989 | false | false | false | false |
mne-tools/mne-python | mne/preprocessing/nirs/_tddr.py | 8 | 5024 | # Authors: Robert Luke <mail@robertluke.net>
# Frank Fishburn
#
# License: BSD-3-Clause
import numpy as np
from ...io import BaseRaw
from ...utils import _validate_type, verbose
from ..nirs import _validate_nirs_info
@verbose
def temporal_derivative_distribution_repair(raw, *, verbose=None):
"""Apply ... | bsd-3-clause | 3c4f72f73d4da69ee472ab11960c81c4 | 30.4 | 79 | 0.64371 | 3.696836 | false | false | false | false |
mne-tools/mne-python | mne/export/_eeglab.py | 6 | 2455 | # -*- coding: utf-8 -*-
# Authors: MNE Developers
#
# License: BSD-3-Clause
import numpy as np
from ..utils import _check_eeglabio_installed
_check_eeglabio_installed()
import eeglabio.raw # noqa: E402
import eeglabio.epochs # noqa: E402
def _export_raw(fname, raw):
# load data first
raw.load_data()
... | bsd-3-clause | 0675f0e44f2ede5f5730d69da56c3dd3 | 31.302632 | 77 | 0.616293 | 3.204961 | false | false | false | false |
mne-tools/mne-python | examples/stats/sensor_regression.py | 13 | 3814 | # -*- coding: utf-8 -*-
"""
.. _ex-sensor-regression:
=========================================================================
Analysing continuous features with binning and regression in sensor space
=========================================================================
Predict single trial activity from a conti... | bsd-3-clause | 1517262a2b0765fd6af608a46e8c701d | 43.870588 | 78 | 0.673047 | 3.88391 | false | false | false | false |
mne-tools/mne-python | mne/export/_edf.py | 11 | 11831 | # -*- coding: utf-8 -*-
# Authors: MNE Developers
#
# License: BSD-3-Clause
from contextlib import contextmanager
import numpy as np
from ..utils import _check_edflib_installed, warn
_check_edflib_installed()
from EDFlib.edfwriter import EDFwriter # noqa: E402
def _try_to_set_value(header, key, value, channel_inde... | bsd-3-clause | 6cc3b3672a7932017430b262efe2d419 | 41.096085 | 79 | 0.555077 | 3.998986 | false | false | false | false |
mne-tools/mne-python | examples/time_frequency/time_frequency_simulated.py | 7 | 9643 | # -*- coding: utf-8 -*-
"""
.. _ex-tfr-comparison:
==================================================================================
Time-frequency on simulated data (Multitaper vs. Morlet vs. Stockwell vs. Hilbert)
==================================================================================
This example demon... | bsd-3-clause | 9473a00c1ae504884b73ab3212a1bcff | 41.10917 | 82 | 0.638391 | 3.312607 | false | false | false | false |
mne-tools/mne-python | mne/datasets/_fsaverage/base.py | 9 | 4530 | # -*- coding: utf-8 -*-
# Authors: Eric Larson <larson.eric.d@gmail.com>
# License: BSD Style.
import os
import os.path as op
from ..utils import _manifest_check_download, _get_path
from ...utils import verbose, get_subjects_dir, set_config
FSAVERAGE_MANIFEST_PATH = op.dirname(__file__)
@verbose
def fetch_fsaverag... | bsd-3-clause | b45867cc9b85149457d552d64260782f | 33.580153 | 79 | 0.64128 | 3.323551 | false | true | false | false |
mne-tools/mne-python | mne/time_frequency/tests/test_stft.py | 11 | 2237 | # Authors : Alexandre Gramfort <alexandre.gramfort@inria.fr>
# Eric Larson <larson.eric.d@gmail.com>
#
# License : BSD-3-Clause
import pytest
import numpy as np
from scipy import linalg
from numpy.testing import assert_almost_equal, assert_array_almost_equal
from mne.time_frequency import stft, istft, stftf... | bsd-3-clause | 66c0033c5d1c23b895c4a593e43dcaba | 32.38806 | 72 | 0.577559 | 3.039402 | false | true | false | false |
mne-tools/mne-python | mne/datasets/kiloword/kiloword.py | 9 | 1969 | # License: BSD Style.
from ...utils import verbose
from ..utils import (_get_version, _version_doc, _download_mne_dataset)
@verbose
def data_path(path=None, force_update=False, update_path=True,
download=True, *, verbose=None):
"""Get path to local copy of the kiloword dataset.
This is the dat... | bsd-3-clause | bf7dd90077b786ff0d6395459a32de99 | 33.54386 | 79 | 0.656171 | 4.034836 | false | false | false | false |
mne-tools/mne-python | mne/viz/tests/test_montage.py | 8 | 2822 | # Authors: Denis Engemann <denis.engemann@gmail.com>
# Alexandre Gramfort <alexandre.gramfort@inria.fr>
# Teon Brooks <teon.brooks@gmail.com>
#
# License: Simplified BSD
# Set our plotters to test mode
import os.path as op
import numpy as np
import pytest
import matplotlib.pyplot as plt
from mne.ch... | bsd-3-clause | 609f14b60e2d958285c8fbab970deb21 | 33 | 79 | 0.599929 | 2.954974 | false | true | false | false |
mne-tools/mne-python | tutorials/forward/25_automated_coreg.py | 11 | 4242 | # -*- coding: utf-8 -*-
"""
.. _tut-auto-coreg:
=============================================
Using an automated approach to coregistration
=============================================
This example shows how to use the coregistration functions to perform an
automated MEG-MRI coregistration via scripting. Generally t... | bsd-3-clause | aebc963a449132d6d7e229c74f1fce23 | 35.568966 | 78 | 0.662423 | 3.377389 | false | false | false | false |
mne-tools/mne-python | mne/io/boxy/boxy.py | 11 | 11042 | # Authors: Kyle Mathewson, Jonathan Kuziek <kuziek@ualberta.ca>
#
# License: BSD-3-Clause
import re as re
import numpy as np
from ..base import BaseRaw
from ..meas_info import create_info
from ..utils import _mult_cal_one
from ...utils import logger, verbose, fill_doc, _check_fname
from ...annotations import Annotat... | bsd-3-clause | a3aface4eb25fb090ead2df52b73c970 | 40.984791 | 79 | 0.49194 | 3.983405 | false | false | false | false |
mne-tools/mne-python | mne/preprocessing/maxfilter.py | 11 | 6419 | # Authors: Alexandre Gramfort <alexandre.gramfort@inria.fr>
# Matti Hämäläinen <msh@nmr.mgh.harvard.edu>
# Martin Luessi <mluessi@nmr.mgh.harvard.edu>
#
# License: BSD-3-Clause
import os
from ..bem import fit_sphere_to_headshape
from ..io import read_raw_fif
from ..utils import logger, verbose, warn... | bsd-3-clause | 22e383c2d5ea73c07af1113ef3b5c400 | 31.568528 | 78 | 0.573722 | 3.562465 | false | false | false | false |
mne-tools/mne-python | tutorials/epochs/10_epochs_overview.py | 11 | 17877 | # -*- coding: utf-8 -*-
"""
.. _tut-epochs-class:
=============================================
The Epochs data structure: discontinuous data
=============================================
This tutorial covers the basics of creating and working with :term:`epoched
<epochs>` data. It introduces the :class:`~mne.Epochs`... | bsd-3-clause | 5b5fa76973c48a0172650a4800a07637 | 39.354402 | 79 | 0.686804 | 3.373019 | false | false | false | false |
mne-tools/mne-python | mne/io/ctf/eeg.py | 8 | 3732 | """Read .eeg files."""
# Author: Eric Larson <larson.eric.d<gmail.com>
#
# License: BSD-3-Clause
import numpy as np
from os.path import join
from os import listdir
from ...utils import logger, warn
from ..constants import FIFF
from .res4 import _make_ctf_name
from ...transforms import apply_trans
_cardinal_dict = ... | bsd-3-clause | af758ff4a4ef79dfa2f9de6e576daa00 | 38.284211 | 79 | 0.511254 | 3.758308 | false | false | false | false |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.