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 |
|---|---|---|---|---|---|
#Given a binary tree containing digits from 0-9 only, each root-to-leaf path could represent a number.
#
#An example is the root-to-leaf path 1->2->3 which represents the number 123.
#
#Find the total sum of all root-to-leaf numbers.
#
#For example,
#
# 1
# / \
# 2 3
#The root-to-leaf path 1->2 represents the n... | 95subodh/Leetcode | 129. Sum Root to Leaf Numbers.py | Python | mit | 960 |
from __future__ import absolute_import
from ..packages.six.moves import http_client as httplib
from ..exceptions import HeaderParsingError
def is_fp_closed(obj):
"""
Checks whether a given file-like object is closed.
:param obj:
The file-like object to check.
"""
try:
# Check `i... | RalfBarkow/Zettelkasten | venv/lib/python3.9/site-packages/pip/_vendor/urllib3/util/response.py | Python | gpl-3.0 | 2,573 |
import urllib
import datetime
import lxml.html
import tweepy
from django.contrib.auth.decorators import login_required
from django.core.urlresolvers import reverse
from django.contrib.auth.models import User
from django.contrib.sites.models import Site
from django.http import HttpResponseForbidden, HttpResponseRedirect... | manderson23/NewsBlur | apps/oauth/views.py | Python | mit | 34,202 |
from __future__ import absolute_import
from datetime import timedelta
from django.utils import timezone
from unittest import TestCase as SimpleTestCase
from sentry.api.paginator import (
BadPaginationError,
Paginator,
DateTimePaginator,
OffsetPaginator,
SequencePaginator,
GenericOffsetPaginato... | mvaled/sentry | tests/sentry/api/test_paginator.py | Python | bsd-3-clause | 19,392 |
from django.http import HttpRequest
from django.utils.datastructures import MultiValueDict
from django.http.request import QueryDict
from django.conf import settings
def encode_request(request):
"""
Encodes a request to JSON-compatible datastructures
"""
# TODO: More stuff
value = {
"get":... | octaflop/channels | channels/request.py | Python | bsd-3-clause | 1,366 |
# -*- encoding: utf-8 -*-
##############################################################################
#
# ______ Releasing children from poverty _
# / ____/___ ____ ___ ____ ____ ___________(_)___ ____
# / / / __ \/ __ `__ \/ __ \/ __ `/ ___/ ___/ / __ \/ __ \
# / /___/ /_/ / / / /... | ndtran/compassion-switzerland | lsv_compassion/__openerp__.py | Python | agpl-3.0 | 1,970 |
# -*- coding: utf-8 -*-
# -*- coding: utf-8 -*-
"""
Inventory Management
A module to record inventories of items at a locations (sites),
including Warehouses, Offices, Shelters & Hospitals
"""
module = request.controller
resourcename = request.function
if not settings.has_module(module):
raise HTTP(... | ashwyn/eden-message_parser | controllers/inv.py | Python | mit | 72,247 |
from datetime import datetime
from pytz import timezone
FORMAT = "%Y-%m-%d %H%M"
TIME_ZONE = 'Europe/Paris'
def current_time_zone_info():
current_time = datetime.now(timezone(TIME_ZONE)).strftime(FORMAT)
return current_time.split()
| wearhacks/hackathon_hotline | hotline/common/time_zone.py | Python | mit | 242 |
# vim: tabstop=4 shiftwidth=4 softtabstop=4
# Copyright 2012, Nachi Ueno, NTT MCL, 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... | tuskar/tuskar-ui | openstack_dashboard/dashboards/project/routers/views.py | Python | apache-2.0 | 5,466 |
# -*- coding: utf-8 -*-
# Generated by Django 1.9.6 on 2016-05-22 23:51
from __future__ import unicode_literals
from django.db import migrations, models
import django.db.models.deletion
class Migration(migrations.Migration):
dependencies = [
('cs_questions', '0010_auto_20160522_2041'),
]
operat... | jonnatas/codeschool | src/cs_questions/migrations/old/0011_auto_20160522_2051.py | Python | gpl-3.0 | 738 |
# -*- coding: utf-8 -*-
from Screens.Screen import Screen
from Screens.Standby import TryQuitMainloop
from Screens.MessageBox import MessageBox
from Components.ActionMap import NumberActionMap
from Components.Pixmap import Pixmap
from Components.Sources.StaticText import StaticText
from Components.MenuList import MenuL... | 0sc0d3r/enigma2 | lib/python/Screens/SkinSelector.py | Python | gpl-2.0 | 5,526 |
# -*- coding: utf-8 -*-
# Generated by Django 1.11.16 on 2018-10-08 14:24
from __future__ import unicode_literals
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('mainapp', '0013_auto_20181005_1900'),
]
operations = [
migrations.AddField(... | meine-stadt-transparent/meine-stadt-transparent | mainapp/migrations/0014_userprofile_pgp_key_fingerprint.py | Python | mit | 490 |
# -*- coding: utf-8 -*-
from collections import Counter
from .design_pattern import singleton
@singleton()
class ListUtilsClass(object):
def most_common_inspect(self, list1):
new_list = []
for s1 in list1:
if not isinstance(s1, unicode):
s1 = str(s1).decode("UTF-8")
... | Luiti/etl_utils | etl_utils/list_utils.py | Python | mit | 1,250 |
# Glumol - An adventure game creator
# Copyright (C) 1998-2008 Sylvain Baubeau & Alexis Contour
# This file is part of Glumol.
# Glumol 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 th... | lebauce/artub | configmanager.py | Python | gpl-2.0 | 1,399 |
#!/usr/bin/env python
from argparse import ArgumentParser
import sys
import serial
from datetime import datetime
def run(device, baud, prefix=None):
with serial.Serial(device, baud, timeout=0.1) as ser:
while True:
line = ser.readline()
if not line:
continue
... | recursify/serial-debug-tool | serial_reader.py | Python | unlicense | 983 |
from __future__ import absolute_import
from __future__ import unicode_literals
import docker
from .. import mock
from .. import unittest
from compose.const import LABEL_CONFIG_HASH
from compose.const import LABEL_ONE_OFF
from compose.const import LABEL_PROJECT
from compose.const import LABEL_SERVICE
from compose.cont... | TheDataShed/compose | tests/unit/service_test.py | Python | apache-2.0 | 22,651 |
#!/usr/bin/env python
# vim: tabstop=4 shiftwidth=4 softtabstop=4
# Copyright 2010 United States Government as represented by the
# Administrator of the National Aeronautics and Space Administration.
# All Rights Reserved.
#
# Copyright 2010 Anso Labs, LLC
#
# Licensed under the Apache License, Version 2.0 (the "Li... | sorenh/cc | nova/auth/users.py | Python | apache-2.0 | 32,614 |
# coding=utf-8
from __future__ import absolute_import
__author__ = "Gina Häußge <osd@foosel.net>"
__license__ = 'GNU Affero General Public License http://www.gnu.org/licenses/agpl.html'
__copyright__ = "Copyright (C) 2014 The OctoPrint Project - Released under terms of the AGPLv3 License"
import os
import copy
impor... | fastbot3d/Octoprint | src/octoprint/printer/profile.py | Python | agpl-3.0 | 22,124 |
# Lint as: python3
"""Flume preprocessing pipeline for Criteo data.
"""
import collections
import csv
import logging as stdlogging
import re
from absl import app
from absl import flags
import apache_beam as beam
import numpy as np
import tensorflow.compat.v1 as tf
import runner
FLAGS = flags.FLAGS
flags.DEFINE_str... | mlperf/training_results_v0.7 | Google/benchmarks/dlrm/implementations/dlrm-research-TF-tpu-v4-512/criteo_util/criteo_batched.py | Python | apache-2.0 | 5,711 |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
# Copyright (C) 2009 Timothée Lecomte
# This file is part of Friture.
#
# Friture 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.
#
# Friture is distri... | UIKit0/friture | friture/ringbuffer.py | Python | gpl-3.0 | 4,737 |
import re
import sys
import traceback
from config import panda_config
# logger
from pandalogger.PandaLogger import PandaLogger
_logger = PandaLogger().getLogger('SiteMapper')
# PandaIDs
from PandaSiteIDs import PandaSiteIDs
# default site
from taskbuffer.SiteSpec import SiteSpec
from taskbuffer.NucleusSpec import Nu... | RRCKI/panda-server | pandaserver/brokerage/SiteMapper.py | Python | apache-2.0 | 12,774 |
# Gramps - a GTK+/GNOME based genealogy program
#
# Copyright (C) 2012 Nick Hall
# Copyright (C) 2012 Brian G. Matherly
# Copyright (C) 2012-2014 Paul Franklin
#
# 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
# t... | SNoiraud/gramps | gramps/plugins/textreport/alphabeticalindex.py | Python | gpl-2.0 | 4,553 |
from jinja2 import Environment, FileSystemLoader
loader = FileSystemLoader("webx/templates")
env = Environment(loader=loader)
template = env.get_template('form.html')
print template.render(the='variables', go='here') | mabotech/maboss.py | maboss/webx/models/gen_form.py | Python | mit | 227 |
from BaseModel import BaseModel
import DatabaseLayer
class HabitBaseModel(BaseModel):
"""
This will be the base class for all of my models. And since my save
changes is going to use pretty much the same logic in all of my models,
I'm going to centralize the logic in this base glass. I know that that is... | joelliusp/SpaceHabit | SpaceHabitRPG/Models/HabitBaseModel.py | Python | mit | 1,573 |
# Package versioning solution originally found here:
# http://stackoverflow.com/q/458550
# Store the version here so:
# 1) we don't load dependencies by storing it in __init__.py
# 2) we can import it in setup.py for the same reason
# 3) we can import it into your module
__version__ = '0.3.8'
| tlatzko/spmcluster | .tox/docs/lib/python2.7/site-packages/build/lib/build/lib/build/lib/build/lib/build/lib/build/lib/sphinxcontrib/napoleon/_version.py | Python | bsd-2-clause | 295 |
import sys
from aimes.emgr.utils import *
__author__ = "Matteo Turilli"
__copyright__ = "Copyright 2015, The AIMES Project"
__license__ = "MIT"
# -----------------------------------------------------------------------------
def write_skeleton_conf(cfg, scale, cores, uniformity, fout):
'''Write a skeleton configu... | radical-cybertools/aimes.emgr | src/aimes/emgr/workloads/skeleton.py | Python | mit | 1,336 |
#!/usr/bin/env python
import tornado.ioloop
import tornado.web
class MainHandler(tornado.web.RequestHandler):
def get(self):
self.write("Hello, world")
application = tornado.web.Application([
(r"/", MainHandler),
])
if __name__ == "__main__":
application.listen(8888)
tornado.ioloop.IOLoop.in... | tinyogre/multislash | testserver.py | Python | mit | 337 |
"""
This module contains all the views which are used
by the manager to add/edit healthprofessionals and the
views used by the healthprofessional itselves.
:subtitle:`Class definitions:`
"""
import StringIO
from datetime import date
from django.contrib.auth.decorators import login_required, user_passes_test
from djang... | acesonl/remotecare | remotecare/apps/healthperson/healthprofessional/views.py | Python | gpl-3.0 | 30,894 |
__all__ = ['ttypes', 'constants', 'rataservice']
| leonidas/roboio | tests/servers/gen-py/rataservice/__init__.py | Python | lgpl-2.1 | 49 |
# -*- coding: utf-8 -*-
"""
=========================================================
The Iris Dataset
=========================================================
This data sets consists of 3 different types of irises'
(Setosa, Versicolour, and Virginica) petal and sepal
length, stored in a 150x4 numpy.ndarray
The rows ... | manhhomienbienthuy/scikit-learn | examples/datasets/plot_iris_dataset.py | Python | bsd-3-clause | 1,939 |
from flask import render_template, Flask, request, redirect, url_for, current_app
from app import app
import urllib2
from bs4 import BeautifulSoup
from flaskext import wtf
from flaskext.wtf import Form, TextField, TextAreaField, \
SubmitField, validators, ValidationError, IntegerField
from google.appengine.ext impo... | kho0810/likelion_Web | app/views.py | Python | apache-2.0 | 5,752 |
# -*- coding: utf-8 -*-
# Form implementation generated from reading ui file 'ui_sudoku_solver.ui'
#
# Created: Mon Dec 30 21:16:20 2013
# by: PyQt4 UI code generator 4.10
#
# WARNING! All changes made in this file will be lost!
from PyQt4 import QtCore, QtGui
try:
_fromUtf8 = QtCore.QString.fromUtf8
except... | guanidene/pySudokuSolver | ui_sudoku_solver.py | Python | bsd-3-clause | 121,430 |
# -*- coding: utf-8 -*-
"""
***************************************************************************
ToolboxAction.py
---------------------
Date : August 2012
Copyright : (C) 2012 by Victor Olaya
Email : volayaf at gmail dot com
*************************... | mhugent/Quantum-GIS | python/plugins/processing/gui/ToolboxAction.py | Python | gpl-2.0 | 1,554 |
import util
from threading import Thread
from poison import Poison
from arp import arp
from zoption import Zoption
from scapy.all import *
class dhcp(Poison):
def __init__(self):
super(dhcp, self).__init__('DHCP Spoof')
conf.verb = 0
self.local_mac = get_if_hwaddr(conf.iface)
self.... | bacemtayeb/Tierra | src/modules/poison/dhcp.py | Python | gpl-3.0 | 8,157 |
#!/usr/bin/env python
# cmy:- c-mee
# DUMP your thoughts and CLEAR your mind using c-mee.
# Version : v1-beta
# email:- cmy.project.mail@gmail.com
# cmy is short form of Clear Mind YAML
import yaml
import datetime
import os
import sys
import io
from pathlib import Path
# Create the yaml file, if it does not exist.
... | anilv4/cmy | cmy/cmy.py | Python | gpl-3.0 | 6,870 |
"""
returns tsv of word frequencies in revision comments
Usage:
revision_comment_word_extractor (-h|--help)
revision_comment_word_extractor <input> <output>
[--debug]
[--verbose]
Options:
-h, --help This help message is printed
<... | hall1467/wikidata_usage_tracking | python_analysis_scripts/revision_comment_word_extractor.py | Python | mit | 2,427 |
# -*- coding: utf-8 -*-
"""
A file compress utility module. You can easily programmatically add files
and directorys to zip archives. And compress arbitrary binary content.
- :func:`zip_a_folder`: add folder to archive.
- :func:`zip_everything_in_a_folder`: add everything in a folder to archive.
- :func:`zip_many_fil... | MacHu-GWU/single_file_module-project | sfm/winzip.py | Python | mit | 4,194 |
class Solution:
def twoCitySchedCost(self, costs):
costs = sorted(costs, key=lambda x:x[0]-x[1])
ans = 0
for i in range(len(costs)):
if i < len(costs)//2:
ans += costs[i][0]
else:
ans += costs[i][1]
return ans
print(Solution().t... | zuun77/givemegoogletshirts | leetcode/python/1029_two-city-scheduling.py | Python | apache-2.0 | 374 |
#!/usr/bin/env python3
from rnnlm_ops import RnnlmOp, run_epoch
from dataset import Datasets
from config import Config
import os
import tensorflow as tf
class Train(RnnlmOp):
def __init__(self, config, params):
super(Train, self).__init__(config, params)
self.io.check_dir(params.data_path)
assert(... | pltrdy/tf_rnnlm | train.py | Python | apache-2.0 | 3,381 |
# coding=utf-8
from adbook.orm.entity import Entity
from adbook.orm.types.collection_ref import CollectionRef
class Group(Entity):
"""
Group entity
"""
def __init__(self, name=""):
super().__init__()
self.name = name
self.persons = CollectionRef("persons", self, Group._man... | avatar29A/adbook | adbook/orm/entities/groups.py | Python | mit | 406 |
# 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... | npuichigo/ttsflow | third_party/tensorflow/tensorflow/python/kernel_tests/in_topk_op_test.py | Python | apache-2.0 | 2,682 |
import unittest
import freezegun
import ocal
import time
import os
class ocaltest(unittest.TestCase):
def assertYMD(self, o, cal, year, mon, day, dow, msg):
self.assertEqual(o.calendar, cal,
"{} showed the wrong calendar".format(msg))
self.assertEqual(o.year, year... | mlv/ocal | test_ocal.py | Python | mit | 12,174 |
from django.shortcuts import render, redirect, get_object_or_404
from blogEngine.models import blogPost, blogSlug
def postList(request, pk):
pass
##Both of these just deal with url management, and keeping url's human readable.
def postView(request, pk=None, slug=None):
postInstance = get_object_or_404(blogPos... | traverseda/personalSite | blogEngine/views.py | Python | unlicense | 822 |
"""
uh.cx
X-Chat Version
@homepage: http://uh.cx
@copyright: Copyright (C) 2015 J. Boehm
"""
__module_name__ = "uh.cx"
__module_version__ = "0.2"
__module_description__ = "Make a shortened URL with uh.cx and post it to a channel or user."
__module_author__ = "uh.cx (J. Boehm)"
import urllib
import traceback
import j... | jeboehm/uhcx-xchat | uhcx_xchat.py | Python | gpl-2.0 | 2,529 |
#!/usr/bin/env python
import Genscan
import GFF
meta, data, proteins = Genscan.load('genscan.txt')
offset = 16000000
reference = 'scaffold_42'
gffSource = 'genscan'
gffClass = 'Genscan'
featureType = 'gene'
subfeatureType = 'exon'
for gene in data:
name = gene[0]['gene.exon'].split('.')[0]
output = []
... | PapenfussLab/Mungo | snippets/genscan2gff.py | Python | artistic-2.0 | 1,215 |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
# vim: ai ts=4 sts=4 et sw=4
from django.conf import settings
from django.db.models import Sum, Count, Avg
from django.http import HttpResponse, HttpResponseRedirect
from django.shortcuts import render_to_response, get_object_or_404
from django.contrib.auth.models import Us... | videntity/tweatwell | apps/profile/views.py | Python | gpl-2.0 | 3,216 |
# 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... | tabish121/quiver | python/brokerlib.py | Python | apache-2.0 | 11,350 |
"""Run bark-spider using waitress.
"""
import bark_spider.app
from waitress import serve
serve(bark_spider.app.make_app(), listen="*:8080")
| sixty-north/bark-spider | wsgi.py | Python | agpl-3.0 | 142 |
#! /usr/bin/env python3
"""Test whether given Newick/NHX trees are valid for ProPhyle.
Author: Karel Brinda <kbrinda@hsph.harvard.edu>
Licence: MIT
Example:
$ prophyle_validate_tree.py ~/prophyle/bacteria.nw ~/prophyle/viruses.nw
"""
import os
import sys
import argparse
sys.path.append(os.path.dirname(__file_... | karel-brinda/prophyle | prophyle/prophyle_validate_tree.py | Python | mit | 1,090 |
##############################################################################
# Copyright (c) 2013-2017, Lawrence Livermore National Security, LLC.
# Produced at the Lawrence Livermore National Laboratory.
#
# This file is part of Spack.
# Created by Todd Gamblin, tgamblin@llnl.gov, All rights reserved.
# LLNL-CODE-64... | wscullin/spack | var/spack/repos/builtin/packages/py-py2neo/package.py | Python | lgpl-2.1 | 1,874 |
# Copyright 2020 The HuggingFace Team. 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 applicabl... | huggingface/pytorch-transformers | tests/test_modeling_flax_bert.py | Python | apache-2.0 | 5,250 |
#!/usr/bin/env python
"""
[appname]
[author]
[description]
"""
import os
from flask import Flask, render_template, url_for
def static(filename):
"""Provides the 'static' function that also appends the file's timestamp to the URL, usable in a template."""
timestamp = os.path.getmtime(os.path.join(app.static_... | joeyespo/flask-scaffold | [appname].py | Python | mit | 763 |
import PyOpenWorm as P
from PyOpenWorm import Cell
class Muscle(Cell):
"""A single muscle cell.
See what neurons innervate a muscle:
Example::
>>> mdr21 = P.Muscle('MDR21')
>>> innervates_mdr21 = mdr21.innervatedBy()
>>> len(innervates_mdr21)
4
Attributes
-------... | hnunner/PyOpenWorm | PyOpenWorm/muscle.py | Python | mit | 935 |
import abc
from sqlalchemy.orm import exc
from watson.auth import crypto
from watson.auth.providers import exceptions
from watson.common import imports
from watson.common.decorators import cached_property
class Base(object):
config = None
session = None
def __init__(self, config, session):
self.... | watsonpy/watson-auth | watson/auth/providers/abc.py | Python | bsd-3-clause | 3,673 |
# Copyright 2010-2012 Gentoo Foundation
# Distributed under the terms of the GNU General Public License v2
__all__ = ['getmaskingreason']
import portage
from portage import os
from portage.const import USER_CONFIG_PATH
from portage.dep import Atom, match_from_list
from portage.exception import InvalidAtom
from portag... | clickbeetle/portage-cb | pym/portage/package/ebuild/getmaskingreason.py | Python | gpl-2.0 | 3,872 |
#!/usr/bin/env python
from flask.ext import restful
from awbwFlask import mongo
from awbwFlask.common.methods import bsonToJson, generate_auth_token, hash_password, verify_auth_token, verify_password
from awbwFlask.common.variables import headers
class Login_EP(restful.Resource):
def __init__(self):
self.r... | amarriner/awbwFlask | resources/LoginAPI.py | Python | mit | 1,642 |
# Copyright 2010 United States Government as represented by the
# Administrator of the National Aeronautics and Space Administration.
# Copyright 2011 Justin Santa Barbara
# All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance wi... | stanzikratel/barbican-2 | barbican/openstack/common/jsonutils.py | Python | apache-2.0 | 6,717 |
__all__ = ["Cipher", "Util"]
| repotvsupertuga/tvsupertuga.repository | script.module.cryptolib/lib/Crypto/__init__.py | Python | gpl-2.0 | 29 |
from etcd import EtcdKeyNotFound
from subprocess import CalledProcessError
from tendrl.commons.event import Event
from tendrl.commons.message import ExceptionMessage
from tendrl.commons.utils import log_utils as logger
from tendrl.monitoring_integration.alert import constants
from tendrl.monitoring_integration.alert.ha... | rishubhjain/monitoring-integration | tendrl/monitoring_integration/alert/handlers/node/cpu_handler.py | Python | lgpl-2.1 | 5,352 |
#
# Copyright (c) 2014 ThoughtWorks, Inc.
#
# Pixelated is free software: you can redistribute it and/or modify
# it under the terms of the GNU Affero General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# Pixelated is distrib... | alabeduarte/pixelated-user-agent | service/pixelated/resources/loading_page.py | Python | agpl-3.0 | 1,677 |
from fastlmm import Pr
import scipy as sp
import numpy as NP
from numpy import dot
import scipy.integrate
from scipy.linalg import cholesky,solve_triangular
from fastlmm.external.util.math import check_definite_positiveness,check_symmetry,mvnormpdf,ddot,trace2,dotd
from fastlmm.external.util.math import stl, stu
from f... | MicrosoftGenomics/FaST-LMM | fastlmm/inference/laplace.py | Python | apache-2.0 | 16,247 |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
#
# Copyright 2018 João Pedro Rodrigues
#
# 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
#
# Unl... | JoaoRodrigues/pdb-tools | pdbtools/pdb_rplresname.py | Python | apache-2.0 | 4,763 |
from django.test import TestCase
from judge.models.tests.util import CommonDataMixin, create_blogpost, create_user
class BlogPostTestCase(CommonDataMixin, TestCase):
@classmethod
def setUpTestData(self):
super().setUpTestData()
self.users.update({
'staff_blogpost_edit_own': create... | DMOJ/site | judge/models/tests/test_blogpost.py | Python | agpl-3.0 | 2,642 |
from __future__ import unicode_literals
from ubuntui.ev import EventLoop
from ubuntui.utils import Color, Padding
from ubuntui.widgets.buttons import menu_btn, quit_btn
from urwid import Columns, Filler, Pile, Text, WidgetWrap
from conjureup.app_config import app
class VariantView(WidgetWrap):
def __init__(sel... | conjure-up/conjure-up | conjureup/ui/views/variant.py | Python | mit | 2,592 |
"""The islamic_prayer_times component."""
from datetime import timedelta
import logging
from prayer_times_calculator import PrayerTimesCalculator, exceptions
from requests.exceptions import ConnectionError as ConnError
import voluptuous as vol
from homeassistant.config_entries import SOURCE_IMPORT
from homeassistant.... | nkgilley/home-assistant | homeassistant/components/islamic_prayer_times/__init__.py | Python | apache-2.0 | 6,817 |
from flask import render_template, request, url_for, jsonify
from application.mongo_db import mongo
from bson.objectid import ObjectId
from . import module
from . import validation
from .setup import setup
@module.route("/<component_type>/", methods=("GET", "POST"))
def index(component_type):
kwargs = {}
if... | megrela/flask-cms-control-panel | application/modules/components/router.py | Python | mit | 2,677 |
# Copyright (c) 2010 OpenStack Foundation
# Copyright 2010 United States Government as represented by the
# Administrator of the National Aeronautics and Space Administration.
# All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in complianc... | nikesh-mahalka/cinder | cinder/scheduler/driver.py | Python | apache-2.0 | 4,426 |
# dispatch.py - command dispatching for mercurial
#
# Copyright 2005-2007 Matt Mackall <mpm@selenic.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 i18n import _
import os, sys, atexit, signal, pdb, socket, errno, shlex,... | jordigh/mercurial-crew | mercurial/dispatch.py | Python | gpl-2.0 | 31,772 |
# Spacewalk Proxy Server authentication manager.
#
# Copyright (c) 2008--2015 Red Hat, Inc.
#
# This software is licensed to you under the GNU General Public License,
# version 2 (GPLv2). There is NO WARRANTY for this software, express or
# implied, including the implied warranties of MERCHANTABILITY or FITNESS
# FOR A... | lhellebr/spacewalk | proxy/proxy/rhnProxyAuth.py | Python | gpl-2.0 | 18,014 |
# Copyright 2008-2015 Nokia Solutions and Networks
#
# 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... | fingeronthebutton/RIDE | src/robotide/lib/robot/reporting/xunitwriter.py | Python | apache-2.0 | 3,461 |
#!/usr/bin/env python
#
# This file is part of the Fun SDK (fsdk) project. The complete source code is
# available at https://github.com/luigivieira/fsdk.
#
# Copyright (c) 2016-2017, Luiz Carlos Vieira (http://www.luiz.vieira.nom.br)
#
# MIT License
#
# Permission is hereby granted, free of charge, to any person obtai... | luigivieira/fsdk | fsdk/reports/distances.py | Python | mit | 6,011 |
# Feature extractors for XML files ( 0 < Dynamo < 2)
import xml.etree.ElementTree as ET
def getVersion(b64decodedData):
et = ET.fromstring(b64decodedData)
version = et.attrib["Version"]
return version
def usesListAtLevel(data):
usesList = data.find('useLevels="True"') > -1
return usesList
def ha... | DynamoDS/Coulomb | SessionTools/features_XML.py | Python | mit | 941 |
# 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... | tlby/mxnet | python/mxnet/contrib/text/embedding.py | Python | apache-2.0 | 30,929 |
from consts.client_type import ClientType
from consts.notification_type import NotificationType
from controllers.gcm.gcm import GCMMessage
from notifications.base_notification import BaseNotification
class UpdateFavoritesNotification(BaseNotification):
_supported_clients = [ClientType.OS_ANDROID, ClientType.WEBH... | nwalters512/the-blue-alliance | notifications/update_favorites.py | Python | mit | 1,094 |
from datetime import datetime
from dateutil.relativedelta import relativedelta
from flask import Flask
from celery import Celery
from .mail_utility import send_email
def make_celery(app):
celery = Celery(app.import_name,
backend=app.config['CELERY_BACKEND'],
broker=app.co... | vsilent/Vision | app/tasks.py | Python | gpl-2.0 | 2,777 |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
try:
from setuptools import setup
except ImportError:
from distutils.core import setup
import re
from codecs import open
version = ""
with open("koordinates/__init__.py", "r") as fd:
version = re.search(
r'^__version__\s*=\s*[\'"]([^\'"]*)[\'"]', fd.... | koordinates/python-client | setup.py | Python | bsd-3-clause | 1,747 |
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.db import models, migrations
class Migration(migrations.Migration):
dependencies = [
('cali_water', '0018_auto_20150501_1126'),
]
operations = [
migrations.AlterField(
model_name='watersuppliermonthl... | SCPR/accountability-tracker | cali_water/migrations/0019_auto_20150501_1150.py | Python | gpl-2.0 | 821 |
from .vnsipmd import MdApi
from .sip_constant import * | bigdig/vnpy | vnpy/api/sip/__init__.py | Python | mit | 54 |
# Licensed under a 3-clause BSD style license - see LICENSE.rst
import urllib.request
import os
import locale
import platform
import pytest
import numpy as np
from numpy.testing import assert_array_equal
import erfa
from astropy.time import Time, TimeDelta
from astropy.utils.iers import iers
from astropy.utils.data i... | dhomeier/astropy | astropy/utils/iers/tests/test_leap_second.py | Python | bsd-3-clause | 19,966 |
# This file is part of MSMTools.
#
# Copyright (c) 2015, 2014 Computational Molecular Biology Group, Freie Universitaet Berlin (GER)
#
# MSMTools 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 ... | markovmodel/msmtools | tests/analysis/impl/dense/stationary_vector_test.py | Python | lgpl-3.0 | 2,003 |
#!/usr/local/bin/ipython -i
"""
A scatter graph of grid count vs grid area.
"""
import numpy as np
import matplotlib.pyplot as plt
# extract data from csv
file_name = "../data/tdwgsp_filtered.csv"
# columns (filtered):
# 1 - star_infs
# 2 - tdwgtotals
# 3 - tdwgareas
star_infs = np.genfromtxt(file_name, delimiter=','... | Nodoka/Bioquality | graphing/tdwg_scatter.py | Python | mit | 1,350 |
# -*- coding: utf-8 -*-
# Generated by Django 1.11.5 on 2017-09-09 10:54
from __future__ import unicode_literals
from django.db import migrations, models
import django.db.models.deletion
class Migration(migrations.Migration):
initial = True
dependencies = [
('groups', '0001_initial'),
]
op... | MilyMilo/sci-organizer | agenda/migrations/0001_initial.py | Python | mit | 1,029 |
# !/usr/bin/python
# -*- coding: cp1252 -*-
#
##################################################################################
#
# Copyright 2016 Félix Brezo and Yaiza Rubio (i3visio, contacto@i3visio.com)
#
# This program is part of OSRFramework. You can redistribute it and/or modify
# it under the terms of... | i3visio/osrframework | osrframework/wrappers/pending/blackplanet.py | Python | agpl-3.0 | 4,164 |
#!/usr/bin/python
# -*- coding: utf-8 -*-
# This file encoding UTF-8 no BOM. このファイルの文字コードはUTF-8 BOM無しです。
################################################################################
__appname__ = "MasterlistLib"
__author__ = "Jaken<Jaken.Jarvis@gmail.com>"
__copyright__ = "Copyright 2010, Jaken"
__licen... | jakenjarvis/pyOss | pyOssLib/v1_0/MasterlistLib.py | Python | gpl-3.0 | 89,690 |
"""
Copyright 2013 Steven Diamond
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software... | SteveDiamond/cvxpy | cvxpy/atoms/sum_squares.py | Python | gpl-3.0 | 930 |
../../../../../share/pyshared/twisted/python/urlpath.py | Alberto-Beralix/Beralix | i386-squashfs-root/usr/lib/python2.7/dist-packages/twisted/python/urlpath.py | Python | gpl-3.0 | 55 |
""" CISCO_IETF_MPLS_ID_STD_03_MIB
Copyright (c) 2012 IETF Trust and the persons identified
as the document authors. All rights reserved.
This MIB module contains generic object definitions for
MPLS Traffic Engineering in transport networks. This module is a
cisco\-ized version of the IETF draft\:
draft\-ietf\-mpls\... | 111pontes/ydk-py | cisco-ios-xe/ydk/models/cisco_ios_xe/CISCO_IETF_MPLS_ID_STD_03_MIB.py | Python | apache-2.0 | 3,540 |
import os
import re
import json
import pprint
EMPTY = '4b825dc642cb6eb9a060e54bf8d69288fbee4904'
repo = str(input('Enter clone url to git repo: '))
repo_folder = repo.split('/')[-1].split('.git')[0]
os.system('git clone ' + repo)
os.system('cd ' + repo_folder)
log = os.popen('git --git-dir ./' + repo_folder + '/.... | vivekmumbles/git-ledger | data.py | Python | gpl-2.0 | 3,254 |
# -*- coding: utf-8 -*-
from Model import Model
import sys, locale;
# ucitava primjere iz zadane datoteke
def load_data_X(file):
X = []
for line in open(file):
line = line.decode('utf-8')
sentences = line.strip().split('\t')
X.append(sentences)
return X
# ucitava izlaze primjera iz... | kbiscanic/apt_project | apt/Main.py | Python | apache-2.0 | 7,473 |
import argparse
import subprocess
import os.path as osp
cdir = osp.dirname(__file__)
wheeldir_dpath = osp.join(cdir, 'wheelhouse')
pip_args = ['wheel', '--wheel-dir', wheeldir_dpath, '--use-wheel', '--find-links',
wheeldir_dpath]
def build_file(req_fpath):
subprocess.check_call(['pip'] + pip_args + ... | nZac/keg-elements | requirements/build-wheelhouse.py | Python | bsd-3-clause | 881 |
"""
This is the test suite for segregation.py.
"""
from unittest import TestCase
from propargs.propargs import PropArgs
import models.segregation as seg
from indra.composite import Composite
from indra.env import Env
from registry.registry import get_env
from models.segregation import DEF_TOLERANCE, DEF_SIGMA
from m... | gcallah/Indra | models/tests/test_segregation.py | Python | gpl-3.0 | 3,455 |
#---------------------------------------------------------------------------------------------
# Copyright (c) Microsoft Corporation. All rights reserved.
# Licensed under the MIT License. See License.txt in the project root for license information.
#---------------------------------------------------------------------... | BurtBiel/azure-cli | src/command_modules/azure-cli-network/azure/cli/command_modules/network/mgmt_vnet_gateway/lib/vnet_gateway_creation_client.py | Python | mit | 5,916 |
"""
Declares model object for the VLDB
"""
from afs.model.BaseModel import BaseModel
class VLDB(BaseModel) :
"""
empty model for volume Location Database.
This defines a logical view on the DB.
The single copies of it are defined in the
DBServer model.
"""
def __init__(self):
"""
... | openafs-contrib/afspy | afs/model/VLDB.py | Python | bsd-2-clause | 883 |
""" This module hosts the logic for executing an RPC call.
"""
from DIRAC.Core.DISET.private.BaseClient import BaseClient
from DIRAC.Core.Utilities.ReturnValues import S_OK
from DIRAC.Core.Utilities.DErrno import cmpError, ENOAUTH
class InnerRPCClient(BaseClient):
"""This class instruments the BaseClient to perfo... | DIRACGrid/DIRAC | src/DIRAC/Core/DISET/private/InnerRPCClient.py | Python | gpl-3.0 | 2,922 |
from django.core.exceptions import PermissionDenied
from django.views.generic import TemplateView
from C4CApplication.views.utils import create_user
class ChangeActivityView(TemplateView):
template_name = "C4CApplication/ChangeActivity.html"
def dispatch(self, request, *args, **kwargs):
... | dsarkozi/care4care-sdp-grp4 | Care4Care/C4CApplication/views/ChangeActivityView.py | Python | agpl-3.0 | 820 |
from bottle import route, template, error, request, static_file, get, post
from index import get_index
from bmarks import get_bmarks
from tags import get_tags
from add import add_tags
from bmarklet import get_bmarklet
from account import get_account
from edit_tags import get_edit_tags
from importbm import get_import_bm... | netllama/tastipy | tastiapp.py | Python | gpl-3.0 | 2,172 |
import json
from nose.tools import eq_
import mock
from django.core.urlresolvers import reverse
from airmozilla.base.tests.test_mozillians import (
Response,
GROUPS1,
GROUPS2
)
from .base import ManageTestCase
class TestCuratedGroups(ManageTestCase):
@mock.patch('logging.error')
@mock.patch('r... | kenrick95/airmozilla | airmozilla/manage/tests/views/test_curatedgroups.py | Python | bsd-3-clause | 1,463 |
# Copyright (c) 2014-present PlatformIO <contact@platformio.org>
#
# 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... | platformio/platformio | platformio/commands/home/rpc/server.py | Python | apache-2.0 | 3,610 |
#!/usr/bin/env python
# coding=utf-8
from flaskcms.lib import db
from flask.ext.sqlalchemy import event
from passlib.apps import mysql_context as pwd_context
class User(db.Model):
__tablename = "user"
id = db.Column(db.Integer, primary_key=True)
name = db.Column(db.String(10))
passwd = db.Column(db.St... | Franciscowxp/FlaskCms | flaskcms/modules/account/model.py | Python | mit | 1,196 |
"""
Global PyTrace exception classes.
"""
class ImproperlyConfigured(Exception):
"""PyTrace is somehow improperly configured"""
pass
class StandardInputReadError(Exception):
"""
Raised when attempted to read from Standard Input Stream
while Input Queue is empty
"""
MESSAGE = "Unable to ... | uadnan/pytrace | pytrace/core/exceptions.py | Python | mit | 2,561 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.