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 |
|---|---|---|---|---|---|
################################################################################
# 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... | aljoscha/flink | flink-python/pyflink/version.py | Python | apache-2.0 | 1,132 |
from __future__ import absolute_import
from collections import namedtuple
# Other useful structs
TopicPartition = namedtuple("TopicPartition",
["topic", "partition"])
BrokerMetadata = namedtuple("BrokerMetadata",
["nodeId", "host", "port", "rack"])
PartitionMetadata = namedtuple("PartitionMetadata",
["... | mumrah/kafka-python | kafka/structs.py | Python | apache-2.0 | 801 |
# Copyright (c) 2014 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 or agreed to in writing, so... | japaniel/CloudFerry | cloudferrylib/os/actions/deploy_snapshots.py | Python | apache-2.0 | 4,490 |
"""
mbed SDK
Copyright (c) 2011-2017 ARM Limited
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... | adustm/mbed | tools/export/gnuarmeclipse/__init__.py | Python | apache-2.0 | 40,515 |
class Post(object):
def __init__(self, **kwargs):
self.__dict__.update(kwargs)
def __iter__(self):
return iter(self.__dict__)
| emitrom/integra-openstack-ui | workflows/post/post.py | Python | apache-2.0 | 151 |
# Copyright 2017-present Open Networking 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 agr... | opencord/xos | xos/core/migrations/0012_backupoperation_decl_uuid.py | Python | apache-2.0 | 1,124 |
#!/usr/bin/env python
"""
conference.py -- Udacity conference server-side Python App Engine API;
uses Google Cloud Endpoints
$Id: conference.py,v 1.25 2014/05/24 23:42:19 wesc Exp wesc $
created by wesc on 2014 apr 21
"""
__author__ = 'wesc+api@google.com (Wesley Chun)'
from datetime import datetime
import js... | kirklink/udacity-fullstack-p4 | conference.py | Python | apache-2.0 | 40,994 |
# Copyright (c) 2015 Hewlett-Packard Development Company, L.P.
# 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/LICEN... | ekosareva/vmware-dvs | networking_vsphere/tests/unit/drivers/test_ovs_firewall.py | Python | apache-2.0 | 28,260 |
# Copyright (c) 2014 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 agreed to... | KoreaCloudObjectStorage/swift3 | swift3/subresource.py | Python | apache-2.0 | 16,885 |
import gdb
# This is not quite right, as local vars may override symname
def read_global_var (symname):
return gdb.selected_frame().read_var(symname)
def g_quark_to_string (quark):
if quark == None:
return None
quark = long(quark)
if quark == 0:
return None
try:
val = read_... | jonnyniv/boost_converter | host/gui/GTK+/share/glib-2.0/gdb/glib.py | Python | apache-2.0 | 7,426 |
# 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... | annarev/tensorflow | tensorflow/python/data/util/nest.py | Python | apache-2.0 | 16,774 |
from django.test import TestCase
from threadlocals.threadlocals import set_current_user
from django.contrib.auth import get_user_model
from powerdns.models import (
Domain,
DomainRequest,
Record,
RecordRequest,
)
from .utils import (
ServiceFactory,
assert_does_exist,
assert_not_exists,
)
... | dominikkowalski/django-powerdns-dnssec | powerdns/tests/test_requests.py | Python | bsd-2-clause | 2,984 |
import os
import csv
import pickle
from indra.literature import id_lookup
from indra.sources import trips, reach, index_cards
from assembly_eval import have_file, run_assembly
if __name__ == '__main__':
pmc_ids = [s.strip() for s in open('pmcids.txt', 'rt').readlines()]
# Load the REACH reading output
wit... | pvtodorov/indra | indra/benchmarks/assembly_eval/combine4/run_combined.py | Python | bsd-2-clause | 1,490 |
from django import template
from django.template.defaultfilters import stringfilter
register = template.Library()
STATUS_COLORS = {
'default': 'blue',
'queued': 'blue',
'undetermined': 'blue',
'infected': 'red',
'uninfected': 'green',
'deposited': 'blue',
'rejected': 'red',
'accepted':... | gustavofonseca/penne-core | frontdesk/templatetags/frontdesk.py | Python | bsd-2-clause | 1,931 |
default_app_config = 'comet.apps.CometIndicatorConfig' | LegoStormtroopr/comet-indicator-registry | comet/__init__.py | Python | bsd-2-clause | 54 |
# Copyright 2012 Energid Technologies
from energid_nlp import logic
GENERATION_PROPOSITION = '$generate'
class Error(Exception):
pass
class Generator:
def __init__(self, kb):
self.kb = kb
def generate_prim(self, concept):
if isinstance(concept, logic.Description):
return self.generate_prim(c... | wiseman/energid_nlp | energid_nlp/generation.py | Python | bsd-2-clause | 1,810 |
"""Magic functions for running cells in various scripts."""
# Copyright (c) IPython Development Team.
# Distributed under the terms of the Modified BSD License.
import errno
import os
import sys
import signal
import time
from subprocess import Popen, PIPE
import atexit
from IPython.core import magic_arguments
from I... | unnikrishnankgs/va | venv/lib/python3.5/site-packages/IPython/core/magics/script.py | Python | bsd-2-clause | 8,835 |
# flake8: NOQA
from . import datasets
from . import evaluations
from . import extensions
from . import models
from . import utils
| start-jsk/jsk_apc | demos/grasp_fusion/grasp_fusion_lib/contrib/grasp_fusion/__init__.py | Python | bsd-3-clause | 131 |
# -*- coding: utf-8 -*-
import collections
import itertools
import json
import os
import posixpath
import re
import time
from operator import attrgetter
from datetime import datetime
from django.conf import settings
from django.core.exceptions import ObjectDoesNotExist
from django.core.files.storage import default_sto... | mstriemer/addons-server | src/olympia/addons/models.py | Python | bsd-3-clause | 80,686 |
# -----------------------------------------------------------------------------
# Copyright (c) 2014--, The Qiita Development Team.
#
# Distributed under the terms of the BSD 3-clause License.
#
# The full license is in the file LICENSE, distributed with this software.
# ------------------------------------------------... | biocore/qiita | qiita_pet/handlers/study_handlers/sample_template.py | Python | bsd-3-clause | 19,340 |
''' Provide special versions of list and dict, that can automatically notify
about changes when used for property values.
Mutations to these values are detected, and the properties owning the
collection is notified of the changes. Consider the following model
definition:
.. code-block:: python
class SomeModel(Mo... | Karel-van-de-Plassche/bokeh | bokeh/core/property/containers.py | Python | bsd-3-clause | 14,792 |
# Copyright (c) 2009-2010 Six Apart Ltd.
# All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions are met:
#
# * Redistributions of source code must retain the above copyright notice,
# this list of conditions an... | mozilla/remoteobjects | remoteobjects/dataobject.py | Python | bsd-3-clause | 9,792 |
# -*- coding: utf-8 -*-
from django import forms
from cms_content.settings import EDITOR
from cms_content.models import CMSArticle
from cms_content import widgets
WIDGET = getattr(widgets, EDITOR)
class CMSArticleAdminForm(forms.ModelForm):
content = forms.CharField(widget=WIDGET)
class Meta:
m... | indexofire/django-cms-content | cms_content_patch/forms.py | Python | bsd-3-clause | 604 |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
#
# Copyright (C) 2014 SWIPO Project
#
# Authors (this file):
# Stefan Schinkel <stefan.schinkel@gmail.com>
"""
Provides sanity checks for basic for parallel and serial circiuts.
"""
import numpy as np
import networkx as nx
from pyunicorn import ResNetwork
from .Resisti... | leftaroundabout/pyunicorn | tests/test_core/TestResitiveNetwork-circuits.py | Python | bsd-3-clause | 6,379 |
"""
====================================================
Imputing missing values before building an estimator
====================================================
Missing values can be replaced by the mean, the median or the most frequent
value using the basic :class:`sklearn.impute.SimpleImputer`.
The median is a mor... | chrsrds/scikit-learn | examples/impute/plot_missing_values.py | Python | bsd-3-clause | 5,503 |
import django.db.models as models
from django.contrib.auth.models import User
from django.utils.translation import ugettext_lazy as _
from django.db.models.signals import post_save
class Profile(models.Model):
"""
parameters we can get from gigya:
birthMonth,isLoggedIn,city,UID,zip,birthYear,state,pro... | MediaSapiens/wavesf | apps/externals/gigyauth/models.py | Python | bsd-3-clause | 1,844 |
import os
import numpy as np
import pytest
from pandas import (
Categorical,
DatetimeIndex,
Interval,
IntervalIndex,
NaT,
Series,
TimedeltaIndex,
Timestamp,
cut,
date_range,
isna,
qcut,
timedelta_range,
)
from pandas.api.types import CategoricalDtype as CDT
from pan... | toobaz/pandas | pandas/tests/reshape/test_qcut.py | Python | bsd-3-clause | 6,328 |
# -*- coding: utf-8 -*-
import csv
import json
from cStringIO import StringIO
from datetime import datetime
from django.conf import settings
from django.core import mail
from django.core.cache import cache
import mock
from pyquery import PyQuery as pq
from olympia import amo
from olympia.amo.tests import TestCase
fr... | andymckay/addons-server | src/olympia/zadmin/tests/test_views.py | Python | bsd-3-clause | 77,618 |
from dasdocc.conf import base | JohnRandom/django-aggregator | dasdocc/conf/staging.py | Python | bsd-3-clause | 29 |
import keyedcache
import logging
log = logging.getLogger(__name__)
class CachedObjectMixin(object):
"""Provides basic object keyedcache for any objects using this as a mixin.
The class name of the object should be unambiguous.
"""
def cache_delete(self, *args, **kwargs):
key = self.cache_key... | aronysidoro/django-livesettings | live/keyedcache/models.py | Python | bsd-3-clause | 2,736 |
# -*- coding: utf-8 -*-
"""
pygments.styles.manni
~~~~~~~~~~~~~~~~~~~~~
A colorful style, inspired by the terminal highlighting style.
This is a port of the style used in the `php port`_ of pygments
by Manni. The style is called 'default' there.
:copyright: Copyright 2006-2019 by the Pygments... | wakatime/wakatime | wakatime/packages/py27/pygments/styles/manni.py | Python | bsd-3-clause | 2,374 |
# ----------------------------------------------------------------------------
# Copyright (c) 2013--, scikit-bio development team.
#
# Distributed under the terms of the Modified BSD License.
#
# The full license is in the file COPYING.txt, distributed with this software.
# --------------------------------------------... | Achuth17/scikit-bio | skbio/io/tests/test_fastq.py | Python | bsd-3-clause | 30,554 |
# encoding: utf-8
import datetime
from south.db import db
from south.v2 import SchemaMigration
from django.db import models
class Migration(SchemaMigration):
def forwards(self, orm):
# Adding field 'UserInfo.avatar'
db.add_column('canvas_userinfo', 'avatar', self.gf('django.db.models.fiel... | canvasnetworks/canvas | website/canvas/migrations/0163_auto__add_field_userinfo_avatar.py | Python | bsd-3-clause | 21,325 |
from statsmodels.compat.python import lzip
import numpy as np
from scipy import stats
from statsmodels.distributions import ECDF
from statsmodels.regression.linear_model import OLS
from statsmodels.tools.decorators import cache_readonly
from statsmodels.tools.tools import add_constant
from . import utils
__all__ = ... | statsmodels/statsmodels | statsmodels/graphics/gofplots.py | Python | bsd-3-clause | 35,607 |
import numpy as np
import pandas as pd
from bokeh.plotting import *
# Define some categories
categories = [
'ousia', 'poson', 'poion', 'pros ti', 'pou',
'pote', 'keisthai', 'echein', 'poiein', 'paschein',
]
# Create data
N = 10
data = { cat : np.random.randint(10, 100, size=N) for cat in categories }
# Defin... | jakevdp/bokeh | sphinx/source/tutorial/exercises/style.py | Python | bsd-3-clause | 2,134 |
"""A module which implements the time-frequency estimation.
Morlet code inspired by Matlab code from Sheraz Khan & Brainstorm & SPM
"""
# Authors : Alexandre Gramfort <alexandre.gramfort@telecom-paristech.fr>
# Hari Bharadwaj <hari@nmr.mgh.harvard.edu>
# Clement Moutard <clement.moutard@polytechniq... | nicproulx/mne-python | mne/time_frequency/tfr.py | Python | bsd-3-clause | 69,456 |
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('cms', '0014_auto_20160404_1908'),
]
operations = [
migrations.AlterField(
model_name='cmsplugin',
name='position',
field=models.PositiveSmallIntegerField... | rsalmaso/django-cms | cms/migrations/0015_auto_20160421_0000.py | Python | bsd-3-clause | 391 |
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.db import models, migrations
def generate_initial_block_types(apps, schema_editor):
User = apps.get_model("auth", "User")
root = User.objects.filter(username="root").first()
if not root:
root = User.objects.filter(usernam... | peterayeni/dash | dash/dashblocks/migrations/0003_auto_20140804_0236.py | Python | bsd-3-clause | 1,506 |
import numpy as np
import tensorflow as tf
import dists
from misc import *
| davmre/bayesflow | elbow/util/__init__.py | Python | bsd-3-clause | 77 |
import ipcalc
from django.db import models
from django.utils.translation import ugettext_lazy as _
from django.core.cache import cache
from django.db.models.signals import post_save, post_delete
class BlockIP(models.Model):
network = models.CharField(_('IP address or mask'), max_length=18)
reason_for_block =... | zhendilin/django-block-ip | block_ip/models.py | Python | bsd-3-clause | 866 |
from datetime import timedelta
import numpy as np
import pytest
import pandas as pd
from pandas import (
Float64Index, Index, Int64Index, NaT, Timedelta, TimedeltaIndex,
timedelta_range)
import pandas.util.testing as tm
class TestTimedeltaIndex(object):
def test_astype_object(self):
idx = timede... | GuessWhoSamFoo/pandas | pandas/tests/indexes/timedeltas/test_astype.py | Python | bsd-3-clause | 4,066 |
'''
Created on Oct 21, 2011
@author: bolme
'''
import time
from collections import defaultdict
import cProfile
import traceback
import shelve
class EmptyData(object):
def __str__(self):
return "<MissingData>"
class DefaultData(object):
def __init__(self,default):
self.default = default
... | mikeseven/pyvision | src/pyvision/beta/vtm.py | Python | bsd-3-clause | 27,866 |
"""
An implementation of OGC WFS 2.0.0 over the top of Django. This module requires that OGR be installed and that you use
either the PostGIS or Spatialite backends to GeoDjango for the layers you are retrieving. The module provides a
generic view, :py:class:WFS that provides standard WFS requests and responses and :p... | hydroshare/hydroshare_temp | ga_ows/views/wfs.py | Python | bsd-3-clause | 31,334 |
# -*- coding: utf-8 -*-
import morepath
from morepath.request import Response
from morepath.authentication import Identity, NO_IDENTITY
from .fixtures import identity_policy
import base64
import json
from webtest import TestApp as Client
try:
from cookielib import CookieJar
except ImportError:
from http.cookiej... | taschini/morepath | morepath/tests/test_security.py | Python | bsd-3-clause | 16,352 |
#!/usr/bin/env python3
# flake8: noqa
import io
import sys
if len (sys.argv) != 5:
print ("""usage: ./gen-use-table.py IndicSyllabicCategory.txt IndicPositionalCategory.txt UnicodeData.txt Blocks.txt
Input file, as of Unicode 12:
* https://unicode.org/Public/UCD/latest/ucd/IndicSyllabicCategory.txt
* https://unicod... | endlessm/chromium-browser | third_party/harfbuzz-ng/src/src/gen-use-table.py | Python | bsd-3-clause | 15,523 |
import re
from decimal import Decimal
from django.conf import settings
from django.contrib.gis.db.backends.base import BaseSpatialOperations
from django.contrib.gis.db.backends.util import SpatialOperation, SpatialFunction
from django.contrib.gis.db.backends.postgis.adapter import PostGISAdapter
from django.contrib.gi... | postrational/django | django/contrib/gis/db/backends/postgis/operations.py | Python | bsd-3-clause | 25,538 |
# -*- coding: utf-8 -*-
import os
import unittest
from manolo_scraper.spiders.mincu import MincuSpider
from utils import fake_response_from_file
class TestMincuSpider(unittest.TestCase):
def setUp(self):
self.spider = MincuSpider()
def test_parse_item(self):
filename = os.path.join('data/mi... | aniversarioperu/django-manolo | scrapers/tests/test_mincu_spider.py | Python | bsd-3-clause | 1,379 |
from flask import Flask
from flask.ext.restful import reqparse, abort, Api, Resource
app = Flask(__name__)
api = Api(app)
TODOS = {
'todo1': {'task': 'build an API'},
'todo2': {'task': '?????'},
'todo3': {'task': 'profit!'},
}
def abort_if_todo_doesnt_exist(todo_id):
if todo_id not in TODOS:
... | CanalTP/flask-restful | examples/todo.py | Python | bsd-3-clause | 1,446 |
from media_tree.contrib.cms_plugins.media_tree_image.models import MediaTreeImage
from media_tree.contrib.cms_plugins.helpers import PluginLink
from media_tree.models import FileNode
from media_tree.contrib.views.detail.image import ImageNodeDetailView
from django.utils.translation import ugettext_lazy as _
from cms.ut... | bittner/django-media-tree | media_tree/contrib/cms_plugins/media_tree_image/views.py | Python | bsd-3-clause | 1,854 |
#!/usr/bin/python
# Copyright (c) 2012 The Native Client Authors. All rights reserved.
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
"""Run all python tests in this directory."""
import sys
import unittest
MODULES = [
'directory_storage_test',
'gsd_stor... | endlessm/chromium-browser | native_client/pynacl/run_pynacl_tests.py | Python | bsd-3-clause | 757 |
#!/usr/bin/env python
import logging
# CUSTOM LOG LEVELS
LOG_LEVEL_TOOL = 25
# Terminal colors
TERMINAL_COLOR_BLUE = '\033[94m'
TERMINAL_COLOR_GREEN = '\033[92m'
TERMINAL_COLOR_YELLOW = '\033[93m'
TERMINAL_COLOR_RED = '\033[91m'
TERMINAL_COLOR_END = '\033[0m'
class ConsoleFormatter(logging.Formatter):
"""
C... | DarKnight24/owtf | framework/lib/formatters.py | Python | bsd-3-clause | 1,857 |
# -*- coding: utf-8 -*-
"""
website.api
~~~~~~~~~~~
website api blueprint.
"""
| alibaba/FlexGW | website/api/__init__.py | Python | bsd-3-clause | 92 |
from cmsplugin_cascade.segmentation.mixins import EmulateUserModelMixin, EmulateUserAdminMixin
from shop.admin.customer import CustomerProxy
class EmulateCustomerModelMixin(EmulateUserModelMixin):
UserModel = CustomerProxy
class EmulateCustomerAdminMixin(EmulateUserAdminMixin):
UserModel = CustomerProxy
| divio/django-shop | shop/cascade/segmentation.py | Python | bsd-3-clause | 317 |
# Copyright 2010-2011, Sikuli.org
# Released under the MIT License.
from org.sikuli.script import VDictProxy
import java.io.File
##
# VDict implements a visual dictionary that has Python's conventional dict
# interfaces.
#
# A visual dictionary is a data type for storing key-value pairs using
# images as keys. Using... | ck1125/sikuli | sikuli-script/src/main/python/sikuli/VDict.py | Python | mit | 3,120 |
# Copyright (c) 2013, Web Notes Technologies Pvt. Ltd.
# MIT License. See license.txt
from __future__ import unicode_literals
"""
Customize Form is a Single DocType used to mask the Property Setter
Thus providing a better UI from user perspective
"""
import webnotes
from webnotes.utils import cstr
class DocType:
... | gangadhar-kadam/sapphite_lib | core/doctype/customize_form/customize_form.py | Python | mit | 8,959 |
from __future__ import absolute_import, unicode_literals
import email
import logging
from email.utils import formataddr
from collections import defaultdict
from django.conf import settings
from django.contrib.auth.models import User
from django.contrib.sites.models import Site
from django.core.urlresolvers import rev... | beol/reviewboard | reviewboard/notifications/email.py | Python | mit | 32,206 |
"""
Copyright 2011 Jeff Garzik
AuthServiceProxy has the following improvements over python-jsonrpc's
ServiceProxy class:
- HTTP connections persist for the life of the AuthServiceProxy object
(if server supports HTTP/1.1)
- sends protocol 'version', per JSON-RPC 1.1
- sends proper, incrementing 'id'
... | bitcoin-hivemind/hivemind | qa/rpc-tests/python-hivemindrpc/hivemindrpc/authproxy.py | Python | mit | 5,785 |
# -*- coding: utf-8 -*-
# Form implementation generated from reading ui file 'acq4/analysis/old/UncagingControlTemplate.ui'
#
# Created by: PyQt5 UI code generator 5.8.2
#
# WARNING! All changes made in this file will be lost!
from PyQt5 import QtCore, QtGui, QtWidgets
class Ui_UncagingControlWidget(object):
def... | campagnola/acq4 | acq4/analysis/old/UncagingControlTemplate_pyqt5.py | Python | mit | 9,306 |
import numpy as np
from keras.datasets import mnist
from keras.layers import Activation
from keras.layers import Dense
from keras.models import Sequential
from keras.utils import np_utils
np.random.seed(1337)
nb_classes = 10
batch_size = 128
nb_epoch = 5
weighted_class = 9
standard_weight = 1
high_weight = 5
max_trai... | farizrahman4u/keras-contrib | keras_contrib/tests/regularizers.py | Python | mit | 1,414 |
import zlib
from test_support import TestFailed
import sys
import imp
try:
t = imp.find_module('test_zlib')
file = t[0]
except ImportError:
file = open(__file__)
buf = file.read() * 8
file.close()
# test the checksums (hex so the test doesn't break on 64-bit machines)
print hex(zlib.crc32('penguin')), hex... | MalloyPower/parsing-python | front-end/testsuite-python-lib/Python-2.2/Lib/test/test_zlib.py | Python | mit | 6,045 |
from django import template
from django.shortcuts import render_to_response, redirect, get_object_or_404
# from product.models import Slide
register = template.Library()
# @register.inclusion_tag('slides/slides.html')
# def get_main_slides():
# slides = Slide.objects.filter(published_main=1).order_by('orde... | skylifewww/pangolin-fog | product/templatetags/category_tags.py | Python | mit | 2,627 |
#-*- encoding:utf-8 -*-
'''
Created on Nov 30, 2014
@author: letian
'''
import networkx as nx
from Segmentation import Segmentation
import numpy as np
class TextRank4Keyword(object):
def __init__(self, stop_words_file = None, delimiters = '?!;?!。;…\n'):
'''
`stop_words_file`:默认值为None,此时内部停止词表... | MSC19950601/TextRank4ZH | textrank4zh/TextRank4Keyword.py | Python | mit | 7,411 |
import numpy
from chainer.backends import cuda
from chainer import function_node
from chainer.utils import type_check
def _pair(x):
if hasattr(x, '__getitem__'):
return x
return x, x
class Shift(function_node.FunctionNode):
def __init__(self, ksize=3, dilate=1):
super(Shift, self).__in... | anaruse/chainer | chainer/functions/connection/shift.py | Python | mit | 4,492 |
# coding: utf-8
# Copyright (c) Pymatgen Development Team.
# Distributed under the terms of the MIT License.
import itertools
import json
import os
import unittest
import numpy as np
from monty.json import MontyDecoder
from pymatgen.core.periodic_table import Element
from pymatgen.core.lattice import Lattice
from p... | richardtran415/pymatgen | pymatgen/analysis/tests/test_structure_matcher.py | Python | mit | 47,994 |
#!/usr/bin/env python3
# Copyright (c) 2016 The Bitcoin Core developers
# Distributed under the MIT software license, see the accompanying
# file COPYING or http://www.opensource.org/licenses/mit-license.php.
"""Test NULLDUMMY softfork.
Connect to a single node.
Generate 2 blocks (save the coinbases for later).
Genera... | isle2983/bitcoin | qa/rpc-tests/nulldummy.py | Python | mit | 6,648 |
# -*- coding: utf-8 -*-
# Copyright (c) 2012 Fabian Barkhau <fabian.barkhau@gmail.com>
# License: MIT (see LICENSE.TXT file)
import os
from django.core.exceptions import PermissionDenied
from apps.gallery.models import Gallery
from apps.gallery.models import Picture
from apps.team.utils import asse... | F483/bikesurf.org | apps/gallery/control.py | Python | mit | 2,303 |
#!/usr/bin/env python3
# Copyright (c) 2017 The Bitcoin Core developers
# Distributed under the MIT software license, see the accompanying
# file COPYING or http://www.opensource.org/licenses/mit-license.php.
"""Test the -uacomment option."""
from test_framework.test_framework import PivxTestFramework
from test_framew... | Mrs-X/PIVX | test/functional/feature_uacomment.py | Python | mit | 1,480 |
# -*- python -*-
# Copyright (C) 2009 Free Software Foundation, 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 License, or
# (at your option) any later version.
#
... | ljnissen/shop_engine | mingw/lib/gcc/mingw32/4.5.2/libstdc++.dll.a-gdb.py | Python | mit | 2,316 |
# $Id: 150_srtp_1_1.py 369517 2012-07-01 17:28:57Z file $
#
from inc_cfg import *
test_param = TestParam(
"Callee=optional SRTP, caller=optional SRTP",
[
InstanceParam("callee", "--null-audio --use-srtp=1 --srtp-secure=0 --max-calls=1"),
InstanceParam("caller", "--null-audio --use-srtp=1 --srtp-secure=0 --ma... | fluentstream/asterisk-p2p | res/pjproject/tests/pjsua/scripts-call/150_srtp_1_1.py | Python | gpl-2.0 | 340 |
# This file is part of Buildbot. Buildbot 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, version 2.
#
# This program is distributed in the hope that it will be useful, but WITHOUT
# ANY WARRANTY; without eve... | tardyp/buildbot | master/buildbot/test/integration/test_worker_comm.py | Python | gpl-2.0 | 13,868 |
"""Tests for the unparse.py script in the Tools/parser directory."""
import unittest
import test.support
import io
import os
import random
import tokenize
import ast
from test.test_tools import basepath, toolsdir, skip_if_missing
skip_if_missing()
parser_path = os.path.join(toolsdir, "parser")
with test.support.Di... | FFMG/myoddweb.piger | monitor/api/python/Python-3.7.2/Lib/test/test_tools/test_unparse.py | Python | gpl-2.0 | 8,393 |
#!/usr/bin/env python
# Licensed to the Apache Software Foundation (ASF) under one
# or more contributor license agreements. See the NOTICE file
# distributed with this work for additional information
# regarding copyright ownership. The ASF licenses this file
# to you under the Apache License, Version 2.0 (the
... | ikoula/cloudstack | test/integration/component/test_affinity_groups_projects.py | Python | gpl-2.0 | 41,778 |
"""Support functions for loading the reference count data file."""
__version__ = '$Revision: 1.2 $'
import os
import string
import sys
# Determine the expected location of the reference count file:
try:
p = os.path.dirname(__file__)
except NameError:
p = sys.path[0]
p = os.path.normpath(os.path.join(os.getcw... | atmark-techno/atmark-dist | user/python/Doc/tools/refcounts.py | Python | gpl-2.0 | 2,236 |
#!/usr/bin/env python
from runtest import TestBase
class TestCase(TestBase):
def __init__(self):
TestBase.__init__(self, 'float-libcall', result="""
# DURATION TID FUNCTION
[18276] | main() {
0.371 ms [18276] | expf(1.000000) = 2.718282;
0.118 ms [18276] | log(2.718282) = 1.00... | namhyung/uftrace | tests/t198_lib_arg_float.py | Python | gpl-2.0 | 799 |
# -*- coding: utf-8 -*-
"""QGIS Unit tests for core additions
.. note:: This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.
"""
__a... | raymondnijssen/QGIS | tests/src/python/test_core_additions.py | Python | gpl-2.0 | 1,581 |
###########################################################################
#
# This program is part of Zenoss Core, an open source monitoring platform.
# Copyright (C) 2009, Zenoss Inc.
#
# This program is free software; you can redistribute it and/or modify it
# under the terms of the GNU General Public License versi... | zenoss/ZenPacks.community.VMwareESXMonitor | ZenPacks/community/VMwareESXMonitor/modeler/plugins/zenoss/snmp/Esx.py | Python | gpl-2.0 | 1,873 |
#-----------------------------------------------------------------------------
#remove duplicates v1.3
#best way to remove duplicates, just select the objects you want the duplicates removed, then run this scrpit
import bpy
for obj in bpy.context.selected_objects:
if obj.type == 'MESH':
bpy.data.scenes[0]... | infobeisel/polyvr | extras/blender_scripts/remove_double_vertices_and_faces.py | Python | gpl-3.0 | 2,067 |
# ========================================================================
# Copyright (c) 2007, Metaweb Technologies, Inc.
# All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions
# are met:
# * Redistribution... | artzub/code_swarm-gource-my-conf | tools/codeswarm/lib/freebase/api/session.py | Python | gpl-3.0 | 17,231 |
#!/usr/bin/env python
import argparse
import os
import sys
import math
import pyRootPwa
import pyRootPwa.core
def writeParticleToFile (outFile, particleName, particleMomentum):
if pyRootPwa.core.particleDataTable.isInTable(particleName):
partProperties = pyRootPwa.core.particleDataTable.entry(particleName)
char... | legordian/ROOTPWA | pyInterface/scripts/convertTreeToEvt.py | Python | gpl-3.0 | 3,620 |
#-*- coding: utf-8 -*-
'''
Created on 24 дек. 20%0
@author: ivan
'''
import random
all_agents = """
Mozilla/5.0 (X11; U; Linux x86_64; en-US; rv:1.9.1.3) Gecko/20090913 Firefox/3.5.3
Mozilla/5.0 (Windows; U; Windows NT 6.1; en; rv:1.9.1.3) Gecko/20090824 Firefox/3.5.3 (.NET CLR 3.5.30729)
Mozilla/5.0 (Windows; U; Win... | sitexa/foobnix | foobnix/util/agent.py | Python | gpl-3.0 | 1,349 |
import os
import numpy as np
from vrml.vrml97 import basenodes, nodetypes, parser, parseprocessor
class VRML_Loader(object):
"""
Parser for VRML files. The VRML language is described in its specification
at http://www.web3d.org/documents/specifications/14772/V2.0/index.html
"""
def __init__(self, ... | timvandermeij/mobile-radio-tomography | environment/VRML_Loader.py | Python | gpl-3.0 | 4,378 |
import sys
import numpy as np
from scipy import stats
import subprocess as sp
import datetime
import socket
import os
exec_name = sys.argv[1]
max_t = int(sys.argv[2])
ntries = 5
tot_timings = []
for t_idx in range(1,max_t + 1):
cur_timings = []
for _ in range(ntries):
# Run the process.
p = sp.Popen([exec_nam... | darioizzo/piranha | tools/benchmark.py | Python | gpl-3.0 | 911 |
# Copyright 2016 Google Inc. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or ... | GirlsCodePy/girlscode-coursebuilder | modules/courses/courses_integration_tests.py | Python | gpl-3.0 | 1,816 |
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.db import models, migrations
class Migration(migrations.Migration):
dependencies = [
('libreosteoweb', '0018_auto_20150420_1232'),
]
operations = [
migrations.AlterField(
model_name='regulardoctor',
... | littlejo/Libreosteo | libreosteoweb/migrations/0019_auto_20150420_1821.py | Python | gpl-3.0 | 460 |
import boto,sys,euca_admin
from boto.exception import EC2ResponseError
from euca_admin.generic import BooleanResponse
from euca_admin.generic import StringList
from boto.resultset import ResultSet
from euca_admin import EucaAdmin
from optparse import OptionParser
SERVICE_PATH = '/services/Accounts'
class Group():
... | Shebella/HIPPO | clc/tools/src/euca_admin/groups.py | Python | gpl-3.0 | 2,776 |
#!/usr/bin/env python
# vim:fileencoding=utf-8
from __future__ import (unicode_literals, division, absolute_import,
print_function)
__license__ = 'GPL v3'
__copyright__ = '2014, Kovid Goyal <kovid at kovidgoyal.net>'
from tinycss.css21 import CSS21Parser
from tinycss.parsing import remove_whit... | nozuono/calibre-webserver | src/tinycss/media3.py | Python | gpl-3.0 | 4,645 |
from south.db import db
from django.db import models
from transifex.releases.models import *
class Migration:
def forwards(self, orm):
"Write your forwards migration here"
def backwards(self, orm):
"Write your backwards migration here"
models = {
}
complete_apps = ['releases... | tymofij/adofex | transifex/releases/migrations/0001_initial.py | Python | gpl-3.0 | 323 |
# Copyright (c) 2019, Frappe Technologies Pvt. Ltd. and contributors
# For license information, please see license.txt
# import frappe
from frappe.model.document import Document
class QualityReviewObjective(Document):
pass
| frappe/erpnext | erpnext/quality_management/doctype/quality_review_objective/quality_review_objective.py | Python | gpl-3.0 | 228 |
# encoding: utf-8
import datetime
from south.db import db
from south.v2 import DataMigration
from django.db import models
class Migration(DataMigration):
def forwards(self, orm):
# Deleting field id
db.delete_column('layers_layer', 'id')
# set new primary key for layers_layer
db.cr... | GISPPU/GrenadaLandInformation | geonode/layers/migrations/0010_remove_unneeded_objects.py | Python | gpl-3.0 | 20,864 |
from nose.tools import eq_, with_setup
from threading import Thread
from Queue import Queue
from time import sleep
def setup():
global Person, neo4django, gdb, neo4jrestclient, neo_constants, settings, models
from neo4django.tests import Person, neo4django, gdb, neo4jrestclient, \
neo_constants, ... | coffenbacher/neo4django | neo4django/tests/synchronicity_tests.py | Python | gpl-3.0 | 2,374 |
# coding=utf-8
__author__ = "Gina Häußge <osd@foosel.net>"
__license__ = 'GNU Affero General Public License http://www.gnu.org/licenses/agpl.html'
from flask import request, jsonify, make_response
import re
from octoprint.settings import settings, valid_boolean_trues
from octoprint.server import printer, restricted_a... | C-o-r-E/OctoPrint | src/octoprint/server/api/printer.py | Python | agpl-3.0 | 9,354 |
#!/usr/bin/python
#
# \file 0_setup.py
# \brief Setup rbank
# \date 2009-03-10-22-43-GMT
# \author Jan Boon (Kaetemi)
# Python port of game data build pipeline.
# Setup rbank
#
# NeL - MMORPG Framework <http://dev.ryzom.com/projects/nel/>
# Copyright (C) 2010 Winch Gate Property Limited
#
# This program is free soft... | osgcc/ryzom | nel/tools/build_gamedata/processes/rbank/0_setup.py | Python | agpl-3.0 | 2,998 |
# This file is part of Navitia,
# the software to build cool stuff with public transport.
#
# Hope you'll enjoy and contribute to this project,
# powered by Canal TP (www.canaltp.fr).
# Help us simplify mobility and open public transport:
# a non ending quest to the responsive locomotion way of traveling!
#... | xlqian/navitia | source/jormungandr/jormungandr/interfaces/v1/decorators.py | Python | agpl-3.0 | 1,461 |
#!/usr/bin/env python
from django.core.management import call_command
from django.core.management.base import BaseCommand
class Command(BaseCommand):
def handle(self, *args, **options):
call_command(
'dumpdata',
"waffle.flag",
indent=4,
use_natural_foreign_k... | uclouvain/OSIS-Louvain | base/management/commands/dump_waffle_flags.py | Python | agpl-3.0 | 436 |
#!/usr/bin/python
# -*- coding: utf-8 -*-
##
# ipy.py: Interaction with IPython and Jupyter.
##
# © 2016 Chris Ferrie (csferrie@gmail.com) and
# Christopher E. Granade (cgranade@gmail.com)
#
# This file is a part of the Qinfer project.
# Licensed under the AGPL version 3.
##
# This program is free software:... | MichalKononenko/python-qinfer | src/qinfer/ipy.py | Python | agpl-3.0 | 3,141 |
# -*- encoding: utf-8 -*-
###############################################################################
#
# OpenERP, Open Source Management Solution
# Copyright (C) 2013 Savoir-faire Linux (<http://www.savoirfairelinux.com>).
#
# This program is free software: you can redistribute it and/or modify
# it un... | bwrsandman/openerp-hr | hr_language/hr_language.py | Python | agpl-3.0 | 1,839 |
#!/usr/bin/python
# -*- coding: utf-8 -*-
##
# distributions.py: module for probability distributions.
##
# © 2017, Chris Ferrie (csferrie@gmail.com) and
# Christopher Granade (cgranade@cgranade.com).
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided t... | csferrie/python-qinfer | src/qinfer/distributions.py | Python | agpl-3.0 | 51,767 |
# 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 PerlWwwRobotrules(PerlPackage):
"""Database of robots.txt-derived permissions"""
home... | iulian787/spack | var/spack/repos/builtin/packages/perl-www-robotrules/package.py | Python | lgpl-2.1 | 637 |
"""a readline console module (unix only).
maxime.tournier@brain.riken.jp
the module starts a subprocess for the readline console and
communicates through pipes (prompt/cmd).
the console is polled through a timer, which depends on PySide.
"""
from select import select
import os
import sys
import signal
if __name_... | FabienPean/sofa | applications/plugins/SofaPython/python/SofaPython/console.py | Python | lgpl-2.1 | 5,349 |
##############################################################################
# Copyright (c) 2013-2018, Lawrence Livermore National Security, LLC.
# Produced at the Lawrence Livermore National Laboratory.
#
# This file is part of Spack.
# Created by Todd Gamblin, tgamblin@llnl.gov, All rights reserved.
# LLNL-CODE-64... | EmreAtes/spack | var/spack/repos/builtin/packages/libiconv/package.py | Python | lgpl-2.1 | 2,156 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.