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 |
|---|---|---|---|---|---|---|
from sevenbridges.meta.resource import Resource
from sevenbridges.meta.fields import StringField, DictField
class BatchGroup(Resource):
"""
Batch group for a batch task.
Represents the group that is assigned to the child task
from the batching criteria that was used when the task was started.
"""
... | sbg/sevenbridges-python | sevenbridges/models/compound/tasks/batch_group.py | Python | apache-2.0 | 454 | 0 |
# from django.shortcuts import render, get_object_or_404
# from .models import Album, Song
# def index(request):
# all_albums = Album.objects.all()
# context = {
# 'all_albums':all_albums,
# }
# return render(request, 'music/index.html', context)
# def detail(request, album_id):
... | TheCoderNextdoor/DjangoSites | django_tut/website/music/views.py | Python | gpl-3.0 | 3,632 | 0.020099 |
import sys
from logging import warning
from glob import iglob
import json
import os
import shutil
from ..common import chdir, run
from .cache import cache_specs
from .dirs import get_specs_dir
def load_all_specs(*, basedir=get_specs_dir(), skip_update_check=True):
os.makedirs(basedir, exist_ok=True)
if not ... | StoDevX/cs251-toolkit | cs251tk/specs/load.py | Python | mit | 2,467 | 0.001621 |
from django.apps import AppConfig
class MainConfig(AppConfig):
name = 'main'
| edisondotme/motoPi | main/apps.py | Python | mit | 80 | 0.0125 |
import unittest
from chat.commands.commandlist import CommandList
from chat.command import Command
from tests.structs.dummychat import DummyChat
class TestCommands(unittest.TestCase):
def setUp(self):
self.chat = DummyChat()
def test_get(self):
command = CommandList.get('help', self.chat, 'me... | jk977/twitch-plays | bot/tests/commands.py | Python | gpl-3.0 | 1,035 | 0.002899 |
class TestRailTestCase:
def __init__(self, title, section, suite, steps):
self.title = title
self.section_name = section
self.suite_name = suite
self.steps = steps
self.type_id = 1
self.priority_id = 4
def to_json_dict(self):
return {
'title':... | 2gis/pytestrail | testrail/testcase.py | Python | mit | 474 | 0 |
"""
Tools for sending email.
"""
from django.conf import settings
from django.core.exceptions import ImproperlyConfigured
from django.utils.importlib import import_module
# Imported for backwards compatibility, and for the sake
# of a cleaner namespace. These symbols used to be in
# django/core/mail.py before the int... | ychen820/microblog | y/google-cloud-sdk/platform/google_appengine/lib/django-1.3/django/core/mail/__init__.py | Python | bsd-3-clause | 5,072 | 0.002957 |
"""Supporting definitions for the Python regression tests."""
if __name__ != 'test_support':
raise ImportError, 'test_support must be imported from the test package'
import sys
class Error(Exception):
"""Base class for regression test exceptions."""
class TestFailed(Error):
"""Test failed."""
class Tes... | ruamel/ordereddict | test/unit/test_support.py | Python | mit | 17,653 | 0.003852 |
import mock
import lxml.etree as ET
from .utils import make_cobertura
def test_parse_path():
from pycobertura import Cobertura
xml_path = 'foo.xml'
with mock.patch('pycobertura.cobertura.os.path.exists', return_value=True):
with mock.patch('pycobertura.cobertura.ET.parse') as mock_parse:
... | msabramo/pycobertura | tests/test_cobertura.py | Python | mit | 7,957 | 0.000754 |
from optparse import make_option
from django.core.management.base import BaseCommand
from crits.core.mongo_tools import mongo_connector
import pprint
class Command(BaseCommand):
"""
Gets a count of indicator types and object types in CRITs
"""
help = "Gets a count of indicator types and object type... | thelok/crits_scripts | crits/core/managament/commands/get_indicator_types.py | Python | mit | 4,701 | 0.005956 |
# 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.backend.j... | areitz/pants | src/python/pants/backend/jvm/tasks/scala_repl.py | Python | apache-2.0 | 2,743 | 0.008385 |
#!/usr/bin/python3
# @begin:license
#
# Copyright (c) 2015-2019, Benjamin Niemann <pink@odahoda.de>
#
# 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 y... | odahoda/noisicaa | noisicaa/builtin_nodes/control_track/track_ui.py | Python | gpl-2.0 | 15,641 | 0.000895 |
# -*- coding: utf-8 -*-
# Copyright 2015 AvanzOsc (http://www.avanzosc.es)
# Copyright 2015-2017 - Pedro M. Baeza <pedro.baeza@tecnativa.com>
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl)
{
"name": "Procurement Purchase No Grouping",
"version": "10.0.1.0.0",
"author": "AvanzOSC,"
... | Eficent/purchase-workflow | procurement_purchase_no_grouping/__manifest__.py | Python | agpl-3.0 | 662 | 0 |
# Copyright 2018 Google Inc. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or a... | GoogleCloudPlatform/tf-estimator-tutorials | 00_Miscellaneous/model_optimisation/optimize_graph_keras.py | Python | apache-2.0 | 7,518 | 0.009178 |
# Copyright 2015 Dell Inc.
#
# Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance with the License. You may obtain
# a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agree... | saeki-masaki/cinder | cinder/volume/drivers/dell/dell_storagecenter_iscsi.py | Python | apache-2.0 | 7,182 | 0 |
from pytest import fixture
from itertools import combinations
import msgpack as pymsgpack
values = [
42, 7, 3.14, 2.71, 'lorem', 'ipsum', True, False, None, b'lorem', b'ipsum', [], [
'lorem', 42, 3.14, True, None, ['ipsum']], dict(), {
'lorem': 'ipsum', 'dolor': 42, 'sit': 3.14, 'amet': [
... | attugit/cxxjson | test/conftest.py | Python | mit | 587 | 0.001704 |
# vim: ft=python fileencoding=utf-8 sts=4 sw=4 et:
# Copyright 2014-2017 Florian Bruhin (The Compiler) <mail@qutebrowser.org>
#
# This file is part of qutebrowser.
#
# qutebrowser 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 S... | pkill-nine/qutebrowser | tests/conftest.py | Python | gpl-3.0 | 6,876 | 0.000873 |
# Licensed to the Apache Software Foundation (ASF) under one
# or more contributor license agreements. See the NOTICE file
# distributed with this work for additional information
# regarding copyright ownership. The ASF licenses this file
# to you under the Apache License, Version 2.0 (the
# "License"); you may not u... | airbnb/airflow | tests/api_connexion/schemas/test_event_log_schema.py | Python | apache-2.0 | 4,612 | 0.000867 |
"""Subclass of NewMember, which is generated by wxFormBuilder."""
import copy
import wx
from beatle import model
from beatle.lib import wxx
from beatle.activity.models.ui import ui as ui
# Implementing NewMember
class MemberDialog(ui.NewMember):
"""
This dialog allows to setup data member of class
or s... | melviso/phycpp | beatle/activity/models/ui/dlg/cc/Member.py | Python | gpl-2.0 | 14,333 | 0.001535 |
# Licensed to the Apache Software Foundation (ASF) under one
# or more contributor license agreements. See the NOTICE file
# distributed with this work for additional information
# regarding copyright ownership. The ASF licenses this file
# to you under the Apache License, Version 2.0 (the
# "License"); you may not u... | sxjscience/tvm | python/tvm/micro/session.py | Python | apache-2.0 | 4,567 | 0.002847 |
"""
This tutorial introduces the multilayer perceptron using Theano.
A multilayer perceptron is a logistic regressor where
instead of feeding the input to the logistic regression you insert a
intermediate layer, called the hidden layer, that has a nonlinear
activation function (usually tanh or sigmoid) . One can use ... | vmayoral/basic_reinforcement_learning | tutorial5/tests/theano_mnist_mlp.py | Python | gpl-3.0 | 14,310 | 0.001048 |
import pytest
import requests
import time
from threading import Thread
from bottle import default_app, WSGIRefServer
from tomviz.acquisition import server
class Server(Thread):
def __init__(self, dev=False, port=9999):
super(Server, self).__init__()
self.host = 'localhost'
self.port = por... | cjh1/tomviz | acquisition/tests/conftest.py | Python | bsd-3-clause | 1,440 | 0 |
# coding=utf-8
# Copyright 2018 The Google AI Language Team Authors.
#
# 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 ... | google-research/language | language/compgen/nqg/tasks/compare_predictions.py | Python | apache-2.0 | 1,653 | 0.008469 |
# -*- encoding: utf-8 -*-
"""Utility functions for computing combinations of dimensions and hierarchy
levels"""
from __future__ import absolute_import
import itertools
import sys
import re
import os.path
import decimal
import datetime
import json
from collections import OrderedDict
from .errors import *
from . imp... | noyeitan/cubes | cubes/common.py | Python | mit | 9,653 | 0.002695 |
import math
class P4(object):
def p4(self):
'''4-momentum, px, py, pz, E'''
return self._tlv
def p3(self):
'''3-momentum px, py, pz'''
return self._tlv.Vect()
def e(self):
'''energy'''
return self._tlv.E()
def pt(self):
'''transverse momentum ... | semkiv/heppy_fcc | particles/p4.py | Python | gpl-3.0 | 1,250 | 0.0152 |
from django.conf.urls import url
from .viewsets import BookmarkViewSet
bookmark_list = BookmarkViewSet.as_view({
'get': 'list',
'post': 'create'
})
bookmark_detail = BookmarkViewSet.as_view({
'get': 'retrieve',
'patch': 'update',
'delete': 'destroy'
})
urlpatterns = [
url(r'^bookmarks/$', bo... | hnakamur/django-bootstrap-table-example | project/apiv2/urls.py | Python | mit | 430 | 0.002326 |
#!/usr/bin/python
# -*- coding: utf-8 -*-
# Copyright (c) 2018 Dell EMC Inc.
# GNU General Public License v3.0+ (see LICENSE or https://www.gnu.org/licenses/gpl-3.0.txt)
from __future__ import absolute_import, division, print_function
__metaclass__ = type
ANSIBLE_METADATA = {'status': ['preview'],
... | dagwieers/ansible | lib/ansible/modules/remote_management/redfish/idrac_redfish_command.py | Python | gpl-3.0 | 5,884 | 0.00119 |
# -*- coding: utf-8 -*-
# Copyright 2015 Eficent - Jordi Ballester Alomar
# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl.html).
from odoo import api, fields, models
class AnalyticAccountOpen(models.TransientModel):
_name = 'analytic.account.open'
_description = 'Open single analytic account'
... | sysadminmatmoz/pmis | analytic_account_open/wizards/analytic_account_open.py | Python | agpl-3.0 | 1,741 | 0 |
# -*- coding: utf-8 -*-
### BEGIN LICENSE
# Copyright (C) 2009 Philip Peitsch <philip.peitsch@gmail.com>
#This program is free software: you can redistribute it and/or modify it
#under the terms of the GNU General Public License version 3, as published
#by the Free Software Foundation.
#
#This program is distributed ... | necolt/hudson-notifier | hudsonnotifier/AboutHudsonnotifierDialog.py | Python | gpl-3.0 | 2,628 | 0.012938 |
"""Utilities to support packages."""
# NOTE: This module must remain compatible with Python 2.3, as it is shared
# by setuptools for distribution with Python 2.3 and up.
import os
import sys
import imp
import os.path
from types import ModuleType
__all__ = [
'get_importer', 'iter_importers', 'get_loader', 'find_l... | Khroki/MCEdit-Unified | pkgutil.py | Python | isc | 20,304 | 0.000788 |
# Licensed to the Apache Software Foundation (ASF) under one
# or more contributor license agreements. See the NOTICE file
# distributed with this work for additional information
# regarding copyright ownership. The ASF licenses this file
# to you under the Apache License, Version 2.0 (the
# "License"); you may not u... | Huyuwei/tvm | nnvm/tests/python/frontend/darknet/test_forward.py | Python | apache-2.0 | 18,555 | 0.00388 |
# -*- coding: utf-8 -*-
"""
Layer.py - base layer for gabbs maps
======================================================================
AUTHOR: Wei Wan, Purdue University
EMAIL: rcac-help@purdue.edu
Copyright (c) 2016 Purdue University
See the file "license.terms" for information on usage and
re... | waneric/PyMapLib | src/gabbs/layers/Layer.py | Python | mit | 2,213 | 0.001808 |
cost, zeros = map(int, input().split())
print(int(round(cost, -zeros))) | JonSteinn/Kattis-Solutions | src/Slatkisi/Python 3/main.py | Python | gpl-3.0 | 71 | 0.014085 |
# Copyright 2015 Mirantis, Inc.
# All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance with the License. You may obtain
# a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by a... | VTabolin/networking-vsphere | networking_vsphere/common/vmware_conf.py | Python | apache-2.0 | 3,247 | 0.002772 |
#!/usr/bin/env python
#
# Copyright (C) 2012 Jay Sigbrandt <jsigbrandt@slb.com>
# Martin Owens <doctormo@gmail.com>
#
# This library is free software; you can redistribute it and/or
# modify it under the terms of the GNU Lesser General Public
# License as published by the Free Software Foundation; ei... | doctormo/python-crontab | tests/test_usage.py | Python | lgpl-3.0 | 7,441 | 0.000672 |
from .. import BaseForm
from wtforms import StringField, TextAreaField
from wtforms.validators import DataRequired
class CategoryForm(BaseForm):
name = StringField('name',
validators=[
DataRequired()
])
description = TextAreaField('desc... | friendly-of-python/flask-online-store | flask_online_store/forms/admin/category.py | Python | mit | 461 | 0 |
#!/usr/bin/python
# -*- coding: utf-8 -*-
#
# Copyright 2013 The Plaso Project Authors.
# Please see the AUTHORS file for details on individual authors.
#
# 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 L... | cvandeplas/plaso | plaso/parsers/plist.py | Python | apache-2.0 | 5,390 | 0.004824 |
# -*- coding: utf-8 -*-
# @author: vuolter
from __future__ import absolute_import, unicode_literals
import os
import re
import sys
from future import standard_library
standard_library.install_aliases()
def char(text, chars, repl=''):
return re.sub(r'[{0}]+'.format(chars), repl, text)
_UNIXBADCHARS = ('\0', ... | pyblub/pyload | pyload/utils/purge.py | Python | agpl-3.0 | 1,743 | 0 |
from .killableprocess import Popen, mswindows
if mswindows:
from .winprocess import STARTUPINFO, STARTF_USESHOWWINDOW | eukaryote/dotfiles | sublime3/.config/sublime-text-3/Packages/SublimeREPL/repls/killableprocess/__init__.py | Python | mit | 118 | 0.016949 |
#!/usr/bin/env python
# -*- coding: utf8 -*-
import os
import argparse
import tensorflow as tf
from gym import wrappers
from yarll.environment.registration import make
class ModelRunner(object):
"""
Run an already learned model.
Currently only supports one variation of an environment.
"""
def __i... | arnomoonens/DeepRL | yarll/scripts/run_model.py | Python | mit | 2,858 | 0.004899 |
# Copyright 2018 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
#
# https://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, ... | google/jax | tests/linalg_test.py | Python | apache-2.0 | 64,375 | 0.007518 |
"""
Kodi resolveurl plugin
Copyright (C) 2014 smokdpi
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.
... | repotvsupertuga/tvsupertuga.repository | script.module.resolveurl/lib/resolveurl/plugins/videozoo.py | Python | gpl-2.0 | 3,993 | 0.008264 |
#!/usr/bin/env python
# Standard packages
import os
import sys
import argparse
# Third-party packages
from toil.job import Job
# Package methods
from ddb import configuration
from ddb_ngsflow import gatk
from ddb_ngsflow import annotation
from ddb_ngsflow import pipeline
from ddb_ngsflow.align import bwa
from ddb_ng... | dgaston/ddb-ngsflow-scripts | workflow-vcfanno_somatic_amplicon.py | Python | mit | 2,541 | 0.002361 |
import importlib
from .base import BaseTransport
from ..service import Service
class LocalTransport(BaseTransport):
def __init__(self):
super(LocalTransport, self).__init__()
self.__service = None
def __repr__(self):
return self.__class__.__name__
def configure(self, service_na... | brianz/servant | servant/transport/local.py | Python | lgpl-3.0 | 2,255 | 0.002661 |
import squeakspace.common.util as ut
import squeakspace.common.util_http as ht
import squeakspace.proxy.server.db_sqlite3 as db
import squeakspace.common.squeak_ex as ex
import config
def post_handler(environ):
query = ht.parse_post_request(environ)
cookies = ht.parse_cookies(environ)
user_id = ht.get_re... | eek6/squeakspace | www/proxy/scripts/local/node_addr.py | Python | gpl-3.0 | 2,510 | 0.004382 |
from .pathutils import grep_r
from . import project
import os
import re
def is_partial(path):
'''Check if file is a Sass partial'''
return os.path.basename(path).startswith('_')
def partial_import_regex(partial):
'''Get name of Sass partial file as would be used for @import'''
def from_curdir(cwd)... | blitzrk/sublime_libsass | lib/deps.py | Python | mit | 1,567 | 0.003191 |
#
# Copyright (C) 2014 National Institute For Space Research (INPE) - Brazil.
#
# This file is part of Python Client API for Web Time Series Service.
#
# Web Time Series Service for Python is free software: you can
# redistribute it and/or modify it under the terms of the
# GNU Lesser General Public License as pu... | e-sensing/wtss.py | src/wtss/__init__.py | Python | lgpl-3.0 | 1,040 | 0.000962 |
# -*- 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):
# Adding field 'Subscription.frequency'
db.add_column('billing_subscription', 'frequency',
... | artminster/artminster | contrib/billing/migrations/0002_auto__add_field_subscription_frequency.py | Python | mit | 5,583 | 0.008239 |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
import gi
gi.require_version('Gtk', '3.0')
import sys
import pygame
from gi.repository import Gtk
from sugar3.activity.activity import Activity
from sugar3.graphics.toolbarbox import ToolbarBox
from sugar3.activity.widgets import ActivityToolbarButton
from sugar3.graphic... | AlanJAS/iknowEditor | activity.py | Python | gpl-3.0 | 4,743 | 0.004217 |
import unittest
import os
from PIL import Image
from SUASSystem.utils import crop_target
class SUASSystemUtilsDataFunctionsTestCase(unittest.TestCase):
def test_crop_image(self):
"""
Test the crop image method.
"""
input_image_path = "tests/images/image2_test_image_bounder.jpg"
... | FlintHill/SUAS-Competition | tests/unit_tests/test_suassystem_utils_data_functions.py | Python | mit | 1,006 | 0.001988 |
# -*- coding: utf-8 -*-
#
# Copyright © 2012 - 2015 Michal Čihař <michal@cihar.com>
#
# This file is part of Weblate <http://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, eith... | leohmoraes/weblate | weblate/trans/scripts.py | Python | gpl-3.0 | 2,637 | 0 |
import sys
#line = sys.stdin.read()
#print line
datas = []
for line in sys.stdin:
datas.append(line)
print datas
| BizShuk/code_sandbox | python/raw_input_test.py | Python | mit | 120 | 0.016667 |
#!/usr/bin/python
# -*- coding: utf-8 -*-
#
def add(x, y):
a=1
while a>0:
a = x & y
b = x ^ y
x = b
y = a << 1
return b
def vowel_count(word):
vowels_counter = 0
for letter in word:
if letter.isalpha():
if letter.upper() in 'AEIOUY':
vowels_co... | pybursa/homeworks | a_lusher/hw3/Lusher_Alexander_home_work_3_.py | Python | gpl-2.0 | 2,380 | 0.059714 |
# Copyright 22011 Canonical Ltd. This software is licensed under the
# GNU Affero General Public License version 3 (see the file LICENSE).
"""All the interfaces that are exposed through the webservice.
There is a declaration in ZCML somewhere that looks like:
<webservice:register module="lp.patchwebservice" />
wh... | abramhindle/UnnaturalCodeFork | python/testdata/launchpad/lib/lp/services/temporaryblobstorage/webservice.py | Python | agpl-3.0 | 959 | 0 |
# Copyright: Ankitects Pty Ltd and contributors
# License: GNU AGPL, version 3 or later; http://www.gnu.org/licenses/agpl.html
import anki.lang
import aqt
from aqt import AnkiQt
from aqt.profiles import RecordingDriver, VideoDriver
from aqt.qt import *
from aqt.utils import (
TR,
HelpPage,
disable_help_butt... | simgunz/anki | qt/aqt/preferences.py | Python | agpl-3.0 | 10,181 | 0.000982 |
"""Custom urls.py for django-registration."""
from django.conf import settings
from django.conf.urls import include, url
from django.views.generic import TemplateView
from registration.backends.default.views import (
ActivationView,
RegistrationView,
)
from registration_email.forms import EmailRegistrationForm... | bitmazk/django-registration-email | registration_email/backends/default/urls.py | Python | unlicense | 1,615 | 0 |
#!/usr/bin/env python
import json
DEBUG = False
import sys
import tweepy
import time
#consumer_key = 'HcMP89vDDumRhHeQBYbE3Asnp'
#consumer_secret = 'kcXfsNyBl7tan1u2DgV7E10MpsVxhbwTjmbjp3YL9XfDdMJiYt'
#access_key = '67882386-IXbLKaQEtTbZF9yotuLTjgitqjwBkouIstmlW4ecG'
#access_secret = 'SyVrXlIDkidYr3JlNiTQ8tjZ973gIKy... | gtrdp/twitter-clustering | crawling/crawl.py | Python | mit | 1,795 | 0.007242 |
# coding=utf-8
# Licensed Materials - Property of IBM
# Copyright IBM Corp. 2016
"""
Publish and subscribe to MQTT messages.
Additional information at http://mqtt.org and
http://ibmstreams.github.io/streamsx.messaging
"""
from future.builtins import *
from streamsx.topology.topology import *
from streamsx.topology ... | wmarshall484/streamsx.topology | com.ibm.streamsx.topology/opt/python/packages/streamsx/topology/mqtt.py | Python | apache-2.0 | 7,558 | 0.003705 |
def fat(n):
result = 1
while n > 0:
result = result * n
n = n - 1
return result
# testes
print("Fatorial de 3: ", fat(3));
| Gigers/data-struct | algoritimos/Python/fatorial-while.py | Python | bsd-2-clause | 158 | 0.012658 |
from datetime import datetime
def days_diff(date1, date2):
"""
Find absolute diff in days between dates
"""
days = datetime(*date1) - datetime(*date2)
print abs(days)
return abs(days.days)
if __name__ == '__main__':
# These "asserts" using only for self-checking and not necessary for... | Dani4kor/Checkio | days-diff.py | Python | mit | 504 | 0.003968 |
import sys
import requests
try:
from .helper import *
except SystemError:
from helper import *
def compareRequestsAndSelenium(url):
html1 = str(requests.get(url).text)
try:
driver = webdriver.Firefox()
driver.maximize_window()
driver.get(url)
html2 = str(driver.page... | bgarrels/sky | sky/legacy/comparison.py | Python | bsd-3-clause | 685 | 0.014599 |
"""
This module contains several handy functions primarily meant for internal use.
"""
from datetime import date, datetime, timedelta
from time import mktime
import re
import sys
from types import MethodType
__all__ = ('asint', 'asbool', 'convert_to_datetime', 'timedelta_seconds',
'time_difference', 'datet... | ecdpalma/napscheduler | napscheduler/util.py | Python | mit | 6,708 | 0.001044 |
# -*- coding: utf-8 -*-
# © <YEAR(S)> ClearCorp
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html).
import account_move_line
| ClearCorp/odoo-clearcorp | exchange_rate_calculated/models/__init__.py | Python | agpl-3.0 | 144 | 0 |
#! /usr/bin/env python
"""Read infofiles.
"""
import glob
import os, os.path
import sys
import threading
import time
import skytools
import cc.util
from cc import json
from cc.daemon import CCDaemon
from cc.message import is_msg_req_valid
from cc.reqs import InfofileMessage
class InfoStamp:
def __init__(self,... | markokr/cc | cc/daemon/infosender.py | Python | bsd-2-clause | 5,065 | 0.0077 |
"""empty message
Revision ID: ded3fd1d7f9d
Revises: b70e85abec53
Create Date: 2020-12-30 22:46:59.418950
"""
from alembic import op
import sqlalchemy as sa
from sqlalchemy.dialects import mysql
# revision identifiers, used by Alembic.
revision = 'ded3fd1d7f9d'
down_revision = 'b70e85abec53'
branch_labels = None
depe... | hashview/hashview | migrations/versions/ded3fd1d7f9d_.py | Python | gpl-3.0 | 850 | 0.002353 |
# ----------------------------------------------------------------------
# Numenta Platform for Intelligent Computing (NuPIC)
# Copyright (C) 2013, Numenta, Inc. Unless you have an agreement
# with Numenta, Inc., for a separate license for this software code, the
# following terms and conditions apply:
#
# This progra... | runt18/nupic | src/nupic/regions/TestRegion.py | Python | agpl-3.0 | 15,152 | 0.011022 |
import unittest
import os, sys, imp
from qgis import utils
from qgis.core import QgsVectorLayer, QgsField, QgsProject, QGis
from qgis.PyQt.QtCore import QVariant
from .qgis_models import set_up_interface
from mole3.qgisinteraction import layer_interaction as li
from mole3.qgisinteraction import plugin_interaction as p... | UdK-VPT/Open_eQuarter | mole3/tests/plugin_interaction_test.py | Python | gpl-2.0 | 4,712 | 0.002971 |
# the problem described below was fixed in 9758!
# keep_htpsit=False fails since 9473,
# on some installations (?) with:
# case A (see below in the code):
# RuntimeError: Could not locate the Fermi level!
# or the energies from the 2nd one behave strange, no convergence:
# iter: 1 18:21:49 +1.7 -3608.... | robwarm/gpaw-symm | gpaw/test/big/scf/b256H2O/b256H2O.py | Python | gpl-3.0 | 4,905 | 0.031804 |
from flask import Flask
from flask.ext.bootstrap import Bootstrap
from flask.ext.mail import Mail
from flask.ext.moment import Moment
from flask.ext.sqlalchemy import SQLAlchemy
from config import config
from flask.ext.redis import Redis
bootstrap = Bootstrap()
mail = Mail()
moment = Moment()
db = SQLAlchemy()
redis1 ... | simonqiang/gftest | app/__init__.py | Python | mit | 888 | 0.003378 |
# -*- coding: utf-8 -*-
from .base import WatershedBEM
| carolFrohlich/nipype | nipype/interfaces/mne/__init__.py | Python | bsd-3-clause | 55 | 0 |
"""
A tool for converting kv6 models into pmf.
GreaseMonkey, 2013 - Public Domain
WARNING: I haven't checked to ensure that X,Y are around the right way.
If you find your models have been flipped inadvertently, let me know! --GM
"""
from __future__ import print_function
import sys, struct
# Backwards compatibilit... | fkaa/iceball | tools/kv62pmf.py | Python | gpl-3.0 | 3,453 | 0.019983 |
from mrjob.job import MRJob
from mrjob.step import MRStep
def get_id_from_line(line):
if line.find('.","Message-ID: <') > 0:
start = line.find("Message-ID")+13
i=0
for char in line[start:]:
i=i+1
if (not (char.isdigit() or (char == '.'))):
stop = i+start-2
break
return line[start:stop]
class MR... | tokamstud/enron-analysis | src/complex/hive_prep.py | Python | gpl-3.0 | 2,895 | 0.071157 |
import json
import os
import re
import shutil
import subprocess
import sys
import tempfile
import textwrap
import time
import venv # type: ignore
import zipfile
from typing import Dict
from argparse import ArgumentParser
from dataclasses import dataclass
from pathlib import Path
from urllib.request import urlopen
f... | fishtown-analytics/dbt | scripts/build-dbt.py | Python | apache-2.0 | 29,183 | 0.000069 |
#!/usr/bin/python
# Generate .js files defining Blockly core and language messages.
#
# Copyright 2013 Google Inc.
# https://developers.google.com/blockly/
#
# 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 t... | NTUTVisualScript/Visual_Script | static/javascript/blockly/i18n/create_messages.py | Python | mit | 6,374 | 0.010041 |
# -*- coding: utf-8 -*-
"""
pythoner.net
Copyright (C) 2013 PYTHONER.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 License, or
(at your option) any later versio... | yohn89/pythoner.net | pythoner/accounts/admin.py | Python | gpl-3.0 | 915 | 0.006557 |
# Copyright 2015 Netflix, 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... | stackArmor/security_monkey | security_monkey/watchers/elasticsearch_service.py | Python | apache-2.0 | 4,759 | 0.003572 |
outdata1 = divmod(20,8)
# prefix an argument with a star when calling a function to unpack tuple
t = (20,8)
outdata2 = divmod(*t)
import os
# Note that filename = hh.grad
_, filename = os.path.split('/nfs/j3/hh.grad')
# Using * to grab excess items
# Can be used in python3, but not in python2
# a, b, *rest = range... | helloTC/LearnPython | fluent_python/array_of_sequences/tuple_as_record.py | Python | mit | 1,025 | 0.00878 |
import datetime
import decimal
from time import time
from django.utils.hashcompat import md5_constructor
from django.utils.log import getLogger
logger = getLogger('django.db.backends')
class CursorDebugWrapper(object):
def __init__(self, cursor, db):
self.cursor = cursor
self.db = db ... | rimbalinux/MSISDNArea | django/db/backends/util.py | Python | bsd-3-clause | 4,684 | 0.007472 |
import xml.etree.cElementTree as et
from collections import OrderedDict
from tabletopscanner.boardgamegeekapi.parsers import Deserializer
class SearchParser(Deserializer):
def deserialize(self, xml):
tree = et.fromstring(xml)
return [SearchParser.__make_search_result(el) for el in tree.findall('i... | ramseyboy/tabletop-scanner | tabletopscanner/boardgamegeekapi/search.py | Python | apache-2.0 | 674 | 0.001484 |
# pylint: disable=C0111
# pylint: disable=W0621
from lettuce import world, step
from nose.tools import assert_true, assert_in, assert_false # pylint: disable=E0611
from auth.authz import get_user_by_email, get_course_groupname_for_role
from django.conf import settings
from selenium.webdriver.common.keys import Keys... | abo-abo/edx-platform | cms/djangoapps/contentstore/features/common.py | Python | agpl-3.0 | 12,319 | 0.000812 |
import unittest
import os
import json
import time
from os import environ
from ConfigParser import ConfigParser
from pprint import pprint
from biokbase.workspace.client import Workspace as workspaceService
from MyContigFilter.MyContigFilterImpl import MyContigFilter
class MyContigFilterTest(unittest.TestCase):
... | briehl/wjr_sdk_test | test/MyContigFilter_server_test.py | Python | mit | 4,171 | 0.007672 |
# Licensed under a 3-clause BSD style license - see LICENSE.rst
"""
Here are all the test parameters and values for the each
`~astropy.modeling.FittableModel` defined. There is a dictionary for 1D and a
dictionary for 2D models.
Explanation of keywords of the dictionaries:
"parameters" : list or dict
Model parame... | piotroxp/scibibscan | scib/lib/python3.5/site-packages/astropy/modeling/tests/example_models.py | Python | mit | 8,459 | 0.000236 |
DATA_DIR = '/media/d/ssd2/dstl/' | danzelmo/dstl-competition | global_vars.py | Python | mit | 32 | 0.03125 |
from django.db import models
from django.contrib.contenttypes.models import ContentType
from django.contrib.contenttypes import generic
from django.contrib.auth.models import User
from django.contrib.sites.models import Site
from django.template.defaultfilters import slugify
from django.conf import settings
from django... | uclastudentmedia/django-massmedia | massmedia/models.py | Python | apache-2.0 | 14,915 | 0.007643 |
#!/usr/bin/env python
'''
2D Group Members:
> Charlotte Phang
> Lau Wenkie
> Mok Jun Neng
> Martin Tan
> Dicson Candra
'''
#Import relevant modules
import RPi.GPIO as GPIO
import os
import glob
import time
from PIDsm import PID_ControllerSM
### PIN NUMBERS ###
tempPin = 4
motorPin = 12
fanPin = 1... | tgymartin/green-fingers-2d | DW/part2_and_part3/Cohort_6_Team_6/part3_code/prototype.py | Python | gpl-3.0 | 3,524 | 0.018729 |
from django.conf import settings as django_settings
# noinspection PyPep8Naming
class LazySettings:
@property
def REQUIRE_MAIN_NAME(self):
return getattr(django_settings, 'REQUIRE_MAIN_NAME', 'main')
@property
def DEFAULT_PAGINATE_BY(self):
return getattr(django_settings, 'DEFAULT_PAG... | Pyco7/django-ajax-views | ajaxviews/conf.py | Python | mit | 1,622 | 0.001233 |
import re
import time
class BaseCounters:
def __init__(self):
self.keyre = re.compile('\A[\w.]+\Z')
def ping(self, key):
self.validate_key(key)
self.do_ping(key, int(time.time()))
def hit(self, key, n=1):
self.validate_key(key)
self.do_hit(key, n)
def validate_key(self, key):
if re.m... | francois/pycounters | counters/base_counters.py | Python | mit | 499 | 0.022044 |
#
# Licensed to the Apache Software Foundation (ASF) under one or more
# contributor license agreements. See the NOTICE file distributed with
# this work for additional information regarding copyright ownership.
# The ASF licenses this file to You under the Apache License, Version 2.0
# (the "License"); you may not us... | vinodkc/spark | python/pyspark/rdd.py | Python | apache-2.0 | 126,212 | 0.001965 |
from datetime import datetime
class PanoplyException(Exception):
def __init__(self, args=None, retryable=True):
super(PanoplyException, self).__init__(args)
self.retryable = retryable
class IncorrectParamError(Exception):
def __init__(self, msg: str = "Incorrect input parametr"):
sup... | panoplyio/panoply-python-sdk | panoply/errors/exceptions.py | Python | mit | 1,017 | 0 |
"""
===========================================
Robust linear model estimation using RANSAC
===========================================
In this example we see how to robustly fit a linear model to faulty data using
the RANSAC algorithm.
"""
import numpy as np
from matplotlib import pyplot as plt
from sklearn import ... | Tong-Chen/scikit-learn | examples/linear_model/plot_ransac.py | Python | bsd-3-clause | 1,671 | 0 |
from Channel import Channel
import telepot
class AmbrosioBot(telepot.Bot):
"""AmbrosioBot is my telgram bot"""
def __init__(self, token):
super(AmbrosioBot, self).__init__(token)
self.clist = None
self.chat_id = None
def set_list(self,clist):
self.clist = clist
def on... | oscarforri/ambrosio | ambrosio/channels/TelegramChannel.py | Python | gpl-3.0 | 1,405 | 0.003559 |
"""
This module contains a class to make requests to the Gemini API.
Author: Mike Marzigliano
"""
import time
import json
import hmac
import base64
import hashlib
import requests
class Geminipy(object):
"""
A class to make requests to the Gemini API.
Make public or authenticated requests according to th... | geminipy/geminipy | geminipy/__init__.py | Python | gpl-3.0 | 10,473 | 0.000095 |
import click
from complex.cli import pass_context
@click.command('status', short_help='Shows file changes.')
@pass_context
def cli(ctx):
"""Shows file changes in the current working directory."""
ctx.log('Changed files: none')
ctx.vlog('bla bla bla, debug info')
| staranjeet/fjord | vendor/packages/click/examples/complex/complex/commands/cmd_status.py | Python | bsd-3-clause | 277 | 0 |
from __future__ import absolute_import
import six
import logging
from .. import py3_errmsg
logger = logging.getLogger(__name__)
try:
import enaml
except ImportError:
if six.PY3:
logger.exception(py3_errmsg)
else:
raise
else:
from .model import (GetLastModel, DisplayHeaderModel, WatchF... | NSLS-II/replay | replay/search/__init__.py | Python | bsd-3-clause | 527 | 0 |
import typer
from controller import log
from controller.app import Application
from controller.deploy.docker import Docker
@Application.app.command(help="Provide instructions to join new nodes")
def join(
manager: bool = typer.Option(
False, "--manager", show_default=False, help="join new node with manag... | rapydo/do | controller/commands/swarm/join.py | Python | mit | 1,350 | 0.000741 |
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.db import models, migrations
class Migration(migrations.Migration):
dependencies = [
('viewer', '0006_meter_on_auditlist'),
]
operations = [
migrations.CreateModel(
name='Group',
fields=[... | impactlab/jps-handoff | webapp/viewer/migrations/0007_auto_20150408_1402.py | Python | mit | 935 | 0.00107 |
# 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... | jwlawson/tensorflow | tensorflow/contrib/py2tf/pyct/parser.py | Python | apache-2.0 | 1,152 | 0.003472 |
# -*- coding: utf-8 -*-
import os
import ConfigParser
import smtplib
from email.MIMEMultipart import MIMEMultipart
from email.MIMEText import MIMEText
from email.MIMEBase import MIMEBase
from email import encoders
from global_functions import app_dir
class Mailer():
"""
Instance to manage the mailing.
... | juliarizza/certificate_generator | models/mail.py | Python | gpl-3.0 | 2,605 | 0.001153 |
import os, sys
import unittest
import vtk, qt, ctk, slicer
from slicer.ScriptedLoadableModule import *
import logging
import csv
from slicer.util import VTKObservationMixin
import platform
import time
import urllib
import shutil
from CommonUtilities import *
from packaging import version
def _setSectionResizeMode(head... | bpaniagua/SPHARM-PDM | Modules/Scripted/ShapeAnalysisModule/ShapeAnalysisModule.py | Python | apache-2.0 | 88,012 | 0.010192 |
## FormEncode, a Form processor
## Copyright (C) 2003, Ian Bicking <ianb@colorstudy.com>
##
## This library is free software; you can redistribute it and/or
## modify it under the terms of the GNU Lesser General Public
## License as published by the Free Software Foundation; either
## version 2.1 of the License, or ... | fregaham/DISP | formencode/validators.py | Python | gpl-2.0 | 71,779 | 0.001936 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.