text stringlengths 6 947k | repo_name stringlengths 5 100 | path stringlengths 4 231 | language stringclasses 1
value | license stringclasses 15
values | size int64 6 947k | score float64 0 0.34 |
|---|---|---|---|---|---|---|
import vtk
reader = vtk.vtkRectilinearGridReader()
reader.SetFileName("D:/Notebooks_Bogota2017/SS_2017/data/jet4_0.500.vtk")
reader.Update()
output = reader.GetOutput()
xmi, xma, ymi, yma, zmi, zma = output.GetBounds()
# Color Transfer Function and LookUpTable
# Create transfer mapping scalar value to color
colorTra... | dianafprieto/SS_2017 | scripts/07_NB_StreamTubes.py | Python | mit | 4,407 | 0.00295 |
# coding: utf-8
# Copyright 2013 Google Inc. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by ap... | GirlsCodePy/girlscode-coursebuilder | modules/review/review_tests.py | Python | gpl-3.0 | 68,643 | 0.000131 |
import os
import warnings
from collections import OrderedDict
from distutils.version import LooseVersion
import numpy as np
from .. import DataArray
from ..core import indexing
from ..core.utils import is_scalar
from .common import BackendArray
from .file_manager import CachingFileManager
from .locks import Serializa... | chunweiyuan/xarray | xarray/backends/rasterio_.py | Python | apache-2.0 | 12,619 | 0 |
#!/usr/bin/python
#----------------------------------------------------------------------
# Copyright (c) 2013-2016 Raytheon BBN Technologies
#
# Permission is hereby granted, free of charge, to any person obtaining
# a copy of this software and/or hardware specification (the "Work") to
# deal in the Work without rest... | GENI-NSF/gram | src/vmoc/register_controller.py | Python | mit | 2,320 | 0.003879 |
import sys
sys.path = ['..'] + sys.path
import zope
from twisted.internet import reactor
from thrift.transport import TSocket
from thrift.transport import TTransport
from thrift.transport import TTwisted
from thrift.protocol import TBinaryProtocol
from lib.genpy.snowflake import Snowflake
from lib.genpy.snowflake.tt... | michaelmontano/snowflakepy | src/snowflakeserver.py | Python | bsd-3-clause | 1,494 | 0.014726 |
'''
Convert an image file to a data uri.
Copyright 2012 GoodCrypto
Last modified: 2013-11-13
This file is open source, licensed under GPLv3 <http://www.gnu.org/licenses/>.
'''
import os.path
from django import template
import reinhardt.data_image
register = template.Library()
@reg... | goodcrypto/goodcrypto-libs | reinhardt/templatetags/data_img.py | Python | gpl-3.0 | 828 | 0.014493 |
# Copyright (c) 2014 The Chromium Authors. All rights reserved.
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
"""ResourceFinder is a helper class for finding resources given their name."""
import codecs
import os
from py_vulcanize import module
from py_vulcaniz... | endlessm/chromium-browser | third_party/catapult/common/py_vulcanize/py_vulcanize/resource_loader.py | Python | bsd-3-clause | 7,961 | 0.006657 |
# coding=utf-8
# Copyright 2022 The Google Research Authors.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicab... | google-research/google-research | tf3d/utils/voxel_utils.py | Python | apache-2.0 | 21,191 | 0.004672 |
#!/usr/bin/env python
import argparse
import os
import logging
import cdec.configobj
import cdec.sa
from cdec.sa._sa import monitor_cpu
import sys
MAX_PHRASE_LENGTH = 4
def precompute(f_sa, max_len, max_nt, max_size, min_gap, rank1, rank2, tight_phrases):
lcp = cdec.sa.LCP(f_sa)
stats = sorted(lcp.compute_stat... | kho/mr-cdec | python/pkg/cdec/sa/compile.py | Python | apache-2.0 | 5,575 | 0.003587 |
# -*- coding: utf-8 -*-
#
# This file is part of Invenio.
# Copyright (C) 2014 CERN.
#
# Invenio 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 2 of the
# License, or (at your option) any later... | zenodo/invenio | invenio/base/views.py | Python | gpl-2.0 | 947 | 0 |
input = """
x | -x.
y | -y.
"""
output = """
x | -x.
y | -y.
"""
| veltri/DLV2 | tests/parser/bkunstrat3.bk.test.py | Python | apache-2.0 | 69 | 0 |
"""
Copyright 2014 Jason Heeris, jason.heeris@gmail.com
This file is part of the dungeon excavator web interface ("webcavate").
Webcavate 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 L... | detly/webcavate | webcavate/app.py | Python | gpl-3.0 | 3,132 | 0.000958 |
import click
from parsec.cli import pass_context, json_loads
from parsec.decorators import custom_exception, json_output
@click.command('create_library')
@click.argument("name", type=str)
@click.option(
"--description",
help="Optional data library description",
type=str
)
@click.option(
"--synopsis",
... | galaxy-iuc/parsec | parsec/commands/libraries/create_library.py | Python | apache-2.0 | 859 | 0.001164 |
import galaxy.model
from logging import getLogger
log = getLogger( __name__ )
ROLES_UNSET = object()
INVALID_STATES = [ galaxy.model.Dataset.states.ERROR, galaxy.model.Dataset.states.DISCARDED ]
class DatasetMatcher( object ):
""" Utility class to aid DataToolParameter and similar classes in reasoning
about... | mikel-egana-aranguren/SADI-Galaxy-Docker | galaxy-dist/lib/galaxy/tools/parameters/dataset_matcher.py | Python | gpl-3.0 | 6,314 | 0.01758 |
# Copyright (c) 2012 - 2015 Lars Hupfeldt Nielsen, Hupfeldt IT
# All rights reserved. This work is under a BSD license, see LICENSE.TXT.
from jenkinsflow.flow import serial
from .framework import api_select
prefixed_jobs = """
serial flow: [
job: 'top_quick1'
serial flow: [
job: 'top_x_quick2-1'
]
... | lechat/jenkinsflow | test/prefix_test.py | Python | bsd-3-clause | 1,965 | 0.005598 |
"""
Fixture to create a course and course components (XBlocks).
"""
import datetime
import json
import mimetypes
from collections import namedtuple
from textwrap import dedent
from opaque_keys.edx.keys import CourseKey
from path import Path
from common.test.acceptance.fixtures import STUDIO_BASE_URL
from common.test... | jolyonb/edx-platform | common/test/acceptance/fixtures/course.py | Python | agpl-3.0 | 15,531 | 0.002447 |
# This is the version of this source code.
manual_verstr = "1.5"
auto_build_num = "212"
verstr = manual_verstr + "." + auto_build_num
try:
from pyutil.version_class import Version as pyutil_Version
__version__ = pyutil_Version(verstr)
except (ImportError, ValueError):
# Maybe there is no pyutil insta... | prudnikov/python-oauth2 | oauth2/_version.py | Python | mit | 438 | 0.004566 |
import mcpi.minecraft as minecraft
import mcpi.block as block
import random
import time
mc = minecraft.Minecraft.create()
#mc.postToChat("Heat Vision!")
pos = mc.player.getTilePos()
#mc.postToChat(pos)
#rot = mc.player.getRotation()
#pitch = mc.player.getPitch()
#direct = mc.player.getDirection()
#mc.postToChat(ro... | joadavis/rpi-coding | minecraft/oliverboom.py | Python | mit | 907 | 0.016538 |
'''
Created on Oct 19, 2016
@author: jaime
'''
from django.conf.urls import url
from django.views.decorators.csrf import csrf_exempt
from products import views
urlpatterns = [
url(r'^categories/$', csrf_exempt(views.ProductCategoryView.as_view())),
url(r'^categories/(?P<uid>\w+)/$', csrf_exempt(views.ProductCa... | jroeland/teapot | project/web/app/products/urls.py | Python | mit | 489 | 0.010225 |
# -*- encoding: utf-8 -*-
import argparse
import os
import sys
import yaml
from . import VERSION
import actions
import core
import exception
from utils import log
def error(errtype, msg, code=42):
sys.stderr.write("{t.red}[ERROR] {t.yellow}{er}: {msg}"
"{t.normal}\n".format(er=errtype, msg=... | yac/rdoupdate | rdoupdate/shell.py | Python | apache-2.0 | 5,901 | 0 |
from fontTools.misc.py23 import byteord
from fontTools.misc import sstruct
from fontTools.misc.fixedTools import floatToFixedToStr
from fontTools.misc.textTools import safeEval
# from itertools import *
from . import DefaultTable
from . import grUtils
from array import array
from functools import reduce
import struct, ... | google/material-design-icons | update/venv/lib/python3.9/site-packages/fontTools/ttLib/tables/S__i_l_f.py | Python | apache-2.0 | 33,326 | 0.003691 |
# Copyright (C) 2010-2012 Red Hat, Inc.
# This work is licensed under the GNU GPLv2 or later.
import libvirt
import re
from libvirt import libvirtError
from libvirttestapi.utils import utils
required_params = {'guestname', 'checkpoint_name'}
optional_params = {'flags': None}
def checkpoint_get_xml(params):
logg... | libvirt/libvirt-test-API | libvirttestapi/repos/checkpoint/checkpoint_get_xml.py | Python | gpl-2.0 | 2,134 | 0.000937 |
def factorial(count):
return count * factorial(count - 1)
answer = factorial(6)
| zamonia500/PythonTeacherMythenmetz | 과외숙제/factorial.py | Python | gpl-3.0 | 86 | 0 |
import pytest
from iotile.core.exceptions import ArgumentError
from iotile.sg.model import DeviceModel
def test_default_values():
"""Make sure we can get properties with default values."""
model = DeviceModel()
assert model.get('max_nodes') == 32
assert model.get(u'max_nodes') == 32
model.set('... | iotile/coretools | iotilesensorgraph/test/test_devicemodel.py | Python | gpl-3.0 | 693 | 0 |
''' custom script for platformio '''
from os.path import join
from SCons.Script import DefaultEnvironment
env = DefaultEnvironment()
#print "post_extra_script running..."
#print env.Dump()
# compiler and linker flags dont work very well in build_flags of platformio.ini - need to set them here
env.Append(
LINKFL... | zerog2k/stc_diyclock | post_extra_script.py | Python | mit | 392 | 0.015306 |
from attributes import *
from constants import *
# ------------------------------------------------------------------------------
#
class UnitManager (Attributes) :
"""
UnitManager class -- manages a pool
"""
# --------------------------------------------------------------------------
#
... | JensTimmerman/radical.pilot | docs/architecture/api_draft/unit_manager.py | Python | mit | 3,311 | 0.017215 |
import pytz
priorities = ('US/Pacific', 'US/Mountain', 'US/Central', 'US/Eastern',
'Brazil/East', 'UTC')
all_tz = pytz.all_timezones_set.copy()
for priority in priorities:
all_tz.remove(priority)
all_tz = sorted(list(all_tz))
all_tz[:0] = priorities # prepends list to list
# tuples for selection... | mixmastamyk/flask-skeleton | src/timezones.py | Python | unlicense | 371 | 0.002703 |
# pylint: disable=missing-docstring
from datetime import datetime, timedelta
import factory
import pytz
from factory.django import DjangoModelFactory
from factory.fuzzy import FuzzyText
from oauth2_provider.models import AccessToken, Application, RefreshToken
from openedx.core.djangoapps.oauth_dispatch.models impor... | eduNEXT/edx-platform | openedx/core/djangoapps/oauth_dispatch/tests/factories.py | Python | agpl-3.0 | 1,383 | 0 |
{
"name": "Delivery Sequence",
"vesion": "12.0.1.0.0",
"author": "IT-Projects LLC, Ivan Yelizariev",
"license": "LGPL-3",
"category": "Custom",
"website": "https://yelizariev.github.io",
"depends": ["delivery"],
"data": ["views.xml"],
"installable": False,
}
| yelizariev/addons-yelizariev | delivery_sequence/__manifest__.py | Python | lgpl-3.0 | 295 | 0 |
'''
Nibblegen: A script to convert LaTex text to html usable in Nibbleblog Forked from the latex2wp project (the licenceing for which is below).
Copyright (C) 2014 Theodore Jones
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as publis... | theoj2/Nibbletex | nibblegen/nibblegen.py | Python | gpl-3.0 | 19,283 | 0.02733 |
# -*- coding: utf-8 -*-
import re
from ..base.downloader import BaseDownloader
class VeehdCom(BaseDownloader):
__name__ = "VeehdCom"
__type__ = "downloader"
__version__ = "0.29"
__status__ = "testing"
__pattern__ = r"http://veehd\.com/video/\d+_\S+"
__config__ = [
("enabled", "bool",... | vuolter/pyload | src/pyload/plugins/downloaders/VeehdCom.py | Python | agpl-3.0 | 2,189 | 0.000914 |
import csv
import datetime
import logging
import os
from celery.task import task
from django.conf import settings
from django.contrib.auth import get_user_model
from django.utils.timezone import now
from libya_elections.constants import REMINDER_CHECKIN, REMINDER_REPORT, \
REMINDER_LAST_REPORT, REMINDER_CLOSE
fr... | SmartElect/SmartElect | bulk_sms/tasks.py | Python | apache-2.0 | 7,112 | 0.001547 |
# -*- coding: utf-8 -*-
import sys
reload(sys)
sys.setdefaultencoding('utf-8')
from common import public
import time
import re
class qyxx_ck():
"""采矿许可证"""
need_check_ziduan = ['valid_from',
'validto'
]
def check_valid_from(self, indexstr, ustr):
... | mefly2012/platform | src/parse/qyxx_ck.py | Python | apache-2.0 | 1,153 | 0.00272 |
# -*- coding: utf-8 -*-
# Copyright (C) 2011 Romain Bignon, Laurent Bachelier
#
# This file is part of assnet.
#
# assnet is free software: you can redistribute it and/or modify
# it under the terms of the GNU Affero General Public License as published by
# the Free Software Foundation, either version 3 of the License... | laurentb/assnet | assnet/filters.py | Python | agpl-3.0 | 2,171 | 0 |
import radon.complexity
import radon.visitors
from coalib.bears.LocalBear import LocalBear
from coalib.results.Result import Result
from coalib.results.RESULT_SEVERITY import RESULT_SEVERITY
from coalib.results.SourceRange import SourceRange
from coalib.settings.Setting import typed_list
class RadonBear(LocalBear):
... | sims1253/coala-bears | bears/python/RadonBear.py | Python | agpl-3.0 | 1,902 | 0.003155 |
"""Place all plugins in this directory."""
| jscott1989/happening | src/plugins/__init__.py | Python | mit | 43 | 0 |
import os
import datetime
from utils.util import run_command
__author__ = 'maa'
class MsBuilder:
def __init__(self, msbuild):
if msbuild == None:
self.msbuild = r"C:\Windows\Microsoft.NET\Framework64\v4.0.30319\MSBuild.exe"
else:
self.msbuild = msbuild
def build_with... | amatkivskiy/baidu | baidu/utils/msbuilder.py | Python | apache-2.0 | 1,654 | 0.002418 |
# -*- coding: utf-8 -*-
# Mathmaker creates automatically maths exercises sheets
# with their answers
# Copyright 2006-2017 Nicolas Hainaux <nh.techn@gmail.com>
# This file is part of Mathmaker.
# Mathmaker is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License... | nicolashainaux/mathmaker | tests/01_core_objects/test_110_polygons.py | Python | gpl-3.0 | 4,579 | 0.003494 |
from idl.Annotatable import Annotatable
from idl.IDLSyntaxError import IDLSyntaxError
from idl.Type import Type
class EnumField(Annotatable):
'''
Object that represents a single enumeration field.
'''
def __init__(self, enum, name, value):
Annotatable.__init__(self)
self.... | spiricn/libIDL | idl/Enum.py | Python | mit | 3,126 | 0.011836 |
# -*- coding: utf-8 -*-
#
# Copyright (C) 2006, TUBITAK/UEKAE
#
# 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 2 of the License, or (at your option)
# any later version.
#
# Plea... | SolusOS-discontinued/pisi | pisi/signalhandler.py | Python | gpl-2.0 | 1,553 | 0.001932 |
##############################################################################
# MDTraj: A Python Library for Loading, Saving, and Manipulating
# Molecular Dynamics Trajectories.
# Copyright 2012-2013 Stanford University and the Authors
#
# Authors: Robert McGibbon
# Contributors:
#
# MDTraj is free software: y... | kyleabeauchamp/mdtraj | mdtraj/formats/netcdf.py | Python | lgpl-2.1 | 21,654 | 0.002448 |
# coding=utf-8
# Copyright 2019 The Google UDA Team Authors.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicab... | google-research/uda | image/randaugment/augmentation_transforms.py | Python | apache-2.0 | 14,832 | 0.007821 |
# -*- coding: utf-8 -*-
##############################################################################
#
# Copyright (C) 2015 ADHOC SA (http://www.adhoc.com.ar)
# All Rights Reserved.
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU Affero General Pu... | sysadminmatmoz/ingadhoc | project_description/__openerp__.py | Python | agpl-3.0 | 1,639 | 0 |
#!/usr/bin/python
#
# Licensed to the Apache Software Foundation (ASF) under one
# or more contributor license agreements. See the NOTICE file
# distributed with this work for additional information
# regarding copyright ownership. The ASF licenses this file
# to you under the Apache License, Version 2.0 (the
# "Lic... | zhushuchen/Ocean | 组件/zookeeper-3.3.6/src/contrib/zkpython/src/test/delete_test.py | Python | agpl-3.0 | 2,872 | 0.006964 |
from selenium import webdriver
import logging
logger = logging.getLogger()
driver = webdriver.Firefox()
| OrangeTux/MafBot | mafbot/__init__.py | Python | gpl-3.0 | 106 | 0 |
# Copyright 2014 The Chromium Authors. All rights reserved.
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
# pylint: disable=W0201
from recipe_engine import recipe_api
from recipe_engine import config_types
class CheckoutApi(recipe_api.RecipeApi):
@propert... | youtube/cobalt | third_party/skia/infra/bots/recipe_modules/checkout/api.py | Python | bsd-3-clause | 5,928 | 0.006748 |
""" Tablib - DataFrame Support.
"""
import sys
if sys.version_info[0] > 2:
from io import BytesIO
else:
from cStringIO import StringIO as BytesIO
try:
from pandas import DataFrame
except ImportError:
DataFrame = None
import tablib
from tablib.compat import unicode
title = 'df'
extensions = ('df'... | htwenhe/DJOA | env/Lib/site-packages/tablib/formats/_df.py | Python | mit | 1,040 | 0.000962 |
import os
from lxml import etree
class device:
def __init__(self,ipadress,name):
self.ipadress=str(ipadress)
self.name=str(name)
self.status="off"
def turn_on(self):
self.status="on"
def turn_off(self):
self.status="off"
def getstatus(devices):
ips=[]
for ins... | RoboWoodhouse/RoboButler | python/scanlibrary.py | Python | mit | 2,231 | 0.037203 |
#!/usr/bin/env python
import os
from setuptools import setup
def read(fname):
with open(os.path.join(os.path.dirname(__file__), fname)) as f:
return f.read()
setup(name='django-darkknight',
version='0.9.0',
license="BSD",
description="He's a silent guardian, a watchful protector",
... | fusionbox/django-darkknight | setup.py | Python | bsd-2-clause | 1,503 | 0.002661 |
from .app import App
from .model import User, Group, ResetNonce
class ViewPermission:
pass
class EditPermission:
pass
@App.permission_rule(model=object, permission=object)
def admin_has_global_permission(identity, model, permission):
user = User.get(email=identity.userid)
return Group.get(name="Ad... | yacoma/auth-boilerplate | server/permissions.py | Python | mit | 959 | 0 |
def _filename(obj):
try:
return obj.__filename__()
except:
pass
return str(obj)
| dalejung/trtools | trtools/io/common.py | Python | mit | 109 | 0.009174 |
"""Support for dynamic COM client support.
Introduction
Dynamic COM client support is the ability to use a COM server without
prior knowledge of the server. This can be used to talk to almost all
COM servers, including much of MS Office.
In general, you should not use this module directly - see below.
... | Southpaw-TACTIC/Team | src/python/Lib/site-packages/win32com/client/dynamic.py | Python | epl-1.0 | 21,580 | 0.031279 |
import numpy as np
import pytest
import pandas as pd
from pandas.core.sparse.api import SparseDtype
import pandas.util.testing as tm
@pytest.mark.filterwarnings("ignore:Sparse:FutureWarning")
@pytest.mark.filterwarnings("ignore:Series.to_sparse:FutureWarning")
class TestSparseSeriesIndexing:
def setup_method(sel... | toobaz/pandas | pandas/tests/sparse/test_indexing.py | Python | bsd-3-clause | 38,613 | 0.000829 |
from quotes.models import Quote
from django.contrib import admin
class QuoteAdmin(admin.ModelAdmin):
list_display = ('message', 'name', 'program', 'class_of',
'submission_time')
admin.site.register(Quote, QuoteAdmin)
| k4rtik/alpo | quotes/admin.py | Python | mit | 243 | 0.00823 |
#!/usr/bin/env python
# vim: set expandtab shiftwidth=4:
# http://www.voip-info.org/wiki/view/asterisk+manager+events
import sys,time
import simplejson as json
from stompy.simple import Client
import ConfigParser
config = ConfigParser.ConfigParser()
devel_config = ConfigParser.ConfigParser()
config.read('/opt/ucall/... | gryzz/uCall | utils/asterisk-connector/ami2stomp-get.py | Python | gpl-3.0 | 972 | 0.005144 |
def _magic_get_file_type(f, _):
file_type = magic.from_buffer(f.read(1024), mime=True)
f.seek(0)
return file_type.decode('utf-8')
def _guess_file_type(_, filename):
return mimetypes.guess_type(filename)[0]
try:
import magic
except ImportError:
import mimetypes
get_file_type = _guess_file... | xbot/alfred-pushbullet | lib/pushbullet/filetype.py | Python | mit | 373 | 0 |
# vim: tabstop=4 shiftwidth=4 softtabstop=4
# Copyright 2012 OpenStack Foundation
# All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance with the License. You may obtain
# a copy of the License at
#
# http://www.apach... | eltonkevani/tempest_el_env | tempest/api/compute/floating_ips/test_floating_ips_actions.py | Python | apache-2.0 | 7,990 | 0 |
# coding:utf-8
'''
Created on 2017/11/7.
@author: chk01
'''
import math
import numpy as np
import h5py
import matplotlib.pyplot as plt
import tensorflow as tf
from tensorflow.python.framework import ops
from class_two.week_three.tf_utils import load_dataset, random_mini_batches, convert_to_one_hot, predict
np.random.... | sunyihuan326/DeltaLab | Andrew_NG_learning/class_two/week_three/Dxq_1.py | Python | mit | 3,691 | 0.00246 |
"""
raven.core.processors
~~~~~~~~~~~~~~~~~~~~~
:copyright: (c) 2010-2012 by the Sentry Team, see AUTHORS for more details.
:license: BSD, see LICENSE for more details.
"""
from __future__ import absolute_import
import re
from raven.utils import varmap
from raven.utils import six
class Processor(object):
def _... | nikolas/raven-python | raven/processors.py | Python | bsd-3-clause | 3,988 | 0 |
# -*- coding: utf-8 -*-
#
# This file is part of HEPData.
# Copyright (C) 2016 CERN.
#
# HEPData 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 2 of the
# License, or (at your option) any later... | HEPData/hepdata3 | hepdata/factory.py | Python | gpl-2.0 | 2,063 | 0 |
from datetime import datetime
from django.db import models
from uuidfield.fields import UUIDField
from access import acl
import amo.models
from translations.fields import save_signal
from mkt.constants import comm as const
class CommunicationPermissionModel(amo.models.ModelBase):
# Read permissions imply writ... | Joergen/zamboni | apps/comm/models.py | Python | bsd-3-clause | 6,495 | 0.001232 |
""" This class represents a Queue Node to store values and also
links others Nodes with values."""
class Node:
""" It starts with a value at all times. A note can not be
created without a value associated. """
def __init__(self, value):
self.value = value
self.next = None
""" This ... | ericxlive/abstract-data-types | abstract-data-types/adt_queue.py | Python | mit | 2,361 | 0.002541 |
NAME = 'django-adminactions'
VERSION = __version__ = (0, 4, 0, 'final', 0)
__author__ = 'sax'
import subprocess
import datetime
import os
def get_version(version=None):
"""Derives a PEP386-compliant version number from VERSION."""
if version is None:
version = VERSION
assert len(version) == 5
... | updatengine/updatengine-server | adminactions/__init__.py | Python | gpl-2.0 | 1,648 | 0.002427 |
##############################################################################
#
# Copyright (c) 2004 Zope Corporation and Contributors.
# All Rights Reserved.
#
# This software is subject to the provisions of the Zope Public License,
# Version 2.1 (ZPL). A copy of the ZPL should accompany this distribution.
# THIS SO... | Donkyhotay/MoonPy | zope/app/apidoc/browser/skin.py | Python | gpl-3.0 | 1,074 | 0.003724 |
# Copyright (c) 2013, Kevin Greenan (kmgreen2@gmail.com)
# All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions are met:
#
# Redistributions of source code must retain the above copyright notice, this
# list of c... | tsg-/pyeclib | pyeclib/__init__.py | Python | bsd-2-clause | 1,348 | 0 |
"""
tflite backend (https://github.com/tensorflow/tensorflow/lite)
"""
# pylint: disable=unused-argument,missing-docstring,useless-super-delegation
from threading import Lock
try:
# try dedicated tflite package first
import tflite_runtime
import tflite_runtime.interpreter as tflite
_version = tflite_... | plaidml/plaidml | mlperf/backend_tflite.py | Python | apache-2.0 | 1,874 | 0.001601 |
from __future__ import with_statement
from sympy import Symbol, exp, Integer, Float, sin, cos, log, Poly, Lambda, \
Function, I, S, sqrt, srepr, Rational, Tuple, Matrix, Interval
from sympy.abc import x, y
from sympy.core.sympify import sympify, _sympify, SympifyError, kernS
from sympy.core.decorators import _sympi... | lidavidm/mathics-heroku | venv/lib/python2.7/site-packages/sympy/core/tests/test_sympify.py | Python | gpl-3.0 | 14,157 | 0.000212 |
from .ScatterplotStructure import ScatterplotStructure
from .BasicHTMLFromScatterplotStructure import BasicHTMLFromScatterplotStructure
from scattertext.viz.PairPlotFromScattertextStructure import PairPlotFromScatterplotStructure
from .VizDataAdapter import VizDataAdapter
from .HTMLSemioticSquareViz import HTMLSemiotic... | JasonKessler/scattertext | scattertext/viz/__init__.py | Python | apache-2.0 | 329 | 0.009119 |
'''
Created by auto_sdk on 2013.11.26
'''
from top.api.base import RestApi
class PictureIsreferencedGetRequest(RestApi):
def __init__(self,domain='gw.api.taobao.com',port=80):
RestApi.__init__(self,domain, port)
self.picture_id = None
def getapiname(self):
return 'taobao.picture.isreferenced.get'
| colaftc/webtool | top/api/rest/PictureIsreferencedGetRequest.py | Python | mit | 318 | 0.028302 |
"""
Meteorology visualisation examples
==================================
"""
| pp-mo/iris | docs/iris/example_code/Meteorology/__init__.py | Python | lgpl-3.0 | 78 | 0 |
def test_assert():
assert 'soup' == 'soup'
def test_pass():
pass
def test_fail():
assert False
test_fail.will_fail = True
| wilas/lab-ci | samples/py_garden/py_simple_tdd/test_nose_flat_play.py | Python | apache-2.0 | 137 | 0.021898 |
#! /usr/bin/env python
# -*- coding: UTF-8 -*-
# ---------------------------------------------------------------------------
# ___ __ ___ ___ ____ ____ __
# | \ | \ | | / | | | \ Automatic
# |__/ |__/ | | | |__ |__ | | Conference
# | ... | brigittebigi/proceed | proceed/src/TagPDF/name.py | Python | gpl-3.0 | 3,002 | 0.003331 |
"""
POZ Development Application.
"""
import numpy as np
# import cv2
import pozutil as pu
import test_util as tpu
def perspective_test(_y, _z, _ele, _azi):
print "--------------------------------------"
print "Perspective Transform tests"
print
cam = pu.CameraHelper()
# som... | mwgit00/poz | poz.py | Python | mit | 3,487 | 0.000287 |
#!/usr/bin/env python
from setuptools import setup, find_packages
setup(
name='pysensu-yelp',
version='0.4.4',
provides=['pysensu_yelp'],
description='Emits Yelp-flavored Sensu events to a Sensu Client',
url='https://github.com/Yelp/pysensu-yelp',
author='Yelp Operations Team',
author_emai... | Yelp/pysensu-yelp | setup.py | Python | apache-2.0 | 480 | 0 |
# Peerz - P2P python library using ZeroMQ sockets and gevent
# Copyright (C) 2014-2015 Steve Henderson
#
# 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... | shendo/peerz | peerz/messaging/base.py | Python | gpl-3.0 | 2,720 | 0.002941 |
import hashlib
puzzle_input = 'iwrupvqb'
current = 0
done = False
while not done:
combined_input = puzzle_input + str(current)
solution = hashlib.md5(combined_input.encode())
solution = str(solution.hexdigest())
print(solution)
if solution.startswith('000000'):
done = True
print(c... | rubiconjosh/aoc-2015 | day4-part2.py | Python | mit | 345 | 0 |
# Authors: Alexandre Gramfort <alexandre.gramfort@telecom-paristech.fr>
# License: BSD 3 clause
import pytest
import numpy as np
from numpy.testing import assert_allclose
from scipy import sparse
from sklearn.base import BaseEstimator
from sklearn.dummy import DummyClassifier
from sklearn.model_selection import Leave... | glemaitre/scikit-learn | sklearn/tests/test_calibration.py | Python | bsd-3-clause | 23,376 | 0 |
#! /usr/bin/env python
"""WSGI server interface to mw-render and mw-zip/mw-post"""
import os
import re
import shutil
import signal
import StringIO
import subprocess
import time
import urllib2
try:
from hashlib import md5
except ImportError:
from md5 import md5
try:
import json
except ImportError:
impo... | cscott/wikiserver | mwlib/serve.py | Python | gpl-2.0 | 19,146 | 0.004805 |
#!/usr/bin/env python
"""
Simple-stupid time tracker script
=================================
Timetrack
opyright (C) 2010, Branko Vukelic <studio@brankovukelic.com>
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 Soft... | foxbunny/Timetrack | tt.py | Python | gpl-3.0 | 7,554 | 0.003574 |
from typing import Dict, Set
from django.db import transaction
from django.db import models
from django.utils import timezone
from data_refinery_common.models.models import Sample, Experiment, OriginalFile
class SurveyJob(models.Model):
"""Records information about a Surveyor Job."""
class Meta:
db... | data-refinery/data_refinery | common/data_refinery_common/models/jobs.py | Python | bsd-3-clause | 8,068 | 0.001363 |
import cpp11_decltype
a = cpp11_decltype.A()
a.i = 5
if a.i != 5:
raise RuntimeError, "Assignment to a.i failed."
a.j = 10
if a.j != 10:
raise RuntimeError, "Assignment to a.j failed."
b = a.foo(5)
if b != 10:
raise RuntimeError, "foo(5) should return 10."
b = a.foo(6)
if b != 0:
raise RuntimeError,... | DGA-MI-SSI/YaCo | deps/swig-3.0.7/Examples/test-suite/python/cpp11_decltype_runme.py | Python | gpl-3.0 | 347 | 0.011527 |
import numpy as np
import cudarray as ca
from .base import PickleMixin
_FLT_MIN = np.finfo(ca.float_).tiny
class Loss(PickleMixin):
# abll: I suspect that this interface is not ideal. It would be more
# elegant if Loss only provided loss() and grad(). However, where should
# we place the logic from fpro... | lre/deeppy | deeppy/loss.py | Python | mit | 3,134 | 0 |
from rest_framework import serializers
class BaseModelSerializer(serializers.ModelSerializer):
id = serializers.SerializerMethodField()
def get_id(self, instance):
return str(instance.id)
| mnazim/django-rest-kickstart | helpers/serializers.py | Python | mit | 206 | 0.004854 |
from website.addons.base.serializer import CitationsAddonSerializer
class MendeleySerializer(CitationsAddonSerializer):
addon_short_name = 'mendeley'
| zachjanicki/osf.io | website/addons/mendeley/serializer.py | Python | apache-2.0 | 155 | 0.006452 |
"""
merged implementation of the cache provider
the name cache was not chosen to ensure pluggy automatically
ignores the external pytest-cache
"""
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
import json
import os
from collections import OrderedDict
imp... | hackebrot/pytest | src/_pytest/cacheprovider.py | Python | mit | 13,931 | 0.00079 |
import os, sys
import myfun
import numpy as np
import matplotlib as mpl
mpl.use('ps')
import matplotlib.pyplot as plt
from mpl_toolkits.mplot3d import Axes3D
from scipy import interpolate
import lagrangian_stats
import scipy.fftpack
## READ archive (too many points... somehow)
# args: name, dayi, dayf, days
#label ... | jungla/ICOM-fluidity-toolbox | 2D/U/plot_Div_spec.py | Python | gpl-2.0 | 3,442 | 0.049099 |
# -*- coding: utf-8 -*-
__version__ = '0.7.0'
| MathieuDuponchelle/django-sortedm2m | sortedm2m/__init__.py | Python | bsd-3-clause | 48 | 0 |
# Copyright (C) 2011-2017 2ndQuadrant Limited
#
# This file is part of Barman.
#
# Barman 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 versio... | infoxchange/barman | barman/xlog.py | Python | gpl-3.0 | 14,318 | 0 |
#
#
# Copyright (C) 2007, 2008, 2010, 2012 Google Inc.
# All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions are
# met:
#
# 1. Redistributions of source code must retain the above copyright notice,
# this list ... | apyrgio/ganeti | lib/http/__init__.py | Python | bsd-2-clause | 28,992 | 0.007243 |
# GemRB - Infinity Engine Emulator
# Copyright (C) 2003 The GemRB Project
#
# 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 2
# of the License, or (at your option) any later versi... | tomprince/gemrb | gemrb/GUIScripts/bg1/GUICG22.py | Python | gpl-2.0 | 3,963 | 0.028261 |
""" Class to handle date-parsing and formatting """
# Workaround for http://bugs.python.org/issue8098
import _strptime # pylint: disable=unused-import
from datetime import datetime
import time
class DateUtils(object):
""" Class to handle date-parsing and formatting """
date_format = '%Y-%m-%dT%H:%M:%SZ'
... | sebastian-steinmann/kodi-repo | src/service.library.video/resources/lib/date_utils.py | Python | mit | 1,538 | 0.001951 |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
# Copyright (C) 2011 Adriano Monteiro Marques
#
# Author: Piotrek Wasilewski <wasilewski.piotrek@gmail.com>
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU Affero General Public License as
# published by the Free Sof... | umitproject/network-admin | netadmin/networks/urls.py | Python | agpl-3.0 | 2,718 | 0.002575 |
#-*- coding: utf-8 -*-
'''
Created on 16 déc. 2013
@author: yoann Moreau
All controls operations :
return true if control ok
'''
import os
import errno
from datetime import date,datetime,timedelta
import ogr,osr
import re
import gdal
import osr
import numpy as np
import numpy.ma as ma
import subprocess
import shutil... | yoannMoreau/Evapo_EraInterim | python/utils.py | Python | cc0-1.0 | 20,707 | 0.026002 |
#
# Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance with the License. You may obtain
# a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# ... | miguelgrinberg/heat | heat/engine/clients/os/trove.py | Python | apache-2.0 | 4,752 | 0 |
# import python modules
import os
import time
import logging
import multiprocessing
# import django modules
# import third party modules
# import project specific model classes
from config.models import Origin
# import app specific utility classes
# import app specific utility functions
from .utils import packet_c... | hephestos/pythos | discovery/tasks.py | Python | gpl-3.0 | 3,656 | 0.000274 |
import unittest
import time
import _thread as thread
from threading import Barrier
from threading import Lock
from threading import Event
from t2db_buffer.buffer import GlobalBuffer
from t2db_buffer.buffer import BufferServer
from t2db_objects.objects import Tweet
from t2db_objects.objects import User
from t2db_object... | ptorrestr/t2db_buffer | t2db_buffer/tests/test_buffer.py | Python | gpl-2.0 | 11,583 | 0.003367 |
import sys
from django.core.management.base import BaseCommand
from ietf.community.constants import SIGNIFICANT_STATES
from ietf.community.models import DocumentChangeDates
from ietf.doc.models import Document
class Command(BaseCommand):
help = (u"Update drafts in community lists by reviewing their rules")
... | wpjesus/codematch | ietf/community/management/commands/update_doc_change_dates.py | Python | bsd-3-clause | 1,440 | 0.002083 |
# -*- coding: ISO-8859-15 -*-
# =============================================================================
# Copyright (c) 2004, 2006 Sean C. Gillies
# Copyright (c) 2009 STFC <http://www.stfc.ac.uk>
#
# Authors :
# Dominic Lowe <dominic.lowe@stfc.ac.uk>
#
# Contact email: dominic.lowe@stfc.ac.uk
# =======... | okfn/owslib | owslib/wfs.py | Python | bsd-3-clause | 930 | 0.008602 |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
import os
import sys
if __name__ == "__main__":
settings_name = "settings.local" if os.name == 'nt' else "settings.remote"
os.environ.setdefault("DJANGO_SETTINGS_MODULE", settings_name)
from django.core.management import execute_from_command_line
execute_... | alexeiramone/django-default-template | manage.py | Python | mit | 348 | 0 |
import pymysql.cursors
from pymysql.tests import base
from pymysql import util
from pymysql.err import ProgrammingError
import time
import datetime
__all__ = ["TestConversion", "TestCursor", "TestBulkInserts"]
class TestConversion(base.PyMySQLTestCase):
def test_datatypes(self):
""" test every data typ... | MonicaHsu/truvaluation | venv/lib/python2.7/site-packages/pymysql/tests/test_basic.py | Python | mit | 12,154 | 0.003291 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.