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 |
|---|---|---|---|---|---|
"""Functionality for manipulating multiple grism exposures simultaneously
"""
import os
import time
import glob
from collections import OrderedDict
import multiprocessing as mp
import scipy.ndimage as nd
import numpy as np
import matplotlib.pyplot as plt
from astropy.table import Table
import astropy.io.fits as pyfi... | albertfxwang/grizli | grizli/multifit.py | Python | mit | 180,455 |
# Copyright 2015-2021 D.G. MacCarthy <https://dmaccarthy.github.io/sc8pr>
#
# This file is part of "sc8pr".
#
# "sc8pr" 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... | dmaccarthy/sc8pr | sc8pr/misc/s8v.py | Python | gpl-3.0 | 3,010 |
# Copyright (c) 2013, Web Notes Technologies Pvt. Ltd. and Contributors
# License: GNU General Public License v3. See license.txt
# For license information, please see license.txt
from __future__ import unicode_literals
import frappe
from frappe.model.document import Document
class ItemReorder(Document):
pass | indictranstech/focal-erpnext | stock/doctype/item_reorder/item_reorder.py | Python | agpl-3.0 | 315 |
from .views import (ManageOrganizationList, ManageOrganizationDetail, ManageOrganizationAddressDetail,
ManageOrganizationAddressList, ManageOrganizationDocumentList, ManageOrganizationDocumentDetail)
from django.conf.urls import patterns, url, include
from surlex.dj import surl
from .views import Or... | gannetson/sportschooldeopenlucht | apps/organizations/urlsapi.py | Python | bsd-3-clause | 1,217 |
from rest_framework.pagination import LimitOffsetPagination
from rest_framework import status
from rest_framework.response import Response
class AdministratorPagination(LimitOffsetPagination):
def get_paginated_response(self, data):
return Response({
"status": True,
"code": status.... | belatrix/BackendAllStars | administrator/pagination.py | Python | apache-2.0 | 497 |
#-------------------------------------------------------------------------
# Copyright (c) Microsoft Corporation
# All rights reserved.
#
# MIT License:
# 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... | kod3r/Azure-MachineLearning-ClientLibrary-Python | tests/roundtriptests.py | Python | mit | 6,355 |
# 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 pants.base.depr... | landism/pants | src/python/pants/backend/jvm/targets/exclude.py | Python | apache-2.0 | 489 |
"""
Django settings for code4sa project.
For more information on this file, see
https://docs.djangoproject.com/en/1.7/topics/settings/
For the full list of settings and their values, see
https://docs.djangoproject.com/en/1.7/ref/settings/
"""
# Build paths inside the project like this: os.path.join(BASE_DIR, ...)
im... | Code4SA/django-template | code4sa/settings.py | Python | mit | 4,773 |
#!/usr/bin/python
#
# Copyright 2012 Anthony Campbell (anthonycampbell.co.uk)
#
# 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 re... | acampbell3000/clojure-imdb-parser | run.py | Python | apache-2.0 | 4,140 |
'''
@input: python3 generate_data.py <user_size> <item_size> <factor_size> <user_item_density> <user_factor_density> <folder_name>
@output:
rating_table.csv
effect_talbe.csv
conversion_table.csv
rating_list.csv, formats: user_id, itme_id, rating_value
conversion_list.csv, formats: user_id, factor_id
... | JalexChang/cross-media-attribution | data/generator.py | Python | bsd-2-clause | 2,583 |
# encoding: utf-8
import datetime
from south.db import db
from south.v2 import DataMigration
from django.db import models
class Migration(DataMigration):
def forwards(self, orm):
parse = lambda s: datetime.datetime.strptime(s, '%Y-%m-%dT%H:%M:%S.%f')
commissions = orm.Commission.objects.all()
... | grnet/synnefo | snf-astakos-app/astakos/quotaholder_app/migrations/old/0006_datetime.py | Python | gpl-3.0 | 4,257 |
"""Build and install scmtiles."""
# Copyright 2016 Andrew Dawson
#
# 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 applicab... | aopp-pred/scmtiles | setup.py | Python | apache-2.0 | 921 |
#!/usr/bin/env python
import matplotlib
matplotlib.use('agg')
import sys
import yt
import numpy as np
from yt.visualization.volume_rendering.api import \
Scene, \
VolumeSource
# this is for the wdconvect problem
def doit(plotfile):
ds = yt.load(plotfile)
ds.periodicity = (True, True, True)
f... | BoxLib-Codes/wdmerger | analysis/vol-wd.py | Python | mit | 2,763 |
"""This module defines the class DesiForest to represent DESI forests"""
from picca.delta_extraction.astronomical_objects.forest import Forest
from picca.delta_extraction.errors import AstronomicalObjectError
class DesiForest(Forest):
"""Forest Object
Methods
-------
__gt__ (from AstronomicalObject)
... | igmhub/picca | py/picca/delta_extraction/astronomical_objects/desi_forest.py | Python | gpl-3.0 | 7,693 |
#!/usr/bin/env python3
#
# Electrum - lightweight Bitcoin client
# Copyright (C) 2014 Thomas Voegtlin
#
# Electron Cash - lightweight Bitcoin Cash client
# Copyright (C) 2019 The Electron Cash Developers
#
# Permission is hereby granted, free of charge, to any person
# obtaining a copy of this software and associated d... | fyookball/electrum | plugins/cosigner_pool/qt.py | Python | mit | 15,181 |
# -*- coding: utf-8 -*-
##############################################################################
#
# OpenERP, Open Source Management Solution
# Copyright (C) 2004-2009 Tiny SPRL (<http://tiny.be>).
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the... | diogocs1/comps | web/openerp/service/security.py | Python | apache-2.0 | 1,510 |
#!/usr/bin/env python3
"""
Demo of reading raw Bayer 10-bit data from Raspberry Pi camera chip using PiCamera module.
Notes:
1) can only read full chip, no binning or ROI: 2592x1944 pixel image with current imaging chip
2) captures a single image
3) sudo apt-get install python3-picamera python3-scipy
Basis from Michae... | pietkuip/raspberrypi_muon_microscope | getrawimage.py | Python | mit | 2,714 |
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
#
# ReGraph documentation build configuration file, created by
# sphinx-quickstart on Mon Dec 4 16:51:07 2017.
#
# 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
# au... | eugeniashurko/ReGraph | docs/source/conf.py | Python | mit | 5,928 |
"""`List` provider example."""
import dataclasses
from typing import List
from dependency_injector import containers, providers
@dataclasses.dataclass
class Module:
name: str
@dataclasses.dataclass
class Dispatcher:
modules: List[Module]
class Container(containers.DeclarativeContainer):
dispatcher_... | rmk135/objects | examples/providers/list.py | Python | bsd-3-clause | 979 |
""" Simple implementation of mutinomial Naive Bayes for text classfification.
TODO: Apply to 20 Newsgroups, Reuters-21578 datasets
"""
__author__ = 'Duong Nguyen'
__version__ = '0.0'
import math
import sys
from collections import defaultdict
class NaiveBayes(object):
""" Multinomial Naive Bayes"""
def... | ntduong/ML | Misc/naivebayes.py | Python | mit | 2,081 |
# -*- coding: utf-8 -*-
import os
import shutil
from jinja2 import Environment, FileSystemLoader
from webassets import Environment as AssetsEnvironment
from webassets.ext.jinja2 import AssetsExtension
from webassets.loaders import YAMLLoader
class TemplateBuilder(object):
def __init__(self, path, output,
... | regadas/presstatic | presstatic/builder.py | Python | mit | 3,269 |
# -*- coding: iso-8859-1 -*-
##############################################################################
#
# Copyright (c) 2001 Zope Corporation and Contributors. All Rights Reserved.
#
# This software is subject to the provisions of the Zope Public License,
# Version 2.0 (ZPL). A copy of the ZPL should accompany t... | HomeRad/TorCleaner | wc/webgui/PageTemplates/__init__.py | Python | gpl-2.0 | 997 |
# coding=utf-8
# Copyright 2014 Pants project contributors (see CONTRIBUTORS.md).
# Licensed under the Apache License, Version 2.0 (see LICENSE).
from __future__ import (absolute_import, division, generators, nested_scopes, print_function,
unicode_literals, with_statement)
class Analysis(obje... | tejal29/pants | src/python/pants/backend/jvm/tasks/jvm_compile/analysis.py | Python | apache-2.0 | 1,537 |
#!/usr/bin/env python
#!/usr/bin/env python3
# download_ipc
# Written in 2013 by Chris Pavlina
# CC0 1.0 Universal
# This script downloads the IPC libraries from FreePCB and converts them to
# KiCad format using freepcb2kicad.
import zipfile
import tempfile
import shutil
import imp
import os
import shutil
VERSION ... | iromero91/kicad-pcblib | download_ipc.py | Python | cc0-1.0 | 5,859 |
# 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... | Xeralux/tensorflow | tensorflow/python/framework/meta_graph.py | Python | apache-2.0 | 38,066 |
# Copyright 2013 Embrane, Inc.
# All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance with the License. You may obtain
# a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by... | projectcalico/calico-neutron | neutron/plugins/embrane/base_plugin.py | Python | apache-2.0 | 17,449 |
from nose.tools import assert_equal, assert_raises, assert_not_equal
import networkx as nx
import io
import tempfile
import os
from networkx.readwrite.p2g import *
from networkx.testing import *
class TestP2G:
def setUp(self):
self.G = nx.Graph(name="test")
e = [('a', 'b'), ('b', 'c'), ('c', 'd')... | kenshay/ImageScript | ProgramData/SystemFiles/Python/Lib/site-packages/networkx/readwrite/tests/test_p2g.py | Python | gpl-3.0 | 1,394 |
from hkns.scraper import HKitem, max_id, get_bests, get_news, get_tops, log
from hkns.config import db
from celery import Celery
app = Celery()
app.config_from_object('hkns.config')
@app.on_after_configure.connect
def setup(sender, **kwargs):
sender.add_periodic_task(301.0, get_ranking.s())
sender.add_perio... | zuik/stuff | hkns/run.py | Python | mit | 1,351 |
from django.db import models
from django.db.models import Max
from questionnaire.models.base import BaseModel
from questionnaire.utils.model_utils import map_question_type_with, profiles_that_can_edit
class QuestionGroup(BaseModel):
question = models.ManyToManyField("Question", blank=False, null=False, related_n... | eJRF/ejrf | questionnaire/models/question_groups.py | Python | bsd-3-clause | 5,459 |
#! /usr/bin/env python
# -*- coding: utf-8 -*-
import logging
import os
from dateutil.relativedelta import relativedelta
from datetime import datetime, date
import click
from werkzeug.security import generate_password_hash
import newspipe.models
from newspipe.bootstrap import application, db
from newspipe.controller... | JARR-aggregator/JARR | newspipe/commands.py | Python | agpl-3.0 | 5,322 |
# -*- coding: utf8 -*-
import re
import requests
# copied from stackoverflow
HANUNI = re.compile(ur'^[⺀-⺙⺛-⻳⼀-⿕々〇〡-〩〸-〺〻㐀-䶵一-鿃豈-鶴侮-頻並-龎]+$', re.UNICODE)
def guoyu(uid, txt):
print u'UID %s 查國語萌典: %s' % (uid, txt)
r = 'undefined'
if HANUNI.match(txt):
get = requests.get('https://www.moedict.tw/a/%... | miaoski/amis-linebot | moe.py | Python | mit | 5,510 |
# Fermat's Last Theorem says that there are no integers a, b, and c such that
# a^n + b^n = c^n
# for any values of n greater than 2.
# 1. Write a function named check_fermat that takes four parameters-a, b, c
# and n-and that checks to see if Fermat's theorem holds. If n is greater than
# 2 and it turns out to be tr... | epequeno/ThinkPy-Solutions | ch05/5.01.py | Python | gpl-3.0 | 1,117 |
# OfflineIMAP initialization code
# Copyright (C) 2002-2007 John Goerzen
# <jgoerzen@complete.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 2 of the License, or
... | avsm/lifedb-plugins | IMAP/offlineimap/offlineimap/init.py | Python | gpl-2.0 | 7,684 |
from unittest.case import TestCase
from zsl import Config, inject
from zsl.application.containers.container import IoCContainer
from zsl.testing.db import IN_MEMORY_DB_SETTINGS
from zsl.testing.zsl import ZslTestCase, ZslTestConfiguration
from zsl.utils.redis_helper import Keymaker
from zsl.utils.testing import set_te... | AtteqCom/zsl | tests/utils/redis_helper_test.py | Python | mit | 2,174 |
#!/usr/bin/python -tt
# -*- coding: utf-8 -*-
import logging, logging.handlers
import pttlib
log_line_format = '%(asctime)s %(name)s %(levelname)s: %(message)s'
log_handlers = [
{
'log_level': logging.INFO,
'class': logging.StreamHandler,
'config': {'stream': None},
},
{
'... | sq6jnx/sr0wx.py | config.py | Python | apache-2.0 | 2,439 |
from pageobject import *
from context import *
from util import *
| imsardine/pyuia | pyuia/appium/__init__.py | Python | mit | 67 |
'''
LineByLineMerge.py
'''
import sys
import os
import codecs
FILE_MODE = 0
PROCESS_MODE = 0
class TxtFileProcessor:
def __init__(self):
self.filePaths = []
self.output_filename = "output.txt"
def load_from_folder_tree(self, expression = '.txt', folder_path = './'):
self.filePaths = ... | resolutedreamer/LineByLineMerge | src/LineByLineMerge.py | Python | apache-2.0 | 5,640 |
#!/usr/bin/python
# -*- coding: utf-8 -*-
"""
=========================================================
K-means Clustering
=========================================================
The plots display firstly what a K-means algorithm would yield
using three clusters. It is then shown what the effect of a bad
initializa... | florian-f/sklearn | examples/cluster/plot_cluster_iris.py | Python | bsd-3-clause | 2,573 |
"""Tests for local fab commands."""
from django.test import TestCase
from ..fabfile.local import check, flake8, jshint
class JshintTestCase(TestCase):
def test_command(self):
jshint()
class Flake8TestCase(TestCase):
def test_command(self):
flake8()
class CheckTestCase(TestCase):
def t... | bitmazk/django-development-fabfile | development_fabfile/tests/local_tests.py | Python | mit | 403 |
# coding: utf8
# try something like
from gluon.tools import Service
service = Service(globals())
def call():
session.forget()
return service()
response.generic_patterns = ['*.json', '*.html']
def get_project_id(project_name):
"Find the project and create a new one if it doesn't exists"
project =... | plcode7/rad2py | psp2py/controllers/services.py | Python | gpl-3.0 | 2,763 |
#!/usr/bin/python
# -*- coding: utf-8 -*-
from Tkinter import *
from r515.projector import *
import time
import ConfigParser
class Application(Frame):
def _ms_to_tc(self, ms):
#ms = int(ms)
seconds = ms / 1000
hours = seconds/3600
minutes = (seconds%3600)/60
seconds = secon... | DirkWilhelmi/mikro_tms | gui.py | Python | gpl-2.0 | 13,886 |
#!/usr/bin/python2
# Copyright (c) 2011 The Native Client Authors. All rights reserved.
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
"""
Process ppapi header files, e.g.
../ppapi/c/ppp_*h and
../ppapi/c/ppb_*h
And check whether they could cause pnacl calling con... | Lind-Project/native_client | pnacl/unsupported/interface_checker.py | Python | bsd-3-clause | 4,077 |
# -*- coding: utf-8 -*-
import logging
log = logging.getLogger(__name__)
class Light(object):
def __init__(self, light_id, bridge):
self.bridge = bridge
self.id = int(light_id)
self.json = None
self._update()
def __str__(self):
return '<%s %s "%s">' % (self.__class__.... | sebastianw/hue | hue/light.py | Python | mit | 2,671 |
from sympy import (
Abs, Dummy, Eq, Gt, Function, Mod,
LambertW, Piecewise, Poly, Rational, S, Symbol, Matrix,
asin, acos, acsc, asec, atan, atanh, cos, csc, erf, erfinv, erfc, erfcinv,
exp, log, pi, sin, sinh, sec, sqrt, symbols,
tan, tanh, atan2, arg,
Lambda, imageset, cot, acot, I, EmptySet, ... | ChristinaZografou/sympy | sympy/solvers/tests/test_solveset.py | Python | bsd-3-clause | 40,985 |
# -*- coding: utf-8 -*-
"""
A number of generic default fixtures to use with tests.
All model-related fixtures defined here require the database, and should imply as much by
including ``db`` fixture in the function resolution scope.
"""
from __future__ import absolute_import, print_function, unicode_literals
import o... | mvaled/sentry | src/sentry/utils/pytest/fixtures.py | Python | bsd-3-clause | 11,418 |
#!/usr/bin/python2.4
#
# Copyright 2008 Google 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 o... | ychen820/microblog | y/google-cloud-sdk/platform/google_appengine/lib/graphy/graphy/formatters.py | Python | bsd-3-clause | 6,836 |
'''
Created on 03.02.2016
@author: fabian
'''
import os
import collections
import csv
class ResultParser(object):
'''
classdocs
'''
def __init__(self, resultFolder):
'''
Constructor
'''
self.resultFolder = resultFolder
def getAllCommitsWithJacocoErro... | ftrautsch/testEvolution | parser/resultparser.py | Python | apache-2.0 | 2,937 |
# Imperialism remake
# Copyright (C) 2014-16 Trilarion
#
# 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 progra... | Trilarion/imperialism-remake | tools/process_and_merge_sound_effects.py | Python | gpl-3.0 | 846 |
#
# Instant Python
# $Id: tkCommonDialog.py 32140 2003-04-06 09:01:11Z rhettinger $
#
# base class for tk common dialogues
#
# this module provides a base class for accessing the common
# dialogues available in Tk 4.2 and newer. use tkFileDialog,
# tkColorChooser, and tkMessageBox to access the individual
# dialogs.
#... | xbmc/atv2 | xbmc/lib/libPython/Python/Lib/lib-tk/tkCommonDialog.py | Python | gpl-2.0 | 1,504 |
# -*- coding: utf-8 -*-
"""
shellstreaming.core.batch_queue
~~~~~~~~~~~~~~~~~~~~~~~~~~
:synopsis: Provides queue of output batch
Simple wrapper of internal queue class
"""
import Queue as q
import threading
class BatchQueue(object):
"""Queue of output batch"""
# [todo] - use ActiveMQ for pe... | laysakura/shellstreaming | shellstreaming/core/batch_queue.py | Python | apache-2.0 | 1,347 |
# coding=utf-8
#
# This file is part of Dragonfly.
# (c) Copyright 2007, 2008 by Christo Butcher
# Licensed under the LGPL.
#
# Dragonfly 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 ... | tylercal/dragonfly | dragonfly/language/ar/number.py | Python | lgpl-3.0 | 5,178 |
import unittest
import datetime
import json
from garage.formatters.json import encode_datetime
from garage.formatters.json import encode_mapping
from garage.formatters.json import join_encoders
from garage.timezones import TimeZone
from tests.utils import make_sorted_ordered_dict
class JsonTest(unittest.TestCase):... | clchiou/garage | py/garage/tests/formatters/test_json.py | Python | mit | 1,288 |
#!/usr/bin/env python3
#Copyright 2014 Carl Johnson IV
'''
command line rpn calculator
'''
#TODO: allow for function definition inline (ephemeral) and in config (persistent)
import argparse
import sys
from decimal import Decimal
from command import Command
from stack import Stack
COMMAND_DEFINITIONS = {
'p': Co... | soshtolsus/repoca | main.py | Python | gpl-3.0 | 1,181 |
import random
import numpy
from rdkit.ML.DecTree import ID3
def GenRandomExamples(nVars=10, randScale=0.3, bitProb=0.5, nExamples=500, seed=(0, 0),
addResults=1):
random.seed(seed[0])
varWeights = numpy.array([random.random() for _ in range(nVars)]) * randScale
examples = [None] * nExamp... | rvianello/rdkit | rdkit/ML/DecTree/randomtest.py | Python | bsd-3-clause | 1,028 |
# -*- coding: utf-8 -*-
# Part of Odoo. See LICENSE file for full copyright and licensing details.
{
'name': 'Point of Sale',
'version': '1.0.1',
'category': 'Point Of Sale',
'sequence': 20,
'summary': 'Touchscreen Interface for Shops',
'description': """
Quick and Easy sale process
===========... | chienlieu2017/it_management | odoo/addons/point_of_sale/__manifest__.py | Python | gpl-3.0 | 2,501 |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
# Triangle Project Code.
# Triangle analyzes the lengths of the sides of a triangle
# (represented by a, b and c) and returns the type of triangle.
#
# It returns:
# 'equilateral' if all sides are equal
# 'isosceles' if exactly 2 sides are equal
# 'scalene' ... | lorimccurry/python_koans | python3/koans/triangle.py | Python | mit | 1,034 |
#!/usr/bin/env python3
__author__ = 'DSOWASP'
| dianshen/python_day | day8/__init__.py | Python | apache-2.0 | 46 |
import plugnhack_extension
import datetime
import json
def enum(**named_values):
"""
enum represents a simulation of 'enum' data type in programming languages as
C, C++, Java etc.
enum type is available as a built-in type in Python 3.4, not in Python 2.7,
enum data type was backported to 2.7 thr... | DePierre/owtf | framework/http/proxy/plugnhack/client_message.py | Python | bsd-3-clause | 7,671 |
#!/usr/bin/env python3
# ./upload.py
# Upload archives to Google Drive.
import pyautogui, time, sys
if len(sys.argv) <= 1 or sys.argv[1] != '-f':
print('Adapt the script to the local context before running.'); exit()
pyautogui.PAUSE = 1.5
# go to web browser
pyautogui.hotkey('winleft', '1')
pyautogui.hotkey('... | Fornost461/drafts-and-stuff | Python/pyautogui/upload.py | Python | cc0-1.0 | 1,095 |
# -*- coding: utf-8 -*-
"""
Классы для взаимодействия конфига и GUI
"""
from abc import ABCMeta, abstractmethod
import wx
class BaseElement(metaclass=ABCMeta):
def __init__(self,
option,
control: wx.Control):
"""
option - опция из core.config
"""
... | unreal666/outwiker | src/outwiker/gui/preferences/configelements.py | Python | gpl-3.0 | 5,919 |
from vsg.rule_group import indent
from vsg import parser
from vsg import violation
from vsg.rules import utils as rules_utils
class token_indent(indent.Rule):
'''
Checks the case for words.
Parameters
----------
name : string
The group the rule belongs to.
identifier : string
... | jeremiah-c-leary/vhdl-style-guide | vsg/rules/token_indent.py | Python | gpl-3.0 | 3,272 |
class BigchainDBError(Exception):
"""Base class for BigchainDB exceptions."""
class CriticalDoubleSpend(BigchainDBError):
"""Data integrity error that requires attention"""
class CriticalDoubleInclusion(BigchainDBError):
"""Data integrity error that requires attention"""
class CriticalDuplicateVote(Bi... | stanta/darfchain | darfchain_docker_vagrant/bigchaindb/exceptions.py | Python | gpl-3.0 | 391 |
# Copyright 2016 Joel Dunham
#
# 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 writi... | jrwdunham/old | onlinelinguisticdatabase/controllers/morphologies.py | Python | apache-2.0 | 23,387 |
# This file is part of PyEMMA.
#
# Copyright (c) 2015, 2014 Computational Molecular Biology Group, Freie Universitaet Berlin (GER)
#
# PyEMMA 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 versi... | gph82/PyEMMA | pyemma/coordinates/data/data_in_memory.py | Python | lgpl-3.0 | 11,501 |
"""
Primitive replacement for requests to avoid extra dependency.
Avoids use of urllib2 due to lack of SNI support.
"""
from __future__ import absolute_import, print_function
import json
try:
from urllib import urlencode
except ImportError:
# noinspection PyCompatibility, PyUnresolvedReferences
from urll... | andreaso/ansible | test/runner/lib/http.py | Python | gpl-3.0 | 3,424 |
# coding=utf-8
# ------------------------------------
# Copyright (c) Microsoft Corporation.
# Licensed under the MIT License.
# ------------------------------------
import pytest
import functools
from devtools_testutils import recorded_by_proxy, set_bodiless_matcher
from azure.core.credentials import AzureKeyCredenti... | Azure/azure-sdk-for-python | sdk/formrecognizer/azure-ai-formrecognizer/tests/test_dac_analyze_custom_model_from_url.py | Python | mit | 8,155 |
from __future__ import absolute_import
import re
import string
from six import StringIO
try:
from string import maketrans
def bytes(chars):
return ''.join(map(chr, chars))
except ImportError:
maketrans = bytes.maketrans
from fulltext.util import BaseBackend
BUFFER_MAX = 1024 * 1024
# Transl... | btimby/fulltext | fulltext/backends/__bin.py | Python | mit | 1,365 |
'''
This script splits the files into train/dev and held-out test set,
depending on the CSV file that has the 'fold' information for each
document.
'''
import shutil
import sys
import csv
import os
inDir = sys.argv[1]
csvFile = sys.argv[2]
outDirTrain = sys.argv[3]
outDirTest = sys.argv[4]
fileEnding = sys.argv[5]
... | annefried/sitent | de.uni-saarland.coli.sitent/python-scripts/split.py | Python | apache-2.0 | 1,493 |
from hashlib import md5
import datetime, calendar
from flask import Flask, request, session, url_for, redirect, render_template, abort, g, flash
from werkzeug import check_password_hash, generate_password_hash
from google.appengine.ext import ndb
# create our little application :)
app = Flask(__name__)
app.config.fro... | dapangmao/minitwit | main.py | Python | apache-2.0 | 6,806 |
#!/usr/bin/python
# -*- coding: utf-8 -*-
#Library of common functions
import json, urllib2, re, time, datetime, sys, cgi, os, string, random, math
import locale
import base64
import hashlib
import sqlite3
from tempfile import TemporaryFile
from email.mime.text import MIMEText
from werkzeug.security import generate_... | nikb999/Helper-Functions | sql_functions.py | Python | mit | 8,879 |
# -*- coding: utf-8 -*-
# Generated by Django 1.10.2 on 2016-10-11 16:57
from __future__ import unicode_literals
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('staff', '0013_attendance_phone_status'),
]
operations = [
migrations.AlterF... | d120/pyophase | staff/migrations/0014_auto_20161011_1857.py | Python | agpl-3.0 | 612 |
#!/usr/bin/env python
#
###############################################################################
# Copyright (C) 2016 Cortney T. Buffington, N0MJS <n0mjs@me.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
... | n0mjs710/DMRlink | dmrlink.py | Python | gpl-3.0 | 52,232 |
import datetime
from django.conf import settings
from django.template.loader import render_to_string
from django.utils.safestring import mark_safe
from corehq.apps.crud.models import BaseAdminHQTabularCRUDManager
from corehq.apps.indicators.utils import get_namespace_name
from dimagi.utils.data.crud import CRUDFormRequ... | gmimano/commcaretest | corehq/apps/indicators/admin/crud.py | Python | bsd-3-clause | 5,171 |
class Unit(object):
event = "event"
grams = "g"
milligrams_per_deciliter = "mg/dL"
percent_of_basal = "percent"
units = "U"
units_per_hour = "U/hour"
| channemann/openaps-predict | openapscontrib/predict/models.py | Python | mit | 176 |
# Shared Goal Light resources
import time
from gpiozero import LED
goalLED = LED(17)
def triggerGoalLight(onTime=15):
goalLED.on()
time.sleep(onTime)
goalLED.off()
| kopertop/pi-goal-light | light.py | Python | unlicense | 168 |
from __future__ import absolute_import
from __future__ import unicode_literals
from __future__ import print_function
from __future__ import division
__all__ = ('autoclass', 'ensureclass')
from six import with_metaclass
from .jnius import (
JavaClass, MetaJavaClass, JavaMethod, JavaStaticMethod,
JavaField, Java... | KyleAMoore/KanjiNani | Android/.buildozer/android/platform/build/dists/KanjiNani/crystax_python/crystax_python/site-packages/jnius/reflect.py | Python | gpl-3.0 | 9,703 |
#! rhf gradient code
"""
This script calculates nuclear gradients of RHF Wavefunction using
gradients of one and two electron integrals obtained from PSI4.
Reference: "Derivative studies in Hartree--Fock and Moller--Plesset theories",
J. A. Pople, R. Krishnan, H. B. Schlegel and J. S. Binkley
DOI: 10.1002/qua.560160... | psi4/psi4 | tests/psi4numpy/rhf-gradient/input.py | Python | lgpl-3.0 | 5,395 |
from services.acservice.constants import *
class ACLicensingMixin(object):
"""
Mixin that defines methods to allow licensing of Audio Commons content.
Services are expected to override methods to adapt them to their own APIs.
"""
LICENSING_ACID_DOMAINS = list()
def conf_licensing(self, conf):... | AudioCommons/ac-mediator | services/acservice/licensing.py | Python | apache-2.0 | 2,657 |
"""
IceManager initializes Ice and implement all low level methods necessary to IceHMS
"""
import sys
import socket # to get ip address
import logging
import Ice
import IceGrid
import IceStorm
import icehms
class IceManager(object):
"""
create connection to ice
creates also usefull proxies and wrappe... | oroulet/icehms | src/python/icehms/icemanager.py | Python | gpl-3.0 | 14,695 |
from django.test import TestCase
from pxl.models import PXLBoardModel
from django.contrib.auth.models import User
import factory
class UserFactory(factory.django.DjangoModelFactory):
"""Set up a user."""
class Meta:
model = User
username = factory.Faker('user_name')
password = factory.Faker('p... | PXL-CF2016/pxl-master-server | pxl/tests/test_models.py | Python | mit | 1,169 |
#
# history.py - Changelog dialog for TortoiseHg
#
# Copyright 2007 Brad Schick, brad at gmail . com
# Copyright (C) 2007 TK Soh <teekaysoh@gmail.com>
#
import os
import pygtk
pygtk.require('2.0')
import gtk
import gobject
import pango
import StringIO
from mercurial.node import *
from mercurial import ui, hg, command... | tdjordan/tortoisegit | gitgtk/history.py | Python | gpl-2.0 | 23,107 |
import six
from .. import errors
from ..utils import format_environment, split_command
class TaskTemplate(dict):
"""
Describe the task specification to be used when creating or updating a
service.
Args:
container_spec (ContainerSpec): Container settings for containers
started as p... | jarv/cmdchallenge-site | lambda_src/runcmd/docker/types/services.py | Python | mit | 11,780 |
import sys
class Solution:
def lengthOfLastWord(self, s: str) -> int:
s = s.strip()
if not s:
return 0
last = s.split(' ')[-1]
return len(last)
if __name__ == "__main__":
sol = Solution()
input = sys.argv[1]
print(sol.lengthOfLastWord(input))
| shenfei/oj_codes | leetcode/python/n58_Length_of_Last_Word.py | Python | mit | 308 |
from django.db import models
from django.contrib.auth.models import User
class DocumentsExamined(models.Model):
user = models.ForeignKey(User)
title = models.CharField(max_length=200)
docid = models.CharField(max_length=30)
doc_num = models.CharField(max_length=30)
judgement = models.IntegerField(... | leifos/treconomics | treconomics_project/treconomics/models.py | Python | mit | 1,842 |
# -*- coding: utf-8 -*-
"""
javascript.timeago_filter
~~~~~~~~~~~~~~~~~~~~~~~~~
A Filter for the jQuery Timeago Plugin
http://flask.pocoo.org/snippets/49/
"""
import os
import sys
sys.path.insert(0, os.path.dirname(os.path.abspath(os.path.dirname(__file__))))
from flask import request, Response
from... | fengsp/flask-snippets | javascript/filter_for_timeago.py | Python | bsd-3-clause | 1,367 |
# -*- coding: utf-8 -*-
#
# regulations documentation build configuration file, created by
# sphinx-quickstart on Thu Jul 3 16:47:19 2014.
#
# 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
# autogenerated file.
#... | ascott1/regulations-site | docs/conf.py | Python | cc0-1.0 | 10,364 |
__author__ = 'Tom'
import math
from Tkinter import *
from assembly_line_scheduling import *
class AssemblyLineCanvas:
def __init__(self, root, als):
self.root = root
self.als = als
self.setup_root()
self.draw_factory()
def setup_root(self):
self.root.title("Assembly-li... | tjtrebat/algorithms | algorithms/dynamic_programming/assembly_line_scheduling/assembly_line_canvas.py | Python | gpl-2.0 | 6,751 |
# 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 ... | Francis-Liu/animated-broccoli | nova/tests/unit/compute/test_resource_tracker.py | Python | apache-2.0 | 60,776 |
# Copyright 2013-2020 Lawrence Livermore National Security, LLC and other
# Spack Project Developers. See the top-level COPYRIGHT file for details.
#
# SPDX-License-Identifier: (Apache-2.0 OR MIT)
class PyWebsockets(PythonPackage):
"""websockets is a library for building WebSocket servers and
clients in Pytho... | iulian787/spack | var/spack/repos/builtin/packages/py-websockets/package.py | Python | lgpl-2.1 | 700 |
#!/usr/bin/env python
# encoding: utf-8
from .user import User
| luke0922/celery_learning | application/models/__init__.py | Python | apache-2.0 | 63 |
import types
import functools
import unittest
from .agent import Config, Agent
# XXX bring into compliance with python 2.7 unittest api
class AssertRaisesContextManager(object):
def __init__(self, expected):
self.expected = expected
def __enter__(self):
return self
def __exit__(se... | p/webracer | webracer/testcase.py | Python | bsd-2-clause | 4,545 |
from kapteyn import maputils
from matplotlib import pyplot as plt
f = maputils.FITSimage("m101.fits")
mplim = f.Annotatedimage()
im = mplim.Image()
mplim.plot()
plt.show()
| kapteyn-astro/kapteyn | doc/source/EXAMPLES/mu_simple.py | Python | bsd-3-clause | 175 |
# based on
# PetersonNoiseModel.m
from __future__ import print_function
#from math import pi,log10
#import numpy as np
from numpy import pi,log10,array
def PetersonNoiseModel(Period,s=''):
#debug
#print "PetersonNoiseModel: ",Period,s
# initialize
accel = 0.0
veloc = 0.0
displ = 0.0
if... | geodynamics/specfem3d | EXAMPLES/noise_tomography/PetersonNoiseModel.py | Python | gpl-3.0 | 2,363 |
"""
Taiga integration for Zulip.
Tips for notification output:
*Emojis*: most of the events have specific emojis e.g.
- :notebook: - change of subject/name/description
- :chart_with_upwards_trend: - change of status
etc. If no there's no meaningful emoji for certain event, the defaults are used:
- :thought_balloon: -... | Vallher/zulip | zerver/views/webhooks/taiga.py | Python | apache-2.0 | 10,726 |
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
@author: Moritz
"""
import io
from collections import deque
import numpy as np
import cv2
import scipy
from image_processor import ProcessOutput
from goal_detector import GoalDetector
def main():
po = ProcessOutput()
gd = GoalDetector()
i = 0
videopa... | moritzschaefer/kickercam | src/kickercam/readstream.py | Python | gpl-3.0 | 975 |
# -*- coding: utf-8 -*-
"""
Copyright 2013-2014 Olivier Cortès <oc@1flow.io>
This file is part of the 1flow project.
1flow 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 versio... | 1flow/1flow | oneflow/core/models/reldb/item/email.py | Python | agpl-3.0 | 16,956 |
"A collection of individuals with fixed relationships"
import numpy as np
from pydigree.paths import fraternity
from pydigree.common import table
from pydigree.population import Population
class Pedigree(Population):
"A collection of individuals with fixed relationships"
def __init__(self, label=None):... | jameshicks/pydigree | pydigree/pedigree.py | Python | apache-2.0 | 8,471 |
# -*- coding: utf-8 -*-
# Generated by Django 1.10.1 on 2016-09-23 17:26
from __future__ import unicode_literals
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('rango', '0003_category_slug'),
]
operations = [
migrations.AlterField(
... | raghuraju/tango-with-django-110 | rango/migrations/0004_auto_20160923_1726.py | Python | mit | 442 |
from pixie.vm.object import Object, Type, safe_invoke
from pixie.vm.primitives import true
import rpython.rlib.rthread as rthread
from pixie.vm.primitives import nil
import rpython.rlib.rgil as rgil
from pixie.vm.code import as_var
import pixie.vm.rt as rt
class Bootstrapper(object):
def __init__(self):
se... | pixie-lang/pixie | pixie/vm/threads.py | Python | gpl-3.0 | 2,030 |
# -*- coding: utf-8 -*-
##
## This file is part of Invenio.
## Copyright (C) 2005, 2006, 2007, 2008, 2009, 2010, 2011 CERN.
##
## Invenio 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 t... | GRArmstrong/invenio-inspire-ops | modules/docextract/lib/refextract_api.py | Python | gpl-2.0 | 10,884 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.