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 |
|---|---|---|---|---|---|---|
###############################################################################
# ilastik: interactive learning and segmentation toolkit
#
# Copyright (C) 2011-2014, the ilastik developers
# <team@ilastik.org>
#
# This program is free software; you can redistribute it and/or
# mod... | nielsbuwen/ilastik | ilastik/applets/counting/opCountingDataExport.py | Python | gpl-3.0 | 3,184 | 0.007538 |
# Copyright (c) 2017 rmbar
#
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the "Software"), to deal
# in the Software without restriction, including without limitation the rights
# to use, copy, modify, merge, publish, distribu... | capergroup/bayou | tool_files/acceptpy_1_3_0/accept.py | Python | apache-2.0 | 9,670 | 0.003619 |
import json
from django.contrib.auth.decorators import login_required
from django.contrib.auth.views import logout
from django.shortcuts import render
from django.http import HttpResponseRedirect, HttpResponse
from movement_app.models import *
from movement_app.logic import find_move
def index(request):
if requ... | ox1omon/movement_fefu | movement_app/views.py | Python | mit | 5,870 | 0.00233 |
#!/usr/bin/env python3
"""
Sandbox for "swell-foop" command
"""
import glob
import os
import signal
import sys
import network_mod
import subtask_mod
class Main:
"""
Main class
"""
def __init__(self) -> None:
try:
self.config()
sys.exit(self.run())
except (EOF... | drtuxwang/system-config | bin/swell_foop_.py | Python | gpl-2.0 | 1,717 | 0 |
# -*- coding: utf-8 -*-
#
# Copyright (C) 2014-2019 khalim19
#
# 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 applicab... | khalim19/gimp-plugin-export-layers | export_layers/pygimplib/__init__.py | Python | gpl-3.0 | 11,842 | 0.016298 |
"""
WSGI config for backbonejs_todos_with_Django project.
It exposes the WSGI callable as a module-level variable named ``application``.
For more information on this file, see
https://docs.djangoproject.com/en/1.7/howto/deployment/wsgi/
"""
import os
os.environ.setdefault("DJANGO_SETTINGS_MODULE", "backbonejs_todos_... | ladder1984/backbonejs_todos_with_Django | backbonejs_todos_with_Django/wsgi.py | Python | mit | 431 | 0.00464 |
# (c) Nelen & Schuurmans. GPL licensed, see LICENSE.rst.
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
from __future__ import print_function
import re
DATASET_NAME_PATTERN = re.compile(
r"""^(?P<time_zero>\d{12}) # e.g. 200506010000
_
(?P<program>DP[a-zA-Z]*) # e.g. DPR_rijn... | nens/dpnetcdf | dpnetcdf/utils.py | Python | gpl-3.0 | 1,037 | 0 |
# Generated by Django 2.0.2 on 2018-03-23 22:29
from django.db import migrations, models
SCORE_TYPE_MAP = {1: 'NO_SCORE', 2: 'FULL', 3: 'PIANO', 4: 'CONDENSED'}
FORWARDS_QUERY = """
UPDATE library_piece
SET "score_type" = %s
WHERE "score_id" = %s
""... | cellofellow/symphony | library/migrations/0009_score_type_to_choices.py | Python | agpl-3.0 | 1,288 | 0.000776 |
# Copyright 2017 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 | mycroft/metrics/__init__.py | Python | apache-2.0 | 6,083 | 0 |
"""Add an address translation to an IPSEC tunnel context."""
# :license: MIT, see LICENSE for more details.
import click
import SoftLayer
from SoftLayer.CLI import environment
# from SoftLayer.CLI.exceptions import ArgumentError
# from SoftLayer.CLI.exceptions import CLIHalt
@click.command()
@click.argument('contex... | kyubifire/softlayer-python | SoftLayer/CLI/vpn/ipsec/translation/add.py | Python | mit | 1,435 | 0 |
# coding: utf-8
# Copyright (c) Pymatgen Development Team.
# Distributed under the terms of the MIT License.
"""
This module define a WulffShape class to generate the Wulff shape from
a lattice, a list of indices and their corresponding surface energies,
and the total area and volume of the wulff shape,the weighted su... | czhengsci/pymatgen | pymatgen/analysis/wulff.py | Python | mit | 21,287 | 0.000235 |
# Copyright 2015, Kay Hayen, mailto:kay.hayen@gmail.com
#
# Part of "Nuitka", an optimizing Python compiler that is compatible and
# integrates with CPython, but also works on its own.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in complianc... | wfxiang08/Nuitka | nuitka/codegen/templates/CodeTemplatesFrames.py | Python | apache-2.0 | 8,340 | 0.001079 |
# -*- coding: UTF-8 -*-
import os
import os.path
import unittest
from tempfile import mkdtemp
from outwiker.core.tree import WikiDocument
from outwiker.core.application import Application
from outwiker.core.attachment import Attachment
from outwiker.pages.wiki.parser.commands.attachlist import AttachListCommand
from ... | unreal666/outwiker | src/test/wikiparser/test_wikicommandattachlist.py | Python | gpl-3.0 | 11,139 | 0.000187 |
from flask.ext.admin.contrib.mongoengine import ModelView
from .models import Prediction
from app.management.mixins import AdminMixin
class PredictionView(AdminMixin, ModelView):
column_searchable_list = ('text',)
| piotrdubiel/scribeserver | app/recognition/admin.py | Python | mit | 220 | 0 |
from datetime import datetime, timedelta
import json
from django.contrib.contenttypes.models import ContentType
from django.test import TestCase
from django_dynamic_fixture import G, N
from freezegun import freeze_time
from mock import patch
from issue.models import (
Assertion, ExtendedEnum, Issue, IssueAction, ... | wesleykendall/django-issue | issue/tests/model_tests.py | Python | mit | 22,256 | 0.002696 |
#!/usr/bin/env python
import math
f_truth = open('lr_good_weights.txt', 'r')
f_result = open('ALRresult.log', 'r')
frlines = f_result.readlines()
ftlines = f_truth.readlines()
c = 0
margin = 0.001
for i, line in enumerate(ftlines):
if math.fabs(float(line) - float(frlines[i])) > margin :
c = c + 1
prin... | jperla/spark-advancers | compareResult.py | Python | bsd-3-clause | 358 | 0.002793 |
from django import forms
from .models import Author
class RegisterNewAuthorForm(forms.ModelForm):
password = forms.CharField(widget=forms.PasswordInput())
repeated_password = forms.CharField(widget=forms.PasswordInput())
class Meta:
model = Author
fields = ['email', 'first_name', 'last_n... | jokuf/hack-blog | users/forms.py | Python | mit | 1,762 | 0 |
# -*- coding: utf-8 -*-
# Copyright (c) 2012 Fabian Barkhau <fabian.barkhau@gmail.com>
# License: MIT (see LICENSE.TXT file)
from django.db import models
from django.utils.translation import ugettext as _
from django.core.validators import RegexValidator
from sanitizer.models import SanitizedCharFi... | F483/bikesurf.org | apps/page/models.py | Python | mit | 1,607 | 0.011201 |
from .bpemb import BPEmb
| bheinzerling/bpemb | bpemb/__init__.py | Python | mit | 25 | 0 |
# Copyright 2014 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.
from telemetry.page import page as page_module
from telemetry.page import page_set as page_set_module
class FallbackViaHeaderPage(page_module.Page):
def... | sencha/chromium-spacewalk | tools/chrome_proxy/integration_tests/chrome_proxy_pagesets/fallback_viaheader.py | Python | bsd-3-clause | 701 | 0.00428 |
# coding: utf-8
import os
import urllib
import numpy as np
import pickle
from Experiment import Experiment
ROOT_PATH = './full_dataset/article_4_data/grouped_ephys'
ZIPFILE_PATH = './full_dataset/article_4_data'
EXPM_PATH = './results/experiments/'
URL = 'http://microcircuits.epfl.ch/data/released_data/'
if not os.... | awakenting/gif_fitting | bbp_analysis/bluebrain_data_io.py | Python | gpl-3.0 | 9,533 | 0.004196 |
import scipy.io
from sklearn.metrics import accuracy_score
from sklearn import cross_validation
from sklearn import svm
from skfeature.function.information_theoretical_based import CMIM
def main():
# load data
mat = scipy.io.loadmat('../data/colon.mat')
X = mat['X'] # data
X = X.astype(float)
y... | jundongl/scikit-feast | skfeature/example/test_CMIM.py | Python | gpl-2.0 | 1,485 | 0.003367 |
"""MySQLdb Cursors
This module implements Cursors of various types for MySQLdb. By
default, MySQLdb uses the Cursor class.
"""
import re
import sys
try:
from types import ListType, TupleType, UnicodeType
except ImportError:
# Python 3
ListType = list
TupleType = tuple
UnicodeType = str
restr = r... | ecolitan/fatics | venv/lib/python2.7/site-packages/MySQLdb/cursors.py | Python | agpl-3.0 | 17,253 | 0.00284 |
__author__ = 'admin'
class ContactHelper:
def __init__(self, app):
self.app = app
def create(self, contact):
self.fill_contact_fields(contact)
def modify(self, contact):
# modify contact
self.click_edit_button()
self.fill_contact_fields(contact)
def set_field_... | dimchenkoAlexey/python_training | fixture/contact.py | Python | apache-2.0 | 3,347 | 0.001793 |
#***************************************************************************
#* *
#* Copyright (c) 2011, 2012 *
#* Jose Luis Cercos Pita <jlcercos@gmail.com> *
#* ... | wood-galaxy/FreeCAD | src/Mod/Plot/Plot.py | Python | lgpl-2.1 | 13,577 | 0.002652 |
# -*- coding: utf-8 -*-
import threading
import datetime
class PDNSResult:
def __init__(self, source, response_time, query, answer, rrtype, ttl, firstseen, lastseen, count):
self.source = source
self.response_time = response_time
self.query = query
self.answer = answer
self.... | chrislee35/pypassivedns | pypassivedns/pypassivedns.py | Python | bsd-3-clause | 1,538 | 0.006502 |
from models import DBUse
test1 = DBUse()
test1.f_create(account="maomao@gmail.com", password="123321")
test1.f_create(account="hahaha@gmail.com", password="abcd")
user = test1.f_read(uid=2)
test1.f_update(user, account="amy111@gmail.com")
ul = test1.f_read()
for i in ul:
test1.f_delete(i)
test1.f_read()
| pythonistas-tw/academy | web-api/maomao/usecase.py | Python | gpl-2.0 | 313 | 0 |
"""
Django settings for unusebamboo project.
Generated by 'django-admin startproject' using Django 1.8.2.
For more information on this file, see
https://docs.djangoproject.com/en/1.8/topics/settings/
For the full list of settings and their values, see
https://docs.djangoproject.com/en/1.8/ref/settings/
"""
# Build ... | unlessbamboo/django | unusebamboo/settings.py | Python | gpl-3.0 | 3,094 | 0 |
# Authors: Harvard Intelligent Probabilistic Systems (HIPS) Group
# http://hips.seas.harvard.edu
# Ryan Adams, David Duvenaud, Scott Linderman,
# Dougal Maclaurin, Jasper Snoek, and others
# Copyright 2014, The President and Fellows of Harvard University
# Distributed under an MIT license. Se... | HIPS/Kayak | kayak/regularizers.py | Python | mit | 2,109 | 0.006164 |
# -*- coding: utf-8 -*-
# Generated by Django 1.9.4 on 2016-04-18 07:59
from __future__ import unicode_literals
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('primus', '0006_auto_20160418_0959'),
]
operations = [
migrations.AlterField(... | sighill/shade_app | primus/migrations/0007_auto_20160418_0959.py | Python | mit | 457 | 0 |
from __future__ import print_function, absolute_import, division
import operator
from functools import reduce
from llvmlite.llvmpy.core import Type
import llvmlite.llvmpy.core as lc
import llvmlite.binding as ll
from numba.targets.imputils import implement, Registry
from numba import cgutils
from numba import types
... | pombredanne/numba | numba/hsa/hsaimpl.py | Python | bsd-2-clause | 10,106 | 0.000396 |
#!/usr/bin/python
#
# Copyright (C) 2008, 2011, 2012, 2013 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:
#
# 1. Redistributions of source code must retain the above copyright noti... | andir/ganeti | test/py/cmdlib/cluster_unittest.py | Python | bsd-2-clause | 96,615 | 0.005248 |
#!/usr/bin/env python3
# Copyright © 2012-13 Qtrac Ltd. All rights reserved.
# This program or module 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)... | nwiizo/workspace_2017 | pipng/multiplexer2.py | Python | mit | 4,364 | 0.00298 |
import sys
sys.path.append('/opt/marcopolo/')
from bindings.polo import polo
from twisted.trial import unittest
from mock import MagicMock, patch
class TestRegisterService(unittest.TestCase):
pass
class TestRegisterService(unittest.TestCase):
def setUp(self):
self.polo = polo.Polo()
self.... | Alternhuman/marcopolo | marcopolo/tests/test_polo_binding.py | Python | mpl-2.0 | 1,960 | 0.015816 |
#!/usr/bin/python
# -*- coding: UTF-8 -*-
import random
print random.uniform(10, 30)
| tomhaoye/LetsPython | practice/practice50.py | Python | mit | 87 | 0 |
import os
import shutil
import tempfile
import vmprof
import prof_six as six
from _prof_imports import TreeStats, CallTreeStat
class VmProfProfile(object):
""" Wrapper class that represents VmProf Python profiling backend with API matching
the cProfile.
"""
def __init__(self):
self.stats... | siosio/intellij-community | python/helpers/profiler/vmprof_profiler.py | Python | apache-2.0 | 2,691 | 0.001115 |
from opentrons import instruments, containers
metadata = {
'protocolName': 'Testosaur',
'author': 'Opentrons <engineering@opentrons.com>',
'description': 'A variant on "Dinosaur" for testing',
'source': 'Opentrons Repository'
}
p200rack = containers.load('tiprack-200ul', '5', 'tiprack')
# create a p2... | Opentrons/labware | api/tests/opentrons/data/testosaur.py | Python | apache-2.0 | 745 | 0 |
#! /usr/bin/env python
from __future__ import print_function
from openturns import *
TESTPREAMBLE()
RandomGenerator.SetSeed(0)
try:
# Instanciate one distribution object
distribution = NegativeBinomial(4.5, 0.7)
print("Distribution ", repr(distribution))
print("Distribution ", distribution)
# Is... | dubourg/openturns | python/test/t_NegativeBinomial_std.py | Python | gpl-3.0 | 2,540 | 0.000787 |
#!/usr/bin/env python
"""Tests for the dtypes and converters arguments to CSV import.
"""
import pytest
from io import BytesIO
from unittest import mock
from tdclient import api, Client
from tdclient.util import read_csv_records
from tdclient.test.test_helper import gunzipb
from tdclient.test.test_helper import ma... | treasure-data/td-client-python | tdclient/test/dtypes_and_converters_test.py | Python | apache-2.0 | 7,897 | 0.001773 |
# simple class generator helper
#Ange Albertini, BSD licence 2011
import struct
def make_utf8(s):
return "".join(["\x01", struct.pack(">H", len(s)), s])
def make_class(i):
return "".join(["\x07", struct.pack(">H", i)])
def make_nat(name, type):
return "".join(["\x0C", struct.pack(">H", name)... | angea/corkami | src/java/java.py | Python | bsd-2-clause | 1,502 | 0.009987 |
#!/usr/bin/env python
import os
import sys
if __name__ == '__main__':
os.environ.setdefault('DJANGO_SETTINGS_MODULE', 'config.settings.local')
try:
from django.core.management import execute_from_command_line
except ImportError:
# The above import may fail for some other reason. Ensure tha... | sussexstudent/falmer | manage.py | Python | mit | 1,026 | 0 |
# -*- coding: utf-8 -*-
import unittest
import doctest
import sys
import time
import timeside.core
class _TextTestResult(unittest.TestResult):
"""A test result class that can print formatted text results to a stream.
Used by TextTestRunner.
"""
separator1 = '=' * 70
separator2 = '-' * 70
de... | Parisson/TimeSide | tests/unit_timeside.py | Python | agpl-3.0 | 5,327 | 0.000188 |
# coding=utf-8
# Copyright 2014 Pants project contributors (see CONTRIBUTORS.md).
# Licensed under the Apache License, Version 2.0 (see LICENSE).
from __future__ import (absolute_import, division, generators, nested_scopes, print_function,
unicode_literals, with_statement)
from pants.base.payl... | areitz/pants | src/python/pants/backend/core/targets/resources.py | Python | apache-2.0 | 1,552 | 0.005799 |
import os
from sqlalchemy.ext.declarative import declarative_base
from sqlalchemy import create_engine
from sqlalchemy.orm import sessionmaker
Base = declarative_base()
class DBConnector():
'''
where every row is the details one employee was paid for an entire month.
'''
@classmethod
def get_sess... | JasonThomasData/payslip_code_test | app/models/db_connector.py | Python | mit | 498 | 0.002008 |
from whiffle import wikidotapi
from util import hook
import re
import time,threading
@hook.command
def tale(inp): #this is for WL use, easily adaptable to SCP
".tale <Article Name> -- Will return first page containing exact match to Article Name"
if firstrefresh == 0: #make sure the cache actually exists
return "C... | pixeltasim/IRCBot-Pixeltasim | plugins/tale.py | Python | unlicense | 3,149 | 0.039695 |
from abc import ABCMeta, abstractmethod
from typing import Dict
from Src.BioAnalyzer.CrossCutting.DTOs.GenePrioritization.GlobalDifferentialSampleDto import GlobalDifferentialSampleDto
from Src.BioAnalyzer.CrossCutting.Filters.GenePrioritization.FeSingleGlobalDifferentialSample import \
FeSingleGlobalDifferentialS... | cemarchi/biosphere | Src/BioAnalyzer/CrossCutting/Contracts/GenePriotization/GlobalDifferentialDnaMethylationSampleRepositoryBase.py | Python | bsd-3-clause | 1,566 | 0.012133 |
from datetime import timedelta, datetime
import os
from django.db import models
from django.db.models.signals import pre_save, post_save
from django.contrib.auth.models import User
from django.conf import settings
from django.core.urlresolvers import reverse
from django.core.exceptions import ObjectDoesNotExist
from ... | nyov/mooshell | models.py | Python | mit | 14,529 | 0.001445 |
# vim: tabstop=4 shiftwidth=4 softtabstop=4
#
# 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 applicab... | savi-dev/heat | heat/engine/parameters.py | Python | apache-2.0 | 14,053 | 0 |
#!/bin/python
from __future__ import division
from __future__ import print_function
from __future__ import absolute_import
import itertools
from math import log
import sys
# Python 3 backwards compatibility tricks
if sys.version_info.major > 2:
def xrange(*args, **kwargs):
return iter(rang... | sameersingh/uci-statnlp | hw2/lm.py | Python | apache-2.0 | 3,681 | 0.002173 |
#-*- coding: utf-8 -*-
from __future__ import unicode_literals
import itertools
import os
import re
from django import forms
from django.conf import settings as django_settings
from django.contrib import messages
from django.contrib.admin import helpers
from django.contrib.admin.util import quote, unquote, capfirst
fr... | o-zander/django-filer | filer/admin/folderadmin.py | Python | bsd-3-clause | 53,477 | 0.002711 |
# Copyright (c) Mathias Kaerlev 2012.
# This file is part of pyspades.
# pyspades 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.
# ... | piqueserver/piqueserver | piqueserver/scheduler.py | Python | gpl-3.0 | 1,666 | 0 |
################################
# These variables are overwritten by Zenoss when the ZenPack is exported
# or saved. Do not modify them directly here.
# NB: PACKAGES is deprecated
NAME = 'ZenPacks.community.DistributedCollectors'
VERSION = '1.7'
AUTHOR = 'Egor Puzanov'
LICENSE = ''
NAMESPACE_PACKAGES = ['ZenPacks', '... | anksp21/Community-Zenpacks | ZenPacks.community.DistributedCollectors/setup.py | Python | gpl-2.0 | 2,617 | 0.010317 |
#!/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
# "... | apache/incubator-airflow | tests/providers/google/cloud/operators/test_gcs_system_helper.py | Python | apache-2.0 | 2,215 | 0 |
'''
IROHA Python package.
'''
__all__ = ["iroha", "design_tool", "axi"]
| nlsynth/iroha | py/iroha/__init__.py | Python | bsd-3-clause | 73 | 0 |
# -*- coding:utf-8 -*-
# Copyright (c) 2010-2012 OpenStack Foundation
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by ... | tipabu/swift | test/unit/common/test_memcached.py | Python | apache-2.0 | 37,888 | 0 |
"""
Support for Yamaha Receivers.
For more details about this platform, please refer to the documentation at
https://home-assistant.io/components/media_player.yamaha/
"""
import logging
import requests
import voluptuous as vol
from homeassistant.components.media_player import (
DOMAIN, MEDIA_PLAYER_SCHEMA, MEDIA... | tinloaf/home-assistant | homeassistant/components/media_player/yamaha.py | Python | apache-2.0 | 13,441 | 0 |
from __future__ import unicode_literals, division, absolute_import
from builtins import * # pylint: disable=unused-import, redefined-builtin
from flexget import options, plugin
from flexget.event import event
from flexget.terminal import console
from flexget.manager import Session
try:
from flexget.plugins.inter... | oxc/Flexget | flexget/plugins/cli/t411.py | Python | mit | 4,537 | 0.004408 |
#!/usr/bin/env vpython
# Copyright 2021 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.
"""Unittests for xcode_util.py."""
import logging
import mock
import os
import unittest
import test_runner_errors
import test_runner_... | ric2b/Vivaldi-browser | chromium/ios/build/bots/scripts/xcode_util_test.py | Python | bsd-3-clause | 20,961 | 0.004389 |
# -*- coding: utf-8 -*-
# Part of Odoo. See LICENSE file for full copyright and licensing details.
# Copyright (c) 2011 CCI Connect asbl (http://www.cciconnect.be) All Rights Reserved.
# Philmer <philmer@cciconnect.be>
{
'name': 'Accounting Consistency Tests',
'version': '1.0',
'cate... | jeremiahyan/odoo | addons/account_test/__manifest__.py | Python | gpl-3.0 | 1,166 | 0.005146 |
from airy.core.conf import settings
from mongoengine import *
connect(getattr(settings, 'database_name', 'airy'))
| letolab/airy | airy/core/db.py | Python | bsd-2-clause | 116 | 0.008621 |
# Copyright (C) 2016 Robert Scott
# 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 is distributed in the... | robsco-git/spreadsheet_server | example_client.py | Python | gpl-2.0 | 2,456 | 0.004072 |
# -*- Mode: Python; coding: utf-8; indent-tabs-mode: nil; tab-width: 4 -*-
### BEGIN LICENSE
# This file is in the public domain
### END LICENSE
from desktopcouch.records.server import CouchDatabase
from desktopcouch.records.record import Record
import gtk
from morso.helpers import get_builder
import gettext
from ge... | BitPrepared/morso | 12.04/10.04/morso/PreferencesMorsoDialog.py | Python | gpl-2.0 | 3,829 | 0.00235 |
import Sofa
import particle
class Tuto3(Sofa.PythonScriptController):
# optionnally, script can create a graph...
def createGraph(self,node):
particle.oneParticleSample(node)
return 0
| Anatoscope/sofa | applications/plugins/SofaPython/doc/SofaDays_oct2013/3_OneParticle/controller.py | Python | lgpl-2.1 | 195 | 0.030769 |
# Copyright 2016 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 agreed to in writing, ... | calpeyser/google-cloud-python | vision/tests/unit/test_client.py | Python | apache-2.0 | 26,626 | 0 |
#coding: utf-8
import csv
from read_conf import config
import MySQLdb as mysql
conn = mysql.connect(host='localhost',user='root',passwd='111111111',port=3306)
cur = conn.cursor()
def create_db():
count = cur.execute('create database if not exists shopping;')
print "create database",count
result = cur.fe... | lavizhao/shopping | python/create_trans_table.py | Python | gpl-2.0 | 2,625 | 0.013415 |
"""
Test suite for openjpeg's callback functions.
"""
# Standard library imports ...
from io import StringIO
import warnings
import unittest
from unittest.mock import patch
# Local imports ...
import glymur
from . import fixtures
@unittest.skipIf(
fixtures.OPENJPEG_NOT_AVAILABLE, fixtures.OPENJPEG_NOT_AVAILABLE_... | quintusdias/glymur | tests/test_callbacks.py | Python | mit | 3,032 | 0 |
# 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... | davidzchen/tensorflow | tensorflow/python/data/util/sparse_test.py | Python | apache-2.0 | 12,352 | 0.002995 |
'''
zzz
'''
import os
import mako.lookup
import tornado.options
import tornado.httpserver
import tornado.web
import tornado.template
from tornado.options import define, options
CURRENT_PATH = os.path.dirname(__file__)
define('port', default=8081, help="run on the given port", type=int)
define('debug', default=Fals... | xiexiao/zzz | zzz.py | Python | mit | 1,198 | 0.013356 |
import _plotly_utils.basevalidators
class ColorscaleValidator(_plotly_utils.basevalidators.ColorscaleValidator):
def __init__(self, plotly_name="colorscale", parent_name="histogram2d", **kwargs):
super(ColorscaleValidator, self).__init__(
plotly_name=plotly_name,
parent_name=parent... | plotly/plotly.py | packages/python/plotly/plotly/validators/histogram2d/_colorscale.py | Python | mit | 495 | 0.00404 |
#!/bin/python3
# -*-coding:utf-8 -*
import curses;
from .Creature import Creature;
from random import choice;
"""A module containing the Monster class"""
class Monster(Creature):
"""The Monster class"""
def __init__(self, env, y, x, char):
"""Constructor"""
super(Monster, self).__init__(env, y, x, char, 7,... | ribacq/utaxc | items/Monster.py | Python | gpl-3.0 | 519 | 0.04817 |
#coding:utf-8
import os, sys, io
import shutil
import struct
_DELTA = 0x9E3779B9
def _long2str(v, w):
n = (len(v) - 1) << 2
if w:
m = v[-1]
if (m < n - 3) or (m > n): return ''
n = m
s = struct.pack('<%iL' % len(v), *v)
if w :
return s[0:n]
else :
return s... | helloztq/helloztq.github.io | _drafts/encrypt.py | Python | mit | 2,578 | 0.009697 |
# 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
# d... | jay-lau/magnum | magnum/db/sqlalchemy/alembic/versions/e647f5931da8_add_insecure_registry_to_baymodel.py | Python | apache-2.0 | 1,007 | 0.001986 |
# unpack sequences
a, = 1, ; print(a)
a, b = 2, 3 ; print(a, b)
a, b, c = 1, 2, 3; print(a, b, c)
a, = range(1); print(a)
a, b = range(2); print(a, b)
a, b, c = range(3); print(a, b, c)
(a) = range(1); print(a)
(a,) = range(1); print(a)
(a, b) = range(2); print(a, b)
(a, b, c) = range(3); print(a, b, c)
(a, (b, ... | mhoffma/micropython | tests/basics/unpack1.py | Python | mit | 1,794 | 0.036232 |
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the Li... | alex/warehouse | tests/unit/accounts/test_views.py | Python | apache-2.0 | 12,295 | 0 |
#!/usr/bin/env python
# -*- coding:utf-8 -*-
import pika
import time
connection = pika.BlockingConnection(pika.ConnectionParameters(
host='localhost'))
channel = connection.channel()
channel.queue_declare(queue='rpc_queue')
def fib(n):
if n == 0:
return 0
elif n == 1:
return 1
else:... | dianshen/python_day | s12day10/rabbitMQ_rpc_serverl.py | Python | apache-2.0 | 951 | 0.010515 |
def fitness(string, length) :
strSum = 0.0
newAlpha = convert(string.gene)
fhCrypt = open("crypto.txt")
flippedCrypt = ""
flippedCrypt = flip(fhCrypt.readline(),newAlpha)
flippedCrypt = flippedCrypt.split()
for word in flippedCrypt :
#print "Word: %s" % word
if len(word) == 1 :
fhDict = open("1.txt")
e... | csmtco10/SRshare | Reyn/AI/Generic/crypto_fitness.py | Python | gpl-2.0 | 4,583 | 0.057822 |
# -*- coding: utf-8 -*-
# Generated by Django 1.11.15 on 2018-08-09 02:47
from __future__ import unicode_literals
from django.db import migrations, models
import django.db.models.deletion
class Migration(migrations.Migration):
dependencies = [
('core', '0020_auto_20180808_2247'),
('vouchers', '0... | django-danceschool/django-danceschool | danceschool/vouchers/migrations/0004_customergroupvoucher.py | Python | bsd-3-clause | 1,085 | 0.002765 |
#Copyright 2008, Meka Robotics
#All rights reserved.
#http://mekabot.com
#Redistribution and use in source and binary forms, with or without
#modification, are permitted.
#THIS SOFTWARE IS PROVIDED BY THE Copyright HOLDERS AND CONTRIBUTORS
#"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
#LIMITED... | ahoarau/m3meka | python/scripts/m3qa/calibrate_head_s2r2.py | Python | mit | 4,572 | 0.042651 |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
"""
requests_cache.backends.base
~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Contains BaseCache class which can be used as in-memory cache backend or
extended to support persistence.
"""
from datetime import datetime
import hashlib
from copy import copy
from io import Byt... | YetAnotherNerd/requests-cache | requests_cache/backends/base.py | Python | bsd-2-clause | 8,344 | 0.001558 |
# -*- coding: utf-8 -*-
##
## This file is part of Invenio.
## Copyright (C) 2011, 2012 CERN.
##
## Invenio 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 opt... | PXke/invenio | invenio/legacy/bibauthorid/merge.py | Python | gpl-2.0 | 15,747 | 0.004953 |
#!/usr/bin/python
# -*- coding: ISO-8859-15 -*-
import rlib
myreport = rlib.Rlib()
print rlib.version
myreport.add_datasource_xml("local_xml")
myreport.add_query_as("local_xml", "data.xml", "data")
myreport.add_report("array.xml")
myreport.set_output_format_from_text("pdf")
myreport.execute()
print myreport.get_conte... | SICOM/rlib | src/examples/python/xml.py | Python | gpl-2.0 | 388 | 0.002577 |
import enum
import math
from .attrs import AttrTypes
class AssetTypes(enum.Enum):
DEVICE = "Device"
TECH = "Technique"
ALLY = "Ally"
class Asset(object):
class Prop(object):
allowed_types = []
def __init__(self):
self.master = None
self.extra_flaw = False
... | HarkonenBade/jadepunk-chargen | jadepunk/assets.py | Python | mit | 15,523 | 0.001611 |
"""
Unit test for dynamic parameters.
Tests __get__, __set__ and that inspect_value() and
get_value_generator() work.
Originally implemented as doctests in Topographica in the file
testDynamicParameter.txt
"""
import copy
import unittest
import param
import numbergen
class TestDynamicParameters(unittest.TestCase):... | ceball/param | tests/API0/testdynamicparams.py | Python | bsd-3-clause | 9,003 | 0.003443 |
# -*- coding: utf-8 -*-
from flask import Flask,render_template,send_file,Response,flash,request,redirect,session
from werkzeug.utils import secure_filename
import json
import os.path
import os
import gzip
import urllib
from db import DbGetListOfDates,DbGet,DbGetComments,DbGetMulitple,DbGetNearbyPoints,DbPut,DbPutWith... | fparrel/regepe | vps/regepe_flask_server.py | Python | gpl-3.0 | 30,280 | 0.024935 |
# -*- coding: utf-8 -*-
# Authors: Y. Jia <ytjia.zju@gmail.com>
import unittest
from common.BinaryTree import BinaryTree
from .. import BinaryTreeMaximumPathSum
class test_BinaryTreeMaximumPathSum(unittest.TestCase):
solution = BinaryTreeMaximumPathSum.Solution()
def test_maxPathSum(self):
self.as... | ytjia/coding-practice | algorithms/python/leetcode/tests/test_BinaryTreeMaximumPathSum.py | Python | mit | 446 | 0.002242 |
class AppointmentStatusError(Exception):
pass
class AppointmentCreateError(Exception):
pass
class AppointmentSmsReminderError(Exception):
pass
| botswana-harvard/edc-appointment | edc_appointment/exceptions.py | Python | gpl-2.0 | 161 | 0 |
# 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-batch/azure/batch/models/task_id_range.py | Python | mit | 1,362 | 0 |
import multiprocessing
import time
import random
import sys
#
# Functions used by test code
#
def calculate(func, args):
result = func(*args)
return '%s says that %s%s = %s' % (
multiprocessing.current_process().name,
func.__name__, args, result
)
def calculatestar(args):
return c... | Kiddinglife/kidding-engine | python/Doc/includes/mp_pool.py | Python | lgpl-3.0 | 3,892 | 0.002055 |
"""
THIS SCRIPT CREATES AN INDEX OF NEIGHBORHOOD CHANGE USING USER SPECIFIED INDICATORS:
1. CALCULATE Z-SCORE FOR EACH INDICATOR
2. CALCULATE NEGATIVE Z-SCORE FOR INDICATORS THAT SHOULD DETRACT FROM SCORE (I.E. VACANCY RATE)
3. ADD INDICATORS TOGETHER FOR RAW SCORE
4. DEFINE CLASSIFICATION METHOD
5.... | adriennemcd/neighborhood-change-index | nc-pt1.py | Python | mit | 19,716 | 0.005833 |
# Copyright 2019 Google LLC. 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 a... | tensorflow/tfx | tfx/components/schema_gen/component_test.py | Python | apache-2.0 | 2,491 | 0.001204 |
# 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... | mitya57/debian-buildbot | buildbot/process/builder.py | Python | gpl-2.0 | 25,892 | 0.000657 |
from flask import (flash,
redirect,
render_template,
request,
url_for)
from flask.ext.login import (current_user,
fresh_login_required)
from breezeminder.app import app
from breezeminder.forms.reminder import Remin... | shaunduncan/breezeminder | breezeminder/views/reminder.py | Python | mit | 5,296 | 0.002455 |
import pandas as pd
# TODO: Load up the dataset
# Ensuring you set the appropriate header column names
#
df = pd.read_csv('c:/Users/User/workspace/DAT210x/MOdule2/Datasets/servo.data', names = ['motor', 'screw', 'pgain', 'vgain', 'class'])
df.head()
# TODO: Create a slice that contains all entries
# having a vgain eq... | rebaltina/DAT210x | Module2/assignment3.py | Python | mit | 1,075 | 0.015814 |
from .midi import *
| bit-trade-one/SoundModuleAP | lib-src/portmidi/pm_python/pyportmidi/__init__.py | Python | gpl-2.0 | 25 | 0.04 |
# <pep8 compliant>
import io
import operator
from . import read_ascii_xps
from . import xps_const
from mathutils import Vector
def writeBones(xpsSettings, bones):
bonesString = io.StringIO()
if bones:
bonesString.write('{:d} # bones\n'.format(len(bones)))
for bone in bones:
name... | feureau/Small-Scripts | Blender/Blender config/2.91/scripts/addons/XNALaraMesh/write_ascii_xps.py | Python | gpl-3.0 | 5,428 | 0.000553 |
"""
Forms and validation code for user registration.
"""
from django import forms
from django.utils.translation import ugettext_lazy as _
from django.contrib.auth.models import User
from registration.models import RegistrationProfile
# I put this on all required fields, because it's easier to pick up
# on them wit... | umitproject/openmonitor-aggregator | registration/forms.py | Python | agpl-3.0 | 6,034 | 0.0058 |
#!/usr/bin/env python
import os
import sys
if __name__ == "__main__":
os.environ.setdefault("DJANGO_SETTINGS_MODULE", "cms.settings")
from django.core.management import execute_from_command_line
execute_from_command_line(sys.argv)
| polegithub/shopping_web_python | shopping_web/manage.py | Python | mit | 246 | 0 |
# -*- coding: utf-8 -*-
#
# Copyright (C) 2009 UNINETT AS
#
# This file is part of Network Administration Visualized (NAV).
#
# NAV 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 Software Foundation.
#
# This program is... | sigmunau/nav | python/nav/mibs/etherlike_mib.py | Python | gpl-2.0 | 1,422 | 0 |
import json
from pprint import pprint
import time
import io
# from http://www.codigomanso.com/en/2011/05/trucomanso-transformar-el-tiempo-en-formato-24h-a-formato-12h-python/
def ampmformat (hhmmss):
"""
This method converts time in 24h format to 12h format
Example: "00:32" is "12:32 AM"
"13... | inachen/cs171-hw4-chen-ina | ProblemGeoUSA/data_wrangle_total.py | Python | mit | 1,779 | 0.014615 |
from datetime import date, datetime, timedelta
from itertools import chain
from operator import attrgetter
from django.conf import settings
from django.core.exceptions import ObjectDoesNotExist, ImproperlyConfigured
from django.core.urlresolvers import reverse
from django.db.models import Q, get_app
from django.http i... | hbussell/pinax-tracker | apps/milestones/views.py | Python | mit | 10,170 | 0.003441 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.