text stringlengths 6 947k | repo_name stringlengths 5 100 | path stringlengths 4 231 | language stringclasses 1
value | license stringclasses 15
values | size int64 6 947k | score float64 0 0.34 |
|---|---|---|---|---|---|---|
#!/usr/bin/env python
# encoding: utf-8
"""
Make a grid of synths for a set of attenuations.
2015-04-30 - Created by Jonathan Sick
"""
import argparse
import numpy as np
from starfisher.pipeline import PipelineBase
from androcmd.planes import BasicPhatPlanes
from androcmd.phatpipeline import (
SolarZIsocs, Sola... | jonathansick/androcmd | scripts/dust_grid.py | Python | mit | 2,095 | 0 |
import os
from rednotebook.util.filesystem import get_journal_title
def test_journal_title():
root = os.path.abspath(os.sep)
dirs = [
("/home/my journal", "my journal"),
("/my journal/", "my journal"),
("/home/name/Journal", "Journal"),
("/home/name/jörnal", "jörnal"),
... | jendrikseipp/rednotebook | tests/test_filesystem.py | Python | gpl-2.0 | 420 | 0 |
# Copyright 2017 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 wri... | google/tangent | tests/test_compile.py | Python | apache-2.0 | 1,290 | 0.007752 |
from django.apps import AppConfig
class FeaturesConfig(AppConfig):
name = 'features'
def ready(self):
import features.signals
| KDD-OpenSource/fexum | features/apps.py | Python | mit | 145 | 0 |
# Copyright 2016 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 ... | priya-pp/Tacker | tacker/db/migration/alembic_migrations/versions/5246a6bd410f_multisite_vim.py | Python | apache-2.0 | 2,711 | 0.001475 |
"""
Implementation of model
"""
import numpy as np
import numpy.random as npr
from scipy import ndimage
from configuration import get_config
config = get_config()
class LatticeState(object):
""" Treat 1D list as 2D lattice and handle coupled system
This helps with simply passing this object to scipy's... | kpj/PyWave | model.py | Python | mit | 5,052 | 0.001781 |
from unittest import TestCase
class TestImports(TestCase):
_multiprocess_can_split_ = True
def test_coeff2header_import(self):
import sk_dsp_comm.coeff2header
def test_coeff2header_from(self):
from sk_dsp_comm import coeff2header
def test_digitalcom_import(self):
import sk_d... | mwickert/scikit-dsp-comm | sk_dsp_comm/test/test_imports.py | Python | bsd-2-clause | 1,438 | 0.000695 |
#! /usr/bin/env python3
#
# Copyright (c) 2014 Joseph Keshet, Morgan Sonderegger, Thea Knowles
#
# This file is part of Autovot, a package for automatic extraction of
# voice onset time (VOT) from audio files.
#
# Autovot is free software: you can redistribute it and/or modify it
# under the terms of the GNU Lesser Gen... | mlml/autovot | autovot/bin/auto_vot_append_files.py | Python | lgpl-3.0 | 4,617 | 0.003682 |
# -*- coding: utf-8 -*-
#
## This file is part of Zenodo.
## Copyright (C) 2012, 2013, 2014 CERN.
##
## Zenodo 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 ... | otron/zenodo | zenodo/demosite/receivers.py | Python | gpl-3.0 | 2,660 | 0.005639 |
"""latex.py
Character translation utilities for LaTeX-formatted text.
Usage:
- unicode(string,'latex')
- ustring.decode('latex')
are both available just by letting "import latex" find this file.
- unicode(string,'latex+latin1')
- ustring.decode('latex+latin1')
where latin1 can be replaced by any other known encod... | jterrace/sphinxtr | extensions/natbib/latex_codec.py | Python | bsd-2-clause | 15,250 | 0.003607 |
#
# 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 u... | YakindanEgitim/EN-LinuxClipper | thrift/transport/TZlibTransport.py | Python | gpl-3.0 | 8,187 | 0.006596 |
"""
WSGI config for appscake project.
This module contains the WSGI application used by Django's development server
and any production WSGI deployments. It should expose a module-level variable
named ``application``. Django's ``runserver`` and ``runfcgi`` commands discover
this application via the ``WSGI_APPLICATION``... | DrOctogon/appscake-rewrite | config/wsgi.py | Python | bsd-3-clause | 1,421 | 0.000704 |
__version_info__ = (2, 4, 2)
__version__ = ".".join(map(str, __version_info__))
| SergeyCherepanov/ansible | ansible/paramiko/_version.py | Python | mit | 80 | 0 |
for i in range(1, 101):
print i
asd = open("inp/" + str(i), "r")
s = asd.read()
s = s[:-1]
n = int(s)
print n
if n % 100 != 0:
if n % 4 == 0:
s = "EVET" + "\n"
else:
s = "HAYIR" + "\n"
else:
if n % 400 == 0:
s = "EVET" + "\n"
... | Rassilion/ProjectC | web/problems/003/solver.py | Python | gpl-3.0 | 527 | 0 |
from OpenGLCffi.GLES3 import params
@params(api='gles3', prms=['first', 'count', 'v'])
def glViewportArrayvNV(first, count, v):
pass
@params(api='gles3', prms=['index', 'x', 'y', 'w', 'h'])
def glViewportIndexedfNV(index, x, y, w, h):
pass
@params(api='gles3', prms=['index', 'v'])
def glViewportIndexedfvNV(index,... | cydenix/OpenGLCffi | OpenGLCffi/GLES3/EXT/NV/viewport_array.py | Python | mit | 1,222 | 0.011457 |
from django import forms
from django.core.mail import send_mail
from css.models import CUser, Room, Course, SectionType, Schedule, Section, Availability, FacultyCoursePreferences
from django.http import HttpResponseRedirect
from settings import DEPARTMENT_SETTINGS, HOSTNAME
import re
from django.forms import ModelChoic... | makennajohnstone/CSS | css/forms.py | Python | mit | 11,524 | 0.010413 |
# -*- coding: utf-8 -*-
# Part of Odoo. See LICENSE file for full copyright and licensing details.
import time
from odoo.addons.account.tests.account_test_classes import AccountingTestCase
from odoo.exceptions import ValidationError
class ISRTest(AccountingTestCase):
def create_invoice(self, currency_to_use='b... | Aravinthu/odoo | addons/l10n_ch/tests/test_l10n_ch_isr.py | Python | agpl-3.0 | 5,070 | 0.006509 |
from os import makedirs
from os.path import join
from posix import listdir
from django.conf import settings
from django.core.management.base import BaseCommand
from libavwrapper.avconv import Input, Output, AVConv
from libavwrapper.codec import AudioCodec, NO_VIDEO
from 匯入.族語辭典 import 代碼對應
class Command(BaseComma... | sih4sing5hong5/hue7jip8 | 匯入/management/commands/族語辭典1轉檔.py | Python | mit | 1,474 | 0 |
"""Tests for distutils.command.check."""
import os
import textwrap
import unittest
from test.support import run_unittest
from distutils.command.check import check, HAS_DOCUTILS
from distutils.tests import support
from distutils.errors import DistutilsSetupError
try:
import pygments
except ImportError:
pygment... | batermj/algorithm-challenger | code-analysis/programming_anguage/python/source_codes/Python3.8.0/Python-3.8.0/Lib/distutils/tests/test_check.py | Python | apache-2.0 | 5,711 | 0.000525 |
# coding=utf-8
"""This module, code_section.py, is an abstraction for code sections. Needed for ordering code chunks."""
class CodeSection(object):
"""Represents a single code section of a source code file."""
def __init__(self, section_name):
self._section_name = section_name
self._code_chunks = []
def add... | utarsuno/quasar_source | deprecated/code_api/code_section.py | Python | mit | 979 | 0.022472 |
from south.db import db
from django.db import models
from csc.corpus.models import *
class Migration:
def forwards(self, orm):
# Adding model 'TaggedSentence'
db.create_table('tagged_sentences', (
('text', orm['corpus.TaggedSentence:text']),
('language', orm['... | pbarton666/buzz_bot | djangoproj/djangoapp/csc/corpus/migrations/0001_initial.py | Python | mit | 8,362 | 0.008012 |
#!/usr/bin/python2.4
# Copyright 2009, Google Inc.
# All rights reserved.
#
# 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 list of... | rwatson/chromium-capsicum | o3d/tests/selenium/selenium_utilities.py | Python | bsd-3-clause | 11,831 | 0.007776 |
#!/usr/bin/env python
#
# Copyright 2014 The Chromium Authors. All rights reserved.
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
import sys
from adb_profile_chrome import main
if __name__ == '__main__':
sys.exit(main.main())
| AndroidOpenDevelopment/android_external_chromium_org | tools/android/adb_profile_chrome.py | Python | bsd-3-clause | 288 | 0.003472 |
# Script executed by jython
# Can import any Java package
from org.csstudio.display.builder.runtime.script import PVUtil
# Can also import some python code that's available under Jython
import sys, time
trigger = PVUtil.getInt(pvs[0])
if trigger:
info = "%s,\ninvoked at %s" % (sys.version, time.strftime("%Y-%m-... | kasemir/org.csstudio.display.builder | org.csstudio.display.builder.model/examples/python/jython.py | Python | epl-1.0 | 377 | 0.005305 |
import pytest
from .addons import using_networkx
from .utils import *
import math
import numpy as np
import qcelemental as qcel
import psi4
from psi4.driver import qcdb
pytestmark = pytest.mark.quick
def hide_test_xtpl_fn_fn_error():
psi4.geometry('He')
with pytest.raises(psi4.UpgradeHelper) as e:
... | CDSherrill/psi4 | tests/pytests/test_misc.py | Python | lgpl-3.0 | 3,413 | 0.004102 |
import csv
import re
from io import TextIOWrapper
from django.conf import settings
from django.core.cache import cache
from django.utils.termcolors import colorize
# Import clog if we're in debug otherwise make it a noop
if settings.DEBUG:
from clog.clog import clog
else:
def clog(*args, **kwargs):
pa... | tndatacommons/tndata_backend | tndata_backend/goals/utils.py | Python | mit | 3,686 | 0 |
from font import font
class zschemaname( font ):
"""
Displays a header name for a Z Schema. It may contain text, images,
equations, etc... but the width of it should be kept to a minimum so
it isn't wider than the containing Z Schema box. See
<a href="zschema.html"><zschema></a> for proper usage.
"""
def... | derekmd/opentag-presenter | tags/zschemaname.py | Python | bsd-2-clause | 2,160 | 0.056019 |
import unittest
RESOURCE_NAME = 'Test_Resource'
class BaseEndpointTest(unittest.TestCase):
def setUp(self):
self.endpoint = None
self.resources = {}
self.template = {
'Resources': self.resources
}
def test_resource_name(self):
if self.endpoint:
... | pebble/spacel-provision | src/test/provision/app/alarm/endpoint/__init__.py | Python | mit | 688 | 0 |
#This file is part of Tryton & Nereid. The COPYRIGHT file at the top level of
#this repository contains the full copyright notices and license terms.
import imp
from flask.config import ConfigAttribute, Config as ConfigBase # noqa
class Config(ConfigBase):
"Configuration without the root_path"
def __init__... | NaN-tic/nereid | nereid/config.py | Python | gpl-3.0 | 1,087 | 0.00184 |
#!/usr/bin/env python
"""
demos reading HiST camera parameters from XML file
"""
from histutils.hstxmlparse import xmlparam
from argparse import ArgumentParser
if __name__ == "__main__":
p = ArgumentParser()
p.add_argument("fn", help="xml filename to parse")
p = p.parse_args()
params = xmlparam(p.fn)... | scienceopen/histutils | XMLparamPrint.py | Python | mit | 340 | 0 |
from __future__ import print_function
import os
import time
import json
import datetime
import argparse
import requests
from message import Message
if __name__ == '__main__':
parser = argparse.ArgumentParser()
parser.add_argument('-f','--format', default="protobuf", choices=["protobuf","json"], help="message f... | wunderlist/hamustro | utils/send_single_message.py | Python | mit | 1,002 | 0.00499 |
"""Support for Geofency."""
import logging
from aiohttp import web
import voluptuous as vol
from homeassistant.components.device_tracker import DOMAIN as DEVICE_TRACKER
from homeassistant.const import (
ATTR_LATITUDE,
ATTR_LONGITUDE,
ATTR_NAME,
CONF_WEBHOOK_ID,
HTTP_OK,
HTTP_UNPROCESSABLE_ENTI... | nkgilley/home-assistant | homeassistant/components/geofency/__init__.py | Python | apache-2.0 | 4,573 | 0.000219 |
{'comment': {'handle': 'matt@example.com',
'id': 2603645287324504065,
'message': 'I think differently now.',
'resource': '/api/v1/comments/2603645287324504065',
'url': '/event/jump_to?event_id=2603645287324504065'}}
| macobo/documentation | code_snippets/results/result.api-comment-edit.py | Python | bsd-3-clause | 224 | 0.017857 |
# -*- coding: utf-8 -*-
##############################################################################
# For copyright and license notices, see __openerp__.py file in module root
# directory
##############################################################################
from openerp import fields, models, api, _
from op... | adrianpaesani/odoo-argentina | l10n_ar_invoice/models/afip.py | Python | agpl-3.0 | 6,822 | 0.000293 |
#
# 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... | apache/incubator-airflow | tests/providers/google/cloud/transfers/test_oracle_to_gcs.py | Python | apache-2.0 | 6,070 | 0.002471 |
from __future__ import absolute_import
from __future__ import print_function
from __future__ import unicode_literals
"""
Get package download statistics from PyPI
"""
# Based on https://github.com/collective/Products.PloneSoftwareCenter\
# /commit/601558870175e35cfa4d05fb309859e580271a1f
# For sorting XML-RPC result... | benjaoming/simple-pypi-statistics | simple_pypi_statistics/api.py | Python | gpl-2.0 | 6,238 | 0.000321 |
#!/usr/bin/env python
#
# 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
# "... | kgiusti/pyngus | examples/perf-tool.py | Python | apache-2.0 | 6,874 | 0 |
# # 1. Define a function max() that takes two numbers as arguments and returns the largest of them.
# # Use the if-then-else construct available in Python.
# # (It is true that Python has the max() function built in, but writing it yourself is nevertheless a good exercise.)
#
# def max (a, b):
# if a>b:
# r... | openUniverse/singularity | BensPractice/Practise2.py | Python | mit | 2,825 | 0.013805 |
import codecs
input_filename = '/home/jittat/mydoc/directadm53/payment/assignment.csv'
quota_filename = '/home/jittat/mydoc/directadm53/payment/quota.txt'
output_filename = '/home/jittat/mydoc/directadm53/payment/assignment-added.csv'
def read_quota():
q_data = {
'nat_id': {},
'firstname': {},
... | jittat/ku-eng-direct-admission | scripts/filter_quota.py | Python | agpl-3.0 | 1,880 | 0.007447 |
from __future__ import print_function
import sys
import argparse
import numpy as np
def max3(x, y, z):
return max(max(x, y), z)
def lcs(s1, s2):
m = len(s1)
n = len(s2)
t = np.zeros((n + 2, m + 2), dtype=int)
for j in range(1, n + 1):
for i in range(1, m + 1):
is_same = 0
... | yoriyuki/nksnd | nksnd/evaluate.py | Python | mit | 2,104 | 0.003802 |
from thrift.protocol import TBinaryProtocol
from thrift.transport import TTransport
import pickle
import bz2
def SerializeThriftMsg(msg, protocol_type=TBinaryProtocol.TBinaryProtocol):
"""Serialize a thrift message using the given protocol.
The default protocol is binary.
Args:
msg: the... | wayetender/whip | whip/src/adapter/util/serialization.py | Python | gpl-2.0 | 1,453 | 0.007571 |
# -*- coding: utf-8 -*-
from __future__ import absolute_import
from __future__ import unicode_literals
from collections import namedtuple
from botocore.vendored.requests.exceptions import ReadTimeout
from py_swf.errors import NoTaskFound
__all__ = ['DecisionClient', 'DecisionTask']
DecisionTask = namedtuple('Dec... | quantsini/pyswf | py_swf/clients/decision.py | Python | mit | 9,074 | 0.002976 |
# You can edit these settings and save them, they
# will be applied immediately and remembered for next time.
# This will reset the interpreter.
# ******************************************************************************* #
# If changing these settings makes the interpreter unrecoverable, you #
# can... | Eloff/silvershell | client/silvershell/white_on_black_prefs.py | Python | bsd-3-clause | 6,018 | 0.003157 |
# -*- coding: utf-8 -*-
# Copyright: (c) 2012, Dag Wieers <dag@wieers.com>
# GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt)
from __future__ import (absolute_import, division, print_function)
__metaclass__ = type
DOCUMENTATION = '''
callback: mail
type: notification
short_d... | vmindru/ansible | lib/ansible/plugins/callback/mail.py | Python | gpl-3.0 | 8,479 | 0.002831 |
import logging
logging.basicConfig(
level=logging.INFO, format='%(asctime)s|%(name)s|%(levelname)s|%(message)s')
logging.getLogger('vcr.stubs').setLevel(logging.WARNING)
logging.getLogger('requests.packages.urllib3.connectionpool')\
.setLevel(logging.WARNING)
def get_logger(*args, **kwargs):
return loggi... | mindriot101/k2catalogue | k2catalogue/k2logging.py | Python | mit | 350 | 0.002857 |
#!/usr/bin/python
# Copyright (c) 2015, BROCADE COMMUNICATIONS SYSTEMS, INC
# All rights reserved.
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions are met:
# 1. Redistributions of source code must retain the above copyright n... | tnadeau/pybvc | samples/sampleopenflow/demos/demo42.py | Python | bsd-3-clause | 8,783 | 0.00353 |
# -*- coding: utf-8 -*-
'''
test_qgscomposerlabel.py
--------------------------------------
Date : Oct 2012
Copyright : (C) 2012 by Dr. Hugo Mercier
email : hugo dot mercier at oslandia dot com
*****************... | herow/planning_qgis | tests/src/python/test_qgscomposerlabel.py | Python | gpl-2.0 | 4,750 | 0.017053 |
# -*- coding: utf-8 -*-
# Form implementation generated from reading ui file 'lassoui.ui'
#
# Created: Sat Apr 11 09:14:27 2015
# by: PyQt4 UI code generator 4.10.4
#
# WARNING! All changes made in this file will be lost!
from PyQt4 import QtCore, QtGui
try:
_fromUtf8 = QtCore.QString.fromUtf8
except Attrib... | mlskit/astromlskit | REGRESSION/lassofront.py | Python | gpl-3.0 | 3,925 | 0.000764 |
from lxml import html
def main():
dom = html.parse(('http://www.amazon.com/Apple-MH0W2LL-10-Inch-Retina-'
'Display/dp/B00OTWOAAQ/ref=sr_1_1?s=pc&ie=UTF8&'
'qid=1459799371&sr=1-1&keywords=ipad'))
title = dom.find('//*[@id="productTitle"]')
print(title.text)
if... | yrunts/python-for-qa | 4-http-json-xml-html/examples/html_parse.py | Python | cc0-1.0 | 358 | 0.002793 |
#!/usr/bin/env python
#
# pKaTool - analysis of systems of titratable groups
# Copyright (C) 2010 Jens Erik Nielsen
#
# 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 Lice... | dmnfarrell/peat | pKaTool/titration_class.py | Python | mit | 5,464 | 0.010615 |
### Author: Bert de Bruijn <bert+dstat$debruijn,be>
### VMware ESX kernel vmknic stats
### Displays VMkernel port statistics on VMware ESX servers
# NOTE TO USERS: command-line plugin configuration is not yet possible, so I've
# "borrowed" the -N argument.
# EXAMPLES:
# # dstat --vmknic -N vmk1
# You can even combine... | dagwieers/dstat | plugins/dstat_vmk_nic.py | Python | gpl-2.0 | 2,648 | 0.009819 |
__author__ = 'benji'
| oldm/OldMan | oldman/validation/__init__.py | Python | bsd-3-clause | 21 | 0 |
#!/usr/bin/env python
import sys
import re
import getopt
from typing import List, Tuple
from feed_maker_util import IO
def main() -> int:
link: str = ""
title: str = ""
url_prefix = ""
state = 0
num_of_recent_feeds = 1000
optlist, _ = getopt.getopt(sys.argv[1:], "f:n:")
for o, a in optl... | terzeron/FeedMakerApplications | funbe/capture_item_funbe.py | Python | gpl-2.0 | 1,590 | 0.000629 |
# -*- coding: utf-8 -*-
# This file is part of Shuup.
#
# Copyright (c) 2012-2016, Shoop Ltd. All rights reserved.
#
# This source code is licensed under the AGPLv3 license found in the
# LICENSE file in the root directory of this source tree.
from shuup.xtheme.editing import could_edit, is_edit_mode, set_edit_mode
fro... | shawnadelic/shuup | shuup_tests/xtheme/test_edit.py | Python | agpl-3.0 | 681 | 0 |
# Copyright (C) 2013-2016 DNAnexus, Inc.
#
# This file is part of dx-toolkit (DNAnexus platform client libraries).
#
# 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.a... | johnwallace123/dx-toolkit | src/python/dxpy/cli/workflow.py | Python | apache-2.0 | 11,696 | 0.00436 |
import itertools
import numpy as np
from vanilla_neural_nets.base.loss_function import BaseLossFunction
class CrossEntropyLoss(BaseLossFunction):
@classmethod
def loss(cls, y_true, y_predicted):
return cls.total_loss(y_true=y_true, y_predicted=y_predicted) / len(y_true)
@classmethod
def to... | cavaunpeu/vanilla-neural-nets | vanilla_neural_nets/recurrent_neural_network/loss_function.py | Python | mit | 606 | 0.008251 |
#!/usr/bin/env python3
# Copyright (c) 2014-2020 The Bitcoin Core developers
# Distributed under the MIT software license, see the accompanying
# file COPYING or http://www.opensource.org/licenses/mit-license.php.
"""Test descendant package tracking code."""
from decimal import Decimal
from test_framework.blocktools ... | domob1812/bitcoin | test/functional/mempool_packages.py | Python | mit | 16,008 | 0.003686 |
from matplotlib import pyplot as plt
import numpy as np
class Spline(object):
"""Forms a cublic spline on an interval given values and derivatives at the endpoints of that interval."""
def __init__(self, x1, y1, dy1, x2, y2, dy2):
self.x1 = x1
self.x2 = x2
self.y1 = y1
self.y2 ... | amanzi/ats-dev | tools/utils/plot_wrm.py | Python | bsd-3-clause | 6,867 | 0.011213 |
def func():
value = "not-none"
# pylint: disable=unused-argument1
<caret>if value is None:
print("None")
# pylint: disable=unused-argument2
print(value)
| siosio/intellij-community | python/testData/intentions/PyInvertIfConditionIntentionTest/commentsPylintNoElseBoth.py | Python | apache-2.0 | 183 | 0.005464 |
# Copyright 2013 IBM Corp.
#
# 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... | takeshineshiro/nova | nova/tests/unit/objects/test_objects.py | Python | apache-2.0 | 68,588 | 0.000029 |
"""Seqan Doc Links for Trac.
Version 0.1.
Copyright (C) 2010 Manuel Holtgrewe
Install by copying this file into the plugins directory of your trac
work directory. In your trac.ini, you can use something like this
(the following also shows the defaults).
[seqan_doc_links]
prefix = seqan
base_url = http://www.... | h-2/seqan | misc/trac_plugins/DocLinks/doc_links/macro.py | Python | bsd-3-clause | 7,207 | 0.002498 |
import re
from rest_framework import serializers
from seahub.auth import authenticate
from seahub.api2.models import Token, TokenV2, DESKTOP_PLATFORMS
from seahub.api2.utils import get_client_ip
from seahub.utils import is_valid_username
def all_none(values):
for value in values:
if value is not None:
... | cloudcopy/seahub | seahub/api2/serializers.py | Python | apache-2.0 | 4,418 | 0.003395 |
# Copyright (c) 2013, Web Notes Technologies Pvt. Ltd. and Contributors
# License: GNU General Public License v3. See license.txt
from __future__ import unicode_literals
import frappe
def execute():
frappe.reload_doc("regional", "doctype", "gst_settings")
frappe.reload_doc("accounts", "doctype", "gst_account")
gst... | Zlash65/erpnext | erpnext/patches/v10_0/set_b2c_limit.py | Python | gpl-3.0 | 417 | 0.014388 |
import os
yandex_api_key = os.environ['YANDEX_API_KEY']
weather_underground_api_key = os.environ['WEATHER_UNDERGROUND_API_KEY']
| hombit/house | house/secrets.py | Python | mit | 130 | 0 |
#! python3
###############################################################################
# Copyright (c) 2016, PulseRain Technology LLC
#
# This program is distributed under a dual license: an open source license,
# and a commercial license.
#
# The open source license under which this program is distributed is t... | PulseRain/Arduino_M10_IDE | M10_upload/FP51_upload.py | Python | lgpl-3.0 | 9,618 | 0.020067 |
import fileinput
def str_to_int(s):
return([ int(x) for x in s.split() ])
# args = [ 'line 1', 'line 2', ... ]
def proc_input(args):
(n, l) = str_to_int(args[0])
a = tuple(str_to_int(args[1]))
return(l, a)
def solve(args, verbose=False):
(l, a) = proc_input(args)
list_a = list(a)
list_a.sort()
max_dist = max... | cripplet/practice | codeforces/492/attempt/b_lanterns.py | Python | mit | 897 | 0.044593 |
from tests import tests
def test_toggle():
temporary = tests.toggled_seats
assert temporary == [[1, 1, 1], [1, 1, 1], [1, 1, 1]] | kevindiltinero/seass3 | tests/test_toggle.py | Python | bsd-2-clause | 137 | 0.014599 |
from sympy import (
Abs, Dummy, Eq, Gt, Function,
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, Union... | mafiya69/sympy | sympy/solvers/tests/test_solveset.py | Python | bsd-3-clause | 40,909 | 0.001076 |
#!/usr/bin/env python3
# Copyright (c) 2017-2019 The Bitcoin Core developers
# Distributed under the MIT software license, see the accompanying
# file COPYING or http://www.opensource.org/licenses/mit-license.php.
"""Class for bitcoind node under test"""
import contextlib
import decimal
import errno
from enum import E... | yacoin/yacoin | test/functional/test_framework/test_node.py | Python | mit | 24,353 | 0.003203 |
#!/usr/bin/env python3
"""
Meerkat API Tests
Unit tests for the location resource in Meerkat API
"""
import json
import unittest
import meerkat_api
from meerkat_api.test import db_util
from meerkat_api.resources import locations
from meerkat_api.test.test_data.locations import DEVICE_IDS_CSV_LIST, DEVICEID_1, DEVICE_I... | meerkat-code/meerkat_api | meerkat_api/test/test_locations.py | Python | mit | 8,430 | 0.00083 |
#!/usr/bin/env python
# -*- coding: UTF-8 -*-
##### ##### ===== 포함 파일 =====
# 개인적인 아이디, 비밀번호 파일.
from personal.jconfig import LOGIN_ID, LOGIN_PW
# scrapy item 파일.
from joonggonara.items import JoonggonaraItem
# 로그인을 위한 FormRequest.
# 로그인 이후 크롤링을 위한 Request.
from scrapy.http import FormRequest, Request
# 게시판 페이지에서 ... | munhyunsu/UsedMarketAnalysis | joonggonara_crawl/joonggonara/spiders/lgt_spiders.py | Python | gpl-3.0 | 7,133 | 0.033962 |
# generated from catkin/cmake/template/pkg.context.pc.in
CATKIN_PACKAGE_PREFIX = ""
PROJECT_PKG_CONFIG_INCLUDE_DIRS = "".split(';') if "" != "" else []
PROJECT_CATKIN_DEPENDS = "".replace(';', ' ')
PKG_CONFIG_LIBRARIES_WITH_PREFIX = "".split(';') if "" != "" else []
PROJECT_NAME = "laser_scan_publisher_tutorial"
PROJEC... | nicolasgallardo/TECHLAV_T1-6 | bebop_ws/build/laser_scan_publisher_tutorial/catkin_generated/pkg.develspace.context.pc.py | Python | gpl-2.0 | 389 | 0 |
from __future__ import with_statement
import sys
import logging
import warnings
import django
from django.conf import settings
try:
from django.conf.urls import patterns, url
except ImportError: # Django < 1.4
from django.conf.urls.defaults import patterns, url
from django.core.exceptions import ObjectDoesNotEx... | rtucker-mozilla/WhistlePig | vendor-local/lib/python/tastypie/resources.py | Python | bsd-3-clause | 94,814 | 0.002067 |
# -*- encoding: utf-8 -*-
##############################################################################
# For copyright and license notices, see __openerp__.py file in root directory
##############################################################################
from openerp import fields, models, api
import logging
_... | sysadminmatmoz/ingadhoc | account_journal_book/models/account.py | Python | agpl-3.0 | 1,050 | 0 |
import xml.etree.ElementTree as et
import os, time
from xml.etree.ElementTree import Element
from PyQt4 import QtCore, QtGui
class Helper():
#initiatlizes the class and prepares an XMLtree for parsing
def __init__(self):
self.tree = et.parse('./data/data.xml')
self.root = self.tree.getroot()
def wr... | CPSC491FileMaker/project | helper.py | Python | gpl-2.0 | 2,133 | 0.018753 |
from sofi.ui import TableRow
def test_basic():
assert(str(TableRow()) == "<tr></tr>")
def test_text():
assert(str(TableRow("text")) == "<tr>text</tr>")
def test_custom_class_ident_style_and_attrs():
assert(str(TableRow("text", cl='abclass', ident='123', style="font-size:0.9em;", attrs={"data-test": 'abc'... | tryexceptpass/sofi | test/tablerow_test.py | Python | mit | 429 | 0.011655 |
""" A simple restful webservice to provide access to the wiki.db"""
import json
from bottle import Bottle, run, response, static_file, redirect
from dbfunctions import Wikidb
api = Bottle()
db = Wikidb()
@api.route('/static/<filepath:path>')
def static(filepath):
return static_file(filepath, root='./static')
@... | mtik00/bottle-wiki | wikiapi.py | Python | mit | 1,234 | 0.007293 |
import json
import correlation
import category
import tools
import settings
from matplotlib.backends.backend_pdf import PdfPages
def process_data(data_type, stats, highlights):
print("Starting student data processing.")
all_pdf_path, highlight_pdf_path = (None,None)
question_types, demographic_question... | code-ape/SocialJusticeDataProcessing | stats.py | Python | apache-2.0 | 3,877 | 0.003869 |
"""
The setup package to install MasterQA dependencies
"""
from setuptools import setup, find_packages # noqa
import os
import sys
this_directory = os.path.abspath(os.path.dirname(__file__))
long_description = None
total_description = None
try:
with open(os.path.join(this_directory, 'README.md'), 'rb') as f:
... | masterqa/MasterQA | setup.py | Python | mit | 2,876 | 0 |
# -*- coding: utf-8 -*-
# This file is part of Shoop.
#
# Copyright (c) 2012-2016, Shoop Ltd. All rights reserved.
#
# This source code is licensed under the AGPLv3 license found in the
# LICENSE file in the root directory of this source tree.
from __future__ import unicode_literals
from django.template.loader import ... | akx/shoop | shoop/xtheme/plugins/_base.py | Python | agpl-3.0 | 7,820 | 0.002046 |
"""
This module contains a single class that manages the scraping of data
from one or more supermarkets on mysupermarket.co.uk
"""
from datetime import datetime
from os import remove
from os.path import isfile, getmtime
from time import time
from scrapy import signals
from scrapy.crawler import Crawler
from scrapy.uti... | hmcc/price-search | scraper/scraper.py | Python | mit | 3,591 | 0.003063 |
from __future__ import unicode_literals
import logging
import operator
import os
import sys
import urllib2
from mopidy import backend, exceptions, models
from mopidy.audio import scan, utils
from mopidy.internal import path
logger = logging.getLogger(__name__)
FS_ENCODING = sys.getfilesystemencoding()
class FileL... | pacificIT/mopidy | mopidy/file/library.py | Python | apache-2.0 | 4,786 | 0 |
from datetime import datetime
from django.contrib.auth.decorators import login_required
from django.views.decorators.csrf import csrf_exempt
from django.http import JsonResponse
from Core.models import RosterAudit, RosterUser
@login_required
@csrf_exempt
def myroster_rows(request):
"""
Obtain all the rows for... | faisaltheparttimecoder/EMEARoster | MyRoster/views.py | Python | mit | 1,122 | 0.000891 |
from django.db import models
class Person(models.Model):
name = models.CharField(max_length=255, default='Robot')
age = models.IntegerField()
class Meta:
app_label = 'test_djangoitem'
class IdentifiedPerson(models.Model):
identifier = models.PositiveIntegerField(primary_key=True)
name = ... | elkingtowa/pyrake | tests/test_djangoitem/models.py | Python | mit | 440 | 0.002273 |
# anchorGenerator
from models.anchor import *
# main function
if __name__=='__main__':
# TEMP: Wipe existing anchors
# anchors = Anchor.all(size=1000)
# Anchor.delete_all(anchors)
# THIS IS TEMPORARY:
anchors = {'Vaccination', 'Vaccinations', 'Vaccine', 'Vaccines', 'Inoculation', 'Immunization', 'Shot', 'Chicken... | ControCurator/controcurator | python_code/anchorGenerator.py | Python | mit | 1,229 | 0.026037 |
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.test import TestCase
from django.conf import settings
from django.core.urlresolvers import reverse
from django.contrib.auth.models import User
from powerpages.models import Page
from powerpages.sync import PageFileDumper
from powerpages.admi... | Open-E-WEB/django-powerpages | powerpages/tests/test_admin.py | Python | mit | 7,705 | 0 |
# Copyright (C) 2014 - Oscar Campos <oscar.campos@member.fsf.org>
# This program is Free Software see LICENSE file for details
"""AnacondaPHP is a PHP linting plugin for Sublime Text 3
"""
from .plugin_version import anaconda_required_version
from .anaconda_lib.anaconda_plugin import anaconda_version
if anaconda_r... | danalec/dotfiles | sublime/.config/sublime-text-3/Packages/anaconda_php/anaconda_php.py | Python | mit | 673 | 0 |
# http://www.pythonchallenge.com/pc/def/equality.html
import re
file_ob = open("3.dat", 'r')
ob_read = file_ob.read()
read_arr = list(ob_read)
word = []
def for_loop(): # Loops through array to find solution
for i in range(len(read_arr)):
if (i + 8) > len(read_arr): # To keep index in bounds
break
if not(... | yarabarla/python-challenge | 3.py | Python | mit | 812 | 0.022167 |
"""
Contains the python specific FileManager.
"""
import ast
import re
from pyqode.core.api import TextBlockHelper
from pyqode.core.managers import FileManager
class PyFileManager(FileManager):
"""
Extends file manager to override detect_encoding. With python, we can
detect encoding by reading the two fir... | zwadar/pyqode.python | pyqode/python/managers/file.py | Python | mit | 2,598 | 0 |
from .element import Element
class Anchor(Element):
"""Implements the <a> tag"""
def __init__(self, text=None, href="#", cl=None, ident=None, style=None, attrs=None):
super().__init__(cl=cl, ident=ident, style=style, attrs=attrs)
self.href = href
if text:
self._children.... | tryexceptpass/sofi | sofi/ui/anchor.py | Python | mit | 1,243 | 0.004023 |
URL = {
3304557: {
"production": "https://notacarioca.rio.gov.br/WSNacional/nfse.asmx?wsdl",
"sandbox": "https://homologacao.notacarioca.rio.gov.br/WSNacional/nfse.asmx?wsdl"
}
}
TEMPLATES = {
'send_rps': "GerarNfseEnvio.xml",
'status': "ConsultarNfseEnvio.xml",
'get_nfse': "Consult... | adrianomargarin/py-notacarioca | notacarioca/settings.py | Python | apache-2.0 | 377 | 0.007958 |
from lib.common import helpers
class Module:
def __init__(self, mainMenu, params=[]):
self.info = {
'Name': 'Get-AntiVirusProduct',
'Author': ['@mh4x0f', 'Jan Egil Ring'],
'Description': ('Get antivirus product information.'),
'Background' : True,
... | adaptivethreat/Empire | lib/modules/powershell/situational_awareness/host/antivirusproduct.py | Python | bsd-3-clause | 4,095 | 0.012698 |
from setuptools import setup, find_packages
setup(
name = "FreeCite",
version = "0.1",
py_modules = ['freecite'],
#install requirements
install_requires = [
'requests==1.1.0'
],
#author details
author = "James Ravenscroft",
author_email = "ravenscroftj@gmail... | ravenscroftj/freecite | setup.py | Python | mit | 446 | 0.042601 |
# -*- coding: utf-8 -*-
__author__ = 'degibenz'
import logging
log = logging.getLogger(__name__)
log.setLevel(logging.DEBUG)
import json
from aiohttp import web
from core.model import ObjectId
from core.exceptions import *
from models.chat import *
from models.client import Client, Token
__all__ = [
'ChatWS'... | degibenz/vispa-chat | src/api/chat_ws.py | Python | mit | 5,947 | 0.002097 |
from .attribute import html_attribute
from .element import VoidElement
class Image(VoidElement):
"""An HTML image (<img>) element.
Images must have an alternate text description that describes the
contents of the image, if the image can not be displayed. In some
cases the alternate text can be empty.... | srittau/python-htmlgen | htmlgen/image.py | Python | mit | 952 | 0 |
from mumax2 import *
# Standard Problem 4
Nx = 32
Ny = 32
Nz = 1
setgridsize(Nx, Ny, Nz)
setcellsize(500e-9/Nx, 125e-9/Ny, 3e-9/Nz)
load('micromagnetism')
load('solver/rk12')
setv('Msat', 800e3)
setv('demag_acc', 7)
setv('Aex', 1.3e-11)
setv('alpha', 1)
setv('dt', 1e-12)
setv('m_maxerror', 1./1000)
new_maxabs("my_m... | mumax/2 | tests/reduce.py | Python | gpl-3.0 | 704 | 0.012784 |
"""
Classes used for defining and running nose test suites
"""
import os
from paver.easy import call_task
from pavelib.utils.test import utils as test_utils
from pavelib.utils.test.suites import TestSuite
from pavelib.utils.envs import Env
__test__ = False # do not collect
class NoseTestSuite(TestSuite):
"""
... | wwj718/ANALYSE | pavelib/utils/test/suites/nose_suite.py | Python | agpl-3.0 | 5,609 | 0 |
from osweb.projects.ManageProject import ManageProject
from osweb.projects.projects_data import ProjectsData | openshine/osweb | osweb/projects/__init__.py | Python | gpl-3.0 | 108 | 0.009259 |
#!/usr/bin/env python
# DummyMP - Multiprocessing Library for Dummies!
# Copyright 2014 Albert Huang.
#
# 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/LI... | alberthdev/pyradmon | pyradmon/dummymp/loghandler.py | Python | apache-2.0 | 2,314 | 0.008643 |
name0_1_1_0_0_2_0 = None
name0_1_1_0_0_2_1 = None
name0_1_1_0_0_2_2 = None
name0_1_1_0_0_2_3 = None
name0_1_1_0_0_2_4 = None | siosio/intellij-community | python/testData/completion/heavyStarPropagation/lib/_pkg0/_pkg0_1/_pkg0_1_1/_pkg0_1_1_0/_pkg0_1_1_0_0/_mod0_1_1_0_0_2.py | Python | apache-2.0 | 128 | 0.007813 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.