repo_name stringlengths 7 65 | path stringlengths 5 186 | copies stringlengths 1 4 | size stringlengths 4 6 | content stringlengths 941 973k | license stringclasses 14
values | hash stringlengths 32 32 | line_mean float64 5 100 | line_max int64 26 999 | alpha_frac float64 0.25 0.93 | ratio float64 1.5 7.35 | autogenerated bool 1
class | config_or_test bool 2
classes | has_no_keywords bool 2
classes | has_few_assignments bool 1
class |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
bethgelab/foolbox | foolbox/attacks/fast_gradient_method.py | 1 | 2805 | from .gradient_descent_base import L1BaseGradientDescent
from .gradient_descent_base import L2BaseGradientDescent
from .gradient_descent_base import LinfBaseGradientDescent
from ..models.base import Model
from ..criteria import Misclassification, TargetedMisclassification
from .base import T
from typing import Union, A... | mit | 5fa0e98b1fa8d2865c83dfa825f7880e | 27.05 | 86 | 0.601783 | 4.348837 | false | false | false | false |
bethgelab/foolbox | foolbox/attacks/spatial_attack_transformations.py | 1 | 9311 | from typing import Tuple, Any
import numpy as np
import math
from eagerpy import astensor, Tensor
from eagerpy.tensor import TensorFlowTensor, PyTorchTensor
def rotate_and_shift(
inputs: Tensor,
translation: Tuple[float, float] = (0.0, 0.0),
rotation: float = 0.0,
) -> Any:
rotation = rotation * math.... | mit | 00ae58662d6fce73ad50e1fe8939676d | 32.858182 | 90 | 0.574911 | 3.126595 | false | false | false | false |
bethgelab/foolbox | foolbox/criteria.py | 1 | 4213 | """
===============================================================================
:mod:`foolbox.criteria`
===============================================================================
Criteria are used to define which inputs are adversarial.
We provide common criteria for untargeted and targeted adversarial attack... | mit | 3a86343e2478d716655aeed9f75ce47a | 28.461538 | 92 | 0.576074 | 4.078412 | false | false | false | false |
egnyte/gitlabform | gitlabform/processors/defining_keys.py | 1 | 2372 | from abc import ABC, abstractmethod
class AbstractKey(ABC):
@abstractmethod
def matches(self, e1, e2):
pass
@abstractmethod
def contains(self, entity):
pass
@abstractmethod
def explain(self) -> str:
pass
class Key(AbstractKey):
def __init__(self, value):
... | mit | 5dcdd911a1535925a6b22210f818a645 | 25.355556 | 86 | 0.605818 | 3.566917 | false | false | false | false |
egnyte/gitlabform | gitlabform/gitlab/__init__.py | 1 | 1828 | import enum
from typing import List
from gitlabform.gitlab.branches import GitLabBranches
from gitlabform.gitlab.commits import GitLabCommits
from gitlabform.gitlab.group_badges import GitLabGroupBadges
from gitlabform.gitlab.group_ldap_links import GitLabGroupLDAPLinks
from gitlabform.gitlab.members import GitLabMem... | mit | d2c7d089db81404c2eb2e2e69a04d6d0 | 29.466667 | 94 | 0.751641 | 3.707911 | false | false | false | false |
egnyte/gitlabform | tests/acceptance/test_group_members_users.py | 1 | 12986 | import pytest
from gitlabform.gitlab import AccessLevel
from tests.acceptance import (
run_gitlabform,
)
@pytest.fixture(scope="function")
def one_owner_and_two_developers(gitlab, group, users):
gitlab.add_member_to_group(group, users[0], AccessLevel.OWNER.value)
gitlab.add_member_to_group(group, users[... | mit | 9219e8a0aa5eb301d89b51fd1cd9721a | 33.815013 | 86 | 0.520022 | 4.069571 | false | false | false | false |
egnyte/gitlabform | gitlabform/output.py | 1 | 1998 | from logging import debug
from cli_ui import debug as verbose
from cli_ui import fatal
import yaml
from gitlabform import EXIT_INVALID_INPUT, EXIT_PROCESSING_ERROR
class EffectiveConfiguration:
"""
For upgrades and configuration refactoring we want to be able to compare the effective configurations before
... | mit | 0047464acc8cefda447b7140eeb08a5c | 33.448276 | 113 | 0.571071 | 4.510158 | false | true | false | false |
python-cmd2/cmd2 | cmd2/cmd2.py | 1 | 247319 | # coding=utf-8
"""Variant on standard library's cmd with extra features.
To use, simply import cmd2.Cmd instead of cmd.Cmd; use precisely as though you
were using the standard library's cmd, while enjoying the extra features.
Searchable command history (commands: "history")
Run commands from file, save to file, edit ... | mit | bdfb2ccd06dd4e180353a769df3f20fb | 44.304085 | 127 | 0.604614 | 4.529247 | false | false | false | false |
python-cmd2/cmd2 | examples/paged_output.py | 1 | 1847 | #!/usr/bin/env python
# coding=utf-8
"""A simple example demonstrating the using paged output via the ppaged() method.
"""
import os
from typing import (
List,
)
import cmd2
class PagedOutput(cmd2.Cmd):
"""Example cmd2 application which shows how to display output using a pager."""
def __init__(self):
... | mit | d589eb4efe4b8344bb8a380c63e08609 | 28.790323 | 106 | 0.61072 | 3.761711 | false | false | false | false |
python-cmd2/cmd2 | examples/scripts/save_help_text.py | 1 | 3322 | # coding=utf-8
# flake8: noqa F821
"""
A cmd2 script that saves the help text for every command, subcommand, and topic to a file.
This is meant to be run within a cmd2 session using run_pyscript.
"""
import argparse
import os
import sys
from typing import (
List,
TextIO,
)
ASTERISKS = "***********************... | mit | 299ef844d3944f7a39e0ebc922d52de6 | 29.2 | 92 | 0.610175 | 3.796571 | false | false | false | false |
python-cmd2/cmd2 | examples/dynamic_commands.py | 1 | 1613 | #!/usr/bin/env python3
# coding=utf-8
"""A simple example demonstrating how do_* commands can be created in a loop.
"""
import functools
import cmd2
from cmd2.constants import (
COMMAND_FUNC_PREFIX,
HELP_FUNC_PREFIX,
)
COMMAND_LIST = ['foo', 'bar']
CATEGORY = 'Dynamic Commands'
class CommandsInLoop(cmd2.Cmd... | mit | 6742c7918c7c0c25f307f548f95a6d18 | 31.918367 | 96 | 0.640422 | 3.924574 | false | false | false | false |
python-cmd2/cmd2 | examples/persistent_history.py | 1 | 1178 | #!/usr/bin/env python
# coding=utf-8
"""This example demonstrates how to enable persistent readline history in your cmd2 application.
This will allow end users of your cmd2-based application to use the arrow keys and Ctrl+r in a manner which persists
across invocations of your cmd2 application. This can make it much ... | mit | 75c77550c2d83d51e6c9290855c899ec | 34.69697 | 118 | 0.691851 | 3.913621 | false | false | false | false |
python-cmd2/cmd2 | examples/decorator_example.py | 1 | 4375 | #!/usr/bin/env python
# coding=utf-8
"""A sample application showing how to use cmd2's argparse decorators to
process command line arguments for your application.
Thanks to cmd2's built-in transcript testing capability, it also
serves as a test suite when used with the exampleSession.txt transcript.
Running `python d... | mit | be748539e0ae1a7b0c749f6fe2a00d0a | 36.715517 | 110 | 0.648457 | 3.774806 | false | false | false | false |
python-cmd2/cmd2 | examples/modular_commands_main.py | 1 | 2379 | #!/usr/bin/env python
# coding=utf-8
"""
A complex example demonstrating a variety of methods to load CommandSets using a mix of command decorators
with examples of how to integrate tab completion with argparse-based commands.
"""
import argparse
from typing import (
Iterable,
List,
Optional,
)
from modula... | mit | b7a2610aa1eff42ba93d4a195202e210 | 32.041667 | 127 | 0.69525 | 3.971619 | false | false | false | false |
python-cmd2/cmd2 | plugins/ext_test/tests/test_ext_test.py | 1 | 1797 | #
# coding=utf-8
import cmd2_ext_test
import pytest
from cmd2 import (
CommandResult,
cmd2,
)
######
#
# define a class which implements a simple cmd2 application
#
######
OUT_MSG = 'this is the something command'
class ExampleApp(cmd2.Cmd):
"""An class to show how to use a plugin"""
def __init__... | mit | 9eda90915ec3e865c75878a45566bdfb | 22.337662 | 73 | 0.680579 | 3.791139 | false | true | false | false |
python-cmd2/cmd2 | examples/python_scripting.py | 1 | 4493 | #!/usr/bin/env python
# coding=utf-8
"""A sample application for how Python scripting can provide conditional
control flow of a cmd2 application.
cmd2's built-in scripting capability, which can be invoked via the "@" shortcut
or "run_script" command, uses basic ASCII/UTF-8 text scripts and is very easy
to use. Moreov... | mit | ab3cd50e3391b82feb4c1e464b26bb85 | 35.16129 | 118 | 0.637823 | 4.072661 | false | false | false | false |
python-cmd2/cmd2 | examples/read_input.py | 1 | 4590 | #!/usr/bin/env python
# coding=utf-8
"""
A simple example demonstrating the various ways to call cmd2.Cmd.read_input() for input history and tab completion
"""
from typing import (
List,
)
import cmd2
EXAMPLE_COMMANDS = "Example Commands"
class ReadInputApp(cmd2.Cmd):
def __init__(self, *args, **kwargs) -> ... | mit | e1bf92b1e5f5f13024517eb8e092e9f3 | 36.016129 | 127 | 0.6061 | 4.094558 | false | false | false | false |
pydoit/doit | tests/test_cmd_ignore.py | 3 | 2577 | from io import StringIO
import pytest
from doit.exceptions import InvalidCommand
from doit.dependency import DbmDB, Dependency
from doit.cmd_ignore import Ignore
from .conftest import tasks_sample, CmdFactory
class TestCmdIgnore(object):
@pytest.fixture
def tasks(self, request):
return tasks_sample... | mit | 543cedf4729473b98697aacd31b65933 | 37.462687 | 79 | 0.583624 | 3.784141 | false | true | false | false |
pydoit/doit | doit/reporter.py | 1 | 9941 | """Reports doit execution status/results"""
import sys
import time
import datetime
import json
from io import StringIO
from .exceptions import BaseFail
class ConsoleReporter(object):
"""Default reporter. print results on console/terminal (stdout/stderr)
@ivar failure_verbosity: (int) include captured stdou... | mit | dd913e54e04282a339df3e696bc8fa0c | 33.161512 | 78 | 0.57972 | 4.067512 | false | false | false | false |
pydoit/doit | doit/cmd_completion.py | 1 | 11827 | """generate shell script with tab completion code for doit commands/tasks"""
import os
import sys
from string import Template
from .exceptions import InvalidCommand
from .cmd_base import DoitCmdBase
opt_shell = {
'name': 'shell',
'short': 's',
'long': 'shell',
'type': str,
'choices': (('bash', ''... | mit | 07dbcd5766e10ab17f2225b7493523c0 | 30.041995 | 97 | 0.532341 | 3.643561 | false | false | false | false |
grow/grow | grow/extensions/core/routes_extension.py | 1 | 7430 | """Routes core extension."""
import os
from werkzeug import wrappers
from grow import extensions
from grow.collections import collection
from grow.common import timer
from grow.extensions import hooks
from grow.performance import docs_loader
from grow.pods import ui
from grow.routing import router as grow_router
from ... | mit | a79c127d5765726d5a8a77812e6fc694 | 39.824176 | 95 | 0.591521 | 4.33742 | false | false | false | false |
grow/grow | grow/cache/document_cache.py | 1 | 1317 | """
Cache for storing and retrieving data specific to a document.
Supports caching specific to the pod_path of a document.
The contents of the cache should be raw and not internationalized as it will
be shared between locales with the same pod_path.
"""
class DocumentCache:
def __init__(self):
self.rese... | mit | 27982485acd395f655512ee530cdad7f | 25.877551 | 76 | 0.617312 | 3.618132 | false | false | false | false |
grow/grow | grow/sdk/installer.py | 1 | 2687 | # coding: utf8
"""Base installer class."""
from grow.common import colors
from grow.sdk.installers import base_installer
EXTRA_FORMAT = '{}\n {}'
MESSAGE_FORMAT = '[{}] {}'
class Error(Exception):
"""Base error for installers."""
def __init__(self, message):
super(Error, self).__init__(message)
... | mit | 2f1e7c62d52bcca86c759d740baa7c3e | 32.962025 | 97 | 0.59262 | 4.555178 | false | false | false | false |
grow/grow | grow/performance/docs_loader.py | 1 | 6425 | """Threaded loader that forces a list of docs to be loaded from filesystem."""
import sys
import traceback
from multiprocessing.dummy import Pool as ThreadPool
from grow.common import bulk_errors
from grow.documents import document_front_matter
class Error(Exception):
"""Base loading error."""
def __init__(... | mit | 77ed81dccdd59d51a44e07305476aacb | 37.473054 | 80 | 0.519689 | 4.612347 | false | false | false | false |
grow/grow | grow/pods/messages.py | 3 | 3571 | from protorpc import messages
class Kind(messages.Enum):
RENDERED = 1
STATIC = 2
SITEMAP = 3
class RouteMessage(messages.Message):
path = messages.StringField(1)
kind = messages.EnumField(Kind, 2)
locale = messages.StringField(3)
class Format(messages.Enum):
YAML = 1
MARKDOWN = 2
... | mit | ab2cba73bcb95a83362cb148d7f250dc | 25.065693 | 76 | 0.712405 | 3.819251 | false | false | false | false |
grow/grow | grow/common/untag.py | 1 | 6938 | """Untag an object using convention based keys."""
import re
from boltons import iterutils
LOCALIZED_KEY_REGEX = re.compile(r'(.*)@([^@]+)$')
class Untag:
"""Untagging utility for locale and environment based untagging."""
@staticmethod
def untag(data, locale_identifier=None, params=None):
"""... | mit | 795bef723b187c40b207ba3b4bff2465 | 38.420455 | 98 | 0.567455 | 4.391139 | false | false | false | false |
grow/grow | grow/preprocessors/gulp.py | 2 | 1917 | """Preprocessor for running gulp tasks."""
import os
import atexit
import subprocess
from protorpc import messages
from grow.common import subprocesses
from grow.preprocessors import base
from grow.sdk import sdk_utils
# Keep track of any child processes to terminate on exit.
# pylint: disable=invalid-name
_child_pr... | mit | 0f4b7d02fe95f640a4e9151c398eba5e | 31.491525 | 77 | 0.657799 | 4.027311 | false | true | false | false |
grow/grow | grow/routing/path_filter.py | 1 | 2330 | """Filter paths to control ignores and includes by path."""
import re
DEFAULT_IGNORED = [
re.compile(r'^.*/\.[^/]*$'), # Dot files.
]
DEFAULT_INCLUDED = []
class PathFilter:
"""Filter for testing paths against a set of filter criteria."""
def __init__(self, ignored=None, included=None):
self.... | mit | 9621712b357fca85314ec77f58ef8e56 | 27.765432 | 82 | 0.566953 | 4.379699 | false | false | false | false |
grow/grow | grow/rendering/render_pool.py | 1 | 4275 | """Rendering pool for grow documents."""
import random
import threading
from grow.templates import filters
from grow.templates import jinja_dependency
from grow.templates import tags
from grow.templates import tests as jinja_tests
class Error(Exception):
"""Base rendering pool error."""
def __init__(self, m... | mit | 7000a03bed44cbaebecbccc2cfc85dc2 | 36.173913 | 92 | 0.587135 | 4.249503 | false | false | false | false |
grow/grow | grow/collections/collection.py | 1 | 17091 | """Collections contain content documents and blueprints."""
import copy
import logging
import operator
import os
import re
import sys
from grow.collections import collection_routes
from grow.common import features
from grow.common import structures
from grow.common import untag
from grow.common import utils
from grow.... | mit | e4cb4012d4717392f560b692ffb0a254 | 36.895787 | 88 | 0.586449 | 4.244102 | false | false | false | false |
grow/grow | grow/sdk/installers/npm_installer.py | 1 | 5556 | """NPM installer class."""
import subprocess
from grow.sdk import sdk_utils
from grow.sdk.installers import base_installer
INSTALL_HASH_FILE = '/node_modules/install-hash.txt'
NPM_LOCK_FILE = '/package-lock.json'
PACKAGE_FILE = '/package.json'
YARN_LOCK_FILE = '/yarn.lock'
class NpmInstaller(base_installer.BaseIns... | mit | fd2de70d5068e57108952054d6619988 | 38.971223 | 95 | 0.594672 | 3.994249 | false | false | false | false |
grow/grow | grow/common/utils.py | 1 | 21454 | """Common grow utility functions."""
import csv as csv_lib
import codecs
import fnmatch
import functools
import gettext
import json
import logging
import os
import re
import string
import sys
import threading
import time
from urllib import parse as url_parse
from collections import OrderedDict
import yaml
import bs4
i... | mit | 44f57663f4519501b63205f70befa44f | 32.262016 | 110 | 0.581756 | 4.03878 | false | false | false | false |
reviewboard/reviewboard | reviewboard/diffviewer/views.py | 1 | 32218 | import logging
import os
import re
import traceback
from io import BytesIO
from zipfile import ZipFile
from django.conf import settings
from django.core.paginator import InvalidPage, Paginator
from django.http import (HttpResponse,
HttpResponseNotFound,
HttpResponseNot... | mit | e48082cd511bc4e04374a40200493e9e | 35.445701 | 79 | 0.550189 | 4.66657 | false | false | false | false |
reviewboard/reviewboard | contrib/profiling/gather_profile_stats.py | 1 | 1055 | #!/usr/bin/env python
"""
gather_profile_stats.py /path/to/dir/of/profiles
Note that the aggregated profiles must be read with pstats.Stats, not
hotshot.stats (the formats are incompatible)
"""
import os
import pstats
import sys
from hotshot import stats
def gather_stats(p):
profiles = {}
for f in os.listd... | mit | 0f7fb89f5d8702af1b59091275ec599c | 23.534884 | 69 | 0.545024 | 3.38141 | false | false | false | false |
reviewboard/reviewboard | reviewboard/attachments/managers.py | 1 | 2856 | from django.db.models import Manager, Q
class FileAttachmentManager(Manager):
"""Manages FileAttachment objects.
Adds utility functions for looking up FileAttachments based on other
objects.
"""
def create_from_filediff(self, filediff, from_modified=True, save=True,
... | mit | ee47a6c5a34d60a110c24eb8e68c93b3 | 39.225352 | 77 | 0.585434 | 4.984293 | false | false | false | false |
python-jsonschema/jsonschema | jsonschema/tests/test_exceptions.py | 1 | 19639 | from unittest import TestCase
import textwrap
from jsonschema import exceptions
from jsonschema.validators import _LATEST_VERSION
class TestBestMatch(TestCase):
def best_match_of(self, instance, schema):
errors = list(_LATEST_VERSION(schema).iter_errors(instance))
best = exceptions.best_match(ite... | mit | b05b6c7a298104b53916970b1ee01d64 | 31.677205 | 79 | 0.488772 | 4.372968 | false | true | false | false |
spaam/svtplay-dl | lib/svtplay_dl/subtitle/__init__.py | 1 | 16087 | import json
import logging
import re
import xml.etree.ElementTree as ET
from io import StringIO
from requests import __build__ as requests_version
from svtplay_dl.utils.fetcher import filter_files
from svtplay_dl.utils.http import get_full_url
from svtplay_dl.utils.http import HTTP
from svtplay_dl.utils.output import ... | mit | 35510f8a90deed6951ec750caadd50e0 | 32.444906 | 125 | 0.451234 | 3.753383 | false | false | false | false |
exercism/python | exercises/practice/forth/.meta/example.py | 2 | 2097 | class StackUnderflowError(Exception):
"""Exception raised when Stack is not full.
message: explanation of the error.
"""
def __init__(self, message):
self.message = message
def is_integer(string):
try:
int(string)
return True
except ValueError:
return False
... | mit | 55be44e2dbb5e585002d7890c27b4ccb | 30.772727 | 89 | 0.491655 | 4.452229 | false | false | false | false |
pinax/django-user-accounts | account/admin.py | 2 | 1314 | from django.contrib import admin
from account.models import (
Account,
AccountDeletion,
EmailAddress,
PasswordExpiry,
PasswordHistory,
SignupCode,
)
class SignupCodeAdmin(admin.ModelAdmin):
list_display = ["code", "max_uses", "use_count", "expiry", "created"]
search_fields = ["code",... | mit | 59d6c0d883711c1ba6afa33b2a23f21b | 22.890909 | 73 | 0.711568 | 3.619835 | false | false | false | false |
spaam/svtplay-dl | lib/svtplay_dl/service/nrk.py | 1 | 1521 | # ex:ts=4:sw=4:sts=4:et
# -*- tab-width: 4; c-basic-offset: 4; indent-tabs-mode: nil -*-
import copy
import re
from svtplay_dl.error import ServiceError
from svtplay_dl.fetcher.hls import hlsparse
from svtplay_dl.service import OpenGraphThumbMixin
from svtplay_dl.service import Service
from svtplay_dl.subtitle import ... | mit | 80a99dd0c72b8b272268e0d2a6392544 | 37.025 | 99 | 0.583169 | 3.570423 | false | false | false | false |
exercism/python | exercises/practice/bowling/.meta/example.py | 2 | 3367 | MAX_FRAME = 10
class Frame:
def __init__(self, idx):
self.idx = idx
self.throws = []
@property
def total_pins(self):
"""Total pins knocked down in a frame."""
return sum(self.throws)
def is_strike(self):
return self.total_pins == 10 and len(self.throws) == 1
... | mit | 8d0ff93ffc7921c919f09419083ca849 | 33.010101 | 78 | 0.575884 | 3.736959 | false | false | false | false |
rubik/radon | radon/visitors.py | 1 | 14879 | '''This module contains the ComplexityVisitor class which is where all the
analysis concerning Cyclomatic Complexity is done. There is also the class
HalsteadVisitor, that counts Halstead metrics.'''
import ast
import collections
import operator
# Helper functions to use in combination with map()
GET_COMPLEXITY = ope... | mit | a6a690ac9c8a138f6d01271a6351dd88 | 31.845475 | 79 | 0.587808 | 4.243868 | false | false | false | false |
hendrix/hendrix | examples/django_nyc_demo/hendrix_demo/settings.py | 3 | 2666 | """
Django settings for hendrix_demo project.
Generated by 'django-admin startproject' using Django 1.8.4.
For more information on this file, see
https://docs.djangoproject.com/en/1.8/topics/settings/
For the full list of settings and their values, see
https://docs.djangoproject.com/en/1.8/ref/settings/
"""
# Build... | mit | 69ada2e0e2a8643e22e7d514e3027125 | 26.204082 | 71 | 0.690923 | 3.435567 | false | false | false | false |
hendrix/hendrix | test/test_crosstown_traffic.py | 2 | 9807 | import threading
import pytest
import pytest_twisted
from six.moves.queue import Queue
from twisted.internet import reactor
from twisted.internet.address import IPv4Address
from twisted.internet.threads import deferToThreadPool
from twisted.logger import Logger
from twisted.python.threadpool import ThreadPool
from twi... | mit | a66ae8429ac7c663244c4551a2cd39b2 | 32.020202 | 128 | 0.661364 | 3.58312 | false | true | false | false |
hendrix/hendrix | hendrix/contrib/cache/backends/__init__.py | 3 | 4357 | """
Fuck YEAH. enthusiasm.
"""
try:
import urlparse
except ImportError:
from urllib.parse import urlparse
from hendrix.contrib.cache import compressBuffer, decompressBuffer
PREFIX = "/CACHE"
class CacheBackend(object):
"The api to use when creating a cache backend"
@property
def cache(self):
... | mit | 350d558ecf5d6005f1cd7e942919ea47 | 34.137097 | 79 | 0.562084 | 4.654915 | false | false | false | false |
hendrix/hendrix | hendrix/contrib/concurrency/messaging.py | 3 | 4774 | import copy
import json
import uuid
import warnings
warnings.warn("hendrix.contrib.concurrency.messaging is being deprecated. Use hendrix.experience.hey_joe instead.",
DeprecationWarning)
class RecipientManager(object):
"""
This class manages all the transports addressable by a single add... | mit | ced093c2872d8e66efccc93d9ccc97bd | 28.288344 | 116 | 0.621491 | 4.508026 | false | false | false | false |
rubik/radon | radon/cli/colors.py | 1 | 1133 | '''Module holding constants used to format lines that are printed to the
terminal.
'''
import os
import sys
def color_enabled():
COLOR_ENV = os.getenv('COLOR', 'auto')
if COLOR_ENV == 'auto' and sys.stdout.isatty():
return True
if COLOR_ENV == 'yes':
return True
return False
try:
... | mit | d174fcd2d3843cf51b8077eed326bf9b | 22.122449 | 72 | 0.586937 | 2.942857 | false | false | false | false |
rubik/radon | radon/metrics.py | 1 | 4913 | '''Module holding functions related to miscellaneous metrics, such as Halstead
metrics or the Maintainability Index.
'''
import ast
import collections
import math
from radon.raw import analyze
from radon.visitors import ComplexityVisitor, HalsteadVisitor
# Halstead metrics
HalsteadReport = collections.namedtuple(
... | mit | e8fa816b5c4639fbd426ac7c8632ee82 | 30.292994 | 79 | 0.630775 | 3.506781 | false | false | false | false |
pastas/pastas | doc/convert_nb.py | 2 | 1697 | """ This script is called by sphinxdoc, to add a link to all Jupyter notebooks
in the Examples folder, so they are converted to HTML for the documentation.
"""
import os
from_path = '../examples/notebooks'
to_path = 'examples'
# first delete existing links in examples directory
for file in os.listdir(to_path):
if... | mit | 57e292532a837bd9df668155f3b24e00 | 38.465116 | 79 | 0.608721 | 3.301556 | false | false | false | false |
pastas/pastas | pastas/stats/core.py | 2 | 13172 | """The following methods may be used to calculate the crosscorrelation and
autocorrelation for a time series.
These methods are 'special' in the sense that they are able to deal with
irregular time steps often observed in hydrological time series.
"""
from numpy import (append, arange, array, average, corrcoef, diff,... | mit | 4afece25dc091e6b4421afc7c716725a | 34.408602 | 80 | 0.614637 | 3.60383 | false | false | false | false |
pipermerriam/flex | flex/loading/schema/base_path.py | 1 | 1054 | from six.moves import urllib_parse as urlparse
from flex.datastructures import (
ValidationList,
)
from flex.constants import (
STRING,
)
from flex.exceptions import ValidationError
from flex.error_messages import MESSAGES
from flex.validation.common import (
generate_object_validator,
generate_type_va... | mit | 5a2a164284d31f1ebf22e8fbb2b1411a | 22.954545 | 72 | 0.727704 | 3.621993 | false | false | false | false |
pipermerriam/flex | flex/validation/operation.py | 1 | 7252 | import functools
from flex.datastructures import ValidationDict
from flex.exceptions import ValidationError
from flex.functional import chain_reduce_partial
from flex.functional import attrgetter
from flex.context_managers import ErrorDict
from flex.http import (
Request,
)
from flex.constants import (
QUERY,
... | mit | d39390d3f99e78e598e5a6395674a077 | 30.258621 | 93 | 0.655268 | 4.479308 | false | false | false | false |
kornai/4lang | src/fourlang/magyarlanc_wrapper_old.py | 3 | 1668 | from tempfile import NamedTemporaryFile
import json
import subprocess
import os
from utils import ensure_dir
class MagyarlancWrapper():
def __init__(self, cfg):
self.cfg = cfg
def parse_sentences(self, entries):
os.chdir('magyarlanc')
self.tmp_dir = '../' + self.cfg.get('data', 'tm... | mit | 971902cd092320218d4d03b3f243baee | 28.263158 | 76 | 0.556355 | 3.518987 | false | false | false | false |
pipermerriam/flex | flex/loading/common/schema/max_properties.py | 1 | 1616 | from flex.exceptions import ValidationError
from flex.error_messages import MESSAGES
from flex.constants import (
INTEGER,
EMPTY,
OBJECT,
)
from flex.utils import pluralize
from flex.validation.common import (
generate_object_validator,
)
from flex.validation.schema import (
construct_schema_validat... | mit | 2712c75944ce852b09b0a58e8635f9b7 | 29.490566 | 85 | 0.650371 | 4.080808 | false | false | false | false |
pipermerriam/flex | flex/utils.py | 1 | 5708 | import math
import numbers
from six.moves import urllib_parse as urlparse
import six
import jsonpointer
from flex._compat import Mapping, Sequence
from flex.constants import (
PRIMITIVE_TYPES,
NULL,
BOOLEAN,
INTEGER,
NUMBER,
STRING,
ARRAY,
OBJECT,
TRUE_VALUES,
FALSE_VALUES,
)
... | mit | a649632e202599c92fd1377ab85fdd99 | 27.39801 | 88 | 0.612999 | 3.830872 | false | false | false | false |
kornai/4lang | src/fourlang/demo/demo.py | 2 | 5351 | import logging
import os
import random
# import sys
from flask import Flask, render_template, request, url_for
from fourlang.corenlp_wrapper import CoreNLPWrapper
from fourlang.utils import draw_dep_graph, draw_text_graph, ensure_dir, get_cfg
from fourlang.dependency_processor import Dependencies
from fourlang.dep_to... | mit | 6e31bb63975b4a3c1828362276803d10 | 35.155405 | 110 | 0.605494 | 3.166272 | false | false | false | false |
kornai/4lang | V2/def_ply_parser.py | 1 | 16027 | # Copyright © 2021 Adam Kovacs <adaam.ko@gmail.com>
# Distributed under terms of the MIT license.
from ply import lex
from ply.lex import TOKEN
import ply.yacc as yacc
import sys
import getopt
import argparse
import os
import re
BINARIES = []
with open(
os.path.join(os.path.dirname(os.path.realpat... | mit | b7ca0c0dd2508710f1512e0c9e6a8e3d | 29.671937 | 194 | 0.431611 | 3.727844 | false | false | false | false |
kornai/4lang | scripts/coverage.py | 3 | 1922 | """Given a dict file and a word frequency list from a corpus, measure type and
token coverage of the dictionary on the corpus"""
import json
import re
import sys
import hunspell
def log(s):
sys.stderr.write(s+'\n')
lowercase_patt = re.compile('^[a-z]+$')
def discard(word):
return not bool(lowercase_patt.mat... | mit | 42f216af0145ee2d108dd310f6cbe2e9 | 27.686567 | 78 | 0.603018 | 3.39576 | false | false | false | false |
joke2k/django-environ | environ/compat.py | 1 | 1682 | # This file is part of the django-environ.
#
# Copyright (c) 2021-2022, Serghei Iakovlev <egrep@protonmail.ch>
# Copyright (c) 2013-2021, Daniele Faraglia <daniele.faraglia@gmail.com>
#
# For the full copyright and license information, please view
# the LICENSE.txt file that was distributed with this source code.
"""T... | mit | 6584d122f85e5d2e69b12c71c09bf593 | 31.346154 | 72 | 0.736029 | 3.571125 | false | false | false | false |
robotpy/pyfrc | pyfrc/mains/cli_deploy.py | 1 | 18231 | import argparse
import contextlib
import subprocess
import datetime
import socket
import inspect
import json
import os
import sys
import re
import shutil
import tempfile
import threading
from os.path import abspath, basename, dirname, join, splitext
from pathlib import PurePosixPath
from robotpy_installer import ssh... | mit | a0e5e63782608343522ca4a84e8f552c | 32.761111 | 128 | 0.52696 | 4.175676 | false | false | false | false |
robotpy/pyfrc | pyfrc/mains/cli_coverage.py | 1 | 1596 | import argparse
import inspect
from os.path import dirname
import subprocess
import sys
class PyFrcCoverage:
"""
Wraps other commands by running them via the coverage module. Requires
the coverage module to be installed.
"""
def __init__(self, parser):
parser.add_argument(
"ar... | mit | 874ff053e821ebac6068f3a96666d1c7 | 27 | 98 | 0.558897 | 4.495775 | false | false | false | false |
alisaifee/flask-limiter | examples/kitchensink.py | 1 | 3224 | import jinja2
from flask import Blueprint, Flask, jsonify, request, render_template, make_response
from flask.views import View
import flask_limiter
from flask_limiter import ExemptionScope, Limiter
from flask_limiter.util import get_remote_address
def index_error_responder(request_limit):
error_template = jinja... | mit | 3c5352466e7b9f5df055c47c7f3c15c2 | 28.577982 | 88 | 0.629963 | 3.926918 | false | false | false | false |
robotpy/pyfrc | pyfrc/physics/visionsim.py | 1 | 7894 | """
The 'vision simulator' provides objects that assist in modeling inputs
from a camera processing system.
"""
import collections
import math
inf = float("inf")
twopi = math.pi * 2.0
def _in_angle_interval(x, a, b):
return (x - a) % twopi <= (b - a) % twopi
class VisionSimTarget:
"""
Target o... | mit | 604ec193227709be2df12aa64b7d77cb | 32.449153 | 99 | 0.589182 | 4.069072 | false | false | false | false |
alisaifee/flask-limiter | versioneer.py | 9 | 81180 |
# Version: 0.22
"""The Versioneer - like a rocketeer, but for versions.
The Versioneer
==============
* like a rocketeer, but for versions!
* https://github.com/python-versioneer/python-versioneer
* Brian Warner
* License: Public Domain
* Compatible with: Python 3.6, 3.7, 3.8, 3.9, 3.10 and pypy3
* [![Latest Versio... | mit | 492b6e296b5a383c811f4b77184418af | 36.934579 | 87 | 0.609731 | 3.949788 | false | false | false | false |
explosion/thinc | examples/type_checking.py | 2 | 1454 | from typing import List
from thinc.layers import Relu, Softmax, chain, reduce_max, concatenate
from thinc.model import Model
# Define Custom X/Y types
MyModelX = List[List[float]]
MyModelY = List[List[float]]
model: Model[MyModelX, MyModelY] = chain(
Relu(12), Relu(12, dropout=0.2), Softmax(),
)
# ERROR: incompat... | mit | 2e3a69123904034ff32abe4868a9e153 | 33.619048 | 85 | 0.722834 | 3.154013 | false | false | false | false |
rapptz/discord.py | examples/views/persistent.py | 3 | 2902 | # This example requires the 'message_content' privileged intent to function.
from discord.ext import commands
import discord
# Define a simple View that persists between bot restarts
# In order a view to persist between restarts it needs to meet the following conditions:
# 1) The timeout of the View has to be set to... | mit | b3e7ec0b0273e04831276904982f1161 | 42.969697 | 105 | 0.709855 | 3.853918 | false | false | false | false |
rapptz/discord.py | discord/emoji.py | 1 | 8627 | """
The MIT License (MIT)
Copyright (c) 2015-present Rapptz
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, merg... | mit | fb1f74a5344d343bf28c78a7eeb180a5 | 32.30888 | 139 | 0.611221 | 3.882538 | false | false | false | false |
explosion/thinc | thinc/layers/dish.py | 1 | 2003 | from typing import Tuple, Optional, Callable, cast
from ..config import registry
from ..model import Model
from .chain import chain
from .layernorm import LayerNorm
from .dropout import Dropout
from ..types import Floats1d, Floats2d
from ..util import partial, get_width
from ..initializers import he_normal_init, zero_... | mit | 8b122a5c221de1205a818af86fe928ea | 29.348485 | 87 | 0.624064 | 2.873745 | false | false | false | false |
rapptz/discord.py | examples/basic_voice.py | 3 | 4474 | # This example requires the 'message_content' privileged intent to function.
import asyncio
import discord
import youtube_dl
from discord.ext import commands
# Suppress noise about console usage from errors
youtube_dl.utils.bug_reports_message = lambda: ''
ytdl_format_options = {
'format': 'bestaudio/best',
... | mit | fb189fe7797aed1a969f0fb6fd78f280 | 28.629139 | 101 | 0.628297 | 3.605157 | false | false | false | false |
rapptz/discord.py | discord/errors.py | 2 | 8952 | """
The MIT License (MIT)
Copyright (c) 2015-present Rapptz
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, merg... | mit | 968a0fcda1c7dd1539e6d31b95ab3ebe | 30.971429 | 123 | 0.657395 | 4.324638 | false | false | false | false |
explosion/thinc | thinc/layers/expand_window.py | 1 | 1641 | from typing import Tuple, TypeVar, Callable, Union, cast
from ..model import Model
from ..config import registry
from ..types import Floats2d, Ragged
InT = TypeVar("InT", Floats2d, Ragged)
@registry.layers("expand_window.v1")
def expand_window(window_size: int = 1) -> Model[InT, InT]:
"""For each vector in an ... | mit | 8006fe3b7dcc0648eded29e478b0e15d | 27.293103 | 86 | 0.627666 | 3.055866 | false | false | false | false |
explosion/thinc | thinc/layers/remap_ids.py | 1 | 3091 | from typing import Tuple, Callable, Sequence, cast
from typing import Dict, Union, Optional, Hashable, Any
from ..model import Model
from ..config import registry
from ..types import Ints1d, Ints2d, DTypes
from ..util import is_xp_array, to_numpy
InT = Union[Sequence[Hashable], Ints1d, Ints2d]
OutT = Ints2d
InT_v1 ... | mit | 7b8fb311afc2b53db797cb074d2b8992 | 30.222222 | 85 | 0.64154 | 3.41547 | false | false | false | false |
explosion/thinc | thinc/layers/with_ragged.py | 1 | 4070 | from typing import Tuple, Callable, Optional, TypeVar, cast, List, Union
from ..types import Padded, Ragged, Array2d, ListXd, List2d, Ints1d
from ..model import Model
from ..config import registry
RaggedData = Tuple[Array2d, Ints1d]
SeqT = TypeVar("SeqT", bound=Union[Padded, Ragged, ListXd, RaggedData])
@registry.l... | mit | a8170d18bae2cbcc3c99c22db2e87103 | 32.636364 | 83 | 0.652334 | 3.152595 | false | false | false | false |
newville/asteval | tests/test_asteval.py | 1 | 36322 | #!/usr/bin/env python
"""
Base TestCase for asteval
"""
import ast
import math
import os
import textwrap
import time
import unittest
from functools import partial
from io import StringIO
from sys import version_info
from tempfile import NamedTemporaryFile
import pytest
from asteval import Interpreter, NameFinder, mak... | mit | 80c7116b3923513999c35ed6a228db52 | 31.488372 | 220 | 0.471174 | 3.567626 | false | true | false | false |
b1naryth1ef/rowboat | rowboat/plugins/reddit.py | 2 | 5889 | import json
import emoji
import requests
from collections import defaultdict
from holster.enum import Enum
from disco.types.message import MessageEmbed
from rowboat.plugins import RowboatPlugin as Plugin
from rowboat.redis import rdb
from rowboat.models.guild import Guild
from rowboat.types.plugin import PluginConfi... | mit | 6522c24613483bcf8cc95d5b9f6572b3 | 32.651429 | 112 | 0.536763 | 4.075433 | false | true | false | false |
b1naryth1ef/rowboat | rowboat/plugins/utilities.py | 1 | 17636 | import random
import requests
import humanize
import operator
import gevent
from six import BytesIO
from PIL import Image
from peewee import fn
from gevent.pool import Pool
from datetime import datetime, timedelta
from collections import defaultdict
from disco.types.user import GameType, Status
from disco.types.messa... | mit | 9759edac19a59bb21b509b32cd799711 | 36.603412 | 111 | 0.581481 | 3.707379 | false | false | false | false |
b1naryth1ef/rowboat | tests/test_util_timing.py | 2 | 1570 | from gevent.monkey import patch_all
patch_all() # noqa: E402
import time
from gevent.event import AsyncResult, Event
from datetime import datetime, timedelta
from rowboat.util.timing import Eventual
def test_eventual_accuracy():
result = AsyncResult()
should_be_called_at = None
def f():
resul... | mit | 0520f5b6ca1d485751607322f0cb3615 | 23.920635 | 74 | 0.640127 | 3.473451 | false | false | false | false |
craffel/mir_eval | tests/test_melody.py | 1 | 17850 | # CREATED: 4/15/14 9:42 AM by Justin Salamon <justin.salamon@nyu.edu>
'''
Unit tests for mir_eval.melody
'''
import numpy as np
import json
import nose.tools
import mir_eval
import glob
import warnings
A_TOL = 1e-12
# Path to the fixture files
REF_GLOB = 'data/melody/ref*.txt'
EST_GLOB = 'data/melody/est*.txt'
SCORE... | mit | 37af51dcafe48daf74b5f796eb2bae33 | 39.568182 | 79 | 0.539664 | 3.248408 | false | true | false | false |
craffel/mir_eval | mir_eval/multipitch.py | 4 | 16801 | '''
The goal of multiple f0 (multipitch) estimation and tracking is to identify
all of the active fundamental frequencies in each time frame in a complex music
signal.
Conventions
-----------
Multipitch estimates are represented by a timebase and a corresponding list
of arrays of frequency estimates. Frequency estimat... | mit | 899a40f1ceaa4c0da9df87afa774ac9f | 32.138067 | 80 | 0.651806 | 3.849026 | false | false | false | false |
jorvis/biocode | gff/add_polypeptide_to_gff3_gene_models.py | 1 | 4683 | #!/usr/bin/env python3
'''
The biocode libraries primarly work with functional annotation attached to the polypeptide feature
of the canonical gene model. Many tools, though, produce gff with gene/mRNA/CDS/exon features but
no polypeptide entry.
This script checks the children of each mRNA and creates a polypeptid... | mit | 85118cc6f4dd2102761fca44305c8e3e | 45.366337 | 183 | 0.596413 | 2.971447 | false | false | false | false |
jorvis/biocode | sandbox/jorvis/digital_normalization.py | 3 | 2380 | #!/usr/bin/env python3
import argparse
import os
from collections import defaultdict
"""
You probably don't want to run this.
I've been using two different digital normalization tools for a while now and am only
writing this rudimentary implementation to get a better feel for the algorithm works.
If you need digit... | mit | 1a7c07d54735994cc28c8555e97f05ec | 29.512821 | 152 | 0.615966 | 3.617021 | false | false | false | false |
jorvis/biocode | general/filter_uniref_by_repid.py | 1 | 1596 | #!/usr/bin/env python3
"""
Filter a UniRef FASTA release by identifiers in the header. For example, if you have
a list of IDs like 'A7IAG2_METB6', this corresponds to this UniRef entry:
>UniRef100_A7IAG2 Farnesyltranstransferase n=1 Tax=Methanoregula boonei (strain DSM 21) TaxID=456442 RepID=A7IAG2_METB6
The RepID ... | mit | 046b2bda543ffa98a88688dfae41a619 | 25.163934 | 119 | 0.588972 | 3.469565 | false | false | false | false |
jorvis/biocode | genbank/download_assemblies_from_genbank.py | 1 | 9368 | #!/usr/bin/env python3
"""
This script is used to download the nucleotide assemblies (contigs/scaffolds) of one or more
genome projects based on the parent Genbank ID of each. It uses EUtils for this, such as:
https://eutils.ncbi.nlm.nih.gov/entrez/eutils/efetch.fcgi?db=nuccore&id=ACIN00000000&retmode=xml&rettype... | mit | 40053c6adcf6626c0c8866aafe6f8fd0 | 34.505703 | 214 | 0.639216 | 3.17619 | false | false | false | false |
jorvis/biocode | fasta/filter_fasta_by_header_regex.py | 2 | 1894 | #!/usr/bin/env python3
'''
Description:
This script reads a FASTA file and matches each header against a regular
expression passed by the user, only exporting those records which matched
it.
The use case for creating this was we had a mixed FASTA file of transcripts
from several different RNA-Seq assemblers. They e... | mit | 26c841c3f83e43260480a2935e4f315e | 25.305556 | 122 | 0.662091 | 3.488029 | false | false | false | false |
jorvis/biocode | fasta/reformat_fasta_residue_lengths.py | 1 | 1571 | #!/usr/bin/env python3
'''
Description:
This script reformats a FASTA file such that there are no more than N-characters
of sequence residues per line. The default is 60.
Input:
- A (multi-)FASTA file.
- Optional width (-w) of the residue lines. Default = 60
'''
import argparse
import sys
from biocode impor... | mit | 53ba6703d582b2467e90ab84f7ae585f | 27.563636 | 153 | 0.644812 | 3.371245 | false | false | false | false |
jorvis/biocode | sandbox/jcrabtree/group_rnaseq_transcripts_by_read_alignment/3-timing-tests/read_split_cigar_and_store.py | 2 | 2682 | #!/usr/bin/env python3
"""
Read BAM file, split each line into columns, build single NON-nested dict of transcript ids.
Also parses CIGAR line to compute coordinates and parses the read name.
"""
import argparse
import os
import re
import sys
def main():
parser = argparse.ArgumentParser( description='Groups... | mit | 147958f7e47f53f41bf8725b546d72be | 25.294118 | 132 | 0.540268 | 3.557029 | false | false | false | false |
jorvis/biocode | lib/biocode/genbank.py | 1 | 15620 | import math
import sys
import biocode.utils
"""
NOTE: This currently only works for coding features
EXAMPLES:
Ex1 (header portion of GenBank flat file):
|--------------- 67 character limit ------------------------------|
LOCUS HQ450365 735 bp DNA linear PLN 15-JUL-2011
DEF... | mit | 5e5d9c8b39d22f7828eb4c5bab22830a | 39.257732 | 135 | 0.531178 | 3.567024 | false | false | false | false |
jorvis/biocode | gff/convert_aat_btab_to_gff3.py | 3 | 16438 | #!/usr/bin/env python3
"""
Converts the btab output of AAT (nap/gap2) to GFF3 format with option-dependent modeling.
Example input:
jcf7180000787896 Aug 28 2013 16242 /usr/local/packages/aat/nap /usr/local/projects/mucormycosis/protein_alignments/fungi_jgi/fungi_jgi.faa jgi|Rhior3|10928|RO3G_0120... | mit | e8a067d33b3978b4774aed25aa7b0af0 | 41.040921 | 308 | 0.589366 | 3.335633 | false | false | false | false |
jorvis/biocode | fasta/subsample_fasta.py | 2 | 2225 | #!/usr/bin/env python3
"""
Randomly extract/subsample a specified number of sequences from an
input multi-FASTA file. If the number of sequences requested is
greater than the number of sequences in the file then all of the input
sequences will be printed. Otherwise, the exact number of
requested sequences will be r... | mit | 683f6f8bcbd99e6df696c2ad525e9572 | 31.246377 | 130 | 0.665618 | 3.745791 | false | false | false | false |
jorvis/biocode | sandbox/jorvis/generate_expression_by_size_plot.py | 1 | 3173 | #!/usr/bin/env python3
"""
I was given data generated using this protocol:
http://trinityrnaseq.sourceforge.net/analysis/abundance_estimation.html
Specifically, this file:
RSEM.isoforms.results
OUTPUT
If you pass a value of 'plot' to the -o parameter it will invoke the interactive plot viewer rather
tha... | mit | bcbabc84be38feb344ba332c34624e1b | 28.37963 | 142 | 0.600063 | 3.609784 | false | false | false | false |
jorvis/biocode | sandbox/jorvis/reference_coverage_plot.py | 1 | 8765 | #!/usr/bin/env python3
"""
Initially written to plot results from Priti's pipeline, where the goal was to determine
how well an assembled transcriptome (Trinity) produced contigs which covered a set of
reference transcripts. Steps in her pipeline:
export BASE=A8_muscle.trinity.standard
export TITLE=PASA
export REF=... | mit | 25db66b310f0a79c219c8af6433815a8 | 37.612335 | 233 | 0.621335 | 3.356951 | false | false | false | false |
jorvis/biocode | gff/filter_gff3_by_id_list.py | 1 | 2707 | #!/usr/bin/env python3
'''
This script is used if you want to filter a GFF3 file by IDs but also maintain any relationships
defined within the file. That is, if you have a list of mRNA identifiers and want to keep them,
but also wanted to keep any associated exons, CDS, etc.
Because common GFF3 usage doesn't guara... | mit | e8d8f9f1eb4f64ce126645311daece58 | 30.847059 | 127 | 0.62283 | 3.928882 | false | false | false | false |
jorvis/biocode | sandbox/jorvis/filter_longest_trinity_subcomponents.py | 1 | 3108 | #!/usr/bin/env python3
'''
DESCRIPTION
Written in response to a request on the Trinity user's list, asking for a script to export the
longest isoform for each component. Offered with the caveat so well explained by "Pseudonym":
http://seqanswers.com/forums/showthread.php?t=19129
The output of Inchworm is the set... | mit | 4ecea8f6a602bafea41b8d163daee7b3 | 34.318182 | 128 | 0.693694 | 3.5 | false | false | false | false |
jorvis/biocode | general/join_columnar_files.py | 1 | 2601 | #!/usr/bin/env python3
"""
Join columns like the linux command 'join' does but via indexing of the two files
so we can avoid all the difficult sorting issues.
Also assumes that each input file has a header line which is skipped unless the
option --no-header is passed.
Warning: this approach requires the loading of f... | mit | beb5981275f8efae6cfe087b1edf55a5 | 27.271739 | 125 | 0.604767 | 3.514865 | false | false | false | false |
jorvis/biocode | sandbox/jorvis/report_reorientation_stats.py | 2 | 1663 | #!/usr/bin/env python3
"""
Put some general, high-level documentation here
"""
import argparse
import os
import re
def main():
parser = argparse.ArgumentParser( description='Put a description of your script here' )
## output file to be written
parser.add_argument('-i', '--input_file', type=str, requir... | mit | 469b7e51eed826c9ee35cb9de0f176fb | 30.980769 | 112 | 0.64101 | 3.286561 | false | false | false | false |
jorvis/biocode | taxonomy/create_taxonomic_profile_from_blast.py | 2 | 11261 | #!/usr/bin/env python3.2
import argparse
import os
import re
import sqlite3
from collections import OrderedDict
from biocode.utils import read_list_file
def main():
"""This is the second script I've written in Python. I'm sure it shows."""
parser = argparse.ArgumentParser( description='Reads a BLAST m8 fil... | mit | 88d5fdfb085242118064a944609dfa61 | 35.092949 | 192 | 0.576503 | 3.538969 | false | false | false | false |
ginkgobioworks/edge | src/edge/ssr/__init__.py | 1 | 28360 | from Bio.Seq import Seq
# sites separated by more than these number of bps will not be considered as
# part of the same combination
SITE_SEPARATION_MAX = 50000
def rc(s):
return str(Seq(s).reverse_complement())
def lower_no_whitespace(s):
return s.replace(" ", "").lower()
def find_indices(big, small):
... | mit | 9f1a09d2e7b218b4e6a486e5bb2b43dd | 36.463672 | 100 | 0.601128 | 4.046226 | false | false | false | false |
ginkgobioworks/edge | src/edge/pcr.py | 1 | 6677 | from edge.blast import blast_genome, EDGE_BLAST_DEFAULT_WORD_SIZE
from Bio.Seq import Seq
MIN_BINDING_LENGTH = 15
BINDING_LENGTH_HI = 20
def compute_pcr_product(
primer_a_sequence,
primer_a_binding_check_len,
primer_a_blastres,
primer_b_sequence,
primer_b_binding_check_len,
primer_b_blastres,... | mit | 3a74629ca17a9cc1f3674a91daeb24d9 | 34.705882 | 86 | 0.633967 | 3.266634 | false | false | false | false |
ginkgobioworks/edge | src/edge/south_migrations/0011_auto__del_field_operation_fragment__add_field_feature_operation.py | 1 | 10455 | # -*- 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 'Operation.fragment'
db.delete_column(u"edge_operation", ... | mit | 1c9f8f1810700c877587392ac23e13b2 | 37.156934 | 126 | 0.423529 | 4.473684 | false | false | false | false |
ginkgobioworks/edge | src/edge/crispr.py | 1 | 4101 | import json
from edge.blast import blast_genome
from edge.models import Operation
from Bio.Seq import Seq
class CrisprTarget(object):
def __init__(
self, fragment_id, fragment_name, strand, subject_start, subject_end, pam
):
self.fragment_id = fragment_id
self.fragment_name = fragment_... | mit | 5123def1a1095b49ed81cc2edc19ab7a | 28.085106 | 83 | 0.595708 | 3.5323 | false | false | false | false |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.