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 |
|---|---|---|---|---|---|
from django.db import models
from django.contrib.auth.models import User
class Profile(models.Model):
user = models.OneToOneField(User, on_delete=models.CASCADE)
bio = models.TextField(max_length=500, blank=True)
location = models.CharField(max_length=30, blank=True)
birth_date = models.DateField(null... | pyladieshre/pyladies | profiles/models.py | Python | mit | 627 |
#!/usr/bin/env python
"""
Copyright (c) 2012, Indiana University School of Medicine
All rights reserved.
Author: Liwei Li
Updated 2014/02/20: Combine into 1 file and fixes for OSG-XSEDE
Last Updated Date: 02/20/2014
"""
import sys
import os
import math
from collections import deque
"""Class ChemKi... | pegasus-isi/SPLINTER-Workflow | genfet.py | Python | apache-2.0 | 21,728 |
# This file is part of Moksha.
# Copyright (C) 2008-2010 Red Hat, Inc.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required ... | lmacken/moksha | setup.py | Python | apache-2.0 | 3,088 |
"""
Copyright (c) 2012-2020 RockStor, Inc. <http://rockstor.com>
This file is part of RockStor.
RockStor is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published
by the Free Software Foundation; either version 2 of the License,
or (at your option) any la... | phillxnet/rockstor-core | src/rockstor/storageadmin/views/rockon_port.py | Python | gpl-3.0 | 1,426 |
#!/usr/bin/env python
# This example demonstrates the use of glyphing. We also use a mask filter
# to select a subset of points to glyph.
import vtk
from vtk.util.misc import vtkGetDataRoot
VTK_DATA_ROOT = vtkGetDataRoot()
# Read a data file. This originally was a Cyberware laser digitizer scan
# of Fran J... | hlzz/dotfiles | graphics/VTK-7.0.0/Examples/VisualizationAlgorithms/Python/spikeF.py | Python | bsd-3-clause | 2,966 |
import sys
import os
def create():
return {}
| gtoonstra/bite | bite/context.py | Python | mit | 51 |
from os import environ, path
import sys
import json
import sqlite3
import time
from datetime import date as dt, datetime
sys.path.append('/home/pvernier/code/python/elpaso')
environ['DJANGO_SETTINGS_MODULE'] = 'elpaso.settings'
from jobs.models import Contrat
from jobs.models import Month, Year, Week
def create_json2... | pvernier/elpaso | utils/modules/test.py | Python | gpl-3.0 | 18,163 |
import logging
from django.template import Context, Engine, Variable, VariableDoesNotExist
from django.test import SimpleTestCase, ignore_warnings
from django.utils.deprecation import RemovedInDjango21Warning
class TestHandler(logging.Handler):
def __init__(self):
super().__init__()
self.log_reco... | tysonclugg/django | tests/template_tests/test_logging.py | Python | bsd-3-clause | 4,731 |
"""Classify changes in Ansible code."""
from __future__ import absolute_import, print_function
import os
from lib.target import (
walk_module_targets,
walk_integration_targets,
walk_units_targets,
walk_compile_targets,
walk_sanity_targets,
)
from lib.util import (
display,
)
def categorize... | chrismeyersfsu/ansible | test/runner/lib/classification.py | Python | gpl-3.0 | 11,206 |
#
# Licensed to the Apache Software Foundation (ASF) under one
# or more contributor license agreements. See the NOTICE file
# distributed with this work for additional information
# regarding copyright ownership. The ASF licenses this file
# to you under the Apache License, Version 2.0 (the
# "License"); you may not... | wooga/airflow | tests/providers/google/cloud/operators/test_gcs_to_sftp_system.py | Python | apache-2.0 | 2,272 |
#
# Copyright 2015 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 or agreed to in writi... | google/strabo | client/python/strabo/strabo_object.py | Python | apache-2.0 | 2,416 |
"""
dj-stripe Sync Method Tests.
"""
import contextlib
from copy import deepcopy
from unittest.mock import patch
from django.contrib.auth import get_user_model
from django.test.testcases import TestCase
from stripe.error import InvalidRequestError
from djstripe.models import Customer
from djstripe.sync import sync_su... | dj-stripe/dj-stripe | tests/test_sync.py | Python | mit | 2,460 |
'''CTS: Cluster Testing System: Main module
Classes related to testing high-availability clusters...
'''
__copyright__='''
Copyright (C) 2000, 2001 Alan Robertson <alanr@unix.sh>
Licensed under the GNU GPL.
'''
#
# This program is free software; you can redistribute it and/or
# modify it under the terms of the GNU ... | ClusterLabs/pacemaker-1.0 | cts/CTS.py | Python | gpl-2.0 | 46,504 |
# import the basic python packages we need
import os
import sys
import tempfile
import pprint
import traceback
# disable python from generating a .pyc file
sys.dont_write_bytecode = True
# change me to the path of pytan if this script is not running from EXAMPLES/PYTAN_API
pytan_loc = "~/gh/pytan"
pytan_static_path =... | tanium/pytan | BUILD/doc/source/examples/invalid_ask_manual_question_too_many_parameter_blocks_code.py | Python | mit | 2,426 |
def genSubsets(L):
'''
L: list
Returns: all subsets of L
'''
# base case
if len(L) == 0:
return [[]]
# recursive block
# all the subsets of smaller + all the subsets of smaller combined with extra = all subsets of L
extra = L[0:1]
smaller = genSubsets(L[1:])
combine ... | medifle/python_6.00.1x | defRecurGenSubsets.py | Python | mit | 409 |
"""
[07/01/13] Challenge #131 [Easy] Who tests the tests?
https://www.reddit.com/r/dailyprogrammer/comments/1heozl/070113_challenge_131_easy_who_tests_the_tests/
# [](#EasyIcon) *(Easy)*: Who tests the tests?
[Unit Testing](http://en.wikipedia.org/wiki/Unit_testing) is one of the more basic, but effective, tools for ... | DayGitH/Python-Challenges | DailyProgrammer/DP20130701A.py | Python | mit | 2,368 |
from __future__ import generators, print_function, unicode_literals
from importlib import import_module
from itertools import chain, combinations
# from nltk.util import ngrams
from colorama import Fore, init
init(autoreset=True)
def pad_sequence(seq, n, pad_left=False, pad_right=False, pad_sym=None):
if pad_le... | jawahar273/practNLPTools-lite | pntl/utils.py | Python | mit | 1,987 |
# Copyright 2019 DeepMind Technologies Limited
#
# 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 agr... | deepmind/open_spiel | open_spiel/python/examples/is_mcts_exploitability.py | Python | apache-2.0 | 3,606 |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
"""
pygimli integration function
"""
from math import pi, sqrt # , sin, cos
import pygimli as pg
class funct:
def __init__(self, f):
self.f = f
def __call__(self, vec):
ret = pg.RVector(len(vec))
for i, arg in enumerate(vec):
... | KristoferHellman/gimli | tests/basics/integrate.py | Python | gpl-3.0 | 3,454 |
# Copyright 2021 Google LLC
#
# 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, ... | google-cloud-japan/gcp-getting-started-cloudrun | src/sumservice/main.py | Python | apache-2.0 | 3,382 |
import collections
import dataclasses
import fractions
import itertools
import logging
import queue
import time
import traceback
from typing import Optional, Tuple
from .. import conversions
from .ephemera import (
CallbackCommand,
CallbackEvent,
ChangeCommand,
ChangeEvent,
ClockContext,
ClockS... | josiah-wolf-oberholtzer/supriya | supriya/clocks/bases.py | Python | mit | 25,442 |
from django.test import TestCase
from django.test import Client
class RegisterTestCase(TestCase):
def test_register(self):
c = Client()
# on success redirects to /
response = c.post('/accounts/register/', {
'username': 'asdas',
'password1': 'asdasdasd12',
... | asb29/Redundant | auth/tests/test_views.py | Python | mit | 1,446 |
from data_collection.management.commands import BaseXpressDemocracyClubCsvImporter
class Command(BaseXpressDemocracyClubCsvImporter):
council_id = 'E06000030'
addresses_name = 'parl.2017-06-08/Version 1/Democracy_Club__08June2017 (11).tsv'
stations_name = 'parl.2017-06-08/Version 1/Democracy_Club__08June20... | chris48s/UK-Polling-Stations | polling_stations/apps/data_collection/management/commands/import_swindon.py | Python | bsd-3-clause | 394 |
"""Module for sum pairs problem."""
def sum_pairs(ints, s):
"""Pair to sum up to s."""
lookup = {}
for n, i in enumerate(ints):
lookup.setdefault(i, []).append(n)
options = []
for k in lookup:
if s - k in lookup:
if s - k == k and len(lookup[s - k]) < 2:
... | clair3st/code-katas | src/sum_pairs.py | Python | mit | 854 |
from collect import get_data
from graph import mkgraph
from subprocess import call
mkgraph(list(get_data()), 'graph.png')
call(['xloadimage', '-onroot', 'graph.png'])
| orlenko/TimeTracking | 15min/script/Timesheet/timesheet/run_timesheet.py | Python | apache-2.0 | 169 |
# -*- coding: utf-8 -*-
from __future__ import print_function
from __future__ import unicode_literals
from __future__ import division
import json
import re
from modgrammar import Grammar, OPTIONAL, G, WORD, OR, ParseError
from django import template
from django.template.loader import get_template
from django.core.exc... | kdeloach/otm-core | opentreemap/treemap/templatetags/form_extras.py | Python | gpl-3.0 | 18,161 |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
from decimal import Decimal
import datetime as dt
import calendar
import json
import os
def decimal2(number, n_decimal=2):
return Decimal(number).quantize(Decimal(10) ** -n_decimal)
def print_decimal(x):
if none_if_blank(x) is None: x = 0
return '{0:.2f}... | dkmatt0/banking-alpha | app/common.py | Python | agpl-3.0 | 7,131 |
# -*- coding: utf-8 -*-
"""The Apple Framework builds require their own customization"""
import logging
import os
import struct
import subprocess
from abc import ABCMeta, abstractmethod
from textwrap import dedent
from six import add_metaclass, text_type
from virtualenv.create.via_global_ref.builtin.ref import ExePat... | pypa/virtualenv | src/virtualenv/create/via_global_ref/builtin/cpython/mac_os.py | Python | mit | 14,421 |
from oscar.app import Shop
from apps.checkout.app import application as checkout_app
class PayPalShop(Shop):
checkout_app = checkout_app
application = PayPalShop()
| phedoreanu/django-oscar-paypal | sandbox/apps/app.py | Python | bsd-3-clause | 173 |
# pyOCD debugger
# Copyright (c) 2019 Arm Limited
# COpyright (c) 2021 Chris Reed
# SPDX-License-Identifier: Apache-2.0
#
# 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.apac... | pyocd/pyOCD | pyocd/core/target_delegate.py | Python | apache-2.0 | 6,921 |
# -*- coding: utf-8 -*-
#
# Sphinx RTD theme demo documentation build configuration file, created by
# sphinx-quickstart on Sun Nov 3 11:56:36 2013.
#
# This file is executed with the current directory set to its containing dir.
#
# Note that not all possible configuration values are present in this
# autogenerated fi... | abadger/stellarmagnate | docs/_themes/sphinx_rtd_theme/demo_docs/source/conf.py | Python | agpl-3.0 | 8,386 |
from .auth.errors import AuthError, AuthzError
class UserError(Exception):
"""
User error.
"""
class ConfigurationError(Exception):
"""
Configuration error.
"""
class IndexdUnexpectedError(Exception):
"""
Unexpected Error
"""
def __init__(self, code=500, message="Unexpecte... | LabAdvComp/indexd | indexd/errors.py | Python | apache-2.0 | 392 |
#!/usr/bin/python
#
# Copyright 2018-2021 Polyaxon, 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 ... | polyaxon/polyaxon | core/tests/test_polyflow/test_builds/test_builds.py | Python | apache-2.0 | 2,179 |
COUNTRY_CODEMAP = {
'afghanistan': 'AF',
'aland islands !åland islands': 'AX',
'albania': 'AL',
'algeria': 'DZ',
'american samoa': 'AS',
'andorra': 'AD',
'angola': 'AO',
'anguilla': 'AI',
'antarctica': 'AQ',
'antigua and barbuda': 'AG',
'argentina': 'AR',
'armenia': 'AM',... | asishm/tenor_gifapi | tenor_api/static.py | Python | mit | 10,798 |
'''
Created on Aug 5, 2013
@author: dmitchell
'''
import unittest
import uuid
from xmodule.modulestore import Location
from xmodule.modulestore.locator import BlockUsageLocator
from xmodule.modulestore.exceptions import ItemNotFoundError
from xmodule.modulestore.loc_mapper_store import LocMapperStore
from mock import ... | TangXT/GreatCatMOOC | common/lib/xmodule/xmodule/modulestore/tests/test_location_mapper.py | Python | agpl-3.0 | 18,244 |
def valeur_absolue(n):
if n >= 0 :
return n
else:
return -n
| TGITS/programming-workouts | erri/python/easter_test_2021/trial1.py | Python | mit | 85 |
from typing import List, TextIO
def shuffle(instructions: List[str], deck_size: int) -> List[int]:
deck = list(range(0, deck_size))
for instruction in instructions:
if "new stack" in instruction:
deck = list(reversed(deck))
continue
parts = instruction.split(" ")
... | bertptrs/adventofcode | 2019/aoc2019/day22.py | Python | mit | 2,023 |
"""
Support for Abode Security System sensors.
For more details about this platform, please refer to the documentation at
https://home-assistant.io/components/sensor.abode/
"""
import logging
from homeassistant.components.abode import AbodeDevice, DOMAIN as ABODE_DOMAIN
from homeassistant.const import (
DEVICE_CL... | tinloaf/home-assistant | homeassistant/components/sensor/abode.py | Python | apache-2.0 | 2,505 |
# Copyright (c) 2016 Red Hat, 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 require... | mahak/cinder | cinder/tests/unit/objects/test_cleanable.py | Python | apache-2.0 | 17,487 |
from django.contrib.auth.models import User, Group
from rest_framework import serializers
from apps.spr.models import Usuario, Institucion, Nivel, Entidad, UnidadJerarquica, AvanceIndicador
class UsuarioSerializer(serializers.HyperlinkedModelSerializer):
class Meta:
model = Usuario
fields = ('id'... | melizeche/pySTP | apps/spr/serializers.py | Python | gpl-3.0 | 2,344 |
# Copyright 2013 Nebula Inc.
#
# Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance with the License. You may obtain
# a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to... | redhat-openstack/python-openstackclient | openstackclient/tests/common/test_module.py | Python | apache-2.0 | 4,217 |
from pybindgen import Module, FileCodeSink, param, retval, cppclass, typehandlers
import pybindgen.settings
import warnings
class ErrorHandler(pybindgen.settings.ErrorHandler):
def handle_error(self, wrapper, exception, traceback_):
warnings.warn("exception %r in wrapper %s" % (exception, wrapper))
... | nsnam/ns-3-dev-git | src/propagation/bindings/modulegen__gcc_LP64.py | Python | gpl-2.0 | 277,968 |
# encoding: utf-8
import datetime
from django.utils.safestring import mark_safe
from django.utils import formats
from django.utils.dateformat import format
from django.utils.text import force_text
# from django.utils.timezone import localtime
def format_date_range(
start_date=None,
end_date=None,
start_hou... | dalou/django-cargo | cargo/utils/date/format.py | Python | bsd-3-clause | 5,183 |
#!/usr/bin/env python
# SConsBuildFramework - Copyright (C) 2009, 2013, Nicolas Papier.
# Distributed under the terms of the GNU General Public License (GPL)
# as published by the Free Software Foundation.
# Author Nicolas Papier
# ok for clx.y
import os
sofaUse = UseRepository.gethUse('sofa')
print (... | npapier/sbf | pak/mkdb/glew.py | Python | gpl-3.0 | 873 |
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.db import models
class SimpleModel(models.Model):
field = models.IntegerField()
manager = models.manager.Manager()
class Book(models.Model):
title = models.CharField(max_length=250)
is_published = models.BooleanField(defaul... | diegoguimaraes/django | tests/check_framework/models.py | Python | bsd-3-clause | 460 |
from werkzeug.security import generate_password_hash, check_password_hash
from itsdangerous import TimedJSONWebSignatureSerializer as Serializer
from flask import current_app
from flask.ext.login import UserMixin
from .. import db, login_manager
class User(UserMixin, db.Model):
__tablename__ = 'users'
id = db... | No7777/webserver | app/user/models.py | Python | gpl-3.0 | 2,832 |
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('contenttypes', '0002_remove_content_type_name'),
('sites', '0001_initial'),
]
operations = [
migrations.CreateModel(... | MrSenko/Nitrate | tcms/core/contrib/linkreference/migrations/0001_initial.py | Python | gpl-2.0 | 1,324 |
"""Install JSON Update"""
# pylint: disable=R0401
# standard library
import os
from typing import TYPE_CHECKING, Optional
if TYPE_CHECKING: # pragma: no cover
from .install_json import InstallJson
class InstallJsonUpdate:
"""Update install.json file with current standards and schema."""
def __init__(se... | ThreatConnect-Inc/tcex | tcex/app_config/install_json_update.py | Python | apache-2.0 | 6,291 |
# Licensed under a 3-clause BSD style license - see LICENSE.rst
"""
=============
CadcClass TAP plus
=============
"""
from io import BytesIO
from urllib.parse import urlsplit, parse_qs
import os
import sys
from astropy.table import Table as AstroTable
from astropy.io.fits.hdu.hdulist import HDUList
from astropy.io.v... | ceb8/astroquery | astroquery/cadc/tests/test_cadctap.py | Python | bsd-3-clause | 16,419 |
# coding: utf-8
"""
This module contains commands to interact with UI via console
Commands included:
Browse
------
A command to open a browser session using the configured preferences from
`robottelo.properties` file and provide an interactive shell to play with
browser session::
$ manage ui browse <entity>
... | ares/robottelo | robottelo/commands/ui.py | Python | gpl-3.0 | 4,653 |
# -*- coding: utf-8 -*-
from __future__ import print_function
import click
import os
import re
import face_recognition.api as face_recognition
import multiprocessing
import sys
import itertools
def print_result(filename, location):
top, right, bottom, left = location
print("{},{},{},{},{}".format(filename, to... | ageitgey/face_recognition | face_recognition/face_detection_cli.py | Python | mit | 2,604 |
"""
Creates few different plots from the focus data.
HISTORY:
Created on Sep 10, 2009
Added to the repository on Dec 3, 2010
:author: Sami-Matias Niemi
:todo: 1) change focus trend since mirror move to two x axis mode (one with date)
2) Create a new plot: all focus data since last mirror move, fit functions
"... | sniemi/SamPy | focus/FocusPlots.py | Python | bsd-2-clause | 57,290 |
from datetime import datetime
from bson import ObjectId
from pymongo import ASCENDING, DESCENDING, IndexModel
from aiomongodel import Document, EmbeddedDocument
from aiomongodel.fields import (
AnyField, StrField, IntField, FloatField, BoolField, DateTimeField,
ObjectIdField, EmbDocField, ListField, RefField,... | ilex/aiomongodel | tests/models.py | Python | mit | 1,697 |
# coding=utf-8
# Author: Nic Wolfe <nic@wolfeden.ca>
#
# URL: https://sickchill.github.io
#
# This file is part of SickChill.
#
# SickChill 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 t... | eleonrk/SickRage | sickbeard/classes.py | Python | gpl-3.0 | 8,008 |
__all__ = ('HuskError', 'HuskConfigError')
class HuskError(Exception):
pass
class HuskConfigError(HuskError):
pass
| husk/husk | husk/exceptions.py | Python | bsd-2-clause | 127 |
import numpy as np
from sklearn.linear_model import LogisticRegression
from sklearn.tree import DecisionTreeClassifier
from sklearn.ensemble import RandomForestClassifier, GradientBoostingClassifier
from sklearn.neighbors import KNeighborsClassifier
from sklearn.naive_bayes import GaussianNB
from utils import binariz... | diogo149/CauseEffectPairsChallenge | code/classification_machines.py | Python | gpl-3.0 | 1,928 |
"""Shared class to maintain Plex server instances."""
import logging
import ssl
import time
from urllib.parse import urlparse
from plexapi.client import PlexClient
from plexapi.exceptions import BadRequest, NotFound, Unauthorized
import plexapi.myplex
import plexapi.playqueue
import plexapi.server
from requests import... | kennedyshead/home-assistant | homeassistant/components/plex/server.py | Python | apache-2.0 | 25,205 |
'''
Alcatel-Lucent SROS support
'''
from netmiko.ssh_connection import SSHConnection
import re
class AlcatelSrosSSH(SSHConnection):
'''
SROS support
'''
def session_preparation(self):
self.disable_paging(command="environment no more\n")
self.set_base_prompt()
def enable(self):
... | jumpojoy/netmiko | netmiko/alcatel/alcatel_sros_ssh.py | Python | mit | 822 |
# Natural Language Toolkit: Stemmer Interface
#
# Copyright (C) 2001-2015 NLTK Project
# Author: Trevor Cohn <tacohn@cs.mu.oz.au>
# Edward Loper <edloper@gmail.com>
# Steven Bird <stevenbird1@gmail.com>
# URL: <http://nltk.org/>
# For license information, see LICENSE.TXT
class StemmerI(object):
"""... | Reagankm/KnockKnock | venv/lib/python3.4/site-packages/nltk/stem/api.py | Python | gpl-2.0 | 781 |
# -*- coding: utf-8 -*-
#
# synergy-maps documentation build configuration file, created by
# sphinx-quickstart on Thu Jul 16 18:43:22 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
# autogenerated file.
... | richlewis42/synergy-maps | docs/source/conf.py | Python | mit | 8,391 |
# Copyright 2016 Twitter. 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 applicable law or agree... | cliffyg/heron | heron/tracker/src/python/handlers/exceptionsummaryhandler.py | Python | apache-2.0 | 4,918 |
#!/usr/bin/python
# Copyright 2015 Google 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 a... | google/corgi | disttools/push_package.py | Python | apache-2.0 | 1,803 |
"""
Display class
"""
__author__ = """\n""".join(['Jeffrey Schmidt (jschmid1@binghamton.edu',
'Benjamin Bush (benjaminjamesbush@gmail.com)',
'Hiroki Sayama (sayama@binghamton.edu)'])
__all__ = ['addInputValues','addExperimentalValues','addInputXValueList','addIn... | schmidtj/PyGNA | PyGNA/Display.py | Python | bsd-3-clause | 15,679 |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
"""General utilities for image processing and filtering"""
import os
import sys
import json
import time
import shutil
import subprocess
import logging
logger = logging.getLogger(__name__)
def retrieve_json_secret(key):
"""Retrieves a secret in JSON format from pas... | anjos/popster | popster/utils.py | Python | gpl-3.0 | 5,852 |
#* This file is part of the MOOSE framework
#* https://www.mooseframework.org
#*
#* All rights reserved, see COPYRIGHT for full restrictions
#* https://github.com/idaholab/moose/blob/master/COPYRIGHT
#*
#* Licensed under LGPL 2.1, please see LICENSE for details
#* https://www.gnu.org/licenses/lgpl-2.1.html
import sys
... | harterj/moose | python/peacock/ExodusViewer/plugins/CameraPlugin.py | Python | lgpl-2.1 | 3,400 |
from __future__ import print_function, division, absolute_import
import unittest
from cu2qu.pens import Cu2QuPen, Cu2QuPointPen
from . import CUBIC_GLYPHS, QUAD_GLYPHS
from .utils import DummyGlyph, DummyPointGlyph
from .utils import DummyPen, DummyPointPen
from fontTools.misc.loggingTools import CapturingLogHandler
f... | googlefonts/cu2qu | tests/pens_test.py | Python | apache-2.0 | 13,027 |
from .helper import *
import open_cp.gui.predictors.retro as retro
import open_cp.retrohotspot
def test_RetroHotspot(model, project_task, analysis_model, grid_task):
provider = retro.RetroHotspot(model)
assert provider.settings_string == "60 Days, Quartic(200m)"
standard_calls(provider, project_task, anal... | QuantCrimAtLeeds/PredictCode | tests/gui/predictors/retro_test.py | Python | artistic-2.0 | 5,126 |
#!/usr/bin/env python
"""
From namd logs file(s), finds key output such as system energy and temperature
"""
from __future__ import print_function
import argparse
import os
import sys
import re
from md_utils.md_common import (InvalidDataError, warning, file_rows_to_list, IO_ERROR, GOOD_RET, INPUT_ERROR,
... | cmayes/md_utils | md_utils/namd_log_proc.py | Python | bsd-3-clause | 5,442 |
import os.path
from django.core.management import call_command
from django_nose.tools import (
assert_equal,
assert_false,
assert_is_none,
assert_raises,
assert_true,
)
from django.db.models import Q
from django.test.utils import override_settings
from mock import call, Mock, patch
from pontoon.b... | participedia/pontoon | pontoon/base/tests/test_models.py | Python | bsd-3-clause | 57,587 |
# -*- coding: utf-8 -*-
# © <YEAR(S)> <AUTHOR(S)>
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html).
from openerp import fields, models
class MrpProduction(models.Model):
_inherit = 'mrp.production'
sale_id = fields.Many2one(
'sale.order',
string='Sale order',
copy=... | Gebesa-Dev/Addons-gebesa | sale_order_everywhere/models/mrp_production.py | Python | agpl-3.0 | 716 |
# encoding: utf8
# Copyright 2011-2017 Facundo Batista, Nicolás César
# All Rigths Reserved
"""Backend functionality for Kilink."""
import collections
import datetime
import logging
import operator
import uuid
import zlib
from sqlalchemy import Column, DateTime, String, LargeBinary
from sqlalchemy.ext.declarative i... | matibarriento/kilink | kilink/backend.py | Python | gpl-3.0 | 6,515 |
# -*- coding: utf-8 -*-
# Copyright 2017-2019 Mike Fährmann
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License version 2 as
# published by the Free Software Foundation.
"""Extract images from https://warosu.org/"""
from .common import Extra... | mikf/gallery-dl | gallery_dl/extractor/warosu.py | Python | gpl-2.0 | 4,021 |
# -*- coding: utf-8 -*-
from trytond.model import ModelView, ModelSQL, ModelSingleton, fields
from trytond.pool import PoolMeta
__all__ = ['Configuration', 'SaleConfiguration']
__metaclass__ = PoolMeta
class Configuration(ModelSingleton, ModelSQL, ModelView):
"Configuration"
__name__ = 'gift_card.configurati... | tarunbhardwaj/trytond-gift-card | configuration.py | Python | bsd-3-clause | 1,092 |
#
# Licensed to the Apache Software Foundation (ASF) under one
# or more contributor license agreements. See the NOTICE file
# distributed with this work for additional information
# regarding copyright ownership. The ASF licenses this file
# to you under the Apache License, Version 2.0 (the
# "License"); you may not... | mrkm4ntr/incubator-airflow | tests/providers/vertica/hooks/test_vertica.py | Python | apache-2.0 | 3,840 |
# Copyright (C)
# All rights reserved.
# See LICENSE.txt for details.
# Author: Brian Maranville, Christopher Metting
#Starting Date:8/23/2010
from numpy import arctan2,indices,array,ma,pi,amin,amax,nan,degrees, isfinite
import matplotlib,wx
from matplotlib.widgets import RectangleSelector
from matplotlib.blocking_i... | reflectometry/osrefl | osrefl/viewers/wxzslice.py | Python | bsd-3-clause | 12,470 |
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
from datetime import datetime, timedelta
from unittest import TestCase, skipIf
try:
import pytz
except ImportError:
pytz = None
from django import forms
from django.conf import settings
from django.contrib import admin
from django.contrib.admin ... | jarvys/django-1.7-jdb | tests/admin_widgets/tests.py | Python | bsd-3-clause | 50,733 |
###
# Copyright 2011 Diamond Light Source Ltd.
#
# 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 agr... | erwindl0/python-rpc | org.eclipse.triquetrum.python.service/scripts/scisoftpy/python/pycomparisons.py | Python | epl-1.0 | 1,127 |
# Copyright (c) 2010-2011 OpenStack, LLC.
#
# 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 ... | rackerlabs/sloggingo | test_slogging/unit/test_compressing_file_reader.py | Python | apache-2.0 | 1,258 |
#!/usr/bin/env python
#
# Copyright (c) 2011-2013, Shopkick Inc.
# All rights reserved.
#
# 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/.
#
# ---
# Author: John Egan <jw... | shopkick/flawless | tests/server/service_test.py | Python | mpl-2.0 | 29,269 |
# Copyright 2017 The GiR @ AAMU 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... | lutrellja15/gir_app_labs_at_aamu | gir_app_labs_at_aamu.py | Python | apache-2.0 | 1,813 |
# -*- encoding: utf-8 -*-
from __future__ import absolute_import
from .esipy import esiapp
# universe / api endpoints
get_status = esiapp.get_v1_swagger.op['get_status']
get_industry_systems = esiapp.get_v1_swagger.op['get_industry_systems']
get_markets_prices = esiapp.get_v1_swagger.op['get_markets_prices']
get_mark... | Kyria/LazyBlacksmith | lazyblacksmith/extension/esipy/operations.py | Python | bsd-3-clause | 897 |
input = [1, 5, 2,
2, 4, 7,
3, 6, 9]
size = 3
input = [0, 2, 1, 3,
2, 1, 0, 4,
3, 3, 3, 3,
5, 5, 2, 1]
size = 4
input = [1, 0, 2, 5, 8,
2, 3, 4, 7, 9,
3, 5, 7, 8, 9,
1, 2, 5, 4, 2,
3, 3, 5, 2, 1]
size = 5
output = [0] * len... | jakubczaplicki/projecteuler | farmers/farmers.py | Python | mit | 1,906 |
# orm/properties.py
# Copyright (C) 2005-2016 the SQLAlchemy authors and contributors
# <see AUTHORS file>
#
# This module is part of SQLAlchemy and is released under
# the MIT License: http://www.opensource.org/licenses/mit-license.php
"""MapperProperty implementations.
This is a private module which defines the beh... | sandan/sqlalchemy | lib/sqlalchemy/orm/properties.py | Python | mit | 10,482 |
#!/usr/bin/env python
# Read DAKOTA parameters file (aprepro or standard format) and call a
# Python module rosenbrock for analysis. Uses same rosenbrock.py as
# linked case for consistency.
# DAKOTA will execute this script as
# rosenbrock_bb.py params.in results.out
# so sys.argv[1] will be the parameters file a... | pemryan/DAKOTA | examples/script_interfaces/Python/rosenbrock_bb.py | Python | lgpl-2.1 | 4,283 |
"""
Conversion functions.
"""
# adapted from the UFO spec
def convertUFO1OrUFO2KerningToUFO3Kerning(kerning, groups):
# gather known kerning groups based on the prefixes
firstReferencedGroups, secondReferencedGroups = findKnownKerningGroups(groups)
# Make lists of groups referenced in kerning pairs.
f... | adrientetar/robofab | Lib/ufoLib/converters.py | Python | bsd-3-clause | 10,633 |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
#
# king_phisher/__init__.py
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions are
# met:
#
# * Redistributions of source code must retain the above copyright
# notice, this li... | securestate/king-phisher | king_phisher/__init__.py | Python | bsd-3-clause | 1,647 |
"""EBLUP for the unit level model.
This module implements the basic EBLUP unit level model. The functionalities are organized in
classes. Each class has three main methods: *fit()*, *predict()* and *bootstrap_mse()*.
Linear Mixed Models (LMM) are the core underlying statistical framework used to model the
hierarchi... | survey-methods/samplics | src/samplics/sae/eblup_unit_model.py | Python | mit | 22,567 |
# Here's some strange new stuff
days = "Mon Tue Wed Thu Fri Sat Sun"
months = "Jan\nFeb\nMar\nApr\nMay\nJun\nJul\nAug"
print "here are the days: ", days
print "here are the months: ", months
print """
There's something going on here.
With the three double-quotes.
we'll be able to type as much as we like.
""" | rlsharpton/learning-python-the-hard-way | lpthw9.py | Python | gpl-2.0 | 312 |
#
# epydoc.css: default epydoc CSS stylesheets
# Edward Loper
#
# Created [01/30/01 05:18 PM]
# $Id: css.py,v 1.19 2004/03/09 05:01:50 edloper Exp $
#
"""
Predefined CSS stylesheets for the HTML outputter (L{epydoc.html}).
@type STYLESHEETS: C{dictionary} from C{string} to C{(string, string)}
@var STYLESHEETS: A dict... | dabodev/dabodoc | api/epydoc/css.py | Python | mit | 16,417 |
from PyQt5 import QtWidgets
from src.ui.commons.layout import set_wvbox
from src.ui.mainWindow.ccdInfo import CCDInfo
from src.ui.mainWindow.fanStatus import FanStatus
from src.ui.mainWindow.tempMonitor import TempMonitor
class CameraInfo(QtWidgets.QFrame):
def __init__(self, parent=None):
super(CameraIn... | hiyoku/ccd10 | src/ui/mainWindow/cameraInfo.py | Python | gpl-3.0 | 645 |
# This code is part of Ansible, but is an independent component.
# This particular file snippet, and this file snippet only, is BSD licensed.
# Modules you write using this snippet, which is embedded dynamically by Ansible
# still belong to the author of the module, and may assign their own license
# to the complete wo... | Russell-IO/ansible | lib/ansible/module_utils/ansible_tower.py | Python | gpl-3.0 | 3,978 |
# -*- coding: utf-8 -*-
# Part of Odoo. See LICENSE file for full copyright and licensing details.
from odoo import api, fields, models
class ResConfigSettings(models.TransientModel):
_inherit = 'res.config.settings'
lock_confirmed_po = fields.Boolean("Lock Confirmed Orders", default=lambda self: self.env.c... | ygol/odoo | addons/purchase/models/res_config_settings.py | Python | agpl-3.0 | 2,809 |
from setuptools import setup
setup(name='microsoftbotframework',
version='0.1.17',
description='A wrapper for the microsoft bot framework API',
classifiers=[
'Development Status :: 3 - Alpha',
'License :: OSI Approved :: MIT License',
'Programming Language :: Pyth... | RaminderSinghSahni/micro-ram-bot | setup.py | Python | mit | 916 |
"""Snow depth."""
import datetime
import copy
import numpy as np
import pandas as pd
import matplotlib.colors as mpcolors
from pyiem.plot import figure
from pyiem.plot.colormaps import nwssnow
from pyiem.util import get_autoplot_context, get_sqlalchemy_conn
from pyiem.exceptions import NoDataFound
LEVELS = [0.1, 1, 2... | akrherz/iem | htdocs/plotting/auto/scripts/p62.py | Python | mit | 3,814 |
"""
Parallel & Distributed Algorithms - laboratory
Examples:
- Launch 8 workers with default parameter values:
> python arir.py 8
- Launch 12 workers with custom parameter values:
> python arir.py 12 --shared-memory-size 128 --delay-connect 2.0 --delay-transmit 0.5 --delay-process 0.75
"""
__author__ = 'moo... | AleksanderGondek/GUT_PaDP_Labs | Lab4/matrix.py | Python | mit | 13,416 |
import logging
import os
import re
from alerta.exceptions import RejectException
from alerta.plugins import PluginBase, app
LOG = logging.getLogger('alerta.plugins')
ORIGIN_BLACKLIST = os.environ['ORIGIN_BLACKLIST'].split(',') \
if 'ORIGIN_BLACKLIST' in os.environ else app.config.get('ORIGIN_BLACKLIST', [])
ALLO... | guardian/alerta | alerta/plugins/reject.py | Python | apache-2.0 | 2,079 |
import mock
import pytest
import librarian.core.downloads as mod
@mock.patch.object(mod.scandir, 'scandir')
def test_get_downloads(scandir):
filename = 'file.zip'
file_path = '/path/' + filename
mocked_entry = mock.Mock()
mocked_entry.name = filename
mocked_entry.path = file_path
scandir.retu... | karanisverma/feature_langpop | tests/core/test_downloads.py | Python | gpl-3.0 | 2,314 |
__author__ = 'USER'
import os.path
from collections import OrderedDict
from os import listdir
from analyzer import ngram
from common import fileio
from common import math_util
from analyzer import similarity
import _operator
class TextAnalyzer:
dir_path = ""
dict_map = None
def __init__(self, dir_path):... | ParkJinSang/Logle | analyzer/text_analyzer.py | Python | mit | 6,282 |
import logging
import re
from autotest.client.shared import error
from virttest import utils_misc
@error.context_aware
def run(test, params, env):
"""
Install cygwin env for windwos guest:
1) Install cygwin in guest
2) Verify cygwin install
:param test: QEMU test object
:param params: Dictio... | ehabkost/tp-qemu | qemu/tests/cyginstall.py | Python | gpl-2.0 | 1,719 |
# Copyright 2008-2013 Nokia Siemens Networks Oyj
#
# 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... | yamateh/robotframework | src/robot/utils/robotinspect.py | Python | apache-2.0 | 1,085 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.