code stringlengths 3 1.05M | repo_name stringlengths 5 104 | path stringlengths 4 251 | language stringclasses 1
value | license stringclasses 15
values | size int64 3 1.05M |
|---|---|---|---|---|---|
from regraph.library.data_structures import (TypedGraph,
TypedDiGraph,
Homomorphism)
from regraph.library.primitives import (merge_attributes)
from regraph.library.utils import keys_by_value
def pullback(h1, h2):
""" Given h... | eugeniashurko/ReGraph | regraph/library/category_op.py | Python | mit | 11,395 |
from .base import BaseResult
class PublishBodyResult(BaseResult):
def set_result(self, result):
super().set_result(result)
@property
def publication_id(self):
return self._result['publicationID']
@property
def publicationID(self):
"""
synonym
"""
r... | ta2xeo/python3-kii | kii/results/publishbody.py | Python | mit | 415 |
from flask import Blueprint, render_template
import logging
logr = logging.getLogger('gimphub.blueprint_static')
static_B = Blueprint('static', __name__)
@static_B.route('/terms', methods = ['GET'])
def terms():
return render_template('terms.html')
@static_B.route('/privacy', methods = ['GET'])
def privacy... | Jolopy/GimpHub | app/blueprint_static.py | Python | gpl-2.0 | 635 |
import logging
import ckan.plugins as p
from ckanext.archiver.model import Archival
from ckanext.qa.model import QA, aggregate_qa_for_a_dataset
log = logging.getLogger(__name__)
_ = p.toolkit._
@p.toolkit.side_effect_free
def qa_resource_show(context, data_dict):
'''
Returns the QA and Archival information ... | ckan/ckanext-qa | ckanext/qa/logic/action.py | Python | mit | 1,625 |
# -*- coding: utf-8 -*-
__version__ = '1.0.2'
| 596acres/django-livinglots-forms | livinglots_forms/__init__.py | Python | agpl-3.0 | 46 |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
# Copyright (c) 2009-2011, Nicolas Clairon
# 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 abov... | MobicoTIC/MongoLite | mongolite/mongo_exceptions.py | Python | bsd-3-clause | 2,399 |
# coding=utf-8
from flask.ext.restplus import Resource
from flask import request, Response
from app import api
from utils.wordeater_api import ApiResponse
from cerberus import Validator
from config import API_PATH, ENVELOPE_DATA
from services.service_locator import ServiceLocator
from decorators.authenticate import ... | h-qub/wordeater-web | we-web/api/resources/pictures/pictures.py | Python | mit | 2,290 |
"""
This config file runs the simplest dev environment"""
# We intentionally define lots of variables that aren't used, and
# want to import all variables from base settings files
# pylint: disable=W0401, W0614
from .common import *
from logsettings import get_logger_config
DEBUG = True
USE_I18N = True
# For display... | apigee/edx-platform | cms/envs/dev.py | Python | agpl-3.0 | 6,700 |
"""
Utility functions for reading MITgcm mds files (.meta / .data)
"""
# python 3 compatiblity
from __future__ import print_function, division
import re
import os
import numpy as np
import warnings
from functools import reduce
from dask import delayed
import dask.array as dsa
from dask.base import tokenize
import xarr... | xgcm/xmitgcm | xmitgcm/utils.py | Python | mit | 66,760 |
# Copyright (C) 2014 Andrey Antukh <niwi@niwi.be>
# Copyright (C) 2014 Jesús Espino <jespinog@gmail.com>
# Copyright (C) 2014 David Barragán <bameda@dbarragan.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 F... | WALR/taiga-back | taiga/projects/services/bulk_update_order.py | Python | agpl-3.0 | 5,428 |
from sys import argv
script, filename = argv
txt = open(filename)
print('Here\'s your file %r:' % filename)
print(txt.read())
print('Type the filename again:')
file_again = input('>')
txt_again = open(file_again)
print(txt_again.read()) | johnwang117/learn-python-the-hard-way | ex15.py | Python | gpl-3.0 | 242 |
def test_azure_template(check_cli_success, azure_config_path):
info, desc = check_cli_success(azure_config_path)
def test_azure_template_with_helper(check_cli_success, azure_with_helper_config_path):
info, desc = check_cli_success(azure_with_helper_config_path)
| dcos/dcos-launch | test/test_arm.py | Python | apache-2.0 | 272 |
# 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
# "License"); you may not u... | mlperf/training_results_v0.7 | Fujitsu/benchmarks/resnet/implementations/implementation_open/mxnet/3rdparty/tvm/vta/apps/tsim_example/python/tsim.py | Python | apache-2.0 | 1,886 |
# -*- coding: utf-8; -*-
#
# This file is part of Superdesk.
#
# Copyright 2013, 2014 Sourcefabric z.u. and contributors.
#
# For the full copyright and license information, please see the
# AUTHORS and LICENSE files distributed with this source code, or
# at https://www.sourcefabric.org/superdesk/license
import os
... | nistormihai/superdesk-core | apps/io/formatted_email_test.py | Python | agpl-3.0 | 2,980 |
#!/usr/bin/python3
import sys
import json
from selenium import webdriver
from selenium.webdriver.common.by import By
from selenium.webdriver.common.keys import Keys
from selenium.webdriver.support import expected_conditions as EC
from selenium.webdriver.support.ui import WebDriverWait
TIMEOUT = 5
DEBUG = False
if DEB... | koss822/misc | Python/yahoo-scraper/app/scraper.py | Python | gpl-3.0 | 2,857 |
from init import *
| treverhines/ModEst | modest/pymls/__init__.py | Python | mit | 19 |
from datetime import date
from django.conf import settings
from django.contrib import messages
from django.contrib.auth.decorators import permission_required
from django.db.models import Q
from django.http import JsonResponse
from django.shortcuts import get_object_or_404, redirect, reverse
from django.template.respon... | UITools/saleor | saleor/dashboard/product/views.py | Python | bsd-3-clause | 25,822 |
# Copyright 2016 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... | tongwang01/tensorflow | tensorflow/contrib/bayesflow/examples/reinforce_simple/reinforce_simple_example.py | Python | apache-2.0 | 5,012 |
from setuptools import find_packages, setup
version='0.1.2'
setup(
name='Trac2mite',
version=version,
description="Trac2mite connects your Trac account with your mite.account. Track your time easily on issues within Trac (requires 'TracHoursPlugin') and get them automatically send to mite.",
packages=find_packag... | thomasklein/Trac2mite | 0.11/setup.py | Python | mit | 1,034 |
# Copyright (C) 2013 Google Inc., authors, and contributors <see AUTHORS file>
# Licensed under http://www.apache.org/licenses/LICENSE-2.0 <see LICENSE file>
# Created By: dan@reciprocitylabs.com
# Maintained By: dan@reciprocitylabs.com
| prasannav7/ggrc-core | test/integration/ggrc/behave/__init__.py | Python | apache-2.0 | 238 |
# Licensed to the StackStorm, Inc ('StackStorm') 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 "License"); you may not use th... | pinterb/st2 | st2common/st2common/logging/handlers.py | Python | apache-2.0 | 2,387 |
import numpy as numpy
# This function allows the code to compute numerical values for mathematical functions given as "String".
def f(x, s):
return eval(s)
# Function should return Energy Eigenvalue via "Shooting Method"
def findE(E0, Ef, tol, N, dx, f_string):
# Since we know an eigenvalue exists between E0 and Ef... | KalterTod/S-EqSolver | EqSolver.py | Python | mit | 1,444 |
# Copyright 2015 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.
"""RPC compatible subprocess-type module.
This module defined both a task-side process class as well as a controller-side
process wrapper for easier access ... | Teamxrtc/webrtc-streaming-node | third_party/webrtc/src/chromium/src/testing/legion/process.py | Python | mit | 8,760 |
import pytest
from cli_config.script import script
from utility.nix_error import NixError
def test_script_rename_no_script(capsys):
with pytest.raises(SystemExit) as _excinfo:
script.script("nixconfig", ["rename"])
_out, _err = capsys.readouterr()
assert _excinfo.value.code is 2, "Incorrect exi... | mbiciunas/nix | test/cli_config/script/test_script_rename.py | Python | gpl-3.0 | 2,951 |
# Copyright 2010 United States Government as represented by the
# Administrator of the National Aeronautics and Space Administration.
# 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 ... | NetApp/manila | manila/test.py | Python | apache-2.0 | 12,603 |
#!/usr/bin/env python
# encoding: utf-8
from RedBlackTree import RedBlackTree
import random
"""
TP2.py
Coéquipiers :
Tristan Savaria
"""
def main(n):
living = n
starting_gold = 1000000
RBPosition = RedBlackTree()
RBGold = RedBlackTree()
#Set up and initial turn
for x in range(living):
post = 0 + random.... | Tri125/IFT-2015-TP3 | TP3.py | Python | bsd-3-clause | 1,876 |
"""Tests for Transmission config flow."""
from datetime import timedelta
import pytest
from transmissionrpc.error import TransmissionError
from homeassistant import data_entry_flow
from homeassistant.components import transmission
from homeassistant.components.transmission import config_flow
from homeassistant.compon... | nkgilley/home-assistant | tests/components/transmission/test_config_flow.py | Python | apache-2.0 | 8,440 |
import datetime
import pyclassifiers.values
import config.general
project_github_username = 'veltzer'
project_name = 'pysigfd'
github_repo_name = project_name
project_website = 'https://{project_github_username}.github.io/{project_name}'.format(**locals())
project_website_source = 'https://github.com/{project_github_u... | veltzer/python-sigfd | config/project.py | Python | gpl-3.0 | 3,406 |
#! /usr/bin/env python
# $Id: test_dependencies.py 5720 2008-10-31 17:50:17Z goodger $
# Author: Lea Wiemann <LeWiemann@gmail.com>
# Copyright: This module has been placed in the public domain.
"""
Test module for the --record-dependencies option.
"""
import os.path
import unittest
import sys
import DocutilsTestSupp... | spreeker/democracygame | external_apps/docutils-snapshot/test/test_dependencies.py | Python | bsd-3-clause | 3,443 |
import binascii
import ipaddress
import os
import sys
from collections import deque
from itertools import islice
APP_KEY = "aiohttp_debugtoolbar"
TEMPLATE_KEY = "aiohttp_debugtoolbar_jinja2"
REDIRECT_CODES = (300, 301, 302, 303, 305, 307, 308)
STATIC_PATH = "static/"
ROOT_ROUTE_NAME = "debugtoolbar.main"
STATIC_ROUTE... | aio-libs/aiohttp-debugtoolbar | aiohttp_debugtoolbar/utils.py | Python | apache-2.0 | 6,867 |
# Spawn Area file created with PSWG Planetary Spawn Tool
import sys
from java.util import Vector
def addSpawnArea(core):
dynamicGroups = Vector()
dynamicGroups.add('dathomir_bolma')
dynamicGroups.add('dathomir_purbole')
dynamicGroups.add('dathomir_rancor')
dynamicGroups.add('dathomir_rhoa')
core.spawnService.add... | agry/NGECore2 | scripts/mobiles/spawnareas/dathomir_nw_1.py | Python | lgpl-3.0 | 391 |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
'''
This tools is used to read a tab seperated file and format it into a table
@author: Hoang Duc Chinh <dc.hoang.vn@gmail.com>
'''
# Copyright (c) 2015, Hoang Duc Chinh <dc.hoang.vn@gmail.com>
#
#Permission is hereby granted, free of charge, to any person obtaining a co... | dakside/pydemo | file_handling/beautiful_csv.py | Python | mit | 7,423 |
"""Thin wrapper around Werkzeug because Flask and Bottle
do not play nicely with async uwsgi"""
import json
from werkzeug.wrappers import Request, Response
from werkzeug.routing import Map, Rule
from werkzeug.exceptions import HTTPException, NotFound
from werkzeug.utils import redirect
from covador import ValidationD... | guilhermedallanol/dotfiles | vim/plugged/vial-http/server/dswf.py | Python | mit | 2,837 |
import numpy
from Orange.classification import Learner, Model
from Orange.data import ContinuousVariable
from Orange.statistics import distribution
__all__ = ["MeanLearner"]
class MeanLearner(Learner):
"""
Fit a regression model that returns the average response (class) value.
"""
name = 'mean'
... | qusp/orange3 | Orange/regression/mean.py | Python | bsd-2-clause | 2,474 |
#! /usr/bin/env python
# ==========================================================================
# This Python script creates the node section of the NodeFunction using
# logarithmically spaced energy bins. The intensity scale is set to the
# HESS Crab intensity (assuming a power law).
#
# Copyright (C) 2012-2016 Ju... | ctools/ctools | test/dev/cta_make_nodes.py | Python | gpl-3.0 | 3,101 |
#
# expression.py - Verilog expression parser data types
#
# Verilib - A Verilog HDL development framework
# Copyright (c) 2014, Patrick Dear, All rights reserved.
#
# This library is free software; you can redistribute it and/or
# modify it under the terms of the GNU Lesser General Public
# License as published by the... | pdear/verilib | pytools/vlparse/types/expression.py | Python | lgpl-3.0 | 6,414 |
#!/usr/bin/python
import os,urllib2
os.system('clear')
def title():
print '''
-- UrduSecurity Free Tools Library --
-- Tool: %s --
-- Visit: %s --
-- Author: %s --
-- Release: %s --
UrduSecurity - a Vally of Knowledge\n\n'''%(__Script__,__visit__,__Author__,__Release__)
# define variables
__visit__ = "htt... | Chaudhary-Adeel/UrduSecurityFreeTools | HTTPHeaderInjectory.py | Python | gpl-2.0 | 1,665 |
import webapp2
import models
class PrefsPage(webapp2.RequestHandler):
def post(self):
userprefs = models.get_userprefs()
try:
tz_offset = int(self.request.get('tz_offset'))
userprefs.tz_offset = tz_offset
userprefs.put()
except ValueError:
# ... | jscontreras/learning-gae | pgae-examples-master/2e/python/clock/clock4/prefs.py | Python | lgpl-3.0 | 541 |
##############################################################################
#
# 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 ... | uclouvain/osis | education_group/views/training/common_read.py | Python | agpl-3.0 | 20,155 |
# Copyright (c) LinkedIn Corporation. All rights reserved. Licensed under the BSD-2 Clause license.
# See LICENSE in the project root for license information.
from iris.custom_import import import_custom_module
import logging
logger = logging.getLogger(__name__)
class IrisRoleLookupException(Exception):
pass
d... | dwang159/iris-api | src/iris/role_lookup/__init__.py | Python | bsd-2-clause | 863 |
# -*- coding: utf-8 -*-
# Copyright (c) 2010-2017 Tuukka Turto
#
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the "Software"), to deal
# in the Software without restriction, including without limitation the rights
# to use, copy,... | tuturto/pyherc | src/herculeum/ui/text/config.py | Python | mit | 2,158 |
# Copyright (c) 2013 Mirantis, 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... | istalker2/yaql | yaql/functions/__init__.py | Python | apache-2.0 | 613 |
class Node(object):
def __init__(self, tag, value, start_mark, end_mark):
self.tag = tag
self.value = value
self.start_mark = start_mark
self.end_mark = end_mark
def __repr__(self):
value = self.value
#if isinstance(value, list):
# if len(val... | croxis/SpaceDrive | spacedrive/renderpipeline/rplibs/yaml/yaml_py3/nodes.py | Python | mit | 1,489 |
# browsershots.org - Test your web design in different browsers
# Copyright (C) 2007 Johann C. Rocholl <johann@browsershots.org>
#
# Browsershots 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 ... | skerit/shotfactory | shotfactory04/gui/windows/msie.py | Python | gpl-3.0 | 4,589 |
#!/usr/bin/env python2.7
from django.core.management import execute_manager
try:
import settings # Assumed to be in the same directory.
except ImportError:
import sys
sys.stderr.write("Error: Can't find the file 'settings.py' in the directory containing %r. It appears you've customized things.\nYou'll have ... | haroldl/homeworklog | manage.py | Python | bsd-3-clause | 549 |
from .aliquot_admin import AliquotAdmin
from .box_admin import BoxAdmin
from .box_item_admin import BoxItemAdmin
from .box_type_admin import BoxTypeAdmin
from .consignee_admin import ConsigneeAdmin
from .fieldsets import (
requisition_fieldset,
requisition_identifier_fields,
requisition_status_fields,
r... | botswana-harvard/edc-lab | edc_lab/admin/__init__.py | Python | gpl-2.0 | 762 |
from twisted.internet import defer
from tint.log import Logger
from tint.storage.addressing import Path
class NotAuthorizedError(Exception):
"""
Someone is trying to access something they can't.
"""
class DefaultPermissions(object):
def __init__(self, storage):
self.storage = storage
... | 8468/tint | tint/storage/permissions.py | Python | mit | 3,253 |
#!/usr/bin/env python
import unittest
from sqlbuilder import smartsql
from ascetic import exceptions, validators
from ascetic.databases import databases
from ascetic.mappers import Mapper, mapper_registry
from ascetic.relations import ForeignKey
Author = Book = None
class TestMapper(unittest.TestCase):
maxDif... | emacsway/ascetic | ascetic/tests/test_mappers.py | Python | mit | 11,813 |
import time
from azure.storage import AccessPolicy
from azure.storage.blob import BlockBlobService, ContentSettings, ContainerPermissions
from datetime import datetime, timedelta
# The name of the new Shared Access policy
policy_name = 'readandlistonly'
# The Storage Account Name
storage_account_name = 'mystore'
sto... | Azure-Samples/hdinsight-dotnet-python-azure-storage-shared-access-signature | Python/SASToken.py | Python | mit | 1,714 |
###############################################################################
##
## Copyright (C) 2006-2011, University of Utah.
## All rights reserved.
## Contact: contact@vistrails.org
##
## This file is part of VisTrails.
##
## "Redistribution and use in source and binary forms, with or without
## modification, ... | CMUSV-VisTrails/WorkflowRecommendation | vistrails/packages/controlflow/list_module.py | Python | bsd-3-clause | 2,364 |
from __future__ import absolute_import, division, print_function, unicode_literals
import unittest
from itertools import chain
from mock import Mock, sentinel
from nose.tools import eq_, raises
from six.moves import xrange
from smarkets.signal import Signal
class SignalTest(unittest.TestCase):
"Test the `smar... | smarkets/smk_python_sdk | smarkets/tests/signal.py | Python | mit | 4,449 |
# -*- coding: utf-8 -*-
##############################################################################
#
# Copyright (c) 2011 Camptocamp SA (http://www.camptocamp.com)
# All Right Reserved
#
# Author : Joel Grand-guillaume (Camptocamp)
#
# WARNING: This program as such is intended to be used by professional
# programm... | avanzosc/avanzosc6.1 | project_department/__init__.py | Python | agpl-3.0 | 1,414 |
import datetime
import logging
import textwrap
import time
import click
import hatarake
import hatarake.net as requests
from hatarake.config import Config
logger = logging.getLogger(__name__)
@click.group()
@click.option('-v', '--verbosity', count=True)
def main(verbosity):
logging.basicConfig(level=logging.WA... | kfdm/hatarake | hatarake/cli.py | Python | mit | 4,255 |
from flask import Blueprint, url_for
core = Blueprint('core', __name__)
from . import filters
| MrLeeh/flaskhab | app/core/__init__.py | Python | mit | 94 |
#!/usr/bin/env python
##################################################
# Gnuradio Python Flow Graph
# Title: Radio Impairments Model
# Author: mettus
# Generated: Thu Aug 1 12:46:10 2013
##################################################
from __future__ import absolute_import
from __future__ import division
from __... | jdemel/gnuradio | gr-channels/python/channels/impairments.py | Python | gpl-3.0 | 4,926 |
def fib(n):
if n < 2:
return n
else:
return fib(n-1) + fib(n-2)
def fib_fast(n):
from math import sqrt
s5 = sqrt(5)
x = (1 + s5) ** n
y = (1 - s5) ** n
return int((x - y)/(s5 * 2**n))
def print_fib(n):
for i in range(n):
print fib(i),
print
for i i... | familug/FAMILUG | Python/fibs.py | Python | bsd-2-clause | 668 |
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
("migrations", "0001_initial"),
]
operations = [
migrations.DeleteModel("Tribble"),
migrations.RemoveField("Author", "silly_field"),
migrations.AddField("Author", "rating",... | beckastar/django | tests/migrations/test_migrations/0002_second.py | Python | bsd-3-clause | 592 |
# -*- coding: utf-8 -*-
#
# Avendesora documentation build configuration file, created by
# sphinx-quickstart on Mon Jun 12 12:01:56 2017.
#
# 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
# autogenerated file.
#
# ... | KenKundert/avendesora | doc/conf.py | Python | gpl-3.0 | 8,400 |
"""
A PyGraphQT timetrace plot figure with a slider to scroll the time axis
back and forth.
Adapted from:
http://stackoverflow.com/questions/16824718/python-matplotlib-pyside-fast-timetrace-scrolling
"""
from PySide import QtGui, QtCore
import numpy as np
import pyqtgraph as pg
N_SAMPLES = 1e6
def test_plot():
... | chungjjang80/FRETBursts | fretbursts/utils/examples/timetrace_scroll_pygraphqt.py | Python | gpl-2.0 | 3,476 |
# -*- coding: utf-8 -*-
# Generated by Django 1.11 on 2017-04-11 06:56
from __future__ import unicode_literals
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('ims_app', '0007_auto_20170411_1228'),
]
operations = [
migrations.AlterField(... | FarhadurFahim/ims | ims_app/migrations/0008_auto_20170411_1256.py | Python | mit | 447 |
from django.http import HttpResponseBadRequest, HttpResponse
from ..simplified import PermissionDenied, SimplifiedException, InvalidUsername
from restview import RestfulView, extjswrap
from serializers import (serializers, SerializableResult,
ErrorMsgSerializableResult,
... | vegarang/devilry-django | devilry/restful/modelrestview.py | Python | bsd-3-clause | 11,188 |
"""
Run the .travis.yml file
"""
import yaml
import subprocess
import sys
__version__ = '0.0.1'
def run_scripts(travis, stage):
"""
Given an travis configuration and a stage, run its scripts if any
"""
stage_scripts = travis.get(stage, [])
success = True
for script in stage_scripts:
s... | jmullan/pytravis | pytravis/pytravis.py | Python | gpl-3.0 | 1,904 |
"""Module for the custom Django sampledata command."""
import csv
import random
from django.core import management
from django.conf import settings
from django.contrib.auth import get_user_model
from django.contrib.gis.geos import Point
from allauth.account.models import EmailAddress
from resources.models import (
... | uccser/cs4teachers | dthm4kaiako/general/management/commands/sampledata.py | Python | mit | 7,305 |
from django.core.management.base import BaseCommand
from django.conf import settings
from django.db import connection
from collections import defaultdict
import os
from datetime import datetime, timedelta
from common.utils import Date
from schools.models import (
School, Boundary)
from stories.models import (
... | klpdotorg/dubdubdub | apps/stories/management/commands/generate_sms_report.py | Python | mit | 17,179 |
#!/usr/bin/python
# Copyright (c) 2015 IBM
# GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt)
from __future__ import absolute_import, division, print_function
__metaclass__ = type
ANSIBLE_METADATA = {'metadata_version': '1.1',
'status': ['preview'],
... | noroutine/ansible | lib/ansible/modules/cloud/openstack/os_flavor_facts.py | Python | gpl-3.0 | 7,373 |
#
# 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
# "License"); you may not... | wooga/airflow | airflow/example_dags/example_bash_operator.py | Python | apache-2.0 | 2,042 |
#!/usr/bin/env python
# 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 distributed in... | idoerg/cafa-format-check | cafa_hpo_format_checker.py | Python | gpl-3.0 | 9,287 |
#!/usr/bin/env python
# -*- encoding: utf-8
import csv
import gzip
from collections import defaultdict
from ec_settings import POS, NEG
class CorpusReader(object):
def _csv_to_dict(self, fn):
"""
Read in the contents of a CSV file and place the contents
in a dict of dicts.
The ... | wojtekwalczak/EmoClassifier | src/corpus_reader.py | Python | mit | 1,285 |
# -*- coding: utf-8 -*-
"""Helper functions for libComXml
"""
__all__ = ['codi_periode', 'codi_dh', 'extreu_periode', 'rodes',
'codi_refact', 'nom_refact', 'codi_reg_refact', 'nom_reg_refact',
'parse_totals_refact']
CODIS_REFACT = {'RT42011': '40',
'RT12012': '41',
... | Som-Energia/switching | switching/helpers/funcions.py | Python | gpl-3.0 | 2,866 |
"""
This module provides convenient functions to transform sympy expressions to
lambda functions which can be used to calculate numerical values very fast.
"""
from __future__ import print_function, division
import inspect
import textwrap
from sympy.external import import_module
from sympy.core.compatibility import ... | maniteja123/sympy | sympy/utilities/lambdify.py | Python | bsd-3-clause | 21,677 |
import logging
import subprocess
from django.contrib import auth
from django.template import TemplateSyntaxError
from django.test import LiveServerTestCase, TestCase
from django.test.utils import override_settings
from allauth.account.models import EmailAddress
from selenium import webdriver
from selenium.common.exc... | OpenHumans/open-humans | common/testing.py | Python | mit | 5,545 |
disp_avlbl = True
import os
if 'DISPLAY' not in os.environ:
disp_avlbl = False
import matplotlib
matplotlib.use('Agg')
import matplotlib.pyplot as plt
import matplotlib.pyplot as plt
import networkx as nx
import numpy as np
import scipy.io as sio
import scipy.sparse as sp
import scipy.sparse.linalg as lg
f... | palash1992/GEM | gem/embedding/hope.py | Python | bsd-3-clause | 3,591 |
# Copyright 2020 Makani Technologies LLC
#
# 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... | google/makani | avionics/motor/monitors/motor_ina219.py | Python | apache-2.0 | 2,535 |
# Copyright 2016 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... | TakayukiSakai/tensorflow | tensorflow/contrib/learn/python/learn/io/pandas_io.py | Python | apache-2.0 | 2,243 |
from nose.tools import * # noqa: F403
from tests.base import AdminTestCase
from admin.base.forms import GuidForm
class TestGuidForm(AdminTestCase):
def setUp(self):
super(TestGuidForm, self).setUp()
def test_valid_data(self):
guid = '12345'
form = GuidForm({
'guid': gui... | saradbowman/osf.io | admin_tests/base/test_forms.py | Python | apache-2.0 | 624 |
# Copyright (c) 2013 Rackspace, 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 wr... | amitgandhinz/cdn | poppy/transport/falcon/driver.py | Python | apache-2.0 | 2,641 |
# -*- encoding: utf-8 -*-
##############################################################################
#
# OpenERP, Open Source Management Solution
# This module copyright (C) 2013 Savoir-faire Linux
# (<http://www.savoirfairelinux.com>).
#
# This program is free software: you can redistribute it and/or m... | abstract-open-solutions/hr | hr_employee_phone_extension/__openerp__.py | Python | agpl-3.0 | 1,432 |
# Natural Language Toolkit: Probability and Statistics
#
# Copyright (C) 2001 University of Pennsylvania
# Author: Edward Loper <edloper@gradient.cis.upenn.edu>
# Trevor Cohn <tacohn@cs.mu.oz.au> (additions)
# URL: <http://nltk.sf.net>
# For license information, see LICENSE.TXT
#
# $Id: probability.py,v 1.1.1.2... | ronaldahmed/robot-navigation | neural-navigation-with-lstm/MARCO/nltk/probability.py | Python | mit | 60,530 |
__author__ = 'Stefan'
| sDessens/coinotomy | coinotomy/watchers/tests/__init__.py | Python | mit | 22 |
# 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
# "License"); you may not u... | apache/incubator-superset | superset/migrations/versions/11c737c17cc6_deprecate_restricted_metrics.py | Python | apache-2.0 | 1,487 |
# -*- coding: utf-8 -*-
# Part of Odoo. See LICENSE file for full copyright and licensing details.
from openerp import http
from openerp.addons.website_portal.controllers.main import website_account
from openerp.http import request
class WebsiteAccount(website_account):
@http.route()
def account(self):
... | be-cloud-be/horizon-addons | server/addons/website_project_issue/controllers/main.py | Python | agpl-3.0 | 1,320 |
# -*- coding: utf-8 -*-
#
# Django FileBrowser documentation build configuration file, created by
# sphinx-quickstart on Sun Dec 5 19:11:46 2010.
#
# 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
# autogenerated fi... | michalwerner/django-filebrowser | docs/conf.py | Python | bsd-3-clause | 7,396 |
from typing import List
import pyasice
from esteid.exceptions import InvalidParameter
from esteid.signing import Container, DataFile, Signer
class MySigner(Signer):
def prepare(self, container: pyasice.Container = None, files: List[DataFile] = None) -> dict:
container = self.open_container(container, fi... | thorgate/django-esteid | esteid/flowtest/signer.py | Python | bsd-3-clause | 1,155 |
from Screens.Screen import Screen
from Screens.ChannelSelection import *
from Screens.ChoiceBox import ChoiceBox
from Screens.Standby import TryQuitMainloop
from Screens.MessageBox import MessageBox
from Components.ActionMap import ActionMap
from Components.Sources.List import List
from Components.Sources.StaticText im... | Antonio-Team/enigma2 | lib/python/Plugins/SystemPlugins/CommonInterfaceAssignment/plugin.py | Python | gpl-2.0 | 26,986 |
#!/usr/bin/python
# -*- coding: UTF-8 -*-
'''
# What's a Perfect Power anyway?题目地址:http://www.codewars.com/kata/whats-a-perfect-power-anyway
'''
import time
import unittest
class TestCases(unittest.TestCase):
def test1(self):self.assertEqual(isPP(4), [2,2], "4 = 2^2")
def test2(self):self.assertEqual... | karchi/codewars_kata | 已完成/What's a Perfect Power anyway.py | Python | mit | 1,233 |
# -*- coding: utf-8 -*-
from model.group import Group
import pytest
from data.groups import constant as testdata
def test_add_group(app, data_groups):
group = data_groups
old_groups = app.group.get_group_list()
app.group.create(group)
assert len(old_groups)+1 == app.group.count()
new_groups = app.... | TerekhovaKate/Python_training | test/add_new_group.py | Python | apache-2.0 | 1,229 |
# ------------------------------------------------------------------
# Copyright (c) 2020 PyInstaller Development Team.
#
# This file is distributed under the terms of the GNU General Public
# License (version 2.0 or later).
#
# The full license is available in LICENSE.GPL.txt, distributed with
# this software.
#
# SPD... | etherkit/OpenBeacon2 | macos/venv/lib/python3.8/site-packages/_pyinstaller_hooks_contrib/hooks/stdhooks/hook-umap.py | Python | gpl-3.0 | 517 |
"""Redundancy."""
from proselint.tools import memoize, preferred_forms_check
@memoize
def check(text):
"""Suggest the preferred forms."""
err = "redundancy.wallace"
msg = "Redundancy. Use '{}' instead of '{}'."
redundancies = [
["rectangular", ["rectangular in shape"]],
["audi... | amperser/proselint | proselint/checks/redundancy/misc.py | Python | bsd-3-clause | 25,051 |
from insights.tests import context_wrap
from insights.parsers.qemu_conf import QemuConf
qemu_conf_content = """
vnc_listen = "0.0.0.0"
vnc_auto_unix_socket = 1
vnc_tls = 1
# comment line
vnc_tls_x509_cert_dir = "/etc/pki/libvirt-vnc"
security_driver = "selinux" #inline comment
cgroup_device_ac... | RedHatInsights/insights-core | insights/parsers/tests/test_qemu_conf.py | Python | apache-2.0 | 995 |
import unittest
from datetime import date, timedelta
from prescription import Prescription
class PrescriptionTest(unittest.TestCase):
def test_completion_date(self):
prescription = Prescription(dispense_date = date.today() - timedelta(days=15), days_supply = 30)
self.assertEquals(date.today() ... | emilybache/KataMedicineClash | Refactoring/Python/prescription_test.py | Python | mit | 695 |
from direct.directnotify.DirectNotifyGlobal import directNotify
from direct.gui.DirectGui import *
from direct.showbase import PythonUtil
from direct.task import Task
from panda3d.core import *
import DisplaySettingsDialog
import ShtikerPage
from otp.speedchat import SCColorScheme
from otp.speedchat import SCStaticTex... | silly-wacky-3-town-toon/SOURCE-COD | toontown/shtiker/OptionsPage.py | Python | apache-2.0 | 38,922 |
import tensorflow as tf
m1 = tf.constant([[1., 2.]])
m2 = tf.constant([[1],
[2]])
m3 = tf.constant([ [[1,2],
[3,4],
[5,6]],
[[7,8],
[9,10],
[11,12]] ])
print(m1)
print(m2)
print(m3)
# 500 x 500 tensor
print(tf.o... | saramic/learning | data/tensorflow/src/2_4_creating_tensors.py | Python | unlicense | 405 |
# emacs: -*- mode: python; py-indent-offset: 4; indent-tabs-mode: t -*-
# vi: set ft=python sts=4 ts=4 sw=4 noet :
# This file is part of Fail2Ban.
#
# Fail2Ban 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;... | Eyepea/fail2ban | fail2ban/tests/utils.py | Python | gpl-2.0 | 10,517 |
# -*- coding: UTF-8 -*-
# Copyright 2018-2020 Rumma & Ko Ltd
# License: GNU Affero General Public License v3 (see file COPYING for details)
from lino.projects.std.settings import *
from lino.api import _
class Site(Site):
verbose_name = "Lino Presto"
url = "http://presto.lino-framework.org"
# demo_fixtur... | lsaffre/presto | lino_presto/lib/presto/settings.py | Python | agpl-3.0 | 3,982 |
from app import cache, celery
from app.factory import create_app
app = create_app(celery, cache)
if __name__ == '__main__':
app.run(debug=True)
| Djaler/VkGraph | run_app.py | Python | mit | 150 |
# -*- coding: utf-8
# @mtrpires
# Raspador de dados do Bolsa Família no Portal da Transparência do governo federal brasileiro
# http://www.portaltransparencia.gov.br
#
import os
from raspafamiliaFunctions import getEstado
from raspafamiliaFunctions import setParamsEstados
from raspafamiliaFunctions import salvaMunici... | mtrpires/raspafamilia | raspador.py | Python | gpl-3.0 | 3,509 |
# -*- coding: utf-8 -*-
# Generated by Django 1.9.2 on 2016-04-12 00:22
from __future__ import unicode_literals
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('api', '0002_auto_20160411_2108'),
]
operations = [
migrations.AddField(
... | eespaillat/RoommateManagerApp | roommatemanager/api/migrations/0003_item_item_finished.py | Python | mit | 452 |
'''
A little module for creating hierarchical word clusters.
This is based loosely on the following paper.
Peter F. Brown; Peter V. deSouza; Robert L. Mercer; T. J. Watson; Vincent J.
Della Pietra; Jenifer C. Lai. 1992. Class-Based n-gram Models of Natural
Language. Computational Linguistics, Volume 18, Numb... | ronaldahmed/labor-market-demand-analysis | shallow parsing models/word_clustering/pmi_cluster_outdated.py | Python | mit | 13,453 |
#!/usr/bin/python
# Copyright (c) 2005--2010 Red Hat, Inc.
#
#
#
# $Id$
raise Exception("""
This test is no more valid; see the bug
https://bugzilla.redhat.com/show_bug.cgi?id=423351
""")
import os
import unittest
from spacewalk.server import rhnSQL
DB = 'rhnuser/rhnuser@webdev'
class ExecutemanyTest(unittest.Te... | colloquium/spacewalk | backend/server/test/unit-test/rhnSQL/test_executemany.py | Python | gpl-2.0 | 1,833 |
# This file is part of Trackma.
#
# 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 distributed in the... | Hairo/trackma | trackma/ui/gtk/main.py | Python | gpl-3.0 | 998 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.