code stringlengths 6 947k | repo_name stringlengths 5 100 | path stringlengths 4 226 | language stringclasses 1
value | license stringclasses 15
values | size int64 6 947k |
|---|---|---|---|---|---|
# -*- encoding: utf-8 -*-
##############################################################################
#
# OpenERP, Open Source Management Solution
# Copyright (c) 2012 Serv. Tecnol. Avanzados (http://www.serviciosbaeza.com) All Rights Reserved.
# Pedro M. Baeza <pedro.baeza@serviciosbaeza... | eneldoserrata/marcos_openerp | addons/account_periodical_invoicing/periodical_invoicing.py | Python | agpl-3.0 | 23,307 |
# -*- coding: utf-8 -*-
# Copyright (C) 2006 Lukas Lalinsky
# Copyright (C) 2012 Christoph Reiter
#
# 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 yo... | mark-me/Pi-Jukebox | venv/Lib/site-packages/mutagen/musepack.py | Python | agpl-3.0 | 9,468 |
# -*- coding: utf-8 -*-
# Generated by Django 1.10.1 on 2016-09-30 23:43
from __future__ import unicode_literals
from django.db import migrations, models
import django.db.models.deletion
class Migration(migrations.Migration):
dependencies = [
('games', '0012_remove_gamelink_accepted_at'),
]
ope... | Turupawn/website | games/migrations/0013_auto_20161001_0143.py | Python | agpl-3.0 | 561 |
"""
Tests for users API
"""
import datetime
from unittest.mock import patch
from urllib.parse import parse_qs
import ddt
import pytz
from completion.test_utils import CompletionWaffleTestMixin, submit_completions_for_testing
from django.conf import settings
from django.db import transaction
from django.template impo... | arbrandes/edx-platform | lms/djangoapps/mobile_api/users/tests.py | Python | agpl-3.0 | 26,677 |
import pymongo
from bson.objectid import ObjectId
from eve.utils import date_to_str
from html5lib.html5parser import ParseError
from lxml.html.html5parser import fragments_fromstring, HTMLParser
from superdesk.utc import utcnow
from superdesk import get_resource_service
from liveblog.posts.mixins import AuthorsMixin... | liveblog/liveblog | server/liveblog/blogs/blog.py | Python | agpl-3.0 | 4,946 |
#! usr/bin/env python
# coding: utf8
from __future__ import print_function
from __future__ import absolute_import
from __future__ import unicode_literals
"""
metalex is general tool for lexicographic and metalexicographic activities
Copyright (C) 2017 by Elvis MBONING
This program is free software: you ... | Levis0045/MetaLex | metalex/ocrtext/normalizeText.py | Python | agpl-3.0 | 11,920 |
'''
Created on Aug 12, 2015
@author: yasir1brahim
'''
from openerp import fields, models
class fields():
pass
fields() | yasir1brahim/OLiMS | controllers/fields.py | Python | agpl-3.0 | 126 |
import superdesk
from superdesk.notification import push_notification
from apps.content import push_content_notification
from superdesk import get_resource_service
PRIVILEGE = 'desk_routing'
class ClosedDeskResource(superdesk.Resource):
"""Custom resource to change desk.is_closed
Allowing users without de... | mdhaman/superdesk-core | apps/desk_routing.py | Python | agpl-3.0 | 2,361 |
# -*- coding: utf-8 -*-
# Generated by Django 1.10 on 2017-08-28 11:43
from django.conf import settings
from django.db import migrations, models
import django.db.models.deletion
class Migration(migrations.Migration):
initial = True
dependencies = [
migrations.swappable_dependency(settings.AUTH_USE... | wetneb/dissemin | deposit/osf/migrations/0001_initial.py | Python | agpl-3.0 | 1,150 |
# Copyright 2013-2020 Lawrence Livermore National Security, LLC and other
# Spack Project Developers. See the top-level COPYRIGHT file for details.
#
# SPDX-License-Identifier: (Apache-2.0 OR MIT)
from spack import *
class PyPytz(PythonPackage):
"""World timezone definitions, modern and historical."""
homep... | iulian787/spack | var/spack/repos/builtin/packages/py-pytz/package.py | Python | lgpl-2.1 | 1,493 |
#
# Copyright (c) 2015 Red Hat, Inc.
#
# This software is licensed to you under the GNU Lesser General Public
# License as published by the Free Software Foundation; either version
# 2 of the License (LGPLv2) or (at your option) any later version.
# There is NO WARRANTY for this software, express or implied,
# includin... | credativ/gofer | src/gofer/agent/manager.py | Python | lgpl-2.1 | 5,843 |
# Copyright (C) 2001-2010 Python Software Foundation
# Author: Barry Warsaw
# Contact: email-sig@python.org
"""Miscellaneous utilities."""
__all__ = [
'collapse_rfc2231_value',
'decode_params',
'decode_rfc2231',
'encode_rfc2231',
'formataddr',
'formatdate',
'format_datetime',
... | Orav/kbengine | kbe/src/lib/python/Lib/email/utils.py | Python | lgpl-3.0 | 14,708 |
import sys
from java.util import Vector
def addTemplate(core):
mobileTemplates = Vector()
mobileTemplates.add('huurton_pub')
mobileTemplates.add('huurton_reaper')
mobileTemplates.add('huurton_stalker')
core.spawnService.addLairTemplate('dantooine_huurton_lair_2', mobileTemplates, 15, 'object/tangible/lair/base/... | ProjectSWGCore/NGECore2 | scripts/mobiles/lairs/dantooine_huurton_lair_2.py | Python | lgpl-3.0 | 368 |
from django.conf.urls import include, url
from django.contrib.staticfiles.templatetags.staticfiles import static
from django.core import urlresolvers
from django.utils.html import format_html
from wagtail.wagtailcore import hooks
from modeladminutils import admin_urls
@hooks.register('register_admin_urls')
def regi... | nott/next.filmfest.by | modeladminutils/wagtail_hooks.py | Python | unlicense | 891 |
"""
Renames files in a directory (command line argument) to not have intermediate extensions.
Works for cTAKES xmi or xml files if the original file extension has been retained.
"""
import re
import subprocess
import sys
import os
try:
d = sys.argv[1]
except:
print('usage:\npython ' + sys.argv[0] + ' <path-... | gpfinley/ensembles | scripts/remove_extraneous_extensions.py | Python | apache-2.0 | 664 |
# Copyright 2012-2013 Red Hat, 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... | rackerlabs/instrumented-ceilometer | ceilometer/openstack/common/rpc/proxy.py | Python | apache-2.0 | 9,444 |
# 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
# distributed under t... | openstack/keystone | keystone/common/policies/domain.py | Python | apache-2.0 | 3,937 |
# 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 ... | orbitfp7/nova | nova/api/ec2/__init__.py | Python | apache-2.0 | 25,652 |
import httplib
import functools
from modularodm.exceptions import NoResultsFound
from modularodm.storage.base import KeyExistsException
from framework.auth.decorators import must_be_signed
from framework.exceptions import HTTPError
from addons.osfstorage.models import OsfStorageFileNode, OsfStorageFolder
from osf.mo... | caneruguz/osf.io | addons/osfstorage/decorators.py | Python | apache-2.0 | 2,839 |
import random
import time
from collections import OrderedDict
from plenum.common.util import randomString
try:
import ujson as json
except ImportError:
import json
import pytest
from plenum.recorder.recorder import Recorder
TestRunningTimeLimitSec = 350
def test_add_to_recorder(recorder):
last_check_... | evernym/plenum | plenum/test/recorder/test_recorder.py | Python | apache-2.0 | 6,601 |
import itertools
import os
import zipfile
import numpy as np
import requests
import scipy.sparse as sp
def _get_movielens_path():
"""
Get path to the movielens dataset file.
"""
return os.path.join(os.path.dirname(os.path.abspath(__file__)),
'movielens.zip')
def _download... | paoloRais/lightfm | examples/movielens/data.py | Python | apache-2.0 | 3,559 |
import re
import sys
import unittest
import metricbeat
import os
import time
# Further tests:
# * Mix full config modules with reloading modules
# * Load empty file
# * Add remove module
# * enabled / disable module
# * multiple files
# * Test empty file
class Test(metricbeat.BaseTest):
@unittest.skipUnless(re.... | christiangalsterer/httpbeat | vendor/github.com/elastic/beats/metricbeat/tests/system/test_reload.py | Python | apache-2.0 | 2,260 |
# Generated by the gRPC Python protocol compiler plugin. DO NOT EDIT!
import grpc
from google.cloud.monitoring_v3.proto import notification_pb2 as google_dot_cloud_dot_monitoring__v3_dot_proto_dot_notification__pb2
from google.cloud.monitoring_v3.proto import notification_service_pb2 as google_dot_cloud_dot_monitoring... | jonparrott/google-cloud-python | monitoring/google/cloud/monitoring_v3/proto/notification_service_pb2_grpc.py | Python | apache-2.0 | 15,062 |
"""Support for exposing a templated binary sensor."""
import voluptuous as vol
from homeassistant.components.binary_sensor import (
DEVICE_CLASSES_SCHEMA,
ENTITY_ID_FORMAT,
PLATFORM_SCHEMA,
BinarySensorEntity,
)
from homeassistant.const import (
ATTR_ENTITY_ID,
ATTR_FRIENDLY_NAME,
CONF_DEVI... | partofthething/home-assistant | homeassistant/components/template/binary_sensor.py | Python | apache-2.0 | 7,122 |
# Copyright 2010-2011 OpenStack Foundation
# Copyright 2015 Clinton Knight
# 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/li... | j-griffith/cinder | cinder/api/views/versions.py | Python | apache-2.0 | 2,771 |
#!/usr/bin/env python
#
# Copyright 2009 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 o... | supriyantomaftuh/python-publisher | pubsubhubbub_publish_test.py | Python | apache-2.0 | 4,205 |
# automatically generated by the FlatBuffers compiler, do not modify
# namespace: graph
import flatbuffers
class FlatProperties(object):
__slots__ = ['_tab']
@classmethod
def GetRootAsFlatProperties(cls, buf, offset):
n = flatbuffers.encode.Get(flatbuffers.packer.uoffset, buf, offset)
x ... | deeplearning4j/deeplearning4j | libnd4j/include/graph/generated/nd4j/graph/FlatProperties.py | Python | apache-2.0 | 7,580 |
"""The tests for MQTT device triggers."""
import json
import pytest
import homeassistant.components.automation as automation
from homeassistant.components.device_automation import DeviceAutomationType
from homeassistant.components.mqtt import _LOGGER, DOMAIN, debug_info
from homeassistant.helpers import device_regist... | home-assistant/home-assistant | tests/components/mqtt/test_device_trigger.py | Python | apache-2.0 | 43,669 |
# Copyright 2013 Donald Stufft
#
# 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, so... | mattrobenolt/warehouse | tasks/__init__.py | Python | apache-2.0 | 673 |
# 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... | sxjscience/tvm | python/tvm/contrib/clang.py | Python | apache-2.0 | 3,361 |
# Copyright (c) 2018 PaddlePaddle 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 app... | chengduoZH/Paddle | python/paddle/fluid/layers/device.py | Python | apache-2.0 | 1,438 |
import os
import sys
import site
SAL_ENV_DIR = '/home/docker/sal'
# Use site to load the site-packages directory of our virtualenv
# site.addsitedir(os.path.join(SAL_ENV_DIR, 'lib/python2.7/site-packages'))
# Make sure we have the virtualenv and the Django app itself added to our path
sys.path.append(SAL_ENV_DIR)
sy... | salopensource/sal | docker/wsgi.py | Python | apache-2.0 | 691 |
# 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... | Laurawly/tvm-1 | tests/python/unittest/test_tir_analysis_calculate_workspace.py | Python | apache-2.0 | 8,017 |
# vim: tabstop=4 shiftwidth=4 softtabstop=4
# encoding: utf-8
# Copyright 2014 Orange
#
# 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
#
# Un... | openstack/networking-bagpipe | networking_bagpipe/bagpipe_bgp/vpn/evpn/linux_vxlan.py | Python | apache-2.0 | 15,445 |
# This Source Code Form is subject to the terms of the Mozilla Public
# License, v. 2.0. If a copy of the MPL was not distributed with this
# file, You can obtain one at http://mozilla.org/MPL/2.0/.
import os
import platform
from emulator import Emulator
class B2GEmulator(Emulator):
def __init__(self, homedir... | sergecodd/FireFox-OS | B2G/gecko/testing/mozbase/mozdevice/mozdevice/b2gemulator.py | Python | apache-2.0 | 3,381 |
"""Functions for downloading and reading MNIST data."""
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
import gzip
import os
import urllib
import numpy
from six.moves import xrange # pylint: disable=redefined-builtin
SOURCE_URL = 'http://yann.lecun.com/exdb... | saraghav/blue-box | TensorFlow/input_data.py | Python | apache-2.0 | 5,847 |
#!/usr/bin/env python
#
# Cloudlet Infrastructure for Mobile Computing
#
# Author: Kiryong Ha <krha@cmu.edu>
#
# Copyright (C) 2011-2013 Carnegie Mellon University
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may ob... | cmusatyalab/elijah-provisioning | elijah/provisioning/server.py | Python | apache-2.0 | 46,655 |
# -*- coding: utf-8 -*-
'''
Connection module for Amazon SQS
.. versionadded:: 2014.7.0
:configuration: This module accepts explicit sqs credentials but can also utilize
IAM roles assigned to the instance through Instance Profiles. Dynamic
credentials are then automatically obtained from AWS API and no furthe... | stephane-martin/salt-debian-packaging | salt-2016.3.3/salt/modules/boto_sqs.py | Python | apache-2.0 | 5,122 |
# Copyright 2020 The StackStorm Authors.
# Copyright 2019 Extreme 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 ... | StackStorm/st2 | st2common/st2common/content/loader.py | Python | apache-2.0 | 14,094 |
# 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... | pavelchristof/gomoku-ai | tensorflow/python/debug/lib/grpc_debug_server.py | Python | apache-2.0 | 16,574 |
# Copyright 2008 German Aerospace Center (DLR)
#
# 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... | DLR-SC/RepoGuard | test/repoguard_test/checks/__init__.py | Python | apache-2.0 | 665 |
#!/usr/bin/env python
#
# Author: Qiming Sun <osirpt.sun@gmail.com>
#
'''
TDDFT analytical nuclear gradients.
'''
from pyscf import gto, scf, dft, tddft
mol = gto.M(
atom = [
['O' , 0. , 0. , 0],
['H' , 0. , -0.757 , 0.587],
['H' , 0. , 0.757 , 0.587]],
basis = 'ccpvdz')
mf = sc... | gkc1000/pyscf | examples/grad/06-tddft_gradients.py | Python | apache-2.0 | 948 |
from flavorsync import config
from flask_sqlalchemy import SQLAlchemy
db = SQLAlchemy()
def init_db(app):
if app.config['TESTING']:
app.config['SQLALCHEMY_DATABASE_URI'] = 'sqlite:///' + app.config['DB_TEST_URI']
else:
app.config['SQLALCHEMY_DATABASE_URI'] = config.DB_URI
db.init_app... | Fiware/ops.Flavor-sync | flavorsync/database.py | Python | apache-2.0 | 345 |
#
# 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 us... | zuotingbing/spark | python/pyspark/resource/taskrequests.py | Python | apache-2.0 | 3,865 |
# 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
# distributed under t... | openstack/python-openstacksdk | openstack/tests/unit/identity/v3/test_application_credential.py | Python | apache-2.0 | 2,214 |
from django.conf.urls import url,include
from django.contrib import admin
urlpatterns = [
url(r'^',include('Register_and_login.urls')),
url(r'^homepage/',include('MainPage.urls')),
url(r'^username/cart/',include('cart.urls')),
url(r'^username/',include('customer.urls')),
url(r'^pharmacy_name/',incl... | mpiplani/Online-Pharmacy | online_pharmacy/online_pharmacy/urls.py | Python | apache-2.0 | 542 |
# Licensed to Cloudera, Inc. under one
# or more contributor license agreements. See the NOTICE file
# distributed with this work for additional information
# regarding copyright ownership. Cloudera, Inc. licenses this file
# to you under the Apache License, Version 2.0 (the
# "License"); you may not use this file ex... | 2013Commons/HUE-SHARK | apps/shell/setup.py | Python | apache-2.0 | 1,754 |
import logging
import datetime
import urllib
from django.core.mail import send_mail, EmailMessage
from django.core.urlresolvers import reverse
from django.core.paginator import Paginator, InvalidPage, EmptyPage
from django.conf import settings
from django.db.models import Q
from django.http import HttpResponse, HttpRe... | StephenPower/CollectorCity-Market-Place | stores/apps/store_admin/views.py | Python | apache-2.0 | 46,221 |
# Copyright 2014 Amazon.com, Inc. or its affiliates. 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. A copy of
# the License is located at
#
# http://aws.amazon.com/apache2.0/
#
# or in the "license" file accompa... | synctree/synctree-awsebcli | ebcli/objects/environment.py | Python | apache-2.0 | 1,422 |
#
# 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... | irinabov/debian-qpid-dispatch | tests/router_engine_test.py | Python | apache-2.0 | 27,299 |
import unittest
from flexmock import flexmock_teardown
from tests.util.global_reactor import cisco_switch_ip, \
cisco_auto_enabled_switch_ssh_port, cisco_auto_enabled_switch_telnet_port
from tests.util.protocol_util import SshTester, TelnetTester, with_protocol
class TestCiscoAutoEnabledSwitchProtocol(unittest.T... | mlecours/fake-switches | tests/cisco/test_cisco_auto_enabled_switch.py | Python | apache-2.0 | 1,464 |
# Copyright 2017 Battelle Energy Alliance, 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 t... | joshua-cogliati-inl/raven | tests/framework/PostProcessors/Validation/DSS/lorentzAttractor_timeScale_I.py | Python | apache-2.0 | 2,032 |
# coding: utf-8
#
# Copyright 2017 The Oppia 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 requi... | oppia/oppia-ml | core/classifiers/classifier_utils_test.py | Python | apache-2.0 | 9,247 |
# Copyright (c) 2010-2012 OpenStack Foundation
#
# 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 agree... | swiftstack/swift | test/unit/account/test_server.py | Python | apache-2.0 | 135,836 |
"""
Provide functionality to TTS.
For more details about this component, please refer to the documentation at
https://home-assistant.io/components/tts/
"""
import asyncio
import ctypes
import functools as ft
import hashlib
import logging
import mimetypes
import os
import re
import io
from aiohttp import web
import vo... | JshWright/home-assistant | homeassistant/components/tts/__init__.py | Python | apache-2.0 | 16,893 |
# Copyright 2013 The LUCI Authors. All rights reserved.
# Use of this source code is governed under the Apache License, Version 2.0
# that can be found in the LICENSE file.
import base64
import contextlib
import datetime
import json
import logging
import time
import webtest
from google.appengine.datastore import dat... | luci/luci-py | appengine/components/test_support/test_case.py | Python | apache-2.0 | 11,348 |
"""Support for exposing NX584 elements as sensors."""
import logging
import threading
import time
from nx584 import client as nx584_client
import requests
import voluptuous as vol
from homeassistant.components.binary_sensor import (
DEVICE_CLASS_OPENING,
DEVICE_CLASSES,
PLATFORM_SCHEMA,
BinarySensorEn... | aronsky/home-assistant | homeassistant/components/nx584/binary_sensor.py | Python | apache-2.0 | 4,476 |
# Copyright (C) 2012 Red Hat, 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 ... | mahak/nova | nova/tests/unit/virt/disk/vfs/test_guestfs.py | Python | apache-2.0 | 14,130 |
# -*- coding: utf-8 -*-
"""
File related views, including view_file, edit_file, view_history_file,
view_trash_file, view_snapshot_file
"""
import os
import hashlib
import json
import stat
import tempfile
import urllib
import urllib2
import chardet
from django.contrib.sites.models import Site, RequestSite
from django.... | cloudcopy/seahub | seahub/views/wiki.py | Python | apache-2.0 | 8,863 |
# vim: set fileencoding=utf-8 :
#
# Copyright (c) 2012 Retresco GmbH
# Copyright (c) 2012 Daniel Truemper <truemped at googlemail.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
#
# ht... | truemped/dopplr | dopplr/solr/__init__.py | Python | apache-2.0 | 707 |
# -*- coding: utf-8 -*-
#
# 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
... | btallman/incubator-airflow | airflow/www/api/experimental/endpoints.py | Python | apache-2.0 | 3,540 |
# This file is part of VoltDB.
# Copyright (C) 2008-2013 VoltDB Inc.
#
# This file contains original code and/or modifications of original code.
# Any modifications made by VoltDB Inc. are licensed under the following
# terms and conditions:
#
# Permission is hereby granted, free of charge, to any person obtaining
# a... | vtorshyn/voltdb-shardit-src | voltdb-3.7/lib/python/voltcli/voltadmin.d/restore.py | Python | apache-2.0 | 1,943 |
# coding: utf-8
import datetime
def timesince(value):
"""Friendly time gap"""
now = datetime.datetime.now()
delta = now - value
if delta.days > 365:
return '%d年前' % (delta.days / 365)
if delta.days > 30:
return '%d个月前' % (delta.days / 30)
if delta.days > 0:
return '%d天前... | tuistudio/tuistudio.com | tuistudio/utils/filters.py | Python | apache-2.0 | 530 |
# -*- encoding: utf-8 -*-
#
# License: New BSD Style
#
# [typography.py][1] is a set of filters enhancing written text output. As the
# name says, it adds specific typography things documented in the definitions
# itself and [smartypants][2].
#
# The typography.py filter comes with two options: ``mode`` and ``default``... | markvl/acrylamid | acrylamid/filters/typography.py | Python | bsd-2-clause | 12,390 |
#!/usr/bin/python3
"""Punctuation rules around colons and semi-colons."""
import wlint.punctuation
def _colon_rule(name, colon):
rules = []
# a colon might be followed by a digit if it's time
if name == "colon":
rules.append(("{}.missing-space".format(name),
wlint.punctuati... | snewell/wlint | lib/wlint/punctuation/colon.py | Python | bsd-2-clause | 973 |
import json
import logging
import unittest
from requests import Response, Request
from streamlink.compat import urlencode
from streamlink.plugins.bbciplayer import BBCiPlayer
class TestPluginBBCiPlayer(unittest.TestCase):
def test_can_handle_url(self):
# should match
self.assertTrue(
... | javiercantero/streamlink | tests/test_plugin_bbciplayer.py | Python | bsd-2-clause | 1,639 |
#!/usr/bin/env python
import unittest
from arni_countermeasure.rated_statistic_storage import *
from rosgraph_msgs.msg import Clock
from arni_countermeasure.outcome import *
import rospy
import time
import arni_countermeasure.helper as helper
PKG = "arni_countermeasure"
class TestStorage(unittest.TestCase):
pub ... | ROS-PSE/arni | arni_countermeasure/tests/test_storage.py | Python | bsd-2-clause | 5,630 |
# Generated by Django 3.1.13 on 2021-09-03 08:02
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('feedback', '0014_auto_20210825_1130'),
]
operations = [
migrations.AddField(
model_name='reportproblemmagnitude',
n... | GeotrekCE/Geotrek-admin | geotrek/feedback/migrations/0015_reportproblemmagnitude_suricate_label.py | Python | bsd-2-clause | 478 |
"""
--------------------------------------------------------------------------------------------
Extracted from skikit-learn to ensure basic compatibility
without creating an explicit dependency.
For the original code see
http://scikit-learn.org/
and
https://github.com/scikit-learn
----------------------------... | arokem/PyEMMA | pyemma/_ext/sklearn/parameter_search.py | Python | bsd-2-clause | 3,395 |
import json
import os
def fix_assets_path(path):
fullpath = os.path.join(os.path.dirname(__file__), "../", path)
return fullpath
def array_from_string(s):
array = s.split(',')
if "" in array:
array.remove("")
return array
def set_from_string(s):
return set(array_from_string(s))
... | 44px/redash | redash/settings/helpers.py | Python | bsd-2-clause | 471 |
# Author: Krist Jin
# Reviewer: Michael Lissner
# Date created: 2013-08-03
from datetime import datetime
from lxml import html
from juriscraper.OpinionSite import OpinionSite
from juriscraper.lib.string_utils import titlecase
class Site(OpinionSite):
def __init__(self, *args, **kwargs):
sup... | Andr3iC/juriscraper | opinions/united_states/state/ark.py | Python | bsd-2-clause | 2,181 |
# Generated by Django 3.0.3 on 2020-02-06 10:24
import django.db.models.deletion
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
("example", "0007_artproject_description"),
]
operations = [
migrations.CreateModel(
name="LabRes... | django-json-api/rest_framework_ember | example/migrations/0008_labresults.py | Python | bsd-2-clause | 1,087 |
import re
from lib.common import helpers
class Module:
def __init__(self, mainMenu, params=[]):
self.info = {
'Name': 'Invoke-ShellcodeMSIL',
'Author': ['@mattifestation'],
'Description': ('Execute shellcode within the context of the running PowerShell '
... | frohoff/Empire | lib/modules/powershell/code_execution/invoke_shellcodemsil.py | Python | bsd-3-clause | 3,462 |
# This file is part of the Astrometry.net suite.
# Licensed under a 3-clause BSD style license - see LICENSE
from numpy import *
import datetime
import numpy as np
from functools import reduce
arcsecperrad = 3600. * 180. / np.pi
axistilt = 23.44 # degrees
def ra_normalize(ra):
return np.mod(ra, 360.)
def ra_rang... | olebole/astrometry.net | util/starutil_numpy.py | Python | bsd-3-clause | 18,610 |
#!/usr/bin/python
#
# Copyright (c) 2004,2005 Hewlett-Packard Company
# 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
# ... | ekiwi/tinyos-1.x | contrib/handhelds/hwtest/telosb/Accel/multiaccel.py | Python | bsd-3-clause | 12,716 |
#!/usr/bin/env python3
#
# Copyright (c) 2016, The OpenThread Authors.
# 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
# ... | lanyuwen/openthread | tests/scripts/thread-cert/Cert_5_1_06_RemoveRouterId.py | Python | bsd-3-clause | 4,328 |
#!/usr/bin/python
# Copyright (c) 2009 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.
# usage: action_useragentstylesheets.py OUTPUTS -- INPUTS
#
# Multiple OUTPUTS and INPUTS may be listed. The sections are separated b... | kuiche/chromium | webkit/build/action_useragentstylesheets.py | Python | bsd-3-clause | 1,985 |
from django.test.utils import override_settings
from hc.api.models import Channel
from hc.test import BaseTestCase
class AddMsTeamsTestCase(BaseTestCase):
def setUp(self):
super().setUp()
self.url = "/projects/%s/add_msteams/" % self.project.code
def test_instructions_work(self):
self... | healthchecks/healthchecks | hc/front/tests/test_add_msteams.py | Python | bsd-3-clause | 1,478 |
from django.conf.urls import patterns, url
from . import views
urlpatterns = patterns(
'',
url(r'^$', views.customer_list, name='customers'),
url(r'^(?P<pk>[0-9]+)/$', views.customer_details, name='customer-details')
)
| hongquan/saleor | saleor/dashboard/customer/urls.py | Python | bsd-3-clause | 234 |
# AUTO-GENERATED by tools/checkspecs.py - DO NOT EDIT
from ....testing import assert_equal
from ..model import MRISPreproc
def test_MRISPreproc_inputs():
input_map = dict(args=dict(argstr='%s',
),
environ=dict(nohash=True,
usedefault=True,
),
fsgd_file=dict(argstr='--fsgd %s',
xor=(u'subje... | carolFrohlich/nipype | nipype/interfaces/freesurfer/tests/test_auto_MRISPreproc.py | Python | bsd-3-clause | 2,331 |
# commit.py
# Copyright (C) 2008, 2009 Michael Trier (mtrier@gmail.com) and contributors
#
# This module is part of GitPython and is released under
# the BSD License: http://www.opensource.org/licenses/bsd-license.php
from gitdb import IStream
from git.util import (
hex_to_bin,
Actor,
Iterable,
Stats,
... | jeblair/GitPython | git/objects/commit.py | Python | bsd-3-clause | 20,799 |
import pytest
import numpy as np
import scipy.sparse
import qutip
from qutip.fastsparse import fast_csr_matrix
from qutip.cy.checks import (_test_sorting, _test_coo2csr_inplace_struct,
_test_csr2coo_struct, _test_coo2csr_struct)
from qutip.random_objects import rand_jacobi_rotation
def _u... | cgranade/qutip | qutip/tests/test_cy_structs.py | Python | bsd-3-clause | 1,816 |
import os
import shutil
import logging
import unittest
import tempfile
from riboplot import ribocore, riboplot
# use testing configuration
CFG = riboplot.CONFIG = riboplot.config.TestingConfig()
logging.disable(logging.CRITICAL)
class CheckArgumentsTestCase(unittest.TestCase):
"""Check if all arguments sent on ... | vimalkumarvelayudhan/riboplot | tests/test_riboplot.py | Python | bsd-3-clause | 7,454 |
# $Id$
#
# Copyright (C) 2001-2008 Greg Landrum and Rational Discovery LLC
# All Rights Reserved
#
""" Automatic search for quantization bounds
This uses the expected informational gain to determine where quantization bounds should
lie.
**Notes**:
- bounds are less than, so if the bounds are [1.,2.],
[0.9... | strets123/rdkit | rdkit/ML/Data/Quantize.py | Python | bsd-3-clause | 10,583 |
"""Experiment tests."""
# -----------------------------------------------------------------------------
# Imports
# -----------------------------------------------------------------------------
import os
import shutil
import tempfile
import numpy as np
import pandas as pd
import tables as tb
from nose import with_set... | klusta-team/klustaviewa | klustaviewa/gui/tests/test_recluster.py | Python | bsd-3-clause | 2,906 |
from django.test import TestCase
from django.contrib.auth.models import Group
from hs_access_control.models import UserResourceProvenance, UserResourcePrivilege, \
GroupResourceProvenance, GroupResourcePrivilege, \
UserGroupProvenance, UserGroupPrivilege, \
PrivilegeCodes
from hs_core import hydroshare
fr... | ResearchSoftwareInstitute/MyHPOM | hs_access_control/tests/test_provenance_function.py | Python | bsd-3-clause | 58,013 |
''' Present a scatter plot with linked histograms on both axes.
Use the ``bokeh serve`` command to run the example by executing:
bokeh serve selection_histogram.py
at your command prompt. Then navigate to the URL
http://localhost:5006/selection_histogram
in your browser.
'''
import numpy as np
from boke... | justacec/bokeh | examples/app/selection_histogram.py | Python | bsd-3-clause | 3,598 |
from django.conf.urls import include, url
from wagtail.wagtailadmin import hooks
from wagtail.wagtaildocs import admin_urls
def register_admin_urls():
return [
url(r'^documents/', include(admin_urls)),
]
hooks.register('register_admin_urls', register_admin_urls)
| sahat/wagtail | wagtail/wagtaildocs/wagtail_hooks.py | Python | bsd-3-clause | 282 |
#!/usr/bin/env python
# Copyright (C) 2001 Colin Phipps <cphipps@doomworld.com>
# Copyright (C) 2008, 2013 Simon Howard
# Parts copyright (C) 1999 by id Software (http://www.idsoftware.com/)
#
# SPDX-License-Identifier: GPL-2.0+
#
# Takes PLAYPAL as input (filename is the only parameter)
# Produces a light graduated CO... | CWolfRU/freedoom | lumps/colormap/colormap.py | Python | bsd-3-clause | 6,534 |
#!/usr/bin/env python
#
# ICMP flooder
#
# Date: Oct. 22, 2012
# All rights reserved.
#
import socket,sys,threading
import threading,time
import scapy.arch,random
from scapy.all import sr1,IP,ICMP,TCP
scapy.config.conf.iface="eth0"
class sendSYN(threading.Thread):
def __init__(self, id, name, target, port):
self.... | sfluo/Mr.Bot | tools/icmpflood.py | Python | bsd-3-clause | 1,274 |
from urllib import urlencode
from django import forms, template
from django.contrib.auth.admin import csrf_protect_m
from django.contrib.admin import helpers
from django.contrib.admin.util import unquote
from django.contrib.contenttypes.models import ContentType
from django.core.exceptions import PermissionDenied
fro... | thomasgilgenast/spqr-nonrel | filetransfers/admin.py | Python | bsd-3-clause | 13,542 |
r'''
Utility functionality
=====================
.. currentmodule:: micronota.util
This module (:mod:`micronota.util`) provides various utility functionality,
'''
# ----------------------------------------------------------------------------
# Copyright (c) 2015--, micronota development team.
#
# Distributed under t... | RNAer/micronota | micronota/util.py | Python | bsd-3-clause | 9,506 |
#!/usr/bin/env python
# The outputManager synchronizes the output display for all the various threads
#####################
import threading
class outputStruct():
def __init__( self ):
self.id = 0
self.updateObjSem = None
self.title = ""
self.numOfInc = 0
class outputManager( threading.Thread ):
def __in... | alexforsale/manga_downloader | src/outputManager/base.py | Python | mit | 881 |
schema = {u'copyFields': [{u'dest': u'text', u'source': u'author'},
{u'dest': u'text', u'source': u'cat'},
{u'dest': u'text', u'source': u'content'},
{u'dest': u'text', u'source': u'content_type'},
{u'dest': u'text', u'source': u'description'},
... | mamico/scorched | scorched/tests/schema.py | Python | mit | 52,325 |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
#
# Copyright 2011 Yesudeep Mangalapilly <yesudeep@gmail.com>
# Copyright 2012 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
#
# ... | austinwagner/sublime-sourcepawn | watchdog/events.py | Python | mit | 18,129 |
"""
WSGI config for ciat_plaforma project.
It exposes the WSGI callable as a module-level variable named ``application``.
For more information on this file, see
https://docs.djangoproject.com/en/1.6/howto/deployment/wsgi/
"""
import os
os.environ.setdefault("DJANGO_SETTINGS_MODULE", "ciat_plataforma.settings")
from... | ErickMurillo/ciat_plataforma | ciat_plataforma/wsgi.py | Python | mit | 403 |
# -*- coding: utf-8 -*-
"""
Admin Controllers
"""
module = "admin"
resourcename = request.function
# Options Menu (available in all Functions' Views)
# - can Insert/Delete items from default menus within a function, if required.
s3_menu(module)
# S3 framework functions
# ----------------------------------------... | flavour/porto | controllers/admin.py | Python | mit | 53,568 |
from .celery import app as celery_app
__all__ = ["celery_app"]
| codeforboston/cornerwise | server/cornerwise/__init__.py | Python | mit | 65 |
# coding: utf8
from __future__ import unicode_literals
import regex as re
from ._tokenizer_exceptions_list import FR_BASE_EXCEPTIONS
from .punctuation import ELISION, HYPHENS
from ..tokenizer_exceptions import URL_PATTERN
from ..char_classes import ALPHA_LOWER
from ...symbols import ORTH, LEMMA, TAG, NORM, PRON_LEMMA... | aikramer2/spaCy | spacy/lang/fr/tokenizer_exceptions.py | Python | mit | 5,710 |
#This script is the test script for apps_db_comparison script
#It makes 2 new web2py apps to compare
#Just run the test script to compare
#i.e python applications/eden/tests/dbmigration/TestScript.py
import os
import sys
import subprocess
import shutil
#CALCULATING PATHS
own_path = os.path.realpath(__file__)
own... | anubhav929/eden | tests/dbmigration/TestScript.py | Python | mit | 2,281 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.