text stringlengths 6 947k | repo_name stringlengths 5 100 | path stringlengths 4 231 | language stringclasses 1
value | license stringclasses 15
values | size int64 6 947k | score float64 0 0.34 |
|---|---|---|---|---|---|---|
"""combine URL Configuration
The `urlpatterns` list routes URLs to views. For more information please see:
https://docs.djangoproject.com/en/1.11/topics/http/urls/
Examples:
Function views
1. Add an import: from my_app import views
2. Add a URL to urlpatterns: url(r'^$', views.home, name='home')
Class-ba... | WSULib/combine | combine/urls.py | Python | mit | 818 | 0 |
# -*- coding: UTF-8 -*-
from django.contrib import admin
from django.db import models
from django_markdown.admin import MarkdownModelAdmin, AdminMarkdownWidget
from django_markdown.models import MarkdownField
from happenings.models import Event as HappeningsEvent
from happenings.admin import EventAdmin as HappeningsEve... | hacklab-fi/hhlevents | hhlevents/apps/hhlregistrations/admin.py | Python | bsd-3-clause | 2,455 | 0.003666 |
# -*- coding: utf-8 -*-
from django.contrib import admin
from django.utils.translation import ugettext_lazy as _
from mptt.admin import MPTTModelAdmin
from .models import Channel
from .forms import ChannelAdminForm
from opps.core.admin import PublishableAdmin
from opps.core.admin import apply_opps_rules
from opps.cor... | jeanmask/opps | opps/channels/admin.py | Python | mit | 3,690 | 0.000813 |
from django import template
from django.template.loader import render_to_string
from django.conf import settings
from ..utils import get_tag_id, set_lazy_tag_data
register = template.Library()
@register.simple_tag
def lazy_tag(tag, *args, **kwargs):
"""
Lazily loads a template tag after the page has loaded... | grantmcconnaughey/django-lazy-tags | lazy_tags/templatetags/lazy_tags.py | Python | mit | 2,029 | 0 |
# The Hazard Library
# Copyright (C) 2012 GEM Foundation
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU Affero General Public License as
# published by the Free Software Foundation, either version 3 of the
# License, or (at your option) any later version.
#
# Th... | ROB-Seismology/oq-hazardlib | openquake/hazardlib/tests/acceptance/disagg_test.py | Python | agpl-3.0 | 10,965 | 0.00073 |
#! /usr/bin/env python
## -*- Mode: python; py-indent-offset: 4; indent-tabs-mode: nil; coding: utf-8; -*-
#
# Copyright (c) 2014 Siddharth Santurkar
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License version 2 as
# published by the Free Softw... | bijaydev/Implementation-of-Explicit-congestion-notification-ECN-in-TCP-over-wireless-network-in-ns-3 | utils/tests/test-waf.py | Python | gpl-2.0 | 7,623 | 0.005903 |
#
# 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... | wileeam/airflow | airflow/contrib/operators/bigquery_to_gcs.py | Python | apache-2.0 | 1,678 | 0.00298 |
# 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... | allenlavoie/tensorflow | tensorflow/python/training/warm_starting_util.py | Python | apache-2.0 | 15,397 | 0.004287 |
import fnmatch
import os
import shlex
def autoCompleteList(text, items):
if not text:
completions = items
else:
completions = [item for item in items if item.lower().startswith(text.lower())]
return completions
def containsAny(string, chars):
return True in [char in string for char in... | iLoop2/ResInsight | ThirdParty/Ert/devel/python/python/ert_gui/shell/shell_tools.py | Python | gpl-3.0 | 2,275 | 0.004396 |
# 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,... | froyobin/ironic | ironic/conductor/utils.py | Python | apache-2.0 | 6,324 | 0.000316 |
"""
Data processing for VisualWordLSTM happens here; this creates a class that
acts as a data generator/feed for model training.
"""
from __future__ import print_function
from collections import defaultdict
import cPickle
import h5py
import logging
import numpy as np
np.set_printoptions(threshold='nan')
import os
impo... | elliottd/GroundedTranslation | data_generator.py | Python | bsd-3-clause | 36,237 | 0.003229 |
# Copyright 2017 DT42
#
# This file is part of BerryNet.
#
# BerryNet 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.
#
# BerryNet is d... | DT42/BerryNet | berrynet/service/movidius_service.py | Python | gpl-3.0 | 5,991 | 0.000501 |
import sys
#from functools import partial
from PyQt4 import QtCore, QtGui
from PyQt4.Qt import *
from ome_globals import *
import ui_histogram_dataselect_page
class HistogramDataSelectPage(QWizardPage, ui_histogram_dataselect_page.Ui_WizardPage):
def __init__(self, model, prev_hist_var=None, parent=None):
... | gdietz/OpenMEE | common_wizard_pages/histogram_dataselect_page.py | Python | gpl-3.0 | 1,558 | 0.009628 |
# coding:utf-8
'''
Author : qbeenslee
Created : 2015/1/20
'''
import json
import datetime
JSON_PARSE_ERROR = u"{'success':0,'data':[],'message':'Json 解析错误'}"
class NeJSONEncoder(json.JSONEncoder):
""" Wrapper class to try calling an object's tojson() method. This allows us to JSONify objects comi... | qbeenslee/Nepenthes-Server | utils/jsonutil.py | Python | gpl-3.0 | 1,193 | 0.00172 |
# -*- coding: utf-8 -*-
# Part of Odoo. See LICENSE file for full copyright and licensing details.
from openerp import models, api
class ir_translation(models.Model):
_inherit = 'ir.translation'
@api.model
def _get_terms_mapping(self, field, records):
if self._context.get('edit_translations'):
... | minhphung171093/GreenERP | openerp/addons/web_editor/models/ir_translation.py | Python | gpl-3.0 | 578 | 0.00346 |
a = (1, 2)
b = (1, 3, 5, 7, 8, 11)
print a[0]
#b[3] = 3 # error!
x1 = a[0]
y1 = a[1]
x1, y1 = a
b1, b2, b3, b4, b5, b6 = b
print b4
#b1, b2 = b # error!
a = 1, 2, 3
print a
def f():
return 1, 3
a = f()
x, y = f()
x = f()[0]
| amiraliakbari/sharif-mabani-python | by-session/ta-921/j8/tuple1.py | Python | mit | 263 | 0.011407 |
# import argcomplete
# import httplib
# import logging
# import simplejson
# import sys
# import urllib2
# from time import strftime, localtime
# from conpaas.core import https
# from .base import BaseClient
# from .config import config
# from .service import ServiceCmd
# MODES = ['DEMO', 'REAL']
# TASKFARM_MNG_POR... | ConPaaS-team/conpaas | cps-tools/src/cps_tools/taskfarm.py | Python | bsd-3-clause | 10,346 | 0.002513 |
__author__ = 'emre'
print "hello world" | ekutlu/raspberry-test | test.py | Python | mit | 40 | 0.025 |
from django.conf.urls import patterns, include, url
from django.contrib import admin
from django.conf import settings
urlpatterns = patterns('',
# Examples:
# url(r'^$', 'webapp.views.home', name='home'),
# url(r'^blog/', include('blog.urls')),
url(r"", include("meeting.urls", namespace = "meeting")),
url(r'... | TunedMystic/taskr | webapp/urls.py | Python | gpl-2.0 | 434 | 0.013825 |
#! /usr/bin/env python
import random
import utilities
def read_nodes_from_training(file_name):
"""
Returns a list of all the nodes in the graph
"""
node_set = set()
for nodes in utilities.edges_generator(file_name):
for node in nodes:
node_set.add(node)
return list(node_s... | ameyavilankar/social-network-recommendation | preprocessing/random_benchmark.py | Python | bsd-2-clause | 1,033 | 0.006776 |
import lda
from flask import Flask, abort, request
app = Flask(__name__, static_url_path='')
@app.route('/td/items', methods=['GET'])
def items():
document, status, headers = lda.get_virtual_container(request.environ, 'ce_item_of')
if status != 200:
abort(status)
document, headers = lda.convert_to... | ld4apps/lda-examples | todo-flask/src/app.py | Python | apache-2.0 | 1,842 | 0.008143 |
# Copyright (c) 2015, Frappe Technologies Pvt. Ltd. and Contributors
# MIT License. See license.txt
from __future__ import unicode_literals
import frappe
from frappe.model.document import Document
class DefaultValue(Document):
pass
def on_doctype_update():
"""Create indexes for `tabDefaultValue` on `(parent, defk... | vjFaLk/frappe | frappe/core/doctype/defaultvalue/defaultvalue.py | Python | mit | 607 | 0.021417 |
import json
import pytest
from common.utils.attack_utils import ScanStatus
from infection_monkey.model import VictimHost
from infection_monkey.telemetry.attack.t1197_telem import T1197Telem
DOMAIN_NAME = "domain-name"
IP = "127.0.0.1"
MACHINE = VictimHost(IP, DOMAIN_NAME)
STATUS = ScanStatus.USED
USAGE_STR = "[Usage... | guardicore/monkey | monkey/tests/unit_tests/infection_monkey/telemetry/attack/test_t1197_telem.py | Python | gpl-3.0 | 917 | 0.001091 |
# -*- coding:utf-8 -*-
from django.shortcuts import render
def index(request):
return render(request, 'djign/index.html') | ghilbut/djign | djign/__init__.py | Python | mit | 128 | 0.023438 |
import json
import math
import sys
import threading
import traceback
import time
import uuid
from pika import BasicProperties
from pika.exceptions import ConnectionClosed, ChannelClosed, IncompatibleProtocolError
from ...helper import log, debug_mode_enabled
from ...model import Message, RemoteSignal
fro... | shiroyuki/vireo | vireo/drivers/amqp/consumer.py | Python | mit | 24,473 | 0.010256 |
# -*- coding: utf-8 -*-
##############################################################################
#
# OpenERP, Open Source Management Solution
# Copyright (C) 2004-2010 Tiny SPRL (<http://tiny.be>).
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU... | titasakgm/brc-stock | openerp/addons/ineco_stock/product.py | Python | agpl-3.0 | 5,430 | 0.009024 |
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('wagtailmenus', '0009_auto_20160201_0859'),
]
operations = [
migrations.RenameField(
model_name='mainmenuitem',
... | rkhleics/wagtailmenus | wagtailmenus/migrations/0010_auto_20160201_1558.py | Python | mit | 408 | 0 |
# flake8: noqa
"""Settings to be used for running tests."""
from settings import *
INSTALLED_APPS.append('integration_tests')
DATABASES = {
"default": {
"ENGINE": "django.db.backends.sqlite3",
"NAME": ":memory:",
}
}
EMAIL_SUBJECT_PREFIX = '[test] '
EMAIL_BACKEND = 'django.core.mail.backend... | bitmazk/webfaction-django-boilerplate | website/webapps/django/project/settings/test_settings.py | Python | mit | 371 | 0 |
# Copyright 2012 Nebula, 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 agree... | Crystal-SDS/dashboard | crystal_dashboard/dashboards/crystal/containers/browsers.py | Python | gpl-3.0 | 1,168 | 0 |
#!/usr/bin/python
#
# This file is part of Ansible
#
# Ansible 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.
#
# Ansible is distribut... | cmelange/ansible | lib/ansible/modules/network/nxos/nxos_vlan.py | Python | gpl-3.0 | 13,912 | 0.001509 |
import optparse
class CLI:
pass
CLI.parser = optparse.OptionParser()
CLI.parser.add_option("-q", "--queries", dest="queries", help="Queries csv file", metavar="FILE")
CLI.parser.add_option("-l", "--logs", dest="logs", help="Path to log files containing directory", metavar="DIR")
CLI.parser.add_option("-r", "--resu... | fire-uta/iiix-data-parser | cli.py | Python | mit | 1,078 | 0.008349 |
from __future__ import absolute_import
import socket
import types
from collections import defaultdict
from itertools import count
from kombu import Connection, Exchange, Queue, Consumer, Producer
from kombu.exceptions import InconsistencyError, VersionMismatch
from kombu.five import Empty, Queue as _Queue
from kombu... | jindongh/kombu | kombu/tests/transport/test_redis.py | Python | bsd-3-clause | 40,008 | 0.000025 |
import csv
import math
from CSHLDAP import CSHLDAP #get this from the wiki
from subprocess import call
your_gender_list = []
with open('match_scores.csv', 'rb') as f:
reader = csv.reader(f)
your_gender_list = list(reader)
print(your_gender_list)
tempList = [0] * len(your_gender_list)
peopleList = [... | sherrardTr4129/FaceHarold | getCSVData.py | Python | mit | 2,092 | 0.010516 |
import functools
import itertools
import logging
import re
import urlparse
import warnings
import bson
from django.db.models import Q
from dirtyfields import DirtyFieldsMixin
from django.apps import apps
from django.contrib.contenttypes.fields import GenericRelation
from django.core.paginator import Paginator
from dja... | leb2dg/osf.io | osf/models/node.py | Python | apache-2.0 | 117,415 | 0.001823 |
class Solution:
"""
@param: nums: A list of integers
@return: A integer indicate the sum of max subarray
"""
def maxSubArray(self, nums):
# write your code here
if not nums or len(nums) == 0: return 0
cur = res = nums[0]
for i in xrange(1, len(nums)):
... | shawncaojob/LC | LINTCODE/41_maximum_subarray.py | Python | gpl-3.0 | 410 | 0.004878 |
# -*- 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
from .publis... | plamut/superdesk | server/apps/publish/content/__init__.py | Python | agpl-3.0 | 524 | 0 |
import unittest
from openmdao.main.api import VariableTree, Component, Assembly
from openmdao.main.datatypes.api import Float, VarTree
class VT(VariableTree):
x = Float()
class C(Component):
x = Float(iotype='in')
out = Float(iotype='out')
def execute(self):
self.out = 2 * self.x
class A... | DailyActie/Surrogate-Model | 01-codes/OpenMDAO-Framework-dev/openmdao.main/src/openmdao/main/test/test_aningvtree.py | Python | mit | 742 | 0 |
# -*- coding: utf-8 -*-
#!/usr/bin/env python
import webapp2,jinja2,os
import logging
import wowapi
from datetime import datetime
from google.appengine.ext import ndb
from google.appengine.api.memcache import Client
from google.appengine.api import taskqueue
from google.appengine.api.taskqueue import Queue
from goog... | AndyHannon/ctrprogress | ranker.py | Python | mit | 11,305 | 0.008138 |
#!/usr/bin/env python3
# Copyright 2014, 2015, 2017 Endless Mobile, Inc.
# This file is part of eos-event-recorder-daemon.
#
# eos-event-recorder-daemon 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... | endlessm/eos-event-recorder-daemon | tests/test-opt-out-integration.py | Python | gpl-2.0 | 8,113 | 0.002588 |
from __future__ import unicode_literals
import boto
import copy
import itertools
import re
import six
from collections import defaultdict
from datetime import datetime
from boto.ec2.instance import Instance as BotoInstance, Reservation
from boto.ec2.blockdevicemapping import BlockDeviceMapping, BlockDeviceType
from b... | mrucci/moto | moto/ec2/models.py | Python | apache-2.0 | 121,494 | 0.001523 |
#!/usr/bin/env python
"""
Make a pie chart where peaks fall in annotations; see \
:mod:`pybedtools.contrib.Classifier` for more flexibility.
The results here are similar to CEAS (http://liulab.dfci.harvard.edu/CEAS/).
However, multi-featuretype classes are reported. That is, if a peak falls in
an exon in one isoform... | jos4uke/getSeqFlankBlatHit | lib/python2.7/site-packages/pybedtools/scripts/peak_pie.py | Python | gpl-2.0 | 5,681 | 0.000176 |
"""
Tests for gravity-style spatial interaction models
Test data is the Austria migration dataset used in Dennet's (2012) practical primer
on spatial interaction modeling. The data was made avialable through the
following dropbox link: http://dl.dropbox.com/u/8649795/AT_Austria.csv.
The data has been pre-filtered so ... | TaylorOshan/spint | spint/tests/test_gravity.py | Python | bsd-3-clause | 67,670 | 0.004699 |
__version__ = "0.2.7"
from pypushover.Constants import PRIORITIES, SOUNDS, OS
from pypushover._base import BaseManager, send, base_url, PushoverError
from pypushover import client, groups, license, message, verification
__all__ = ['PRIORITIES', 'SOUNDS', 'OS', 'client', 'groups', 'license', 'message', 'verification'... | KronosKoderS/py_pushover | pypushover/__init__.py | Python | mit | 324 | 0.006173 |
# coding=utf-8
"""InaSAFE Disaster risk tool by Australian Aid - Volcano Point on
Population Impact Function.
Contact : ole.moller.nielsen@gmail.com
.. 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 So... | Samweli/inasafe | safe/impact_functions/volcanic/volcano_point_population/impact_function.py | Python | gpl-3.0 | 8,892 | 0 |
__author__ = 'shinyorke_mbp'
| Shinichi-Nakagawa/xp2015_baseball_tools | service/__init__.py | Python | mit | 29 | 0 |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
# test_cancel.py - unit test for query cancellation
#
# Copyright (C) 2010-2011 Jan Urbański <wulczer@wulczer.org>
#
# psycopg2 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 Free... | nwokeo/supysonic | venv/lib/python2.7/site-packages/psycopg2/tests/test_cancel.py | Python | agpl-3.0 | 3,785 | 0.000264 |
# type: ignore
#
# Inthe.AM documentation build configuration file, created by
# sphinx-quickstart on Sat Sep 13 15:53:25 2014.
#
# 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.
#
# All confi... | coddingtonbear/inthe.am | docs/conf.py | Python | agpl-3.0 | 8,300 | 0.000602 |
x = lambda x: (lambda x: (lambda x: x + 2)(x+2))(x+2)
print x(2)
| buchuki/pyjaco | tests/basic/lambda2.py | Python | mit | 67 | 0.014925 |
import unittest
from mistletoe.span_token import tokenize_inner
from mistletoe.latex_token import Math
from mistletoe.latex_renderer import LaTeXRenderer
class TestLaTeXToken(unittest.TestCase):
def setUp(self):
self.renderer = LaTeXRenderer()
self.renderer.__enter__()
self.addCleanup(self... | miyuchina/mistletoe | test/test_latex_token.py | Python | mit | 544 | 0 |
import collections.abc
import copy
import datetime
import decimal
import math
import operator
import uuid
import warnings
from base64 import b64decode, b64encode
from functools import partialmethod, total_ordering
from django import forms
from django.apps import apps
from django.conf import settings
from django.core i... | ar4s/django | django/db/models/fields/__init__.py | Python | bsd-3-clause | 90,874 | 0.000694 |
#!/usr/bin/env python
# Copyright (c) 2012 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.
"""Moves a C++ file to a new location, updating any include paths that
point to it, and re-ordering headers as needed. Updates inc... | zcbenz/cefode-chromium | tools/git/move_source_file.py | Python | bsd-3-clause | 5,348 | 0.010845 |
#! /usr/bin/env python
import unittest
import time
from Communication import Communication
class CommunicationTest(unittest.TestCase):
def setUp(self):
'''
Verify environment is setup properly.
'''
self.controller = Communication()
self.b_list = self.controller.get_blu... | mparra-mpz/CURIOSITY | CURIOSITY/test/CommunicationTest.py | Python | gpl-2.0 | 1,149 | 0.007833 |
from numpy import *
from matplotlib import pyplot
import scripts.skewtools as st
import sys
X,Y,t,Pe = st.importDatasets(sys.argv[1],'X','Y','Time','Peclet')
figscale = 5.
fig,ax = pyplot.subplots(1,1,figsize=(4*figscale,figscale))
uwall = 2./3.
xmax = X.max() + uwall*Pe*t[-1]
for i in range(len(t)):
#for i in [5... | maminian/skewtools | scripts/animate_particles_2d_labframe.py | Python | gpl-3.0 | 1,101 | 0.070845 |
#
# Copyright 2015 Quantopian, 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... | wilsonkichoi/zipline | zipline/sources/data_frame_source.py | Python | apache-2.0 | 5,146 | 0 |
#-----------------------------------------------------------------------------
# Copyright (c) 2010 Justin Riley
#
# Distributed under the terms of the New BSD License. The full license is in
# the file COPYING.BSD, distributed as part of this software.
#-------------------------------------------------------------... | mgadi/naemonbox | sources/psdash/pyzmq-13.1.0/examples/mongodb/controller.py | Python | gpl-2.0 | 3,050 | 0.003934 |
import os
from conda_build import api
from conda_build import render
def test_output_with_noarch_says_noarch(testing_metadata):
testing_metadata.meta['build']['noarch'] = 'python'
output = api.get_output_file_path(testing_metadata)
assert os.path.sep + "noarch" + os.path.sep in output[0]
def test_outpu... | pelson/conda-build | tests/test_render.py | Python | bsd-3-clause | 1,460 | 0.000685 |
# Copyright 2014, Rackspace, US, Inc.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in w... | openstack/horizon | openstack_dashboard/test/unit/api/rest/test_keystone.py | Python | apache-2.0 | 37,897 | 0 |
# -*- coding: utf-8 -*-
from __future__ import with_statement
import copy
from django.db import connection
from cms.api import create_page
from cms.menu import CMSMenu, get_visible_pages
from cms.models import Page
from cms.models.permissionmodels import GlobalPagePermission, PagePermission
from cms.test_utils.fixtures... | datakortet/django-cms | cms/tests/menu.py | Python | bsd-3-clause | 52,671 | 0.001956 |
# -*- coding: utf-8 -*-
# leapbackend.py
# Copyright (C) 2013 LEAP
#
# 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.
#
#... | meskio/bitmask_client | src/leap/bitmask/backend/leapbackend.py | Python | gpl-3.0 | 20,848 | 0 |
import sys
__author__ = "ilausuch"
__date__ = "$13-jun-2017 20:05:19$"
sys.path.append( "../Addons" )
from Client import Client
from Timer import Timer
count=1000
def test1():
print ("Test 1: Multiple entry set same connection (count={0})".format(count))
client = Client("localhost", 10001)
t... | ilausuch/CacheServer | src/test/testServer_speed.py | Python | mit | 1,247 | 0.035285 |
# -*- coding: utf-8 -*-
# Copyright 2020 Google 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... | googleapis/python-dialogflow | samples/generated_samples/dialogflow_generated_dialogflow_v2_versions_create_version_async.py | Python | apache-2.0 | 1,488 | 0.000672 |
#!/usr/bin/env python3
# coding: utf-8
import sys
class Solution:
def findPaths(self, m, n, N, i, j):
"""
:type m: int
:type n: int
:type N: int
:type i: int
:type j: int
:rtype: int
"""
if N == 0:
return 0
from collectio... | feigaochn/leetcode | p576_out_of_boundary_paths.py | Python | mit | 1,552 | 0 |
from __future__ import unicode_literals
from django.db import models
from django.utils.translation import ugettext_lazy as _
IMPORTANT_FIELD_GUESSES = ['id', 'pk', 'name', 'last', 'first', 'full_name', 'summary', 'description', 'user', 'person']
def representation(model, field_names=[], max_fields=None):
"""Uni... | totalgood/twote | twote/model_utils.py | Python | mit | 2,398 | 0.003336 |
"""
Module: plugin.py
Author: Rinke Hoekstra
Created: 2 October 2012
Copyright (c) 2012, Rinke Hoekstra, VU University Amsterdam
http://github.com/Data2Semantics/linkitup
"""
from flask.ext.login import login_required
import re
from linkitup import app
from linkitup.util.baseplugin import plugin, SPARQLPl... | Data2Semantics/linkitup | linkitup/bio2rdf/plugin.py | Python | mit | 1,736 | 0.021889 |
# -*- coding: utf-8 -*-
#########################################################################
#
# Copyright (C) 2016 OSGeo
#
# 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 ... | timlinux/geonode | geonode/contrib/ows_api/views.py | Python | gpl-3.0 | 2,017 | 0.000496 |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
#
# $Id$
#
# Copyright 2010 Glencoe Software, Inc. All rights reserved.
# Use is subject to license terms supplied in LICENSE.txt
#
# Hudson launcher script which properly launches the script
# on the right system. This is used by most jobs via:
#
# cd src
# cd docs
# ... | jballanc/openmicroscopy | docs/hudson/launcher.py | Python | gpl-2.0 | 4,193 | 0.0031 |
#!/usr/bin/env python
#
# Copyright 2010 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 require... | alexandregz/simian | src/simian/mac/munki/handlers/uauth.py | Python | apache-2.0 | 2,569 | 0.011288 |
"""
pgoapi - Pokemon Go API
Copyright (c) 2016 tjado <https://github.com/tejado>
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... | charbec1/pokemapfuntimesyay | pogom/pgoapi/pgoapi.py | Python | mit | 6,103 | 0.00934 |
import os.path as op
from nose.tools import assert_true, assert_raises
import numpy as np
from numpy.testing import assert_array_almost_equal, assert_array_equal
import warnings
import mne
from mne import compute_covariance
from mne.datasets import testing
from mne.beamformer import lcmv, lcmv_epochs, lcmv_raw, tf_lc... | dimkal/mne-python | mne/beamformer/tests/test_lcmv.py | Python | bsd-3-clause | 15,822 | 0 |
# sequences.py
# strings
>>> # 4 ways to make a string
>>> str1 = 'This is a string. We built it with single quotes.'
>>> str2 = "This is also a string, but built with double quotes."
>>> str3 = '''This is built using triple quotes,
... so it can span multiple lines.'''
>>> str4 = """This too
... is a multiline one
.... | mkhuthir/learnPython | Book_learning-python-r1.1/ch2/sequences.py | Python | mit | 1,614 | 0.019279 |
"""
The controller base class
"""
from .routes import Route
from .view import View
class Controller(object):
def __init__(self, entity, env):
"""Instantiate a controller with the name of the entity and the
environment dict.
"""
self.entity = entity.strip('/^$')
if not self.... | bis12/yapwaf | yapwaf/controller.py | Python | mit | 2,107 | 0.001424 |
from theano import tensor
from theano.tensor.nnet import conv2d
def weights_std(weights, mask_outputs=None):
positions = tensor.arange(weights.shape[2])
expected = (weights * positions).sum(axis=2)
expected2 = (weights * positions ** 2).sum(axis=2)
result = (expected2 - expected ** 2) ** 0.5
if mas... | rizar/attention-lvcsr | lvsr/expressions.py | Python | mit | 2,325 | 0.00129 |
from pandas import compat
import sys
import itertools
import functools
import numpy as np
from pandas.core.common import isnull, notnull, _values_from_object, is_float
import pandas.core.common as com
import pandas.lib as lib
import pandas.algos as algos
import pandas.hashtable as _hash
import pandas.tslib as tslib
... | alephu5/Soundbyte | environment/lib/python3.3/site-packages/pandas/core/nanops.py | Python | gpl-3.0 | 18,949 | 0.000422 |
from uhashring.ring import HashRing
__all__ = ["HashRing", "monkey"]
| ultrabug/uhashring | uhashring/__init__.py | Python | bsd-3-clause | 70 | 0 |
#!/usr/bin/env python3
import connexion
if __name__ == '__main__':
app = connexion.App(__name__, specification_dir='./swagger/')
app.add_api('swagger.yaml', arguments={'title': 'A second cut at writing the code initial formed in web.py for the PiMoroni UnicornHAT\n'})
app.run(port=8080)
| dthoreau/rpi_rally | services/daemons/uniserve-flask/app.py | Python | mit | 302 | 0.003311 |
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
#
# Copyright (C) 2015-2020 Bitergia
#
# 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 l... | grimoirelab/perceval | tests/test_meetup.py | Python | gpl-3.0 | 37,799 | 0.001587 |
from PIL import ImageFile, Image
class CSGOInventoryCacheFile(ImageFile.ImageFile):
format = "IIC"
format_description = "CS:GO Inventory Image Cache"
def _open(self):
self.mode = "RGBA"
self.size = 512, 384
self.tile = [
("raw", (0, 0) + self.size, 0, ("BGRA", 0, 1))
... | nelsonw2014/CSGOInvCacheConverter | cicc/image.py | Python | mit | 729 | 0.001372 |
#! /usr/bin/env python3
# Copyright 2007 Google 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 2
# of the License, or (at your option) any later version.
#
# This program... | itensionanders/distcc | include_server/cache_basics.py | Python | gpl-2.0 | 37,214 | 0.004407 |
# emacs: -*- mode: python; py-indent-offset: 4; indent-tabs-mode: nil -*-
# vi: set ft=python sts=4 ts=4 sw=4 et:
"""
The Image class provides the interface which should be used
by users at the application level. The image provides a coordinate map,
and the data itself.
"""
from __future__ import absolute_import
__doc... | alexis-roche/nipy | nipy/core/image/__init__.py | Python | bsd-3-clause | 518 | 0.001931 |
from django import template
from django.conf import settings
from ccpages.models import Page
register = template.Library()
@register.inclusion_tag('ccpages/_js.html')
def ccpages_js():
return {
'STATIC_URL': settings.STATIC_URL,
}
@register.inclusion_tag('ccpages/_css.html')
def ccpages_css():
re... | designcc/django-ccpages | ccpages/templatetags/ccpages_tags.py | Python | bsd-3-clause | 921 | 0.005429 |
from imgurpython import ImgurClient
import webbrowser
import credentials
client = ImgurClient(credentials.imgur['client_id'], credentials.imgur['client_secret'])
# Authorization flow, pin example (see docs for other auth types)
authorization_url = client.get_auth_url('pin')
print authorization_url
webbrowser.open(au... | hexagonist/RedditDaltonizerBot | get_imgur_tokens.py | Python | mit | 540 | 0.003704 |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
"""
test_is_vcs_installed
---------------------
"""
from cookiecutter import vcs
def test_existing_repo_type():
assert vcs.is_vcs_installed("git")
def test_non_existing_repo_type():
assert not vcs.is_vcs_installed("stringthatisntashellcommand")
| tylerdave/cookiecutter | tests/test_is_vcs_installed.py | Python | bsd-3-clause | 305 | 0 |
#
# Copyright (C) 2013-2015 RoboIME
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU Affero General Public License as
# published by the Free Software Foundation, either version 3 of the
# License, or (at your option) any later version.
#
# This program is distrib... | roboime/pyroboime | roboime/utils/mathutils.py | Python | agpl-3.0 | 2,108 | 0.001423 |
from math import isnan
import warnings
import unittest
from unittest.mock import MagicMock
import numpy as np
from numpy.testing import assert_array_equal
from Orange.data import \
Instance, Domain, Unknown, Value, \
DiscreteVariable, ContinuousVariable, StringVariable
class TestInstance(unittest.TestCase):... | hugobuddel/orange3 | Orange/tests/test_instance.py | Python | gpl-3.0 | 14,298 | 0.00028 |
# -*- coding: utf-8 -*-
# Generated by Django 1.11.2 on 2017-06-25 10:17
from __future__ import unicode_literals
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('explorer', '0004_district_shapefile_link'),
]
operations = [
migrations.Alt... | asterix135/whoshouldivotefor | explorer/migrations/0005_auto_20170625_0617.py | Python | mit | 474 | 0 |
# -*- coding: utf-8 -*-
from __future__ import unicode_literals, absolute_import
import six
from sys import platform
import locale
import os.path
from pelican.tests.support import unittest, get_settings
from pelican.contents import Page, Article, Static, URLWrapper, Author, Category
from pelican.settings import DEFA... | goerz/pelican | pelican/tests/test_contents.py | Python | agpl-3.0 | 24,186 | 0.001778 |
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
from __future__ import unicode_literals
import os
import six
import six.moves.urllib as urllib
import tabulator
from .resource_file import (
InlineResourceFile,
LocalResourceFile,
RemoteResourceFi... | sirex/datapackage-py | datapackage/resource.py | Python | mit | 11,528 | 0.000087 |
# Generated by Django 2.0.1 on 2018-01-19 00:49
from django.db import migrations, models
class Migration(migrations.Migration):
initial = True
dependencies = [
]
operations = [
migrations.CreateModel(
name='GameType',
fields=[
('id', models.AutoField... | Ladeia/QueroJogar | games/migrations/0001_initial.py | Python | mpl-2.0 | 1,032 | 0.002907 |
from SceneGenerator import *
import math
import random
def scale(vec, s):
vec[0] *= s
vec[1] *= s
vec[2] *= s
return vec
s = 1
scene = generateScene('CarScene', camPosition=[1,5,20], camLookat=[0,0,0])
addParameters(scene, h=0.005, maxIter=50, maxIterVel=50, contactTolerance=0.01, gravity=[0,-2,0],... | janbender/PositionBasedDynamics | data/scenes/CarScene.py | Python | mit | 4,517 | 0.019491 |
# -*- coding: utf-8 -*-
#
# 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
#... | owlabs/incubator-airflow | tests/sensors/test_timeout_sensor.py | Python | apache-2.0 | 3,102 | 0.000322 |
# -*- coding: utf-8 -*-
# Generated by Django 1.11.20 on 2019-12-09 00:06
from __future__ import unicode_literals
from django.conf import settings
import django.core.files.storage
from django.db import migrations, models
import django.db.migrations.operations.special
import django.db.models.deletion
import django.util... | MozillaSecurity/FuzzManager | server/crashmanager/migrations/0001_squashed_0020_add_app_permissions.py | Python | mpl-2.0 | 15,946 | 0.000564 |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
from flask_sqlalchemy import SQLAlchemy
db = SQLAlchemy()
from .models import Group, Firma, User, oauth, OAuthSignIn
from random import randint
from app.utils import fake_firma, fake_user
def populate_db(num_users=5, num_groups=15, num_firms=5):
"""
Fills the data ... | Urumasi/Flask-Bones | app/data/__init__.py | Python | mit | 4,084 | 0.001959 |
# # a=1
# # b=a
# # print(a,b)
# #
# # for i in range(1,10,2):
# # print(i)
#
# def fun():
# a=10
# print(a)
# return a +100
#
# sun = fun()
# # sun + 100
#
# print(fun())
# print(sun)
file = open('my file.txt','r') #以读文件的形式打开文件
# content = file.readline() 仅读取第一行
content = file.readlines() #读取所有行,并以列表形... | 1065865483/0python_script | Python/01.py | Python | mit | 415 | 0.014164 |
#!/usr/bin/python
# bigcinemas
class InvalidAge(Exception):
def __init__(self,age):
self.age = age
def validate_age(age):
if age < 18:
raise InvalidAge(age)
else:
return "Welcome to the movies!!"
age = int(raw_input("please enter your age:"))
#print validate_age(age)
try:
validate_age(age)
# except Exc... | tuxfux-hlp-notes/python-batches | archieves/batch-64/14-oop/sixth.py | Python | gpl-3.0 | 462 | 0.025974 |
# coding=utf-8
from .token import PAYMENT_PROVIDER_TOKEN
from telegram import (LabeledPrice, InlineKeyboardButton, InlineKeyboardMarkup, ParseMode)
from telegram.ext import (MessageHandler, CallbackQueryHandler, Filters, PreCheckoutQueryHandler, ShippingQueryHandler)
import logging
logger = logging.getLogger(__name__... | vetu11/piloco | bin/paybot.py | Python | gpl-3.0 | 4,476 | 0.007872 |
#!/usr/bin/env python
# Copyright (C) 2012 Google Inc. All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions are
# met:
#
# * Redistributions of source code must retain the above copyright
# notice, this list ... | nawawi/wkhtmltopdf | webkit/Source/WebCore/make-file-arrays.py | Python | lgpl-3.0 | 5,529 | 0.000723 |
# -*- coding: utf-8 -*-
# isort: skip_file
from django.contrib.auth.models import User
from django.db import models
# This line cannot move to the below according to the isort linter.
# Resolve it firstly, then apply isort again.
from .base import TCMSContentTypeBaseModel # noqa
from tcms.logs.views import TCMSLog
... | Nitrate/Nitrate | src/tcms/core/models/__init__.py | Python | gpl-2.0 | 2,359 | 0.001696 |
#!/usr/bin/python
# -*- coding: utf-8 -*-
# Copyright: (c) 2012, Michael DeHaan <michael.dehaan@gmail.com>
# Copyright: (c) 2017, Ansible Project
# 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__ ... | Shaps/ansible | lib/ansible/modules/files/file.py | Python | gpl-3.0 | 37,706 | 0.003739 |
# This work was created by participants in the DataONE project, and is
# jointly copyrighted by participating institutions in DataONE. For
# more information on DataONE, see our web site at http://dataone.org.
#
# Copyright 2009-2019 DataONE
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you ma... | DataONEorg/d1_python | gmn/src/d1_gmn/app/revision.py | Python | apache-2.0 | 18,605 | 0.002687 |
import decimal
import os
from contextlib import contextmanager
from django.test import TestCase
from django.core.exceptions import ImproperlyConfigured
from mock import patch
from configurations.values import (Value, BooleanValue, IntegerValue,
FloatValue, DecimalValue, ListValue,
... | luzfcb/django-configurations | tests/test_values.py | Python | bsd-3-clause | 12,772 | 0.000313 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.