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 |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
alphagov/notifications-api | app/v2/broadcast/post_broadcast.py | 1 | 5034 | from itertools import chain
from flask import current_app, jsonify, request
from notifications_utils.polygons import Polygons
from notifications_utils.template import BroadcastMessageTemplate
from sqlalchemy.orm.exc import MultipleResultsFound
from app import api_user, authenticated_service, redis_store
from app.broa... | mit | 93ae65e1d8116f29ec0f7a4456b275ae | 37.121212 | 120 | 0.662758 | 4.214405 | false | false | false | false |
denisenkom/pytds | tests/simple_server.py | 3 | 9787 | import socket
import socketserver
import struct
import logging
import OpenSSL.SSL
import pytds.tds
_BYTE_STRUCT = struct.Struct('B')
_OFF_LEN_STRUCT = struct.Struct('>HH')
_PROD_VER_STRUCT = struct.Struct('>LH')
logger = logging.getLogger(__name__)
class TdsParser:
def bad_stream(self, msg):
# TODO us... | mit | 89b0dc8f3c6ba97944d38cfc8b566fcb | 35.248148 | 111 | 0.56105 | 3.510402 | false | false | false | false |
alphagov/notifications-api | migrations/versions/0123_add_noti_to_email_reply.py | 1 | 1650 | """
Revision ID: 0123_add_noti_to_email_reply
Revises: 0122_add_service_letter_contact
Create Date: 2017-09-27 09:42:39.412731
"""
import sqlalchemy as sa
from alembic import op
from sqlalchemy.dialects import postgresql
revision = "0123_add_noti_to_email_reply"
down_revision = "0122_add_service_letter_contact"
de... | mit | 25013e53a37d17180b4885e04dc3591e | 30.730769 | 120 | 0.641818 | 3.333333 | false | false | false | false |
alphagov/notifications-api | app/v2/inbound_sms/get_inbound_sms.py | 1 | 1286 | from flask import current_app, jsonify, request, url_for
from app import authenticated_service
from app.dao import inbound_sms_dao
from app.schema_validation import validate
from app.v2.inbound_sms import v2_inbound_sms_blueprint
from app.v2.inbound_sms.inbound_sms_schemas import get_inbound_sms_request
@v2_inbound_... | mit | 1fcf6f0dfe85c96687a58f0c86da6908 | 28.227273 | 101 | 0.632193 | 3.475676 | false | false | false | false |
alphagov/notifications-api | gunicorn_config.py | 1 | 1718 | import os
import socket
import sys
import traceback
import eventlet
import gunicorn
from gds_metrics.gunicorn import child_exit # noqa
workers = 4
worker_class = "eventlet"
worker_connections = 256
errorlog = "/home/vcap/logs/gunicorn_error.log"
bind = "0.0.0.0:{}".format(os.getenv("PORT"))
statsd_host = "{}:8125".f... | mit | a4407e8b3db6246bbc93fe6cf9513a93 | 31.415094 | 117 | 0.729336 | 3.655319 | false | false | false | false |
alphagov/notifications-api | migrations/versions/0326_broadcast_event.py | 1 | 2250 | """
Revision ID: 0326_broadcast_event
Revises: 0325_int_letter_rates_fix
Create Date: 2020-07-24 12:40:35.809523
"""
import sqlalchemy as sa
from alembic import op
from sqlalchemy.dialects import postgresql
revision = "0326_broadcast_event"
down_revision = "0325_int_letter_rates_fix"
def upgrade():
op.create_t... | mit | ae0f1d732458d86600b903e1013ce15c | 44 | 120 | 0.671111 | 3.560127 | false | false | false | false |
reubano/csv2ofx | csv2ofx/main.py | 1 | 7976 | #!/usr/bin/env python
# -*- coding: utf-8 -*-
# vim: sw=4:ts=4:expandtab
"""
csv2ofx.main
~~~~~~~~~~~~
Provides the primary ofx and qif conversion functions
Examples:
literal blocks::
python example_google.py
Attributes:
ENCODING (str): Default file encoding.
"""
import time
import itertools as it
... | mit | 116574a5052579a66291a7a8c8fc1087 | 26.315068 | 87 | 0.621991 | 3.562305 | false | false | false | false |
googlefonts/ufo2ft | tests/featureWriters/kernFeatureWriter_test.py | 2 | 36389 | import logging
from textwrap import dedent
import pytest
from ufo2ft.errors import InvalidFeaturesData
from ufo2ft.featureCompiler import parseLayoutFeatures
from ufo2ft.featureWriters import KernFeatureWriter, ast
from . import FeatureWriterTest
def makeUFO(cls, glyphMap, groups=None, kerning=None, features=None)... | mit | a2ff860566a4a4734b0184f84ec2de06 | 29.298918 | 90 | 0.471928 | 3.681234 | false | false | false | false |
pybel/pybel | src/pybel/manager/base_manager.py | 1 | 4164 | # -*- coding: utf-8 -*-
"""This module contains the base class for connection managers in SQLAlchemy."""
import logging
from typing import List, Optional, Tuple, Type, TypeVar
import pystow
from sqlalchemy import create_engine
from sqlalchemy.orm import scoped_session, sessionmaker
from .models import Base
__all__... | mit | 9c3f378b58410d3035815962d93c7894 | 31.27907 | 116 | 0.661383 | 4.019305 | false | false | false | false |
pybel/pybel | src/pybel/io/hipathia.py | 1 | 17666 | # -*- coding: utf-8 -*-
"""Convert a BEL graph to HiPathia inputs.
Input
-----
SIF File
~~~~~~~~
- Text file with three columns separated by tabs.
- Each row represents an interaction in the pathway. First column is the source
node, third column the target node, and the second is the type of relation
between them... | mit | b24c673925cef932b4e509cc247e55a1 | 35.20082 | 112 | 0.597475 | 3.380406 | false | false | false | false |
pybel/pybel | src/pybel/resources/resources.py | 1 | 1619 | # -*- coding: utf-8 -*-
"""Resources for PyBEL."""
CHEBI_URL = "https://raw.githubusercontent.com/pharmacome/conso/d67144bc27a21626a514837b3b4382413dd6866b/external/chebi-names.belns"
EC_URL = (
"https://raw.githubusercontent.com/pharmacome/conso/d67144bc27a21626a514837b3b4382413dd6866b/external/ec-code.belns"
)
... | mit | 4d019e89d274a652fa59fff19c0f2309 | 48.060606 | 138 | 0.795553 | 2.254875 | false | false | false | false |
pybel/pybel | src/pybel/io/lines.py | 1 | 1647 | # -*- coding: utf-8 -*-
"""This module contains IO functions for BEL scripts."""
import gzip
import logging
from typing import TextIO, Union
from bel_resources.utils import download
from networkx.utils import open_file
from .line_utils import parse_lines
from ..struct import BELGraph
__all__ = [
"from_bel_scri... | mit | 3a3fd5be9d0ac429489cccf40eb31c85 | 27.396552 | 104 | 0.673345 | 3.334008 | false | false | false | false |
pybel/pybel | tests/test_grounding.py | 1 | 20364 | # -*- coding: utf-8 -*-
"""Test grounding."""
import unittest
from unittest import mock
import bioregistry
import pyobo
from pyobo.mocks import get_mock_id_name_mapping
from pybel.constants import (
ANNOTATIONS,
CONCEPT,
GMOD,
IDENTIFIER,
KIND,
MEMBERS,
NAME,
NAMESPACE,
PMOD,
... | mit | a4e3020239d020de72f595dbdc08027b | 33.810256 | 119 | 0.466018 | 4.075245 | false | true | false | false |
googlefonts/ufo2ft | Lib/ufo2ft/featureWriters/gdefFeatureWriter.py | 3 | 3707 | from ufo2ft.featureWriters import BaseFeatureWriter, ast
class GdefFeatureWriter(BaseFeatureWriter):
"""Generates a GDEF table based on OpenType Category and glyph anchors.
It skips generating the GDEF if a GDEF is defined in the features.
It uses the 'public.openTypeCategories' values to create the GDE... | mit | ee831148260b80d5728d6158616cce01 | 36.826531 | 86 | 0.60669 | 4.109756 | false | false | false | false |
pybel/pybel | src/pybel/struct/node_utils.py | 1 | 9358 | # -*- coding: utf-8 -*-
"""Utilities for handling nodes."""
import itertools as itt
import logging
from itertools import chain
from typing import Set, Tuple, Type, Union
from networkx import relabel_nodes
from ..constants import ANNOTATIONS, CITATION, EVIDENCE, INCREASES, RELATION
from ..dsl import BaseAbundance, B... | mit | e35857d6f7e2a5a5ad4b2ba6b1500f2f | 34.854406 | 115 | 0.554499 | 4.113407 | false | false | false | false |
pybel/pybel | tests/constant_helper.py | 1 | 29914 | # -*- coding: utf-8 -*-
"""Constants for PyBEL tests."""
import logging
from pybel.constants import *
from pybel.dsl import (
Abundance,
BiologicalProcess,
ComplexAbundance,
CompositeAbundance,
EnumeratedFusionRange,
Fragment,
Gene,
GeneFusion,
GeneModification,
Hgvs,
Hgvs... | mit | 8c920d0175b401ff2871f1933195a3ec | 28.356232 | 112 | 0.517751 | 3.019481 | false | false | false | false |
pybel/pybel | src/pybel/struct/mutation/induction/utils.py | 1 | 2513 | # -*- coding: utf-8 -*-
"""Functions for inducing graphs by nodes and by edge filters."""
from typing import Iterable, Optional
import networkx as nx
from ..utils import expand_by_edge_filter
from ...filters.edge_predicates import is_causal_relation
from ...filters.node_filters import filter_nodes
from ...filters.t... | mit | e258f838e0be14d9aa0b17a20e59d049 | 30.024691 | 111 | 0.71548 | 3.5 | false | false | false | false |
pybel/pybel | src/pybel/parser/parse_metadata.py | 1 | 13428 | # -*- coding: utf-8 -*-
"""This module supports the relation parser by handling statements."""
import logging
import re
from typing import Mapping, Optional, Pattern, Set
from pyparsing import And, MatchFirst, ParseResults, Suppress, Word
from .baseparser import BaseParser
from .constants import NamespaceTermEncodi... | mit | 738383c5673c65342b15f8f213e408b3 | 40.06422 | 157 | 0.653187 | 4.159851 | false | false | false | false |
pybel/pybel | src/pybel/struct/pipeline/pipeline.py | 1 | 11284 | # -*- coding: utf-8 -*-
"""This module holds the Pipeline class."""
import json
import logging
import types
from functools import wraps
from typing import Any, Dict, Iterable, List, Optional, TextIO, Tuple, Union
from .decorators import get_transformation, in_place_map, mapped, universe_map
from .exc import MetaValu... | mit | 043d6e1ddb493818f70c0409633f7607 | 33.72 | 117 | 0.61246 | 4.34167 | false | false | false | false |
spookylukey/django-paypal | paypal/pro/forms.py | 2 | 2178 | #!/usr/bin/env python
from django import forms
from django.utils.translation import gettext_lazy as _
from paypal.pro.exceptions import PayPalFailure
from paypal.pro.fields import CountryField, CreditCardCVV2Field, CreditCardExpiryField, CreditCardField
from paypal.utils import warn_untested
class PaymentForm(forms... | mit | 4394d9efd0583720ed5b97a85c10cefd | 39.333333 | 103 | 0.674472 | 3.96 | false | false | false | false |
pybel/pybel | src/pybel/struct/filters/node_filters.py | 1 | 2592 | # -*- coding: utf-8 -*-
"""Filter functions for nodes in BEL graphs.
A node predicate is a function that takes two arguments: a :class:`BELGraph` and a node. It returns a boolean
representing whether the node passed the given test.
This module contains a set of default functions for filtering lists of nodes and buil... | mit | 012c6b33aab6d17d5ef2b4d05dd3f105 | 35.507042 | 109 | 0.723765 | 3.729496 | false | false | false | false |
rspeer/python-ftfy | ftfy/cli.py | 1 | 4116 | """
A command-line utility for fixing text found in a file.
"""
import os
import sys
from ftfy import __version__, fix_file, TextFixerConfig
ENCODE_ERROR_TEXT_UNIX = """ftfy error:
Unfortunately, this output stream does not support Unicode.
Your system locale may be very old or misconfigured. You should use a locale... | mit | 255953eeebabde129b8fcf869428ca1c | 27.783217 | 86 | 0.6069 | 3.91627 | false | false | false | false |
alphagov/digitalmarketplace-api | migrations/versions/1200_non_nullable_framework_components_and_.py | 1 | 2097 | """Non-nullable framework components and enforce at least one True with a constraint
Revision ID: 1200
Revises: 1190
Create Date: 2018-05-18 14:55:37.248172
"""
from alembic import op
import sqlalchemy as sa
from sqlalchemy.sql import table, column
# revision identifiers, used by Alembic.
revision = '1200'
down_rev... | mit | 1599d4a86279600d0454a3995a8537a6 | 40.94 | 110 | 0.670959 | 3.854779 | false | false | false | false |
alphagov/digitalmarketplace-api | scripts/chpass.py | 1 | 1642 | #!/usr/bin/env python
"""Change user password
Usage:
chpass.py <user_email> <stage> <api_token> [options]
--unlock If set, unlocks user account after changing the password
Example:
./chpass.py admin@example.com dev myToken --unlock
"""
import sys
import getpass
import logging
from docopt import docopt
... | mit | 235c8ee683c7eaa3abde402f26a50c40 | 24.261538 | 90 | 0.643118 | 3.61674 | false | false | false | false |
alphagov/digitalmarketplace-api | migrations/versions/150_add_selection_answers.py | 3 | 1078 | """Add selection answers
Revision ID: 150_add_selection_answers
Revises: 140_service_id_null_for_drafts
Create Date: 2015-06-19 16:22:21.510509
"""
# revision identifiers, used by Alembic.
revision = '150_add_selection_answers'
down_revision = '140_service_id_null_for_drafts'
from alembic import op
import sqlalchem... | mit | cb086e47654d639f3b04d89f8a9dc0c0 | 31.666667 | 74 | 0.701299 | 3.704467 | false | false | false | false |
alphagov/digitalmarketplace-api | migrations/versions/40_add_draft_services.py | 3 | 2004 | """empty message
Revision ID: 37ac005a48c3
Revises: 20_adding_json_index_to_services
Create Date: 2015-06-02 18:32:08.399213
"""
# revision identifiers, used by Alembic.
revision = '40_add_draft_services'
down_revision = '20_adding_json_index_to_services'
from alembic import op
import sqlalchemy as sa
from sqlalche... | mit | 355b11522f544721fdf83f3561d92538 | 42.565217 | 109 | 0.689122 | 3.408163 | false | false | false | false |
alphagov/digitalmarketplace-api | tests/main/views/test_outcomes.py | 1 | 43968 | import datetime
from itertools import chain, product
import json
import re
from urllib.parse import urlparse
from flask import current_app
from sqlalchemy import desc
from mock import ANY
import pytest
from dmtestutils.comparisons import AnyStringMatching, AnySupersetOf, RestrictedAny
from app import db
from app.mo... | mit | 8f46469bd26666a3c343a09ada0991af | 35.098522 | 120 | 0.434248 | 4.528115 | false | false | false | false |
alphagov/digitalmarketplace-api | migrations/versions/880_remove_invalid_draft_dos2_brief_dates_again.py | 1 | 2049 | """Remove dates from draft dos2 briefs.
This is identical to the previous migration but will be run again to cover any draft briefs with invalid
dates that could have appeared during the previous API rollout process (after the previous migration but before
the code propogated fully to the ec2 instances).
Revision ID: ... | mit | 55a1326c5395eaacdd97bbe05e96de4b | 30.045455 | 111 | 0.669595 | 3.370066 | false | false | false | false |
floooh/fips | mod/tools/httpserver.py | 1 | 1989 | """
wrapper for node's http-server module, this is preferred over
python's SimpleHTTPServer module because it supports
HTTP range requests
"""
import subprocess
import platform
from mod import log,util
name = 'http-server'
platforms = ['osx', 'linux', 'win']
optional = True
not_found = "required for runni... | mit | 84c5f93b46b3200e9910611e93882d45 | 35.163636 | 98 | 0.547009 | 4.213983 | false | false | false | false |
hail-is/hail | hail/python/test/hailtop/hailctl/dataproc/test_cli.py | 1 | 1516 | from unittest.mock import Mock
import pytest
from hailtop.hailctl.dataproc import cli
from hailtop.hailctl.dataproc import list_clusters
def test_required_gcloud_version_met(monkeypatch):
monkeypatch.setattr("hailtop.hailctl.dataproc.gcloud.get_version", Mock(return_value=cli.MINIMUM_REQUIRED_GCLOUD_VERSION))
... | mit | 4df0e17cb95794c3842d088decfc8859 | 32.688889 | 126 | 0.716359 | 3.414414 | false | true | false | false |
hail-is/hail | batch/batch/cloud/azure/worker/credentials.py | 1 | 1459 | import base64
import json
from typing import Dict
from ....worker.credentials import CloudUserCredentials
class AzureUserCredentials(CloudUserCredentials):
def __init__(self, data: Dict[str, bytes]):
self._data = data
self._credentials = json.loads(base64.b64decode(data['key.json']).decode())
... | mit | 30b64e021284f62c976a888d5fbd8f58 | 25.053571 | 83 | 0.660727 | 3.829396 | false | false | false | false |
hail-is/hail | website/website/website.py | 1 | 4417 | import logging
import os
from typing import Set
import aiohttp_session
import jinja2
from aiohttp import web
from prometheus_async.aio.web import server_stats # type: ignore
from gear import AuthClient, monitor_endpoints_middleware, setup_aiohttp_session
from hailtop import httpx
from hailtop.config import get_deplo... | mit | 92c47c138f2d37830c7336a81995a8b8 | 30.55 | 112 | 0.670591 | 3.467033 | false | false | false | false |
hail-is/hail | benchmark/python/benchmark_hail/summarize/summarize.py | 3 | 1147 | import collections
import json
import logging
import argparse
from .. import init_logging
def main(args_):
parser = argparse.ArgumentParser()
parser.add_argument("files",
type=str,
nargs='*',
help="JSON files to summarize.")
args ... | mit | 0eaac309e5a943b2cd1bbebba67ab878 | 26.97561 | 94 | 0.558849 | 4.038732 | false | false | false | false |
hail-is/hail | hail/python/hailtop/aiocloud/aioazure/client/pricing_client.py | 1 | 1158 | from typing import Optional, AsyncGenerator, Any
from ...common import AnonymousCloudCredentials
from ..session import AzureSession
from .base_client import AzureBaseClient
class AzurePricingClient(AzureBaseClient):
def __init__(self):
session = AzureSession(credentials=AnonymousCloudCredentials())
... | mit | 53f27c24072ac1b46dc3b5b4d286d463 | 36.354839 | 101 | 0.636442 | 3.938776 | false | false | false | false |
hail-is/hail | batch/batch/driver/instance.py | 1 | 11535 | import base64
import datetime
import json
import logging
import secrets
from typing import Dict, Optional
import aiohttp
import humanize
from gear import Database, transaction
from hailtop import httpx
from hailtop.utils import retry_transient_errors, time_msecs, time_msecs_str
from ..cloud.utils import instance_con... | mit | aaf28ebb2de7dca9737925b907c13e85 | 30.952909 | 113 | 0.573299 | 4.027584 | false | true | false | false |
hail-is/hail | batch/sql/insert_attempt_resources_format_version_lt_3.py | 1 | 9860 | import asyncio
import functools
import os
import random
import time
from gear import Database, transaction
from hailtop.utils import bounded_gather, secret_alnum_string
MYSQL_CONFIG_FILE = os.environ.get('MYSQL_CONFIG_FILE')
class Counter:
def __init__(self):
self.n = 0
async def process_chunk(counter... | mit | 99bc8d2772749de745e989c7130f6f39 | 38.919028 | 202 | 0.605984 | 3.554434 | false | false | false | false |
hail-is/hail | batch/batch/driver/billing_manager.py | 1 | 2580 | import abc
import logging
from typing import Dict, Optional
from gear import Database, transaction
log = logging.getLogger('billing_manager')
def product_version_to_resource(product: str, version: str) -> str:
return f'{product}/{version}'
class ProductVersions:
def __init__(self, data: Dict[str, str]):
... | mit | 6e4926b0d8b87aac085e2f59b8ee1193 | 35.338028 | 120 | 0.665891 | 4.062992 | false | true | false | false |
hail-is/hail | hail/python/hailtop/cleanup_gcr/__main__.py | 1 | 3595 | import sys
import time
import logging
import asyncio
import aiohttp
from hailtop import aiotools
from hailtop.aiocloud import aiogoogle
log = logging.getLogger(__name__)
class AsyncIOExecutor:
def __init__(self, parallelism):
self._semaphore = asyncio.Semaphore(parallelism)
self.task_manager = ai... | mit | fca25ecf8efd874581e5d55f64f29f77 | 29.210084 | 117 | 0.594437 | 3.937568 | false | false | false | false |
hail-is/hail | hail/python/hail/experimental/import_gtf.py | 2 | 12269 | import operator
import functools
import hail as hl
from hail.genetics.reference_genome import reference_genome_type
from hail.typecheck import typecheck, nullable, sequenceof
from hail.utils.java import info
from hail.utils import new_temp_file
@typecheck(path=str, reference_genome=nullable(reference_genome_type), sk... | mit | 1794dcdb3b6e14e72314c71df55f2d1c | 41.600694 | 141 | 0.545684 | 4.035855 | false | false | false | false |
hail-is/hail | batch/batch/driver/instance_collection/pool.py | 1 | 29800 | import asyncio
import logging
import random
from collections import defaultdict
from typing import Dict, List, Optional, Tuple
import prometheus_client as pc
import sortedcontainers
from gear import Database
from hailtop import aiotools
from hailtop.utils import (
AsyncWorkerPool,
Notice,
WaitableSharedPo... | mit | b3b07945240b0bf8745e28538d40af3a | 41.149929 | 151 | 0.614027 | 3.684471 | false | true | false | false |
floooh/fips | mod/tools/git.py | 2 | 12592 | """wrapper for some git commands"""
import re
import subprocess
from mod import log
name = 'git'
platforms = ['linux', 'osx', 'win']
optional = False
not_found = "git not found in path, can't happen(?)"
# default git clone depth
clone_depth = 10
#---------------------------------------------------------------------... | mit | 2fe0a41feacd96d1cc35b9ca5768903a | 37.864198 | 134 | 0.545346 | 4.262695 | false | false | false | false |
hail-is/hail | benchmark/scripts/benchmark_in_batch.py | 1 | 5051 | import os
import random
import re
import sys
import time
from benchmark_hail.run.resources import all_resources
from benchmark_hail.run.utils import list_benchmarks
from hailtop import batch as hb
if __name__ == '__main__':
if len(sys.argv) != 6:
raise RuntimeError(f'usage: <script.py> DOCKER_IMAGE_URL BU... | mit | a122c1f233571d7b512d34f9f86f16dc | 35.078571 | 118 | 0.610572 | 3.275616 | false | true | false | false |
hail-is/hail | datasets/extract/extract_1000_Genomes_NYGC_30x_GRCh38.py | 1 | 1731 | import hailtop.batch as hb
phased_url_root = "ftp://ftp.1000genomes.ebi.ac.uk/vol1/ftp/data_collections/" \
"1000G_2504_high_coverage/working/20201028_3202_phased"
gt_url_root = "ftp://ftp.1000genomes.ebi.ac.uk/vol1/ftp/data_collections/" \
"1000G_2504_high_coverage/working/20201028_320... | mit | ea71f7729a845daac613a6e9c5b95ff0 | 53.09375 | 130 | 0.634893 | 2.397507 | false | false | false | false |
hail-is/hail | hail/python/test/hailtop/config/test_deploy_config.py | 1 | 5147 | import unittest
from hailtop.config.deploy_config import DeployConfig
class Test(unittest.TestCase):
def test_deploy_external_default(self):
deploy_config = DeployConfig('external', 'default', 'organization.tld')
self.assertEqual(deploy_config.location(), 'external')
self.assertEqual(deplo... | mit | 827bd628b20837d5f455b1a8a446679d | 56.188889 | 116 | 0.667573 | 3.537457 | false | true | false | false |
hail-is/hail | batch/batch/cloud/gcp/driver/activity_logs.py | 1 | 4009 | import json
import logging
import re
from typing import Any, Dict
from gear import Database
from hailtop.aiocloud import aiogoogle
from hailtop.utils import parse_timestamp_msecs
from ....driver.instance_collection import InstanceCollectionManager
from .zones import ZoneSuccessRate
log = logging.getLogger('activity_... | mit | b09267ebf06b915f7247d3eff8cc8092 | 33.264957 | 109 | 0.66226 | 3.847409 | false | false | false | false |
hail-is/hail | hail/python/hail/plot/plots.py | 1 | 65187 | import math
import collections
import numpy as np
import pandas as pd
import bokeh
import bokeh.io
from bokeh.models import HoverTool, ColorBar, LogTicker, LogColorMapper, LinearColorMapper, CategoricalColorMapper, \
ColumnDataSource, BasicTicker, Plot, ColorMapper, CDSView, GroupFilter, Legend, LegendItem, Render... | mit | c8ae8775cfce11c2db6908452f5a6bf5 | 40.493316 | 203 | 0.606219 | 3.586378 | false | false | false | false |
hail-is/hail | hail/python/hailtop/hailctl/dataproc/cluster_config.py | 1 | 1215 | class ClusterConfig:
def __init__(self):
self.vars = {}
self.flags = {}
def extend_flag(self, flag, values):
if flag not in self.flags:
self.flags[flag] = values
elif isinstance(self.flags[flag], list):
assert isinstance(values, list)
self.fla... | mit | 7d7b9f4fc28da707f2bf9c7af27fd641 | 34.735294 | 106 | 0.534156 | 3.996711 | false | false | false | false |
hail-is/hail | hail/python/hail/backend/service_backend.py | 1 | 26897 | from typing import Dict, Optional, Callable, Awaitable, Mapping, Any, List, Union, Tuple
import abc
import struct
from hail.expr.expressions.base_expression import Expression
import orjson
import logging
from hail.context import TemporaryDirectory, tmp_dir, TemporaryFilename, revision, _TemporaryFilenameManager
from h... | mit | 940e63a1b758aeafd7339555c32f2698 | 40.126911 | 154 | 0.582184 | 4.069138 | false | false | false | false |
hail-is/hail | batch/batch/cloud/azure/resources.py | 1 | 8454 | import abc
from typing import Any, Dict, Optional
from ...driver.billing_manager import ProductVersions
from ...resources import (
DynamicSizedDiskResourceMixin,
IPFeeResourceMixin,
QuantifiedResource,
Resource,
ServiceFeeResourceMixin,
StaticSizedDiskResourceMixin,
VMResourceMixin,
)
from ... | mit | 6a044a8618d2bc4cf5daa1158d8e4e8d | 35.917031 | 115 | 0.668914 | 3.716044 | false | false | false | false |
hail-is/hail | hail/python/hailtop/hailctl/auth/create_user.py | 1 | 1877 | import asyncio
from hailtop.utils import sleep_and_backoff
from hailtop.auth import async_create_user, async_get_user
def init_parser(parser):
parser.add_argument("username", type=str,
help="User name to create.")
parser.add_argument("login_id", type=str,
help=... | mit | eb1186aa01c4d02d0b9cb9c106b2d30a | 39.804348 | 124 | 0.599361 | 4.265909 | false | false | false | false |
hail-is/hail | hail/python/hail/nd/nd.py | 1 | 21791 | from functools import reduce
import hail as hl
from hail.expr.functions import _ndarray
from hail.expr.functions import array as aarray
from hail.expr.types import HailType, tfloat64, tfloat32, ttuple, tndarray
from hail.typecheck import typecheck, nullable, oneof, tupleof, sequenceof
from hail.expr.expressions import... | mit | e2c8bea206bb6721affcd369909572ec | 30.486994 | 134 | 0.598559 | 3.384436 | false | false | false | false |
hail-is/hail | hail/python/hail/expr/types.py | 1 | 63021 | from typing import Union
import abc
import json
import math
from collections.abc import Mapping, Sequence
import pprint
import builtins
import numpy as np
import pandas as pd
import hail as hl
from hailtop.frozendict import frozendict
from hailtop.hail_frozenlist import frozenlist
from .nat import NatBase, NatLitera... | mit | baa58ea982cd1a0ad2670f1d326b9138 | 27.737346 | 154 | 0.569556 | 3.627525 | false | false | false | false |
hail-is/hail | benchmark/python/benchmark_hail/run/combiner_benchmarks.py | 1 | 3569 | import os.path
from tempfile import TemporaryDirectory
import hail as hl
try:
import hail.experimental.vcf_combiner.vcf_combiner as vc_all
except ImportError:
vc_all = None
from .resources import empty_gvcf, single_gvcf, chr22_gvcfs
from .utils import benchmark
COMBINE_GVCF_MAX = 100
MAX_TO_COMBINE = 20 * C... | mit | cbd462d1be033f567987ceb991f000f8 | 35.418367 | 119 | 0.609975 | 3.382938 | false | false | false | false |
baudren/montepython_public | montepython/add_derived.py | 2 | 6656 | """
.. module:: add_derived
:synopsis: Read a chain and add new derived parameters from an existing run
.. moduleauthor:: Benjamin Audren <benjamin.audren@epfl.ch>
"""
try:
from collections import OrderedDict as od
except ImportError:
from ordereddict import OrderedDict as od
from multiprocessing import Poo... | mit | 6351d2babdc63ad711afab72e11758b1 | 39.339394 | 79 | 0.608774 | 4.139303 | false | false | false | false |
baudren/montepython_public | montepython/io_mp.py | 1 | 18161 | """
Input-Output handling
Handles all the input/output of the code (at least most of it). If something is
printed that does not satisfy you (number of decimals, for instance, in the
output files), you only have to find the called function and change a number.
Whenever the arguments of the functions are :code:`command... | mit | e05fe51dd32373566a680520da48e515 | 31.663669 | 87 | 0.587963 | 3.793817 | false | false | false | false |
plivo/plivo-python | plivo/xml/messageElement.py | 1 | 2727 | from plivo.xml import PlivoXMLElement, map_type
from plivo.utils.validators import *
class MessageElement(PlivoXMLElement):
_name = 'Message'
_nestable = []
@property
def src(self):
return self.__src
@src.setter
def src(self, value):
self.__src = six.text_type(value) if value... | mit | d34e284626f4224418866d48ec630084 | 22.713043 | 73 | 0.552255 | 3.835443 | false | false | false | false |
baudren/montepython_public | tests/test_montepython.py | 2 | 18149 | """
.. module:: test_montepython
to run it, do
~] nosetest tests/test_montepython.py
"""
import unittest
import nose
import os
import datetime
import shutil
import re
import numpy as np
from itertools import count
import warnings
# This discards warning messages (maybe this should be tuned to discard only
# the ones s... | mit | 927953492bb397ad014f33c8d09026b8 | 34.586275 | 81 | 0.585707 | 3.807216 | false | true | false | false |
baudren/montepython_public | montepython/likelihoods/bao_boss_aniso/__init__.py | 2 | 2172 | import os
import numpy as np
import montepython.io_mp as io_mp
from montepython.likelihood_class import Likelihood
import scipy.interpolate as interp
import scipy.constants as conts
class bao_boss_aniso(Likelihood):
# initialization routine
def __init__(self, path, data, command_line):
Likelihood.__... | mit | 21e83764ec6c753ac493cf32ed17b8fe | 32.415385 | 79 | 0.581031 | 3.213018 | false | false | false | false |
baudren/montepython_public | montepython/likelihoods/euclid_pk/__init__.py | 2 | 17399 | from montepython.likelihood_class import Likelihood
import os
import numpy as np
import warnings
from numpy import newaxis as na
from math import exp, log, pi, log10
class euclid_pk(Likelihood):
def __init__(self, path, data, command_line):
Likelihood.__init__(self, path, data, command_line)
sel... | mit | 20e0244bfcc739ca0e79ad767d4a234a | 51.406627 | 359 | 0.549055 | 2.850426 | false | false | false | false |
zzzeek/sqlalchemy | lib/sqlalchemy/dialects/postgresql/dml.py | 2 | 10279 | # postgresql/on_conflict.py
# Copyright (C) 2005-2022 the SQLAlchemy authors and contributors
# <see AUTHORS file>
#
# This module is part of SQLAlchemy and is released under
# the MIT License: https://www.opensource.org/licenses/mit-license.php
# mypy: ignore-errors
import typing
from . import ext
from ... import ut... | mit | 31f8f8e5fd614c83295c084f0894ed37 | 33.377926 | 79 | 0.617375 | 4.663793 | false | false | false | false |
zzzeek/sqlalchemy | test/ext/mypy/plugin_files/imperative_table.py | 4 | 1025 | import datetime
from typing import Optional
from sqlalchemy import Column
from sqlalchemy import DateTime
from sqlalchemy import Integer
from sqlalchemy import String
from sqlalchemy import Table
from sqlalchemy.orm import declarative_base
from sqlalchemy.orm import Mapped
Base = declarative_base()
class MyMappedC... | mit | 5a07f9d70a093d2214d8dba5dc28ebcf | 26.702703 | 119 | 0.717073 | 3.768382 | false | false | false | false |
zzzeek/sqlalchemy | examples/vertical/dictlike-polymorphic.py | 2 | 7206 | """Mapping a polymorphic-valued vertical table as a dictionary.
Builds upon the dictlike.py example to also add differently typed
columns to the "fact" table, e.g.::
Table('properties', metadata
Column('owner_id', Integer, ForeignKey('owner.id'),
primary_key=True),
Column('key', Unico... | mit | 5c15b1d2b6c22937f347a464d95f87e4 | 28.292683 | 78 | 0.603386 | 3.851416 | false | false | false | false |
zzzeek/sqlalchemy | test/ext/mypy/plain_files/typed_results.py | 2 | 14152 | from __future__ import annotations
import asyncio
from typing import cast
from sqlalchemy import Column
from sqlalchemy import column
from sqlalchemy import create_engine
from sqlalchemy import Integer
from sqlalchemy import select
from sqlalchemy import table
from sqlalchemy.ext.asyncio import AsyncConnection
from s... | mit | c8bdbadeedf4a0bc8911a8bb9cfc9e06 | 24.136767 | 136 | 0.651639 | 3.009783 | false | false | false | false |
pimutils/khal | khal/ui/widgets.py | 1 | 23924 | # Copyright (c) 2013-2022 khal contributors
#
# Permission is hereby granted, free of charge, to any person obtaining
# a copy of this software and associated documentation files (the
# "Software"), to deal in the Software without restriction, including
# without limitation the rights to use, copy, modify, merge, publi... | mit | e8959896f70a73ba86d259afdba1e35f | 33.368345 | 98 | 0.565645 | 3.843282 | false | false | false | false |
zzzeek/sqlalchemy | lib/sqlalchemy/dialects/sqlite/base.py | 2 | 94071 | # sqlite/base.py
# Copyright (C) 2005-2022 the SQLAlchemy authors and contributors
# <see AUTHORS file>
#
# This module is part of SQLAlchemy and is released under
# the MIT License: https://www.opensource.org/licenses/mit-license.php
# mypy: ignore-errors
r"""
.. dialect:: sqlite
:name: SQLite
:full_support:... | mit | eed95a756f46b4f791f37784b02ac77b | 33.49615 | 110 | 0.589767 | 4.152878 | false | false | false | false |
zzzeek/sqlalchemy | test/dialect/mssql/test_types.py | 2 | 51872 | import codecs
import datetime
import decimal
import os
import sqlalchemy as sa
from sqlalchemy import Boolean
from sqlalchemy import cast
from sqlalchemy import Column
from sqlalchemy import column
from sqlalchemy import Date
from sqlalchemy import DateTime
from sqlalchemy import DefaultClause
from sqlalchemy import F... | mit | 9302b36330de65f940d163127382bdef | 31.470257 | 79 | 0.497888 | 4.051172 | false | true | false | false |
zzzeek/sqlalchemy | lib/sqlalchemy/dialects/mysql/base.py | 2 | 116749 | # mysql/base.py
# Copyright (C) 2005-2022 the SQLAlchemy authors and contributors
# <see AUTHORS file>
#
# This module is part of SQLAlchemy and is released under
# the MIT License: https://www.opensource.org/licenses/mit-license.php
# mypy: ignore-errors
r"""
.. dialect:: mysql
:name: MySQL / MariaDB
:full_... | mit | a24d26127bf307a988e494bf5475880b | 33.808885 | 121 | 0.597641 | 4.089568 | false | false | false | false |
zzzeek/sqlalchemy | lib/sqlalchemy/orm/persistence.py | 2 | 57863 | # orm/persistence.py
# Copyright (C) 2005-2022 the SQLAlchemy authors and contributors
# <see AUTHORS file>
#
# This module is part of SQLAlchemy and is released under
# the MIT License: https://www.opensource.org/licenses/mit-license.php
# mypy: ignore-errors
"""private module containing functions used to emit INSER... | mit | 11da3bcf1f29cbdad6f988ee41c229c5 | 32.897481 | 79 | 0.504312 | 4.864072 | false | false | false | false |
zzzeek/sqlalchemy | lib/sqlalchemy/orm/strategies.py | 2 | 113541 | # orm/strategies.py
# Copyright (C) 2005-2022 the SQLAlchemy authors and contributors
# <see AUTHORS file>
#
# This module is part of SQLAlchemy and is released under
# the MIT License: https://www.opensource.org/licenses/mit-license.php
# mypy: ignore-errors
"""sqlalchemy.orm.interfaces.LoaderStrategy
implementat... | mit | 09346f26d971729c9fb50750a9a0cdfe | 33.014679 | 79 | 0.5456 | 4.467656 | false | false | false | false |
zzzeek/sqlalchemy | test/orm/test_ac_relationships.py | 2 | 10451 | from sqlalchemy import and_
from sqlalchemy import Column
from sqlalchemy import exc
from sqlalchemy import ForeignKey
from sqlalchemy import func
from sqlalchemy import Integer
from sqlalchemy import join
from sqlalchemy import select
from sqlalchemy import testing
from sqlalchemy.orm import aliased
from sqlalchemy.or... | mit | 05e3f4baf340c9972f3fc51acf3f0fd5 | 30.290419 | 78 | 0.526648 | 3.473247 | false | true | false | false |
zzzeek/sqlalchemy | test/orm/test_relationship_criteria.py | 2 | 71269 | import datetime
import random
from sqlalchemy import Column
from sqlalchemy import DateTime
from sqlalchemy import event
from sqlalchemy import exc as sa_exc
from sqlalchemy import ForeignKey
from sqlalchemy import func
from sqlalchemy import Integer
from sqlalchemy import literal_column
from sqlalchemy import orm
fro... | mit | b85b488ff95e35f1f485e5c203c4f572 | 33.313433 | 79 | 0.509001 | 4.266072 | false | true | false | false |
hyde/hyde | hyde/ext/plugins/js.py | 2 | 5050 | # -*- coding: utf-8 -*-
"""
JavaScript plugins
"""
import subprocess
import sys
from hyde._compat import str
from hyde.exceptions import HydeException
from hyde.plugin import CLTransformer
from fswrap import File
#
# Uglify JavaScript
#
class UglifyPlugin(CLTransformer):
"""
The plugin class for Uglify JS... | mit | f08aa421e493934558f13d70dc7ef351 | 25.578947 | 78 | 0.560396 | 4.115729 | false | false | false | false |
hyde/hyde | hyde/util.py | 2 | 1477 | """
Module for python 2.6 compatibility.
"""
import os
from functools import partial
from itertools import tee
from hyde._compat import str, zip
def make_method(method_name, method_):
def method__(*args, **kwargs):
return method_(*args, **kwargs)
method__.__name__ = method_name
return method__
... | mit | e8a57f54b3566e11afa50b87bc45ac60 | 24.033898 | 67 | 0.643873 | 3.6925 | false | false | false | false |
coldfix/udiskie | udiskie/appindicator.py | 1 | 2069 | """
Status icon using AppIndicator3.
"""
from gi.repository import Gtk
from .async_ import Future
from .depend import require_AppIndicator3
AppIndicator3 = require_AppIndicator3()
class AppIndicatorIcon:
"""
Show status icon using AppIndicator as backend. Replaces
`udiskie.tray.StatusIcon` on ubuntu/... | mit | 9982d37453b9e1ce9733779d2ab88854 | 30.830769 | 79 | 0.633639 | 3.860075 | false | false | false | false |
hyde/hyde | hyde/ext/plugins/css.py | 2 | 15126 | # -*- coding: utf-8 -*-
"""
CSS plugins
"""
from hyde._compat import str
from hyde.plugin import CLTransformer, Plugin
from hyde.exceptions import HydeException
import os
import re
import subprocess
import sys
from fswrap import File
#
# Less CSS
#
class LessCSSPlugin(CLTransformer):
"""
The plugin class... | mit | 3263d0fd850c8fadc62a60fce8aadfde | 29.619433 | 79 | 0.549517 | 4.162356 | false | false | false | false |
learningequality/kolibri | kolibri/core/auth/management/commands/deprovision.py | 1 | 3095 | import logging
import sys
from morango.models import Certificate
from morango.models import DatabaseIDModel
from morango.models import DatabaseMaxCounter
from morango.models import DeletedModels
from morango.models import HardDeletedModels
from morango.models import Store
from kolibri.core.auth.management.utils impor... | mit | 9997559ea1854c510c8009114bde886a | 32.27957 | 129 | 0.668821 | 4.245542 | false | false | false | false |
learningequality/kolibri | kolibri/core/test/test_apps.py | 2 | 5942 | import functools
import mock
from django.test.testcases import TestCase
from redis import Redis
from kolibri.core.apps import KolibriCoreConfig
from kolibri.core.apps import RedisSettingsHelper
DEFAULT_CACHE_OPTS = dict(
CACHE_BACKEND="redis",
CACHE_REDIS_MAXMEMORY=123,
CACHE_REDIS_MAXMEMORY_POLICY="allk... | mit | a7336a50232c47a5eeabfabfb0fa10d8 | 36.1375 | 82 | 0.686133 | 3.444638 | false | true | false | false |
learningequality/kolibri | kolibri/core/logger/test/test_api.py | 1 | 12275 | # -*- coding: utf-8 -*-
"""
Tests that ensure the correct items are returned from api calls.
Also tests whether the users with permissions can create logs.
"""
import csv
import sys
import tempfile
import uuid
from django.core.management import call_command
from django.urls import reverse
from rest_framework.test impo... | mit | 14c049e4197d717f0f63906c347a6cdf | 37.39185 | 86 | 0.538826 | 4.154342 | false | true | false | false |
learningequality/kolibri | kolibri/core/auth/migrations/0019_collection_no_mptt.py | 2 | 1628 | # -*- coding: utf-8 -*-
# Generated by Django 1.11.29 on 2021-05-01 16:46
from __future__ import unicode_literals
import django.db.models.deletion
from django.db import migrations
from django.db import models
class MPTTRemoveField(migrations.RemoveField):
def database_backwards(self, app_label, schema_editor, fr... | mit | 475d4ed6e1dcc0fc251b7ed03a7d223f | 29.148148 | 81 | 0.568182 | 3.970732 | false | false | false | false |
learningequality/kolibri | kolibri/core/content/test/test_paths.py | 1 | 1374 | import hashlib
from django.test import TestCase
from kolibri.core.content.models import LocalFile
from kolibri.core.content.utils.paths import get_zip_content_config
from kolibri.utils.tests.helpers import override_option
class LocalFilePathsTest(TestCase):
def test_file_url_reversal(self):
from kolibri... | mit | 882003a143588caa18c1e37719576ce0 | 33.35 | 87 | 0.669578 | 3.806094 | false | true | false | false |
learningequality/kolibri | kolibri/core/auth/management/commands/resumesync.py | 1 | 2112 | from kolibri.core.auth.constants.morango_sync import DATA_PORTAL_SYNCING_BASE_URL
from kolibri.core.auth.management.utils import get_network_connection
from kolibri.core.auth.management.utils import MorangoSyncCommand
class Command(MorangoSyncCommand):
help = "Allow the syncing of facility data with Kolibri Data ... | mit | 23f255428182158c0a50f150fe416bfd | 36.052632 | 99 | 0.587121 | 4.100971 | false | false | false | false |
learningequality/kolibri | kolibri/utils/tests/test_version.py | 1 | 17771 | """
Tests for `kolibri` module.
"""
from __future__ import absolute_import
from __future__ import print_function
from __future__ import unicode_literals
import unittest
import mock
import kolibri
from kolibri.utils import version
#: Because we don't want to call the original (decorated function), it uses
#: caching... | mit | f1eeeb176d90ee633f4d1e003cfbda98 | 36.650424 | 113 | 0.568679 | 3.460759 | false | true | false | false |
learningequality/kolibri | kolibri/core/device/permissions.py | 1 | 1142 | from rest_framework.permissions import BasePermission
from kolibri.core.auth.permissions.general import DenyAll
class NotProvisionedCanPost(BasePermission):
def has_permission(self, request, view):
from .utils import device_provisioned
return not device_provisioned() and request.method == "POST"... | mit | 136038b3a18381cea3ed25f1abeee284 | 27.55 | 87 | 0.694396 | 4.214022 | false | false | false | false |
learningequality/kolibri | kolibri/core/content/migrations/0012_auto_20180910_1702.py | 4 | 1742 | # -*- coding: utf-8 -*-
# Generated by Django 1.11.15 on 2018-09-11 00:02
from __future__ import unicode_literals
from django.db import migrations
from django.db.models import Sum
from le_utils.constants import content_kinds
def calculate_fields(apps, schema_editor):
ChannelMetadata = apps.get_model("content", "... | mit | 2593a37658d16f334b200222c85c63ed | 34.55102 | 85 | 0.632032 | 4.127962 | false | false | false | false |
learningequality/kolibri | kolibri/core/content/management/commands/exportchannel.py | 1 | 1378 | import logging
import os
from ...utils import paths
from kolibri.core.tasks.management.commands.base import AsyncCommand
from kolibri.utils import file_transfer as transfer
logger = logging.getLogger(__name__)
class Command(AsyncCommand):
def add_arguments(self, parser):
parser.add_argument("channel_id"... | mit | bfeaf8720c0e276182aa22de470fc015 | 31.809524 | 84 | 0.605951 | 4.20122 | false | false | false | false |
learningequality/kolibri | test/test_future_and_futures.py | 1 | 1370 | import imp
import os
import sys
# Import from kolibri first to ensure Kolibri's monkey patches are applied.
from kolibri import dist as kolibri_dist # noreorder
dist_dir = os.path.realpath(os.path.dirname(kolibri_dist.__file__))
def test_import_concurrent_py3():
import concurrent
if sys.version_info[0] =... | mit | a1dabdda7e4aaef2163f366b7ab2cc68 | 33.25 | 79 | 0.650365 | 3.805556 | false | true | false | false |
learningequality/kolibri | kolibri/core/content/contentschema/versions/content_schema_current.py | 1 | 8454 | # coding: utf-8
from sqlalchemy import BigInteger
from sqlalchemy import Boolean
from sqlalchemy import CHAR
from sqlalchemy import Column
from sqlalchemy import Float
from sqlalchemy import ForeignKey
from sqlalchemy import Index
from sqlalchemy import Integer
from sqlalchemy import String
from sqlalchemy import Text
... | mit | c991814436af4f4ffd1e10212a5de3ff | 32.681275 | 103 | 0.681807 | 3.876204 | false | false | false | false |
learningequality/kolibri | kolibri/core/lessons/viewsets.py | 2 | 3599 | from django_filters.rest_framework import DjangoFilterBackend
from .serializers import LessonSerializer
from kolibri.core.api import ValuesViewset
from kolibri.core.auth.api import KolibriAuthPermissions
from kolibri.core.auth.api import KolibriAuthPermissionsFilter
from kolibri.core.auth.constants.collection_kinds im... | mit | 0f65914cbf752442f9c584e4c4dec806 | 35.353535 | 93 | 0.615449 | 4.080499 | false | false | false | false |
learningequality/kolibri | kolibri/core/utils/urls.py | 1 | 1196 | from django.urls import reverse
from six.moves.urllib.parse import urljoin
from kolibri.utils.conf import OPTIONS
def join_url(baseurl, url):
# Join the URL to baseurl, but remove any leading "/" to ensure that if there is a path prefix on baseurl
# it doesn't get ignored by the urljoin (which it would if th... | mit | cf50923f8cfeb4d6352f8c4ddd6ba31d | 43.296296 | 109 | 0.712375 | 3.947195 | false | false | false | false |
crowdresearch/daemo | csp/utils.py | 3 | 1599 | from django.core.exceptions import PermissionDenied
from oauth2_provider.oauth2_backends import get_oauthlib_core
from django.conf import settings
from django.utils.functional import SimpleLazyObject
from django.contrib.auth import get_user
try:
# django >= 1.8 && python >= 2.7
# https://docs.djangoproject.com... | mit | 614d0cdb3bf795441996f5e6b10652f5 | 33.021277 | 104 | 0.706692 | 3.957921 | false | false | false | false |
crowdresearch/daemo | crowdsourcing/views.py | 2 | 5003 | import base64
import hmac
import urllib
from urlparse import parse_qs
from django.conf import settings
from django.contrib.auth.decorators import login_required
from django.http import HttpResponseBadRequest, HttpResponseRedirect
from django.shortcuts import render
from django.utils.decorators import method_decorator
... | mit | 330afc3a07b5441ed8f4a37e02785b0c | 36.335821 | 118 | 0.651209 | 4.19363 | false | false | false | false |
crowdresearch/daemo | mturk/serializers.py | 3 | 1741 | from rest_framework import serializers
from rest_framework.exceptions import ValidationError
from crowdsourcing.serializers.dynamic import DynamicFieldsModelSerializer
from mturk.models import MTurkAccount
from mturk.interface import MTurkProvider
from crowdsourcing.crypto import AESUtil
from csp.settings import AWS_DA... | mit | 7012357d847da77fa3d9a128745f1e19 | 50.205882 | 103 | 0.677197 | 3.930023 | false | false | false | false |
crowdresearch/daemo | crowdsourcing/migrations/0000_get_min_ratings_fn.py | 2 | 2307 | # -*- coding: utf-8 -*-
# Generated by Django 1.9 on 2015-12-20 19:18
from __future__ import unicode_literals
from django.db import migrations
class Migration(migrations.Migration):
dependencies = [
('crowdsourcing', '0001_initial'),
]
operations = [
migrations.RunSQL('''
CREAT... | mit | 16ea8412832d9f722df7ec01b5228f93 | 44.235294 | 186 | 0.679237 | 3.182069 | false | false | false | false |
jrkerns/pylinac | pylinac/core/profile.py | 1 | 69802 | """Module of objects that resemble or contain a profile, i.e. a 1 or 2-D f(x) representation."""
from __future__ import annotations
import enum
import math
import warnings
from typing import Union, Tuple, Sequence, List, Optional
import argue
import matplotlib.pyplot as plt
import numpy as np
from matplotlib.patches ... | mit | 8a59d8d6147eac95cc20a23b9f8b9ec9 | 40.973542 | 182 | 0.570929 | 3.964896 | false | false | false | false |
jrkerns/pylinac | tests_basic/test_starshot.py | 1 | 13937 | import io
import os
import os.path as osp
import tempfile
from unittest import TestCase
import matplotlib.pyplot as plt
import numpy as np
from pylinac import Starshot
from pylinac.core.geometry import Point
from pylinac.starshot import StarshotResults
from tests_basic.utils import save_file, CloudFileMixin, get_file... | mit | 022bcc29d056db69d323dbc7afdd8dc0 | 28.782051 | 130 | 0.648059 | 3.075921 | false | true | false | false |
opennode/waldur-mastermind | src/waldur_core/logging/utils.py | 2 | 1517 | import datetime
import os
import tarfile
from io import BytesIO
from django.apps import apps
from django.core.files.base import ContentFile
from waldur_core.core.utils import datetime_to_timestamp
from waldur_core.logging.loggers import LoggableMixin
def get_loggable_models():
return [model for model in apps.ge... | mit | ebe55a8ba90732d1ce90b45035256bda | 29.34 | 85 | 0.702044 | 3.718137 | false | false | false | false |
opennode/waldur-mastermind | src/waldur_rancher/migrations/0022_rancheruserprojectlink.py | 2 | 1404 | # Generated by Django 2.2.10 on 2020-06-11 09:49
import django.db.models.deletion
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('waldur_rancher', '0021_rancher_user_uuid'),
]
operations = [
migrations.CreateModel(
name='Ran... | mit | b2ec43f9426c59efa3abf369db4d4da4 | 30.2 | 77 | 0.418091 | 5.05036 | false | false | false | false |
opennode/waldur-mastermind | src/waldur_core/structure/migrations/0016_customerpermissionreview.py | 2 | 1986 | # Generated by Django 2.2.13 on 2020-10-28 13:25
import django.db.models.deletion
import django.utils.timezone
import model_utils.fields
from django.conf import settings
from django.db import migrations, models
import waldur_core.core.fields
class Migration(migrations.Migration):
dependencies = [
migra... | mit | 4691e6143ab8f42b4b0e8342dd51f571 | 31.557377 | 73 | 0.447633 | 5.411444 | false | false | false | false |
opennode/waldur-mastermind | src/waldur_rancher/migrations/0027_cluster_template.py | 2 | 3327 | # Generated by Django 2.2.13 on 2020-07-07 15:17
import django.db.models.deletion
import django.utils.timezone
import model_utils.fields
from django.db import migrations, models
import waldur_core.core.fields
import waldur_core.core.validators
class Migration(migrations.Migration):
dependencies = [
('w... | mit | bb66a0a367fbfc867e98643e94a8d1f2 | 32.94898 | 79 | 0.409979 | 5.716495 | false | false | false | false |
opennode/waldur-mastermind | src/waldur_mastermind/marketplace/migrations/0052_limit_components.py | 2 | 2142 | from django.db import migrations, models
def migrate_offering_components_to_limit(apps, schema_editor):
OfferingComponent = apps.get_model('marketplace', 'OfferingComponent')
OfferingComponent.objects.filter(offering__type='Packages.Template').update(
billing_type='limit'
)
OfferingComponent.o... | mit | 2c3fa9857e6f2d0bd1d7352d41ebf20b | 34.7 | 87 | 0.581699 | 4.407407 | false | false | false | false |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.