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 |
|---|---|---|---|---|---|---|
from django.contrib import admin
from .models import Post
class PostAdmin(admin.ModelAdmin):
list_display = ('user', 'mood', 'mood_positive', 'mood_negative', 'mood_neutral', 'created')
list_filter = ('mood', 'created')
admin.site.register(Post, PostAdmin)
| pavlenko-volodymyr/codingmood | codemood/social/admin.py | Python | mit | 270 | 0.003704 |
"""Support for Wink fans."""
import pywink
from homeassistant.components.fan import (
SPEED_HIGH,
SPEED_LOW,
SPEED_MEDIUM,
SUPPORT_DIRECTION,
SUPPORT_SET_SPEED,
FanEntity,
)
from . import DOMAIN, WinkDevice
SPEED_AUTO = "auto"
SPEED_LOWEST = "lowest"
SUPPORTED_FEATURES = SUPPORT_DIRECTION + S... | sdague/home-assistant | homeassistant/components/wink/fan.py | Python | apache-2.0 | 3,014 | 0 |
# file eulxml/__init__.py
#
# Copyright 2010,2011 Emory University Libraries
#
# 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
#
# ... | dannyroberts/eulxml | eulxml/__init__.py | Python | apache-2.0 | 903 | 0 |
# -*- coding: utf-8 -*-
# Generated by Django 1.9.9 on 2016-09-04 23:50
from __future__ import unicode_literals
from django.db import migrations
class Migration(migrations.Migration):
dependencies = [
('courses', '0013_auto_20160903_0212'),
]
operations = [
migrations.RenameField(
... | aspc/mainsite | aspc/courses/migrations/0014_auto_20160904_2350.py | Python | mit | 1,605 | 0 |
# volunteers/urls.py
from django.conf.urls import *
from django.contrib.auth.decorators import login_required
from volunteers.views import *
urlpatterns = patterns('',
#(r'^$', login_required(ShowsInProcessing.as_view()), {}, 'volunteer_show_list'),
#(r'^(?P<show_slug>\[-\w]+)/$', login_required(ShowReview.... | EricSchles/veyepar | dj/volunteers/urls.py | Python | mit | 1,412 | 0.010623 |
from decimal import Decimal as D
from django.conf import settings
from django.core.exceptions import ObjectDoesNotExist
from django.utils.translation import ugettext_lazy as _
from oscar.core import loading
Scale = loading.get_class('shipping.scales', 'Scale')
weight_precision = getattr(settings, 'OSCAR_SHIPPING_WE... | okfish/django-oscar-shipping | oscar_shipping/packers.py | Python | bsd-3-clause | 4,871 | 0.006775 |
# -*- coding: utf-8 -*-
#
# This file is part of PyBuilder
#
# Copyright 2011-2015 PyBuilder Team
#
# 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/l... | Danielweber7624/pybuilder | src/main/python/pybuilder/plugins/exec_plugin.py | Python | apache-2.0 | 3,101 | 0.00258 |
# Copyright (C) 2012 Aaron Krebs akrebs@ualberta.ca
# 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... | a-krebs/finances | finances/django_registration/urls.py | Python | gpl-3.0 | 3,598 | 0.005837 |
from colorsys import rgb_to_hsv
import time
def id_generator():
timestr = time.strftime("%Y%m%d-%H%M%S")
return timestr
def lightness(pixel):
# For backwards compatibility with python2
return rgb_to_hsv(pixel[0], pixel[1], pixel[2])[2] / 255.0
def hue(pixel):
return rgb_to_hsv(pixel[0], pixel[... | satyarth/pixelsort | pixelsort/util.py | Python | mit | 1,262 | 0.001585 |
# 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 version.
#
# HEPData is d... | HEPData/hepdata | tests/converter_test.py | Python | gpl-2.0 | 4,511 | 0.00133 |
"""
Copyright 2009 55 Minutes (http://www.55minutes.com)
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 t... | UT-Austin-FIS/django-coverage | django_coverage/utils/coverage_report/templates/default_module_exceptions.py | Python | apache-2.0 | 2,058 | 0.00243 |
# Copyright 2017 The TensorFlow Authors. 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 applica... | jbedorf/tensorflow | tensorflow/python/util/tf_inspect.py | Python | apache-2.0 | 13,772 | 0.01002 |
# -*- coding: utf-8 -*-
# Generated by Django 1.10.2 on 2016-10-16 04:54
from __future__ import unicode_literals
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('products', '0001_initial'),
]
operations = [
migrations.CreateModel(
... | hariharaselvam/djangotraining | products/migrations/0002_stat.py | Python | apache-2.0 | 566 | 0.001767 |
"""Various utilities"""
| UNICT-DMI/Telegram-DMI-Bot | module/utils/__init__.py | Python | gpl-3.0 | 24 | 0 |
# Copyright (c) 2020 Ultimaker B.V.
# Copyright (c) 2013 David Braam
# Uranium is released under the terms of the LGPLv3 or higher.
import os
from UM.Job import Job
from UM.Logger import Logger
from UM.Mesh.MeshReader import MeshReader
from UM.Mesh.MeshBuilder import MeshBuilder
from UM.Scene.SceneNode import SceneNo... | Ultimaker/Uranium | plugins/FileHandlers/OBJReader/OBJReader.py | Python | lgpl-3.0 | 5,356 | 0.003547 |
from grid.models import Grid
from django.contrib.auth.models import Group, User, Permission
from package.models import Category, PackageExample, Package
from grid.models import Element, Feature, GridPackage
from core.tests import datautil
def load():
category, created = Category.objects.get_or_create(
pk=... | audreyr/opencomparison | apiv1/tests/data.py | Python | mit | 6,264 | 0.000958 |
import sys
from flexmock import flexmock
import inject
from mcloud.events import EventBus
from mcloud.txdocker import IDockerClient, DockerTwistedClient
from mcloud.util import txtimeout
import pytest
from mcloud.remote import Server, Client, ApiError, Task, ApiRpcServer
from twisted.internet import reactor, defer
fr... | modera/mcloud | tests/test_remote.py | Python | apache-2.0 | 6,741 | 0.005192 |
# -*- coding: utf-8 -*-
#------------------------------------------------------------
import sys
PY3 = False
if sys.version_info[0] >= 3: PY3 = True; unicode = str; unichr = chr; long = int
if PY3:
import urllib.parse as urlparse # Es muy lento en PY2. En PY3 es nativo
else:
import... | alfa-addon/addon | plugin.video.alfa/channels/freeporn.py | Python | gpl-3.0 | 5,059 | 0.016024 |
# Copyright (c) 2011 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.apache.org/licenses/LICENSE-2.0
#
# Unless ... | mmasaki/trove | trove/tests/unittests/guestagent/test_pkg.py | Python | apache-2.0 | 21,209 | 0 |
from ....common.db.sql import VARCHAR, Numeric as NUMBER, DateTime as DATETIME, Column, BaseModel, CLOB, DATE
VARCHAR2 = VARCHAR
class CCommodityFuturesEODPrices(BaseModel):
"""
4.182 中国商品期货日行情
Attributes
----------
object_id: VARCHAR2(100)
对象ID
s_info_windcode: VARCHAR2(40)
... | SnowWalkerJ/quantlib | quant/data/wind/tables/ccommodityfutureseodprices.py | Python | gpl-3.0 | 1,944 | 0.015819 |
from django.db import models
from django.dispatch import receiver
from django.utils.encoding import python_2_unicode_compatible
from django.conf import settings
from django.utils.translation import ugettext_lazy as _
from django.core.validators import MaxValueValidator, MinValueValidator
from projects.models import Pro... | bilbeyt/ituro | ituro/results/models.py | Python | mit | 11,573 | 0.000432 |
import sys
import time
import lexer
import parser
import cfg
import typecheck
import codegen
import errors
import exc
from threading import Lock
compilelock = Lock()
#------------------------------------------------------------------------
# Pipeline
#---------------------------------------------------------------... | seibert/blaze-core | blaze/blir/passes.py | Python | bsd-2-clause | 6,473 | 0.006334 |
from django.conf.urls import url
from . import views
urlpatterns = [
url(r'^signin/', views.signin, name='signin'),
url(r'^signout/', views.signout, name='signout'),
url(r'^change_password/', views.change_password, name='change_password'),
] | wasit7/visionmarker | beta/wl_auth/urls.py | Python | mit | 244 | 0.016393 |
## This file is part of Scapy
## See http://www.secdev.org/projects/scapy for more informations
## Copyright (C) Philippe Biondi <phil@secdev.org>
## This program is published under a GPLv2 license
"""
Customizations needed to support Microsoft Windows.
"""
import os,re,sys,socket,time
from glob import glob
from scap... | mytliulei/DCNRobotInstallPackages | windows/win32/scapy-2/scapy/arch/windows/__init__.py | Python | apache-2.0 | 19,506 | 0.009382 |
from django import template
from django.template.loader import render_to_string
from isi_mip.core.models import FooterLinks
register = template.Library()
@register.simple_tag(takes_context=True)
def footer(context, **kwargs):
request = context['request']
settings = FooterLinks.for_site(request.site)
pa... | bruecksen/isimip | isi_mip/core/templatetags/footer.py | Python | mit | 833 | 0.0012 |
import datetime
import decimal
from django.db import models
from django.db.models.sql.constants import LOOKUP_SEP
from django.db.models.deletion import Collector
from django.db.models.related import RelatedObject
from django.forms.forms import pretty_name
from django.utils import formats
from django.utils.html import ... | lzw120/django | django/contrib/admin/util.py | Python | bsd-3-clause | 15,005 | 0.0012 |
import os
import Image
from flask import Module, request, current_app, render_template, jsonify, send_file, abort
from werkzeug import secure_filename
from urbanjungle.models import db
from urbanjungle.models.report import Report
from sqlalchemy.ext.serializer import dumps
frontend = Module(__name__)
def allowed_file... | thibault/UrbanJungle | site/urbanjungle/controllers/frontend.py | Python | gpl-3.0 | 2,808 | 0.006766 |
import click
__all__ = [
'info'
]
INFO_MESSAGE = """
Odooku
--------------------------------------
available modules: {num_modules}
"""
@click.command()
@click.pass_context
def info(ctx):
logger = (
ctx.obj['logger']
)
from odoo.modules import get_modules
print INFO_MESSAGE.format(
... | adaptivdesign/odooku-compat | odooku/cli/commands/info.py | Python | apache-2.0 | 365 | 0 |
import sys
import numpy
import scipy
import json
import itertools
import random
import os
from sys import stderr, exit, argv
from scipy.sparse.linalg import spsolve
from sklearn.metrics.pairwise import euclidean_distances
from nltk.stem import SnowballStemmer
def load_data_sparse(prefix) :
return scipy.sparse.csr... | genie9/pulp | pulp_simulator.py | Python | gpl-3.0 | 13,319 | 0.015166 |
"""Predicate: output token."""
from gtd.utils import ComparableMixin
class Predicate(ComparableMixin):
"""Represents a step in the logical form (i.e., an output token)."""
__slots__ = ['_name', '_original_string', '_types']
def __init__(self, name, original_string=None, types=None):
"""Create Pr... | kelvinguu/lang2program | strongsup/predicate.py | Python | apache-2.0 | 1,835 | 0 |
#!/usr/bin/python
# -*- coding: utf-8 -*-
# Copyright: 2017, Dag Wieers (@dagwieers) <dag@wieers.com>
# GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt)
ANSIBLE_METADATA = {'metadata_version': '1.1',
'status': ['preview'],
'supported_by... | hryamzik/ansible | lib/ansible/modules/windows/win_defrag.py | Python | gpl-3.0 | 2,682 | 0.002237 |
# -*- coding: utf-8 -*-
##############################################################################
#
# OpenERP, Open Source Management Solution
# Copyright (C) 2004-2010 Tiny SPRL (<http://tiny.be>).
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU... | Johnzero/erp | openerp/addons/fetchmail/fetchmail.py | Python | agpl-3.0 | 12,859 | 0.006766 |
# -*- encoding: utf-8 -*-
from __future__ import print_function
import abc
import configobj
import os
import time
import validate
from abjad.tools.abctools.AbjadObject import AbjadObject
class Configuration(AbjadObject):
r'''A configuration object.
'''
### CLASS VARIABLES ###
__slots__ = (
'... | andrewyoung1991/abjad | abjad/tools/systemtools/Configuration.py | Python | gpl-3.0 | 6,475 | 0.001853 |
# Copyright 2013, Big Switch Networks, Inc
#
# 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... | wangxiangyu/horizon | openstack_dashboard/dashboards/project/firewalls/forms.py | Python | apache-2.0 | 16,187 | 0 |
# -*- coding: utf-8 -*-
"""Family module for Vikidia."""
#
# (C) Pywikibot team, 2010-2018
#
# Distributed under the terms of the MIT license.
#
from __future__ import absolute_import, division, unicode_literals
from pywikibot import family
class Family(family.SubdomainFamily):
"""Family class for Vikidia."""
... | PersianWikipedia/pywikibot-core | pywikibot/families/vikidia_family.py | Python | mit | 661 | 0 |
"""
Module containing functions to differentiate functions using tensorflow.
"""
try:
import tensorflow as tf
from tensorflow.python.ops.gradients import _hessian_vector_product
except ImportError:
tf = None
from ._backend import Backend, assert_backend_available
class TensorflowBackend(Backend):
def... | j-towns/pymanopt | pymanopt/tools/autodiff/_tensorflow.py | Python | bsd-3-clause | 2,913 | 0 |
"""
@author: ArcGIS for Intelligence
@contact: defensesolutions@esri.com
@company: Esri
@version: 1.0
@description: Used to stage the apps for Movement Analysis
@requirements: Python 2.7.x, ArcGIS 10.3.1
@copyright: Esri, 2015
"""
import arcresthelper
from arcresthelper import portalautomati... | conklinbd/MovementAnalysis | TemplateInstall/PortalDeploy/StageApp.py | Python | apache-2.0 | 726 | 0.009642 |
__doc__ = """External interface to the BeautifulSoup HTML parser.
"""
__all__ = ["fromstring", "parse", "convert_tree"]
from lxml import etree, html
from BeautifulSoup import \
BeautifulSoup, Tag, Comment, ProcessingInstruction, NavigableString
def fromstring(data, beautifulsoup=None, makeelement=None, **bsarg... | cortext/crawtextV2 | ~/venvs/crawler/lib/python2.7/site-packages/lxml/html/soupparser.py | Python | mit | 4,360 | 0.002982 |
"""
This module holds all of the regular expression patterns that pykol uses. It makes sense
to store them all in the same place since many patterns are used by multiple requests.
The 'patterns' data object is a dictionary mapping patternId to pattern. If pattern is a tuple,
then the first element of the tuple should b... | ijzer/cwbot-ndy | kol/data/Patterns.py | Python | bsd-3-clause | 28,912 | 0.014596 |
"""
To run this test, type this in command line <kolibri manage test -- kolibri.core.content>
"""
import datetime
import unittest
import uuid
import mock
import requests
from django.conf import settings
from django.core.cache import cache
from django.core.urlresolvers import reverse
from django.test import TestCase
fr... | indirectlylit/kolibri | kolibri/core/content/test/test_content_app.py | Python | mit | 72,718 | 0.001595 |
from django.contrib import admin
from django.utils.text import truncate_words
from django.core import urlresolvers
from django.utils.html import escape
from infosys.models import *
def uni_tr_10(field_name):
def func(obj):
return truncate_words(unicode(getattr(obj, field_name)), 10)
func.short_de... | bancek/egradebook | src/apps/infosys/admin.py | Python | gpl-3.0 | 6,165 | 0.005515 |
from django.conf.urls import include, url
from . import views
urlpatterns = [
url(r'^register/$', views.register,name="register"),
# url('^logout', views.logout_view,name="logout"),
# url('^login', views.logout_view,name="login"),
url(r'^password_change/$','django.contrib.auth.views.pa... | RachellCalhoun/craftsite | accounts/urls.py | Python | gpl-3.0 | 1,059 | 0.00661 |
# -*- coding: utf-8 -*-
from __future__ import absolute_import
from vilya.libs.template import st
from vilya.models.feed import get_user_inbox, get_public_feed
MAX_ACT_COUNT = 100
_q_exports = ['actions', 'public_timeline']
def _q_index(request):
return st('/m/feed.html', **locals())
def public_timeline(re... | douban/code | vilya/views/m.py | Python | bsd-3-clause | 1,035 | 0 |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
"""
trigger.contrib.docommand
~~~~~~~~~~~~~~~~~~~~~~~~~
This package provides facilities for running commands on devices using the CLI.
"""
__author__ = 'Jathan McCollum, Mike Biancianello'
__maintainer__ = 'Jathan McCollum'
__email__ = 'jathan@gmail.com'
__copyright__ =... | chepazzo/trigger | trigger/contrib/docommand/__init__.py | Python | bsd-3-clause | 12,051 | 0.001079 |
from django.contrib import admin
from abcast.models import *
from django.contrib.auth.models import User
from genericadmin.admin import GenericAdminModelAdmin, GenericTabularInline
class MembersInline(admin.TabularInline):
model = Station.members.through
class ChannelsInline(admin.TabularInline):
model = C... | hzlf/openbroadcast | website/apps/abcast/admin/baseadmin.py | Python | gpl-3.0 | 1,860 | 0.017204 |
from django.contrib import admin
from django.utils.translation import ugettext, ugettext_lazy as _
from ella.positions.models import Position
from ella.utils import timezone
class PositionOptions(admin.ModelAdmin):
def show_title(self, obj):
if not obj.target:
return '-- %s --' % ugettext('em... | WhiskeyMedia/ella | ella/positions/admin.py | Python | bsd-3-clause | 1,381 | 0.003621 |
from loader import *
from extract_keywords import split_line
from collections import defaultdict
def main():
keyword_data = load_single_file('keyword_table.csv')
paper_data = load_single_file('Paper.csv')
with open('lda_input.txt', 'w', encoding='utf-8') as write_file:
for paper_id in paper_data.keys():
paper... | leeopop/2015-CS570-Project | prepare_lda.py | Python | mit | 897 | 0.031215 |
# Copyright (c) 2007 The Regents of The University of Michigan
# 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 ... | vineodd/PIMSim | GEM5Simulation/gem5/src/python/m5/ticks.py | Python | gpl-3.0 | 3,221 | 0.003415 |
#!/usr/bin/env python
## Program: VMTK
## Module: $RCSfile: vmtkfebiowytet10.py,v $
## Language: Python
## Date: $Date: 2016/08/19 09:49:59 $
## Version: $Revision: 1.6 $
## Copyright (c) Jingfeng Jiang, Yu Wang. All rights reserved.
## See LICENCE file for details.
## This software is di... | jjiang-mtu/virtual-breast-project | dynamic_SWE/write_FEBio_format_quadratic/vmtkfebiowytet10.py | Python | gpl-2.0 | 1,844 | 0.016269 |
from vsg.rules import previous_line
from vsg import token
lTokens = []
lTokens.append(token.if_statement.if_keyword)
class rule_031(previous_line):
'''
This rule checks for blank lines or comments above the **if** keyword.
In the case of nested **if** statements, the rule will be enfoced on the first *... | jeremiah-c-leary/vhdl-style-guide | vsg/rules/if_statement/rule_031.py | Python | gpl-3.0 | 988 | 0.001012 |
# from http://stackoverflow.com/questions/4581789/how-do-i-get-user-ip-address-in-django
def get_client_ip(request):
x_forwarded_for = request.META.get('HTTP_X_FORWARDED_FOR')
if x_forwarded_for:
ip = x_forwarded_for.split(',')[0].strip()
else:
ip = request.META.get('REMOTE_ADDR')
return... | mattcaldwell/autopylot | autopylot/django/__init__.py | Python | mit | 324 | 0.003086 |
from django.core.files.uploadedfile import InMemoryUploadedFile
import re
import six
from django import forms
from django.forms.util import flatatt
from django.forms.widgets import FileInput
from django.template import Context
from django.template.loader import render_to_string
from django.utils.encoding import force_... | MrReN/django-oscar | oscar/forms/widgets.py | Python | bsd-3-clause | 5,740 | 0 |
# -*- coding: utf-8 -*-
##############################################################################
#
# OpenERP, Open Source Management Solution
# Copyright (C) 2011 NovaPoint Group LLC (<http://www.novapointgroup.com>)
# Copyright (C) 2004-2010 OpenERP SA (<http://www.openerp.com>)
#
# This program is f... | ryepdx/account_payment_cim_authdotnet | wizard/__init__.py | Python | agpl-3.0 | 1,222 | 0 |
"""
Django admin dashboard configuration.
"""
from config_models.admin import ConfigurationModelAdmin, KeyedConfigurationModelAdmin
from django.contrib import admin
from django.utils.translation import ugettext_lazy as _
from common.djangoapps.xblock_django.models import XBlockConfiguration, XBlockStudioConfiguratio... | eduNEXT/edunext-platform | common/djangoapps/xblock_django/admin.py | Python | agpl-3.0 | 2,485 | 0.004427 |
# -*- coding: utf-8 -*-
from __future__ import absolute_import, division, print_function, unicode_literals
__license__ = 'GNU Affero General Public License http://www.gnu.org/licenses/agpl.html'
__copyright__ = "Copyright (C) 2018 The OctoPrint Project - Released under terms of the AGPLv3 License"
import octoprint.pl... | foosel/OctoPrint | src/octoprint/plugins/tracking/__init__.py | Python | agpl-3.0 | 15,412 | 0.026022 |
# Copyright 2019 Rackspace, US Inc.
#
# 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 w... | ctrlaltdel/neutrinator | vendor/openstack/load_balancer/v2/flavor.py | Python | gpl-3.0 | 1,423 | 0 |
# ############################################################################
# OSIS stands for Open Student Information System. It's an application
# designed to manage the core business of higher education institutions,
# such as universities, faculties, institutes and professional schools.
# The core business i... | uclouvain/OSIS-Louvain | education_group/ddd/validators/_copy_check_mini_training_end_date.py | Python | agpl-3.0 | 1,855 | 0.002157 |
# -*- coding: utf-8 -*-
#
# Configuration file for the Sphinx documentation builder.
#
# This file does only contain a selection of the most common options. For a
# full list see the documentation:
# http://www.sphinx-doc.org/en/stable/config
# -- Path setup ------------------------------------------------------------... | mmaelicke/scikit-gstat | docs/conf.py | Python | mit | 7,252 | 0.000552 |
#!/usr/bin/env python3.5
# Arun Debray, 24 Dec. 2015
# Given a group order, classifies finite abelian groups of that order.
# ./finite_abelian_groups.py [-tpi] number
# -t formats the output in TeX (as opposed to in the terminal)
# -p chooses the primary components decomposition (default)
# -i chooses the invariant f... | adebray/enumerating_abelian_groups | finite_abelian_groups.py | Python | mit | 5,033 | 0.020481 |
"""Tests for plugin.py."""
import ckanext.dictionary.plugin as plugin
def test_plugin():
pass | cmuphillycapstone/ckanext-dictionary | ckanext/dictionary/tests/test_plugin.py | Python | agpl-3.0 | 98 | 0.020408 |
#!/usr/bin/env python3
# What directories are needed to run an app?
# Use strace to find out. Potentially useful for setting up chroots.
# Usage: dirsneeded.py cmd [arg arg ...]
'''
TODO:
> o for anything where access attempt is made in chroot and fails,
> at least by default, only consider it something to pos... | akkana/scripts | dirsneeded.py | Python | gpl-2.0 | 4,269 | 0.001171 |
from direction import Direction, Pivot
XMovement = {
Direction.left: -1,
Direction.up: 0,
Direction.right: 1,
Direction.down: 0,
Direction.up_left: -1,
Direction.up_right: 1,
Direction.down_left: -1,
Direction.down_right: 1
}
YMovement = {
Direction.left: 0,
Direction.up: -1,
... | somebody1234/Charcoal | directiondictionaries.py | Python | mit | 2,433 | 0 |
import os.path
import json
class Tag:
def __init__(self, tag, title, icon):
self.tag = tag
self.title = title
self.icon = icon
class SiteConfig:
def __init__(self, site_dir):
self.site_dir = site_dir
config_file_name = os.path.join(self.site_dir, "config.js")
if not os.path.exists(confi... | andrewstephens75/gensite | gensite/siteconfig.py | Python | mit | 1,317 | 0.012908 |
"""
Test APIs.
"""
import json
import pytest
from mock import patch
from coursera import api
from coursera.test.utils import slurp_fixture
@pytest.fixture
def course():
course = api.CourseraOnDemand(session=None, course_id='0')
return course
@patch('coursera.api.get_page_json')
def test_ondemand_programm... | iemejia/coursera-dl | coursera/test/test_api.py | Python | lgpl-3.0 | 4,808 | 0.003536 |
#-------------------------------------------------------------------------
# The Azure Batch Apps Python Client
#
# Copyright (c) Microsoft Corporation. All rights reserved.
#
# The MIT License (MIT)
#
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated docu... | Azure/azure-batch-apps-python | batchapps/test/unittest_pool.py | Python | mit | 7,440 | 0.007124 |
"""Numeric integration of data coming from a source sensor over time."""
from decimal import Decimal, DecimalException
import logging
import voluptuous as vol
from homeassistant.components.sensor import PLATFORM_SCHEMA
from homeassistant.const import (
ATTR_UNIT_OF_MEASUREMENT,
CONF_NAME,
STATE_UNAVAILABL... | titilambert/home-assistant | homeassistant/components/integration/sensor.py | Python | apache-2.0 | 6,827 | 0.000586 |
"""
Test that we work properly with classes with the trivial_abi attribute
"""
import lldb
from lldbsuite.test.decorators import *
from lldbsuite.test.lldbtest import *
from lldbsuite.test import lldbutil
class TestTrivialABI(TestBase):
mydir = TestBase.compute_mydir(__file__)
NO_DEBUG_INFO_TESTCASE = Tru... | endlessm/chromium-browser | third_party/llvm/lldb/test/API/lang/cpp/trivial_abi/TestTrivialABI.py | Python | bsd-3-clause | 2,923 | 0.004105 |
#!/usr/bin/env python
# tests the standard library of math functions
import unittest
import math
import cmath
import string
import commands
import types
import testbase
import absyn
import codegen
import fractparser
import fractlexer
import fsymbol
import translate
class Test(testbase.TestBase):
def setUp(self... | ericchill/gnofract4d | fract4d/test_stdlib.py | Python | bsd-3-clause | 14,992 | 0.014141 |
import nltk
import json
import sys
sys.path.append("../../")
import parser
from entity import Word
class ModelRewriter:
rewriteRules = None
rewriteRuleFileName = "model.txt"
@staticmethod
def loadModel():
inputFile = open("model.txt")
modelJsonString = inputFile.read()
inputF... | cuijiaxing/nlp | rewriter/rules/rewrite_rule/generator.py | Python | gpl-2.0 | 4,155 | 0.004091 |
# ===============================================================================
# Copyright 2011 Jake Ross
#
# 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/licens... | UManPychron/pychron | pychron/hardware/gauges/mks/__init__.py | Python | apache-2.0 | 788 | 0.001269 |
#!/usr/bin/python
from __future__ import (absolute_import, division, print_function)
# Copyright 2019 Fortinet, Inc.
#
# 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 Lic... | amenonsen/ansible | lib/ansible/modules/network/fortios/fortios_firewall_vip6.py | Python | gpl-3.0 | 46,189 | 0.002728 |
# -*- coding: utf-8 -*-
# Generated by Django 1.10.2 on 2017-11-21 18:16
from __future__ import unicode_literals
from django.conf import settings
from django.db import migrations, models
import django.db.models.deletion
class Migration(migrations.Migration):
dependencies = [
migrations.swappable_depende... | ByrdOfAFeather/AlphaTrion | Community/migrations/0034_auto_20171121_1316.py | Python | mit | 1,619 | 0.003706 |
# Copyright 2014 Cisco Systems, 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 requir... | nash-x/hws | neutron/db/vpn/vpn_validator.py | Python | apache-2.0 | 4,980 | 0.000602 |
#!/usr/bin/python
#coding=utf-8
'''
@author: sheng
@license:
'''
SPELL=u'láogōng'
CN=u'劳宫'
NAME=u'laogong21'
CHANNEL='pericardium'
CHANNEL_FULLNAME='PericardiumChannelofHand-Jueyin'
SEQ='PC8'
if __name__ == '__main__':
pass
| sinotradition/meridian | meridian/acupoints/laogong21.py | Python | apache-2.0 | 241 | 0.034043 |
#!/usr/bin/env python
'''
Oct 10, 2017: Pasi Korhonen, The University of Melbourne
Simplifies system calls, logs and pipe interaction.
'''
import sys, os, time #, ConfigParser
import shlex, subprocess, errno
from threading import Timer
###############################################################################
... | vetscience/Tools | Utils/base.py | Python | bsd-3-clause | 7,040 | 0.014773 |
#!/usr/bin/python2.7
# Copyright 2015 Google Inc.
#
# 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 ... | AwesomeTurtle/personfinder | app/add_note.py | Python | apache-2.0 | 7,586 | 0.000791 |
import copy
import confu.schema
import vaping
import vaping.config
import vaping.io
from vaping.plugins import PluginConfigSchema
try:
import vodka
import vodka.data
except ImportError:
pass
try:
import graphsrv
import graphsrv.group
except ImportError:
graphsrv = None
def probe_to_graphsr... | 20c/vaping | src/vaping/plugins/vodka.py | Python | apache-2.0 | 3,075 | 0.000325 |
# urllib3/util.py
# Copyright 2008-2013 Andrey Petrov and contributors (see CONTRIBUTORS.txt)
#
# This module is part of urllib3 and is released under
# the MIT License: http://www.opensource.org/licenses/mit-license.php
from base64 import b64encode
from collections import namedtuple
from socket import error as Socke... | mattesno1/Sick-Beard | lib/requests/packages/urllib3/util.py | Python | gpl-3.0 | 11,326 | 0.000618 |
#------------------------------------------------------------------------------
# bind_sdo.py (Section 4.4)
#------------------------------------------------------------------------------
#------------------------------------------------------------------------------
# Copyright 2017, 2018, Oracle and/or its affiliate... | kawamon/hue | desktop/core/ext-py/cx_Oracle-6.4.1/samples/tutorial/solutions/bind_sdo.py | Python | apache-2.0 | 2,694 | 0.003712 |
# Copyright 2017 The TensorFlow Authors. 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 applica... | tensorflow/tensorflow | tensorflow/python/debug/lib/common.py | Python | apache-2.0 | 2,967 | 0.004382 |
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
from gtp import gtp
from Tkinter import *
from toolbox import *
from toolbox import _
def get_full_sequence_threaded(worker,current_color,deepness):
sequence=get_full_sequence(worker,current_color,deepness)
threading.current_thread().sequence=sequence
... | pnprog/goreviewpartner | gnugo_analysis.py | Python | gpl-3.0 | 13,115 | 0.060465 |
import signal
import subprocess
import sys
from pathlib import Path
from unittest import TestCase, skipIf
from django.test import tag
from inloop.testrunner.runner import DockerTestRunner, collect_files
BASE_DIR = Path(__file__).resolve().parent
DATA_DIR = str(BASE_DIR.joinpath("data"))
class CollectorTest(TestCas... | st-tu-dresden/inloop | tests/testrunner/tests.py | Python | gpl-3.0 | 6,974 | 0.002156 |
# Copyright (C) 2018 Red Hat, 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 applicable ... | mahak/nova | nova/tests/functional/libvirt/base.py | Python | apache-2.0 | 14,789 | 0.000135 |
"""OAuth 2.0 WSGI server middleware providing MyProxy certificates as access tokens
"""
__author__ = "W van Engen"
__date__ = "01/11/12"
__copyright__ = "(C) 2011 FOM / Nikhef"
__license__ = "BSD - see LICENSE file in top-level directory"
__contact__ = "wvengen+oauth2@nikhef.nl"
__revision__ = "$Id$"
from base64 impor... | cedadev/ndg_oauth | ndg_oauth_server/ndg/oauth/server/lib/authenticate/password_authenticator.py | Python | bsd-3-clause | 2,193 | 0.006384 |
import sys
from setuptools import setup, find_packages
package_name = "sqlalchemy_dict"
py_version = sys.version_info[:2]
def read_version(module_name):
from re import match, S
from os.path import join, dirname
f = open(join(dirname(__file__), module_name, "__init__.py"))
return match(r".*__versio... | meyt/sqlalchemy-dict | setup.py | Python | mit | 1,268 | 0 |
#!/usr/bin/env python3.5
# -*- coding: utf-8 -*-
# Author: ChenLiang
# 执行系统命令
import os
os.system("ls -al")
os.mkdir("pwd")
read = os.popen("df -hT").read()
# 查看系统路径
import sys
print(sys.path)
# 命令行下tab补全命令
# For MAC:
import sys
import readline
import rlcompleter
if sys.platform == 'darwin' and sys.version_info[0... | smartczm/python-learn | Old-day01-10/s13-day1/system.py | Python | gpl-2.0 | 1,313 | 0.012573 |
from distutils import spawn
import mock
import pytest
import requests
from pyepm import config as c
config = c.get_default_config()
has_solc = spawn.find_executable("solc")
solc = pytest.mark.skipif(not has_solc, reason="solc compiler not found")
COW_ADDRESS = '0xcd2a3d9f938e13cd947ec05abc7fe734df8dd826'
def is_h... | etherex/pyepm | test/helpers.py | Python | mit | 931 | 0.003222 |
"""Testing code for the tupa.features package, unit-testing only."""
import os
from collections import OrderedDict
import pytest
from ucca import textutil
from tupa.action import Actions
from tupa.features.dense_features import DenseFeatureExtractor
from tupa.features.sparse_features import SparseFeatureExtractor
fro... | danielhers/tupa | tests/test_features.py | Python | gpl-3.0 | 5,494 | 0.003276 |
import greengraph
if __name__ == '__main__':
from matplotlib import pyplot as plt
mygraph = greengraph.Greengraph('New York','Chicago')
data = mygraph.green_between(20)
plt.plot(data)
plt.show()
| padraic-padraic/MPHYSG001_CW1 | example.py | Python | gpl-2.0 | 216 | 0.00463 |
class Person:
def __init__(self):
self.name = 'jeff'
self.age = 10
p = Person()
print(p.__dict__)
| mikeckennedy/python-data-driven-nov9 | playground/classdict.py | Python | gpl-3.0 | 121 | 0.008264 |
"""
Copyright (c) 2017 SONATA-NFV and Paderborn University
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... | stevenvanrossem/son-emu | src/emuvim/api/openstack/openstack_dummies/neutron_dummy_api.py | Python | apache-2.0 | 44,105 | 0.002993 |
'''
Functions for working with DESI mocks and fiberassignment
TODO (maybe):
This contains hardcoded hacks, especially wrt priorities and
interpretation of object types
'''
from __future__ import print_function, division
import sys, os
import numpy as np
from astropy.table import Table, Column
from fiberassign import... | desihub/fiberassign | old/py/mock.py | Python | bsd-3-clause | 3,161 | 0.008858 |
"""
Python script "setup.py"
by Matthew Garcia, PhD student
Dept. of Forest and Wildlife Ecology
University of Wisconsin - Madison
matt.e.garcia@gmail.com
Copyright (C) 2015-2016 by Matthew Garcia
Licensed Gnu GPL v3; see 'LICENSE_GnuGPLv3.txt' for complete terms
Send questions, bug reports, any related requests to ma... | megarcia/WxCD | setup.py | Python | gpl-3.0 | 18,007 | 0 |
from test_support import *
do_flow(opt=["-u", "indefinite_bounded.adb"])
| ptroja/spark2014 | testsuite/gnatprove/tests/NB19-026__flow_formal_vectors/test.py | Python | gpl-3.0 | 73 | 0 |
import os
from unittest import TestCase
from unittest.mock import patch
from bs4 import BeautifulSoup
from RatS.criticker.criticker_ratings_inserter import CritickerRatingsInserter
TESTDATA_PATH = os.path.abspath(
os.path.join(os.path.dirname(__file__), os.pardir, os.pardir, "assets")
)
class CritickerRatingsI... | StegSchreck/RatS | tests/unit/criticker/test_criticker_ratings_inserter.py | Python | agpl-3.0 | 9,321 | 0.001609 |
from openerp.modules.registry import RegistryManager
from openerp.netsvc import Service
from osv import fields, osv
from osv.orm import MetaModel
from reimport import reimport
class module(osv.osv):
_inherit = "ir.module.module"
def button_reload(self, cr, uid, ids, context=None):
for module_record i... | silvau/Addons_Odoo | module_reload/module.py | Python | gpl-2.0 | 1,349 | 0.008154 |
# -*- Mode: Python; py-indent-offset: 4 -*-
# pygobject - Python bindings for the GObject library
# Copyright (C) 2006-2007 Johan Dahlin
#
# gobject/constants.py: GObject type constants
#
# This library is free software; you can redistribute it and/or
# modify it under the terms of the GNU Lesser General Public
# Lic... | Alberto-Beralix/Beralix | i386-squashfs-root/usr/share/pyshared/gi/_gobject/constants.py | Python | gpl-3.0 | 3,114 | 0.000321 |
# -*- coding: utf-8 -*-
###############################################################################
#
# Copyright (C) 2001-2014 Micronaet SRL (<http://www.micronaet.it>).
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU Affero General Public License a... | Micronaet/micronaet-mx8 | sale_delivery_partial_B/__init__.py | Python | agpl-3.0 | 1,040 | 0 |
import os
import logging
from werkzeug.exceptions import BadRequest, NotFound
from flask import Blueprint, redirect, send_file, request
from apikit import jsonify, Pager, get_limit, get_offset, request_data
from aleph.core import archive, url_for, db
from aleph.model import Document, Entity, Reference, Collection
from... | smmbllsm/aleph | aleph/views/documents_api.py | Python | mit | 5,217 | 0.000192 |
from pyramid.config import Configurator
from pyramid.renderers import JSONP
def main(global_config, **settings):
""" This function returns a Pyramid WSGI application.
"""
config = Configurator(settings=settings)
config.add_renderer('jsonp', JSONP(param_name='callback'))
config.include('pyramid_mako... | SevereOverfl0w/Krympa | krympa/__init__.py | Python | mit | 597 | 0.001675 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.