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 |
|---|---|---|---|---|---|
#!/usr/bin/python
# -*- coding: utf-8 -*-
#
# Authors : Roberto Majadas <roberto.majadas@openshine.com>
# Cesar Garcia Tapia <tapia@openshine.com>
#
# Copyright (c) 2003-2012, Telefonica Móviles España S.A.U.
#
# This library is free software; you can redistribute it and/or
# modify it under the terms of the ... | tgcmteam/tgcmlinux | src/tgcm/core/HotSpotsService.py | Python | gpl-2.0 | 13,115 |
# -*- coding: UTF-8 -*-
# ..#######.########.#######.##....#..######..######.########....###...########.#######.########..######.
# .##.....#.##.....#.##......###...#.##....#.##....#.##.....#...##.##..##.....#.##......##.....#.##....##
# .##.....#.##.....#.##......####..#.##......##......##.....#..##...##.##.....#.... | repotvsupertuga/tvsupertuga.repository | script.module.openscrapers/lib/openscrapers/sources_openscrapers/de/movie2z.py | Python | gpl-2.0 | 5,033 |
# Copyright [2015] Hewlett-Packard Development Company, L.P.
# 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... | fabian4/trove | trove/extensions/common/models.py | Python | apache-2.0 | 3,639 |
#!/usr/bin/python
#------------------------------------------------------------------------------
# DP Solution
#------------------------------------------------------------------------------
class Solution:
def isMatch(self, s, p):
"""
:type s: str
:type p: str
:rtype: bool
... | kyle8998/Practice-Coding-Questions | leetcode/10-Hard-Regular-Expression-Matching/answer.py | Python | unlicense | 2,948 |
#!/usr/bin/env python
# Copyright 2014 Hewlett-Packard Development Company, L.P.
#
# 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 ... | jmvrbanac/barbican | bin/barbican-keystone-listener.py | Python | apache-2.0 | 2,403 |
# Definition for a point.
# class Point:
# def __init__(self, a=0, b=0):
# self.x = a
# self.y = b
class Solution:
def gcd(self,x,y):
if y==0 :
return x
else:
return self.gcd(y, x%y)
def helper(self,a,b):
if a.x-b.x==0:
retur... | Hehwang/Leetcode-Python | code/149 Max Points on a Line.py | Python | mit | 2,490 |
a = u'LNsdsdsdfSA'
if a[0:2].lower() == u'ln':
print 'dfdfdf'
fn = open(u'1.txt')
num = 0
ln = 0
lx = 0
lm = 0
for line in fn.readlines():
if line[0:2].lower() == u'ln':
ln = ln + 1
if line[0:2].lower() == u'lx':
lx = lx + 1
if line[0:2].lower() == u'lm':
lm = lm + 1
print line[0:2].lower()
... | softtyphoon/tz | tools/read_file.py | Python | gpl-2.0 | 432 |
import tinctest
from mpp.models import SQLTestCase
class SampleSQLMockTest(SQLTestCase):
"""
@gpdiff No
"""
sql_dir = 'sql/'
pass
| cjcjameson/gpdb | src/test/tinc/tincmmgr/test/e2e/sample/sample_tincmm_sql_tests.py | Python | apache-2.0 | 152 |
# Copyright (c) 2010-2014 openpyxl
#
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the "Software"), to deal
# in the Software without restriction, including without limitation the rights
# to use, copy, modify, merge, publish, distr... | quisas/albus | cli_tools/openpyxl/tests/test_dump.py | Python | agpl-3.0 | 4,837 |
# Copyright (C) 2010-2014 CEA/DEN, EDF R&D
#
# 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 (at your option) any later version.
#
# This library ... | FedoraScientific/salome-paravis | test/VisuPrs/DeformedShape/A7.py | Python | lgpl-2.1 | 1,519 |
# Copyright 2019 Tecnativa - Pedro M. Baeza
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html).
from odoo import exceptions
from odoo.tests import common
class TestStockLockLot(common.SavepointCase):
@classmethod
def setUpClass(cls):
super().setUpClass()
cls.category = cls.en... | OCA/stock-logistics-workflow | stock_lock_lot/tests/test_stock_lock_lot.py | Python | agpl-3.0 | 1,639 |
from useintest.modules.irods.executables import IrodsBaseExecutablesController, Irods4_1_10ExecutablesController, \
IrodsExecutablesController, irods_executables_controllers_and_versions, irods_executables_controllers
from useintest.modules.irods.helpers import AccessLevel, IrodsSetupHelper
from useintest.modules.i... | wtsi-hgi/startfortest | useintest/modules/irods/__init__.py | Python | mit | 631 |
import sys
from views import *
from config import config
# Load default config and override config from an environment variable
if config.LOCAL:
app.config.from_pyfile('../local.cfg')
else:
app.config.from_pyfile('../phenopolis.cfg')
if __name__ == "__main__":
# use ssl
# add some common url. Would b... | Withington/phenopolis | runserver.py | Python | mit | 1,238 |
# 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... | petewarden/tensorflow | tensorflow/python/training/saving/functional_saver.py | Python | apache-2.0 | 13,689 |
from django import template
from django.template.defaultfilters import stringfilter
from pastebin.utils import languageformat
register = template.Library()
@register.filter
@stringfilter
def truncatechars(value, index):
result = value[:index]
if len(value) >= index:
result += '...'
return res... | DrMegahertz/codenotes | applications/pastebin/templatetags/pastebin_tags.py | Python | bsd-3-clause | 1,243 |
import json
import mimetypes
import os
from itertools import chain
from zipfile import ZipFile, BadZipfile
from django.conf import settings
from django.contrib.auth.decorators import login_required
from django.contrib.auth.mixins import LoginRequiredMixin
from django.core.exceptions import ValidationError
from django.... | Minkov/site | judge/views/problem_data.py | Python | agpl-3.0 | 8,427 |
#! /usr/bin/env python
from zplot import *
# populate zplot table from data file
t = table('verticalbars.data')
# create the postscript file we'll use as our canvas
canvas = postscript('verticalbars.eps')
# on the x-axis, we want categories, not numbers. Thus, we
# determine the number of categories by checking th... | z-plot/z-plot | examples/basics/verticalbars.py | Python | bsd-3-clause | 2,348 |
# Copyright (C) 2009-2016 CS-SI. All Rights Reserved.
# Author: Yoann Vandoorselaere <yoann.v@prelude-ids.com>
# Author: Wes Young <wes@barely3am.com>
#
# This file is part of the Prelude-Correlator program.
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General... | agil3b3ast/CNITCorrelator | rules/SpamhausDropPlugin.py | Python | gpl-2.0 | 3,842 |
'''
not sure if bug ... or brillant
'''
from AI import AI
@AI.Team
class Ditto(AI):
def __init__(self):
try:
self.other = [team for team in AI.team if team != self.__class__][0]()
except:
self.other = None
def Update(self, ai_input):
if self.other:
... | jedislight/Shockball | Team/Ditto.py | Python | mit | 585 |
import logging
from django.utils import six
from django import template
from django.conf import settings
from ella.photos.models import Photo, Format, FormatedPhoto
from ella.core.cache.utils import get_cached_object
log = logging.getLogger('ella.photos')
register = template.Library()
class ImageTag(template.Node)... | MichalMaM/ella | ella/photos/templatetags/photos.py | Python | bsd-3-clause | 5,630 |
from rest_framework import serializers
from .models import Fund,FundNet,FundRealTimeNet
class FundSerializer(serializers.ModelSerializer):
class Meta:
model = Fund
fields = ('id', 'fund_code', 'fund_name','created_at','updated_at')
class FundNetSerializer(serializers.ModelSerializer):
class ... | ashione/bamslips | bamslipsrest/bamfund/serializers.py | Python | gpl-3.0 | 682 |
import pyintersim.corelib as corelib
import ctypes
### Load Library
_core = corelib.LoadCoreLibrary()
### State wrapper class to be used in 'with' statement
class State:
"""Wrapper Class for the State"""
def __init__(self):
self.p_state = setup()
def __enter__(self):
return self.p_state
... | GPMueller/intersim | core/pyintersim/state.py | Python | mit | 743 |
#!/usr/bin/python3
#
# Copyright: Conor O'Callghan 2016
# Version: v1.1.3
#
# Please feel free to fork this project, modify the code and improve
# it on the github repo https://github.com/brioscaibriste/iarnrod
#
# Powered by TfL Open Data
# This program is free software: you can redistribute it and/or modi... | brioscaibriste/iarnrod | coire.py | Python | gpl-3.0 | 6,003 |
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.db import models, migrations
import datetime
class Migration(migrations.Migration):
dependencies = [
('rules', '0029_auto_20150102_1212'),
]
operations = [
migrations.AlterField(
model_name='category... | CyberTaoFlow/scirius | rules/migrations/0030_auto_20150103_1136.py | Python | gpl-3.0 | 1,122 |
#!/usr/bin/env python
import yaml
import argparse
import subprocess
import os
import signal
import time
import pwd
import jinja2
import codecs
import sys
__author__ = "Anoop P Alias"
__copyright__ = "Copyright Anoop P Alias"
__license__ = "GPL"
__email__ = "anoopalias01@gmail.com"
installation_path = "/opt/nDeplo... | AnoopAlias/XtendWeb | scripts/init_backends.py | Python | gpl-3.0 | 8,703 |
# 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
# distribu... | jarrodmcc/OpenFermion | src/openfermion/transforms/_conversion_test.py | Python | apache-2.0 | 19,956 |
import logging
log = logging.getLogger('zen.CloudFoundryLoader')
from zope.interface import implements
from Products.Zuul import getFacade
from Products.ZenModel.interfaces import IDeviceLoader
class CloudFoundryLoader(object):
"""
Loader for the CloudFoundry ZenPack.
"""
implements(IDeviceLoader)
... | zenoss/ZenPacks.zenoss.CloudFoundry | ZenPacks/zenoss/CloudFoundry/deviceloaders.py | Python | gpl-2.0 | 495 |
# -*- coding: utf-8 -*-
"""
A library of useful functions used throughout the *fyrd* package.
These include functions to handle data, format outputs, handle file opening,
run commands, check file extensions, get user input, and search and format
imports.
These functions are not intended to be accessed directly.
"""
f... | MikeDacre/slurmy | fyrd/run.py | Python | mit | 26,828 |
# Status: ported, except for tests.
# Base revision: 64070
#
# Copyright 2001, 2002, 2003 Dave Abrahams
# Copyright 2006 Rene Rivera
# Copyright 2002, 2003, 2004, 2005, 2006 Vladimir Prus
# Distributed under the Boost Software License, Version 1.0.
# (See accompanying file LICENSE_1_0.txt or http://www.boost.org/LICENS... | stan-dev/math | lib/boost_1.75.0/tools/build/src/build/property.py | Python | bsd-3-clause | 23,372 |
# This file is part of Buildbot. Buildbot 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, version 2.
#
# This program is distributed in the hope that it will be useful, but WITHOUT
# ANY WARRANTY; without eve... | zozo123/buildbot | master/buildbot/test/unit/test_db_migrate_versions_017_restore_other_indices.py | Python | gpl-3.0 | 5,782 |
# encoding: utf-8
"""A dict subclass that supports attribute style access.
Authors:
* Fernando Perez (original)
* Brian Granger (refactoring to a dict subclass)
"""
#-----------------------------------------------------------------------------
# Copyright (C) 2008-2011 The IPython Development Team
#
# Distributed... | mattvonrocketstein/smash | smashlib/ipy3x/utils/ipstruct.py | Python | mit | 11,894 |
#!/usr/bin/env python
# coding=utf-8
# Author: YAO Matrix (yaoweifeng0301@126.com)
import numpy as np
def precision(predictions, labels):
"""Return the precision based on dense predictions and sparse labels."""
return (100.0 *
np.sum(np.argmax(predictions, 1) == labels) /
predictions.shape[0])
def e... | yao-matrix/mLearning | use_case/image_cnn/utils/metrics.py | Python | apache-2.0 | 534 |
from pyramid.events import subscriber
from websauna.system.crud.views import TraverseLinkButton
from pyramid.events import BeforeRender
from websauna.system.user.admins import UserAdmin
@subscriber(BeforeRender)
def contribute_admin(event):
"""Add notebook entry to the admin user interface."""
# XXX: dummy w... | enkidulan/websauna.notebook | websauna/notebook/subscribers.py | Python | mit | 894 |
from unittest import mock
from django.core.checks import Error
from django.db import connections, models
from django.test import SimpleTestCase
from django.test.utils import isolate_apps
def dummy_allow_migrate(db, app_label, **hints):
# Prevent checks from being run on the 'other' database, which doesn't have
... | atul-bhouraskar/django | tests/invalid_models_tests/test_backend_specific.py | Python | bsd-3-clause | 1,010 |
# xyz
# Copyright (C) 2014 xyz developers <admin@localhost.lh> (see AUTHORS)
#
# All rights reserved.
from django.contrib import admin
from django.utils.translation import ugettext_lazy as _
from django.db.models import Count
from . import models, forms
class ProductAdmin(admin.ModelAdmin):
exclude = ( 'progress... | 4geit-module/4i.language.python.django | tests/progressbar/output/myapp/admin.py | Python | gpl-3.0 | 1,234 |
"""Example of NaCl calculation."""
from typing import List
import numpy as np
from phonopy import Phonopy
from phonopy.file_IO import parse_BORN, parse_FORCE_SETS
from phonopy.interface.vasp import read_vasp
# from phonopy.structure.atoms import PhonopyAtoms
def _append_band(bands, q_start, q_end):
band = []
... | atztogo/phonopy | example/NaCl/NaCl.py | Python | bsd-3-clause | 4,060 |
#!/usr/bin/env python
# coding: utf-8
import sys
#
# Код работы со строками
# Название s_ выбрано исходя их краткости и того, что оно
# непохоже на имя переменной (по крайней мере для Python;
# стереотип, что в C++ так обозначают приватные имена атрибутов
# классов, очень мешал, но все равно)
#
# И да, понимаю, что э... | BradburyLab/show_tv | show_tv/s_.py | Python | gpl-3.0 | 1,964 |
# Copyright 2018 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... | jhseu/tensorflow | tensorflow/python/ops/cond_v2.py | Python | apache-2.0 | 46,155 |
"""
tests for magic_gui
"""
import wx
import unittest
import os
from programs import magic_gui
from pmagpy import contribution_builder as cb
import dialogs
from dialogs import grid_frame3 as grid_frame
#import dialogs.pmag_widgets as pmag_widgets
from pmagpy import pmag
from pmagpy import data_model3 as data_model
# ... | lfairchild/PmagPy | pmagpy_tests/test_magic_gui.py | Python | bsd-3-clause | 7,108 |
from calendar import month_name
from django.http import Http404
from django.shortcuts import get_object_or_404
from mezzanine.blog.models import BlogPost, BlogCategory
from mezzanine.blog.feeds import PostsRSS, PostsAtom
from mezzanine.conf import settings
from mezzanine.generic.models import Keyword
from mezzanine.u... | eRestin/Mezz | mezzanine/blog/views.py | Python | bsd-2-clause | 3,269 |
# -*- coding: utf-8 -*-
# Form implementation generated from reading ui file 'ui_gui.ui'
#
# Created by: PyQt5 UI code generator 5.5.1
#
# WARNING! All changes made in this file will be lost!
from PyQt5 import QtCore, QtGui, QtWidgets
class Ui_MainWindow(object):
def setupUi(self, MainWindow):
MainWindow... | mazafrav/JdeRobot | src/tools/uav_viewer_py/gui/ui_gui.py | Python | gpl-3.0 | 5,879 |
from __future__ import absolute_import, unicode_literals
from glyphsLib.builder.instances import apply_instance_data
__all__ = ["apply_instance_data"]
| googlei18n/glyphsLib | Lib/glyphsLib/interpolation.py | Python | apache-2.0 | 152 |
n = int(input())
result = set(map(int, input().split()))
operations = int(input())
for _ in range(operations):
operation = input().split()[0]
target_set = set(map(int, input().split()))
if operation == 'update':
result.update(target_set)
elif operation == 'intersection_update':
r... | avenet/hackerrank | python/sets/set_mutations.py | Python | mit | 574 |
# 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
# distributed u... | ctrlaltdel/neutrinator | vendor/stevedore/tests/test_driver.py | Python | gpl-3.0 | 3,234 |
#!/usr/bin/env python
# Capstone Python bindings, by Nguyen Anh Quynnh <aquynh@gmail.com>
from __future__ import print_function
from capstone import *
from capstone.ppc import *
from xprint import to_x, to_hex, to_x_32
PPC_CODE = b"\x43\x20\x0c\x07\x41\x56\xff\x17\x80\x20\x00\x00\x80\x3f\x00\x00\x10\x43\x23\x0e\xd0\x... | dhxkgozj/DirEngine | lib/capstone/bindings/python/test_ppc.py | Python | bsd-3-clause | 2,840 |
from library import aura as aura_module
from utils import AnsibleExitJson, AnsibleFailJson, ModuleTestCase, set_module_args
from ansible.compat.tests.mock import patch, call
# test_parted is a pretty good start.
class TestAura(ModuleTestCase):
def setUp(self):
super(TestAura, self).setUp()
self.... | AlexandreCarlton/ansible-aura | tests/test_aura.py | Python | gpl-3.0 | 3,472 |
__version__ = '0.6.3-dev'
# Package level logger
import logging
try:
# Python >= 2.7
from logging import NullHandler
except ImportError:
# Python < 2.7
class NullHandler(logging.Handler):
def emit(self, record):
pass
logger = logging.getLogger("pyoos")
logger.addHandler(logging.Null... | emiliom/pyoos | pyoos/__init__.py | Python | lgpl-3.0 | 331 |
# -*- coding: utf-8 -*-
##############################################################################
#
# Copyright (C) 2016 Compassion CH (http://www.compassion.ch)
# Releasing children from poverty in Jesus' name
# @author: Emanuel Cino <ecino@compassion.ch>
#
# The licence is in the file __manifest__.py... | ecino/compassion-switzerland | child_sync_wp/tools/__init__.py | Python | agpl-3.0 | 425 |
#
# This file is part of pysnmp software.
#
# Copyright (c) 2005-2016, Ilya Etingof <ilya@glas.net>
# License: http://pysnmp.sf.net/license.html
#
import sys
import traceback
from pysnmp.smi import error
from pysnmp import debug
__all__ = ['AbstractMibInstrumController', 'MibInstrumController']
class AbstractMibInstr... | filippog/pysnmp | pysnmp/smi/instrum.py | Python | bsd-3-clause | 9,238 |
'''
Created on Feb 20, 2017
@author: havrila
'''
import json
from pprint import pprint
from nuage.API_wrappers.nuage_vspk_interface import nuage_vspk_wrapper
def nuage_assign(args):
pprint (args)
if args.OBJECT is None:
print("nuage assign didn't recieved mandatory parameter, exiting ....")
r... | zerxen/Project_FAST | nuage/nuage_assign.py | Python | gpl-2.0 | 4,327 |
"""
The Tornado Framework
By Ali Pesaranghader
University of Ottawa, Ontario, Canada
E-mail: apesaran -at- uottawa -dot- ca / alipsgh -at- gmail -dot- com
"""
from data_structures.attribute_scheme import AttributeScheme
from classifier.__init__ import *
from drift_detection.__init__ import *
from filters.pro... | alipsgh/tornado | github_prequential_multi_test.py | Python | mit | 4,255 |
"""SCons.Scanner.LaTeX
This module implements the dependency scanner for LaTeX code.
"""
#
# Copyright (c) 2001 - 2014 The SCons Foundation
#
# Permission is hereby granted, free of charge, to any person obtaining
# a copy of this software and associated documentation files (the
# "Software"), to deal in the Softwar... | engineer0x47/SCONS | engine/SCons/Scanner/LaTeX.py | Python | mit | 16,203 |
"""Application-defined errors."""
import tornado.web
class MinigridHTTPError(tornado.web.HTTPError):
"""Base class for application HTTP errors."""
def __init__(self, reason, status_code, template_name, **template_kwargs):
"""Create an instance of this Error.
Subclasses should include a defau... | SEL-Columbia/minigrid-server | minigrid/error.py | Python | gpl-3.0 | 1,108 |
# 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 'MenuPluginSettings.template'
db.add_column('cmsplugin_menupluginsettings', 'template', sel... | airtonix/cmsplugin-embedded-menu | cmsplugin_embeddedmenu/migrations/0002_auto__add_field_menupluginsettings_template.py | Python | bsd-2-clause | 6,755 |
#!/usr/bin/env python2
import sys,os,platform
import publishfunctions
curdir = os.path.dirname(os.path.realpath(__file__))
# ------- Configuration parameters -------------
projectname='gspbox'
if platform.system()=='Darwin':
homefolder='/Users/user'
else:
homefolder='/home/user'
project=homefolder+'/'+pro... | epfl-lts2/gspbox | mat2doc/publish.py | Python | gpl-3.0 | 3,694 |
#!/usr/bin/env python3
"""
This is a minimal, speed-optimized version of a FASTQ->FASTA conversion script. It lacks a
lot of options other scripts might have, but I got tired of runtimes taking hours with
billion-read FASTQ files.
Example timing information on a 5.4GB input file (with 21.7 million records)**:
-... | zctea/biocode | fastq/convert_fastq_to_fasta.py | Python | gpl-3.0 | 4,053 |
import unittest
from itertools import islice
from dt174b import dt174b
class TestSettingPacket(unittest.TestCase):
def setUp(self):
self.def_data = {
'year': 2013,
'month': 2,
'day': 5,
'hour': 9,
'min': 5,
'se... | jaryn/dt174b | tests/test_dt174b.py | Python | gpl-3.0 | 2,865 |
class JitPyException(Exception):
pass
| fijal/jitpy | jitpy/exc.py | Python | mit | 43 |
#!/usr/bin/env python
import time
import os
from plugins import *
import CustomHandlers
# Light switch
#try:
# CapSwitch.CapSwitch(SerialEnumeration.find("capbutton1"))
#except:
# pass
try:
# Telephony services
rotdial = RotaryDial.RotaryDial(SerialEnumeration.find("rotarydial"))
# Handle telephon... | moosd/HomeAutomation | main.py | Python | gpl-2.0 | 1,574 |
# Run this with:
# python setup.py install --install-lib=.
from distutils.core import setup,Extension
import RDConfig
# force the use of g++ please
from distutils import sysconfig
save_init_posix = sysconfig._init_posix
def my_init_posix():
print 'my_init_posix: changing gcc to g++'
save_init_posix()
g = ... | rdkit/rdkit-orig | Code/Demos/boost/cross_mod_err/setup.py | Python | bsd-3-clause | 1,917 |
# coding: utf-8
import numpy as np
from ppyt import const
from ppyt.indicators import IndicatorBase
class PriceIndicator(IndicatorBase):
"""価格のindicatorです。"""
_findkey = '価格' # indicatorを一意に特定できる名前をつけます。
def _build_indicator(self, price_type=const.PRICE_TYPE_CLOSE, **kwds):
"""indicatorのデータを組み立... | yusukemurayama/ppytrading | ppyt/indicators/basic_indicators.py | Python | mit | 2,073 |
# Copyright 2016 Casey Jaymes
# This file is part of PySCAP.
#
# PySCAP 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.
#
# PySCAP is ... | cjaymes/pyscap | src/scap/model/oval_5/defs/windows/WmiTestElement.py | Python | gpl-3.0 | 884 |
from .cli import CLI
def main():
cli = CLI(None)
cli.execute()
if __name__ == '__main__':
main()
| srz-zumix/wandbox-api | wandbox/__main__.py | Python | mit | 113 |
"""Config flow for flo integration."""
from aioflo import async_get_api
from aioflo.errors import RequestError
import voluptuous as vol
from homeassistant import config_entries, core, exceptions
from homeassistant.const import CONF_PASSWORD, CONF_USERNAME
from homeassistant.helpers.aiohttp_client import async_get_clie... | tboyce021/home-assistant | homeassistant/components/flo/config_flow.py | Python | apache-2.0 | 2,110 |
import binascii
import datetime
import json
import os
from uuid import uuid4
from flask import Blueprint
from flask import flash, url_for, redirect, request, jsonify, Markup, render_template
from flask.ext.login import current_user
from flask.ext.restplus import abort
from app import db
from app.helpers.auth import A... | arpitn30/open-event-orga-server | app/views/users/events.py | Python | gpl-3.0 | 19,262 |
# ******************************************************************************
# Copyright 2017-2018 Intel Corporation
#
# 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.apa... | NervanaSystems/neon | examples/faster-rcnn/ingest_kitti.py | Python | apache-2.0 | 9,191 |
import matplotlib.pyplot as plt
import cosima_cookbook as cc
from tqdm import tqdm_notebook
import IPython.display
def sea_surface_temperature(expts=[], resolution=1):
"""
Plot a map of SST from last decade of run.
"""
if not isinstance(expts, list):
expts = [expts]
# computing
resu... | OceansAus/cosima-cookbook | cosima_cookbook/plots/maps.py | Python | apache-2.0 | 2,361 |
# (C) British Crown Copyright 2011 - 2017, Met Office
#
# This file is part of cartopy.
#
# cartopy 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 3 of the License, or
# (at your option)... | zak-k/cartopy | lib/cartopy/tests/io/test_ogc_clients.py | Python | lgpl-3.0 | 10,964 |
# -*- cpy-indent-level: 4; indent-tabs-mode: nil -*-
# ex: set expandtab softtabstop=4 shiftwidth=4:
#
# Copyright (C) 2008,2009,2010,2011,2012,2013,2014,2015,2016 Contributor
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You ma... | guillaume-philippon/aquilon | lib/aquilon/worker/dbwrappers/hardware_entity.py | Python | apache-2.0 | 11,896 |
import deskbar.interfaces.Action
from gettext import gettext as _
import gtk
class CopyToClipboardAction(deskbar.interfaces.Action):
"""
Copy given text to clipboard
"""
def __init__(self, name, text):
deskbar.interfaces.Action.__init__(self, name)
self._text = text
de... | benpicco/mate-deskbar-applet | deskbar/handlers/actions/CopyToClipboardAction.py | Python | gpl-2.0 | 574 |
# -*- coding: utf-8 -*-
import unittest
import datetime
from pyboleto.bank.bancodobrasil import BoletoBB
from .testutils import BoletoTestCase
class TestBancoBrasil(BoletoTestCase):
def setUp(self):
self.dados = []
for i in range(3):
d = BoletoBB(7, 1)
d.carteira = '18'
... | opevolution/pyboleto | tests/test_banco_do_brasil.py | Python | bsd-3-clause | 1,202 |
'''
Created on Nov 26, 2014
@author: jiao
'''
import sys
import os
import urllib2
from bs4 import BeautifulSoup
sys.path.append('/home/jiao/QTL')
os.environ.setdefault('DJANGO_SETTINGS_MODULE', 'QTL.settings')
from qtl.models import Experiment,Gene,Marker,LOD,Parent,RIL,Metabolite,MParent,MRIL,MLOD,Genotype,Experi... | longing247/QTL | qtl/upload.py | Python | apache-2.0 | 16,057 |
VERSION = '0.4'
| SimonSapin/tinycss | tinycss/version.py | Python | bsd-3-clause | 16 |
import subprocess
import unittest
import urllib2
import shutil
import json
import ast
import os
from flask import Flask
from flask.ext.testing import LiveServerTestCase
from lwp.app import app
from lwp.utils import connect_db
token = 'myrandomapites0987'
class TestApi(LiveServerTestCase):
db = None
type_js... | romses/LXC-Web-Panel | tests/api.py | Python | mit | 2,899 |
# (c) 2016 Red Hat Inc.
#
# 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 published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# Ansible is dis... | andreaso/ansible | test/units/modules/network/ios/ios_module.py | Python | gpl-3.0 | 3,255 |
"""okc_scraper includes all the functions needed to scrape profiles from
OKCupid"""
import requests
import cPickle as pickle
import time
from BeautifulSoup import BeautifulSoup
def authorize(username, password):
"""Log into OKCupid to scrape profiles"""
user_info = {"username": username, "password": passwor... | lbybee/okc_project | okc_scraper_no_q.py | Python | gpl-2.0 | 8,941 |
"""
script_watcher.py: Reload watched script upon changes.
Copyright (C) 2015 Isaac Weaver
Author: Isaac Weaver <wisaac407@gmail.com>
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... | kilbee/blender-script-watcher | script_watcher.py | Python | gpl-2.0 | 12,299 |
# This file is part of OpenHatch.
# Copyright (C) 2010 Parker Phinney
# Copyright (C) 2010 Jack Grigg
# Copyright (C) 2011 Krzysztof Tarnowski (krzysztof.tarnowski@ymail.com)
# Copyright (C) 2009, 2010, 2011 OpenHatch, Inc.
# Copyright (C) 2011 Jairo E. Lopez
#
# This program is free software: you can redistribute it a... | ehashman/oh-mainline | mysite/base/tests.py | Python | agpl-3.0 | 27,957 |
#encoding:utf-8
subreddit = 'Bertra'
t_channel = '@r_Bertra'
def send_post(submission, r2t):
return r2t.send_simple(submission)
| Fillll/reddit2telegram | reddit2telegram/channels/~inactive/r_bertra/app.py | Python | mit | 135 |
import pickle
import sys
from sklearn.multiclass import OneVsOneClassifier
from sklearn.svm import SVC
sys.path.append('src')
from data import get_featues, get_label
class SVMModel(object):
def __init__(self):
self.clf = OneVsOneClassifier(SVC())
self.name = 'SVM'
def get_params(self):
... | artofai/overcome-the-chaos | src/models/svm.py | Python | mit | 806 |
# Joshua Mazur
# AI class
import random
from copy import deepcopy
import TTT_game
class AI:
def __init__(self,level):
# Current time seed for random calls
random.seed()
# Setting difficulty level
if (level == 0) or (level == 1):
self.difficulty = level # 0 for easy, 1 f... | carpeyoyo/Python-TicTacToe | TTT_AI.py | Python | mit | 21,641 |
#!/usr/bin/env python
"""Client actions related to administrating the client and its configuration."""
import logging
import os
import platform
import socket
import traceback
import cryptography
from cryptography.hazmat.backends import openssl
import pkg_resources
import psutil
import pytsk3
import yara
from grr_res... | google/grr | grr/client/grr_response_client/client_actions/admin.py | Python | apache-2.0 | 11,600 |
#!/usr/bin/env python
# __BEGIN_LICENSE__
# Copyright (c) 2009-2013, United States Government as represented by the
# Administrator of the National Aeronautics and Space Administration. All
# rights reserved.
#
# The NGT platform is licensed under the Apache License, Version 2.0 (the
# "License"); you may not use ... | NeoGeographyToolkit/Tools | nsidc_upload/labels/icebridge_common.py | Python | apache-2.0 | 57,502 |
# -*- encoding: utf-8 -*-
# This file is distributed under the same license as the Django package.
#
# The *_FORMAT strings use the Django date format syntax,
# see http://docs.djangoproject.com/en/dev/ref/templates/builtins/#date
DATE_FORMAT = 'j F Y'
TIME_FORMAT = 'H:i:s'
DATETIME_FORMAT = 'j F Y H:i:s'
YEAR_MONTH_F... | ychen820/microblog | y/google-cloud-sdk/platform/google_appengine/lib/django-1.4/django/conf/locale/fr/formats.py | Python | bsd-3-clause | 1,555 |
# vim: tabstop=4 shiftwidth=4 softtabstop=4
# Copyright 2013 Huawei Technologies Co.,LTD.
# 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://w... | eltonkevani/tempest_el_env | tempest/api/compute/security_groups/test_security_group_rules_negative.py | Python | apache-2.0 | 8,583 |
# System
import sys
# Flask
from flask import Flask, render_template, request, send_from_directory
# SQLAlchemy
from flask_sqlalchemy import SQLAlchemy
from flask_migrate import Migrate
# Utils
from utils.countrycode2toname import countrycode2toname
# Define the WSGI application object
app = Flask(__name__)
app.con... | fnkr/POSS | app/__init__.py | Python | mit | 3,396 |
'''This is not a valid Python module as it contains two
non-standard keywords: repeat and function. However,
by using a custom importer, and the presence of the special
import line below, these non-standard keywords will be converted
into valid Python syntax prior to execution.
'''
from __experimental__ i... | aroberge/python_experiments | version4/test.py | Python | cc0-1.0 | 1,091 |
# -*- coding: utf-8 -*-
"""
***************************************************************************
GdalUtils.py
---------------------
Date : August 2012
Copyright : (C) 2012 by Victor Olaya
Email : volayaf at gmail dot com
*****************************... | nirvn/QGIS | python/plugins/processing/algs/gdal/GdalUtils.py | Python | gpl-2.0 | 14,018 |
import os
import jinja2
import webapp2
from src.lib.TaskHandler import TaskHandler
from src.lib.TasksHandler import TasksHandler
JINJA_ENVIRONMENT = jinja2.Environment(
loader=jinja2.FileSystemLoader(os.path.dirname(__file__)),
extensions=['jinja2.ext.autoescape'],
autoescape=True)
class MainHandler(web... | EduardoCopat/TaskList-angular-gae-python | main.py | Python | mit | 602 |
# -*- coding: utf-8 -*-
import babel
from dateutil.relativedelta import relativedelta
import itertools
import json
from odoo import fields, _, models
from odoo.tools import float_round
from odoo.addons.web.controllers.main import clean_action
DEFAULT_MONTH_RANGE = 3
class Project(models.Model):
_inherit = 'pro... | t3dev/odoo | addons/sale_timesheet/models/project_overview.py | Python | gpl-3.0 | 23,386 |
# coding: utf8
import logging
import time
import sys
import pprint
import requests
from vilya.libs.store import mc, clear_local_cache, ONE_DAY
MC_KEY_REPOSITORY_RELEASE = 'latest_release:%s'
MC_KEY_UNRELEASE_COMMITS = 'release:%s:%s:%s:commits'
def get_release(repository):
'''get latest successed release info... | xtao/code | vilya/models/release.py | Python | bsd-3-clause | 2,102 |
import os
import subprocess
class TestFunctions:
def setup_method(self):
self.test_dir = os.path.join(os.path.dirname(os.path.realpath(__file__)), "scripts")
def test_functions(self):
test_file_name = "functions.py"
test_target = os.path.join(self.test_dir, test_file_name)
ou... | mjpatter88/mjpython | test/acc/test_functions.py | Python | mit | 500 |
# -*- coding: utf-8 -*-
"""An output module that saves events to OpenSearch."""
from plaso.output import manager
from plaso.output import shared_opensearch
class OpenSearchOutputModule(shared_opensearch.SharedOpenSearchOutputModule):
"""Output module for OpenSearch."""
NAME = 'opensearch'
DESCRIPTION = 'Saves... | joachimmetz/plaso | plaso/output/opensearch.py | Python | apache-2.0 | 705 |
#!/usr/bin/env python3.5
# coding:utf-8
# 全局
# 分页显示数量
MAX_PER_PAGE = 5
# 银行相关
ATM_LOG = '../log/atm_history.log'
ACCOUNT_FILE = '../db/user_record.db'
MAX_BALANCE = 15000.0
DEFAULT_PASSWORD = '123'
MAX_ERROR_COUNT = 3
INTEREST = 5 / 1000
# 银行后台相关
# 管理员密码
ADMIN_USER = 'admin'
ADMIN_PASSWORD = '202... | smartczm/python-learn | Old-day01-10/s13-day5/day5/homework/src/conf.py | Python | gpl-2.0 | 626 |
import sys
import warnings
import textwrap
msg = textwrap.dedent("""
You are running Setuptools on Python 2, which is no longer
supported and
>>> SETUPTOOLS WILL STOP WORKING <<<
in a subsequent release. Please ensure you are installing
Setuptools using pip 9.x or later or pin to `setuptools<45`
... | Khan/khan-linter | vendor/py3/pkg_resources/py2_warn.py | Python | apache-2.0 | 633 |
from datetime import timedelta
from django.contrib import admin
from django.db.models import Case, Value, When
from django.utils import timezone
from .models import Channel, Post, RssFeed
@admin.register(Channel)
class ChannelAdmin(admin.ModelAdmin):
list_display = ('__str__', 'title', 'username', 'publish_pict... | vaniakosmos/memes-reposter | apps/rss/admin.py | Python | mit | 1,262 |
import cv2
import numpy as np
roi = cv2.imread( 'mtn1.jpg' )
hsv = cv2.cvtColor( roi, cv2.COLOR_BGR2HSV )
target = cv2.imread( 'mtn2.jpg' )
hsvt = cv2.cvtColor( target, cv2.COLOR_BGR2HSV )
mask = np.zeros( roi.shape[0:2], np.uint8 )
mask[302:1000, 766:1617] = 255
# calculating the object histogram
roihist = cv2.ca... | SSG-DRD-IOT/commercial-iot-security-system | opencv/commercial/Instructions/CV_Fundamentals/histogram/backproj/backproj.py | Python | mit | 886 |
#!/usr/bin/env python
"""this will be the runner file"""
__author__ = 'Geoff Rosen'
__email__ = 'geoff.rosen <at> gmail.com'
__status__ = 'development'
__description__ = '''This program will help to run pplacer \n\
from start to end'''
import argparse, logging, time, argparse, sys
from classes import update_refpkg... | geoffrosen/vaginal-microbiome | pplacerrunner.py | Python | mit | 2,034 |
##############################################################################
# Copyright (c) 2013-2018, 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... | matthiasdiener/spack | var/spack/repos/builtin/packages/xsdk/package.py | Python | lgpl-2.1 | 4,933 |
#!/usr/bin/env python
# -*- coding: utf-8 -*- #
from __future__ import unicode_literals
# This file is only used if you use `make publish` or
# explicitly specify it as your config file.
import os
import sys
sys.path.append(os.curdir)
from pelicanconf import *
SITEURL = 'https://relopezbriega.github.io'
#RELATIVE_... | relopezbriega/mi-python-blog | publishconf.py | Python | gpl-2.0 | 574 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.