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 |
|---|---|---|---|---|---|---|
# -*- 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... | internap/arsenal | releasenotes/source/conf.py | Python | apache-2.0 | 8,940 | 0 |
"""List the IP forwarding rules"""
from baseCmd import *
from baseResponse import *
class listIpForwardingRulesCmd (baseCmd):
typeInfo = {}
def __init__(self):
self.isAsync = "false"
"""list resources by account. Must be used with the domainId parameter."""
self.account = None
... | MissionCriticalCloud/marvin | marvin/cloudstackAPI/listIpForwardingRules.py | Python | apache-2.0 | 4,977 | 0.001005 |
import os
from datetime import date
from unittest.mock import MagicMock, call
import pytest
import imagesize
from kaleidoscope import renderer, generator
from kaleidoscope.model import Gallery, Album, Section, Photo
from kaleidoscope.generator import generate, DefaultListener
def test_generate_gallery_index(tmpdir,... | sergejx/kaleidoscope | tests/test_generator.py | Python | bsd-3-clause | 6,135 | 0.000326 |
import announcements, users, corporate, api, volunteer, teams, innovation
def configure_routes(app):
app.add_url_rule('/', 'landing', view_func=users.views.landing, methods=['GET'])
# Signing Up/Registration
app.add_url_rule('/register', 'sign-up', view_func=users.views.sign_up, methods=['GET', 'POST'])
... | rohitdatta/pepper | pepper/routes.py | Python | agpl-3.0 | 7,316 | 0.007791 |
#!/usr/bin/env python
"""This Class is an Arbiter module for having a webservice
throuhg which we can have `sync` and `live polling` functionalities
"""
import json
import os
import select
import subprocess
import sys
import tarfile
import time
from shinken.basemodule import BaseModule
from shinken.external_comman... | peeyush-tm/shinken | modules/ws-nocout/module.py | Python | agpl-3.0 | 15,057 | 0.030152 |
from __future__ import absolute_import
from __future__ import division
# Copyright (c) 2010-2016 openpyxl
"""Manage Excel date weirdness."""
# Python stdlib imports
import datetime
from datetime import timedelta, tzinfo
import re
from jdcal import (
gcal2jd,
jd2gcal,
MJD_0
)
from openpyxl.compat import ... | mfsteen/CIQTranslate-Kristian | openpyxl/utils/datetime.py | Python | gpl-3.0 | 3,155 | 0.00412 |
#!/usr/bin/env python2.6
# -*- coding: utf-8 -*-
#!/usr/bin/env python
#
# Software License Agreement (GPLv2 License)
#
# Copyright (c) 2012 TheCorpora SL
#
# 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... | HailStorm32/Q.bo_stacks | qbo_webi/src/voiceRecognition/voiceRecognition.py | Python | lgpl-2.1 | 10,125 | 0.01541 |
#!/usr/bin/python
# -*- coding: utf-8 -*-
# (c) 2013, Hiroaki Nakamura <[email protected]>
#
# 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... | romain-dartigues/ansible-modules-core | system/hostname.py | Python | gpl-3.0 | 20,763 | 0.003516 |
#coding: utf-8
import os
from setuptools import setup
README = open(os.path.join(os.path.dirname(__file__), 'README.md')).read()
# Allow setup.py to be run from any path
os.chdir(os.path.normpath(os.path.join(os.path.abspath(__file__), os.pardir)))
setup(
name='django-dbmessages',
version='0.2.0a',
pack... | strogonoff/django-dbmessages | setup.py | Python | apache-2.0 | 1,218 | 0.001642 |
#!/usr/bin/env python
# -*- coding:utf-8 -*-
"""
@author: Will
"""
from django import forms
from app01 import models
class ImportFrom(forms.Form):
HOST_TYPE=((1,"001"),(2,"002")) #替換爲文件
host_type = forms.IntegerField(
widget=forms.Select(choices=HOST_TYPE)
)
hostname = f... | willre/homework | day19/web/app01/forms/home.py | Python | gpl-2.0 | 723 | 0.027027 |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
# @Date : 2016-09-01 22:26:01
# @Author : Your Name ([email protected])
# @Link : http://example.org
# @Version : $Id$
import os
import threading
import requests
import lxml
from threading import Thread
from bs4 import BeautifulSoup
import sys
reload(sys)
sys.setdef... | xycfree/py_spider | spider/down_pic_thread.py | Python | gpl-3.0 | 1,358 | 0.021021 |
"""
.. _tut_stats_cluster_source_2samp:
=========================================================================
2 samples permutation test on source data with spatio-temporal clustering
=========================================================================
Tests if the source space data are significantly differe... | trachelr/mne-python | tutorials/plot_cluster_stats_spatio_temporal_2samp.py | Python | bsd-3-clause | 4,321 | 0 |
# Download the Python helper library from twilio.com/docs/python/install
from twilio.rest.ip_messaging import TwilioIpMessagingClient
# Your Account Sid and Auth Token from twilio.com/user/account
account = "ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX"
token = "your_auth_token"
client = TwilioIpMessagingClient(account, token)
... | teoreteetik/api-snippets | ip-messaging/rest/messages/list-messages/list-messages.5.x.py | Python | mit | 533 | 0 |
from typing import Optional, Tuple
import os
import sys
from distutils.version import LooseVersion
from version import PROVISION_VERSION
from scripts.lib.zulip_tools import get_dev_uuid_var_path
def get_major_version(v):
# type: (str) -> int
return int(v.split('.')[0])
def get_version_file():
# type: () ... | tommyip/zulip | tools/lib/test_script.py | Python | apache-2.0 | 2,710 | 0.002583 |
import json
import pytest
from indy import crypto, did, error
@pytest.mark.asyncio
async def test_auth_crypt_works_for_created_key(wallet_handle, seed_my1, verkey_my2, message):
verkey = await did.create_key(wallet_handle, json.dumps({'seed': seed_my1}))
await crypto.auth_crypt(wallet_handle, verkey, verkey... | peacekeeper/indy-sdk | wrappers/python/tests/crypto/test_auth_crypt.py | Python | apache-2.0 | 1,227 | 0.005705 |
#!/usr/bin/python3
#############
# this is to be leaded by every module.
# I think
#import mysglobal as g # args,loggerr @every module
#################
import logging
from logzero import setup_logger,LogFormatter,colors
import argparse
import os,sys
import json
from blessings import Terminal
import getpass # ... | jaromrax/myservice | version2/mysglobal.py | Python | gpl-2.0 | 4,226 | 0.014908 |
# Copyright 2015 - StackStorm, 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 ... | StackStorm/mistral | mistral/tests/unit/lang/v2/base.py | Python | apache-2.0 | 3,920 | 0 |
import requests
import datetime
import calendar
class DeskTime(object):
MAIN_URL = 'https://desktime.com/api/2/json/?{params}'
def __init__(self, app_key, username, password):
self.api_key = self._login(app_key, username, password)
if self.api_key is None:
raise Excepti... | utek/pydesktime | pydesktime/desktime.py | Python | mit | 2,182 | 0.000917 |
# -*- 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
#... | adamhaney/airflow | tests/contrib/operators/test_gcp_bigtable_operator.py | Python | apache-2.0 | 29,272 | 0.00164 |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
""" A set of utilities, mostly for post-processing and visualization
We put arrays on disk as raw bytes, extending along the first dimension.
Alongside each array x we ensure the value x.dtype which stores the string
description of the array's dtype.
See Also:
----------... | agiovann/Constrained_NMF | caiman/source_extraction/cnmf/utilities.py | Python | gpl-2.0 | 40,754 | 0.001718 |
for i in range(1000000):
def f(x, y=1, *args, **kw):
pass
| jonathanverner/brython | www/speed/benchmarks/create_function_complex_args.py | Python | bsd-3-clause | 71 | 0.014085 |
# pylint: skip-file
class GCPResource(object):
'''Object to represent a gcp resource'''
def __init__(self, rname, rtype, project, zone):
'''constructor for gcp resource'''
self._name = rname
self._type = rtype
self._project = project
self._zone = zone
@property
... | appuio/ansible-role-openshift-zabbix-monitoring | vendor/openshift-tools/ansible/roles/lib_gcloud/build/lib/gcpresource.py | Python | apache-2.0 | 683 | 0 |
__author__ = "Jacob Lydon"
__copyright__ = "Copyright 2017"
__credits__ = []
__license__ = "GPLv3"
__version__ = "0.1"
__maintainer__ = "Jacob Lydon"
__email__ = "[email protected]"
__status__ = "Development" | lydonjake/cs-grad-school-app | program/__init__.py | Python | gpl-3.0 | 211 | 0.004739 |
# /ciscripts/check/python/__init__.py
#
# Module loader file for /ciscripts/check/python.
#
# See /LICENCE.md for Copyright information
"""Module loader file for /ciscripts/check/python."""
| polysquare/polysquare-ci-scripts | ciscripts/check/python/__init__.py | Python | mit | 190 | 0 |
# Build Code
import os
import subprocess
import re
class GCC:
def __init__(self):
self.enter_match = re.compile(r'Entering directory')
self.leave_match = re.compile(r'Leaving directory')
def can_build(self, dirname, ext):
if ext in (".c", ".h", ".cpp", ".hpp"):
files = [f.lower() for f in os.listdir(dirn... | peter1010/my_vim | vimfiles/py_scripts/build_types/gcc.py | Python | gpl-2.0 | 1,180 | 0.036441 |
import maya.cmds as cmds
from . import renamer_settings as settings
class FieldReplacer(object):
def __init__(self):
print 'Initializing jsRenamer FieldReplacer...'
#replaceMaterial = self.replaceMaterial
def checkTemplate(self,node):
#availPos = ['C','L','R','LF','RF','LB','RB','U',... | jszokoli/jsTK | jsRenamer/field_replacer.py | Python | gpl-3.0 | 6,998 | 0.018148 |
"""The HTTP api to control the cloud integration."""
import asyncio
from functools import wraps
import logging
import aiohttp
import async_timeout
import attr
from hass_nabucasa import Cloud, auth, thingtalk
from hass_nabucasa.const import STATE_DISCONNECTED
import voluptuous as vol
from homeassistant.components impo... | joopert/home-assistant | homeassistant/components/cloud/http_api.py | Python | apache-2.0 | 19,172 | 0.000939 |
import web
db = web.database(dbn='mysql', db='googlemodules', user='ale', passwd='3babes')
for url in db.select('function', what='screenshot'):
print 'http://www.googlemodules.com/image/screenshot'
| gcobos/rft | scripts/get_all_images.py | Python | agpl-3.0 | 207 | 0 |
class PSFModel(object):
def __init__(self, scopeType, psfModel, xySpace, zSpace, emissionWavelength, numericalAperture, designImmersionOilRefractiveIndex, \
designSpecimenLayerRefractiveIndex, actualImmersionOilRefractiveIndex, \
actualSpecimenLayerRefractiveIndex, actualPointSourceDepthInSpecimenLayer, home... | bnorthan/projects | Scripts/Jython/Psfs/PSFModel.py | Python | gpl-2.0 | 1,817 | 0.053935 |
# -*- coding:utf-8 -*-
'''Created on 2014-8-7 @author: Administrator '''
from sys import path as sys_path
if not '..' in sys_path:sys_path.append("..") #用于import上级目录的模块
import web
#早起的把一个文件分成多个文件,再把class导入
from login.login import (index,login,loginCheck,In,reset,register,find_password)
from blog.blog imp... | lqe/EconomyCompensation | code.py | Python | gpl-3.0 | 2,064 | 0.036126 |
#!/usr/bin/python
import participantCollection
participantCollection = participantCollection.ParticipantCollection()
numberStillIn = participantCollection.sizeOfParticipantsWhoAreStillIn()
initialNumber = participantCollection.size()
print "There are currently **" + str(numberStillIn) + " out of " + str(initialNumber... | foobarbazblarg/stayclean | stayclean-2015-january/display-on-last-day-before-participants-must-check-in.py | Python | mit | 1,018 | 0.006876 |
from __future__ import absolute_import, division, print_function, unicode_literals
# Statsd client. Loosely based on the version by Steve Ivy <[email protected]>
import logging
import random
import socket
import time
from contextlib import contextmanager
log = logging.getLogger(__name__)
class StatsD(object):
... | smarkets/smk_python_sdk | smarkets/statsd.py | Python | mit | 2,824 | 0.000354 |
__version__ = '0.0.1'
| jgrillo/zoonomia | zoonomia/_version.py | Python | mit | 22 | 0 |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
import re
import locale
locale.setlocale(locale.LC_ALL, 'pt_PT.UTF8')
import logging
logging.basicConfig(level=logging.DEBUG)
import os
import string
import datetime
from pprint import pprint
from html2text import add_item
### Constantes ###
MP_STATEMENT = 'deputado_i... | transparenciahackday/dar-scripts | scripts/raspadar/txt2taggedtext.py | Python | gpl-3.0 | 23,048 | 0.008054 |
#
# 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 | python/qpid_dispatch_internal/router/__init__.py | Python | apache-2.0 | 1,041 | 0 |
# Copyright 2019 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 agreed to in writing, ... | google/embedding-tests | thought/image_text_model.py | Python | apache-2.0 | 11,824 | 0.008373 |
'''
Created on 11/02/2010
@author: [email protected]
'''
class webInterface(object):
'''
classdocs
'''
writeFile = None
def __init__(self):
pass
def __openFile(self, fileName):
self.writeFile = open(fileName, 'w')
def closeFile(self):
self.w... | steakunderscore/Bandwidth-Monitoring | src/webInterface.py | Python | gpl-3.0 | 3,059 | 0.010134 |
import platform
# -----------------------------------------------------------------------------
# Guess platform we are running on
def current_platform():
machine = platform.machine()
if machine == 'armv5tejl':
return 'ev3'
elif machine == 'armv6l':
return 'brickpi'
else:
return... | ddemidov/ev3dev-lang-python-1 | ev3dev/auto.py | Python | mit | 497 | 0.004024 |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
import argparse
import os
import requests
import sys
import tempfile
import zipfile
from . import Command
class Deploy(Command):
"""Deploy a module on an Odoo instance"""
def __init__(self):
super(Deploy, self).__init__()
self.session = requests.se... | vileopratama/vitech | src/openerp/cli/deploy.py | Python | mit | 4,038 | 0.003219 |
#!/usr/bin/python
#
# Urwid html fragment output wrapper for "screen shots"
# Copyright (C) 2004-2007 Ian Ward
#
# This library is free software; you can redistribute it and/or
# modify it under the terms of the GNU Lesser General Public
# License as published by the Free Software Foundation; either
# v... | suizokukan/urwid | urwid/html_fragment.py | Python | lgpl-2.1 | 8,175 | 0.005505 |
from django.contrib import admin
# from models import Agent, ReCa, Accomodation, Beach, Activity, Contact
#
# @admin.register(ReCa, Activity)
# class VenueAdmin(admin.ModelAdmin):
# list_display = ('name', 'internal_rating', 'ready', 'description',)
# list_filter = ('ready', 'internal_rating',)
# search_fields =... | popara/jonny-api | matching/admin.py | Python | mit | 786 | 0.001272 |
"""Implementation of JSONEncoder
"""
from __future__ import absolute_import
import re
from operator import itemgetter
# Do not import Decimal directly to avoid reload issues
import decimal
from .compat import u, unichr, binary_type, string_types, integer_types, PY3
def _import_speedups():
try:
from . import... | samvarankashyap/googlecloudutility2 | lib/simplejson/simplejson/encoder.py | Python | apache-2.0 | 25,806 | 0.001589 |
from copy import deepcopy
import numpy as np
from menpo.image.base import Image
from skimage.transform import pyramid_gaussian
class BooleanImage(Image):
r"""
A mask image made from binary pixels. The region of the image that is
left exposed by the mask is referred to as the 'masked region'. The
set o... | jabooth/menpo-archive | menpo/image/boolean.py | Python | bsd-3-clause | 11,453 | 0 |
from buildbot.status import tests
from buildbot.process.step import SUCCESS, FAILURE, BuildStep
from buildbot.process.step_twisted import RunUnitTests
from zope.interface import implements
from twisted.python import log, failure
from twisted.spread import jelly
from twisted.pb.tokens import BananaError
from twisted.w... | gward/buildbot | buildbot/process/step_twisted2.py | Python | gpl-2.0 | 6,316 | 0.004275 |
#!/usr/bin/env python3
"""
Calculate minor reads coverage.
Minor-read ratio (MRR), which was defined as the ratio of reads for the less
covered allele (reference or variant allele) over the total number of reads
covering the position at which the variant was called. (Only applied to hetero sites.)
... | wavefancy/BIDMC-PYTHON | Exome/MinorReadsCoverage/MinorReadsCoverage.py | Python | mit | 3,687 | 0.006509 |
# -*- coding: utf-8 -*-
# pylint: disable=no-init
"""
Django settings for home_web project.
Generated by 'django-admin startproject' using Django 1.10.
For more information on this file, see
https://docs.djangoproject.com/en/1.10/topics/settings/
For the full list of settings and their values, see
https://docs.djang... | cailloumajor/home-web | backend/home_web/settings.py | Python | gpl-3.0 | 7,131 | 0 |
#!/usr/bin/env python
import sys
def gen_test(n):
print "CREATE TABLE t (a CHAR(%d));" % (n)
for v in [ 'hi', 'there', 'people' ]:
print "INSERT INTO t VALUES ('%s');" % (v)
for i in range(2,256):
if i < n:
print "--replace_regex /MariaDB/XYZ/ /MySQL/XYZ/"
print "--e... | tplavcic/percona-xtradb-cluster | mysql-test/suite/tokudb/t/change_column_char.py | Python | gpl-2.0 | 1,383 | 0.006508 |
from django.contrib import admin
from devilry.devilry_dbcache.models import AssignmentGroupCachedData
@admin.register(AssignmentGroupCachedData)
class AssignmentGroupCachedDataAdmin(admin.ModelAdmin):
list_display = [
'id',
'group',
'first_feedbackset',
'last_feedbackset',
... | devilry/devilry-django | devilry/devilry_dbcache/admin.py | Python | bsd-3-clause | 1,516 | 0 |
# -*- coding: utf-8 -*-
###############################################################################
#
# GetTimestamp
# Returns the current date and time, expressed as seconds or milliseconds since January 1, 1970 (epoch time).
#
# Python versions 2.6, 2.7, 3.x
#
# Copyright 2014, Temboo Inc.
#
# Licensed under the... | willprice/arduino-sphere-project | scripts/example_direction_finder/temboo/Library/Utilities/Dates/GetTimestamp.py | Python | gpl-2.0 | 6,772 | 0.005472 |
import sys, os
def stop(arv):
pwd = os.getcwd()
# if argv given, folders = [argv]
# else, folders = pwd
### for each folder in folders
##### check pwd/folder/temp/pids for existing pid files
####### kill -15 & rm files
def main():
print "Please don't try to run this script separately."
if __nam... | modcracker/Tork | tork/core/manage/stop.py | Python | mit | 347 | 0.054755 |
from __future__ import unicode_literals, division, absolute_import
from builtins import * # pylint: disable=unused-import, redefined-builtin
class TestListInterface(object):
config = """
templates:
global:
disable: [seen]
tasks:
list_get:
entry_list: t... | oxc/Flexget | flexget/tests/test_list_interface.py | Python | mit | 9,931 | 0.000503 |
#!/usr/bin/python
###############################################################################
#
#
# Project: ECOOP, sponsored by The National Science Foundation
# Purpose: this code is part of the Cyberinfrastructure developed for the ECOOP project
# http://tw.rpi.edu/web/project/ECOOP
# ... | epifanio/ecoop | ecooputil.py | Python | lgpl-3.0 | 10,832 | 0.003139 |
#!/usr/bin/env python
""" musings on order of variables, x/y vs. col/row
Everyone agrees that col 2, row 1 is (2,1) which is xy ordered.
This works well with the name.
Remember that the usual iterators (over a list-of-lists)
is outer loop y first."""
from __future__ import absolute_import
import re
import messytables... | scraperwiki/xypath | xypath/xypath.py | Python | bsd-2-clause | 31,182 | 0.000994 |
from django.db import models
from stdimage import StdImageField
from django.core.validators import RegexValidator
import datetime
YEAR_CHOICES = []
for r in range(1980, (datetime.datetime.now().year+1)):
YEAR_CHOICES.append((r,r))
S_CHOICE = [('1stYear','1stYear'),('2ndYear','2ndYear'),('3rdYear','3rdYear'),('4t... | bpain2010/kgecweb | hostels/models.py | Python | gpl-2.0 | 2,053 | 0.032148 |
#!/usr/bin/python2
# Copyright (c) 2017 The WebRTC project authors. All Rights Reserved.
#
# Use of this source code is governed by a BSD-style license
# that can be found in the LICENSE file in the root of the source
# tree. An additional intellectual property rights grant can be found
# in the file PATENTS. All... | wangcy6/storm_app | frame/c++/webrtc-master/modules/audio_coding/audio_network_adaptor/parse_ana_dump.py | Python | apache-2.0 | 4,718 | 0.010386 |
# coding=utf-8
"""
Faça um programa, contendo subprogramas, que:
a) Leia da entrada padrão as dimensões, quantidade de linhas e quantidade de colunas de uma matriz bidimensional;
b) Gere uma matriz, onde cada célula é um número inteiro gerado aleatoriamente no intervalo 0 a 9;
c) Mostre a matriz, linha a linha na tel... | deyvedvm/cederj | fund-prog/2017-2/ap1/questao3.py | Python | gpl-3.0 | 2,277 | 0.001778 |
#!/usr/bin/env python
# Copyright 2015, Google, Inc.
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or ... | sharbison3/python-docs-samples | bigquery/api/getting_started.py | Python | apache-2.0 | 2,344 | 0 |
"""
core.mixins - Mixins available to use with models
"""
from django.db.models.signals import post_save
def on_changed(sender, **kwargs):
"""
Calls the `model_changed` method and then resets the state.
"""
instance = kwargs.get("instance")
is_new = kwargs.get("created")
dirty_fields = instanc... | CCI-MOC/GUI-Backend | core/mixins.py | Python | apache-2.0 | 1,993 | 0 |
# pyOCD debugger
# Copyright (c) 2006-2020 Arm Limited
# SPDX-License-Identifier: Apache-2.0
#
# 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... | mbedmicro/pyOCD | pyocd/probe/pydapaccess/interface/pywinusb_backend.py | Python | apache-2.0 | 6,277 | 0.001912 |
# coding=utf-8
# --------------------------------------------------------------------------
# Copyright (c) Microsoft Corporation. All rights reserved.
# Licensed under the MIT License. See License.txt in the project root for
# license information.
#
# Code generated by Microsoft (R) AutoRest Code Generator.
# Changes ... | lmazuel/azure-sdk-for-python | azure-mgmt-network/azure/mgmt/network/v2018_01_01/models/connection_monitor_parameters.py | Python | mit | 2,077 | 0.001444 |
#!/usr/bin/env python
"""Django's command-line utility for administrative tasks."""
import os
import sys
def main():
os.environ.setdefault('DJANGO_SETTINGS_MODULE', 'project.settings')
try:
from django.core.management import execute_from_command_line
except ImportError as exc:
r... | integree/hello-world | manage.py | Python | mit | 648 | 0 |
import numpy as np
import pandas as pd
import pickle
# Return 0 or 1 based on whether Course fulfills a General Education Requirement
def lookupGenEd(cNum, college):
fileName = "data/Dietrich Gen Eds.csv"
picklepath = "data\\dietrich_gen_eds.p"
try:
with open(picklepath,'rb') as file:
... | calvinhklui/Schedulize | GenEdLookup.py | Python | mit | 931 | 0.015038 |
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
Created on Wed Jun 7 21:16:09 2017
@author: immersinn
"""
import regex as re
def billsummaryaref_matcher(tag):
return tag.name =='a' and hasattr(tag, 'text') and tag.text == 'View Available Bill Summaries'
def extract_links(soup):
"""Extract Bill Text Lin... | immersinn/ncga | ncga/extract_billpage_content.py | Python | mit | 2,219 | 0.00721 |
#!/usr/bin/env python
#
# VM Backup extension
#
# Copyright 2015 Microsoft Corporation
#
# 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
#
# U... | Azure/azure-linux-extensions | VMEncryption/main/oscrypto/ubuntu_1604/Ubuntu1604EncryptionStateMachine.py | Python | apache-2.0 | 7,381 | 0.003252 |
#!/usr/bin/python
# -*- coding: utf-8 -*-
# (c) 2016, Cumulus Networks <[email protected]>
# GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt)
from __future__ import absolute_import, division, print_function
__metaclass__ = type
ANSIBLE_METADATA = {'metadata_versio... | hryamzik/ansible | lib/ansible/modules/network/cumulus/_cl_ports.py | Python | gpl-3.0 | 2,580 | 0.00155 |
import numpy as np
def gauss(win, sigma):
x = np.arange(0, win, 1, float)
y = x[:,np.newaxis]
x0 = y0 = win // 2
g=1/(2*np.pi*sigma**2)*np.exp((((x-x0)**2+(y-y0)**2))/2*sigma**2)
return g
def gaussx(win, sigma):
x = np.arange(0, win, 1, float)
y = x[:,np.newaxis]
... | pranka02/image_processing_py | gaussian.py | Python | mit | 652 | 0.019939 |
# Copyright (c) 2014, Fundacion Dr. Manuel Sadosky
# 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 notice, this
# list of condit... | cnheitman/barf-project | tests/core/smt/test_smtsolver.py | Python | bsd-2-clause | 13,055 | 0.000153 |
#!/usr/bin/env python
###############################################################################
# $Id: sgi.py 31335 2015-11-04 00:17:39Z goatbar $
#
# Project: GDAL/OGR Test Suite
# Purpose: PNM (Portable Anyware Map) Testing.
# Author: Frank Warmerdam <[email protected]>
#
#################################... | nextgis-extra/tests | lib_gdal/gdrivers/sgi.py | Python | gpl-2.0 | 2,443 | 0.006959 |
import json
import os
import avasdk
from zipfile import ZipFile, BadZipFile
from avasdk.plugins.manifest import validate_manifest
from avasdk.plugins.hasher import hash_plugin
from django import forms
from django.core.validators import ValidationError
from .validators import ZipArchiveValidator
class PluginArchive... | ava-project/ava-website | website/apps/plugins/forms.py | Python | mit | 2,440 | 0 |
#author: Tobias Andermann, [email protected]
import os
import sys
import re
import glob
import shutil
import argparse
from Bio import SeqIO
from .utils import CompletePath
# Get arguments
def get_args():
parser = argparse.ArgumentParser(
description="Set the maximum fraction of missing data that you ... | AntonelliLab/seqcap_processor | secapr/remove_uninformative_seqs.py | Python | mit | 2,167 | 0.032764 |
# Copyright (C)2016 D. Plaindoux.
#
# This program 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 Software Foundation; either version 2, or (at your option) any
# later version.
import unittest
import path_parse_test
impo... | d-plaindoux/fluent-rest | tests/runall.py | Python | lgpl-2.1 | 828 | 0 |
from django.apps import AppConfig
class QsiteConfig(AppConfig):
name = 'qsite'
verbose_name = '站点管理'
| gzqichang/wa | qsite/qsite/apps.py | Python | mit | 119 | 0.009009 |
import json
from httpretty import HTTPretty
from social.p3 import urlencode
from social.tests.backends.oauth import OAuth1Test
class YahooOAuth1Test(OAuth1Test):
backend_path = 'social.backends.yahoo.YahooOAuth'
user_data_url = 'https://social.yahooapis.com/v1/user/a-guid/profile?' \
'for... | GDGLima/contentbox | third_party/social/tests/backends/test_yahoo.py | Python | apache-2.0 | 1,798 | 0 |
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
import six
import unittest2
from robottelo.ui.location import Location
from robottelo.ui.locators import common_locators
from robottelo.ui.locators import locators
if six.PY2:
import mock
else:
from unittest import mock
class LocationTestCase(... | sghai/robottelo | tests/robottelo/ui/test_location.py | Python | gpl-3.0 | 2,887 | 0 |
# Copyright 2020 Mycroft AI 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 writin... | forslund/mycroft-core | test/integrationtests/voight_kampff/generate_feature.py | Python | apache-2.0 | 2,177 | 0 |
from django import template
import datetime
register = template.Library()
# https://stackoverflow.com/a/8907269/2226755
def strfdelta(tdelta, fmt):
d = {"days": tdelta.days}
d["hours"], rem = divmod(tdelta.seconds, 3600)
d["minutes"], d["seconds"] = divmod(rem, 60)
return fmt.format(**d)
# TODO add... | ChantyTaguan/zds-site | zds/utils/templatetags/seconds_to_duration.py | Python | gpl-3.0 | 787 | 0 |
import olymap.skill
def test_learn_time():
tests = (
({}, None),
({'SK': {'tl': ['14']}}, '14'),
({'SK': {'an': ['0']}}, None),
({'IT': {'tl': ['1']}}, None),
({'SK': {'an': ['1']}}, None),
)
for box, answer in tests:
assert olymap.skill.get_learn_time(box) =... | olympiag3/olypy | tests/unit/test_olymap_skill.py | Python | apache-2.0 | 1,098 | 0.005464 |
from Model import *
import MemoryDecay
# Note we cannot import TwoConcepts here because that ends up modifying the grammar, ruining it for example loaders
| joshrule/LOTlib | LOTlib/Examples/RationalRules/__init__.py | Python | gpl-3.0 | 157 | 0.006369 |
# -*- coding: utf-8 -*-
import sys
import os.path
import subprocess
import json
import string
import tempfile
import shutil
import threading
import exceptions
import errno
from collections import defaultdict
from xml.etree import ElementTree
import nixops.statefile
import nixops.backends
import nixops.logger
import ni... | AmineChikhaoui/nixops | nixops/deployment.py | Python | lgpl-3.0 | 53,483 | 0.004463 |
"""
This encapsulates the logic for displaying filters in the Django admin.
Filters are specified in models with the "list_filter" option.
Each filter subclass knows how to display a filter for a field that passes a
certain test -- e.g. being a DateField or ForeignKey.
"""
import datetime
from django.db import models... | Sonicbids/django | django/contrib/admin/filters.py | Python | bsd-3-clause | 17,360 | 0.00121 |
from django.contrib import admin
from rawParser.models import flightSearch
# Register your models here.
admin.site.register(flightSearch)
| anantag/flightsearch | backend/flightsearch/rawParser/admin.py | Python | gpl-2.0 | 139 | 0 |
# -*- coding: utf-8 -*-
#
# Copyright (c) 2016-2017 Ircam
# Copyright (c) 2016-2017 Guillaume Pellerin
# Copyright (c) 2016-2017 Emilie Zawadzki
# This file is part of mezzanine-organization.
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU Affero General Public L... | Ircam-Web/mezzanine-organization | organization/shop/management/commands/__init__.py | Python | agpl-3.0 | 846 | 0 |
# -*- coding: utf-8 -*-
#
# powerschool_apps documentation build configuration file, created by
# sphinx-quickstart.
#
# 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 configuration valu... | IronCountySchoolDistrict/powerschool_apps | docs/conf.py | Python | mit | 8,001 | 0.001125 |
from parabem.pan2d import doublet_2_1
import parabem
import numpy as np
v1 = parabem.PanelVector2(-1, 0)
v2 = parabem.PanelVector2(1, 0)
panel = parabem.Panel2([v2, v1])
vals = ([doublet_2_1(parabem.Vector2(x, 0), panel, True) for x in np.linspace(-2, 2, 20)])
print(vals)
| looooo/panel-method | examples/tests/test_linear_2d_doublet.py | Python | gpl-3.0 | 276 | 0.003623 |
__author__ = 'rls'
class Robot:
"""Represents a robot, with a name."""
# A class variable, counting the number of robots
population = 0
def __init__(self, name):
"""Initializes the data."""
self.name = name
print('(Initializing {})'.format(self.name))
# When this pers... | rlsharpton/byte-of-Python | oop_objvar.py | Python | gpl-2.0 | 1,127 | 0.003549 |
import re
import os
import sys
import time
import datetime
import traceback
from decimal import Decimal
import threading
import asyncio
from electrum.bitcoin import TYPE_ADDRESS
from electrum.storage import WalletStorage
from electrum.wallet import Wallet, InternalAddressCorruption
from electrum.paymentrequest import ... | fujicoin/electrum-fjc | electrum/gui/kivy/main_window.py | Python | mit | 44,226 | 0.003346 |
"""
Order module has been split for its complexity.
Proposed clean hierarchy for GASSupplierOrder that
can be used in many contexts such as:
DES: ChooseSupplier ChooseGAS ChooseReferrer
GAS: ChooseSupplier OneGAS ChooseReferrer
Supplier: OneSupplier ChooseGAS ChooseR... | befair/gasistafelice | gasistafelice/gf/gas/forms/order/__init__.py | Python | agpl-3.0 | 5,005 | 0.006194 |
#!/usr/bin/env python
# Copyright (C) 2008,2011 Lanedo GmbH
#
# Author: Tim Janik
#
# 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 lat... | tim-janik/testbit-tools | buglist.py | Python | gpl-3.0 | 7,933 | 0.024707 |
# *-* coding:utf-8 *-*
from functools import partial
# 可读性好
# range()
print range(0,9,2) #递增列表
for i in xrange(0,9,2): # 只用于for 循环中
print i
albums = ("Poe","Gaudi","Freud","Poe2")
years = (1976,1987,1990,2003)
for album in sorted(albums):
print album
for album in reversed(albums):
print a... | qiudebo/13learn | code/python/myPython.py | Python | mit | 1,435 | 0.0445 |
# -*- coding: utf-'8' "-*-"
import base64
try:
import simplejson as json
except ImportError:
import json
import logging
import urlparse
import werkzeug.urls
import urllib2
from openerp.addons.payment.models.payment_acquirer import ValidationError
from openerp.addons.payment_paypal.controllers.main import Payp... | funkring/fdoo | addons/payment_paypal/models/paypal.py | Python | agpl-3.0 | 19,377 | 0.003716 |
# Copyright (C) 2003-2009 Robey Pointer <[email protected]>
#
# This file is part of paramiko.
#
# Paramiko 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
# Software Foundation; either version 2.1 of the License, or (a... | rauburtin/pysftpserver | pysftpserver/tests/stub_sftp.py | Python | mit | 6,888 | 0.000145 |
import numpy
import itertools
import random
import math
def convert_spike_list_to_timed_spikes(spike_list, min_idx, max_idx, tmin, tmax, tstep):
times = numpy.array(range(tmin, tmax, tstep))
spike_ids = sorted(spike_list)
possible_neurons = range(min_idx, max_idx)
spikeArray = dict([(neuron, times) for... | dhgarcia/babelModules | pynnModules/Network/spike_file_to_spike_array.py | Python | gpl-3.0 | 8,559 | 0.015189 |
from distutils.core import setup
from distutils.extension import Extension
from Cython.Distutils import build_ext
import numpy as np
import os
sourcefiles = [ 'fast_likelihood.pyx']
ext_modules = [Extension("fast_likelihood",
sourcefiles,
include_dirs = [np.get_inclu... | jeremy-ma/gmmmc | gmmmc/fastgmm/setup_fast_likelihood.py | Python | mit | 597 | 0.025126 |
#!/usr/bin/env python3
# Copyright (c) 2015-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.
from test_framework.test_framework import ComparisonTestFramework
from test_framework.util import *
from ... | EntropyFactory/creativechain-core | qa/rpc-tests/p2p-fullblocktest.py | Python | mit | 52,732 | 0.003926 |
# encoding: utf-8
import datetime
import django
from south.db import db
from south.v2 import SchemaMigration
from django.db import models
# Django 1.5+ compatibility
if django.VERSION >= (1, 5):
from django.contrib.auth import get_user_model
else:
from django.contrib.auth.models import User
def get_user... | mark-adams/django-waffle | waffle/south_migrations/0001_initial.py | Python | bsd-3-clause | 7,674 | 0.007297 |
# -*- Mode: Python; py-indent-offset: 4 -*-
# pygobject - Python bindings for the GObject library
# Copyright (C) 2006-2012 Johan Dahlin
#
# glib/__init__.py: initialisation file for glib module
#
# This library is free software; you can redistribute it and/or
# modify it under the terms of the GNU Lesser General Pub... | davidmalcolm/pygobject | gi/_glib/__init__.py | Python | lgpl-2.1 | 4,827 | 0 |
"""
HTMLParser-based link extractor
"""
from HTMLParser import HTMLParser
from urlparse import urljoin
from w3lib.url import safe_url_string
from scrapy.link import Link
from scrapy.utils.python import unique as unique_list
class HtmlParserLinkExtractor(HTMLParser):
def __init__(self, tag="a", attr="href", pro... | mzdaniel/oh-mainline | vendor/packages/scrapy/scrapy/contrib/linkextractors/htmlparser.py | Python | agpl-3.0 | 2,447 | 0.001635 |
from django.contrib.contenttypes.fields import GenericForeignKey, GenericRelation
from django.contrib.contenttypes.models import ContentType
from django.core.exceptions import ObjectDoesNotExist, ValidationError
from django.core.validators import MaxValueValidator, MinValueValidator
from django.db import models
from dj... | digitalocean/netbox | netbox/dcim/models/device_components.py | Python | apache-2.0 | 27,423 | 0.002079 |
'''
GameData.py
Last Updated: 3/16/17
'''
import json, os
import numpy as np
import pygame as pg
from GameAssets import GameAssets as ga
class GameData():
"""
GameData class is used to stores game state information.
"""
def __init__(self):
'''
Method initiates game state variables.
... | rz4/SpaceManBash | src/GameData.py | Python | mit | 8,056 | 0.002731 |
# -*- coding: utf-8 -*-
# Third Party Stuff
# Third Party Stuff
from rest_framework.pagination import PageNumberPagination as DrfPageNumberPagination
class PageNumberPagination(DrfPageNumberPagination):
# Client can control the page using this query parameter.
page_query_param = 'page'
# Client can cont... | aniketmaithani/kimani-adserver | Adserver/base/api/pagination.py | Python | gpl-2.0 | 640 | 0.001563 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.