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 |
|---|---|---|---|---|---|
import logging
from django.conf import settings
from django.template.loader import render_to_string
try:
import weasyprint as wp
PDF_EXPORT_AVAILABLE = True
except ImportError:
PDF_EXPORT_AVAILABLE = False
from froide.helper.text_utils import remove_closing_inclusive
logger = logging.getLogger(__name_... | stefanw/froide | froide/foirequest/pdf_generator.py | Python | mit | 1,902 |
from ase.io import read
from ase.calculators.emt import EMT
from ase.neb import NEB
from ase.optimize import BFGS
# read the last structures (of 5 images used in NEB)
images = read('neb.traj@-5:')
for i in range(1, len(images) - 1):
images[i].set_calculator(EMT())
neb = NEB(images)
qn = BFGS(neb, trajectory='neb... | misdoro/python-ase | doc/tutorials/neb/diffusion4.py | Python | gpl-2.0 | 355 |
from afqueue.common.encoding_utilities import cast_string, cast_list_of_strings
from afqueue.common.exception_formatter import ExceptionFormatter #@UnresolvedImport
from afqueue.data_objects.exchange_wrapper import ExchangeWrapper #@UnresolvedImport
from afqueue.data_objects.data_queue_wrapper import DataQueueWrapper #... | appfirst/distributed_queue_manager | afqueue/source/shared_memory_manager.py | Python | mit | 41,372 |
from unittest import mock
import datetime
from django.test import TestCase
from django.utils import timezone
from django.core.management import call_command
from model_mommy import mommy
from matches.models import Bracket, Round, Match, MatchNotification
from players.models import Player
class SendCurrentMatchupsT... | kevinharvey/django-tourney | tourney/matches/tests/test_commands.py | Python | gpl-3.0 | 2,074 |
#-*- coding: utf-8 -*-
try:
from PIL import Image
from PIL import ExifTags
except ImportError:
try:
import Image
import ExifTags
except ImportError:
raise ImportError("The Python Imaging Library was not found.")
def get_exif(im):
try:
exif_raw = im._getexif() or {}
... | stefanfoulis/django-filer-travis-testing | filer/utils/pil_exif.py | Python | bsd-3-clause | 759 |
from a10sdk.common.A10BaseClass import A10BaseClass
class XmlSchema(A10BaseClass):
"""Class Description::
XML-Schema File.
Class xml-schema supports CRUD Operations and inherits from `common/A10BaseClass`.
This class is the `"PARENT"` class for this module.`
:param uuid: {"description": "uu... | amwelch/a10sdk-python | a10sdk/core/export/export_periodic_xml_schema.py | Python | apache-2.0 | 1,752 |
"""Testing for bicluster metrics module"""
import numpy as np
from sklearn.utils._testing import assert_almost_equal
from sklearn.metrics.cluster._bicluster import _jaccard
from sklearn.metrics import consensus_score
def test_jaccard():
a1 = np.array([True, True, False, False])
a2 = np.array([True, True, T... | glemaitre/scikit-learn | sklearn/metrics/cluster/tests/test_bicluster.py | Python | bsd-3-clause | 1,698 |
#!/usr/bin/env python
# encoding: utf-8
import os
import os.path as osp
import platform
import time
import commands
import xml.etree.ElementTree as ET
try:
from collections import OrderedDict
except ImportError:
from ordereddict import OrderedDict
OS_SYSTEM = platform.system()
IS_WINDOWS = OS_SYSTEM == "Windo... | Zuckonit/weekr | weekr/core/logparser.py | Python | gpl-2.0 | 5,443 |
from __future__ import division
import pyaudio
import wave
import sys
import scipy
import numpy as np
import struct
#from scikits.audiolab import flacread
from numpy.fft import rfft, irfft
from numpy import argmax, sqrt, mean, diff, log
import matplotlib
from scipy.signal import blackmanharris, fftconvolve
from time... | LucidBlue/mykeepon-storyteller | src/audio_capture_test.py | Python | bsd-3-clause | 5,709 |
import six
import json
from userjs.userjs_settings import JSON_HANDLERS
def _json_handlers(obj):
"""Extra handlers that JSON aren't able to parse.
The only built-in conversion is for datetime. User configured handlers
are tried for other types. If they all fail, raise TypeError.
"""
if hasattr... | tweekmonster/django-userjs | userjs/utils.py | Python | bsd-3-clause | 1,325 |
'''
@date Sep 10, 2010
@author Matthew Todd
This file is part of Test Parser
by Matthew A. Todd
Test Parser 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) an... | matcatc/Test_Parser | src/TestParser/Model/FileRunner.py | Python | gpl-3.0 | 2,639 |
# -*- coding: UTF-8 -*-
#! python3 # noqa E265
"""
Isogeo API v1 - Enums for Resource entity accepted kinds
See: http://help.isogeo.com/api/complete/index.html#definition-application
"""
# #############################################################################
# ########## Libraries #############
# ##... | isogeo/isogeo-plugin-qgis | modules/isogeo_pysdk/enums/application_types.py | Python | gpl-3.0 | 2,044 |
import subprocess
import os
import pyblish
path = os.path.join(os.path.dirname(__file__), 'pyblish_util.py')
executable = os.path.dirname(os.path.dirname(pyblish.__file__))
executable = os.path.dirname(os.path.dirname(os.path.dirname(executable)))
executable = os.path.dirname(executable)
executable = os.path.join(e... | mkolar/pyblish-ftrack | pyblish_ftrack/ftrack_event_plugin_path/environment_wrapper.py | Python | lgpl-3.0 | 402 |
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
Q2(c): Recurrent neural nets for NER
"""
from __future__ import absolute_import
from __future__ import division
import argparse
import logging
import sys
import tensorflow as tf
import numpy as np
logger = logging.getLogger("hw3.q2.1")
logger.setLevel(logging.DEBUG... | kabrapratik28/Stanford_courses | cs224n/assignment3/q2_rnn_cell.py | Python | apache-2.0 | 5,031 |
import unittest2
from faker import Faker
from nose.plugins.attrib import attr
from . import helper
from hapi.contacts import ContactsClient
fake = Faker()
class ContactsClientTestCase(unittest2.TestCase):
""" Unit tests for the HubSpot Contacts API Python client.
This file contains some unittest tests... | CBitLabs/hapipy | hapi/test/test_contacts.py | Python | apache-2.0 | 3,881 |
from django.contrib.sitemaps import Sitemap
from django.conf import settings
from django.db import models
class BaseContent(models.Model):
title = models.CharField(max_length=200)
content = models.TextField(blank=True,
help_text='Syntax examples (reStructuredText):<br /><br />'
'<code... | umitproject/tease-o-matic | minicms/models.py | Python | bsd-3-clause | 2,811 |
#!/usr/bin/env python
#
# Tate - lightweight Mazacoin client
# Copyright (C) 2014 Thomas Voegtlin
#
# 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... | mazaclub/tate | lib/daemon.py | Python | gpl-3.0 | 6,841 |
# -*- coding: utf-8 -*-
"""
/***************************************************************************
QGIS Web Processing Service Plugin
-------------------------------------------------------------------
Date : 09 November 2009
Copyright : (C) 2009 by Dr. Horst Duester
email ... | sourcepole/qgis-wps-client | wpslib/executionrequest.py | Python | gpl-2.0 | 17,172 |
#!/usr/bin/env python
# From
# http://twistedmatrix.com/documents/current/web/howto/using-twistedweb.html
#
# And modified to accept a maximum size following the example at:
# http://stackoverflow.com/questions/6491932/need-help-writing-a-twisted-proxy
# JBC. March 2012.
"""\
Be a nice http proxy server. To use with... | torrents-com/content | scrapy/torrents/remote/http_proxy.py | Python | agpl-3.0 | 3,618 |
"Thread-safe in-memory cache backend."
import time
from contextlib import contextmanager
from django.core.cache.backends.base import DEFAULT_TIMEOUT, BaseCache
from django.utils.synch import RWLock
try:
from django.utils.six.moves import cPickle as pickle
except ImportError:
import pickle
# Global in-memor... | BitWriters/Zenith_project | zango/lib/python3.5/site-packages/django/core/cache/backends/locmem.py | Python | mit | 4,287 |
# Copyright 2014 Massimo Santini, Raffaella Migliaccio
#
# This file is part of MarkovDrummer.
#
# MarkovDrummer 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 o... | mapio/markovdrummer | markovdrummer/midi/symbolic.py | Python | gpl-3.0 | 4,031 |
import fileinput
import argparse
from astexport import __version__, __prog_name__
from astexport.parse import parse
from astexport.export import export_json
def create_parser():
parser = argparse.ArgumentParser(
prog=__prog_name__,
description="Python source code in, JSON AST out. (v{})".format(
... | fpoli/python-astexport | astexport/cli.py | Python | mit | 1,148 |
from app.resources import ProtectedResource
from flask import jsonify
from app.models import Community
from app.util import is_not_valid_entity_name
from app.decorators import json_content
from app import db, app
class CommunityResource(ProtectedResource):
def get(self):
communities = Community.query.all(... | dpfg/kicker-scorer-api | app/resources/communities.py | Python | mit | 959 |
from __future__ import absolute_import, unicode_literals
from dash.orgs.models import Org
from dateutil.relativedelta import relativedelta
from django.core.management.base import BaseCommand, CommandError
from django.utils import timezone
from optparse import make_option
from temba.utils import format_iso8601
from tra... | ewheeler/tracpro | tracpro/polls/management/commands/fetchruns.py | Python | bsd-3-clause | 2,846 |
# -*- coding: utf-8 -*-
#
# django-azurite documentation build configuration file, created by
# sphinx-quickstart on Wed Feb 6 22:02:52 2013.
#
# 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.
... | drewtempelmeyer/django-azurite | docs/conf.py | Python | mit | 8,044 |
# 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
@frappe.whitelist()
def get_items(price_list, sales_or_purchase, item=None, item_group=None):
condition = ""
args = {"price_list": p... | suyashphadtare/vestasi-erp-1 | erpnext/erpnext/accounts/doctype/sales_invoice/pos.py | Python | agpl-3.0 | 1,595 |
import os
from flask import Flask
from flask.ext.mongoengine import MongoEngine
from flask.ext.login import LoginManager
UPLOAD_FOLDER = '/srv/cars/cars/data/images'
if 'TRAVIS' in os.environ:
UPLOAD_FOLDER = '{0}/{1}'.format(os.environ['TRAVIS_BUILD_DIR'],
'cars/data/images'... | wiliamsouza/cars | cars/__init__.py | Python | apache-2.0 | 715 |
# Copyright (c) 2020, Apple Inc. All rights reserved.
#
# Use of this source code is governed by a BSD-3-clause license that can be
# found in the LICENSE.txt file or at https://opensource.org/licenses/BSD-3-Clause
from coremltools.converters.mil.mil import types
from coremltools.converters.mil.mil.types import bui... | apple/coremltools | coremltools/converters/mil/mil/var.py | Python | bsd-3-clause | 8,592 |
# encoding=utf8
# The python elasticsearch binding
"""The python elasticsearch binding
"""
| lipixun/pyelastic | elastic/search/__init__.py | Python | gpl-2.0 | 93 |
#!/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 b... | richardfergie/googleads-python-lib | examples/dfp/v201508/custom_targeting_service/update_custom_targeting_values.py | Python | apache-2.0 | 2,539 |
__author__ = "Yinchong Yang"
__copyright__ = "Siemens AG, 2018"
__licencse__ = "MIT"
__version__ = "0.1"
"""
MIT License
Copyright (c) 2018 Siemens AG
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Softwa... | Tuyki/TT_RNN | MNISTSeq.py | Python | mit | 14,227 |
# Copyright 2013 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 collections
import datetime
import logging
import threading
from google.appengine.api import apiproxy_stub_map, background_thread, runtime
from googl... | nicko96/Chrome-Infra | appengine/chromium_build_logs/gtest_summaries.py | Python | bsd-3-clause | 4,193 |
# -*- coding: utf-8 -*-
#
# This file is part of Invenio Demosite.
# Copyright (C) 2012, 2013 CERN.
#
# Invenio Demosite 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 (a... | mvesper/invenio-demosite | invenio_demosite/testsuite/flask/test_accounts.py | Python | gpl-2.0 | 4,810 |
#!/usr/bin/python
# -*- coding: utf-8 -*-
import urllib2;
import re;
import string;
import sys;
from BeautifulSoup import BeautifulSoup
month_num = {
'Jan' : '01',
'Feb' : '02',
'Mar' : '03',
'Apr' : '04',
'May' : '05',
'Jun' : '06',
'Jul' : '07',
'Aug' : '08',
'Sep' : '09',
'Oct' : '10',
'Nov' : ... | guoxiaoyong/simple-useful | cxx_learn/cronx/spider/spider_daily_kospi.py | Python | cc0-1.0 | 2,199 |
from django.test import TestCase
from django.contrib.gis import geos
from linz2osm.convert.processing.poly_winding import PolyWindingCW, PolyWindingCCW
class TestPolyWinding(TestCase):
def test_ring_clockwise(self):
cw = [(0,0), (10,10), (20,0), (0,0)]
ccw = cw[:]
ccw.reverse()
... | opennewzealand/linz2osm | linz2osm/convert/processing/tests/test_poly_winding.py | Python | gpl-3.0 | 4,382 |
# -*- coding: utf-8 -*-
import unittest
from openerp.tests import common
class test_single_transaction_case(common.SingleTransactionCase):
"""
Check the whole-class transaction behavior of SingleTransactionCase.
"""
def test_00(self):
"""Create a partner."""
cr, uid = self.cr, self.ui... | vileopratama/vitech | src/openerp/addons/base/tests/test_basecase.py | Python | mit | 3,826 |
# coding:utf-8
import sys
import os
import json
import requests
import urllib
apikey = os.environ.get("GOOGLE_API_KEY")
TIMEOUT = 30
def stt_google_wav(filename):
q = {"output": "json", "lang": "ja-JP", "key": apikey}
url = "http://www.google.com/speech-api/v2/recognize?%s" % (urllib.parse.urlencode(q))
... | shiraco/techcircle_pepper_handson_b | google_stt/stt.py | Python | mit | 1,167 |
# -*- coding: utf-8 -*-
"""
The same code as word2vec.py, but different input data and only two models instead four.
Competition: HomeDepot Search Relevance
Author: Kostia Omelianchuk
Team: Turing test
"""
from config_IgorKostia import *
import gensim
import logging
import numpy as np
from sklearn.ensemble import ... | ChenglongChen/Kaggle_HomeDepot | Code/Igor&Kostia/word2vec_without_google_dict.py | Python | mit | 9,073 |
"""Test interact and interactive."""
# Copyright (c) IPython Development Team.
# Distributed under the terms of the Modified BSD License.
from __future__ import print_function
from collections import OrderedDict
import nose.tools as nt
import IPython.testing.tools as tt
from IPython.kernel.comm import Comm
from IP... | mattvonrocketstein/smash | smashlib/ipy3x/html/widgets/tests/test_interaction.py | Python | mit | 18,598 |
# Licensed to the .NET Foundation under one or more agreements.
# The .NET Foundation licenses this file to you under the Apache 2.0 License.
# See the LICENSE file in the project root for more information.
import unittest
from iptest import IronPythonTestCase, is_cli, is_mono, is_netcoreapp, is_posix, run_test, ski... | slozier/ironpython2 | Tests/test_function.py | Python | apache-2.0 | 51,122 |
import glob
import os.path
import platform
def find_datafiles():
system = platform.system()
if system == 'Windows':
file_ext = '*.exe'
else:
file_ext = '*.sh'
path = os.path.abspath(os.path.join(__path__[0], 'bootstrappers', file_ext))
return [('', glob.glob(path))]
| manuelcortez/socializer | src/update/__init__.py | Python | gpl-2.0 | 304 |
from django.conf import settings
from django.core.urlresolvers import reverse_lazy
from django.views.generic.edit import FormView
from django.utils.importlib import import_module
# import contact form class based on value in settings.py
full_class = getattr(settings, 'CONTACT_FORM_CLASS', 'quix.django.contact.forms.Co... | Quixotix/quix.django.contact | quix/django/contact/views.py | Python | bsd-3-clause | 792 |
# -*- coding: utf-8 -*-
'''
Covenant Add-on
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 prog... | TheWardoctor/Wardoctors-repo | script.module.uncoded/lib/resources/lib/sources/de/movie2k-ac.py | Python | apache-2.0 | 3,611 |
# -*- coding: utf-8 -*-
#
# PySPED - Python libraries to deal with Brazil's SPED Project
#
# Copyright (C) 2010-2012
# Copyright (C) Aristides Caldeira <aristides.caldeira at tauga.com.br>
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU Affero General Public Lice... | kmee/PySPED | pysped/nfe/leiaute/nfe_310.py | Python | lgpl-2.1 | 68,964 |
# -*- encoding: utf-8 -*-
##############################################################################
#
# OpenERP, Open Source Management Solution
# Copyright (C) 2004-2008 Tiny SPRL (<http://tiny.be>). All Rights Reserved
# $Id$
#
# This program is free software: you can redistribute it and/or modify
#... | 3dfxsoftware/cbss-addons | l10n_ve_commerce/__init__.py | Python | gpl-2.0 | 1,073 |
# -*- coding: utf-8 -*-
"""
djadmin2's permission handling. The permission classes have the same API as
the permission handling classes of the django-rest-framework. That way, we can
reuse them in the admin's REST API.
The permission checks take place in callables that follow the following
interface:
* They get passe... | andrewsmedina/django-admin2 | djadmin2/permissions.py | Python | bsd-3-clause | 15,152 |
"""
Cobra RMI Framework
Cobra is a remote method invocation interface that is very "pythony". It is
MUCH like its inspiration pyro, but slimmer and safer for things like threading
and object de-registration. Essentially, cobra allows you to call methods from
and get/set attributes on objects that exist on a remote s... | bat-serjo/vivisect | cobra/__init__.py | Python | apache-2.0 | 37,044 |
"""Custom exceptions which used in Mimesis."""
from typing import Any, Optional, Union
from mimesis.enums import Locale
class LocaleError(ValueError):
"""Raised when a locale isn't supported."""
def __init__(self, locale: Union[Locale, str]) -> None:
"""Initialize attributes for informative output.... | lk-geimfari/elizabeth | mimesis/exceptions.py | Python | mit | 1,703 |
from nltk.corpus import stopwords
import sys
HEX_1 = 16**3
HEX_2 = 16**2
HEX_3 = 16
HEX_4 = 1
digit_to_hex = {i: k for i, k in enumerate('0123456789abcdef')}
def get_hex(an_int):
out = []
for place in (HEX_1, HEX_2, HEX_3, HEX_4):
out.append(digit_to_hex[an_int / place])
an_int = an_int % place... | scivey/relevanced | scripts/dump_nltk_stopwords.py | Python | mit | 2,058 |
import hashlib
import requests
import re
import time
import random
secret_addr = '7a126c6c89988807e84f887a3cee48c84f789c6910f80f547dc250ec5db23a5e'
spin_url = 'http://dogespin.l8.lv/ajax-spin.php'
root_url = 'http://dogespin.l8.lv/'
hash_re = re.compile(r'spinHash=\'([0-9abcdef]+)\'')
colors = ['black','red']
def ge... | powhex/dogespin | dogespin.py | Python | mit | 4,074 |
#
# This file is part of do-mpc
#
# do-mpc: An environment for the easy, modular and efficient implementation of
# robust nonlinear model predictive control
#
# Copyright (c) 2014-2019 Sergio Lucia, Alexandru Tatulea-Codrean
# TU Dortmund. All rights reserved
#
# do-mpc is free sof... | do-mpc/do-mpc | do_mpc/__init__.py | Python | lgpl-3.0 | 1,132 |
from __future__ import unicode_literals
from __future__ import print_function
from __future__ import division
from __future__ import absolute_import
from future import standard_library
standard_library.install_aliases()
from builtins import *
import logging
import emission.core.wrapper.wrapperbase as ecwb
import enum a... | shankari/e-mission-server | emission/core/wrapper/battery.py | Python | bsd-3-clause | 1,602 |
# coding=utf-8
# Copyright 2022 The Google Research 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 applicab... | google-research/google-research | felix/preprocess.py | Python | apache-2.0 | 2,661 |
import os, re, shutil
for (base, _, files) in os.walk("essays",):
for f in files:
if f.endswith(".markdown"):
fp = os.path.join(base, f)
_, np = os.path.split(base)
np = re.sub(r"_def$", "", np)
np = os.path.join("essays", np+".markdown")
# print ... | DigitalPublishingToolkit/Society-of-the-Query-Reader | scripts/gather_essays.py | Python | gpl-3.0 | 470 |
from django.db import transaction
from evesde.models.locations import Station
from evesde.eveapi import get_api_connection
def import_conquerable_stations():
"""Import all conquerable stations and outposts from the EVE API"""
api = get_api_connection()
stations = Station.objects.all()
objs = []
... | nikdoof/django-evesde | evesde/eveapi/eve.py | Python | bsd-3-clause | 823 |
"""Numeric integration of data coming from a source sensor over time."""
from decimal import Decimal, DecimalException
import logging
import voluptuous as vol
from homeassistant.components.sensor import (
DEVICE_CLASS_ENERGY,
DEVICE_CLASS_POWER,
PLATFORM_SCHEMA,
STATE_CLASS_TOTAL,
SensorEntity,
)
... | jawilson/home-assistant | homeassistant/components/integration/sensor.py | Python | apache-2.0 | 7,671 |
#!/usr/bin/env python
#
# Electrum - lightweight Bitcoin client
# Copyright (C) 2015 Thomas Voegtlin
#
# Permission is hereby granted, free of charge, to any person
# obtaining a copy of this software and associated documentation files
# (the "Software"), to deal in the Software without restriction,
# including without... | cryptapus/electrum-uno | lib/pem.py | Python | mit | 6,584 |
from pymongo import MongoClient
from helpers import db_url, db_database, parse_csv, to_int, to_float
mongo = MongoClient(db_url)
db = mongo[db_database]
print("Updating school information from 2015 data...")
for school in parse_csv("../data/2015/ks5_attainment.csv"):
# All schools are RECTYPE=1. Other RECTYPEs a... | danielgavrilov/schools | db/insert_schools.py | Python | mit | 1,894 |
class OrderedDict(dict):
"""
A dictionary that keeps its keys in the order in which they're inserted.
Copied from Django's SortedDict with some modifications.
"""
def __new__(cls, *args, **kwargs):
instance = super(OrderedDict, cls).__new__(cls, *args, **kwargs)
instance.keyOrd... | sorenh/cc | vendor/tornado/website/markdown/odict.py | Python | apache-2.0 | 5,157 |
# -*- coding: UTF-8 -*-
from django.core.management.base import BaseCommand, CommandError
from p3 import models
from assopy import utils
import time
class Command(BaseCommand):
"""
"""
def handle(self, *args, **options):
try:
email = args[0]
except IndexError:
qs = ... | pythonitalia/pycon_site | p3/management/commands/update_attendee_country.py | Python | bsd-2-clause | 873 |
foo = 0 | asedunov/intellij-community | python/testData/inspections/PyUnresolvedReferencesInspection/OneUnsedOneMarked/library.py | Python | apache-2.0 | 7 |
from django.core import exceptions
from olympia.amo.fields import HttpHttpsOnlyURLField
from olympia.amo.tests import TestCase
class HttpHttpsOnlyURLFieldTestCase(TestCase):
def setUp(self):
super(HttpHttpsOnlyURLFieldTestCase, self).setUp()
self.field = HttpHttpsOnlyURLField()
def test_inv... | harikishen/addons-server | src/olympia/amo/tests/test_fields.py | Python | bsd-3-clause | 1,350 |
from treeherder.config.settings import *
DATABASES["default"]["TEST"] = {"NAME": "test_treeherder"}
TREEHERDER_TEST_PROJECT = "%s_jobs" % DATABASES["default"]["TEST"]["NAME"]
# this makes celery calls synchronous, useful for unit testing
CELERY_ALWAYS_EAGER = True
CELERY_EAGER_PROPAGATES_EXCEPTIONS = True
# Reconfig... | akhileshpillai/treeherder | tests/settings.py | Python | mpl-2.0 | 703 |
#!/usr/bin/env python
"""
Python script to convert a list of active and passive residues into
ambiguous interaction restraints for HADDOCK
"""
def active_passive_to_ambig(active1, passive1, active2, passive2, segid1='A', segid2='B'):
"""Convert active and passive residues to Ambiguous Interaction Restraints
... | haddocking/haddock-tools | active-passive-to-ambig.py | Python | apache-2.0 | 2,352 |
# Copyright 2014-2018 The PySCF Developers. 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 appl... | gkc1000/pyscf | pyscf/nao/m_local_vertex.py | Python | apache-2.0 | 4,993 |
#python
import k3d
k3d.check_node_environment(context, "MeshSourceScript")
# Perform required one-time setup to store geometric points in the mesh ...
points = context.output.create_points()
point_selection = context.output.create_point_selection()
# Perform required one-time setup to store cubic curves in the mesh ... | barche/k3d | share/k3d/scripts/MeshSourceScript/cubic_curves.py | Python | gpl-2.0 | 1,499 |
# This file is protected via CODEOWNERS
__version__ = "1.26.2"
| prrvchr/GContactOOo | uno/lib/python/urllib3/_version.py | Python | gpl-3.0 | 63 |
from Parser import Parser
from urllib import quote_plus
from HTMLParser import HTMLParser
import xml.etree.ElementTree as ET
import os
import re
class PONSParser(Parser):
def __init__(self):
self.langKeys = {}
self.sourceTargetPairs = {}
self.exceptSpans = "^genus$|^style$|^case$|^rhetoric... | jannewulf/Anki-Translator | TranslatorAddon/Parser/PONSParser.py | Python | gpl-3.0 | 3,147 |
__license__ = 'GPL v3'
__copyright__ = '2008, Kovid Goyal <kovid at kovidgoyal.net>'
import sys, os, time, socket, traceback
from functools import partial
from PyQt4.Qt import (QCoreApplication, QIcon, QObject, QTimer,
QPixmap, QSplashScreen, QApplication)
from calibre import prints, plugins, force_unicode... | yeyanchao/calibre | src/calibre/gui2/main.py | Python | gpl-3.0 | 17,746 |
#
# Copyright (C) 2009, 2010 UNINETT AS
#
# This file is part of Network Administration Visualized (NAV).
#
# NAV 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.
#
# This program is distributed in th... | alexanderfefelov/nav | python/nav/web/geomap/graph.py | Python | gpl-2.0 | 15,044 |
import MOCs
from utils import validate
from TestCase.MVSTestCase import *
class TestDIDSend(MVSTestCaseBase):
@classmethod
def setUpClass(cls):
#check if the did are created.
ec, message = mvs_rpc.list_dids()
if ec != 0:
return
exist_symbols = [i["symbol"] for i in ... | mvs-live/metaverse | test/test-rpc-v3/TestCase/Identity/test_did.py | Python | agpl-3.0 | 10,939 |
import sys
import platform # Unused import
print(sys.path)
class Something:
def method_without_self():
pass
def something(self):
pass
| seblat/coala-bears | tests/python/test_files/pylint_test.py | Python | agpl-3.0 | 167 |
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.db import models, migrations
import geoposition.fields
class Migration(migrations.Migration):
dependencies = [
('beacon', '0004_auto_20150730_2114'),
]
operations = [
migrations.RemoveField(
model_na... | SorenOlegnowicz/tracker | tracker/beacon/migrations/0005_auto_20150731_1659.py | Python | agpl-3.0 | 1,003 |
#!/usr/bin/env python
#
# Copyright 2011-2014 Splunk, 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... | kkirsche/splunk-sdk-python | examples/analytics/input.py | Python | apache-2.0 | 3,592 |
import urllib2, urllib, urllister
import time
from selenium import webdriver
from selenium.webdriver.common.keys import Keys
while True:
print "Welcome"
print "Press Enter When Download Finishes and Q to quit"
raw_i=raw_input("Song Name and Artist: ")
x = urllib.quote_plus(raw_i)
site1 = urllib2.u... | ActiveState/code | recipes/Python/578530_Music_Downloader/recipe-578530.py | Python | mit | 1,243 |
# This file is licensed seperately of the rest of the codebase. This is due to
# BioPython's failure to merge https://github.com/biopython/biopython/pull/544
# in a timely fashion. Please use this file however you see fit!
#
#
# Copyright (c) 2015-2017 Center for Phage Technology. All rights reserved.
# Redistribution ... | TAMU-CPT/galaxy-tools | tools/comparative/xmfa.py | Python | gpl-3.0 | 5,025 |
#TODO: Consider
# - Saving unwritten events locally when we cannot write to server
# - Download events to a local file
import re
from icalendar import Calendar, Event
from httplib import BadStatusLine
from events import *
import myProduct
WebDAVAvailable = False
importerr = ""
try:
from urlparse import urlparse,... | sergiomb2/gdesklets | Controls/iCalendarEvent/CalDAVbackend.py | Python | gpl-2.0 | 10,287 |
from flask import render_template
def index():
return render_template("index.html")
| Cydrobolt/spectre | spectre/core.py | Python | apache-2.0 | 89 |
# Copyright 2012 OpenStack Foundation
# All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance with the License. You may obtain
# a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless requ... | roopali8/tempest | tempest/api/object_storage/test_object_services.py | Python | apache-2.0 | 48,905 |
"""
Follow up for "Unique Paths":
Now consider if some obstacles are added to the grids. How many unique paths
would there be?
An obstacle and empty space is marked as 1 and 0 respectively in the grid.
For example,
There is one obstacle in the middle of a 3x3 grid as illustrated below.
[
[0,0,0],
[0,1,0],
[0,... | shichao-an/leetcode-python | unique_paths_ii/solution2.py | Python | bsd-2-clause | 1,435 |
# -*- coding: utf-8 -*-
"""
.. module:: bitalino
:synopsis: BITalino API
*Created on Fri Jun 20 2014*
"""
import math
import platform
import re
import struct
import time
import numpy
import serial
def find():
"""
:returns: list of (tuples) with name and MAC address of each device found
Searche... | chipimix/thesis | bitalino.py | Python | gpl-3.0 | 15,005 |
from __future__ import print_function
import os
import sys
import argparse
import pysam
def convert_sams2bams(sams):
separator = ","
split_sams = sams.split(separator)
bams = list()
for sam in split_sams:
bam = sam.replace(".sam", ".bam")
bams.append(bam)
os.system("samtools ... | Xinglab/rmats2sashimiplot | src/rmats2sashimiplot/rmats2sashimiplot.py | Python | gpl-2.0 | 44,567 |
import sqlalchemy
import sqlalchemy.orm
from sqlalchemy.ext.orderinglist import ordering_list
from Blue_Yellow.data.modelbase import SqlAlchemyBase
class Album(SqlAlchemyBase):
__tablename__ = 'Album'
id = sqlalchemy.Column(sqlalchemy.Integer, primary_key=True, autoincrement=True)
name = sqlalchemy.Colu... | smitsgit/tptm | Blue_Yellow/Blue_Yellow/data/album.py | Python | apache-2.0 | 903 |
"""Finders try to find right section for passed module name"""
import importlib.machinery
import inspect
import os
import os.path
import re
import sys
import sysconfig
from abc import ABCMeta, abstractmethod
from contextlib import contextmanager
from fnmatch import fnmatch
from functools import lru_cache
from glob impo... | TeamSPoon/logicmoo_workspace | packs_web/butterfly/lib/python3.7/site-packages/isort/deprecated/finders.py | Python | mit | 14,768 |
# -*- coding: utf-8 -*-
__author__ = 'paronax'
class InvalidFacetError(ValueError):
def __init__(self, message):
self.message = 'Unknown facet : ' + message
class InvalidLanguageError(ValueError):
def __init__(self, message):
self.message = 'Unknown language : ' + message | paronax/pyratp | pyratp/exceptions.py | Python | gpl-2.0 | 299 |
# -*- coding: utf-8 -*-
#
# This file is part of Invenio.
# Copyright (C) 2006, 2007, 2008, 2009, 2010, 2011, 2015 CERN.
#
# Invenio is free software; you can redistribute it and/or
# modify it under the terms of the GNU General Public License as
# published by the Free Software Foundation; either version 2 of the
# Li... | zenodo/invenio | invenio/modules/formatter/format_elements/bfe_imprint.py | Python | gpl-2.0 | 2,491 |
#
# Gramps - a GTK+/GNOME based genealogy program
#
# Copyright (C) 2007-2008 Brian G. Matherly
# Copyright (C) 2007-2009 Stephane Charette
# Copyright (C) 2009 Gary Burton
# Contribution 2009 by Bob Ham <rah@bash.sh>
# Copyright (C) 2010 Jakim Friant
# Copyright (C) 2012 Paul Franklin
#
# This ... | arunkgupta/gramps | gramps/gui/plug/report/_graphvizreportdialog.py | Python | gpl-2.0 | 9,927 |
#!/usr/bin/env python
#-*-coding: utf-8-*-
#
# Halil Kaya
# www.halilkaya.net
# kayahalil@gmail.com
# GPG: 0x0FA83C53
#
# wppy is licensed with GPL
#
import sys, os
from optparse import OptionParser
from random import randint
try:
input = raw_input # Python 2
except NameError: # Python 3
pass
if __name_... | halilkaya/wppy | wppy.py | Python | gpl-3.0 | 3,680 |
import pathlib
import attr
_LICENSES = {
"Glide": {
"name": "3dfx Glide License",
"url": "http://www.users.on.net/~triforce/glidexp/COPYING.txt",
},
"Abstyles": {
"name": "Abstyles License",
"url": "https://fedoraproject.org/wiki/Licensing/Abstyles",
},
"AFL-1.1": {... | clld/clldutils | src/clldutils/licenses.py | Python | apache-2.0 | 38,642 |
from __future__ import unicode_literals
import random
import string
MASTER_ACCOUNT_ID = '123456789012'
MASTER_ACCOUNT_EMAIL = 'fakeorg@moto-example.com'
ORGANIZATION_ARN_FORMAT = 'arn:aws:organizations::{0}:organization/{1}'
MASTER_ACCOUNT_ARN_FORMAT = 'arn:aws:organizations::{0}:account/{1}/{0}'
ACCOUNT_ARN_FORMAT =... | okomestudio/moto | moto/organizations/utils.py | Python | apache-2.0 | 2,175 |
import copy
class Pentomino(object):
def __init__(self, name, coos):
self.name = name
self.coos = coos
self.dim = len(coos[0])
def normalize_coo(self, coo):
a=self.coos[0][coo]
for i in self.coos :
if a > self.coos[i][coo] :
a... | lockeee/Dancing-Links2015 | dancing_links/python/pentominos.py | Python | cc0-1.0 | 6,749 |
# ------------------------------------
# Copyright (c) Microsoft Corporation.
# Licensed under the MIT License.
# ------------------------------------
import pytest
import platform
import functools
from azure.core.exceptions import HttpResponseError, ClientAuthenticationError
from azure.core.credentials import AzureK... | Azure/azure-sdk-for-python | sdk/textanalytics/azure-ai-textanalytics/tests/test_encoding.py | Python | mit | 3,419 |
#!/usr/bin/env python
# -*- coding:utf-8 -*-
"""
如果按照算法描述,这里容易犯一个错误,认为可以使用查询到的最小值替换列表中的元素。
其实不是替换,而是把列表要替换的元素和找到的最小值交换。否则会出项系统中的一些值
被最小值覆盖掉的问题
"""
def select_sort(li):
li_len = len(li)
for x in xrange(0, li_len - 1):
index = x
temp = li[index]
for y in xrange(x + 1, li_len):
... | ssjssh/algorithm | src/ssj/sort/select_sort.py | Python | gpl-2.0 | 737 |
#!/usr/bin/python3
# -*- coding:utf-8 -*-
# Project: http://cloudedbats.org
# Copyright (c) 2016-2018 Arnold Andreasson
# License: MIT License (see LICENSE.txt or http://opensource.org/licenses/mit).
import pathlib
import shutil
import logging
import wurb_core
@wurb_core.singleton
class WurbSettings(object):
"""... | cloudedbats/cloudedbats_wurb | cloudedbats_wurb/wurb_core/wurb_settings.py | Python | mit | 7,577 |
from ws4redis.publisher import redis_connection_pool, StrictRedis
class RedisProvider(object):
def __init__(self, **kwargs):
self._connection = StrictRedis(connection_pool=redis_connection_pool)
def set(self, key, value, expire=None):
return self._connection.set(name=key, value=value)
de... | crowdresearch/daemo | crowdsourcing/redis.py | Python | mit | 1,780 |
from .__about__ import * # noqa: F401,F403
| TeamSPoon/logicmoo_workspace | packs_web/butterfly/lib/python3.7/site-packages/devcore/__init__.py | Python | mit | 44 |
# 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.
class TimelineImporter(object):
"""Reads TraceData and populates timeline model with what it finds."""
def __init__(self, model, trace_data, import_order... | M4sse/chromium.src | tools/telemetry/telemetry/timeline/importer.py | Python | bsd-3-clause | 781 |
import colander
from celery.utils.log import get_task_logger
from script_wrapper.models import getGPSCount
from script_wrapper.tasks import RTask
from script_wrapper.validation import validateRange
from script_wrapper.validation import iso8601Validator
logger = get_task_logger(__name__)
class Schema(colander.Mapping... | NLeSC/eEcology-script-wrapper | script_wrapper/tasks/example_r/__init__.py | Python | apache-2.0 | 1,537 |
# Generated by Django 2.2.24 on 2021-08-27 17:56
from django.db import migrations, models
def force_unique_title(apps, schema_editor):
# I've verified there are no duplicates in Stage and Prod.
# This was brought up as a thing devs might need for their local devstack.
EnterpriseCatalogQuery = apps.get_mod... | edx/edx-enterprise | enterprise/migrations/0141_make_enterprisecatalogquery_title_unique.py | Python | agpl-3.0 | 1,274 |
"""
pygments.lexers.r
~~~~~~~~~~~~~~~~~
Lexers for the R/S languages.
:copyright: Copyright 2006-2022 by the Pygments team, see AUTHORS.
:license: BSD, see LICENSE for details.
"""
import re
from pygments.lexer import Lexer, RegexLexer, include, do_insertions
from pygments.token import Text, Com... | dscorbett/pygments | pygments/lexers/r.py | Python | bsd-2-clause | 6,167 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.