code stringlengths 3 1.05M | repo_name stringlengths 5 104 | path stringlengths 4 251 | language stringclasses 1
value | license stringclasses 15
values | size int64 3 1.05M |
|---|---|---|---|---|---|
from django.db import models
from django_extensions.db.fields import (CreationDateTimeField,
ModificationDateTimeField)
class TimestampAbstract(models.Model):
"""
Subclass this to get timestamp fields.
"""
created = CreationDateTimeField()
modified = Modifi... | theteam/scampcat.com | scampcat/common/models.py | Python | mit | 383 |
#!/usr/bin/env python
########################################################################
# File : dirac-admin-sync-users-from-file
# Author : Adrian Casajus
########################################################################
"""
Sync users in Configuration with the cfg contents.
Usage:
dirac-admin-syn... | yujikato/DIRAC | src/DIRAC/Interfaces/scripts/dirac_admin_sync_users_from_file.py | Python | gpl-3.0 | 1,909 |
# Build-in Default Functions for UnivMathSys
# Copyright (C) 2016 Zhang Chang-kai #
# Contact via: phy.zhangck@gmail.com #
# General Public License version 3.0 #
'''Module Elementary.build of UnivMathSys'''
def TrueFunc(*args):
return True
def FalseFunc(*args):
return False
# End ... | Phy-David-Zhang/UnivMathSys | Elementary/build.py | Python | gpl-3.0 | 363 |
import socket
import sys
class Client:
def __init__(self,host,port):
self.host = host
self.port = port
self.size = 1024
self.open_socket()
def open_socket(self):
try:
self.server = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
self.server.conne... | cletusw/goal-e | src/goale/scripts/client.py | Python | mit | 886 |
from decimal import Decimal
import logging
import stripe
from django.conf import settings
from django.utils.translation import ugettext as _
from corehq import Domain
from corehq.apps.accounting.models import (
BillingAccount,
CreditLine,
Invoice,
PaymentRecord,
SoftwareProductType,
)
from corehq.ap... | puttarajubr/commcare-hq | corehq/apps/accounting/payment_handlers.py | Python | bsd-3-clause | 13,441 |
# Dormbase -- open-source dormitory database system
# Copyright (C) 2012 Alex Chernyakhovsky <achernya@mit.edu>
# Drew Dennison <dennison@mit.edu>
# Isaac Evans <ine@mit.edu>
# Luke O'Malley <omalley1@mit.edu>
#
# This program is free software... | dormbase/dormbase | dormbase/facilities/views.py | Python | gpl-3.0 | 1,448 |
# -*- encoding: utf-8 -*-
"""Implements User UI."""
from robottelo.ui.base import Base, UINoSuchElementError
from robottelo.ui.locators import common_locators, locators, tab_locators
from robottelo.ui.navigator import Navigator
class LdapAuthSource(Base):
"""Implements CRUD functions from UI."""
def navigate... | blrm/robottelo | robottelo/ui/ldapauthsource.py | Python | gpl-3.0 | 3,345 |
from django.conf import settings
from django.contrib.auth import get_user_model
from django.core.urlresolvers import reverse
from django.db import models
from django.db.models.signals import post_save
from django.dispatch import receiver
from .managers import ChatMessageManager
class ChatMessage(models.Model):
"... | izzyalonso/tndata_backend | tndata_backend/chat/models.py | Python | mit | 3,508 |
# coding=utf-8
import argparse
import json
import logging
from retry import retry
import helpers
import requests
logger = logging.getLogger('to_sqlite')
handler = logging.FileHandler('to_sqlite.log')
formatter = logging.Formatter('%(asctime)s %(levelname)s %(funcName)s: %(message)s')
handler.setFormatter(formatter)... | termopetteri/raspberry-sensors | to_aws.py | Python | mit | 1,164 |
"""
Test 'webhooks.apps' file
"""
from django.apps import AppConfig
from django.apps import apps as zenboard_apps
class TestWebhooksConfig:
"""
Test 'webhooks.apps.WebhooksConfig'
"""
def test_boards_app_config(self):
"""Test 'webhooks' module `AppConfig` instance"""
webhooks_app_confi... | pawelad/zenboard | tests/webhooks/test_apps.py | Python | apache-2.0 | 478 |
#!/usr/bin/env python
import numpy,sys,matplotlib.pyplot as plt,operator,pickle
#print plt.style.available
#plt.style.use('ggplot')
nrprim = 600*28800000
if len(sys.argv) < 3:
print "Specify at least one input and one output. First input is the one the output is relative to."
sys.exit()
filesin = sys.argv[1:-1]
fil... | brenthuisman/phd_tools | plot.1d.rel.py | Python | lgpl-3.0 | 1,611 |
#!/usr/bin/env python3
import unittest
from scapy.layers.l2 import Ether
from scapy.layers.inet6 import IPv6
from framework import VppTestCase
class TestL2tp(VppTestCase):
""" L2TP Test Case """
@classmethod
def setUpClass(cls):
super(TestL2tp, cls).setUpClass()
cls.create_pg_interfac... | vpp-dev/vpp | test/test_l2tp.py | Python | apache-2.0 | 1,305 |
# Generated by Django 2.0.3 on 2018-03-21 08:24
from django.db import migrations
class Migration(migrations.Migration):
dependencies = [
('flow_rpt', '0007_remove_stage_comment'),
]
operations = [
migrations.AlterModelOptions(
name='flow',
options={'ordering': ['... | cmos3511/cmos_linux | python/op/op_site/flow_rpt/migrations/0008_auto_20180321_1624.py | Python | gpl-3.0 | 355 |
class BaseItem(object):
def __init__(self):
super(BaseItem, self).__init__()
| chrisbrake/PythonSandbox | character/items/item.py | Python | bsd-3-clause | 90 |
from __future__ import unicode_literals
from django.contrib.admin.util import label_for_field
from .utils import AppTestCase
from .testapp.models import SimpleModel, ConcreteModel, AbstractModel
class AdminTests(AppTestCase):
"""
Test admin features
"""
def test_list_label(self):
# Ensure mod... | ellmetha/django-parler | parler/tests/test_admin.py | Python | apache-2.0 | 1,318 |
"""
Special models useful for complex compound models where control is needed over
which outputs from a source model are mapped to which inputs of a target model.
"""
# pylint: disable=invalid-name
from .core import FittableModel, Model
from astropy.units import Quantity
__all__ = ['Mapping', 'Identity', 'UnitsMappi... | dhomeier/astropy | astropy/modeling/mappings.py | Python | bsd-3-clause | 10,827 |
import sys
PY3 = (sys.version_info[0] >= 3)
if PY3:
string_types = str,
else:
string_types = basestring,
from pybindgen.utils import any, mangle_name
import warnings
import traceback
from pybindgen.typehandlers.base import Parameter, ReturnValue, \
join_ctype_and_name, CodeGenerationError, \
param_... | gjcarneiro/pybindgen | pybindgen/cppclass.py | Python | lgpl-2.1 | 175,750 |
def extractBlissfulfairytaleCom(item):
'''
Parser for 'blissfulfairytale.com'
'''
vol, chp, frag, postfix = extractVolChapterFragmentPostfix(item['title'])
if not (chp or vol) or "preview" in item['title'].lower():
return None
tagmap = [
('reborn as the villain president\'s lover', 'reborn as the vill... | fake-name/ReadableWebProxy | WebMirror/management/rss_parser_funcs/feed_parse_extractBlissfulfairytaleCom.py | Python | bsd-3-clause | 951 |
# Copyright (C) 2014 eNovance SAS <licensing@enovance.com>
#
# Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance with the License. You may obtain
# a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicabl... | yanheven/neutron | neutron/agent/linux/keepalived.py | Python | apache-2.0 | 15,621 |
"""Groups API Tests for Version 1.0.
This is a testing template for the generated GroupsAPI Class.
"""
import unittest
import requests
import secrets
from py3canvas.apis.groups import GroupsAPI
from py3canvas.apis.groups import Group
from py3canvas.apis.groups import Groupmembership
class TestGroupsAPI(unittest.Test... | tylerclair/py3canvas | py3canvas/tests/groups.py | Python | mit | 6,436 |
#!/usr/bin/env python2.7
'''
AFL crash analyzer, crash triage for the American Fuzzy Lop fuzzer
Copyright (C) 2015 floyd
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 ve... | chubbymaggie/afl-crash-analyzer | AflCrashAnalyzer.py | Python | gpl-3.0 | 9,878 |
# -*- coding: utf-8 -*-
import re
from random import randrange
from urllib import quote, unquote
from time import time
from module.common.json_layer import json_loads
from module.plugins.Hoster import Hoster
from module.utils import parseFileSize
class RealdebridCom(Hoster):
__name__ = "RealdebridCom"
_... | sebdelsol/pyload | module/plugins/hoster/RealdebridCom.py | Python | gpl-3.0 | 3,217 |
# -*- coding: utf-8 -*-
# Generated by Django 1.10.4 on 2016-12-22 12:05
from __future__ import unicode_literals
from django.db import migrations
import image_cropping.fields
class Migration(migrations.Migration):
dependencies = [
('churchmanager', '0001_initial'),
]
operations = [
migr... | bm424/churchmanager | migrations/0002_church_wide_crop.py | Python | mit | 641 |
# -*- coding: utf-8 -*-
#
# Picard, the next-generation MusicBrainz tagger
#
# Copyright (C) 2019-2020 Philipp Wolfer
# Copyright (C) 2020 Laurent Monin
#
# 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 Fou... | musicbrainz/picard | picard/version.py | Python | gpl-2.0 | 4,658 |
#!/usr/bin/env python
# coding=utf-8
"""
Diophantine equation
Problem 66
Consider quadratic Diophantine equations of the form:
x^2 – Dy^2 = 1
For example, when D=13, the minimal solution in x is 649^2 – 13×180^2 = 1.
It can be assumed that there are no solutions in positive integers when D is
square.
By findin... | openqt/algorithms | projecteuler/ac/old/pe066_diophantine_equation.py | Python | gpl-3.0 | 1,405 |
# -*- coding: utf-8 -*-
#
# This file is part of INSPIRE.
# Copyright (C) 2015 CERN.
#
# INSPIRE 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... | Dziolas/inspire-next | inspire/modules/workflows/models.py | Python | gpl-2.0 | 4,446 |
from __future__ import unicode_literals, division, absolute_import
from builtins import * # noqa pylint: disable=unused-import, redefined-builtin
import logging
import re
from flexget import plugin
from flexget.event import event
from flexget.entry import Entry
from flexget.manager import Session
from flexget.plugin... | LynxyssCZ/Flexget | flexget/plugins/input/next_series_seasons.py | Python | mit | 10,522 |
import numpy
import chainer
from chainer.backends import cuda
from chainer.backends import intel64
def _contains_nan(x):
"""Returns whether the input array has NaN values.
Args:
x (numpy.ndarray or cupy.ndarray): Array to be checked.
Returns:
bool: True if the input has NaN values.
... | rezoo/chainer | chainer/backend.py | Python | mit | 1,748 |
#! /usr/bin/env python
# -*- encoding: utf-8 -*-
from . import controller_account
from . import controller_catalog
from . import controller_sale_order
from . import controller_technical
| grap/odoo-eshop | odoo_eshop/eshop_app/controllers/__init__.py | Python | agpl-3.0 | 187 |
# -*- coding: utf-8 -*-
"""QGIS Unit tests for QgsInterpolatedLineSymbolLayer.
.. note:: This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or
(at your option) any later... | tomtor/QGIS | tests/src/python/test_qgsinterpolatedlinesymbollayers.py | Python | gpl-2.0 | 10,544 |
class ProviderMachine(object):
"""
Representative of a machine resource created by a
:class:`MachineProvider`. The object is typically annotated by the
machine provider, such that the provider can perform subsequent
actions upon it, using the additional metadata for identification,
without lea... | mcclurmc/juju | juju/machine/__init__.py | Python | agpl-3.0 | 732 |
from django.test import TestCase
from store.forms import ReviewForm
from store.models import Review
from .factories import *
class ReviewFormTest(TestCase):
def test_form_validation_for_blank_items(self):
p1 = ProductFactory.create()
form = ReviewForm(
data={'name':'', 'text': '', '... | kevgathuku/compshop | store/tests/test_forms.py | Python | bsd-3-clause | 1,654 |
# 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.
#
# This program is distributed in the hope that it will be useful,
# bu... | tasleson/targetd | targetd/nfs.py | Python | gpl-3.0 | 10,459 |
#!/usr/bin/python
# -*- coding: utf-8 -*-
# Copyright 2015, Syed Faisal Akber
#
| VA3SFA/rpi_hw_demo | hc-sr04/distance.py | Python | gpl-2.0 | 82 |
# -*- coding: utf-8 -*-
# Scrapy settings for tutorial project
#
# For simplicity, this file contains only settings considered important or
# commonly used. You can find more settings consulting the documentation:
#
# http://doc.scrapy.org/en/latest/topics/settings.html
# http://scrapy.readthedocs.org/en/lates... | sserrot/champion_relationships | champion_relationships/settings.py | Python | mit | 3,187 |
from __future__ import print_function
import os
import sys
sys.path.insert(0, os.path.join(os.path.dirname(__file__), "..", ".."))
from pattern.web import Newsfeed, plaintext, URL
from pattern.db import date
# This example reads a given RSS or Atom newsfeed channel.
# Some example feeds to try out:
NATURE = "http://f... | shubhangiKishore/pattern | examples/01-web/06-feed.py | Python | bsd-3-clause | 1,248 |
## datastructure.py
## Author: Yangfeng Ji
## Date: 08-29-2013
## Time-stamp: <yangfeng 02/14/2015 00:28:50>
class SpanNode(object):
""" RST tree node
"""
def __init__(self, prop):
""" Initialization of SpanNode
:type text: string
:param text: text of this span
"""
... | jiyfeng/DPLP | code/datastructure.py | Python | mit | 2,050 |
import myhdl
from myhdl import (Signal, ResetSignal, intbv, always_seq, always,
always_comb)
@myhdl.block
def blinky(led, clock, reset=None):
assert len(led) >= 2
nled = len(led)
maxcnt = int(clock.frequency)
cnt = Signal(intbv(0,min=0,max=maxcnt))
toggle = Signal(bool(0))
... | cfelton/rhea | examples/build/blink.py | Python | mit | 961 |
#!/usr/bin/env python
# coding=utf-8
# 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.
"""Traces an executable and its child processes and extract the files accessed
by them.
The implementation uses OS-... | windyuuy/opera | chromium/src/tools/swarm_client/trace_inputs.py | Python | bsd-3-clause | 137,646 |
#! /usr/bin/env python
# -*- coding: utf-8 -*-
import sys, random, codecs
tags = []
def random_tag():
return tags[random.randint(0, len(tags)-1)]
def emit(B, tag, word):
if word in B[tag]:
return B[tag][word]
#elif word.replace('.', '0', 1).isdigit():
#return 0 if tag == 'ZZ' else float... | DevinZ1993/Pieces-of-Code | python/cs544/hmm/hmmdecode.py | Python | mpl-2.0 | 3,101 |
from lcc.stars_processing.utilities.base_descriptor import BaseDescriptor
class AbbeValueDescr(BaseDescriptor):
"""
AbbeValueDescr describes stars by Abbe values
Attributes
----------
bins : int
Dimension of reduced light curve from which Abbe value
is calculated
"""
LABE... | mavrix93/LightCurvesClassifier | lcc/stars_processing/descriptors/abbe_value_descr.py | Python | mit | 1,050 |
from collections import OrderedDict
from .country import Country
class Index(object):
"""
Generate index based on the position in bytes
of every letter in the alphabet.
The index is stored in an OrderedDict.
It's a lazy index, the index is not generated
till the first call.
"""
def __i... | malev/gender-detector | gender_detector/index.py | Python | gpl-2.0 | 952 |
# Author: Xavier Paredes-Fortuny (xparedesfortuny@gmail.com)
# License: MIT, see LICENSE.md
import numpy as np
def resamp_line(all_lines, resamp, a, CGS_units):
"""Downsamples the line to 'resamp' cells.
All the lines should have the same lenght with a constant
cell size.
We are not averaging the dat... | xparedesfortuny/pylines | resamp_line.py | Python | mit | 6,769 |
from montemodes import classes as res
__author__ = 'abel'
import math
import random
import copy
import numpy as np
def weighted_choice(weights):
total = sum(weights)
threshold = random.uniform(0, total)
for k, weight in enumerate(weights):
total -= weight
if total < threshold:
... | abelcarreras/MonteModes | montemodes/functions/montecarlo.py | Python | mit | 6,111 |
#!/usr/bin/env python
# coding: UTF-8
from __future__ import division
from util.hosvd import HOSVD, unfold, reconstruct, frobenius_norm
from util.mobility import trans, init_data, init_data2, trans2
import numpy as np
import math
import pylab
# 第一步:构建转移概率tensor
# tensor = trans(count(init_db()))
# tensor = trans(count... | pengyuan/markov2tensor | recommendation/fuzzy_recommend.py | Python | mit | 7,681 |
from .. import db
import datetime
class Client(db.Model):
__tablename__='client'
id=db.Column(db.Integer,primary_key=True)
name=db.Column(db.Unicode(16))
tel=db.Column(db.Unicode(16))
memo=db.Column(db.Unicode(64))
channel_id=db.Column(db.Integer,db.ForeignKey('channel.id'))
channel=db.relationship('Channel',b... | colaftc/webtool | app/client/models.py | Python | mit | 394 |
# 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 ... | AutorestCI/azure-sdk-for-python | azure-mgmt-resource/azure/mgmt/resource/resources/v2017_05_10/models/tag_value.py | Python | mit | 1,165 |
"""
Example of how to generate a Cyclo-Static dataflow graph
"""
from Turbine.generation.generate import generate
from Turbine.param.parameters import Parameters
print "###### Setup the CSDF generation ####"
c_param = Parameters()
# Set the CSDF type for the generation
c_param.set_dataflow_type("CSDF")
# Min/Max pha... | bbodin/turbine | Turbine/examples/generate_CSDFG.py | Python | gpl-2.0 | 649 |
import pytest
import numpy as np
def test_oudin():
from pypet import oudin, daily_extraterrestrial_radiation
doy = 1
latitude = 0.0
def py_oudin(d, l, t, density=1000, latent_heat=2.45):
re = daily_extraterrestrial_radiation(d, l)
if t > -5:
return 1e3 * re * (t + 5) / (1... | jetuk/pypet | tests/test_pet_ufunc.py | Python | mit | 618 |
# Copyright (c) 2015 Russell Sim <russell.sim@gmail.com>
#
# 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 ... | annegentle/fairy-slipper | config.py | Python | apache-2.0 | 2,149 |
"""
WSGI config for supportcenter project.
This module contains the WSGI application used by Django's development server
and any production WSGI deployments. It should expose a module-level variable
named ``application``. Django's ``runserver`` and ``runfcgi`` commands discover
this application via the ``WSGI_APPLICAT... | LethusTI/supportcenter | supportcenter/wsgi.py | Python | gpl-3.0 | 1,220 |
#!/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
"License");... | arenadata/ambari | ambari-server/src/main/resources/stacks/ADH/1.5/services/HIVE/package/scripts/params_linux.py | Python | apache-2.0 | 42,040 |
# -*- coding: utf-8 -*-
from __future__ import division
from __future__ import absolute_import
import datetime as dt
import io
import pkgutil
import weakref
from six.moves import range
import arduino_helpers.hardware.teensy as teensy
import arduino_helpers.hardware.teensy.adc as adc
import arduino_helpers.hardware.tee... | wheeler-microfluidics/teensy-minimal-rpc | teensy_minimal_rpc/adc_sampler.py | Python | gpl-3.0 | 51,254 |
# -*- cpy-indent-level: 4; indent-tabs-mode: nil -*-
# ex: set expandtab softtabstop=4 shiftwidth=4:
#
# Copyright (C) 2011,2012,2013,2014,2016,2017 Contributor
#
# 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... | quattor/aquilon | lib/aquilon/worker/commands/manage_list.py | Python | apache-2.0 | 9,010 |
import pandas as pd
from sklearn.model_selection import KFold
from sklearn.model_selection import cross_val_score
from sklearn.linear_model import LinearRegression
names = ['CRIM', 'ZN', 'INDUS', 'CHAS', 'NOX', 'RM', 'AGE',
'DIS', 'RAD', 'TAX', 'PTRATIO',
'B', 'LSTAT', 'MEDV']
data = ... | Swaraj1998/MyCode | ML-Workshop/mean_abs_error.py | Python | mit | 675 |
#!/usr/bin/env python3
from distutils.core import setup
setup(
name='figurePXJ',
version='0.0.0',
author='Xingjie Pan',
author_email='xingjiepan@gmail.com',
url='https://github.com/xingjiepan/figurePXJ',
packages=[
'figurePXJ',
],
install_requires=[
'numpy',
'sc... | xingjiepan/figurePXJ | setup.py | Python | gpl-3.0 | 668 |
from django.conf.urls import patterns, include, url
from django.contrib import admin
admin.autodiscover()
urlpatterns = patterns('',
# Examples:
url(r'^$', 'demo.views.index', name='index'),
url(r'^all_events/', 'demo.views.all_events', name='all_events'),
url(r'^admin/', include(admin.site.urls)),
)
| rodrigoamaral/django-fullcalendar | demo/demo/urls.py | Python | mit | 320 |
import pygame
from snake.resource import R
from snake.scene import Scene
from snake.ui.information import Information
class MenuScene(Scene):
def setup(self):
self.information_ui = Information()
R.play_music("menu")
def update(self, delta):
self.information_ui.update(delta)
def re... | ccmikechen/snake_game | snake/scenes/menu_scene.py | Python | mit | 568 |
from mig_app import app, db
from models import Foo
@app.route('/')
def index():
return "this is the index"
@app.route('/query')
def query_all():
result = Foo.query.filter_by(id=1).first()
return result.fooname
| Skablam/Flask-Migration-Example | mig_app/server.py | Python | mit | 224 |
# --------------------------------------------------------------------------------------------
# Copyright (c) Microsoft Corporation. All rights reserved.
# Licensed under the MIT License. See License.txt in the project root for license information.
# --------------------------------------------------------------------... | yugangw-msft/azure-cli | src/azure-cli/azure/cli/command_modules/acs/tests/hybrid_2020_09_01/test_loadbalancer.py | Python | mit | 3,509 |
#!/usr/bin/env python3
# fileencoding: utf-8
import os
import sys
import unittest
cafepypath = os.path.join(os.path.dirname(__file__), '..')
sys.path.append(cafepypath)
from cafepy.files import Ninfo
class TestReadNinfo(unittest.TestCase):
@classmethod
def setUpClass(cls):
cls.testdata = os.path.join... | Moguf/cafepy | test/test_ninfofile.py | Python | gpl-3.0 | 1,662 |
import urllib
counts = dict()
fhand = urllib.urlopen('http://www.py4inf.com/code/romeo.txt')
for line in fhand:
words = line.split()
for word in words:
counts[word] = counts.get(word,0) + 1
print counts
| annelida/stuff | Scripts/urlwords.py | Python | mit | 219 |
# -*- coding: utf-8 -*-
# Generated by Django 1.10.7 on 2017-07-12 08:54
from __future__ import unicode_literals
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('organisation', '0029_auto_20170707_1224'),
]
operations = [
migrations.AddF... | rockychen-dpaw/oim-cms | organisation/migrations/0030_departmentuser_azure_guid.py | Python | apache-2.0 | 530 |
import argparse
from rdflib import Graph
def simple_merge(sources):
graph = Graph()
for source in sources:
print("Loading %s..." % source)
graph.parse(source)
return graph
def verbose_merge(sources):
# Prints out every newly merged triple and keep count of how many were already there.... | hsoft/dgeq-rdf | merge.py | Python | bsd-3-clause | 1,448 |
import sys
def add_appsever_import_paths():
from dev_appserver import EXTRA_PATHS
for extra_path in EXTRA_PATHS:
if extra_path not in sys.path:
sys.path = [extra_path] + sys.path
def initialize_service_apis():
from google.appengine.tools import dev_appserver
from google.appengin... | blairconrad/LibraryHippo | App/gael/testing.py | Python | mit | 517 |
## -*- coding: utf-8 -*-
from.vendor.Qt import QtCore, QtGui, QtWidgets
from . import lib
class PartitionWidget(QtWidgets.QWidget):
def __init__(self, parent, data):
self.parent = parent
self.data = data
super(PartitionWidget, self).__init__(parent)
def mouseMoveEvent(self, event):
... | mochio326/SiShelf | Contents/scripts/sishelf/partition.py | Python | mit | 4,465 |
# Copyright (C) 2016 Li Cheng at Beijing University of Posts
# and Telecommunications. www.muzixing.com
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licens... | muzixing/ryu | ryu/app/network_awareness/network_monitor.py | Python | apache-2.0 | 16,706 |
# Copyright 2016 Capital One Services, 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... | andrewalexander/cloud-custodian | tools/c7n_salactus/c7n_salactus/cli.py | Python | apache-2.0 | 8,030 |
# __init__.py for gempy.eti module
__version__ = '0.1.0 (May 2010)'
import gemcombineeti
import gireduceeti
import gmosaiceti
import gsappwaveeti
import gscrrejeti
import gsextracteti
import gsflateti
import gsskysubeti
import gstransformeti
import gswavelengtheti
import sploteti
| pyrrho314/recipesystem | trunk/gempy/gemini/eti/__init__.py | Python | mpl-2.0 | 283 |
"""
Based on Parsedom for XBMC plugins
Copyright (C) 2010-2011 Tobias Ussing And Henrik Mosgaard Jensen
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,... | felipenaselva/felipe.repository | plugin.video.streamhub/resources/lib/modules/dom_parser.py | Python | gpl-2.0 | 5,193 |
import os
import os.path
from amuse.units import units
from amuse.datamodel import Particle
from amuse.ext.star_to_sph import pickle_stellar_model
from amuse.community.mesa.interface import MESA as stellar_evolution_code
from xiTau_parameters import triple_parameters
def evolve_giant(giant, stop_radius):
stell... | hilaglanz/TCE | articles/A_evolve_outer_star_to_giant.py | Python | gpl-2.0 | 1,405 |
from __future__ import print_function
from builtins import range
import sys, os
sys.path.insert(1, os.path.join("..","..",".."))
import h2o
from tests import pyunit_utils
from h2o.estimators.deeplearning import H2ODeepLearningEstimator
def imbalance():
print("Test checks if Deep Learning works fine with an imbalanc... | mathemage/h2o-3 | h2o-py/tests/testdir_algos/deeplearning/pyunit_imbalance_deeplearning_large.py | Python | apache-2.0 | 1,947 |
from django.shortcuts import render
# Create your views here.
from django.shortcuts import render
from django.shortcuts import get_object_or_404
from django.http import HttpResponseRedirect, HttpResponse
from django.core.urlresolvers import reverse
from datetime import datetime
from .forms import TaskForm
from djang... | scotthuang1989/timesheet | activity/views.py | Python | apache-2.0 | 4,632 |
#!/usr/bin/env python3
# Copyright (c) 2014-2017 Wladimir J. van der Laan
# Distributed under the MIT software license, see the accompanying
# file COPYING or http://www.opensource.org/licenses/mit-license.php.
'''
Script to generate list of seed nodes for chainparams.cpp.
This script expects two text files in the dir... | hexxcointakeover/hexxcoin | contrib/seeds/generate-seeds.py | Python | mit | 4,332 |
# -*- coding: utf-8 -*-
import os
from math import factorial
import functools
def memoize(func):
cache = {}
def memoized(key):
# Returned, new, memoized version of decorated function
if key not in cache:
cache[key] = func(key)
return cache[key]
return functools.updat... | NicovincX2/Python-3.5 | Algorithmique/Mathématiques discrètes/Combinatoire/Nombre de Catalan/nb_catalan_3methods.py | Python | gpl-3.0 | 1,091 |
# vim: tabstop=4 shiftwidth=4 softtabstop=4
# Copyright 2012 United States Government as represented by the
# Administrator of the National Aeronautics and Space Administration.
# All Rights Reserved.
#
# Copyright 2012 Nebula, Inc.
#
# Licensed under the Apache License, Version 2.0 (the "License"); you may
# no... | Havate/havate-openstack | proto-build/gui/horizon/Horizon_GUI/openstack_dashboard/dashboards/admin/info/views.py | Python | apache-2.0 | 1,045 |
import time
from pigredients.ics import ws2801 as ws2801
if __name__ == '__main__':
led_chain = ws2801.WS2801_Chain()
led_chain.all_off()
led_chain.write()
led_chain.set_ic(ic_id=24, rgb_value=[255,0,255])
led_chain.write()
time.sleep(2)
led_chain.set_ic(ic_id=24, rgb_value=[0,0,0])
... | rasathus/pigredients | examples/ws2801.py | Python | mit | 795 |
# Copyright 2015 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... | laosiaudi/tensorflow | tensorflow/python/ops/nn_grad.py | Python | apache-2.0 | 20,435 |
#!/usr/bin/env python
# -*- coding:utf-8 -*-
"""
This file implement the tcp server for account-manager.
Multi Thread.
"""
__version__ = "0.1"
DEFAULT_ERROR_MESSAGE = """
Error Code:%(code)d.
Message:%(message)s.
Code Explain:%(explain)s.
"""
DEFAULT_ERROR_CONTENT_TYPE = "text/html"
import sys
import time
import ... | lifulong/account-manager | src/core/svr.py | Python | gpl-2.0 | 15,228 |
import os
import sys
BASE_DIR = os.path.join(os.path.dirname(__file__), "..")
sys.path.insert(0, BASE_DIR)
import argparse
import time
import datetime
from flask import Flask, g, render_template
from flask.ext.sqlalchemy import SQLAlchemy
from server.data import Contest
import lib.models as models
from server.util imp... | SuprDewd/epsilon | server/epsilon.py | Python | mit | 4,043 |
"""
:synopsis: most ajax processors for askbot
This module contains most (but not all) processors for Ajax requests.
Not so clear if this subdivision was necessary as separation of Ajax and non-ajax views
is not always very clean.
"""
import datetime
import logging
from bs4 import BeautifulSoup
from django.conf import... | maxwward/SCOPEBak | askbot/views/commands.py | Python | gpl-3.0 | 52,741 |
#!/usr/bin/env python
import os
import sys
import logging
import subprocess
from lib.environ import setup_environ
setup_environ()
# Don't allow `runserver` or `shell`
if 'runserver' in sys.argv:
logging.warn('You should serve your local instance with dev_appserver. See `serve.sh`')
subprocess.call('./serve.s... | papaloizouc/InvalidNameException | manage.py | Python | gpl-2.0 | 664 |
'''
SASSIE: Copyright (C) 2011 Joseph E. Curtis, Ph.D.
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 versio... | madscatt/zazzie | src_2.7/sassie/interface/two_body_grid/two_body_grid_filter.py | Python | gpl-3.0 | 8,445 |
#
# Copyright © 2012 - 2021 Michal Čihař <michal@cihar.com>
#
# This file is part of Weblate <https://weblate.org/>
#
# 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 Lice... | phw/weblate | weblate/trans/tests/test_variants.py | Python | gpl-3.0 | 5,304 |
"""
问题描述:在一个二维坐标系中,所有的值都是double类型,那么一个三角形可以由3个点来代表,
给定3个点代表的三角形,再给定一个点(x,y),判断(x,y)是否在三角形中.
"""
class PointInTriangle:
@classmethod
def cross_product(cls, x1, y1, x2, y2):
return x1 * y2 - x2 * y1
@classmethod
def is_inside(cls, x1, y1, x2, y2, x3, y3, x, y):
if cls.cross_product(x3-x... | ResolveWang/algrithm_qa | other/q5.py | Python | mit | 989 |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
#
# isocodes
#
# Copyright (C) 2011
# Einar Uvsløkk, <einar.uvslokk@linux.com>
#
# isocodes 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... | vegarwe/luma | tools/util/isocodes.py | Python | gpl-2.0 | 11,783 |
# Copyright 2014-2017 Pedro M. Baeza <pedro.baeza@tecnativa.com>
# Copyright 2018-2019 Sergio Teruel <sergio.teruel@tecnativa.com>
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl).
from odoo import api, fields, models
from odoo.fields import first
class StockPicking(models.Model):
_inherit = 'stock... | Vauxoo/stock-logistics-workflow | stock_picking_show_return/models/stock_picking.py | Python | agpl-3.0 | 1,320 |
import tensorflow as tf
from niftynet.application.segmentation_application import \
SegmentationApplication
from niftynet.engine.application_factory import OptimiserFactory
from niftynet.engine.application_variables import CONSOLE
from niftynet.engine.application_variables import TF_SUMMARIES
from niftynet.layer.l... | NifTK/NiftyNet | demos/Learning_Rate_Decay/Demo_applications/no_decay_lr_comparison_application.py | Python | apache-2.0 | 3,933 |
import sys
import os
if sys.platform == "win32":
import _winreg
import yaku.utils
import yaku.task
if sys.platform == "win32":
from yaku.tools.mscommon.common \
import \
read_keys, open_key, close_key, get_output
from yaku.tools.msvc \
import \
_exec_command_factory... | abadger/Bento | bento/private/_yaku/yaku/tools/ifort.py | Python | bsd-3-clause | 3,189 |
# -*- coding: utf-8 -*-
# Copyright (c) 2011 - 2014 Detlev Offenbach <detlev@die-offenbachs.de>
#
"""
Module implementing a dialog to enter the data for a rebase session.
"""
from __future__ import unicode_literals
from PyQt5.QtCore import pyqtSlot
from PyQt5.QtWidgets import QDialog, QDialogButtonBox
from .Ui_HgR... | davy39/eric | Plugins/VcsPlugins/vcsMercurial/RebaseExtension/HgRebaseDialog.py | Python | gpl-3.0 | 9,628 |
# Authors: Josef Pktd and example from H Raja and rewrite from Vincent Davis
# Alexandre Gramfort <alexandre.gramfort@telecom-paristech.fr>
#
# Code borrowed from statsmodels
#
# License: BSD (3-clause)
import numpy as np
def _ecdf(x):
"""No frills empirical cdf used in fdrcorrection."""
nobs = len(... | adykstra/mne-python | mne/stats/multi_comp.py | Python | bsd-3-clause | 3,033 |
from django.http import HttpResponse
from django.core.cache import cache
from EventSubscriptions.models import EventWithSubscriptions
import requests
'''
This view provides the final result requested from the exercise. It first looks for it in the cache; if the result is
not there, it calls the class "EventWithSubscri... | luispdm/Calendar42Proxy | EventSubscriptions/views.py | Python | gpl-3.0 | 1,983 |
#!/usr/bin/env python
#
# Author: Oliver J. Backhouse <olbackhouse@gmail.com>
# George H. Booth <george.booth@kcl.ac.uk>
#
'''
An example of Density-fitted AGF2 with MPI (the MPI support is very transparent,
so this example is almost identical to 02-dfagf2.py).
MPI support is provided by mpi4py module. The i... | sunqm/pyscf | examples/agf2/09-mpi_dfragf2.py | Python | apache-2.0 | 1,251 |
"""
This module implements WSGI related helpers adapted from ``werkzeug.wsgi``
:copyright: (c) 2010 by the Werkzeug Team, see AUTHORS for more details.
:license: BSD, see LICENSE for more details.
"""
from opbeat.utils import six
try:
from urllib import quote
except ImportError:
from urllib.parse import quote
... | daikeren/opbeat_python | opbeat/utils/wsgi.py | Python | bsd-3-clause | 3,335 |
import sys
from PyQt5.QtWidgets import *
from PyQt5.QAxContainer import *
from PyQt5.QtCore import *
import time
import pandas as pd
import sqlite3
TR_REQ_TIME_INTERVAL = 0.2
class Kiwoom(QAxWidget):
def __init__(self):
super().__init__()
self._create_kiwoom_instance()
self._set_signal_sl... | pystockhub/book | ch18/day01/Kiwoom.py | Python | mit | 4,398 |
# Copyright (c) 2013-2015 Rusty Wagner
#
# 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... | kanpol/bina | PEFile.py | Python | gpl-2.0 | 18,019 |
#!/usr/bin/env python
#
# Electrum - lightweight Bitcoin client
# Copyright (C) 2016 Thomas Voegtlin
#
# 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... | pknight007/electrum-vtc | lib/base_wizard.py | Python | mit | 16,334 |
# Copyright (C) 2016 Google Inc.
# Licensed under http://www.apache.org/licenses/LICENSE-2.0 <see LICENSE file>
"""
Add Snapshot model
Create Date: 2016-07-28 14:09:21.338385
"""
# disable Invalid constant name pylint warning for mandatory Alembic variables.
# pylint: disable=invalid-name
import sqlalchemy as sa
fr... | j0gurt/ggrc-core | src/ggrc/migrations/versions/20160728140921_2a5a39600741_add_snapshot_model.py | Python | apache-2.0 | 1,958 |
import os
import sys
def parse_args():
import optparse
parser = optparse.OptionParser()
parser.add_option('--where', default=None)
opts, args = parser.parse_args()
return opts, args
def run_tests(base_dir=None, apps=None, verbosity=1, interactive=False):
base_dir = base_dir or os.path.dirnam... | giginet/django-generic-tagging | runtests.py | Python | mit | 1,063 |
#!/usr/bin/env python
# Plotfreq plots spectral data from the buffer and allows interactive selection
# of frequency bands for further processing
#
# This software is part of the EEGsynth project, see <https://github.com/eegsynth/eegsynth>.
#
# Copyright (C) 2017-2020 EEGsynth project
#
# This program is free software... | robertoostenveld/eegsynth-matlab | module/plotspectral/plotspectral.py | Python | gpl-2.0 | 20,540 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.