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 |
|---|---|---|---|---|---|---|
# Opus/UrbanSim urban simulation software.
# Copyright (C) 2005-2009 University of Washington
# See opus_core/LICENSE
from opus_core.opus_package import OpusPackage
class package(OpusPackage):
name = 'psrc'
required_opus_packages = ["opus_core", "opus_emme2", "urbansim"]
| christianurich/VIBe2UrbanSim | 3rdparty/opus/src/psrc/opus_package_info.py | Python | gpl-2.0 | 292 | 0.006849 |
# Make sure you name your file with className.py
from hint.hint_class_helpers.find_matches import find_matches
class Prob2_Part1:
"""
Author: Shen Ting Ang
Date: 10/11/2016
"""
def check_attempt(self, params):
self.attempt = params['attempt'] #student's attempt
self.answer = params[... | zhenzhai/edx-platform | common/lib/sandbox-packages/hint/hint_class/Week3/Prob2_Part1.py | Python | agpl-3.0 | 1,401 | 0.013562 |
"""
Common distributions with standard parameterizations in Python
@author : Spencer Lyon <spencer.lyon@stern.nyu.edu>
@date : 2014-12-31 15:59:31
"""
from math import sqrt
import numpy as np
__all__ = ["CanDistFromScipy"]
pdf_docstr = r"""
Evaluate the probability density function, which is defined as
.. math::
... | spencerlyon2/distcan | distcan/scipy_wrap.py | Python | mit | 10,929 | 0 |
#----------------------------------------------------------------------------------------
# nautilus-copypath - Quickly copy file paths to the clipboard from Nautilus.
# Copyright (C) Ronen Lapushner 2017-2018.
# Distributed under the GPL-v3+ license. See LICENSE for more information
#----------------------------------... | ronen25/nautilus-copypath | nautilus-copypath.py | Python | gpl-3.0 | 2,595 | 0.004624 |
# Copyright 2019 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... | karllessard/tensorflow | tensorflow/lite/testing/op_tests/greater.py | Python | apache-2.0 | 2,735 | 0.001828 |
SBINDIR="/usr/sbin"
BINDIR="/usr/bin"
LIBEXEC="/usr/lib/xen/bin"
LIBDIR="/usr/lib64"
SHAREDIR="/usr/share"
PRIVATE_BINDIR="/usr/lib64/xen/bin"
XENFIRMWAREDIR="/usr/lib/xen/boot"
XEN_CONFIG_DIR="/etc/xen"
XEN_SCRIPT_DIR="/etc/xen/scripts"
XEN_LOCK_DIR="/var/lock"
XEN_RUN_DIR="/var/run/xen"
XEN_PAGING_DIR="/var/lib/xen/x... | Hearen/OnceServer | pool_management/bn-xend-core/util/path.py | Python | mit | 330 | 0.036364 |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
#
# Copyright 2002-2006 Zuza Software Foundation
#
# This file is part of translate.
#
# translate 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... | lehmannro/translate | storage/csvl10n.py | Python | gpl-2.0 | 7,279 | 0.001786 |
"""
API for initiating and tracking requests for credit from a provider.
"""
from __future__ import absolute_import
import datetime
import logging
import uuid
import pytz
import six
from django.db import transaction
from edx_proctoring.api import get_last_exam_completion_date
from openedx.core.djangoapps.credit.exc... | ESOedX/edx-platform | openedx/core/djangoapps/credit/api/provider.py | Python | agpl-3.0 | 16,234 | 0.002649 |
import os
from .base import Output
class AppleSay(Output):
"""Speech output supporting the Apple Say subsystem."""
name = 'Apple Say'
def __init__(self, voice = 'Alex', rate = '300'):
self.voice = voice
self.rate = rate
super(AppleSay, self).__init__()
def is_active(self):
return not os.system('which say')... | frastlin/PyAudioGame | pyaudiogame/accessible_output2/outputs/say.py | Python | mit | 535 | 0.050467 |
# -*- Mode: Python -*-
import socket
import unittest
__version__ = '0.1.1'
from .cys2n import *
protocol_version_map = {
'SSLv2' : 20,
'SSLv3' : 30,
'TLS10' : 31,
'TLS11' : 32,
'TLS12' : 33,
}
class PROTOCOL:
reverse_map = {}
for name, val in protocol_version_map.items():
setattr (PROT... | samrushing/cys2n | cys2n/__init__.py | Python | bsd-2-clause | 2,452 | 0.01509 |
#!/usr/bin/env python3
import pwd
for p in pwd.getpwall():
if p.pw_shell.endswith('/bin/bash'):
print(p[0])
| thunderoy/dgplug_training | assignments/assign4.py | Python | mit | 121 | 0.008264 |
print " Content-Type: text/html; charset=utf-8"
print ""
print """
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<script type="text/javascript" src="http://yui.yahooapis.com/combo?3.3.0/build/yui/yui-min.js&3.3.0/build/loader/loader-min.js"></script>
</head>
<body class="yui3-skin... | girvan/pili | test/base_real.py | Python | lgpl-3.0 | 501 | 0.003992 |
# Copyright 2017 The Sonnet 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 applicable l... | mumuwoyou/vnpy-master | sonnet/python/modules/spatial_transformer.py | Python | mit | 23,304 | 0.006222 |
from __future__ import unicode_literals, division, absolute_import
from builtins import * # pylint: disable=unused-import, redefined-builtin
import logging
from flexget import plugin
from flexget.event import event
log = logging.getLogger('rerun')
class MaxReRuns(object):
"""Force a task to rerun for debuggin... | qvazzler/Flexget | flexget/plugins/operate/rerun.py | Python | mit | 643 | 0 |
# -*- coding: utf-8 -*-
# author : kian-meng, ang
#
# input : a dna string at most 100 nt (NucleoTides)
# output : 20 12 17 21
#
# $ python counting_nucleotides.py
# input : a dna string at most 100 nt (NucleoTides)
# output : 20 12 17 21
f = open("rosalind_dna.txt", "r")
dna_string = f.read()
# method 1: using co... | kianmeng/codekata | rosalind/001_dna_counting_nucleotides/counting_nucleotides.py | Python | gpl-3.0 | 1,370 | 0.00073 |
from django.utils.translation import ugettext_lazy as _
import horizon
from openstack_dashboard.dashboards.tasks import dashboard
class History(horizon.Panel):
name = _("History")
slug = "history"
dashboard.Tasks.register(History)
| icloudrnd/automation_tools | openstack_dashboard/dashboards/tasks/history/panel.py | Python | apache-2.0 | 243 | 0.004115 |
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.db import models, migrations
class Migration(migrations.Migration):
dependencies = [
('app', '0009_file_method'),
]
operations = [
migrations.AddField(
model_name='file',
name='time',
... | gregoriorobles/drPencilcode | app/migrations/0010_file_time.py | Python | agpl-3.0 | 417 | 0 |
from __future__ import absolute_import, unicode_literals
from django.conf.urls import url
from django.core.urlresolvers import RegexURLResolver
from django.http import Http404
from wagtail.wagtailcore.models import Page
from wagtail.wagtailcore.url_routing import RouteResult
_creation_counter = 0
def route(pattern... | Toshakins/wagtail | wagtail/contrib/wagtailroutablepage/models.py | Python | bsd-3-clause | 3,477 | 0.000575 |
#
# Copyright 2017 Red Hat, Inc.
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 2 of the License, or
# (at your option) any later version.
#
# This program is distributed in th... | EdDev/vdsm | lib/vdsm/virt/metadata.py | Python | gpl-2.0 | 17,301 | 0 |
"""
SALTS XBMC Addon
Copyright (C) 2014 tknorris
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.
T... | felipenaselva/repo.felipe | plugin.video.salts/scrapers/xmovies8v2_scraper.py | Python | gpl-2.0 | 7,473 | 0.007895 |
import myhdl
from myhdl import *
from bin2gray2 import bin2gray
from inc import Inc
def GrayInc(graycnt, enable, clock, reset, width):
bincnt = Signal(modbv(0)[width:])
inc_1 = Inc(bincnt, enable, clock, reset)
bin2gray_1 = bin2gray(B=bincnt, G=graycnt, width=width)
return inc_1, bin2gr... | cfelton/myhdl | example/manual/GrayInc.py | Python | lgpl-2.1 | 1,048 | 0.016221 |
# -*- coding: utf-8 -*-
# pinched from django-moderation.
# modified to include rather than exclude, fields
import re
import difflib
def get_changes_between_models(model1, model2, include=[]):
from django.db.models import fields
changes = {}
for field_name in include:
field = type(model1)._meta.ge... | ixc/glamkit-eventtools | eventtools/utils/diff.py | Python | bsd-3-clause | 2,524 | 0.004754 |
#!/usr/bin/env python
import os
import sys
if __name__ == "__main__":
os.environ.setdefault("DJANGO_SETTINGS_MODULE", "BlogforSummyChou.settings")
from django.core.management import execute_from_command_line
execute_from_command_line(sys.argv)
| Adai0808/SummyChou | BlogforSummyChou/manage.py | Python | gpl-2.0 | 259 | 0.003861 |
# views are handlers that respond to requests from web browsers or other clients
# Each view function maps to one or more request URLs
from flask import render_template, flash, redirect
from app import app
from .forms import Deck
#./run.py
@app.route('/submit', methods=('GET', 'POST'))
def submit():
form = Deck()
i... | ecotg/Flash-Card-App | app/views.py | Python | mit | 1,100 | 0.048182 |
import glob
import logging
import os
from typing import Any, Dict, List, Optional
from django.conf import settings
from zerver.lib.storage import static_path
# See https://jackstromberg.com/2013/01/useraccountcontrol-attributeflag-values/
# for docs on what these values mean.
LDAP_USER_ACCOUNT_CONTROL_NORMAL = "512"... | rht/zulip | zerver/lib/dev_ldap_directory.py | Python | apache-2.0 | 3,149 | 0.00127 |
#!/usr/bin/env python
import os
import django
from os import path
from django.conf import settings
from django.core.management import call_command
def main():
if not settings.configured:
module_root = path.dirname(path.realpath(__file__))
settings.configure(
DEBUG = False,
... | ixc/django-fluent-contents | makemessages.py | Python | apache-2.0 | 634 | 0.012618 |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
from __future__ import division, print_function, absolute_import, unicode_literals
from .value_types import find_value_type, TypeBase
from six import string_types
import re
from qtpy.QtCore import *
from qtpy.QtGui import *
from qtpy.QtWidgets import *
from .default_value_d... | pashango2/sphinx-explorer | sphinx_explorer/property_widget/property_model.py | Python | mit | 24,672 | 0.000851 |
from django.test import TestCase, RequestFactory
from main.models import *
from main.views import *
from bs4 import BeautifulSoup
from .base import *
import datetime
from feedback.models import IndividualFeedback
class StatusCheckTest(TestCase):
"""Testing the decorator test functions"""
def test_user_teache... | tobi2006/nomosdb | main/tests/test_views.py | Python | gpl-3.0 | 145,259 | 0.000296 |
#!/usr/bin/env python3
'''automated testing of Samba3 against windows'''
import wintest
def set_libpath(t):
t.putenv("LD_LIBRARY_PATH", "${PREFIX}/lib")
def set_krb5_conf(t):
t.run_cmd("mkdir -p ${PREFIX}/etc")
t.write_file("${PREFIX}/etc/krb5.conf",
'''[libdefaults]
dns_lookup_realm... | kernevil/samba | wintest/test-s3.py | Python | gpl-3.0 | 10,296 | 0.003011 |
# -*- coding: utf-8 -*-
# © 2015 Nedas Žilinskas <nedas.zilinskas@gmail.com>
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html).
{
"name": "Variant Pictures",
"category": "Website",
"summary": "Shows picture of the product variant instead of plain color",
"version": "8.0.1.0",
"des... | nedaszilinskas/Odoo-CMS-Variant-Pictures | website_sale_variant_pictures/__openerp__.py | Python | mit | 783 | 0 |
from hubs.ha import haremote as ha
from hubs.ha.hasshub import HAnode, RegisterDomain
from controlevents import CEvent, PostEvent, ConsoleEvent, PostIfInterested
from utils import timers
import functools
# noinspection PyTypeChecker
class Thermostat(HAnode): # deprecated version
def __init__(self, HAitem, d):
sup... | kevinkahn/softconsole | hubs/ha/domains/__oldthermostat.py | Python | apache-2.0 | 3,386 | 0.025399 |
# -*- coding: utf-8 -*-
from baseprovider import BaseProvider
from utils import clean
class Company(BaseProvider):
"""Basic definition of a Company"""
def __init__(self, locales):
super(Company, self).__init__(locales)
def new(self):
self.name = self.parse('company.name')
self.su... | mpuig/faker | faker/providers/company.py | Python | isc | 624 | 0 |
#!/usr/bin/python
# -*- coding: utf-8 -*-
"""Unit tests for pywikibot/textlib.py"""
__version__ = '$Id: cadd8620e9dba64e3c2f3082e6f03f4551fd7641 $'
import unittest
from tests.test_pywiki import PyWikiTestCase
import wikipedia as pywikibot
import pywikibot.textlib as textlib
import catlib
class PyWikiTextLibTestCa... | races1986/SafeLanguage | CEM/tests/test_textlib.py | Python | epl-1.0 | 4,110 | 0.004623 |
import os
import numpy as np
from typing import List, Dict, Union, Optional
import subprocess as sp
import matplotlib
import matplotlib.transforms
import matplotlib.pyplot as plt
import matplotlib.gridspec as gs
import matplotlib.transforms as tf
import matplotlib.cm as cm
from matplotlib.axes import Axes
from matplotl... | JoostHuizinga/ea-plotting-scripts | configure_plots.py | Python | mit | 25,413 | 0.002873 |
# Copyright 2017 Battelle Energy Alliance, 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 t... | joshua-cogliati-inl/raven | tests/framework/unit_tests/utils/testTreeStructure.py | Python | apache-2.0 | 8,503 | 0.029401 |
# -*- coding: utf-8 -*-
##
## This file is part of Invenio.
## Copyright (C) 2007, 2008, 2009, 2010, 2011 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
## Licens... | Panos512/invenio | modules/webjournal/lib/widgets/bfe_webjournal_widget_latestPhoto.py | Python | gpl-2.0 | 4,058 | 0.005914 |
from selenium.webdriver import ActionChains
from selenium.webdriver.common.by import By
from selenium.webdriver.support.wait import WebDriverWait
from selenium.common.exceptions import NoSuchElementException
from webium import BasePage as WebiumBasePage, Find
class BasePage(WebiumBasePage):
url_path = None
a... | KorolevskyMax/TestFrameworkTemplate | pages/base_page.py | Python | mit | 1,954 | 0.002559 |
#
# This file is only used in the Java (Jython) version
# It serves as an entry point.
#
import sys
import PyPlucker.Spider
from java.lang import Runtime
from java.util import Hashtable
import org.plkr.distiller.API
class InvokePluckerBuildFromJava (org.plkr.distiller.API.Invocation):
def __init__(s... | arpruss/plucker | parser/python/InvokePluckerBuildFromJava.py | Python | gpl-2.0 | 1,742 | 0.004592 |
# -*- coding: utf-8 -*-
# Generated by Django 1.10 on 2016-09-17 16:10
from __future__ import unicode_literals
from django.db import migrations, models
import django.db.models.deletion
class Migration(migrations.Migration):
dependencies = [
('overseas', '0013_auto_20160914_1706'),
]
operations ... | nevermoreluo/privateoverseas | overseas/migrations/0014_auto_20160918_0010.py | Python | gpl-3.0 | 1,111 | 0.0027 |
import datetime as dt
import numpy as np
import pandas as pd
import thalesians.tsa.checks as checks
import thalesians.tsa.numpyutils as npu
import thalesians.tsa.processes as proc
import thalesians.tsa.randomness as rnd
def xtimes(start, stop=None, step=None):
checks.check_not_none(start)
i... | thalesians/tsa | src/main/python/thalesians/tsa/simulation.py | Python | apache-2.0 | 4,012 | 0.008724 |
# -*- coding: utf-8 -*-
'''
Created on 05.09.2015
@author: derChris
'''
class ezDict(dict):
def __missing__(self, key):
self.update({key: ezDict()})
return self[key]
def reduce(self):
items = list(self.items())
for key, value in items:
... | ChrisCuts/fnode | src/ezClasses/ezClasses.py | Python | gpl-2.0 | 755 | 0.025166 |
#!/usr/bin/env python
from setuptools import setup, find_packages
classifiers = [
# Get more strings from
# http://pypi.python.org/pypi?%3Aaction=list_classifiers
"License :: OSI Approved :: MIT License",
"Natural Language :: English",
"Operating System :: OS Independent",
"Programming Language :: Python",
"Programmi... | ryanvade/nanpy | setup.py | Python | mit | 1,020 | 0.017647 |
#!/usr/bin/env python
# Linux IEEE 802.15.4 userspace tools
#
# Copyright (C) 2008, 2009 Siemens AG
#
# Written-by: Dmitry Eremin-Solenikov
# Written-by: Sergey Lapin
#
# 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... | tcheneau/linux-zigbee | test-serial/test_recv.py | Python | gpl-2.0 | 2,105 | 0.023278 |
# Copyright (c) 2013, GlaxoSmithKline Research & Development Ltd.
# All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions are
# met:
#
# * Redistributions of source code must retain the above copyright
# ... | soerendip42/rdkit | Contrib/mmpa/search_mmp_db.py | Python | bsd-3-clause | 16,511 | 0.012234 |
# :coding: utf-8
import re
#: Regular Expression pattern for single line comments
_ONE_LINE_COMMENT_PATTERN = re.compile(r"(\n|^| )//.*?\n")
#: Regular Expression pattern for multi-line comments
_MULTI_LINES_COMMENT_PATTERN = re.compile(r"/\*.*?\*/", re.DOTALL)
#: Regular Expression pattern for nested element symb... | buddly27/champollion | source/champollion/parser/helper.py | Python | apache-2.0 | 5,395 | 0.001297 |
# Copyright (c) 2014 Quobyte Inc.
# Copyright (c) 2013 Red Hat, Inc.
# All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance with the License. You may obtain
# a copy of the License at
#
# http://www.apache.org/licenses... | Hybrid-Cloud/cinder | cinder/tests/unit/volume/drivers/test_quobyte.py | Python | apache-2.0 | 38,830 | 0.000052 |
import sublime
import sublime_plugin
import re
import subprocess
from array import *
from .giterCommandThread import CommandThread
from .commandBuilders import buildCommand
from .jsonDecoderBuilder import JsonDecoderBuilder
from .sbtBuildFileEditor import SbtBuildFileEditor
from .logger import LoggerFacade
from .utils ... | lgmerek/ScalaProjectGeneratorFacade | scalaProjectGeneratorFacade.py | Python | mit | 6,824 | 0.002638 |
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
import swisseph as swe
import unittest
class TestSweLunEclipse(unittest.TestCase):
@classmethod
def setUpClass(cls):
swe.set_ephe_path()
def test_01(self):
jd = 2454466.5
flags = swe.FLG_SWIEPH
geopos = (12.1, 49.0, 330)
... | astrorigin/pyswisseph | tests/test_swe_lun_eclipse.py | Python | gpl-2.0 | 2,097 | 0.005246 |
"""Common test objects."""
import copy
from datetime import datetime
import json
from unittest.mock import ANY, patch
from homeassistant.components import mqtt
from homeassistant.components.mqtt import debug_info
from homeassistant.components.mqtt.const import MQTT_DISCONNECTED
from homeassistant.components.mqtt.mixin... | sander76/home-assistant | tests/components/mqtt/test_common.py | Python | apache-2.0 | 41,174 | 0.00085 |
from builtins import str
import logging
import subprocess
from airflow.executors.base_executor import BaseExecutor
from airflow.utils import State
class SequentialExecutor(BaseExecutor):
"""
This executor will only run one task instance at a time, can be used
for debugging. It is also the only executor t... | wangtuanjie/airflow | airflow/executors/sequential_executor.py | Python | apache-2.0 | 1,230 | 0 |
# Copyright 2016 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... | seanli9jan/tensorflow | tensorflow/contrib/rnn/python/ops/lstm_ops.py | Python | apache-2.0 | 25,114 | 0.005017 |
# Copyright 2002, 2004 John T. Reese.
# email: jtr at ofb.net
#
# This file is part of Yammer.
#
# Yammer 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... | nandub/yammer | lib/TicketExceptionHandler.py | Python | gpl-2.0 | 9,659 | 0.013562 |
# -*- coding: utf-8 -*-
# vim: tabstop=4 shiftwidth=4 softtabstop=4
# Copyright (C) 2012 Yahoo! Inc. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance with the License. You may obtain
# a copy of the License at
#
# ... | ntt-sic/taskflow | taskflow/flow.py | Python | apache-2.0 | 2,637 | 0 |
import os
import atexit
import string
import importlib
import threading
import socket
from time import sleep
def BYTE(message):
return bytes("%s\r\n" % message, "UTF-8")
class UserInput(threading.Thread):
isRunning = False
parent = None
def __init__(self, bot):
super().__init__()
self.parent = bot
self.set... | tommai78101/IRCBot | UserInput.py | Python | mit | 2,759 | 0.029358 |
"""Selectors for Home Assistant."""
from __future__ import annotations
from collections.abc import Callable
from typing import Any, cast
import voluptuous as vol
from homeassistant.const import CONF_MODE, CONF_UNIT_OF_MEASUREMENT
from homeassistant.util import decorator
SELECTORS = decorator.Registry()
def valida... | jawilson/home-assistant | homeassistant/helpers/selector.py | Python | apache-2.0 | 5,138 | 0.000779 |
# -*- coding: utf-8 -*-
from datetime import date, timedelta
from subprocess import check_output
from celery import task
from django.template.loader import render_to_string
from django.db.models import Sum
from django.conf import settings
from django.contrib.auth.models import User
from django.core.mail import send_ma... | MSA-Argentina/relojito_project | relojito/app/tasks.py | Python | mit | 6,517 | 0.001536 |
from django.conf.urls import patterns, include, url
# Uncomment the next two lines to enable the admin:
from django.contrib import admin
admin.autodiscover()
urlpatterns = patterns('',
# Examples:
url(r'^$', 'brbappl.views.index', name='index'),
url(r'^done$', 'brbappl.views.done', name='done'),
url(r... | thijsdezoete/BrBaFinals | poolgame/poolgame/urls.py | Python | gpl-2.0 | 816 | 0.003676 |
del x
| pyta-uoft/pyta | examples/ending_locations/del_name.py | Python | gpl-3.0 | 6 | 0 |
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
# Ref: http://doc.qt.io/qt-5/modelview.html#2-1-a-read-only-table
import sys
from PyQt5.QtCore import Qt, QAbstractTableModel, QVariant
from PyQt5.QtWidgets import QApplication, QTableView
class MyData:
def __init__(self):
self._num_rows = 3
self._nu... | jeremiedecock/snippets | python/pyqt/pyqt5/widget_QTableView_edit_print_signal_when_data_changed.py | Python | mit | 2,784 | 0.002514 |
# -*- coding: utf-8 -*-
# Part of Odoo. See LICENSE file for full copyright and licensing details.
import copy
import locale
import logging
import re
import reportlab
import openerp.tools as tools
from openerp.tools.safe_eval import safe_eval
from openerp.tools.misc import ustr
_logger = logging.getLogger(__name__)... | ayepezv/GAD_ERP | openerp/report/render/rml2pdf/utils.py | Python | gpl-3.0 | 6,163 | 0.008924 |
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.db import models, migrations
from django.conf import settings
class Migration(migrations.Migration):
dependencies = [
migrations.swappable_dependency(settings.AUTH_USER_MODEL),
('arm_settings', '0001_initial'),
]
... | shwetams/arm-samples-py | arm_basic_samples/arm_settings/migrations/0002_authsettings_user_id.py | Python | mit | 600 | 0.001667 |
#!/usr/bin/env python
import sys
import argparse
def less(a, b):
return a < b
def greater(a, b):
return a > b
better = less
def dominated(x, y):
if len(x) != len(y):
print "Error: size mismatch!"
return None
dominated = False
for i,j in zip(x,y):
if better(i, j):
return Fal... | daaugusto/ppi | script/domination-many.py | Python | gpl-3.0 | 2,043 | 0.026921 |
import sys; sys.path.append("../") # noqa
import unittest
import copy
import pymongo
import datetime
import bson
from baemo.connection import Connections
from baemo.delimited import DelimitedDict
from baemo.references import References
from baemo.projection import Projection
from baemo.entity import Entity
from ba... | chrisantonellis/pymongo_basemodel | test/test_model.py | Python | mit | 49,483 | 0.000364 |
# Copyright (c) 2011 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.
import uuid
from buildbot.changes.filter import ChangeFilter
from buildbot.scheduler import Dependent
from buildbot.scheduler import Nightly
from buildb... | eunchong/build | scripts/master/master_config.py | Python | bsd-3-clause | 7,620 | 0.005906 |
# 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.
import argparse
import optparse
from telemetry.core import camel_case
class ArgumentHandlerMixIn(object):
"""A structured way to handle command-line arg... | Jonekee/chromium.src | tools/telemetry/telemetry/core/command_line.py | Python | bsd-3-clause | 3,100 | 0.010645 |
import os
from nose.tools import assert_equals, assert_items_equal
from rsk_mind.dataset import PandasDataset
from rsk_mind.transformer import *
import pandas as pd
class CustomTransformer(Transformer):
class Feats():
a1 = Feat()
a2 = Feat()
f1 = CompositeFeat(['a1', 'a2'])
def ge... | rsk-mind/rsk-mind-framework | tests/dataset/test_dataset_pandas.py | Python | mit | 2,486 | 0.000402 |
# -*- coding: utf-8 -*-
# Copyright 2014 Foxdog Studios
#
# 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 l... | foxdog-studios/pyddp | tests/messages/client/test_method_message_parser.py | Python | apache-2.0 | 1,258 | 0.000795 |
# Copyright 2016-2020 The GPflow Contributors. 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 appli... | GPflow/GPflow | gpflow/models/vgp.py | Python | apache-2.0 | 14,665 | 0.002524 |
from brv1 import *
main()
| bveina/TempSensorNode | main.py | Python | mit | 26 | 0 |
#!/usr/bin/env python
# Copyright 2015 The ChEMBL group.
# Author: Nathan Dedman <ndedman@ebi.ac.uk>
# 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/LICE... | chembl/the-S3-amongos | the-S3-amongos.py | Python | apache-2.0 | 21,343 | 0.014431 |
# -*- coding: utf-8 -*-
# (c) Nelen & Schuurmans. GPL licensed, see LICENSE.rst.
"""
Period looper for atomic scripts.
"""
from __future__ import print_function
from __future__ import unicode_literals
from __future__ import absolute_import
from __future__ import division
import datetime
import math
import re
from r... | tomvansteijn/openradar | openradar/periods.py | Python | gpl-3.0 | 1,780 | 0 |
# Copyright 2013 IBM Corp.
#
# Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance with the License. You may obtain
# a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agree... | mikalstill/nova | nova/tests/unit/objects/test_instance_action.py | Python | apache-2.0 | 16,824 | 0.000178 |
"""
Low level *Skype for Linux* interface implemented using *XWindows messaging*.
Uses direct *Xlib* calls through *ctypes* module.
This module handles the options that you can pass to `Skype.__init__`
for Linux machines when the transport is set to *X11*.
No further options are currently supported.
Warning PyGTK fr... | jpablobr/emacs.d | vendor/misc/emacs-skype/build/Skype4Py/Skype4Py/api/posix_x11.py | Python | gpl-3.0 | 17,077 | 0.001581 |
#!/usr/bin/python
# -*- coding: utf-8 -*-
################################################################################
#
# RMG - Reaction Mechanism Generator
#
# Copyright (c) 2002-2017 Prof. William H. Green (whgreen@mit.edu),
# Prof. Richard H. West (r.west@neu.edu) and the RMG Team (rmg_dev@mit.edu)
#
# ... | Molecular-Image-Recognition/Molecular-Image-Recognition | code/rmgpy/data/kinetics/common.py | Python | mit | 16,818 | 0.003687 |
class Clock:
"""Clock that displays 24 hour clock that rollsover properly"""
def __init__(self, hour, minute):
self.hour = hour
self.minute = minute
self.cleanup()
def __repr__(self):
return f'Clock({self.hour}, {self.minute})'
def __str__(self):
return '{:02d}... | exercism/python | exercises/practice/clock/.meta/example.py | Python | mit | 752 | 0 |
# -*- coding: utf-8 -*-
import datetime
from south.db import db
from south.v2 import SchemaMigration
from django.db import models
class Migration(SchemaMigration):
def forwards(self, orm):
# Deleting field 'Company.image_url'
db.delete_column(u'techpong_company', 'image_url')
# Adding fi... | collingreen/startuppong | techpong/apps/techpong/migrations/0005_auto__del_field_company_image_url__add_field_company_banner_url__add_f.py | Python | mit | 8,058 | 0.007446 |
# -*- coding: utf-8 -*-
# Part of Odoo. See LICENSE file for full copyright and licensing details.
{
'name': 'PosBox Homepage',
'version': '1.0',
'category': 'Point of Sale',
'sequence': 6,
'website': 'https://www.odoo.com/page/point-of-sale',
'summary': 'A homepage for the PosBox',
'descr... | vileopratama/vitech | src/addons/hw_posbox_homepage/__openerp__.py | Python | mit | 714 | 0.002801 |
"""
Database models for the LTI provider feature.
This app uses migrations. If you make changes to this model, be sure to create
an appropriate migration file and check it in at the same time as your model
changes. To do that,
1. Go to the edx-platform dir
2. ./manage.py lms schemamigration lti_provider --auto "descr... | JCBarahona/edX | lms/djangoapps/lti_provider/models.py | Python | agpl-3.0 | 5,760 | 0.00191 |
# -*- coding: utf-8 -*-
# Copyright 2022 Google LLC
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or... | googleapis/python-game-servers | google/cloud/gaming_v1/types/common.py | Python | apache-2.0 | 13,962 | 0.001361 |
from flask import render_template
from app import app
@app.route('/')
@app.route('/mainpage')
def slpage():
return render_template('mainpage.html')
@app.errorhandler(404)
def page_not_found(error):
return render_template('page_not_found.html'), 404
| jvahala/brew-thing | app/views.py | Python | apache-2.0 | 274 | 0 |
from __future__ import unicode_literals
from django.contrib import admin
from django.contrib.auth.admin import UserAdmin
from django.db.models import AutoField
from django.forms import ValidationError, ModelForm
from django.http import HttpResponseRedirect
from django.shortcuts import redirect
from django.utils.transl... | dekomote/mezzanine-modeltranslation-backport | mezzanine/core/admin.py | Python | bsd-2-clause | 10,434 | 0.000479 |
class Solution(object):
def removeDuplicates(self, nums):
"""
:type nums: List[int]
:rtype: int
"""
length = len(nums)-1
if length<=0:
return 0
pos = 1
cnt = 1
last = nums[0]
while length > 0:
if nums[pos] == last:
... | xingjian-f/Leetcode-solution | 80. Remove Duplicates from Sorted Array II.py | Python | mit | 605 | 0.07438 |
from main import *
def palindrome_chain_length(n):
count = 0
while True:
reversed_n = reverse_order(n)
if is_palindrome(n, reversed_n):
return count
n += reversed_n
count += 1
def reverse_order(n):
return int("".join([i for i in list(str(n)[::-1])]))
def is_... | bionikspoon/Codewars-Challenges | python/5kyu/palindrome_chain_length/solution.py | Python | mit | 612 | 0.001634 |
# Copyright (C) 2011-2016 Free Software Foundation, Inc.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 3 of the License, or
# (at your option) any later version.
#
# This progr... | freak97/binutils | gdb/testsuite/gdb.python/py-finish-breakpoint2.py | Python | gpl-2.0 | 1,221 | 0.006552 |
import json
import argparse
import logging
import glob
# Logging Information
logger = logging.getLogger(__name__)
logger.setLevel(logging.DEBUG)
formatter = logging.Formatter('%(levelname)s: %(message)s')
fh = logging.FileHandler('test_hashes.log')
fh.setLevel(logging.DEBUG)
fh.setFormatter(formatter)
logger.addHand... | seymour1/label-virusshare | test/test_hashes.py | Python | bsd-3-clause | 1,444 | 0.004848 |
# streamclone.py - producing and consuming streaming repository data
#
# Copyright 2015 Gregory Szorc <gregory.szorc@gmail.com>
#
# This software may be used and distributed according to the terms of the
# GNU General Public License version 2 or any later version.
from __future__ import absolute_import
import struct
... | dscho/hg | mercurial/streamclone.py | Python | gpl-2.0 | 13,689 | 0.001315 |
# -*- coding: utf-8 -*-
# Copyright 2020 Google LLC
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or... | googleads/google-ads-python | google/ads/googleads/v9/services/types/keyword_plan_campaign_service.py | Python | apache-2.0 | 6,083 | 0.000493 |
#
# Copyright 2011 Red Hat, 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... | henrysher/imagefactory | imagefactory-plugins/EC2Cloud/EC2Cloud.py | Python | apache-2.0 | 70,484 | 0.006626 |
"""
Pure SciPy implementation of Locally Optimal Block Preconditioned Conjugate
Gradient Method (LOBPCG), see
http://www-math.cudenver.edu/~aknyazev/software/BLOPEX/
License: BSD
Authors: Robert Cimrman, Andrew Knyazev
Examples in tests directory contributed by Nils Wagner.
"""
from __future__ import division, prin... | jlcarmic/producthunt_simulator | venv/lib/python2.7/site-packages/scipy/sparse/linalg/eigen/lobpcg/lobpcg.py | Python | mit | 19,348 | 0.001551 |
"""
Tests for Calendar Sync views.
"""
import ddt
from django.test import TestCase
from django.urls import reverse
from openedx.features.calendar_sync.api import SUBSCRIBE, UNSUBSCRIBE
from xmodule.modulestore.tests.django_utils import SharedModuleStoreTestCase
from xmodule.modulestore.tests.factories import Course... | stvstnfrd/edx-platform | openedx/features/calendar_sync/tests/test_views.py | Python | agpl-3.0 | 2,051 | 0.002438 |
# constants extracted from
# https://github.com/jrowberg/i2cdevlib/blob/master/Arduino/MPU6050/MPU6050.h
MPU6050_ADDRESS_AD0_LOW = 0x68
MPU6050_ADDRESS_AD0_HIGH = 0x69
MPU6050_DEFAULT_ADDRESS = MPU6050_ADDRESS_AD0_LOW
MPU6050_RA_XG_OFFS_TC = 0x00
MPU6050_RA_YG_O... | mapr-demos/wifi-sensor-demo | python/mpu6050/all_constants.py | Python | apache-2.0 | 15,010 | 0.022252 |
# -*- coding: utf-8 -*-
"""
The rrule module offers a small, complete, and very fast, implementation of
the recurrence rules documented in the
`iCalendar RFC <http://www.ietf.org/rfc/rfc2445.txt>`_,
including support for caching of results.
"""
import itertools
import datetime
import calendar
import sys
from six impor... | drpaneas/linuxed.gr | lib/python2.7/site-packages/dateutil/rrule.py | Python | mit | 47,634 | 0.000084 |
import calendar
db = [None]
def get_month_transaction_days(acc, year, month):
monthdays = calendar.monthrange(year, month)
result = db[0].view('bank/transaction_days', startkey=[acc._id, year, month, 1],
endkey=[acc._id, year, month, monthdays], group=True, group_level=4).all()
return [r['key'][-... | baverman/cakeplant | cakeplant/bank/model.py | Python | mit | 573 | 0.012216 |
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
'''
冒泡排序(bubble sort):每个回合都从第一个元素开始和它后面的元素比较,
如果比它后面的元素更大的话就交换,一直重复,直到这个元素到了它能到达的位置。
每次遍历都将剩下的元素中最大的那个放到了序列的“最后”(除去了前面已经排好的那些元素)。
注意检测是否已经完成了排序,如果已完成就可以退出了。时间复杂度O(n2)
'''
def short_bubble_sort(a_list):
exchange = True
pass_num = len(a_list) - 1
while pass_num... | Lucky0604/algorithms | sort/bubble-sort.py | Python | mit | 1,125 | 0.002361 |
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
import json
import requests
class Brain():
def think(self, userSession):
pass
class WikiBrain(Brain):
maxN = ''
maxX = ''
wikiAPI = u'https://zh.wikipedia.org/w/api.php?uselang=zh_tw&action=query&prop=extracts&format=xml&exintro=&titles='
... | taosheng/jarvis | socialBrainTest/python/brain.py | Python | apache-2.0 | 1,645 | 0.015309 |
if hasattr(context, 'portal_type') and context.portal_type == 'FormSaveData2ContentEntry':
index = None
if context.getValue('brugia-malayi') != 'None' or ('B. malayi' in context.getValue('a-aegypti-infected-with-filariae')):
if context.getValue('brugia-malayi') == '':
index = None
... | uwosh/uwosh.filariasis | uwosh/filariasis/skins/uwosh.filariasis/indexByBMalayi.py | Python | gpl-2.0 | 393 | 0.007634 |
# Problem 19: Counting Sundays
# https://projecteuler.net/problem=19
def is_leapyear(year):
if year%4 == 0 and year%100 != 0 or year%400 == 0:
return 1
else:
return 0
month = [31, 28, 31, 30, 31, 30,
31, 31, 30, 31, 30, 31]
def days_of_month(m, y):
... | yehnan/project_euler_python | p019.py | Python | mit | 1,291 | 0.015492 |
from tasty.types import conversions
from tasty.types import *
from tasty.types.driver import TestDriver
__params__ = {'la': 32, 'lb': 32, 'da': 10}
driver = TestDriver()
def protocol(client, server, params):
server.ga = Garbled(val=Unsigned(bitlen=764, dim=[1], signed=False, passive=True, empty=True), signed=False... | tastyproject/tasty | tasty/tests/functional/protocols/mul/garbled_server_server_client/protocol_setup_server.py | Python | gpl-3.0 | 756 | 0.005291 |
# 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, ... | daspecster/google-cloud-python | speech/google/cloud/speech/client.py | Python | apache-2.0 | 4,677 | 0 |
import asyncio
import os
import time
import peru.cache
from shared import assert_contents, create_dir, make_synchronous, PeruTest
class CacheTest(PeruTest):
@make_synchronous
def setUp(self):
self.cache = yield from peru.cache.Cache(create_dir())
self.content = {
'a': 'foo',
... | oconnor663/peru | tests/test_cache.py | Python | mit | 18,779 | 0 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.