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 |
|---|---|---|---|---|---|
"""
Support gathering system information of hosts which are running glances.
For more details about this platform, please refer to the documentation at
https://home-assistant.io/components/sensor.glances/
"""
from datetime import timedelta
import logging
import voluptuous as vol
from homeassistant.components.sensor ... | PetePriority/home-assistant | homeassistant/components/sensor/glances.py | Python | apache-2.0 | 8,615 |
################################################################################
#
# Copyright 2014-2016 Eric Lacombe <eric.lacombe@security-labs.org>
#
################################################################################
#
# This file is part of fuddly.
#
# fuddly is free software: you can redistribute ... | k0retux/fuddly | framework/basic_primitives.py | Python | gpl-3.0 | 2,943 |
#!/usr/bin/python2.3
from OpenGL.GL import *
from OpenGL.GLU import *
import config
import utilities
from graph import Graph, Vertex, DummyVertex, Edge, SuperEdge, X_AXIS, Y_AXIS, Z_AXIS
from sys import stderr
from math import acos, atan2, pi, log
class GraphGL:
"""
A wrapper class to hold textures and metho... | ulethHCI/GLuskap | graphgl.py | Python | gpl-2.0 | 13,203 |
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.contrib import admin
from django import forms
from .models import Editorials
class EditorialsModelForm(forms.ModelForm):
class Meta:
model = Editorials
fields = '__all__'
widgets = {
'content': forms.Te... | radheygupta/editorialsnow | editorials/admin.py | Python | apache-2.0 | 703 |
from neomodel import (Property, StructuredNode, StringProperty, DateProperty, AliasProperty, UniqueProperty,
DateTimeProperty, RelationshipFrom, BooleanProperty, Relationship, DoesNotExist, ZeroOrOne,
DeflateError, One, ZeroOrMore, OneOrMore, AttemptedCardinalityViolation, Mu... | buckmaxwell/neoapi | neoapi/serializable_structured_node.py | Python | mit | 53,407 |
# Welcome spoke classes
#
# Copyright (C) 2011-2012 Red Hat, Inc.
#
# This copyrighted material is made available to anyone wishing to use,
# modify, copy, or redistribute it subject to the terms and conditions of
# the GNU General Public License v.2, or (at your option) any later version.
# This program is distribute... | marmarek/anaconda | pyanaconda/ui/gui/spokes/welcome.py | Python | gpl-2.0 | 15,586 |
# http://www.codewars.com/kata/52ad1db4b2651f744d000394
import math
def reindeer(presents):
return 2 + math.ceil(float(presents) / 30) | Bodigrim/katas | src/python/6-How-Many-Reindeers.py | Python | bsd-2-clause | 137 |
#!/usr/bin/env python3
# -*- mode: python; indent-tabs-mode: nil; c-basic-offset: 4; tab-width: 4; -*-
# vim: set shiftwidth=4 softtabstop=4 expandtab:
"""Support for reading from an NCAR EOL RAF PostgreSQL database of
real-time flight data.
2014 Copyright University Corporation for Atmospheric Research
This file is... | ncareol/ncharts | ncharts/raf_database.py | Python | bsd-2-clause | 14,670 |
# pylint: disable=E1101
'''
Utilities for contentstore tests
'''
import json
from django.test.client import Client
from django.contrib.auth.models import User
from xmodule.contentstore.django import contentstore
from xmodule.modulestore import ModuleStoreEnum
from xmodule.modulestore.inheritance import own_metadata
... | epam-mooc/edx-platform | cms/djangoapps/contentstore/tests/utils.py | Python | agpl-3.0 | 14,639 |
from gluon.contrib.appconfig import AppConfig
myconf = AppConfig(reload=True)
response.formstyle = myconf.take('forms.formstyle') # or 'bootstrap3_stacked' or 'bootstrap2' or other
response.form_label_separator = myconf.take('forms.separator')
db = DAL('sqlite://storage.sqlite')
from gluon.tools import Auth, Servi... | Priyansh2/test | web2py/cookbook/models/db.py | Python | gpl-3.0 | 3,292 |
#!/usr/bin/env python
# Copyright (c) 2012 The Chromium Authors. All rights reserved.
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
'''Collections of messages and their translations, called cliques. Also
collections of cliques (uber-cliques).
'''
import re
impo... | CrankWheel/grit-i18n | grit/clique.py | Python | bsd-2-clause | 18,037 |
# Progress hub classes
#
# Copyright (C) 2011-2013 Red Hat, Inc.
#
# This copyrighted material is made available to anyone wishing to use,
# modify, copy, or redistribute it subject to the terms and conditions of
# the GNU General Public License v.2, or (at your option) any later version.
# This program is distributed... | snbueno/anaconda | pyanaconda/ui/gui/hubs/progress.py | Python | gpl-2.0 | 11,117 |
# Copyright (c) 2012 OpenStack Foundation.
# 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... | cloudbase/neutron-virtualbox | neutron/cmd/netns_cleanup.py | Python | apache-2.0 | 5,850 |
# -*- coding: utf-8 -*-
"""
sphinx.pygments_styles
~~~~~~~~~~~~~~~~~~~~~~
Sphinx theme specific highlighting styles.
:copyright: Copyright 2007-2013 by the Sphinx team, see AUTHORS.
:license: BSD, see LICENSE for details.
"""
from pygments.style import Style
from pygments.styles.friendly import F... | nirmeshk/oh-mainline | vendor/packages/sphinx/sphinx/pygments_styles.py | Python | agpl-3.0 | 3,025 |
from flask import Flask, request, render_template
app = Flask(__name__)
@app.route('/index')
def index():
#jsonObj = request.json_get('txt') non funziona perchè lo script serverSide può essere eseguito una volta soltanto
return render_template('index.html')
@app.route('/process', methods = ['GET', '... | wibox/Posting-JSON-data-to-Flask-server | __init__.py | Python | mit | 541 |
from __future__ import unicode_literals, division, absolute_import
from argparse import ArgumentParser, ArgumentTypeError
from builtins import * # noqa pylint: disable=unused-import, redefined-builtin
from sqlalchemy.orm.exc import NoResultFound
from flexget import options
from flexget import plugin
from flexget.en... | gazpachoking/Flexget | flexget/components/managed_lists/lists/movie_list/cli.py | Python | mit | 9,783 |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
from django.conf.urls import patterns, url
from django.conf import settings
from opps.contrib.feeds.views import (ContainerFeed, ChannelFeed,
ContainerAtomFeed, ChannelAtomFeed)
from opps.core.tags.views import TagList
from opps.core.c... | laborautonomo/opps | opps/containers/urls.py | Python | mit | 1,707 |
# -*- coding: utf-8 -*-
## Part of the pyprimes.py package.
##
## Copyright © 2014 Steven D'Aprano.
## See the file __init__.py for the licence terms for this software.
"""The module implements various prime generating and testing functions using
the Strategy design pattern, allowing the caller to easily experimen... | skilledindia/pyprimes | src/pyprimes/strategic.py | Python | mit | 5,593 |
# Gramps - a GTK+/GNOME based genealogy program
#
# Copyright (C) 2011,2015 Nick Hall
#
# 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) an... | prculley/gramps | gramps/plugins/gramplet/placedetails.py | Python | gpl-2.0 | 6,794 |
# coding=utf-8
# Copyright 2017 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 contextlib impo... | UnrememberMe/pants | tests/python/pants_test/testutils/process_test_util.py | Python | apache-2.0 | 1,611 |
import json
import os
from django.test import TestCase
from corehq.apps.commtrack.tests.util import bootstrap_domain as initial_bootstrap
from corehq.apps.sms.mixin import VerifiedNumber
from corehq.apps.users.models import CommCareUser
from custom.ewsghana.api import EWSApi, SMSUser
from custom.ilsgateway.tests.mock_... | puttarajubr/commcare-hq | custom/ewsghana/tests/test_smsusers_sync.py | Python | bsd-3-clause | 6,801 |
{
'name': 'Invoice Discount',
'version': '1.0',
'category': 'Accounting',
'sequence': 1,
'summary': "Show Discount Total and Total before Discount on Invoices. ",
'description':"Show Discount Total and Total before Discount on Invoices.",
'author': 'M.Hagag@DVIT.ME',
'website': 'http... | hubercinux/dvit-odoo8 | invoice_discount/__openerp__.py | Python | agpl-3.0 | 549 |
#-----------------------------------------------------------------------------
# Name: ExplorerShell.py
# Product: ClamWin Free Antivirus
#
# Author: alch [alch at users dot sourceforge dot net]
#
# Created: 2004/19/03
# Copyright: Copyright alch (c) 2004
# Licence:
# This program is fr... | ghostshellgnome/clamwin | py/ExplorerShell.py | Python | gpl-2.0 | 6,829 |
#!/usr/bin/python
# -*- coding: utf-8 -*-
#
# Ansible module to manage PaloAltoNetworks Firewall
# (c) 2016, techbizdev <techbizdev@paloaltonetworks.com>
#
# This file is part of Ansible
#
# Ansible is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as publish... | e-gob/plataforma-kioscos-autoatencion | scripts/ansible-play/.venv/lib/python2.7/site-packages/ansible/modules/network/panos/panos_object.py | Python | bsd-3-clause | 16,678 |
"""Module containing class `ImportArchiveDataCommand`."""
from vesper.command.command import Command, CommandSyntaxError
from vesper.singleton.extension_manager import extension_manager
import vesper.command.command_utils as command_utils
class ImportCommand(Command):
extension_name = 'import'
... | HaroldMills/Vesper | vesper/command/import_command.py | Python | mit | 1,160 |
from PdLANParty import PdLANParty
| ruohoruotsi/pure-data-workbench | RjDj Scene Composer Pack/RJC-1000.app/Contents/Resources/PdLANParty/__init__.py | Python | mit | 34 |
import json
from .problem import Problem
class BinJSONEncoder(json.JSONEncoder):
def default(self, o):
return o.to_json()
class Bin:
def __init__(self, node, capacity):
self.node = node
self.capacity = capacity.copy()
self.remaining_capacity = capacity.copy()
self.dime... | Soulou/msc-thesis-container-balancer-controller | balance/bin.py | Python | mit | 1,894 |
# -*- coding: utf-8 -*-
# Copyright (C) 2005 Osmo Salomaa
#
# 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 pr... | otsaloma/gaupol | aeidon/agents/test/test_set.py | Python | gpl-3.0 | 2,672 |
from __future__ import absolute_import
from markdown import Markdown
from skylines.lib.markdown.urlize import UrlizeExtension
__all__ = ['markdown']
urlize = UrlizeExtension()
markdown = Markdown(extensions=['nl2br', urlize], safe_mode='escape')
| dkm/skylines | skylines/lib/markdown/__init__.py | Python | agpl-3.0 | 248 |
# -*- coding: utf-'8' "-*-"
from hashlib import sha1
import logging
import urllib
import urlparse
from openerp.addons.payment.models.payment_acquirer import ValidationError
from openerp.addons.payment_buckaroo.controllers.main import BuckarooController
from openerp.osv import osv, fields
from openerp.tools.float_utils... | ncliam/serverpos | openerp/addons/payment_buckaroo/models/buckaroo.py | Python | agpl-3.0 | 9,117 |
#!/usr/bin/env python
'''
OWASP ZSC
https://www.owasp.org/index.php/OWASP_ZSC_Tool_Project
https://github.com/zscproject/OWASP-ZSC
http://api.z3r0d4y.com/
https://groups.google.com/d/forum/owasp-zsc [ owasp-zsc[at]googlegroups[dot]com ]
'''
import binascii
import random
import string
from core.compatible import version... | zscproject/OWASP-ZSC | lib/encoder/ruby/simple_hex.py | Python | gpl-3.0 | 2,161 |
"""
@author: thom
"""
import logging
import time
from rdkit.Chem import AllChem as Chem
import networkx as nx
class Molecule(Chem.Mol):
"""A base representation of a Molecule with potential and kinetic energy.
* Potential energy is the energy required to form all bonds in the Molecule (therefore always ne... | th0mmeke/toyworld | molecule.py | Python | gpl-3.0 | 8,478 |
import socket
class UDP:
def __init__(self, bind=("127.0.0.1", 4444)):
self.sock = socket.socket(socket.AF_INET, socket.SOCK_DGRAM)
self.sock.bind(bind)
def send_test_message(self, msg=b"test message", destination=("127.0.0.1", 3333)):
self.sock.sendto(msg, destination)
if __name__ ... | rCorvidae/OrionPI | src/tests/IO/TestSendTestMessage.py | Python | mit | 836 |
# -*- coding: utf-8 -*-
from autograd import numpy as np
from lifelines.fitters import ParametricRegressionFitter
from lifelines.fitters.mixins import SplineFitterMixin
from lifelines.utils.safe_exp import safe_exp
class CRCSplineFitter(SplineFitterMixin, ParametricRegressionFitter):
"""
Below is an implemen... | CamDavidsonPilon/lifelines | lifelines/fitters/crc_spline_fitter.py | Python | mit | 2,772 |
# Copyright (c) 2012-2014 Stephanie T. Douglas
# under the MIT License (see LICENSE.txt for full details)
import numpy as np
import cPickle
import triangle
import matplotlib.pyplot as plt
from fit_rossby import *
import get_data
# Set up 3 arrays:
# rossby number, L_{X}/L_{bol}, and the associated uncertainty
#data_... | stephtdouglas/fit-rossby | example_script.py | Python | mit | 2,621 |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
"""
This script installs and configures a Hadoop-YARN cluster using Ansible.
@author: e-science Dev-team
"""
import os
import json
from os.path import dirname, abspath, isfile
import logging
import subprocess
from backend.models import ClusterInfo, UserInfo, OrkaImage, Or... | KPetsas/e-science | webapp/backend/run_ansible_playbooks.py | Python | agpl-3.0 | 13,851 |
"""
Tests for the plugin API
"""
from __future__ import absolute_import
from django.test import TestCase
from openedx.core.lib.plugins import PluginError
from openedx.core.lib.course_tabs import CourseTabPluginManager
class TestCourseTabApi(TestCase):
"""
Unit tests for the course tab plugin API
"""
... | ESOedX/edx-platform | openedx/core/lib/tests/test_course_tab_api.py | Python | agpl-3.0 | 653 |
import array
import unittest
from test.support import import_module, get_attribute
import os, struct
fcntl = import_module('fcntl')
termios = import_module('termios')
get_attribute(termios, 'TIOCGPGRP') #Can't run tests without this feature
try:
tty = open("/dev/tty", "rb")
except OSError:
raise unittest.SkipT... | Microvellum/Fluid-Designer | win64-vc/2.78/python/lib/test/test_ioctl.py | Python | gpl-3.0 | 3,271 |
# Copyright 2011-2015 Splunk, 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 wri... | jruaux/mongodb-monitoring | src/splunklib/binding.py | Python | apache-2.0 | 54,534 |
#!/usr/bin/env python
"""Import topic distributions and minute-by-minute topic coverage to SQL.
Usage: ./import_topics.py
"""
import ConfigParser
import csv
import os
from sqlalchemy import *
import sys
config = ConfigParser.RawConfigParser()
filedir = os.path.dirname(__file__)
config.read(os.path.join(filedir, '../... | kevinwang/moca | topic_data/import_topics.py | Python | mit | 5,387 |
from core.himesis import Himesis
import uuid
class HcopersonsSolveRefCountryFamilyChildCommunityMan(Himesis):
def __init__(self):
"""
Creates the himesis graph representing the DSLTrans rule copersonsSolveRefCountryFamilyChildCommunityMan.
"""
# Flag this instance as comp... | levilucio/SyVOLT | ExFamToPerson/transformation/HcopersonsSolveRefCountryFamilyChildCommunityMan.py | Python | mit | 4,965 |
import os
from parameterized import param, parameterized
from rsmtool.test_utils import check_run_cross_validation
# allow test directory to be set via an environment variable
# which is needed for package testing
TEST_DIR = os.environ.get('TESTDIR', None)
if TEST_DIR:
rsmtool_test_dir = TEST_DIR
else:
from r... | EducationalTestingService/rsmtool | tests/test_experiment_rsmxval.py | Python | apache-2.0 | 1,357 |
# coding: utf-8
"""
DragonPy - Dragon 32 emulator in Python
=======================================
:created: 2013 by Jens Diemer - www.jensdiemer.de
:copyleft: 2013-2015 by the DragonPy team, see AUTHORS for more details.
:license: GNU GPL v3 or above, see LICENSE for more details.
"""
from __fu... | JuhaniImberg/DragonPy | dragonpy/sbc09/config.py | Python | gpl-3.0 | 1,744 |
import numpy as np
import os
from osgeo import gdal
from osgeo.gdalconst import *
import sys
from itertools import product
from datetime import datetime as dt
from scipy import optimize
def generate_thresholds(start, step, numberofsteps, lengthofelement):
end = numberofsteps * step + start
thresholdvals = ran... | jkeifer/pyHytemporal | old_TO_MIGRATE/accuracy_assessment_minimized.py | Python | mit | 9,021 |
import traceback
from _pydev_bundle.pydev_is_thread_alive import is_thread_alive
from _pydev_imps._pydev_saved_modules import threading
from _pydevd_bundle.pydevd_constants import get_current_thread_id, IS_IRONPYTHON, NO_FTRACE, IS_WINDOWS
from _pydevd_bundle.pydevd_dont_trace_files import DONT_TRACE
from _pydevd_bund... | jwren/intellij-community | python/helpers/pydev/_pydevd_bundle/pydevd_trace_dispatch_regular.py | Python | apache-2.0 | 23,323 |
# -*- coding: utf-8 -*-
# Import python libs
from __future__ import absolute_import
import warnings
# Import third party libs
import yaml
from yaml.nodes import MappingNode
from yaml.constructor import ConstructorError
try:
yaml.Loader = yaml.CLoader
yaml.Dumper = yaml.CDumper
except Exception:
pass
# Thi... | smallyear/linuxLearn | salt/salt/utils/yamlloader.py | Python | apache-2.0 | 3,478 |
from __future__ import absolute_import, print_function
import os
import sys
import re
from . import catalog
from . import build_tools
from . import converters
from . import base_spec
class ext_function_from_specs(object):
def __init__(self,name,code_block,arg_specs):
self.name = name
self.arg_sp... | GbalsaC/bitnamiP | venv/lib/python2.7/site-packages/scipy/weave/ext_tools.py | Python | agpl-3.0 | 17,815 |
#!/usr/bin/env python
# -*- coding: iso-8859-1 -*-
#Copyright (C) DJ dj@namurlug.org http://blog.dedj.be
#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... | deuxpi/pytrainer | extensions/dotclear/main.py | Python | gpl-2.0 | 5,025 |
data = (
'Yi ', # 0x00
'Jun ', # 0x01
'Nong ', # 0x02
'Chan ', # 0x03
'Yi ', # 0x04
'Dang ', # 0x05
'Jing ', # 0x06
'Xuan ', # 0x07
'Kuai ', # 0x08
'Jian ', # 0x09
'Chu ', # 0x0a
'Dan ', # 0x0b
'Jiao ', # 0x0c
'Sha ', # 0x0d
'Zai ', # 0x0e
'[?] ', # 0x0f
'Bin ', # 0x10... | samuelmaudo/yepes | yepes/utils/unidecode/x051.py | Python | bsd-3-clause | 4,685 |
"""Tests for Met.no config flow."""
from datetime import timedelta
from unittest.mock import patch
import pytest
from transmissionrpc.error import TransmissionError
from homeassistant import data_entry_flow
from homeassistant.components.transmission import config_flow
from homeassistant.components.transmission.const ... | Cinntax/home-assistant | tests/components/transmission/test_config_flow.py | Python | apache-2.0 | 7,297 |
def application(environ, start_response):
start_response('200 OK', [('Content-Type', 'text/html')])
#return '<h1>Hello, NCIC,ICT,CAS!</h1>'
return '<h1> %s!</h1>' % (environ['PATH_INFO'][1:] or 'NCIC,ICT,CAS')
| haohaibo/tutorial | python/web-dev/hello.py | Python | mit | 222 |
# -*- coding: utf-8 -*-
"""nodoctest
Configure and Start a Notebook Server
The :class:`NotebookObject` is used to configure and launch a Sage
Notebook server.
"""
#############################################################################
# Copyright (C) 2007 William Stein <wstein@gmail.com>
# ... | migeruhito/sagenb | sagenb/notebook/notebook_object.py | Python | gpl-3.0 | 14,029 |
import ast
import json
import os
import re
import time
import urllib2
import environment
import framework
import utils
def cases_iterator(cases):
for case in cases:
if isinstance(case, MultiCase):
for c in case:
yield c
else:
yield case
class Log(object):
def __init__(self, line):
... | xgwubin/vitess | test/queryservice_tests/cases_framework.py | Python | bsd-3-clause | 7,742 |
from django import forms
class UploadFileForm(forms.Form):
title = forms.CharField(max_length=50)
file=forms.FileField()
| rangwala/dmgrader | gradingwebapp/gmugrader/polls/forms.py | Python | gpl-2.0 | 130 |
from django.db import models
# Create your models here.
class Project(models.Model):
name = models.CharField(max_length=100)
def __str__(self):
return self.name
| chbrun/behavui | behavui/projects/models.py | Python | gpl-2.0 | 180 |
def <weak_warning descr="Type hinting is missing for function definition">foo</weak_warning>(x, y):
pass | paplorinc/intellij-community | python/testData/inspections/PyMissingTypeHintsInspection/noAnnotations.py | Python | apache-2.0 | 108 |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
"""
.. codeauthor:: Cédric Dumay <cedric.dumay@gmail.com>
"""
import uuid
from flask.signals import Namespace
from flask.blueprints import Blueprint
from kazoo.client import KazooClient
from kazoo.security import make_digest_acl
try:
# noinspection PyProtectedMembe... | cdumay/flask-zookeeper | src/flask_zookeeper.py | Python | apache-2.0 | 4,510 |
############################################
# Copyright (c) 2012 Microsoft Corporation
#
# Extract enumeration types from z3_api.h
#
# Author: Leonardo de Moura (leonardo)
############################################
import re
import os
blank_pat = re.compile("^ *$")
comment_pat = re.compile("^ *//.*$")
typ... | rychipman/858-labs | symex/z3py/mk_z3consts.py | Python | mit | 2,073 |
import random
print(random.sample(range(1,1000),200))
| DavidFHCh/MiRecocidoRecalentadoSimulado | resources/rand.py | Python | gpl-3.0 | 56 |
# 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... | nathanbjenx/cairis | cairis/core/DataFlow.py | Python | apache-2.0 | 1,448 |
# -*- coding: utf-8 -*-
# Part of Odoo. See LICENSE file for full copyright and licensing details.
from odoo import api, fields, models
class IrModel(models.Model):
_inherit = 'ir.model'
is_mail_thread_sms = fields.Boolean(
string="Mail Thread SMS", default=False,
store=False, compute='_comp... | ddico/odoo | addons/sms/models/ir_model.py | Python | agpl-3.0 | 1,684 |
#!/usr/bin/env python2.7
# -*- coding: UTF-8 -*-
# © Copyright 2013 axujen, <axujen at gmail.com>. All Rights Reserved.
# 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 Li... | axujen/gentoo-bot | src/gentoobot/config.py | Python | gpl-3.0 | 4,620 |
from django.conf.urls import url
from . import views
urlpatterns = [
url(r'^ingredients/$', views.get_all_ingredients, name='detail'),
url(r'^ingredients/(?P<question_id>[A-Za-z0-9]+)/$', views.get_price_by_name, name='detail'),
] | DaBbleR23/Pizza-web | pizzaweb_backend/pizzaweb/backend/urls.py | Python | mit | 240 |
# 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... | hfp/tensorflow-xsmm | tensorflow/python/ops/embedding_ops.py | Python | apache-2.0 | 33,826 |
"""
format(No nest):
- + * [](link "title2")
[](link "title2")
* [](link "title2")
[](link "title2")
+ * [](link "title2")
[![img6... | TylerTemp/amazedown | amazedown/list_avg_gallery.py | Python | gpl-3.0 | 10,841 |
import collections.abc
class Perception(collections.abc.Sequence):
"""
Represents current state of the environment at given time instance.
By default each environment attribute is represented as `str` type.
"""
__slots__ = ['_items', 'oktypes']
def __init__(self, observation, oktypes=(str,))... | ParrotPrediction/pyalcs | lcs/Perception.py | Python | mit | 838 |
import os
import re
from datetime import datetime
from config import config
from inputoutput.readers import csv_read, CSVInputReader
from inputoutput.writers import CSVWriter
from preprocessing.article_preprocessor import ArticlePreprocessor
from preprocessing.tweet_preprocessor import TweetPreprocessor
def tweet_to... | den1den/web-inf-ret-ml | preprocessing/date_sorter.py | Python | mit | 2,911 |
from django.utils import six
from collections import OrderedDict
from django.core.urlresolvers import reverse
from django.core.paginator import InvalidPage, Paginator as DjangoPaginator
from rest_framework import pagination
from rest_framework.exceptions import NotFound
from rest_framework.response import Response
fro... | brandonPurvis/osf.io | api/base/pagination.py | Python | apache-2.0 | 4,312 |
"""
$url play.mrt.com.mk
$type live, vod
$region North Macedonia
"""
import logging
import re
from streamlink.plugin import Plugin, pluginmatcher
from streamlink.plugin.api import validate
from streamlink.stream.hls import HLSStream
log = logging.getLogger(__name__)
@pluginmatcher(re.compile(
r"https?://play\.... | streamlink/streamlink | src/streamlink/plugins/mrtmk.py | Python | bsd-2-clause | 1,423 |
# -*- coding: utf-8 -*-
import os, sys; sys.path.insert(0, os.path.join(os.path.dirname(__file__), ".."))
import unittest
import subprocess
from pattern import de
try:
PATH = os.path.dirname(os.path.realpath(__file__))
except:
PATH = ""
#-----------------------------------------------------------------------... | krishna11888/ai | third_party/pattern/test/test_de.py | Python | gpl-2.0 | 10,848 |
"""
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 use this ... | alexryndin/ambari | ambari-server/src/main/resources/stacks/ADH/1.0/services/HDFS/package/scripts/datanode.py | Python | apache-2.0 | 5,933 |
# -*- coding: utf-8 -*-
import itertools
def diagonal(card):
""" If the password from the card is read diagonally """
diagonals = []
for i in range(card.rows * -1, card.columns):
diagonals.append(card.m.diagonal(offset=i).tolist()[0])
results = list(itertools.chain.from_iterable(diagonals))
... | gszathmari/munchkin | munchkin/core/strategies/diagonal.py | Python | mit | 337 |
#-----------------------------------------------------------------------------
# Copyright (c) 2012 - 2020, Anaconda, Inc., and Bokeh Contributors.
# All rights reserved.
#
# The full license is in the file LICENSE.txt, distributed with this software.
#-------------------------------------------------------------------... | ericmjl/bokeh | tests/unit/bokeh/command/subcommands/_util_subcommands.py | Python | bsd-3-clause | 1,803 |
"""
Automated phase correction
These functions provide support for automatic phasing of NMR data. They
consist of the core `autops` function which performs the optimisation and
a set of private functions for calculating a spectral phase quality score
for a provided spectrum.
"""
from __future__ import print_function
... | atomman/nmrglue | nmrglue/process/proc_autophase.py | Python | bsd-3-clause | 5,411 |
from flask import Flask
from mako.lookup import TemplateLookup
import pkg_resources
import os
module_path = os.path.join(pkg_resources.get_distribution('petersen').location, 'petersen')
app = Flask("petersen.app")
app.config['db_url'] = 'sqlite:///dev.db'
app.secret_key = 'TRMISAVATARAANGCONFIRMED' # TODO Move to en... | TRManderson/petersen | petersen/app/base.py | Python | mit | 802 |
# encoding: 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 'Skill.page'
db.add_column('dnd_skill', 'page', self.gf('django.db.models.fields.PositiveSm... | gregpechiro/dndtools | dndtools/dnd/migrations/0005_auto__add_field_skill_page.py | Python | mit | 14,283 |
import logging
import os
import sys
import time
from typing import TYPE_CHECKING, Optional
from packaging import version
from dvc import __version__
from dvc.utils.pkg import PKG
if TYPE_CHECKING:
from dvc.ui import RichText
logger = logging.getLogger(__name__)
class Updater:
URL = "https://updater.dvc.or... | dmpetrov/dataversioncontrol | dvc/updater.py | Python | apache-2.0 | 5,458 |
# -*- coding: utf-8 -*-
# Generated by Django 1.9.4 on 2016-09-26 12:37
from __future__ import unicode_literals
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('main', '0025_auto_20160628_0913'),
]
operations = [
migrations.AlterField(
... | editorsnotes/editorsnotes | editorsnotes/main/migrations/0026_auto_20160926_1237.py | Python | agpl-3.0 | 531 |
'''
This file is part of ConfigShell.
Copyright (c) 2011-2013 by Datera, 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 appli... | agrover/configshell-fb | configshell/console.py | Python | apache-2.0 | 10,940 |
from baseparser import BaseParser, grab_url, logger
# Different versions of BeautifulSoup have different properties.
# Some work with one site, some with another.
# This is BeautifulSoup 3.2.
from BeautifulSoup import BeautifulSoup
# This is BeautifulSoup 4
import bs4
import re
class PoliticoParser(BaseParser):
d... | amandabee/newsdiffs | parsers/politico.py | Python | mit | 1,613 |
#!/usr/bin/env python
#
# Copyright (c) 2015, 2016, 2017 Tim Savannah under following terms:
# You may modify and redistribe this script with your project
#
# It will download the latest GoodTests.py and use it to execute the tests.
#
# This should be placed in a directory, "tests", at the root of your project. It ... | kata198/QueryableList | tests/runTests.py | Python | lgpl-2.1 | 12,771 |
## @file
# This file is used to define class Configuration
#
# Copyright (c) 2008 - 2014, Intel Corporation. All rights reserved.<BR>
# This program and the accompanying materials
# are licensed and made available under the terms and conditions of the BSD License
# which accompanies this distribution. The full text of... | miguelinux/vbox | src/VBox/Devices/EFI/Firmware/BaseTools/Source/Python/Ecc/Configuration.py | Python | gpl-2.0 | 14,351 |
# Copyright 2012 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 agre... | eayunstack/neutron | neutron/plugins/ml2/drivers/openvswitch/agent/common/config.py | Python | apache-2.0 | 823 |
"""Constants used in tf_cnn_benchmarks."""
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
from enum import Enum
# Results fetched with this prefix will not be reduced. Instead, they will be
# passed as matrices to model's postprocess function.
UNREDUCED_A... | mlperf/training_results_v0.5 | v0.5.0/google/cloud_v100x8/code/resnet/benchmarks/scripts/tf_cnn_benchmarks/constants.py | Python | apache-2.0 | 1,519 |
import sys
from . import main
if __name__ == '__main__':
sys.exit(main())
| davidfoerster/schema-matching | src/schema_matching/__main__.py | Python | mit | 76 |
""" Binance exchange subclass """
import logging
from typing import Dict, List, Tuple
import arrow
import ccxt
from freqtrade.exceptions import (DDosProtection, InsufficientFundsError, InvalidOrderException,
OperationalException, TemporaryError)
from freqtrade.exchange import Exchang... | flightcom/freqtrade | freqtrade/exchange/binance.py | Python | gpl-3.0 | 4,834 |
#!/usr/bin/env python
from optparse import OptionParser
import re
degenerate = {'R':'AG', 'Y':'CT', 'S':'GC', 'W':'AT', 'K':'GT',
'M':'AC', 'B':'CGT', 'D':'AGT', 'H':'ACT', 'V':'ACG',
'N':'ACGT'}
alt_map = {'ins':'0'}
complement = {'A':'T', 'C':'G', 'G':'C', 'T':'A', 'Y':'R', 'R':'Y',
'S':'S', 'W':'W', 'K':'M',... | sjspence/epicBarcoder | epicBarcoder/reads.py | Python | mit | 6,018 |
import datetime
import time
import enum
from collections import OrderedDict
# For backward compatibility import FileLock
from pytos.securechange.xml_objects.restapi.step.rule_decommission.rule_decommission import Step_Field_Rule_Decommission
from pytos.securechange.xml_objects.restapi.step.server_decommission.server_d... | Tufin/pytos | pytos/securechange/xml_objects/rest.py | Python | apache-2.0 | 87,654 |
import os
import xml.etree.ElementTree as ET
import json
import argparse
from PIL import Image
def sprite_data(attrib):
return {
"frame": {
"x": int(attrib['x']),
"y": int(attrib['y']),
"w": int(attrib['width']),
"h": int(attrib['height'])
},
... | ChainedLupine/ludum-dare-24-jam-entry | web/gown.js/themes/xml_to_json.py | Python | gpl-2.0 | 1,708 |
"""
Copyright 2017 Oliver Smith
This file is part of pmbootstrap.
pmbootstrap 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.
pmbootstrap ... | lawl/pmbootstrap | test/test_bootimg.py | Python | gpl-3.0 | 2,767 |
import unittest
class Tester(unittest.TestCase):
def test_list_comprehension(self):
a = [(x, y)
for x in [1, 2, 3]
for y in [3, 1, 4]
if x != y]
b = []
for x in [1, 2, 3]:
for y in [3, 1, 4]:
if x != y:
... | mr-uuid/snippets | python/comprehension.py | Python | mit | 1,057 |
import os
import subprocess
import sys
from queue import Queue
sys.path.insert(0, ".")
import unittest
from bears.tests.LocalBearTestHelper import LocalBearTestHelper
from bears.natural_language.AlexBear import AlexBear
from coalib.settings.Section import Section
class AlexBearTest(LocalBearTestHelper):
def setU... | Tanmay28/coala | bears/tests/natural_language/AlexBearTest.py | Python | agpl-3.0 | 1,313 |
# -*- coding: utf-8 -*-
import os
import base64
from random import choice
def random_file_from_dir(relative_path):
random_file = choice(os.listdir(os.path.join(os.getcwd(), relative_path)))
return abs_path_to_file(os.path.join(relative_path, random_file))
def abs_path_to_file(relative_path):
# print os.g... | alazanman/py_epg_tests | utils/file_util.py | Python | apache-2.0 | 535 |
from ert.enkf.enums.realization_state_enum import RealizationStateEnum
from ert.test import ErtTestContext, ExtendedTestCase
from ert.util import BoolVector
class LoadResultsManuallyTest(ExtendedTestCase):
def setUp(self):
self.config_file = self.createTestPath("Statoil/config/with_data/config")
def ... | arielalmendral/ert | python/tests/ert/enkf/test_enkf_load_results_manually.py | Python | gpl-3.0 | 1,338 |
## Allow this directory to function as a module within which we can import
## individual modules.
pass
| curiouserrandy/Python-Utils | __init__.py | Python | gpl-2.0 | 103 |
#
# This file is part of Mapnik (C++/Python mapping toolkit)
# Copyright (C) 2009 Artem Pavlenko
#
# Mapnik 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 any later versi... | qianwenming/mapnik | bindings/python/mapnik/__init__.py | Python | lgpl-2.1 | 35,583 |
import mongoengine as db
class User(db.Document):
user_id = db.StringField(required=True, unique=True)
created = db.DateTimeField(required=True)
last_login = db.DateTimeField()
nino = db.StringField()
linked_ids = db.ListField(db.ReferenceField('User'), default=[])
def link(self, other):
... | crossgovernmentservices/userstore-prototype | application/models.py | Python | mit | 404 |
import xml.etree.ElementTree as ElementTree
import sys, getopt, os.path, time, urlparse, urllib, datetime, re
# Check that a file argument was supplied
if len(sys.argv) < 2:
print 'No input file specified'
sys.exit(2)
filename = sys.argv[1]
# Check that the file exists
if not os.path.isfile(filename):
print 'I... | bartram/crosseyed | crosseyed.py | Python | gpl-2.0 | 2,229 |
from django.contrib.syndication.feeds import Feed
from django.utils import feedgenerator
from models import Event
class KcalEventsFeed(Feed):
title = "One Huge Lesson in Humility, by Myself (Events)"
link = "http://www.ohlih.com"
subtitle = "Making the navel harder to gaze upon."
author_name = "Paul Fo... | ftrain/django-ftrain | kcal/feeds.py | Python | bsd-3-clause | 1,694 |
from django.views.generic import DetailView
from eventex.subscriptions.forms import SubscriptionForm
from eventex.subscriptions.mixins import EmailCreateView
from eventex.subscriptions.models import Subscription
new = EmailCreateView.as_view(model=Subscription, form_class=SubscriptionForm,
... | rtancman/eventex | eventex/subscriptions/views.py | Python | gpl-2.0 | 461 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.