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
from django.core.urlresolvers import reverse
class QuestionManager(models.Manager):
def new(self):
return super(QuestionManager, self).get_query_set().all().order_by('-added_at')
def popular(self):
return super(QuestionManager, self)... | dennis95stumm/stepic_web_project | ask/qa/models.py | Python | gpl-3.0 | 1,192 |
import datetime
from django.conf import settings
from django.core.management.base import NoArgsCommand
from django.db import transaction
from django.db.models import Q
from djcode.reservations.models import Day_status, Medical_office, Visit_disable_rule
from djcode.reservations.models import Visit_reservation, Visit_... | mmincikova/medobs | djcode/reservations/management/commands/medobsgen.py | Python | gpl-3.0 | 2,042 |
# Licensed under a 3-clause BSD style license - see LICENSE.rst
import functools
import sys
from .core import UnifiedIORegistry
__all__ = ["register_reader", "register_writer", "register_identifier", # noqa: F822
"unregister_reader", "unregister_writer", "unregister_identifier",
"get_reader", ... | pllim/astropy | astropy/io/registry/compat.py | Python | bsd-3-clause | 1,896 |
"""Script for adding empty UD annotation tiers to ELAN files from SSLC.
Requires pympi: https://github.com/dopefishh/pympi/
"""
import sys
import os
from pympi import Elan
def add_tiers(filename):
# Names of the controlled vocabulary / linguistic type specifications.
# Arbitrary.
cv = 'ud_dep'
lang ... | robertostling/ud-swl | scripts/add_tiers.py | Python | gpl-3.0 | 3,445 |
from yawPyCrypto import Key
## rsakey = Key.Key(
| kichkasch/ioids | tests/yawpycrypto_test.py | Python | gpl-3.0 | 53 |
import logging
import requests
from redash.destinations import *
from redash.models import Alert
from redash.utils import json_dumps, deprecated
colors = {
Alert.OK_STATE: "green",
Alert.TRIGGERED_STATE: "red",
Alert.UNKNOWN_STATE: "yellow",
}
@deprecated()
class HipChat(BaseDestination):
@classmet... | getredash/redash | redash/destinations/hipchat.py | Python | bsd-2-clause | 1,906 |
# Copyright (c) 2015, Frappe Technologies Pvt. Ltd. and Contributors
# License: GNU General Public License v3. See license.txt
from __future__ import unicode_literals
import frappe
from frappe.utils import flt, fmt_money, getdate, formatdate
from frappe import _
from frappe.model.document import Document
class Cust... | hanselke/erpnext-1 | erpnext/accounts/doctype/gl_entry/gl_entry.py | Python | agpl-3.0 | 9,495 |
if __name__=="__main__":
import modules.QA_Logger as QA_Logger
LOG = QA_Logger.getLogger(name="feedmon")
import modules.SimpleOptparse as SimpleOptparse
from modules.feedmon import FeedMon
optDef = {
(('--help', '-h'), "This help"): ... | tintinweb/feedmon | src/feedmon.py | Python | gpl-2.0 | 2,806 |
"""A semi-synchronous Client for IPython parallel"""
# Copyright (c) IPython Development Team.
# Distributed under the terms of the Modified BSD License.
from __future__ import print_function
import os
import json
from threading import Thread, Event, current_thread
import time
import types
import warnings
from datet... | fzheng/codejam | lib/python2.7/site-packages/ipyparallel/client/client.py | Python | mit | 70,766 |
"""
# Copyright (C) 2007 Nathan Ramella (nar@remix.net)
#
# 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.... | avroshk/VRDAW | VRDAW_working/LiveOSC.py | Python | gpl-3.0 | 37,220 |
# Copyright 2021 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
#
# https://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed... | deepmind/deepmind-research | ogb_lsc/pcq/datasets.py | Python | apache-2.0 | 2,504 |
#!/usr/bin/python
# -*- coding: utf-8 -*-
#
# Copyright 2017 F5 Networks Inc.
#
# This file is part of Ansible
#
# Ansible is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# ... | e-gob/plataforma-kioscos-autoatencion | scripts/ansible-play/.venv/lib/python2.7/site-packages/ansible/modules/network/f5/bigip_configsync_actions.py | Python | bsd-3-clause | 11,670 |
#!/home/thumbimigwe/Documents/aGithubThosh/magame/myvenv/bin/python3
from django.core import management
if __name__ == "__main__":
management.execute_from_command_line()
| Thoshh/magame | myvenv/bin/django-admin.py | Python | mit | 175 |
from . import nccof
from ..dataset.arff import ArffFile
import numpy as np
import copy
from constraint import *
class NCCLR(object):
"""
NCCLR implements the naive credal classification method using the IDM for
Label ranking problem with label-wise decomposition.
"""
def __init__(self):
... | sdestercke/classifip | classifip/models/ncclr.py | Python | gpl-2.0 | 3,368 |
# -*- coding: utf-8 -*-
from shop.views.product import ProductDetailView
from shop.util.cart import get_or_create_cart
from shop_optiongroups.views import ProductOptionGroupsViewMixin
from shop_textoptions.views import ProductTextOptionsViewMixin
from models import DiaryProduct, CalendarProduct
class DiaryDetailView(... | jrief/django-shop-productvariations | tests/testapp/project/views.py | Python | bsd-3-clause | 1,863 |
# -*- coding: utf-8 -*-
# © <YEAR(S)> <AUTHOR(S)>
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html).
from openerp import _, api, fields, models
class TypeAdjustment(models.Model):
_name = 'type.adjustment'
_description = 'Type of adjustment'
_order = 'consecutive asc'
_rec_name = 'd... | Gebesa-Dev/Addons-gebesa | stock_picking_type/models/type_adjustment.py | Python | agpl-3.0 | 1,769 |
#!/usr/bin/env python
# Copyright 2007 The Closure Linter 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
#
#... | russitto/shaka-player | third_party/gjslint/closure_linter-2.3.13/closure_linter/errors.py | Python | apache-2.0 | 4,254 |
from django.test import TestCase
from eksiapp.entry_creation import create_entry_with_title
# Create your tests here.
from .models import Title, Entry
# class TestEntryCreation(TestCase):
#
# def test_entry_creation(self):
# create_entry_with_title('Deneme', 'Denemenin tanimi')
# create_entry_with_... | hanakamer/eskisozluk-clone | App/eksi/eksiapp/tests.py | Python | gpl-2.0 | 505 |
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.db import models, migrations
import jsonfield.fields
import mptt.fields
import django.db.models.deletion
from django.conf import settings
class Migration(migrations.Migration):
dependencies = [
('auth', '0001_initial'),
... | vittoriozamboni/django-groups-manager | groups_manager/migrations/0001_initial.py | Python | mit | 6,381 |
#!/usr/bin/env python3
# coding: utf-8
"""
scheduler service
dependencies: logbook, interphone
TODO:
* toutes les 5mn, aller grabber une image sur le net pour
- sera utilisé sur la page web d'accueil! :)
+ faire en sorte que scheduler puisse lire mon agenda et me rappeler les trucs pour lesquels j'a... | nio101/BASECAMP | source/scheduler/scheduler.py | Python | gpl-3.0 | 7,902 |
import codecs
import os
import pwd
import tempfile
import mockssh
import pytest
from containercluster import utils
def test_multiple_error_message():
err = utils.MultipleError(KeyError("foo"), ValueError("bar"))
assert str(err) == "'foo'\nbar"
def test_errors_in_parallel():
def divide_by_zero(n):
... | carletes/container-cluster | containercluster/test_utils.py | Python | mit | 2,046 |
from pprint import pprint
from django.contrib.sessions.models import Session
from django.db.models import Max
from django.utils import timezone
from utils.classes import AcessoInterno
from base.models import Colaborador
def get_current_users():
active_sessions = Session.objects.filter(expire_date__gte=timezone.... | anselmobd/fo2 | src/base/pages_context.py | Python | mit | 1,437 |
class Filter(object):
def __init__(self, filter_str):
self.params = dict(map(lambda x: x.split('='), filter_str.split(':')))
for k in self.params:
self.params[k] = self.params[k].split(',')
def skip(self, bench):
for k in self.params:
if k in bench.__dict__:
... | planetA/interference | scripts/manager/filter.py | Python | mit | 830 |
# -*- coding: utf-8 -*-
# Generated by Django 1.10.4 on 2017-02-21 06:56
from __future__ import unicode_literals
from django.db import migrations, models
import django.db.models.deletion
class Migration(migrations.Migration):
dependencies = [
('judge', '0059_problem_is_manually_managed'),
]
ope... | Phoenix1369/site | judge/migrations/0060_contest_clarifications.py | Python | agpl-3.0 | 1,832 |
#!/usr/bin/env python
import collections
import functools
import multiprocessing
import traceback
import Queue
from ct.client import entry_decoder
from ct.client import log_client
from ct.crypto import cert
from ct.crypto import error
from ct.proto import client_pb2
# Messages types:
# Special queue messages to sto... | php-coder/origin | vendor/github.com/google/certificate-transparency/python/ct/client/scanner.py | Python | apache-2.0 | 8,352 |
import sublime, sublime_plugin
import os, re
from CComplete.ccomplete import CComplete
from CComplete.tokenizer import Tokenizer
CCP = None
class CCompletePlugin(sublime_plugin.EventListener):
def __init__(self):
global CCP
if CCP is None:
CCP = self
else:
print("ER... | roycyt/CComplete | ccomplete_plugin.py | Python | gpl-2.0 | 11,107 |
# Copyright (c) 2014-2016 Marcello Salvati
#
# 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 program is distrib... | Lh4cKg/MITMf | plugins/spoof.py | Python | gpl-3.0 | 4,797 |
#python2 & python3
class Node:
def __init__(self,x,y):
self.token_value = x
self.code_value = y
self.children = []
self.index=None
def set_children(self,y):
try:
assert isinstance(y,list)
for i in y:
self.children.appe... | muhakh/TinyParser | tinyparser.py | Python | gpl-3.0 | 7,577 |
# tarpayload.py
# Tar archive software payload management.
#
# Copyright (C) 2012 Red Hat, Inc.
#
# This copyrighted material is made available to anyone wishing to use,
# modify, copy, or redistribute it subject to the terms and conditions of
# the GNU General Public License v.2, or (at your option) any later version... | AdamWill/anaconda | pyanaconda/packaging/tarpayload.py | Python | gpl-2.0 | 3,014 |
import numpy as np
import pandas.util.testing as tm
from pandas import (Series, date_range, DatetimeIndex, Index, RangeIndex,
Float64Index)
from .pandas_vb_common import setup # noqa
class SetOperations(object):
goal_time = 0.2
params = (['datetime', 'date_string', 'int', 'strings'],
... | kdebrab/pandas | asv_bench/benchmarks/index_object.py | Python | bsd-3-clause | 5,080 |
# -*- coding:utf-8 -*-
#
# Copyright (c) 2017 mooncake. All Rights Reserved
####
# @brief
# @author Eric Yue ( hi.moonlight@gmail.com )
# @version 0.0.1
from distutils.core import setup
V = "0.7"
setup(
name = 'mooncake_utils',
packages = ['mooncake_utils'],
version = V,
description = 'just a useful utils fo... | ericyue/mooncake_utils | setup.py | Python | apache-2.0 | 646 |
"""
Widget/logic for dataset ordering.
"""
from PyQt5 import QtWidgets
import sas.qtgui.Utilities.GuiUtils as GuiUtils
# Local UI
from sas.qtgui.Perspectives.Fitting.UI.OrderWidgetUI import Ui_OrderWidgetUI
class OrderWidget(QtWidgets.QWidget, Ui_OrderWidgetUI):
def __init__(self, parent=None, all_data=None):
... | SasView/sasview | src/sas/qtgui/Perspectives/Fitting/OrderWidget.py | Python | bsd-3-clause | 1,434 |
from revscoring.features import user
from revscoring.features.modifiers import not_, log
from ..features import diff, revision
class properties:
"""
Mapping of english descriptions to property identifiers
"""
IMAGE = 'P18'
SEX_OR_GENDER = 'P21'
COUNTRY_OF_CITIZENSHIP = 'P27'
INSTANCE_OF =... | wiki-ai/wb-vandalism | wb_vandalism/feature_lists/wikidata.py | Python | mit | 6,094 |
# encoding: utf-8
import nose
import mock
import ckan.tests.helpers as helpers
import ckan.plugins as p
import ckanext.datastore.interfaces as interfaces
import ckanext.datastore.plugin as plugin
DatastorePlugin = plugin.DatastorePlugin
assert_equal = nose.tools.assert_equal
assert_raises = nose.tools.assert_raises... | NicoVarg99/daf-recipes | ckan/ckan/ckan/ckanext/datastore/tests/test_plugin.py | Python | gpl-3.0 | 7,256 |
from django.test import TestCase
from organization.models.relationship import OrganizationRelationship, \
MilitaryStance
from organization.models.capability import Capability
from organization.models.election import PositionElection, PositionCandidacy
from organization.models.organization import Organization
from ... | jardiacaj/finem_imperii | organization/test/test_organization_model.py | Python | agpl-3.0 | 13,191 |
# -*- encoding: utf-8 -*-
##############################################################################
#
# Odoo, Open Source Management Solution
# This module copyright (C) 2010 Savoir-faire Linux
# (<http://www.savoirfairelinux.com>).
#
# This program is free software: you can redistribute it and/or modi... | depfac/runbot-addons | runbot_gitlab/runbot_repo.py | Python | agpl-3.0 | 10,666 |
from datetime import datetime
import warnings
from subprocess import Popen, PIPE
import re
import sys
import GRID_LRT.auth.grid_credentials as grid_creds
from GRID_LRT.auth.get_picas_credentials import get_picas_cred
from GRID_LRT import token
from GRID_LRT.Staging.srmlist import srmlist
from GRID_LRT.storage.gsifile i... | apmechev/GRID_LRT | GRID_LRT/storage/utils.py | Python | gpl-3.0 | 1,259 |
# -*- coding: utf-8 -*-
"""
All unit tests for the newspaper library should be contained in this file.
"""
import sys
import os
import unittest
import time
import codecs
TEST_DIR = os.path.abspath(os.path.dirname(__file__))
PARENT_DIR = os.path.join(TEST_DIR, '..')
# tests is a separate module, insert parent dir manu... | cantino/newspaper | tests/unit_tests.py | Python | mit | 15,574 |
"""The tests for the Unifi WAP device tracker platform."""
from collections import deque
from copy import copy
from unittest.mock import Mock
from datetime import timedelta
import pytest
from aiounifi.clients import Clients, ClientsAll
from aiounifi.devices import Devices
from homeassistant import config_entries
fro... | fbradyirl/home-assistant | tests/components/unifi/test_device_tracker.py | Python | apache-2.0 | 9,934 |
from optparse import make_option
from django.conf import settings
from django.core.management.commands.runserver import Command as RunserverCommand
from django.contrib.staticfiles.handlers import StaticFilesHandler
class Command(RunserverCommand):
option_list = RunserverCommand.option_list + (
make_opti... | 912/M-new | virtualenvironment/experimental/lib/python2.7/site-packages/django/contrib/staticfiles/management/commands/runserver.py | Python | gpl-2.0 | 1,344 |
# Copyright 2013-2021 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)
from spack import *
class RIgraph(RPackage):
"""Network Analysis and Visualization
Routines for simple graphs a... | LLNL/spack | var/spack/repos/builtin/packages/r-igraph/package.py | Python | lgpl-2.1 | 1,494 |
"""`featurization.py` - a collection of methods for featurizing."""
import logging
from typing import List
__author__ = ['Todd Cook <todd.g.cook@gmail.com>']
__license__ = 'MIT License'
LOG = logging.getLogger(__name__)
LOG.addHandler(logging.NullHandler())
def word_to_features(word: str, max_word_length: int = 20... | LBenzahia/cltk | cltk/utils/featurization.py | Python | mit | 1,131 |
import logging
import urlparse
import sys
try:
from io import BytesIO # python 3
except ImportError:
from cStringIO import StringIO as BytesIO # python 2
from tornado import escape
from xudd.actor import Actor, super_init
_log = logging.getLogger(__name__)
class WSGI(Actor):
def __init__(self, hive, ... | xudd/xudd | xudd/lib/wsgi.py | Python | apache-2.0 | 3,382 |
#!/usr/bin/python
#----------------------------------------------------------------
# pyRoute, a routing program for OpenStreetMap-style data
#
#------------------------------------------------------
# Usage:
# pyroute.py [input OSM file] [start node] [end node]
#------------------------------------------------------
... | ftrimble/route-grower | pyroute/pyroute.py | Python | apache-2.0 | 9,473 |
''' Create empty schemas in Postgres database that will subsequently be needed to store tables. '''
from util import cred # load SQL credentials
from util.SQL_helpers import connect_to_db
def main():
# Create empty schemas
sqlcmd_createschemas = '''
CREATE SCHEMA lookup;
CREATE SCHEMA noble;
CREATE SCHEMA kip... | dssg/education-college-public | code/etl/uploaders/create_schemas.py | Python | mit | 606 |
##
#
# Copyright 2012-2013 Ghent University
#
# This file is part of vsc-base,
# originally created by the HPC team of Ghent University (http://ugent.be/hpc/en),
# with support of Ghent University (http://ugent.be/hpc),
# the Flemish Supercomputer Centre (VSC) (https://vscentrum.be/nl/en),
# the Hercules foundation (ht... | stdweird/vsc-manage | test/__init__.py | Python | gpl-2.0 | 1,339 |
import unittest
import mock
import numpy
import chainer
from chainer import cuda
from chainer import functions
from chainer import testing
from chainer.testing import attr
if cuda.available:
cuda.init()
class TestInceptionBackward(unittest.TestCase):
in_channels = 3
out1, proj3, out3, proj5, out5, pr... | woodshop/chainer | tests/functions_tests/test_inception.py | Python | mit | 3,737 |
class Trio(object):
genomap = { # shared genomap
'./.' : -1, '0/0' : 0, '0/1' : 1, '1/0' : 1, '1/1' : 2,
-1 : -1, 0 : 0, 1 : 1, 2 : 2
}
def __init__(self,offspring=None,father=None,mother=None):
self.off = self.genomap[offspring]
self.fat = self.genomap[father]
s... | schae234/PonyTools | ponytools/Trio.py | Python | mit | 1,742 |
"""
Let's assume Alice and Bob hold an escrow account and now they want to
send 100 XLM from the escrow account to Eve, the following code shows how to achieve it.
I recommend that you check the `./set_up_multisig_account.py` before reading this example.
"""
from stellar_sdk import Asset, Network, Server, TransactionB... | StellarCN/py-stellar-base | examples/multisig_xdr.py | Python | apache-2.0 | 1,535 |
# Copyright 2013 Rackspace Hosting
# 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... | Brocade-OpenSource/OpenStack-DNRM-Nova | nova/api/openstack/compute/plugins/v3/instance_actions.py | Python | apache-2.0 | 5,391 |
# -*- coding: utf-8 -*-
from __future__ import print_function
from __future__ import absolute_import
import os
import sys
import tempfile
import warnings
import numpy
from numpy import testing as npt
import tables
from tables import Atom, ClosedNodeError, NoSuchNodeError
from tables.utils import byteorders
from ta... | gdementen/PyTables | tables/tests/test_array.py | Python | bsd-3-clause | 95,636 |
import warnings
import pyaf.Bench.TS_datasets as tsds
import pyaf.Bench.MComp as mcomp
tester7 = mcomp.cMComp_Tester(tsds.load_M4_comp("FINANCE") , "M4_COMP");
with warnings.catch_warnings():
warnings.simplefilter("error")
tester7.testSignals('FIN28')
# tester7.testSignal('ECON0299')
# tester7.testAl... | antoinecarme/pyaf | tests/bench/test_M4_FIN28_failure.py | Python | bsd-3-clause | 369 |
########################################################################
# amara/xpath/locationpaths/predicates.py
"""
A parsed token that represents a predicate list.
"""
from __future__ import absolute_import
from itertools import count, izip
from amara.xpath import datatypes
from amara.xpath.expressions.basics impo... | zepheira/amara | lib/xpath/locationpaths/predicates.py | Python | apache-2.0 | 7,392 |
# Copyright 2020 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 required by applicable law o... | openstack/nova | nova/api/validation/extra_specs/null.py | Python | apache-2.0 | 1,775 |
from scrapy.contrib.spiders import CrawlSpider, Rule
from scrapy.contrib.linkextractors import LinkExtractor
import scrapy
import os
# IN the special case of the wto disputes, we need to get the list of all disputes, so we run this script preliminarily:
execfile("./fetchjson.py")
# Now we build the scraper:
# Fir... | trcook/wto_python_scrape | wto_scraper.py | Python | mit | 1,127 |
# -*- coding: utf-8 -*-
# © 2016 Eficent Business and IT Consulting Services S.L.
# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl.html).
from openerp import api, exceptions, fields, models, _
class AccountMove(models.Model):
_inherit = 'account.move'
stock_valuation_account_manual_adjustment_... | factorlibre/stock-logistics-warehouse | stock_valuation_account_manual_adjustment/models/account_move.py | Python | agpl-3.0 | 1,624 |
# -*- coding: utf-8 -*-
#
# This file is part of EventGhost.
# Copyright © 2005-2019 EventGhost Project <http://www.eventghost.org/>
#
# EventGhost 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 versio... | topic2k/EventGhost | _build/builder/BuildImports.py | Python | gpl-2.0 | 9,896 |
# -*- coding: utf-8 -*-
"""2520 is the smallest number that can be divided by each of the numbers
from 1 to 10 without any remainder.
What is the smallest positive number
that is evenly divisible by all of the numbers from 1 to 20?"""
doorgaan = True
getal = 2520
while doorgaan == True:
doorgaan = False
for x... | hendrikjeb/Euler | 05.py | Python | mit | 462 |
# Copyright (c) 2001-2004 Twisted Matrix Laboratories.
# See LICENSE for details.
"""
Test cases for Twisted.names' root resolver.
"""
from twisted.trial import unittest
class RootResolverTestCase(unittest.TestCase):
pass
| kenorb-contrib/BitTorrent | twisted/names/test/test_rootresolve.py | Python | gpl-3.0 | 231 |
from django.contrib import admin
from .models import Website, Language, Domain, Search
# Register your models here.
admin.site.register(Website)
admin.site.register(Language)
admin.site.register(Domain)
admin.site.register(Search) | olivmaurel/termsearch | aggregator/admin.py | Python | apache-2.0 | 232 |
#!/usr/bin/env python3
# vim: ft=python fileencoding=utf-8 sts=4 sw=4 et:
# Copyright 2014-2015 Florian Bruhin (The Compiler) <mail@qutebrowser.org>
# This file is part of qutebrowser.
#
# qutebrowser is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as pub... | mnick/qutebrowser | scripts/src2asciidoc.py | Python | gpl-3.0 | 15,193 |
## @file
# This file is used to define comment parsing interface
#
# Copyright (c) 2011 - 2014, Intel Corporation. All rights reserved.<BR>
#
# This program and the accompanying materials are licensed and made available
# under the terms and conditions of the BSD License which accompanies this
# distribution. The full ... | miguelinux/vbox | src/VBox/Devices/EFI/Firmware/BaseTools/Source/Python/UPT/Library/CommentParsing.py | Python | gpl-2.0 | 21,809 |
#!/usr/bin/env python
#
# Author: Mike McKerns (mmckerns @caltech and @uqfoundation)
# Copyright (c) 1997-2015 California Institute of Technology.
# License: 3-clause BSD. The full license text is available at:
# - http://trac.mystic.cacr.caltech.edu/project/mystic/browser/mystic/LICENSE
"""
solvers: minimal and expa... | jcfr/mystic | mystic/solvers.py | Python | bsd-3-clause | 4,042 |
from imp import load_source
from pathlib import Path
from os.path import expanduser
from pprint import pformat
from subprocess import Popen, PIPE
import os
import sys
from psutil import Process, TimeoutExpired
import colorama
import six
from . import logs, conf, types, shells
def setup_user_dir():
"""Returns user... | petr-tichy/thefuck | thefuck/main.py | Python | mit | 4,819 |
""" Unit tests for visibility operations
"""
import sys
import unittest
import logging
import numpy
from data_models.parameters import arl_path
from processing_components.visibility.base import create_blockvisibility_from_ms, create_visibility_from_ms
from processing_components.visibility.operations import integra... | SKA-ScienceDataProcessor/algorithm-reference-library | tests/processing_components/test_visibility_ms.py | Python | apache-2.0 | 4,717 |
# -*- coding: utf-8 -*-
"""
pygments.lexers.php
~~~~~~~~~~~~~~~~~~~
Lexers for PHP and related languages.
:copyright: Copyright 2006-2014 by the Pygments team, see AUTHORS.
:license: BSD, see LICENSE for details.
"""
import re
from pygments.lexer import RegexLexer, include, bygroups, default, us... | spencerlyon2/pygments | pygments/lexers/php.py | Python | bsd-2-clause | 9,756 |
"""SCons.Tool.rpcgen
Tool-specific initialization for RPCGEN tools.
Three normally shouldn't be any need to import this module directly.
It will usually be imported through the generic SCons.Tool.Tool()
selection method.
"""
#
# Copyright (c) 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008 The SCons Foundation
#
# Pe... | frew/simpleproto | scons-local-1.1.0/SCons/Tool/rpcgen.py | Python | bsd-2-clause | 2,761 |
# -*- coding: utf-8 -*-
from david.ext.babel import lazy_gettext as _
from david.ext.admin import DBKeyAdminView
from david.lib.template import st
from .model import DB_HOMEPAGE_ARTICLES
from .model import get_homepage_articles
from ..view import bp
@bp.route('/')
def home():
articles, captions = get_homepage_a... | ktmud/david | david/modules/pages/homepage/__init__.py | Python | mit | 934 |
#!/usr/bin/env python
# encoding: utf-8
# Copyright (C) 2001-2007 Martin Blais. All Rights Reserved
# Copyright (C) 2010 Bear http://code-bear.com/bearlog/
# Copyright (C) 2013 lrq3000
# Excerpt from SnakeFood to recursively list all imports of modules using AST parsing
# Additions to print the versions of each modul... | lrq3000/author-detector | install/pylistmodules/pylistmodules.py | Python | gpl-3.0 | 5,224 |
# 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... | alshedivat/tensorflow | tensorflow/python/ops/histogram_ops_test.py | Python | apache-2.0 | 6,610 |
import os
from hackpad_api.hackpad import Hackpad
hackpad = Hackpad(os.getenv('team') ,consumer_key = os.getenv('consumer_key'), consumer_secret = os.getenv('consumer_secret'))
print(hackpad.do_api_request('pads/all', 'GET'))
| Falicon/Python-Hackpad-API | example/example1.py | Python | mit | 229 |
from sqlobject import *
from setup import *
__connection__ = conn
## Snippet "simpleaddress-person1"
class Person(SQLObject):
_connection = conn
firstName = StringCol()
middleInitial = StringCol(length=1, default=None)
lastName = StringCol()
## end snippet
## We create a table like this: (for MySQL... | pacoqueen/bbinn | SQLObject/SQLObject-0.6.1/examples/simpleperson.py | Python | gpl-2.0 | 2,256 |
#!/usr/bin/env python
#imports go here
from collections import *
#
# Free Coding session for 2014-10-22
# Written by Matt Warren
#
words = ['orange', 'red', 'blue', 'red', 'grey', 'pink', 'blue', 'red']
if __name__=='__main__':
cnt = Counter()
for word in words:
cnt[word] += 1
print cnt
print c... | mfwarren/FreeCoding | 2014/10/fc_2014_10_22.py | Python | mit | 815 |
#!/usr/bin/env python
#
# Copyright (c) 2016 Matt Davis, <mdavis@ansible.com>
# Chris Houseknecht, <house@redhat.com>
#
# This file is part of Ansible
#
# Ansible is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free ... | nwiizo/workspace_2017 | devops/ansible/tettei-nyumon-playbooks/chapter08/azure_playbook1/inventories/staging/azure_rm.py | Python | mit | 32,321 |
# Copyright 2014 OpenStack Foundation
#
# 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 ... | shakamunyi/neutron-vrrp | neutron/db/migration/alembic_migrations/heal_script.py | Python | apache-2.0 | 11,948 |
from django.conf.urls import url
from subscribe import views
urlpatterns = [
url(r'^$', views.HomeView.as_view(), name='homepage'),
url(r'^inschrijven/(?P<slug>[\w-]+)/$', views.register, name='subscribe'),
url(r'^deleteEventQuestion/$', views.delete_event_question, name='delete-event-question'),
url(... | jonge-democraten/dyonisos | subscribe/urls.py | Python | mit | 457 |
# -*- coding: utf-8 -*-
"""
flask.testsuite.subclassing
~~~~~~~~~~~~~~~~~~~~~~~~~~~
Test that certain behavior of flask can be customized by
subclasses.
:copyright: (c) 2011 by Armin Ronacher.
:license: BSD, see LICENSE for more details.
"""
import flask
import unittest
from StringIO import St... | SohKai/ChronoLogger | web/flask/lib/python2.7/site-packages/flask/testsuite/subclassing.py | Python | mit | 1,201 |
"""
.. image::
../_static/mongodb.png
`GridFS <https://docs.mongodb.com/manual/core/gridfs/>`_ is a specification for storing large files
(>16 MB) in MongoDB. See :py:mod:`~requests_cache.backends.mongodb` for more general info on MongoDB.
API Reference
^^^^^^^^^^^^^
.. automodsumm:: requests_cache.backends.gridf... | reclosedev/requests-cache | requests_cache/backends/gridfs.py | Python | bsd-2-clause | 3,582 |
from pyblish import api
from pyblish_bumpybox import inventory
class AppendFtrackAssetName(api.InstancePlugin):
""" Appending "ftrackAssetName" """
label = "Ftrack Asset Name"
order = inventory.get_order(__file__, "AppendFtrackAssetName")
def process(self, instance):
# skipping if not launc... | Bumpybox/pyblish-bumpybox | pyblish_bumpybox/plugins/celaction/bait/append_ftrack_asset_name.py | Python | lgpl-3.0 | 572 |
import os.path
# Fetch data from these URLs
URLS = [
"http://mspaintadventures.com/?search=6_1", # Acts 1-4
"http://mspaintadventures.com/?search=6_2", # Act 5
"http://mspaintadventures.com/?search=6_3", # Act 6
]
# Names used in dialog logs
NAMES = [
'GAMZEE', 'ROSESPRITE', 'DAVEPETASPRITE^2', 'FE... | Matoking/Markovstuck | generator/settings.py | Python | unlicense | 5,200 |
# Copyright (C) 2021 Open Source Integrators
# Copyright (C) 2021 Serpent Consulting Services
# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl).
{
"name": "Field Service with Operating Units",
"summary": """
This module adds operating unit information to Field Service orders.""",
"vers... | OCA/operating-unit | fieldservice_operating_unit/__manifest__.py | Python | agpl-3.0 | 838 |
# Copyright 2014 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, s... | tswast/google-cloud-python | storage/google/cloud/storage/batch.py | Python | apache-2.0 | 11,762 |
# This file is part of Shuup.
#
# Copyright (c) 2012-2017, Shoop Commerce Ltd. All rights reserved.
#
# This source code is licensed under the OSL-3.0 license found in the
# LICENSE file in the root directory of this source tree.
from shuup.apps import AppConfig
class AuthAppConfig(AppConfig):
name = "shuup.front... | suutari-ai/shoop | shuup/front/apps/auth/__init__.py | Python | agpl-3.0 | 594 |
import numpy as np
from scipy import sparse
from . import Mapper
from . import samplers
class VolumeMapper(Mapper):
@classmethod
def _cache(cls, filename, subject, xfmname, **kwargs):
from .. import db
masks = []
xfm = db.get_xfm(subject, xfmname, xfmtype='coord')
pia = db.get_... | gallantlab/pycortex | cortex/mapper/volume.py | Python | bsd-2-clause | 7,345 |
# Copyright (c) 2010-2011, Found IT A/S and Piped Project Contributors.
# See LICENSE for details.
import re
import sys
from twisted.spread import pb, jelly, flavors
from piped import util
def unwrap_wrapped_text(text):
""" Unwraps multi-line strings, but keeps paragraphs separated by
two or more newlines s... | alexbrasetvik/Piped | piped/exceptions.py | Python | mit | 5,663 |
# File ex2.py
#
# Author: Zak Fallows (zakf@mit.edu)
# Copyright 2013
# Released for free use under the terms of the MIT License, see license.txt
#
# Demonstrates Python function call overhead.
#
# Notation: _ipy means "interpreted Python".
# _py means "untyped Python function, maybe compiled by Cython".
# _c means ... | zakf/cython_talk | ex2.py | Python | mit | 2,718 |
from twisted.internet import defer
from twisted.protocols.basic import NetstringReceiver
from twisted.python import failure, log
from txjason import protocol, client
class JSONRPCClientProtocol(NetstringReceiver):
"""
A JSON RPC Client Protocol for TCP/Netstring connections.
"""
def __init__(self, fac... | flowroute/txjason | txjason/netstring.py | Python | mit | 4,336 |
# 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 program is distributed in the hope that it will be useful,
# bu... | fracpete/python-weka-wrapper3 | tests/wekatests/coretests/all_tests.py | Python | gpl-3.0 | 2,123 |
# -*- coding: utf-8 -*-
##############################################################################
#
# This module uses OpenERP, Open Source Management Solution Framework.
# Copyright (C):
# 2012-Today Serpent Consulting Services (<http://www.serpentcs.com>)
#
# This program is free software: you ca... | MackZxh/OCA-Choice | server-tools/mass_editing/models/mass_object.py | Python | lgpl-3.0 | 5,755 |
#! /usr/bin/env python
items = " this is a test this is a test this is this this is a test this the quick brown fox jumps over the lazy dog under the bridge. twinkle twinkle little star how I wonder what you are. Queen and King of Hearts, this is the king and Queen of spades "
"""
# replace . with space
items = ite... | klancer/python102 | wordcount.py | Python | mit | 1,029 |
from sklearn import datasets
import pandas as pd
import numpy as np
ds = datasets.load_breast_cancer();
from sklearn.tree import DecisionTreeClassifier
clf = DecisionTreeClassifier(min_samples_leaf=30, random_state = 1960)
NC = 12
X = ds.data[:,0:NC]
y = ds.target
from sklearn.model_selection import train_test_spl... | antoinecarme/sklearn_explain | tests/issues/issue_8/issue_8_3.py | Python | bsd-3-clause | 1,657 |
#!/usr/bin/env python2.5
#
# Copyright 2011 the Melange authors.
#
# 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 applic... | adviti/melange | app/soc/modules/gci/views/all_tasks.py | Python | apache-2.0 | 4,524 |
# Copyright 2016:
# * Jim Unroe KC9HI, <rock.unroe@gmail.com>
# * Pavel Milanes CO7WT <pavelmc@gmail.com>
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 2 of the License, or
# ... | tylert/chirp.hg | chirp/drivers/vgc.py | Python | gpl-3.0 | 49,667 |
# -*- coding: utf-8 -*-
# Part of Odoo. See LICENSE file for full copyright and licensing details.
import collections
import unittest
from lxml.builder import E
from odoo.tests import common
from odoo.tools.convert import _eval_xml
Field = E.field
Value = E.value
class TestEvalXML(common.TransactionCase):
def ... | ayepezv/GAD_ERP | openerp/addons/test_convert/tests/test_convert.py | Python | gpl-3.0 | 2,290 |
# -*- coding:utf-8 -*-
import re
# Обработка телефонных номеров
phonePattern = re.compile(r'^(\d{3})\D*(\d{3})\D*(\d{4})\D*(\d*)$')
print phonePattern.search('80055512121234').groups()
# ('800', '555', '1212', '1234')
print phonePattern.search('800.555.1212 x1234').groups()
# ('800', '555', '1212', '1234')
print ph... | janusnic/21v-python | unit_13/re6.py | Python | mit | 469 |
'''
quad_function_plot.py
Plot a Quadratic function
'''
import matplotlib.pyplot as plt
def draw_graph(x, y):
plt.plot(x, y)
plt.show()
if __name__ == '__main__':
# assume values of x
x_values = range(-100, 100, 20)
y_values = []
for x in x_values:
# calculate the value of the quadr... | doingmathwithpython/code | chapter2/solutions/quad_function_plot.py | Python | mit | 419 |
# pylint: disable = line-too-long, multiple-statements, missing-module-attribute
"""https://bitbucket.org/logilab/pylint/issue/111/false-positive-used-before-assignment-with"""
try: raise IOError(1, "a")
except IOError, err: print err
| godfryd/pylint | test/input/func_noerror_used_before_assignment.py | Python | gpl-2.0 | 236 |
"""Greek language corpora available for download or loading locally.
All remote corpora hosted by github on the cltk organization account, eg:
'http://github.com/cltk' + name
"""
GREEK_CORPORA = [
{'name': 'greek_software_tlgu',
'location': 'remote',
'type': 'software'},
{'encoding': 'utf-8',
'm... | marpozzi/cltk | cltk/corpus/greek/corpora.py | Python | mit | 1,348 |
###########################################################################
#
# Copyright 2020 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
#
# https://www.apache.org/l... | google/starthinker | starthinker_ui/recipe/urls.py | Python | apache-2.0 | 2,064 |
from django.conf.urls import patterns, url
from django.contrib import admin
admin.autodiscover()
urlpatterns = patterns('account.views',
url(r"^(?P<username>[\w.@+-]+)/id_rsa.pub$",
"get_public_key",
name="get_public_key"),
... | crcollins/chemtools-webapp | account/urls.py | Python | mit | 747 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.