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 |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
openelections/openelections-core | openelex/us/wi/datasource.py | 1 | 3806 | """
Wisconsin has Excel files containing precinct(ward)-level results for elections back to 2002.
All of the files are pre-processed into CSV and available on GitHub at
https://github.com/openelections/openelections-data-wi.
There is one file per election, including national and state offices.
The CSV files are named ... | mit | 884c6dafcbc2047385acfb970033862b | 34.90566 | 163 | 0.604572 | 3.895599 | false | false | false | false |
openelections/openelections-core | openelex/us/in/load.py | 1 | 4428 | """Converts csv file data into RawResults for Indiana election results.
Indiana elections have pre-processed CSV results files for primary and
general elections beginning in 2002. These files contain county-level
and, where available, precinct-level elections data for each of the
state's counties. The CSV versions of... | mit | 92f4cd56352e7c7389bbd83acf847b85 | 36.525424 | 80 | 0.565944 | 4.225191 | false | false | false | false |
viblo/pymunk | pymunk/examples/threaded_space.py | 1 | 1652 | import time
import pymunk
from pymunk.vec2d import Vec2d
class PyramidDemo:
def __init__(self, threads=1):
### Init pymunk and create space
if threads == 0:
self.space = pymunk.Space(threaded=False)
else:
self.space = pymunk.Space(threaded=True)
self.space... | mit | 41b49c144a645abe8db0f0001f55f4e9 | 26.533333 | 85 | 0.487893 | 3.357724 | false | false | false | false |
openelections/openelections-core | openelex/tasks/publish.py | 1 | 1472 | from __future__ import print_function
from blinker import signal
import click
from openelex.base.publish import GitHubPublisher
from .utils import default_state_options
def log_publish_started(sender, **kwargs):
filename = kwargs.get('filename')
print("Publishing {}".format(filename))
def log_publish_finish... | mit | cb5912e4a052b158d7e5af3492a5d012 | 34.902439 | 78 | 0.694293 | 4.043956 | false | false | false | false |
openelections/openelections-core | openelex/base/fetch.py | 1 | 3453 | from __future__ import print_function
from future import standard_library
standard_library.install_aliases()
from os.path import exists, join
import urllib.request, urllib.parse, urllib.error
import urllib.parse
from .state import StateBase
class HTTPError(Exception):
def __init__(self, code, reason):
sel... | mit | d3e04d74154f3c3bc2b4c8bbee3f98f3 | 32.524272 | 87 | 0.617434 | 4.387548 | false | false | false | false |
openelections/openelections-core | openelex/us/wy/fetch.py | 1 | 2629 | from __future__ import print_function
from future import standard_library
standard_library.install_aliases()
import os
import os.path
import urllib.request, urllib.parse, urllib.error
import urllib.parse
from zipfile import ZipFile
from bs4 import BeautifulSoup
import requests
from openelex.base.fetch import BaseFetc... | mit | 3b32e264bb1f25d4d49a368463df2981 | 37.101449 | 78 | 0.611639 | 4.107813 | false | false | false | false |
viblo/pymunk | pymunk/examples/basic_test.py | 2 | 1447 | """Very simple example that does not depend on any third party library such
as pygame or pyglet like the other examples.
"""
import random
import sys
import pymunk
import pymunk.util
from pymunk import Vec2d
def main():
print(f"basic example of pymunk {pymunk.version}")
space = pymunk.Space()
space.gr... | mit | b8e4c1ff5808a0689f783f92377f8e12 | 24.839286 | 76 | 0.538355 | 3.281179 | false | false | false | false |
benoitc/restkit | tests/_server_test.py | 2 | 14960 | # -*- coding: utf-8 -
#
# Copyright (c) 2008 (c) Benoit Chesneau <benoitc@e-engura.com>
#
# Permission to use, copy, modify, and distribute this software for any
# purpose with or without fee is hereby granted, provided that the above
# copyright notice and this permission notice appear in all copies.
#
# THE SOFTWARE... | mit | 9dfcc64df1db3cd2d39b55c743ad459c | 39.833333 | 86 | 0.531884 | 4.016393 | false | true | false | false |
benoitc/restkit | restkit/oauth2.py | 3 | 22155 | # -*- coding: utf-8 -
#
# This file is part of restkit released under the MIT license.
# See the NOTICE for more information.
import base64
import urllib
import time
import random
import urlparse
import hmac
import binascii
try:
from urlparse import parse_qs, parse_qsl
except ImportError:
from cgi import par... | mit | a599aafb833f8a1ee9bdb539c9093ebb | 31.822222 | 265 | 0.59657 | 4.188091 | false | false | false | false |
benoitc/restkit | restkit/contrib/webob_helper.py | 5 | 1808 | # -*- coding: utf-8 -
#
# This file is part of restkit released under the MIT license.
# See the NOTICE for more information.
import webob.exc
from restkit import errors
class WebobResourceError(webob.exc.WSGIHTTPException):
"""
Wrapper to return webob exceptions instead of restkit errors. Usefull
for ... | mit | ed79a9b8e72c1d8befa66179209efc90 | 28.639344 | 76 | 0.639381 | 4.053812 | false | false | false | false |
geopy/geopy | test/proxy_server.py | 1 | 9539 | import base64
import http.server as SimpleHTTPServer
import select
import socket
import socketserver as SocketServer
import threading
from urllib.request import urlopen
def pipe_sockets(sock1, sock2, timeout):
"""Pipe data from one socket to another and vice-versa."""
sockets = [sock1, sock2]
try:
... | mit | b706bcdbe786a4ba4c48512ae177ce11 | 33.189964 | 80 | 0.525736 | 4.55105 | false | false | false | false |
geopy/geopy | test/test_location.py | 2 | 4902 | import pickle
import unittest
from geopy.location import Location
from geopy.point import Point
GRAND_CENTRAL_STR = "89 E 42nd St New York, NY 10017"
GRAND_CENTRAL_COORDS_STR = "40.752662,-73.9773"
GRAND_CENTRAL_COORDS_TUPLE = (40.752662, -73.9773, 0)
GRAND_CENTRAL_POINT = Point(GRAND_CENTRAL_COORDS_STR)
GRAND_CENT... | mit | bdbdbc277159b53ed5c463c1c5b77368 | 36.136364 | 75 | 0.626479 | 3.088847 | false | true | false | false |
geopy/geopy | geopy/geocoders/bing.py | 2 | 9344 | import collections.abc
from functools import partial
from urllib.parse import quote, urlencode
from geopy.exc import (
GeocoderAuthenticationFailure,
GeocoderInsufficientPrivileges,
GeocoderRateLimited,
GeocoderServiceError,
GeocoderUnavailable,
)
from geopy.geocoders.base import DEFAULT_SENTINEL, ... | mit | 881ccdeab8fcac25e9ab9ef97f204cb1 | 34.393939 | 81 | 0.574379 | 4.245343 | false | false | false | false |
geopy/geopy | test/geocoders/__init__.py | 2 | 10806 | import importlib
import inspect
import pkgutil
import docutils.core
import docutils.utils
import pytest
import geopy.geocoders
from geopy.geocoders.base import DEFAULT_SENTINEL, Geocoder
skip_modules = [
"geopy.geocoders.base", # doesn't contain actual geocoders
"geopy.geocoders.googlev3", # deprecated
... | mit | 20b2908364ee4594333febb43bafbafa | 33.196203 | 88 | 0.629187 | 3.700685 | false | true | false | false |
geopy/geopy | geopy/units.py | 2 | 2950 | """``geopy.units`` module provides utility functions for performing
angle and distance unit conversions.
Some shortly named aliases are provided for convenience (e.g.
:func:`.km` is an alias for :func:`.kilometers`).
"""
import math
# Angles
def degrees(radians=0, arcminutes=0, arcseconds=0):
"""
Convert a... | mit | 3cf9e838d1f9dc4594fe9915de956419 | 20.376812 | 78 | 0.600339 | 3.281424 | false | false | false | false |
geopy/geopy | test/geocoders/arcgis.py | 1 | 3150 | import pytest
from geopy import exc
from geopy.geocoders import ArcGIS
from geopy.point import Point
from test.geocoders.util import BaseTestGeocoder, env
class TestUnitArcGIS:
def test_user_agent_custom(self):
geocoder = ArcGIS(
user_agent='my_user_agent/1.0'
)
assert geocod... | mit | cc6ff082689231d1ec73dc40185e2afd | 29.288462 | 77 | 0.565714 | 3.604119 | false | true | false | false |
geopy/geopy | test/geocoders/pelias.py | 1 | 3216 | import warnings
from geopy.geocoders import Pelias
from geopy.point import Point
from test.geocoders.util import BaseTestGeocoder, env
class BaseTestPelias(BaseTestGeocoder):
delta = 0.04
known_state_de = "Verwaltungsregion Ionische Inseln"
known_state_en = "Ionian Islands Periphery"
async def test... | mit | 7d1febb65b02e63efe831e5c28913eb6 | 32.123711 | 77 | 0.549331 | 3.523026 | false | true | false | false |
materialsproject/pymatgen-db | pymatgen/db/query_engine.py | 1 | 27387 | """
This module provides a QueryEngine that simplifies queries for Mongo databases
generated using hive.
"""
__author__ = "Shyue Ping Ong, Michael Kocher, Dan Gunter"
__copyright__ = "Copyright 2011, The Materials Project"
__version__ = "2.0"
__maintainer__ = "Shyue Ping Ong"
__email__ = "shyuep@gmail.com"
__status__... | mit | b3794d8f67b0ab164a4a798ba1c8cd44 | 38.405755 | 107 | 0.573776 | 4.474269 | false | false | false | false |
ab77/netflix-proxy | auth/auth.py | 1 | 22236 | #!/usr/bin/env python
# -*- coding: utf-8 -*-
"""auth.py: basic web front-end to auth/de-auth ipaddrs using iptables.
author: anton@belodedenko.me
"""
from subprocess import Popen, PIPE
from collections import defaultdict
import datetime, traceback, sys, socket
from settings import *
try:
import web
except Impo... | mit | 775479d6a4f85182793cfb5269f39313 | 35.214984 | 154 | 0.546951 | 3.777136 | false | false | false | false |
commaai/openpilot | common/ffi_wrapper.py | 1 | 1319 | import os
import sys
import fcntl
import hashlib
import platform
from cffi import FFI
def suffix():
if platform.system() == "Darwin":
return ".dylib"
else:
return ".so"
def ffi_wrap(name, c_code, c_header, tmpdir="/tmp/ccache", cflags="", libraries=None):
if libraries is None:
libraries = []
cach... | mit | 9a373cb3cee593c5d38b7fef469c0ef8 | 22.981818 | 86 | 0.658074 | 3.25679 | false | false | false | false |
commaai/openpilot | selfdrive/car/honda/hondacan.py | 1 | 6243 | from common.conversions import Conversions as CV
from selfdrive.car.honda.values import HondaFlags, HONDA_BOSCH, HONDA_BOSCH_RADARLESS, CAR, CarControllerParams
# CAN bus layout with relay
# 0 = ACC-CAN - radar side
# 1 = F-CAN B - powertrain
# 2 = ACC-CAN - camera side
# 3 = F-CAN A - OBDII port
def get_pt_bus(car_... | mit | 667a14f0f522ec588a4a61a52f8d1d1e | 34.471591 | 120 | 0.677078 | 2.674807 | false | false | false | false |
wbond/oscrypto | oscrypto/_win/_secur32_ctypes.py | 8 | 5305 | # coding: utf-8
from __future__ import unicode_literals, division, absolute_import, print_function
import sys
import ctypes
from ctypes import windll, wintypes, POINTER, c_void_p, c_uint, Structure
from ctypes.wintypes import DWORD, ULONG
from .._ffi import FFIEngineError
from .._types import str_cls
from ..errors i... | mit | 3a3e82054d1f12e7583a674151a36a12 | 25.792929 | 82 | 0.605655 | 3.676369 | false | false | false | false |
wbond/oscrypto | oscrypto/_openssl/tls.py | 1 | 44082 | # coding: utf-8
from __future__ import unicode_literals, division, absolute_import, print_function
import sys
import re
import socket as socket_
import select
import numbers
from ._libssl import error_code_version_info, libssl, LibsslConst
from ._libcrypto import libcrypto, libcrypto_version_info, handle_openssl_erro... | mit | d7365ea72fe2dc10c28c3911d7891a64 | 33.519969 | 110 | 0.520916 | 4.426348 | false | false | false | false |
wbond/oscrypto | oscrypto/_win/symmetric.py | 1 | 30875 | # coding: utf-8
from __future__ import unicode_literals, division, absolute_import, print_function
from .._errors import pretty_message
from .._ffi import (
buffer_from_bytes,
bytes_from_buffer,
deref,
new,
null,
pointer_set,
struct,
struct_bytes,
unwrap,
write_to_buffer,
)
from... | mit | a51223e1597612dc19e85f9070c47fcd | 25.479417 | 107 | 0.560777 | 3.969019 | false | false | false | false |
wbond/oscrypto | dev/lint.py | 7 | 1030 | # coding: utf-8
from __future__ import unicode_literals, division, absolute_import, print_function
import os
from . import package_name, package_root
import flake8
if not hasattr(flake8, '__version_info__') or flake8.__version_info__ < (3,):
from flake8.engine import get_style_guide
else:
from flake8.api.leg... | mit | eea53e90e1a6dfb1791388486bdca215 | 26.105263 | 85 | 0.617476 | 3.678571 | false | false | false | false |
wbond/oscrypto | oscrypto/_tls.py | 1 | 17845 | # coding: utf-8
from __future__ import unicode_literals, division, absolute_import, print_function
import re
from datetime import datetime
from ._asn1 import Certificate, int_from_bytes, timezone
from ._cipher_suites import CIPHER_SUITE_MAP
from .errors import TLSVerificationError, TLSDisconnectError, TLSError
__al... | mit | 1c472ee99d3c702b812eb7836e48cf07 | 28.544702 | 119 | 0.629812 | 4.218676 | false | false | false | false |
wbond/oscrypto | oscrypto/_win/_secur32_cffi.py | 1 | 3967 | # coding: utf-8
from __future__ import unicode_literals, division, absolute_import, print_function
import sys
from .._ffi import register_ffi
from .._types import str_cls
from ..errors import LibraryNotFoundError
import cffi
__all__ = [
'get_error',
'secur32',
]
ffi = cffi.FFI()
if cffi.__version_info__ ... | mit | 2d1bd263e411afd89c0ea86d03f82ce1 | 29.751938 | 117 | 0.675826 | 3.676552 | false | false | false | false |
wbond/oscrypto | tests/test_init.py | 1 | 4724 | # coding: utf-8
from __future__ import unicode_literals, division, absolute_import, print_function
import ast
import _ast
import unittest
import os
import sys
import oscrypto as module
# This handles situations where an import is importing a function from a
# dotted path, e.g. "from . import ident", and ident is a ... | mit | 4bbe628a935111ead503d6be0655b6ef | 32.034965 | 92 | 0.547629 | 3.930116 | false | false | false | false |
wbond/oscrypto | oscrypto/_mac/_security_cffi.py | 1 | 11218 | # coding: utf-8
from __future__ import unicode_literals, division, absolute_import, print_function
import platform
from .._ffi import register_ffi
from cffi import FFI
__all__ = [
'Security',
'version',
'version_info',
]
version = platform.mac_ver()[0]
version_info = tuple(map(int, version.split('.')... | mit | ab078aa3e5d39ac24f5ff5eeebc9b5ff | 44.052209 | 120 | 0.755037 | 3.86561 | false | false | false | false |
ursgal/ursgal | ursgal/wrappers/msblender_09_2015.py | 2 | 18783 | #!/usr/bin/python
from __future__ import print_function
from __future__ import division
import os
import os.path
import sys
import csv
import math
import subprocess
from pprint import pprint
import ursgal
class msblender_09_2015(ursgal.UNode):
"""
MSblender UNode
Documentation at http://www.marcottelab.... | mit | 81993d727d67d4f2d382ffc6b275ef59 | 37.248473 | 111 | 0.51475 | 3.875361 | false | false | false | false |
ursgal/ursgal | ursgal/resources/platform_independent/arc_independent/svm_1_0_0/svm_1_0_0.py | 2 | 27891 | #!/usr/bin/env python
"""
usage:
svm.py unified_input.csv engine_score_column_name
i.e. :
svm.py omssa_2_1_6_unified.csv 'OMSSA:pvalue'
Writes a new file with added column "SVMscore" which is the distance to
the separating hyperplane of a Percolator-like support vector machine.
"""
impo... | mit | 67e8f3bc7af13a5ee616ba75c56a3094 | 35.98939 | 105 | 0.514557 | 3.945395 | false | false | false | false |
ursgal/ursgal | example_scripts/grouped_search_example.py | 2 | 11223 | #!/usr/bin/env python3
# encoding: utf-8
import ursgal
import csv
from collections import defaultdict as ddict
import os
import glob
import math
from collections import defaultdict as ddict
params = {
"database": os.path.join(
os.pardir,
"example_data",
"Creinhardtii_281_v5_5_CP_MT_with_con... | mit | 1f8be2c96c299cb54a1d162ebbb0756b | 35.796721 | 119 | 0.538893 | 3.744745 | false | false | false | false |
mitdbg/aurum-datadiscovery | knowledgerepr/lite_graph.py | 1 | 1487 | from bitarray import bitarray
from enum import Enum
from collections import defaultdict
num_edge_types = 4
class EdgeType(Enum):
SCHEMA_SIM = 0
CONTENT_SIM = 1
PKFK = 2
SEMANTIC = 3
class LiteGraph:
def __init__(self):
self._node_count = 0
self._edge_count = 0
self._nod... | mit | f62ec92475c74d9150d67921de5c3a67 | 26.555556 | 61 | 0.565568 | 3.689826 | false | false | false | false |
mitdbg/aurum-datadiscovery | ontomatch/process_utils.py | 1 | 1215 |
with open("/Users/ra-mit/development/discovery_proto/ontomatch/links_massdata_dbpedia", "r") as f:
lines = f.readlines()
# lines = lines[:3]
print("Total lines: " + str(len(lines)))
isalines = []
for l in lines:
base = str(l).split(")")
tokens = base[1].split(",")
r = token... | mit | 1b40a4ad65a403271f34de505c223e3f | 32.75 | 100 | 0.528395 | 3.310627 | false | false | false | false |
mitdbg/aurum-datadiscovery | DoD/data_processing_utils.py | 1 | 28280 | import pandas as pd
from collections import defaultdict
import math
from DoD.utils import FilterType
import config as C
import os
import psutil
from tqdm import tqdm
import time
import pprint
pp = pprint.PrettyPrinter(indent=4)
# Cache reading and transformation of DFs
cache = dict()
memory_limit_join_processing = ... | mit | 39dd7b06a4eb4c842338824fec99a3fb | 37.47619 | 133 | 0.581294 | 3.399856 | false | false | false | false |
pydata/conf_site | conf_site/reviews/migrations/0001_initial_squashed_0004_proposalnotification.py | 1 | 3755 | # Generated by Django 2.2.9 on 2020-01-19 05:21
from django.conf import settings
from django.db import migrations, models
import django.db.models.deletion
class Migration(migrations.Migration):
replaces = [('reviews', '0001_initial'), ('reviews', '0002_proposalfeedback_proposalresult'), ('reviews', '0003_propos... | mit | e7aa60b17d9b0daafe0044bab8499f4a | 59.370968 | 352 | 0.612343 | 4.09071 | false | false | false | false |
pydata/conf_site | conf_site/api/serializers.py | 1 | 1713 | from rest_framework import serializers
from rest_framework.reverse import reverse_lazy
from symposion.conference.models import Conference
from symposion.speakers.models import Speaker
from symposion.schedule.models import Presentation, Slot
class SpeakerSerializer(serializers.ModelSerializer):
username = seriali... | mit | 4d85fb2b9c045efc070521dc09920bd7 | 27.081967 | 78 | 0.652072 | 4.381074 | false | false | false | false |
pydata/conf_site | symposion/speakers/migrations/0001_initial.py | 1 | 2144 | # Generated by Django 2.0.13 on 2019-02-17 18:43
from django.conf import settings
from django.db import migrations, models
import django.db.models.deletion
import django.utils.timezone
class Migration(migrations.Migration):
initial = True
dependencies = [
migrations.swappable_dependency(settings.AU... | mit | 04a00a652428397bc59b2e9c0843e666 | 53.974359 | 231 | 0.630597 | 4.068311 | false | false | false | false |
pydata/conf_site | conf_site/reviews/tasks.py | 1 | 1799 | import csv
from django.contrib.auth.models import Group, User
from allauth.account.models import EmailAddress
from allauth.utils import generate_unique_username
def import_reviewer_csv(filename):
num_users_created = 0
num_existing_users = 0
with open(filename, "r", encoding="UTF-8-SIG") as csvfile:
... | mit | c4545e41731d8019f423e6201d0d4627 | 32.943396 | 76 | 0.559755 | 4.431034 | false | false | false | false |
pydata/conf_site | conf_site/urls.py | 1 | 2735 | from django.conf import settings
from django.conf.urls import include, re_path
from django.conf.urls.static import static
from django.contrib import admin
from django.contrib.admin.views.decorators import staff_member_required
from django.urls import path
from django.views.generic.base import TemplateView
try:
imp... | mit | 86109dd6bb3c705dbbb149815ad6bfc4 | 30.436782 | 78 | 0.660695 | 3.542746 | false | false | true | false |
pydata/conf_site | ansible/roles/web/templates/sensitive-settings.py | 1 | 3263 | # Passwords, API keys, and other sensitive information.
import sentry_sdk
from sentry_sdk.integrations.django import DjangoIntegration
from sentry_sdk.integrations.redis import RedisIntegration
from conf_site.settings.base import INSTALLED_APPS
DATABASES_DEFAULT = {
"ENGINE": "django.db.backends.postgresql",
... | mit | fe9d8c2a4a6c117e75d5e096f7eff24e | 30.679612 | 76 | 0.619369 | 3.501073 | false | false | true | false |
pydata/conf_site | symposion/proposals/urls.py | 1 | 1453 | from django.conf.urls import re_path
from .views import (
proposal_submit,
proposal_submit_kind,
proposal_detail,
proposal_edit,
proposal_speaker_manage,
proposal_cancel,
proposal_pending_join,
proposal_pending_decline,
document_create,
document_delete,
document_download,
)
... | mit | 31b99574ea52921eade49d47fab32450 | 25.418182 | 77 | 0.565726 | 3.578818 | false | false | true | false |
pydata/conf_site | conf_site/reviews/models.py | 1 | 5944 | from django.contrib.auth.models import User
from django.core.mail import send_mass_mail
from django.db import models
from django.template import Context, Template
from symposion.markdown_parser import parse
class ProposalVote(models.Model):
"""
Model to track votes made on a proposal.
This model replace... | mit | bd55c088ffcd67bff75998499b7e107a | 32.325843 | 77 | 0.626433 | 4.043626 | false | false | false | false |
pyspeckit/pyspeckit | examples/ammonia_vtau_fit_example.py | 8 | 3778 | from __future__ import print_function
import pyspeckit
# Grab a .fits spectrum with a legitimate header
sp = pyspeckit.Spectrum('G031.947+00.076_nh3_11_Tastar.fits')
""" HEADER:
SIMPLE = T / Written by IDL: Tue Aug 31 18:17:01 2010
BITPIX = -64
NAXIS = 1 / number of array dim... | mit | f306009f908693e27dccfc5cab99e498 | 31.290598 | 91 | 0.676019 | 2.605517 | false | false | false | false |
pyspeckit/pyspeckit | pyspeckit/mpfit/mpfitexpr.py | 11 | 2384 | """
Copyright (C) 2009 Sergey Koposov
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
This program is di... | mit | 6140dd853ba3ac4e57e1060efd5a0a1e | 34.58209 | 125 | 0.698826 | 3.191432 | false | false | false | false |
pyspeckit/pyspeckit | docs/sphinxext/flickr.py | 11 | 2354 | from docutils import nodes
from docutils.parsers.rst import directives
CODE = """\
<object width="%(width)i" height="%(height)i">
<param name="flashvars" value="offsite=true&lang=en-us&page_show_url=%2Fphotos%2F75341362%40N04%2Fsets%2F72157629059614751%2Fshow%2F&page_show_back_url=%2Fphotos%2F75341362%40N04%2Fsets%2... | mit | fa448bdcc222bf8ab3539a61658daf1d | 44.269231 | 403 | 0.67842 | 2.895449 | false | false | false | false |
pytest-dev/py | py/_xmlgen.py | 89 | 8364 | """
module for generating and serializing xml and html structures
by using simple python objects.
(c) holger krekel, holger at merlinux eu. 2009
"""
import sys, re
if sys.version_info >= (3,0):
def u(s):
return s
def unicode(x, errors=None):
if hasattr(x, '__unicode__'):
return x._... | mit | 6143a1ba7412585727b09d986fe7d5ae | 31.8 | 78 | 0.548541 | 3.769265 | false | false | false | false |
pyspeckit/pyspeckit | examples/hcn_example.py | 8 | 4056 | from __future__ import print_function
import pyspeckit
import pylab as pl
import astropy.units as u
# Load the spectrum & properly identify the units
# The data is from http://adsabs.harvard.edu/abs/1999A%26A...348..600P
sp = pyspeckit.Spectrum('02232_plus_6138.txt')
sp.xarr.set_unit(u.km/u.s)
sp.xarr.refX = 88.631846... | mit | 57c92bd4697522b7121c8838c2868258 | 39.56 | 93 | 0.685897 | 2.801105 | false | false | false | false |
pyspeckit/pyspeckit | pyspeckit/spectrum/models/n2dp.py | 4 | 8358 | """
===========
N2D+ fitter
===========
Reference for line params:
Dore (priv. comm.) line frequencies in CDMS,
line strength can also be obtained from Splatalogue
L. Dore, P. Caselli, S. Beninati, T. Bourke, P. C. Myers and G. Cazzoli A&A 413, 1177-1181 (2004)
http://adsabs.harvard.edu/abs/2004A%26A...413.1177D
L. ... | mit | 601d33c2b4778eb49a4ec4b3890f34c4 | 27.141414 | 136 | 0.527638 | 1.958294 | false | false | false | false |
pyspeckit/pyspeckit | pyspeckit/config.py | 7 | 4845 | """
==========================
PySpecKit config system
==========================
Create decorator used to modify inputs to various __call__ methods
to reflect preferences we set in ~/.pyspeckit/config.
To see what values exist in config file, do:
from config import mycfg
mycfg.keys()
To decorate a new __cal... | mit | 99b24a85748542597ef09817b70a7e46 | 31.086093 | 116 | 0.593602 | 3.984375 | false | true | false | false |
pyspeckit/pyspeckit | examples/ammonia_vtau_multitem_example.py | 5 | 5782 | import numpy as np
import pyspeckit
from astropy import units as u
from pyspeckit.spectrum.models import ammonia_constants, ammonia, ammonia_hf
from pyspeckit.spectrum.models.ammonia_constants import freq_dict
from pyspeckit.spectrum.units import SpectroscopicAxis, SpectroscopicAxes
# Step 1. Generate a synthetic spec... | mit | ecd11cf157e39e426d4c84dd9348660f | 50.625 | 79 | 0.508648 | 3.692209 | false | false | false | false |
pyspeckit/pyspeckit | pyspeckit/spectrum/speclines/optical.py | 8 | 2399 | """
Storage for optical spectral line information.
"""
from __future__ import print_function
import numpy as np
def hydrogen(nu,nl, vacuum=True):
"""
Compute the rest wavelength of Hydrogen recombination lines in angstroms
"""
rydberg = 10973731.6 # m^-1
protontoelectron = 1836.15266 # ratio
... | mit | 5845f9c4849c64f9449e576f999e7f8f | 32.319444 | 97 | 0.564402 | 2.647903 | false | false | false | false |
pyspeckit/pyspeckit | pyspeckit/spectrum/classes.py | 3 | 47345 | """
==========================
PySpecKit Spectrum classes
==========================
The spectrum module consists of the Spectrum class, with child classes ObsBlock
and Spectra for multi-spectrum analysis of different types.
The Spectrum class is the main functional code.
ObsBlocks are containers of multiple spectra ... | mit | 035e915798c42706fdaf300b1f11d4e8 | 38.160463 | 155 | 0.575816 | 3.984934 | false | false | false | false |
pytest-dev/py | py/__init__.py | 16 | 6022 | """
pylib: rapid testing and development utils
this module uses apipkg.py for lazy-loading sub modules
and classes. The initpkg-dictionary below specifies
name->value mappings where value can be another namespace
dictionary or an import path.
(c) Holger Krekel and others, 2004-2014
"""
from py._error import error
... | mit | 8e88bd8c59e740b489c871908ac7d93b | 37.602564 | 79 | 0.497343 | 3.586659 | false | false | false | false |
pyspeckit/pyspeckit | pyspeckit/spectrum/__init__.py | 8 | 2600 | """
"""
from .classes import Spectrum,Spectra,ObsBlock
from .OpticalSpectrum import OpticalSpectrum
from . import fitters,plotters,baseline,units
from . import smooth
from . import correlate
from . import headers
from . import moments
from . import units
from . import utils
from . import readers
from . import writers
f... | mit | 2f85c4ce537610ebff0f40274c73acb1 | 30.707317 | 79 | 0.681154 | 3.79562 | false | false | false | false |
pyspeckit/pyspeckit | pyspeckit/parallel_map/parallel_map.py | 8 | 5273 | """
Parellel Map snippet by Brian Refsdal
http://www.astropython.org/snippet/2010/3/Parallel-map-using-multiprocessing
"""
from __future__ import print_function
import numpy
import warnings
from astropy import log
_multi=False
_ncpus=1
try:
# May raise ImportError
import multiprocessing
_multi=True
... | mit | 73dcb2b05c9e0f10a503f1978f048472 | 26.180412 | 76 | 0.683103 | 3.891513 | false | false | false | false |
pyspeckit/pyspeckit | pyspeckit/spectrum/velocity_frames.py | 7 | 5736 | from __future__ import print_function
import numpy as np
import units
def header_to_vlsr(header,**kwargs):
"""
Attempt to determine the vlsr offset using default header keywords
"""
if 'RA' in header:
ra = sexagesimal_to_decimal(header['RA'],ra=True)
dec = sexagesimal_to_decimal(header... | mit | b89121816f58954752de4e70dba6d48c | 33.142857 | 112 | 0.645572 | 2.827008 | false | false | false | false |
pyspeckit/pyspeckit | pyspeckit/spectrum/smooth.py | 7 | 3104 | from __future__ import print_function
import numpy as np
from . import interpolation
def smoothed(spectrum, **kwargs):
sp = spectrum.copy()
sp.smooth(**kwargs)
return sp
def smooth(data, smooth, smoothtype='gaussian', downsample=True,
downsample_factor=None, convmode='same'):
"""
Smooth... | mit | 217acc5e4b120131cebbdfca5484af9a | 35.093023 | 100 | 0.615013 | 3.704057 | false | false | false | false |
pyspeckit/pyspeckit | pyspeckit/spectrum/headers.py | 8 | 1312 | from __future__ import print_function
try:
import astropy.io.fits as pyfits
except ImportError:
import pyfits
def intersection(header1, header2, if_conflict=None):
"""
Return a pyfits Header containing the intersection of two pyfits Headers
*if_conflict* [ '1'/1/'Header1' | '2'/2/'Header2' | None ... | mit | f76b452a7055a4448136485d4bc13157 | 32.641026 | 86 | 0.551067 | 4.555556 | false | false | false | false |
softlayer/softlayer-python | SoftLayer/managers/autoscale.py | 2 | 5854 | """
SoftLayer.autoscale
~~~~~~~~~~~~~~~~~~~
Autoscale manager
:license: MIT, see LICENSE for more details.
"""
class AutoScaleManager(object):
"""Manager for interacting with Autoscale instances."""
def __init__(self, client):
self.client = client
def list(self, mask=None):
... | mit | add43b486cbccd48e0fde1d26a39341d | 41.115108 | 119 | 0.652545 | 3.985024 | false | false | false | false |
softlayer/softlayer-python | SoftLayer/CLI/loadbal/health.py | 2 | 3182 | """Manage LBaaS health checks."""
import click
import SoftLayer
from SoftLayer.CLI import environment
from SoftLayer.CLI import exceptions
from SoftLayer.exceptions import SoftLayerAPIError
from SoftLayer import utils
@click.command(cls=SoftLayer.CLI.command.SLCommand, )
@click.argument('identifier')
@click.option('... | mit | e774e706cf78c0932eab511272cccb20 | 48.71875 | 113 | 0.675361 | 3.79261 | false | false | false | false |
softlayer/softlayer-python | SoftLayer/shell/cmd_help.py | 3 | 1103 | """Print help text."""
# :license: MIT, see LICENSE for more details.
import click
from click import formatting
from SoftLayer.CLI import core as cli_core
from SoftLayer.CLI import environment
from SoftLayer.shell import routes
@click.command()
@environment.pass_env
@click.pass_context
def cli(ctx, env):
"""Pri... | mit | 73f9bf4702a9661bb5a19e0dfc456048 | 26.575 | 53 | 0.663645 | 3.925267 | false | false | false | false |
softlayer/softlayer-python | SoftLayer/managers/block.py | 2 | 8588 | """
SoftLayer.block
~~~~~~~~~~~~~~~
Block Storage Manager
:license: MIT, see LICENSE for more details.
"""
from SoftLayer.managers.storage import StorageManager
from SoftLayer.managers import storage_utils
from SoftLayer import utils
# pylint: disable=too-many-public-methods
class BlockStorageManag... | mit | 2adab59fbacb25978e4a57f082dae5b8 | 38.214612 | 113 | 0.625058 | 4.185185 | false | false | false | false |
softlayer/softlayer-python | SoftLayer/CLI/file/snapshot/list.py | 2 | 1756 | """List file storage snapshots."""
# :license: MIT, see LICENSE for more details.
import click
import SoftLayer
from SoftLayer.CLI import columns as column_helper
from SoftLayer.CLI import environment
from SoftLayer.CLI import formatting
from SoftLayer.CLI import helpers
COLUMNS = [
column_helper.Column('id', ('i... | mit | dc1a6aaf6d99173af9bc441a33863af9 | 31.518519 | 86 | 0.644077 | 3.972851 | false | false | false | false |
softlayer/softlayer-python | SoftLayer/managers/storage_utils.py | 2 | 42407 | """
SoftLayer.storage_utils
~~~~~~~~~~~~~~~
Utility functions used by File and Block Storage Managers
:license: MIT, see LICENSE for more details.
"""
from SoftLayer import exceptions
from SoftLayer import utils
# pylint: disable=too-many-lines
ENDURANCE_TIERS = {
0.25: 100,
2: 200,
4: 3... | mit | 4ae5ee2b8d22d8d357162d0372e0467c | 40.171845 | 119 | 0.637607 | 4.17803 | false | false | false | false |
softlayer/softlayer-python | SoftLayer/CLI/block/object_storage_permission.py | 2 | 1662 | """Display permission details for a cloud object storage."""
# :license: MIT, see LICENSE for more details.
import click
import SoftLayer
from SoftLayer.CLI import environment
from SoftLayer.CLI import formatting
@click.command(cls=SoftLayer.CLI.command.SLCommand, )
@click.argument('object_id')
@environment.pass_env... | mit | 385456db505a254c256c2a7ed7a4a8da | 36.75 | 101 | 0.576761 | 4.382586 | false | false | false | false |
softlayer/softlayer-python | SoftLayer/CLI/hardware/list.py | 2 | 3126 | """List hardware servers."""
# :license: MIT, see LICENSE for more details.
import click
import SoftLayer
from SoftLayer.CLI import columns as column_helper
from SoftLayer.CLI import environment
from SoftLayer.CLI import formatting
from SoftLayer.CLI import helpers
# pylint: disable=unnecessary-lambda
COLUMNS = [
... | mit | bb1b7ffa2540fd347db4ca198d385d39 | 36.662651 | 102 | 0.599488 | 4.190349 | false | false | false | false |
softlayer/softlayer-python | SoftLayer/CLI/report/dc_closures.py | 2 | 5519 | """Report on Resources in closing datacenters"""
import click
from SoftLayer.CLI.command import SLCommand as SLCommand
from SoftLayer.CLI import environment
from SoftLayer.CLI import formatting
from SoftLayer import utils
@click.command(cls=SLCommand, short_help="""Report on Resources in closing datacenters""")
@env... | mit | de4a75213f29bf452d7a5857313444ae | 42.801587 | 115 | 0.621671 | 3.9906 | false | false | false | false |
softlayer/softlayer-python | SoftLayer/fixtures/SoftLayer_Network_Storage_Hub_Cleversafe_Account.py | 2 | 2658 | credentialCreate = {
"accountId": "12345",
"createDate": "2019-04-05T13:25:25-06:00",
"id": 11111,
"password": "nwUEUsx6PiEoN0B1Xe9z9hUCyXMkAFhDOjHqYJva",
"username": "XfHhBNBPlPdlWyaPPJAI",
"type": {
"description": "A credential for generating S3 Compatible Signatures.",
"keyNam... | mit | 01816d9c1008e9d56217cdda5047c5af | 27.580645 | 87 | 0.553047 | 3.010193 | false | false | false | false |
softlayer/softlayer-python | docs/conf.py | 3 | 8516 | # -*- coding: utf-8 -*-
#
# SoftLayer API Python Client documentation build configuration file, created
# by sphinx-quickstart on Fri Mar 22 11:08:48 2013.
#
# This file is execfile()d with the current directory set to its containing
# dir.
#
# Note that not all possible configuration values are present in this
# autog... | mit | d6ef61616886820e97acc6376b8c35b7 | 30.895131 | 79 | 0.694692 | 3.822262 | false | true | false | false |
softlayer/softlayer-python | SoftLayer/CLI/loadbal/ns_list.py | 2 | 1458 | """List active Netscaler devices."""
import click
import SoftLayer
from SoftLayer.CLI import environment
from SoftLayer.CLI import formatting
from SoftLayer import utils
@click.command(cls=SoftLayer.CLI.command.SLCommand, )
@environment.pass_env
def cli(env):
"""List active Netscaler devices."""
mgr = SoftLa... | mit | c587773eec8d0cc165e73b66b0981ecf | 31.4 | 106 | 0.657064 | 3.919355 | false | false | false | false |
softlayer/softlayer-python | SoftLayer/CLI/file/cancel.py | 2 | 1406 | """Cancel an existing file storage volume."""
# :license: MIT, see LICENSE for more details.
import click
import SoftLayer
from SoftLayer.CLI import environment
from SoftLayer.CLI import exceptions
from SoftLayer.CLI import formatting
@click.command(cls=SoftLayer.CLI.command.SLCommand, )
@click.argument('volume-id'... | mit | e96c541b2f69f3e1e5459b409eff1518 | 35.051282 | 75 | 0.642959 | 4.23494 | false | false | false | false |
softlayer/softlayer-python | SoftLayer/CLI/file/access/authorize.py | 2 | 2239 | """Authorizes hosts on a specific file volume."""
# :license: MIT, see LICENSE for more details.
import click
import SoftLayer
from SoftLayer.CLI import environment
from SoftLayer.CLI import exceptions
MULTIPLE = '(Multiple allowed)'
@click.command(cls=SoftLayer.CLI.command.SLCommand, )
@click.argument('volume_id')... | mit | 799895fe6df627845fb149c3fa768d8d | 44.693878 | 100 | 0.624833 | 4.019749 | false | false | false | false |
softlayer/softlayer-python | SoftLayer/CLI/sshkey/add.py | 2 | 1321 | """Add a new SSH key."""
# :license: MIT, see LICENSE for more details.
from os import path
import click
import SoftLayer
from SoftLayer.CLI import environment
from SoftLayer.CLI import exceptions
@click.command(cls=SoftLayer.CLI.command.SLCommand, )
@click.argument('label')
@click.option('--in-file', '-f',
... | mit | 8ba82592c63b983c7ad383155c440700 | 29.72093 | 89 | 0.619228 | 3.503979 | false | false | false | false |
softlayer/softlayer-python | SoftLayer/CLI/ticket/summary.py | 2 | 1234 | """Summary info about tickets."""
# :license: MIT, see LICENSE for more details.
import click
from SoftLayer.CLI.command import SLCommand as SLCommand
from SoftLayer.CLI import environment
from SoftLayer.CLI import formatting
@click.command(cls=SLCommand)
@environment.pass_env
def cli(env):
"""Summary info abou... | mit | 294b73e894fceb4faf8c976a6c15d035 | 35.294118 | 66 | 0.691248 | 3.955128 | false | false | false | false |
nugget/python-insteonplm | insteonplm/states/x10.py | 1 | 10877 | """X10 states."""
import logging
from insteonplm.messages.x10send import X10Send
from insteonplm.messages.x10received import X10Received
from insteonplm.states import State
from insteonplm.constants import (
X10_COMMAND_ALL_UNITS_OFF,
X10_COMMAND_ALL_LIGHTS_ON,
X10_COMMAND_ALL_LIGHTS_OFF,
X10_COMMAND_O... | mit | e796fa26eff7ada0407071a9328dd7a3 | 28.557065 | 86 | 0.575526 | 3.803147 | false | false | false | false |
nugget/python-insteonplm | insteonplm/devices/dimmableLightingControl.py | 1 | 5358 | """INSTEON Device Type Dimmable Lighting Control Module."""
from insteonplm.devices import Device
from insteonplm.states.dimmable import (
DimmableSwitch,
DimmableSwitch_Fan,
DimmableKeypadA,
)
from insteonplm.states.onOff import OnOffKeypad, OnOffKeypadLed
class DimmableLightingControl(Device):
"""Di... | mit | 40a3b302d6ad9e9f6cd7a8ad2d9dec1b | 31.472727 | 87 | 0.571669 | 3.639946 | false | false | false | false |
nugget/python-insteonplm | insteonplm/messages/messageFlags.py | 1 | 9721 | """Message Flags class."""
import logging
import binascii
from insteonplm.constants import (
MESSAGE_FLAG_EXTENDED_0X10,
MESSAGE_TYPE_ALL_LINK_BROADCAST,
MESSAGE_TYPE_ALL_LINK_CLEANUP,
MESSAGE_TYPE_ALL_LINK_CLEANUP_ACK,
MESSAGE_TYPE_ALL_LINK_CLEANUP_NAK,
MESSAGE_TYPE_BROADCAST_MESSAGE,
MESS... | mit | d81a254da1ce497e2eb3c460e5a98a98 | 32.405498 | 88 | 0.587285 | 4.120814 | false | false | false | false |
nugget/python-insteonplm | insteonplm/states/cover.py | 1 | 7686 | """Window Coverings states."""
import logging
from insteonplm.constants import (
COMMAND_LIGHT_INSTANT_CHANGE_0X21_NONE,
COMMAND_LIGHT_MANUALLY_TURNED_OFF_0X22_0X00,
COMMAND_LIGHT_MANUALLY_TURNED_ON_0X23_0X00,
COMMAND_LIGHT_OFF_0X13_0X00,
COMMAND_LIGHT_OFF_FAST_0X14_0X00,
COMMAND_LIGHT_ON_0X11_... | mit | f5f882b1b558d1085f3fed73013fc282 | 35.6 | 87 | 0.611632 | 3.808722 | false | false | false | false |
nugget/python-insteonplm | insteonplm/messages/__init__.py | 1 | 7319 | """INSTEON Messages Module."""
import logging
import binascii
from insteonplm.constants import (
MESSAGE_ALL_LINK_CEANUP_FAILURE_REPORT_0X56,
MESSAGE_ALL_LINK_CLEANUP_STATUS_REPORT_0X58,
MESSAGE_ALL_LINK_RECORD_RESPONSE_0X57,
MESSAGE_ALL_LINKING_COMPLETED_0X53,
MESSAGE_BUTTON_EVENT_REPORT_0X54,
... | mit | 40a675b60aafff5fd37e8e19e485b8e9 | 35.595 | 87 | 0.714169 | 3.239929 | false | false | false | false |
nugget/python-insteonplm | insteonplm/utils.py | 1 | 1774 | """Utility methods."""
from insteonplm.constants import (
HC_LOOKUP,
UC_LOOKUP,
X10_COMMAND_ALL_UNITS_OFF,
X10_COMMAND_ALL_LIGHTS_ON,
X10_COMMAND_ALL_LIGHTS_OFF,
X10CommandType,
)
def housecode_to_byte(housecode):
"""Return the byte value of an X10 housecode."""
return HC_LOOKUP.get(... | mit | b5607124d122b5bab936176957bf56ea | 24.342857 | 75 | 0.644307 | 3.196396 | false | false | false | false |
nugget/python-insteonplm | insteonplm/messages/userdata.py | 1 | 5743 | """Extended Message User Data Type."""
import logging
import binascii
_LOGGER = logging.getLogger(__name__)
class Userdata:
"""Extended Message User Data Type."""
def __init__(self, userdata=None):
"""Init the Userdata Class."""
self._userdata = self.normalize(self.create_empty(0x00), userda... | mit | d47b3df8409c2de2e39ae2bba736cf1c | 29.226316 | 78 | 0.517325 | 4.324548 | false | false | false | false |
nugget/python-insteonplm | insteonplm/devices/windowCoverings.py | 1 | 1135 | """INSTEON Device Type Window Coverings Control Module."""
from insteonplm.devices import Device
from insteonplm.states.cover import Cover
class WindowCovering(Device):
"""Window Covering Controller.
INSTEON Window Covering device class. Available device control options are:
- open()
- open_f... | mit | 181544ee7ac4f89d4b8d0c229ec18145 | 28.102564 | 87 | 0.597357 | 3.954704 | false | false | false | false |
nugget/python-insteonplm | insteonplm/messages/manageAllLinkRecord.py | 1 | 3149 | """INSTEON Message Manage All-Link Record."""
from insteonplm.messages.message import Message
from insteonplm.constants import (
MESSAGE_MANAGE_ALL_LINK_RECORD_0X6F,
MESSAGE_MANAGE_ALL_LINK_RECORD_SIZE,
MESSAGE_MANAGE_ALL_LINK_RECORD_RECEIVED_SIZE,
MESSAGE_ACK,
MESSAGE_NAK,
)
from insteonplm.address... | mit | db84f2dba8890458cc2ad5404008c97d | 26.622807 | 71 | 0.590664 | 3.826245 | false | false | false | false |
okfn/bibserver | bibserver/config.py | 4 | 1076 | import os
import json
'''read the config.json file and make available as a config dict'''
def load_config(path):
fileobj = open(path)
c = ""
for line in fileobj:
if line.strip().startswith("#"):
continue
else:
c += line
out = json.loads(c)
# add some critic... | mit | cc7e75ef88c2161b40fec569a6ac8d20 | 22.911111 | 74 | 0.6171 | 3.635135 | false | true | false | false |
okfn/bibserver | bibserver/ingest.py | 4 | 12956 | '''
Independent running process.
Handling uploads asynchronously.
See: https://github.com/okfn/bibserver/wiki/AsyncUploadDesign
'''
import os, stat, sys, uuid, time
import subprocess
from cStringIO import StringIO
import requests
import hashlib
import json
from datetime import datetime
import traceback
import bibserve... | mit | 9d85079a307fd20ce747cbd745907511 | 34.988889 | 133 | 0.589225 | 3.832002 | false | false | false | false |
okfn/bibserver | bibserver/util.py | 4 | 2105 | from urllib import urlopen, urlencode
import md5
import re
from unicodedata import normalize
from functools import wraps
from flask import request, current_app
def jsonp(f):
"""Wraps JSONified output for JSONP"""
@wraps(f)
def decorated_function(*args, **kwargs):
callback = request.args.get('callb... | mit | 0d7500ae61a4018ef3da9352d940345d | 31.890625 | 109 | 0.629929 | 3.667247 | false | false | false | false |
siddhantgoel/streaming-form-data | tests/test_finder.py | 1 | 1032 | import pytest
from streaming_form_data._parser import Finder
def test_invalid_init():
for value in (None, 'abc', 123, 123.456, [123, 456], (123, 456)):
with pytest.raises(TypeError):
Finder(value)
with pytest.raises(ValueError):
Finder(b'')
def test_init():
finder = Finder(... | mit | fc648f710031b84216338bf2193095fa | 16.793103 | 69 | 0.620155 | 3.646643 | false | true | false | false |
kashifrazzaqui/vyked | tests/integration/test_registry.py | 2 | 2463 |
import requests
import multiprocessing
from vyked import Host, HTTPService, TCPService, TCPServiceClient, Registry
from vyked import request, get, Response, api
from vyked.registry import Repository
processes = []
class ServiceC(HTTPService):
def __init__(self, host, port):
super().__init__("ServiceC"... | mit | 2ce62ce807892d7bea7cd41f10d18873 | 22.457143 | 79 | 0.623224 | 3.378601 | false | false | false | false |
fastavro/fastavro | fastavro/_read_py.py | 1 | 35221 | # cython: auto_cpdef=True
"""Python code for reading AVRO files"""
# This code is a modified version of the code at
# http://svn.apache.org/viewvc/avro/trunk/lang/py/src/avro/ which is under
# Apache 2.0 license (http://www.apache.org/licenses/LICENSE-2.0)
import bz2
import json
import lzma
import zlib
from datetime... | mit | 751aa81b4253fd583cede26932c849c2 | 27.335479 | 89 | 0.582948 | 4.074618 | false | false | false | false |
bugsnag/bugsnag-python | example/flask/server.py | 1 | 6176 | # https://docs.bugsnag.com/platforms/python/flask
#
# this example app demonstrates some of the basic syntax to get Bugsnag error
# reporting configured in your Python Flask code. The key steps are:
#
# 1. call `bugsnag.configure(api_key={your api key})`
# 2. attach the bugsnag.flask `handle_exceptions` wrapper to your... | mit | 9e3855f13f92395c3b6b24f2b6d3f48a | 33.892655 | 79 | 0.656898 | 4.12008 | false | false | false | false |
flav-io/flavio | flavio/physics/betadecays/common.py | 1 | 1337 | """Common functions for beta decays."""
import flavio
from flavio.physics.edms.common import proton_charges
from flavio.physics.bdecays.wilsoncoefficients import get_wceff_fccc_std, get_CVLSM
from math import sqrt
def wc_eff(par, wc_obj, scale, nu):
r"""Lee-Yang effective couplings.
See eqS. (2), (9) of arX... | mit | 49d6a1c870496fe972477f2b3db6c6b7 | 33.282051 | 95 | 0.593867 | 2.556405 | false | false | false | false |
flav-io/flavio | flavio/physics/bdecays/formfactors/b_p/bsz_parameters.py | 1 | 3118 | import numpy as np
import json
import pkgutil
from flavio.classes import Parameter
from flavio.statistics.probability import MultivariateNormalDistribution
FFs = ["f+", "fT", "f0"]
ai = ["a0", "a1", "a2"]
ff_a = [(ff, a) for ff in FFs for a in ai]
a_ff_string = [a + '_' + ff for ff in FFs for a in ai]
tex_a = {'a0'... | mit | 332442c17f8688e495ab4da7cb3e2c56 | 37.975 | 116 | 0.597178 | 2.963878 | false | false | false | false |
bugsnag/bugsnag-python | setup.py | 1 | 1653 | #!/usr/bin/env python
"""
Bugsnag
=======
The official Python notifier for `Bugsnag <https://bugsnag.com/>`_.
Provides support for automatically capturing and sending exceptions
in your Django and other Python apps to Bugsnag, to help you find
and solve your bugs as fast as possible.
"""
from setuptools import setup... | mit | 42a09f1ca3ad393b67c604352acfcd19 | 30.788462 | 69 | 0.611615 | 4.021898 | false | false | false | false |
flav-io/flavio | flavio/statistics/test_functions.py | 1 | 1289 | import unittest
import numpy as np
import flavio
from flavio.statistics.functions import *
class TestFunctions(unittest.TestCase):
def test_deltachi2(self):
self.assertEqual(delta_chi2(3, 1), 9)
self.assertAlmostEqual(delta_chi2(1, 2), 2.30, delta=0.006)
self.assertAlmostEqual(delta_chi2(2,... | mit | 94346b1e015de0a00c42a250f2d8943d | 43.448276 | 82 | 0.677269 | 3.106024 | false | true | false | false |
flav-io/flavio | flavio/physics/bdecays/formfactors/b_p/bcl_parameters.py | 1 | 1188 | import yaml
import pkgutil
import numpy as np
from flavio.classes import Parameter
from flavio.statistics.probability import MultivariateNormalDistribution
def load_parameters(filename, constraints):
f = pkgutil.get_data('flavio.physics', filename)
ff_dict = yaml.safe_load(f)
for parameter_name in ff_dict[... | mit | 90f6e5767660350ec25719a9d87a0b09 | 50.652174 | 112 | 0.705387 | 4.242857 | false | false | false | false |
flav-io/flavio | flavio/physics/bdecays/formfactors/hqet.py | 1 | 5822 | """Common functions for HQET form factors."""
from math import sqrt, log, pi
from functools import lru_cache
from flavio.math.functions import li2
from flavio.physics.running import running
from flavio.physics.bdecays.formfactors import common
def get_hqet_parameters(par):
p = {}
# The scale here is fixed to... | mit | 57e23eec8e5bbbcd746ff8d8f1e49a50 | 30.47027 | 96 | 0.374785 | 2.315831 | false | false | false | false |
flav-io/flavio | flavio/physics/kdecays/kll.py | 1 | 4902 | r"""Functions for $K^0\to \ell^+\ell^-$ decays"""
import flavio
from flavio.config import config
from flavio.physics.bdecays.common import lambda_K
from flavio.physics import ckm
from flavio.physics.kdecays.wilsoncoefficients import wilsoncoefficients_sm_sl
from flavio.physics.common import add_dict
from math import p... | mit | e749c349ca2d28917d34bfb2515b723c | 32.806897 | 120 | 0.5459 | 2.436382 | false | false | false | false |
pythonindia/wye | wye/base/constants.py | 1 | 2585 | # -*- coding: utf-8 -*-
from __future__ import absolute_import, unicode_literals
import inspect
def _user_attributes(cls):
# gives all inbuilt attrs
defaults = dir(type(str('defaults'), (object,), {}))
return [
item[0] for item in inspect.getmembers(cls) if item[0] not in defaults]
def choices(... | mit | bbb61755f436a422427711a240aa7d65 | 24.097087 | 79 | 0.598066 | 2.825137 | false | false | false | false |
flav-io/flavio | flavio/physics/bdecays/formfactors/lambdab_32/QuarkModel_MCN.py | 1 | 5367 | from math import sqrt, exp
import flavio
def lambda_momentum(q2, mL, mLb):
# daughter baryon momentum in the Lb rest frame
s = q2/(mLb**2)
r = (mL/mLb)**2
phi = (1-r)**2 - 2*(1+r)*s + s**2
if phi > 0 :
return mLb/2*sqrt(phi)
else :
return mLb/2*sqrt(-phi)
def lambda_mass(m_q, m... | mit | e655c845e3f4baf425f4bd8d80a8c5c6 | 50.605769 | 402 | 0.529346 | 1.936147 | false | false | false | false |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.