repo_name stringlengths 5 104 | path stringlengths 4 248 | content stringlengths 102 99.9k |
|---|---|---|
bleachbit/bleachbit | bleachbit/Action.py | # vim: ts=4:sw=4:expandtab
# -*- coding: UTF-8 -*-
# BleachBit
# Copyright (C) 2008-2021 Andrew Ziem
# https://www.bleachbit.org
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version... |
KenanBek/rslservices | app/payroll/migrations/0010_auto_20160803_1622.py | # -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.db import models, migrations
class Migration(migrations.Migration):
dependencies = [
('payroll', '0009_auto_20160722_1720'),
]
operations = [
migrations.AddField(
model_name='netsalary',
... |
studio1247/gertrude | controls.py | # -*- coding: utf-8 -*-
# This file is part of Gertrude.
#
# Gertrude 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.
#... |
wojtask/CormenPy | test/test_chapter05/test_textbook5_3.py | from unittest import TestCase
from hamcrest import *
from array_util import get_random_array
from chapter05.textbook5_3 import permute_by_sorting, randomize_in_place
class TestTextbook5_3(TestCase):
def test_permute_by_sorting(self):
array, elements = get_random_array()
array = permute_by_sort... |
prasadtalasila/MailingListParser | lib/input/imap/connection.py | import configparser
import imaplib
"""
Gmail uses OAuth for authentications purposes. This means that a regular SSL connection request
is refused by the mail server. So we have change the account settings to allow for access from less
secure applications.
"""
def open_connection(verbose=False, config_file='./imap.co... |
foss-ag/workshop_minecraft-python | src/astroids/Astroid.py | import pygame
import random
class Astroid:
def __init__(self, x, y, scale):
"""
Create Astroid object.
:param x:
Start position X.
:param y:
Start position Y.
:param scale:
Astroid size scale.
"""
# astroid position
... |
shrimo/node_image_tools | node_graph.py | # Visualize node graph
# Copyright 2013 Victor Lavrentev
import matplotlib.pyplot as plt
import json, sys
import networkx as nx
from node_lib import graph
print '\nNode image tools (Visualize node graph) v01a\n'
try:
file_node=sys.argv[1]
except:
print '->Error. No script'
sys.exit (0)
w... |
m-weigand/Cole-Cole-fit | tests/2-term/test_cases.py | #!/usr/bin/python
# -*- coding: utf-8 -*-
"""
Execute to run double Cole-Cole term characterization
"""
import sys
sys.path.append('..')
import test_helper as th
import os
import itertools
import numpy as np
import subprocess
testdir = 'data'
def _generate_cc_sets():
"""Generate multiple complex resistivity spec... |
bearbear12345/school_SDD_prelimYear | Assessments/AS4 - NCSS Python Programming Challenge/NCSS Challenge (Advanced) 2016/1.2.3 - Box in a Box.py | def genbox(i):
i = int(i)
def draw(size, yc, xc):
y = yc
for _ in range(0,size):
if _ == 0 or _ == size-1:
x = xc
i = 0
while i < size:
if not g[_+y][x]=="x": g[_+y][x] = "x"
x += 2
i+=1
else:
if not g[_+y][xc]=="x": g[_+y][xc... |
aliceinit/todogen | todogen_utils/todo_generator.py | __author__ = 'aliceinit'
import heapq
from todogen_utils.todogen_task import TodoTask
class TodoGenerator(object):
# todo add required place for tasks, set (optionally) places for free time periods
# todo add weather requirements for tasks (optionally) - connect to weather APIs
def __init__(self, task_ma... |
bowenliu16/deepchem | examples/low_data/sider_graph_conv_one_fold.py | """
Train low-data Sider models with graph-convolution. Test last fold only.
"""
from __future__ import print_function
from __future__ import division
from __future__ import unicode_literals
import tempfile
import numpy as np
import tensorflow as tf
import deepchem as dc
from datasets import load_sider_convmol
# 4-fo... |
albatros69/Divers | scrap_ffme.py | #!/usr/bin/env python
# -*- coding: utf-8 -*-
from __future__ import (absolute_import, division, print_function,
unicode_literals)
from datetime import datetime
from os import environ
from requests import get
from bs4 import BeautifulSoup, NavigableString
from icalendar import Calendar, Even... |
zackurtz/box-maker | boxmaker.py | #! /usr/bin/env python
'''
Generates Inkscape SVG file containing box components needed to create several different
types of laser cut tabbed boxes.
Derived from original version authored by elliot white - elliot@twot.eu
This program is free software: you can redistribute it and/or modify
it under the terms of the GN... |
maciekswat/dolfin_1.3.0 | test/unit/meshconvert/python/test.py | """ Tests for the meshconvert module."""
# Copyright (C) 2012
#
# This file is part of DOLFIN.
#
# DOLFIN 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 ... |
sgarrad/hicks | config/urls.py | """hicks URL Configuration
The `urlpatterns` list routes URLs to views. For more information please see:
https://docs.djangoproject.com/en/1.8/topics/http/urls/
Examples:
Function views
1. Add an import: from my_app import views
2. Add a URL to urlpatterns: url(r'^$', views.home, name='home')
Class-based... |
DavidBarishev/DDtankFarmingBot | Ddtank_farm_bot/Framework/Clicking.py | """This module is used to click on the screen"""
import logging
from time import sleep
import pyautogui
import Globals
import UI
log = logging.getLogger(__name__)
def click(x, y):
"""
Clicks left click one time
Args:
x (int): x to click
y (int): y to click
"""
log.debug("Clicki... |
molmod/tamkin | tamkin/examples/004_alkanes/bin/analyse_static.py | #!/usr/bin/env python
# -*- coding: utf-8 -*-
# TAMkin is a post-processing toolkit for normal mode analysis, thermochemistry
# and reaction kinetics.
# Copyright (C) 2008-2012 Toon Verstraelen <Toon.Verstraelen@UGent.be>, An Ghysels
# <An.Ghysels@UGent.be> and Matthias Vandichel <Matthias.Vandichel@UGent.be>
# Center ... |
zqfan/leetcode | algorithms/437. Path Sum III/solution.py | # Definition for a binary tree node.
# class TreeNode(object):
# def __init__(self, x):
# self.val = x
# self.left = None
# self.right = None
class Solution(object):
def pathSum(self, root, sum):
"""
:type root: TreeNode
:type sum: int
:rtype: int
... |
pri22296/yaydoc | modules/scripts/extensions/blog.py | from docutils import nodes
from docutils.parsers import rst
from uuid import uuid4
class feed(nodes.General, nodes.Element):
pass
def visit(self, node):
id = str(uuid4())
tag =u'''
<h4>Latest blogs</h4>
<div id="{0}"></div>
<script>
feednami.load("{1}")
.then(function (resul... |
esdalmaijer/PyGaze | pygaze/libsound.py | # -*- coding: utf-8 -*-
#
# This file is part of PyGaze - the open-source toolbox for eye tracking
#
# PyGaze is a Python module for easily creating gaze contingent experiments
# or other software (as well as non-gaze contingent experiments/software)
# Copyright (C) 2012-2013 Edwin S. Dalmaijer
#
# ... |
wolfiex/DSMACC-testing | zgraph.py | import networkx as nx
import numpy as np
import pandas as pd
def normalise(x):
x = x[:]#deepcopy error
x -= min(x)
x /= max(x)
return x
def jgraph(posjac):
'''
networkx graph object from posjac at timestep
'''
posjac = 1 - normalise(np.log10(posjac).replace([np.inf,-np.inf],np.nan... |
molmod/tamkin | tamkin/pftools.py | # -*- coding: utf-8 -*-
# TAMkin is a post-processing toolkit for normal mode analysis, thermochemistry
# and reaction kinetics.
# Copyright (C) 2008-2012 Toon Verstraelen <Toon.Verstraelen@UGent.be>, An Ghysels
# <An.Ghysels@UGent.be> and Matthias Vandichel <Matthias.Vandichel@UGent.be>
# Center for Molecular Modeling... |
mapossum/SeymourSolo | tester.py | import relayManager
import dronekit
class ShotManager():
def __init__(self):
# see the shotlist in app/shots/shots.p
print "init"
def Start(self, vehicle):
self.vehicle = vehicle
# Initialize relayManager
self.relayManager = relayManager.RelayManager(self)
target = '... |
dserv01/BackupMailToHTML | SavableLazyMail.py | from LazyMail import LazyMail, encode_string
import email
import datetime
import os
import cgi
import re
import logging
from email.header import decode_header
__author__ = 'doms'
class SavableLazyMail(LazyMail):
def __init__(self, config, mail_connection, uid, stats):
self.STATS = stats
self.CONF... |
mediatum/mediatum | core/test/test_legacy_update_create.py | # -*- coding: utf-8 -*-
"""
:copyright: (c) 2016 by the mediaTUM authors
:license: GPL3, see COPYING for details
"""
from __future__ import absolute_import
from utils.date import parse_date
from core.test.factories import DocumentFactory
# adding more test functions may fail, see the comments for the following... |
ChameleonCloud/openstack-nagios-plugins | openstacknagios/nova/Images.py | # Copyright (C) 2016 Jordan Tardif http://github.com/jordant
# Jordan Tardif <jordan@dreamhost.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, either version 3 of the Lic... |
urashima9616/Leetcode_Python | Leet415_AddStrings.py | def addStrings(s1, s2):
"""
type s1, s2: String
rtype string
"""
digit2num = {"0":0, "1":1, "2":2, "3":3, "4":4, "5":5, "6":6, "7":7, "8":8, "9":9}
pt1, pt2 = len(s1)-1, len(s2)-1
carry = 0
res = []
while pt1 >= 0 and pt2 >= 0:
digit_sum = digit2num[s1[pt1]] + digit2num[s2[pt... |
tareqalam/plone.formbuilder | setup.py | # -*- coding: utf-8 -*-
"""Installer for the plone.formbuilder package."""
from setuptools import find_packages
from setuptools import setup
long_description = '\n\n'.join([
open('README.rst').read(),
open('CONTRIBUTORS.rst').read(),
open('CHANGES.rst').read(),
])
setup(
name='plone.formbuilder',
... |
qalhata/Python-Scripts-Repo-on-Data-Science | HTTP_Request_using_Requests.py | # -*- coding: utf-8 -*-
"""
Created on Sun Jan 15 23:32:44 2017
@author: Shabaka
"""
"""
Import the package requests.
Assign the URL of interest to the variable url.
Package the request to the URL, send the request and catch the response
with a single function requests.get(), assigning ... |
dwysocki/trivial | doc/stats/plot.py | import matplotlib as mpl
import matplotlib.pyplot as plt
import numpy as np
def separate_windows(arr):
ret = dict()
for k, v in zip(*arr):
if k in ret:
ret[k].append(v)
else:
ret[k] = [v]
return ret
def load_file(filename, *args, **kwargs):
data = np.genfromtxt(... |
TimothyXu/nurdCase | nurdCase.py | #!/usr/bin/env python3
#######################################################################
#Copyright (C) 2015 Timothy Xu #
# #
#This program is free software: you can redistribute it and/or modify #
#it under... |
abalakh/robottelo | tests/foreman/ui/test_role.py | # -*- encoding: utf-8 -*-
"""Test class for Roles UI"""
from ddt import ddt
from fauxfactory import gen_string
from nailgun import entities
from robottelo.decorators import data
from robottelo.helpers import generate_strings_list, invalid_names_list
from robottelo.test import UITestCase
from robottelo.ui.factory impor... |
marmorkuchen/jw2html | setup.py | import os
from setuptools import setup, find_packages
from jw2html import VERSION
setup(
name='JW2HTML',
version=VERSION,
description='JW2HTML converts an issue of the Jungle World from the website to a single HTML file to be used for epub conversion by e.g. calibre.',
long_description='Alas, there is... |
PabloCastellano/bormeparser | docs/conf.py | #!/usr/bin/env python3
# -*- coding: utf-8 -*-
#
# bormeparser documentation build configuration file, created by
# sphinx-quickstart on Sat Jun 27 16:25:25 2015.
#
# This file is execfile()d with the current directory set to its
# containing dir.
#
# Note that not all possible configuration values are present in this
... |
chenkianwee/envuo | py4design/pycitygml/write_gml.py | # ==================================================================================================
#
# Copyright (c) 2016, Chen Kian Wee (chenkianwee@gmail.com)
#
# This file is part of py4design
#
# py4design is free software: you can redistribute it and/or modify
# it under the terms of the GNU General ... |
Phrozyn/MozDef | tests/alerts/test_bruteforce_ssh.py | # This Source Code Form is subject to the terms of the Mozilla Public
# License, v. 2.0. If a copy of the MPL was not distributed with this
# file, You can obtain one at http://mozilla.org/MPL/2.0/.
# Copyright (c) 2017 Mozilla Corporation
from positive_alert_test_case import PositiveAlertTestCase
from negative_alert_... |
thomas-hori/Repuge-NG | TeddyMapB.py | from TeddyMapBase import TeddyMapBase
from TfGun import TfGun
class TeddyMapB(TeddyMapBase):
#Raw string (r""") because backslashes
# Lab "Other room"
coded_grid=r"""
/------------T-T----------------\
|............>-<................|
|............|%|................|
|............|.|................|
... |
klahnakoski/jx-sqlite | vendor/jx_base/expressions/is_text_op.py | # encoding: utf-8
#
#
# This Source Code Form is subject to the terms of the Mozilla Public
# License, v. 2.0. If a copy of the MPL was not distributed with this file,
# You can obtain one at http:# mozilla.org/MPL/2.0/.
#
# Contact: Kyle Lahnakoski (kyle@lahnakoski.com)
#
from __future__ import absolute_import, divis... |
zerothi/sisl | sisl/io/molden.py | # This Source Code Form is subject to the terms of the Mozilla Public
# License, v. 2.0. If a copy of the MPL was not distributed with this
# file, You can obtain one at https://mozilla.org/MPL/2.0/.
# Import sile objects
from .sile import *
from sisl._internal import set_module
from sisl import Geometry
__all__ = [... |
chuckharmston/ghosttown | app/search/query/base.py | from xml.etree import ElementTree
from memorize import memorize
from memcached import memcached
class BaseQueryEngine(object):
"""
TODO: Query engines are...
"""
def __init__(self, query):
self.query = query
self.results = self.search(query)
def fetch(self, query):
"""
... |
myrdd/firefox-ui-tests | firefox_ui_tests/functional/security/test_no_certificate.py | # This Source Code Form is subject to the terms of the Mozilla Public
# License, v. 2.0. If a copy of the MPL was not distributed with this
# file, You can obtain one at http://mozilla.org/MPL/2.0/.
from urlparse import urlparse
from marionette_driver import expected, Wait
from firefox_ui_harness.decorators import s... |
dsarkozi/care4care-sdp-grp4 | Care4Care/C4CApplication/views/RemoveFavoriteRedirectView.py | from django.views.decorators.cache import never_cache
from django.views.generic.base import RedirectView
from django.core.exceptions import PermissionDenied
from django.core.urlresolvers import reverse_lazy
from C4CApplication.views.utils import create_user
class RemoveFavoriteRedirectView(RedirectView):
... |
seldon/django-flexi-auth | flexi_auth/tests/models.py | # Copyright (C) 2011 REES Marche <http://www.reesmarche.org>
#
# This file is part of ``django-flexi-auth``.
# ``django-flexi-auth`` 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, version 3 of the Lic... |
jaumemarti/l10n-spain-txerpa | l10n_es_payment_order/wizard/csb32.py | # -*- coding: utf-8 -*-
##############################################################################
#
# OpenERP, Open Source Management Solution
# Copyright (c) 2006 ACYSOS S.L. (http://acysos.com)
# Pedro Tarrafeta <pedro@acysos.com>
# Copyright (c) 2008 Pablo Rocandio. All Rights Res... |
GroupBank/global-server | rest_app/decorators.py | import logging
from django.http import HttpResponseBadRequest, HttpResponseForbidden
from functools import wraps
import groupbank_crypto.ec_secp256k1 as crypto
logger = logging.getLogger(__name__)
# decorator for verifying the payload is signed by the author of the request
def verify_author(view):
@wraps(view... |
grap/OCB | addons/purchase/purchase.py | # -*- coding: utf-8 -*-
##############################################################################
#
# OpenERP, Open Source Management Solution
# Copyright (C) 2004-2010 Tiny SPRL (<http://tiny.be>).
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU... |
migue/voltdb | lib/python/vdm/server/Configuration.py | # This file is part of VoltDB.
# Copyright (C) 2008-2017 VoltDB Inc.
#
# This program 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 ver... |
wbsavage/shinken | shinken/misc/datamanagerhostd.py | #!/usr/bin/python
# -*- coding: utf-8 -*-
# Copyright (C) 2009-2012:
# Gabes Jean, naparuba@gmail.com
# Gerhard Lausser, Gerhard.Lausser@consol.de
# Gregory Starck, g.starck@gmail.com
# Hartmut Goebel, h.goebel@goebel-consult.de
#
# This file is part of Shinken.
#
# Shinken is free software: you can redis... |
ESOedX/edx-platform | common/lib/capa/capa/tests/test_input_templates.py | """
Tests for the logic in input type mako templates.
"""
from __future__ import absolute_import
import json
import unittest
from collections import OrderedDict
from lxml import etree
from mako import exceptions
from six.moves import range
from capa.inputtypes import Status
from capa.tests.helpers import capa_rende... |
pronexo-odoo/odoo-argentina | l10n_ar_pyafipws/pysimplesoap/pysimplesoap/server.py | #!/usr/bin/python
# -*- coding: latin-1 -*-
# This program 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, or (at your option) any later
# version.
#
# This program is distributed in t... |
bwrsandman/openerp-hr | hr_employee_legacy_id/__openerp__.py | #-*- coding:utf-8 -*-
#
#
# Copyright (C) 2011,2013 Michael Telahun Makonnen <mmakonnen@gmail.com>.
# All Rights Reserved.
#
# This program 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,... |
h4wkmoon/shinken | shinken/commandcall.py | #!/usr/bin/env python
# -*- coding: utf-8 -*-
# Copyright (C) 2009-2014:
# Gabes Jean, naparuba@gmail.com
# Gerhard Lausser, Gerhard.Lausser@consol.de
# Gregory Starck, g.starck@gmail.com
# Hartmut Goebel, h.goebel@goebel-consult.de
#
# This file is part of Shinken.
#
# Shinken is free software: you can r... |
OpusVL/odoo-trading-as | trading_as/__openerp__.py | # -*- coding: utf-8 -*-
##############################################################################
#
# Trading As Brands
# Copyright (C) 2015 OpusVL (<http://opusvl.com/>)
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU Affero General Public License as
# pub... |
brousch/opencraft | instance/models/server.py | # -*- coding: utf-8 -*-
#
# OpenCraft -- tools to aid developing and hosting free software projects
# Copyright (C) 2015 OpenCraft <xavier@opencraft.com>
#
# This program 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 Soft... |
joyxu/kernelci-backend | app/utils/__init__.py | # Copyright (C) 2014 Linaro Ltd.
#
# This program 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.
#
# This program is distribute... |
MTG/essentia | test/src/unittests/rhythm/test_superfluxextractor.py | #!/usr/bin/env python
# Copyright (C) 2006-2021 Music Technology Group - Universitat Pompeu Fabra
#
# This file is part of Essentia
#
# Essentia 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 (FSF), e... |
wwj718/edx-video | common/djangoapps/student/views.py | import datetime
import feedparser
import json
import logging
import random
import re
import string # pylint: disable=W0402
import urllib
import uuid
import time
from django.conf import settings
from django.contrib.auth import logout, authenticate, login
from django.contrib.auth.models import User
from django.con... |
jolyonb/edx-platform | common/lib/xmodule/xmodule/modulestore/tests/test_semantics.py | """
Tests of modulestore semantics: How do the interfaces methods of ModuleStore relate to each other?
"""
from __future__ import absolute_import
import itertools
from collections import namedtuple
import ddt
from mock import patch
from xblock.core import XBlock, XBlockAside
from xblock.fields import Scope, String
f... |
pculture/mirocommunity | localtv/models.py | import datetime
import itertools
import re
import urllib2
import mimetypes
import operator
import logging
import sys
import traceback
import warnings
import tagging
import tagging.models
import vidscraper
from bs4 import BeautifulSoup
from django.conf import settings
from django.contrib.auth.models import User
from dj... |
devs1991/test_edx_docmode | venv/lib/python2.7/site-packages/opaque_keys/edx/tests/test_asset_locators.py | """
Tests of AssetLocators
"""
from unittest import TestCase
import ddt
from opaque_keys import InvalidKeyError
from opaque_keys.edx.keys import AssetKey, CourseKey
from opaque_keys.edx.locator import AssetLocator, CourseLocator
@ddt.ddt
class TestAssetLocators(TestCase):
"""
Tests of :class:`AssetLocator`
... |
OCA/hr | hr_employee_ppe/models/hr_personal_equipment_request.py | # Copyright 2021 Creu Blanca
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl).
from odoo import fields, models
class HrPersonalEquipmentRequest(models.Model):
_inherit = "hr.personal.equipment.request"
contains_ppe = fields.Boolean(compute="_compute_contains_ppe")
def _compute_contains_p... |
tsotetsi/textily-web | temba/utils/exporter.py | from __future__ import unicode_literals
import csv
import six
from django.core.files.temp import NamedTemporaryFile
from openpyxl import Workbook
from openpyxl.writer.write_only import WriteOnlyCell
class TableExporter(object):
"""
Class that abstracts out writing a table of data to a CSV or Excel file. Thi... |
datagutten/comics | comics/comics/axecop.py | from comics.aggregator.crawler import CrawlerBase, CrawlerImage
from comics.core.comic_data import ComicDataBase
class ComicData(ComicDataBase):
name = 'Axe Cop'
language = 'en'
url = 'http://www.axecop.com/'
start_date = '2010-01-02'
rights = 'Ethan Nicolle'
class Crawler(CrawlerBase):
hist... |
artefactual/archivematica-storage-service | storage_service/locations/south_migrations/0006_duracloud.py | # -*- coding: utf-8 -*-
from __future__ import absolute_import
from south.db import db
from south.v2 import SchemaMigration
class Migration(SchemaMigration):
def forwards(self, orm):
# Adding model 'Duracloud'
db.create_table(
u"locations_duracloud",
(
(u"i... |
edx/edx-enterprise | integrated_channels/sap_success_factors/exporters/learner_data.py | # -*- coding: utf-8 -*-
"""
Learner data exporter for Enterprise Integrated Channel SAP SuccessFactors.
"""
from logging import getLogger
from requests import RequestException
from django.apps import apps
from enterprise.models import EnterpriseCustomerUser, PendingEnterpriseCustomerUser
from enterprise.tpa_pipelin... |
numericube/twistranet | twistranet/twistapp/lib/slugify.py | import re
import unicodedata
from django.core.urlresolvers import reverse
from django.core.exceptions import ObjectDoesNotExist
# List of words you're not allowed to use as a slug
RESERVED_KEYWORDS = [
"account",
"add_to_network",
"cache",
"configuration",
"content",
"comment",
"create",
... |
tjr/CedarRapidsOnline | profile.py | # profile.py
# User profile pages for CedarRapidsOnline web service
# Copyright (C) 2009 Clear Perception Solutions, LLC.
# Written by Trevis J. Rothwell <tjr@gnu.org>
#
# This file is part of the CedarRapidsOnline web service.
#
# This program is free software: you can redistribute it and/or modify
# it under the ter... |
fintech-circle/edx-platform | openedx/core/djangoapps/waffle_utils/tests/test_init.py | """
Tests for waffle utils features.
"""
import ddt
from django.test import TestCase
from mock import patch
from opaque_keys.edx.keys import CourseKey
from waffle.testutils import override_flag
from request_cache.middleware import RequestCache
from .. import CourseWaffleFlag, WaffleFlagNamespace
from ..models import ... |
gem/oq-engine | openquake/hazardlib/gsim/morikawa_fujiwara_2013.py | # -*- coding: utf-8 -*-
# vim: tabstop=4 shiftwidth=4 softtabstop=4
#
# Copyright (C) 2021 GEM Foundation
#
# OpenQuake 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, o... |
renalreg/radar | fabfile.py | from contextlib import contextmanager
import binascii
import os
from pathlib import Path
import tempfile
from fabric import task
from pkg_resources import parse_version
DEFAULT_DIST_DIR = "dist"
# run with
# fab -H root@some_host --prompt-for-login-password deploy|build
@contextmanager
def temp(c):
randomstr ... |
SKIRT/PTS | evolve/genomes/nucleobases.py | #!/usr/bin/env python
# -*- coding: utf8 -*-
# *****************************************************************
# ** PTS -- Python Toolkit for working with SKIRT **
# ** © Astronomical Observatory, Ghent University **
# *****************************************************************
##... |
OddBloke/moore | matches/migrations/0001_initial.py | # 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 model 'Card'
db.create_table('matches_card', (
('id', self.gf('django.db.models.field... |
gbour/wave | tests/testsuite/002_pubsub.py | # -*- coding: UTF8 -*-
import types
from TestSuite import TestSuite, desc, catch
from mqttcli import MqttClient
from nyamuk.event import *
from lib.env import gen_msg, debug
class PubSub(TestSuite):
tests = (
('a/b/c', 'a/b/c'),
('a/b/c', 'a/b/d' , False),
('a/+/c', 'a/b/c'),
('a... |
nathanaevitas/odoo | custom_addons/phaply/models.py | # -*- coding: utf-8 -*-
from openerp import models, fields, api
class phaply(models.Model):
"""
This class will create a new table in DB with the same and replace the '.' with '_'
"""
_name = 'phaply.phaply'
name = fields.Char(string='Ten KH')
ngaysinh = fields.Date(string='Ngay sinh')
... |
paulocsanz/algebra-linear | scripts/eq_n_linear_broyden.py | #!/usr/bin/env python3
from erros import NaoConverge
from numpy import matrix
from numpy.linalg import inv
from numpy.linalg import norm
def SolucaoEqNLinearBroyden(xin, bi, tol, niter, F):
xold = xin
bold = matrix(bi)
tolerancia = 1
while (tolerancia > tol and niter != -1):
f = matrix(F... |
CLVsol/clvsol_odoo_addons | clv_report/models/report.py | # -*- coding: utf-8 -*-
# Copyright (C) 2013-Today Carlos Eduardo Vercelino - CLVsol
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl).
from odoo import api, fields, models
class Report(models.Model):
_description = 'Report'
_name = 'clv.report'
_inherit = 'clv.abstract.report'
_order =... |
CLVsol/odoo_addons | clv_employee/__openerp__.py | # -*- encoding: utf-8 -*-
################################################################################
# #
# Copyright (C) 2013-Today Carlos Eduardo Vercelino - CLVsol #
# ... |
martijnvermaat/rpclib | src/rpclib/test/wsdl/defult_services.py |
#
# rpclib - Copyright (C) rpclib contributors.
#
# 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 lib... |
katyhuff/moose | python/MooseDocs/MooseApplicationSyntax.py | import os
import re
import copy
import collections
import logging
import MooseDocs
import collections
import subprocess
import yaml
log = logging.getLogger(__name__)
class PagesHelper(object):
"""
A helper class for checking if a markdown file is include in the 'pages.yml' file.
"""
def __init__(self,... |
amolenaar/gaphor | gaphor/core/modeling/diagram.py | """This module contains a model element Diagram.
Diagrams can be visualized and edited.
"""
from __future__ import annotations
import logging
import uuid
from dataclasses import dataclass
from functools import lru_cache
from typing import Callable, Iterable, Iterator, Sequence, TypeVar, overload
import gaphas
from t... |
skosukhin/spack | lib/spack/spack/cmd/clone.py | ##############################################################################
# Copyright (c) 2013-2016, 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... |
alonbl/ovirt-host-deploy | src/plugins/ovirt-host-common/hosted-engine/configureha.py | #
# ovirt-host-deploy -- ovirt host deployer
# Copyright (C) 2015 Red Hat, Inc.
#
# 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) ... |
backmari/moose | python/TestHarness/testers/Tester.py | import re, os
import util
from InputParameters import InputParameters
from MooseObject import MooseObject
class Tester(MooseObject):
@staticmethod
def validParams():
params = MooseObject.validParams()
# Common Options
params.addRequiredParam('type', "The type of test of Tester to crea... |
stefanseefeld/synopsis | Synopsis/ASG.py | #
# Copyright (C) 2000 Stefan Seefeld
# Copyright (C) 2000 Stephen Davies
# All rights reserved.
# Licensed to the public under the terms of the GNU LGPL (>= 2),
# see the file COPYING for details.
#
"""Abstract Syntax Tree classes.
This file contains classes which encapsulate nodes in the ASG. The base class
is the ... |
pombredanne/https-git.fedorahosted.org-git-kobo | kobo/decorators.py | # -*- coding: utf-8 -*-
__all__ = (
"decorator_with_args",
"well_behaved",
"log_traceback",
)
def decorator_with_args(old_decorator):
"""Enable arguments for decorators.
Example:
>>> @decorator_with_args
def new_decorator(func, arg1, arg2):
...
# it's the same a... |
booya-at/freecad_glider | freecad/freecad_glider/tools/line_tool.py | from __future__ import division
import sys
if sys.version_info.major > 2:
from importlib import reload
from PySide import QtGui, QtCore
import traceback
import numpy as np
import FreeCAD as App
import FreeCADGui as Gui
from ._tools import BaseTool, input_field, text_field
from ._glider import draw_glider, draw_l... |
poppogbr/genropy | gnrpy/gnr/web/gnrwebstruct.py | #-*- coding: UTF-8 -*-
#--------------------------------------------------------------------------
# package : GenroPy web - see LICENSE for details
# module gnrsqlclass : Genro Web structures implementation
# Copyright (c) : 2004 - 2007 Softwell sas - Milano
# Written by : Giovanni Porcari, Michele Bertoldi... |
nmgeek/npTDMS | nptdms/tdmsinfo.py | from __future__ import print_function
from argparse import ArgumentParser
import logging
from nptdms import tdms
def main():
parser = ArgumentParser(
description="List the contents of a LabView TDMS file.")
parser.add_argument(
'-p', '--properties', action="store_true",
help="Include... |
alephobjects/Cura2 | plugins/LegacyProfileReader/LegacyProfileReader.py | # Copyright (c) 2017 Ultimaker B.V.
# Cura is released under the terms of the LGPLv3 or higher.
import configparser # For reading the legacy profile INI files.
import io
import json # For reading the Dictionary of Doom.
import math # For mathematical operations included in the Dictionary of Doom.
import os.path # ... |
fmarani/spam | spam/spamhaus.py | #!/usr/bin/env python
from urlparse import urlparse
from socket import gethostbyname
from spam import DomainInexistentException
class SpamHausChecker(object):
"""spam checker using spamhaus"""
IS_SPAM = 1
IS_NOT_SPAM = 2
def _query_spamhaus(self, spamhaus_zone):
try:
return getho... |
efforia/eos-dashboard | pandora-ckz/pandora/correios/scraping.py | import re
import urllib2
from BeautifulSoup import BeautifulSoup
from encomenda import Encomenda, Status
class CorreiosWebsiteScraper(object):
def __init__(self, http_client=urllib2):
self.url = 'http://websro.correios.com.br/sro_bin/txect01$.QueryList?P_ITEMCODE=&P_LINGUA=001&P_TESTE=&P_TIPO=001&P_... |
SINGROUP/pycp2k | inputparser.py | #! /usr/bin/env python
# -*- coding: utf-8 -*-
"""Provides functions for creating a python classes from the cp2k_input.xml
file.
"""
import xml.etree.cElementTree as cElementTree
import utilities
import textwrap
#===============================================================================
def validify_section(st... |
sirk390/coinpy | coinpy-lib/src/coinpy/lib/transactions/tx_checks.py | from coinpy.lib.serialization.structures.s11n_tx import TxSerializer
from coinpy.model.constants.bitcoin import MAX_BLOCK_SIZE, is_money_range
from coinpy.lib.serialization.scripts.serialize import ScriptSerializer
class TxVerifier():
def __init__(self, runmode):
self.runmode = runmode
self.tx_ser... |
Patola/Cura | cura/Settings/CuraContainerStack.py | # Copyright (c) 2018 Ultimaker B.V.
# Cura is released under the terms of the LGPLv3 or higher.
from typing import Any, cast, List, Optional
from PyQt5.QtCore import pyqtProperty, pyqtSignal, QObject
from UM.Application import Application
from UM.Decorators import override
from UM.FlameProfiler import pyqtSlot
from U... |
boyska/pyFsdb | fsdb/Fsdb.py | # -*- coding: utf-8 -*-
import os
import errno
import stat
import unicodedata
import hashlib
import shutil
import logging
import config
class Fsdb(object):
"""File system database
expose a simple api (add,get,remove)
to menage the saving of files on disk.
files are placed under specified fs... |
602p/orth | os/kernel/font/font.py | #adapted from ColorWall by jesstesstest
_font = (
(
("########"),
("##....##"),
("#.#..#.#"),
("#..##..#"),
("#..##..#"),
("#.#..#.#"),
("##....##"),
("########")
),
(
("########"),
("##....##"),
("#.#..#.#"),
("#..##..#"),
("#..##..#"),
("#.#..#.#"),
("... |
stgeorges/pythonscripts | object_names_No_occurrences.py | #*******************************************************************************************#
#********* Object names and its number of occurrences **************************************#
#********* by Djordje Spasic ***************************************************************#
#********* issworld2000@yahoo.com 08-F... |
jeffque/circle-quest-squareland | elements/geometry.py | def pitagoras_quad(coordenada):
return coordenada[0] ** 2 + coordenada[1] ** 2
def pitagoras(coordenada):
return pitagoras_quad(coordenada)**0.5
def coords_delta(coord_a, coord_b):
delta = []
delta.append(coord_a[0] - coord_b[0])
delta.append(coord_a[1] - coord_b[1])
return delta
def coord... |
RoyNexus/python | homework6.py | import numpy as np
import copy
import datetime as dt
import QSTK.qstkutil.qsdateutil as du
import QSTK.qstkutil.DataAccess as da
import QSTK.qstkstudy.EventProfiler as ep
from bollinger import Bollinger
"""
Accepts a list of symbols along with start and end date
Returns the Event Matrix which is a pandas Datamatrix
E... |
viktorRock/myFirstPythonAPI | pythonapi/settings.py | """
Django settings for pythonapi project.
Generated by 'django-admin startproject' using Django 1.11.
For more information on this file, see
https://docs.djangoproject.com/en/1.11/topics/settings/
For the full list of settings and their values, see
https://docs.djangoproject.com/en/1.11/ref/settings/
"""
# Parse da... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.