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 |
|---|---|---|---|---|---|---|
# -*- coding: utf-8 -*-
from openerp.osv import orm, fields
def selection_fn(obj, cr, uid, context=None):
return list(enumerate(["Corge", "Grault", "Wheee", "Moog"]))
def function_fn(model, cr, uid, ids, field_name, arg, context):
return dict((id, 3) for id in ids)
def function_fn_write(model, cr, uid, id, f... | diogocs1/comps | web/openerp/addons/test_impex/models.py | Python | apache-2.0 | 5,891 | 0.003225 |
# coding: utf-8
from __future__ import unicode_literals
from .common import InfoExtractor
from ..utils import (
int_or_none,
smuggle_url,
parse_duration,
)
class MiTeleIE(InfoExtractor):
IE_DESC = 'mitele.es'
_VALID_URL = r'https?://(?:www\.)?mitele\.es/(?:[^/]+/)+(?P<id>[^/]+)/player'
_TESTS = [{
'url': 'h... | valmynd/MediaFetcher | src/plugins/youtube_dl/youtube_dl/extractor/mitele.py | Python | gpl-3.0 | 3,700 | 0.028116 |
# Note: not using cStringIO here because then we can't set the "filename"
from StringIO import StringIO
from copy import copy
from datetime import datetime, timedelta
from django.contrib.auth.models import User, AnonymousUser
from django.contrib.messages import SUCCESS
from django.core.urlresolvers import reverse
from... | mozilla/mozilla-ignite | apps/challenges/tests/test_views.py | Python | bsd-3-clause | 32,366 | 0.001329 |
#!/usr/bin/env python
# Copyright (c) 2012 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.
"""Unit tests for rietveld.py."""
import logging
import os
import ssl
import sys
import time
import traceback
import unittest
sys... | liaorubei/depot_tools | tests/rietveld_test.py | Python | bsd-3-clause | 15,103 | 0.006158 |
# -*- coding: utf-8 -*-
# Part of Odoo. See LICENSE file for full copyright and licensing details.
# List of contributors:
# Jordi Esteve <jesteve@zikzakmedia.com>
# Dpto. Consultoría Grupo Opentia <consultoria@opentia.es>
# Pedro M. Baeza <pedro.baeza@tecnativa.com>
# Carlos Liébana <carlos.liebana@factorlibre.com>
#... | maxive/erp | addons/l10n_es/__manifest__.py | Python | agpl-3.0 | 1,890 | 0.003178 |
# -*- coding: utf-8 -*-
"""
.. _tut-set-eeg-ref:
Setting the EEG reference
=========================
This tutorial describes how to set or change the EEG reference in MNE-Python.
.. contents:: Page contents
:local:
:depth: 2
As usual we'll start by importing the modules we need, loading some
:ref:`example dat... | mne-tools/mne-tools.github.io | 0.19/_downloads/0162af27293b0c7e7c35ef85531280ea/plot_55_setting_eeg_reference.py | Python | bsd-3-clause | 10,338 | 0 |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
"""
Reddit worker
"""
import praw
import sys
import time
import yaml
from datetime import datetime
from pytz import UTC
from pymongo import MongoClient, IndexModel, ASCENDING, DESCENDING, TEXT
from pymongo.errors import PyMongoError
__version__ = '0.0.1-alpha.1'
c... | nicolaevladescu/hootch | workers/Reddit.py | Python | mit | 6,671 | 0.008095 |
import re
import time
from flask import Flask, render_template, request, flash, redirect
from flaskext.babel import Babel
from flask.ext.mail import Mail, Message
from flask.ext.cache import Cache
from flask.ext.assets import Environment
from raven.contrib.flask import Sentry
import feedparser
app = Flask(__name__)
... | taikoa/taikoa | taikoa.py | Python | agpl-3.0 | 2,419 | 0.002894 |
#!/usr/bin/python
from __future__ import print_function
import clodius.hdf_tiles as hdft
import h5py
import argparse
def main():
parser = argparse.ArgumentParser(
description="""
python get_hitile.py filename z x
"""
)
parser.add_argument("filename")
parser.add_argument("z", type=int)
... | hms-dbmi/clodius | scripts/get_hitile.py | Python | mit | 1,168 | 0 |
# Copyright 2006 Georg Brandl.
# Licensed to PSF under a Contributor Agreement.
"""Fixer for intern().
intern(s) -> sys.intern(s)"""
# Local imports
from .. import pytree
from .. import fixer_base
from ..fixer_util import Name, Attr, touch_import
class FixIntern(fixer_base.BaseFix):
BM_compatible... | nmercier/linux-cross-gcc | win32/bin/Lib/lib2to3/fixes/fix_intern.py | Python | bsd-3-clause | 1,451 | 0 |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
"""
File: data_augmentation.py
Author: Wen Li
Email: spacelis@gmail.com
Github: http://github.com/spacelis
Description: Augmenting data with some sythetic negative examples.
"""
# pylint: disable=invalid-name
from __future__ import print_function
import sys
import re
impo... | spacelis/hrnn4sim | hrnn4sim/data_augmentation.py | Python | mit | 3,901 | 0.001282 |
#!/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 (th... | apache/bloodhound | installer/setup.py | Python | apache-2.0 | 1,462 | 0 |
#!/Library/Frameworks/Python.framework/Versions/2.7/bin/python
# ----------------------------------------
# USAGE:
# ----------------------------------------
# PREAMBLE:
import numpy as np
import sys
import os
import matplotlib.pyplot as plt
from matplotlib.ticker import NullFormatter
from mpl_toolkits.mplot3d impo... | rbdavid/RMSD_analyses | PCA_RMSD_One_Ref/system_rmsd_plotting.py | Python | gpl-3.0 | 1,985 | 0.040302 |
__version__ = '0.8.1'
__author__ = "Massimiliano Pippi & Federico Frenguelli"
VERSION = __version__ # synonym
| ramcn/demo3 | venv/lib/python3.4/site-packages/oauth2_provider/__init__.py | Python | mit | 113 | 0 |
# (c) Copyright [2015] Hewlett Packard Enterprise Development LP
#
# 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 r... | hpe-storage/horizon-hpe-storage-ui | horizon_hpe_storage/storage_panel/overview/tables.py | Python | apache-2.0 | 850 | 0 |
# -*- coding: utf-8 -*-
import re
import time
import pycurl
from module.network.HTTPRequest import BadHeader
from ..internal.Account import Account
class OneFichierCom(Account):
__name__ = "OneFichierCom"
__type__ = "account"
__version__ = "0.23"
__status__ = "testing"
__description__ = """1fi... | thispc/download-manager | module/plugins/accounts/OneFichierCom.py | Python | gpl-3.0 | 2,134 | 0.000937 |
import unittest
import sys
from spam.spamhaus import *
class MockSpamHausChecker(SpamHausChecker):
def set_spam(self, is_spam):
"""docstring for setSpam"""
self.is_spam = is_spam
def _resolve(self, domain):
"""docstring for __resolve"""
if self.is_spam:
return "2.3... | fmarani/spam | tests/spamhaus_tests.py | Python | lgpl-3.0 | 1,040 | 0.002885 |
import numpy as np
from mesa import Agent
class LanguageAgent(Agent):
def __init__(self, model, name, unique_id, initial_prob_v):
"""
A LanguageAgent represents a particular place during a language shift simulation.
:param model: the model that the agent is in
:param unique_id: Loc... | pawlactb/DiffusionModels | LanguageShift/LanguageAgent.py | Python | gpl-3.0 | 3,360 | 0.00506 |
# -*- coding: utf-8 -*-
"""
################################################
Plataforma ActivUFRJ
################################################
:Author: *Núcleo de Computação Eletrônica (NCE/UFRJ)*
:Contact: carlo@nce.ufrj.br
:Date: $Date: 2009-2010 $
:Status: This is a "work in progress"
:Revision: $Revision: 0.0... | labase/activnce | main/question/database.py | Python | gpl-2.0 | 1,434 | 0.007714 |
#!/usr/bin/python
#Master-Thesis dot parsing framework (PING MODULE)
#Date: 14.01.2014
#Author: Bruno-Johannes Schuetze
#uses python 2.7.6
#uses the djikstra algorithm implemented by David Eppstein
#Module does calculations to behave similar to ping, uses delay label defined in the dot file
from libraries.dijkstra im... | bschutze/ALTO-framework-sim | Views/ping_.py | Python | mit | 611 | 0.022913 |
#! /usr/local/bin/python -u
# Given an array and a value, remove all instances of that value in place and return the new length.
# The order of elements can be changed. It doesn't matter what you leave beyond the new length.
class Solution:
# @param A a list of integers
# @param elem an integer,... | textsaurabh/code_base | src/leetcode/script/remove_element_inplace.py | Python | mit | 815 | 0.006135 |
# -*- coding: utf-8 -*-
from __future__ import absolute_import, print_function, unicode_literals
import os
import imp
import hmac
import hashlib
import six
from flask import Flask, abort, request
DEBUG = os.environ.get("DEBUG", False) == 'True'
HOST = os.environ.get("HOST", '0.0.0.0')
ROOT_DIR = os.path.dirname(os.p... | pyupio/octohook | hook/hook.py | Python | mit | 3,954 | 0.000759 |
# Generated from 'Appearance.h'
def FOUR_CHAR_CODE(x): return x
kAppearanceEventClass = FOUR_CHAR_CODE('appr')
kAEAppearanceChanged = FOUR_CHAR_CODE('thme')
kAESystemFontChanged = FOUR_CHAR_CODE('sysf')
kAESmallSystemFontChanged = FOUR_CHAR_CODE('ssfn')
kAEViewsFontChanged = FOUR_CHAR_CODE('vfnt')
kThemeDataFileType ... | MalloyPower/parsing-python | front-end/testsuite-python-lib/Python-2.3/Lib/plat-mac/Carbon/Appearance.py | Python | mit | 26,525 | 0.001018 |
"""Spatial functions included in ODDT
Mainly used by other modules, but can be accessed directly.
"""
import numpy as np
from scipy.spatial.distance import cdist as distance
__all__ = ['angle', 'angle_2v', 'dihedral', 'distance']
# angle functions
def angle(p1,p2,p3):
"""Returns an angle from a series of 3 point... | mwojcikowski/opendrugdiscovery | oddt/spatial.py | Python | bsd-3-clause | 2,224 | 0.009442 |
from twilio.twiml.voice_response import Gather, VoiceResponse
response = VoiceResponse()
response.gather()
print(response)
| TwilioDevEd/api-snippets | twiml/voice/gather/gather-2/gather-2.6.x.py | Python | mit | 125 | 0 |
from django.http import HttpResponse
from django.test import TestCase
from ..pipeline import make_staff
class Backend(object):
name = None
def __init__(self, name, *args, **kwargs):
super(Backend, self).__init__(*args, **kwargs)
self.name = name
class MockSuperUser(object):
is_staff = ... | dan-gamble/cms | cms/tests/test_pipeline.py | Python | bsd-3-clause | 978 | 0 |
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('defcdb', '0006_site_reference'),
]
operations = [
migrations.AddField(
model_name='dc_country',
name... | acdh-oeaw/defc-app | defcdb/migrations/0007_auto_20151120_0807.py | Python | mit | 2,178 | 0.001837 |
#!/usr/bin/env python
import doctest
import unittest
import sys
def test_suite(docs):
suite = unittest.TestSuite()
for doc in docs:
suite.addTest(doctest.DocFileSuite(doc, optionflags=flags()))
return suite
def flags():
flags = doctest.NORMALIZE_WHITESPACE|doctest.ELLIPSIS
if sys.version_i... | nsi-iff/should-dsl | run_examples.py | Python | mit | 630 | 0.009524 |
from django import template
from projects.version_handling import comparable_version
register = template.Library()
@register.filter
def sort_version_aware(versions):
"""
Takes a list of versions objects and sort them caring about version schemes
"""
return sorted(
versions,
key=lamb... | raven47git/readthedocs.org | readthedocs/projects/templatetags/projects_tags.py | Python | mit | 554 | 0 |
from math import radians, cos, sin, asin, sqrt, degrees, pi, atan2
from enum import Enum
from typing import Union
# mean earth radius - https://en.wikipedia.org/wiki/Earth_radius#Mean_radius
_AVG_EARTH_RADIUS_KM = 6371.0088
class Unit(Enum):
"""
Enumeration of supported units.
The full list can be check... | mapado/haversine | haversine/haversine.py | Python | mit | 5,961 | 0.002852 |
#!/usr/bin/env python
__author__ = "bt3"
from binary_search_tree import BST, Node
def find_ancestor(path, low_item, high_item):
while path:
current_item = path[0]
if current_item < low_item:
try:
path = path[2:]
except:
return current_item... | switchkiller/Python-and-Algorithms-and-Data-Structures | src/trees/check_ancestor.py | Python | mit | 1,369 | 0.005113 |
# Copyright 2021, Google LLC.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing... | google-research/federated | generalization/utils/trainer_utils_test.py | Python | apache-2.0 | 6,847 | 0.007156 |
from datetime import datetime
from argparse import ArgumentParser
import pprint
import time
import warnings
import os, sys, io
import signal
import beretta
import importlib
__author__ = 'holly'
class Parser(object):
def __init__(self):
self.parser = ArgumentParser(description=beretta.__doc__)
... | holly/beretta | lib/beretta/parser.py | Python | mit | 1,231 | 0.004062 |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
import abc
class Task(object):
""" represents work to do """
__metaclass__ = abc.ABCMeta
_is_done = False
def __init__(self):
""" constructor """
pass
def run(self):
self._is_done = True
return self._run()
... | bjorskog/majordomo | majordomo/task.py | Python | bsd-3-clause | 578 | 0.00519 |
#!/usr/bin/env python3
import PISM
from PISM.util import convert
from math import cos, pi
# Simple testing program for Lingle & Clark bed deformation model.
# Runs go for 150,000 years on 63.5km grid with 100a time steps and Z=2 in L&C model.
# SCENARIOS: run 'python bed_deformation.py -scenario N' where N=1,2,3,4 a... | pism/pism | examples/python/bed_deformation.py | Python | gpl-3.0 | 5,232 | 0.001911 |
import _plotly_utils.basevalidators
class IdssrcValidator(_plotly_utils.basevalidators.SrcValidator):
def __init__(self, plotly_name="idssrc", parent_name="splom", **kwargs):
super(IdssrcValidator, self).__init__(
plotly_name=plotly_name,
parent_name=parent_name,
edit_t... | plotly/plotly.py | packages/python/plotly/plotly/validators/splom/_idssrc.py | Python | mit | 388 | 0 |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
from url import url
import tornado.web
import os
settings = dict(
template_path = os.path.join(os.path.dirname(__file__), "templates"),
static_path = os.path.join(os.path.dirname(__file__), "statics")
)
application = tornado.web.Application(
handlers = url,
... | leewp/TornadoPractice | application.py | Python | apache-2.0 | 336 | 0.020833 |
from south.db import db
from django.db import models
from ietf.idtracker.models import *
class Migration:
def forwards(self, orm):
# Changing field 'InternetDraft.shepherd'
# (to signature: django.db.models.fields.related.ForeignKey(to=orm['idtracker.PersonOrOrgInfo'], null=True, bla... | mcr/ietfdb | ietf/idtracker/migrations/0003_internet_draft_shepred_fk_blank_true.py | Python | bsd-3-clause | 37,706 | 0.007771 |
import random
import math
import sys
import numpy as np
random.seed(1L)
labels = []
features = []
NUM_FEATURES = 0
#Parse libsvm
fp = open("datasets/a1a/a1a","r")
while True:
line = fp.readline()
if len(line)==0:
break
tokens = line.split(" ")
del tokens[-1]
labels.append(0 if int(tokens[... | MisterTea/MLPlayground | Python/gd_numpy.py | Python | apache-2.0 | 5,435 | 0.014351 |
import os
path = os.path.dirname(os.path.realpath(__file__))
sbmlFilePath = os.path.join(path, 'MODEL0912503622.xml')
with open(sbmlFilePath,'r') as f:
sbmlString = f.read()
def module_exists(module_name):
try:
__import__(module_name)
except ImportError:
return False
else:
ret... | biomodels/MODEL0912503622 | MODEL0912503622/model.py | Python | cc0-1.0 | 427 | 0.009368 |
# Copyright (c) 2013-2017 Jeffrey Pfau
#
# This Source Code Form is subject to the terms of the Mozilla Public
# License, v. 2.0. If a copy of the MPL was not distributed with this
# file, You can obtain one at http://mozilla.org/MPL/2.0/.
from ._pylib import ffi, lib # pylint: disable=no-name-in-module
from .core imp... | libretro/mgba | src/platform/python/mgba/thread.py | Python | mpl-2.0 | 1,875 | 0 |
import os
from pySDC.helpers.stats_helper import filter_stats, sort_stats
from pySDC.helpers.visualization_tools import show_residual_across_simulation
from pySDC.implementations.collocation_classes.gauss_radau_right import CollGaussRadau_Right
from pySDC.implementations.controller_classes.controller_nonMPI import con... | Parallel-in-Time/pySDC | pySDC/tutorial/step_8/B_multistep_SDC.py | Python | bsd-2-clause | 6,586 | 0.002885 |
"""Test functions for matrix module
"""
from __future__ import division, absolute_import, print_function
from numpy.testing import (
TestCase, run_module_suite, assert_equal, assert_array_equal,
assert_array_max_ulp, assert_array_almost_equal, assert_raises, rand,
)
from numpy import (
arange, rot90,... | LumPenPacK/NetworkExtractionFromImages | win_build/nefi2_win_amd64_msvc_2015/site-packages/numpy/lib/tests/test_twodim_base.py | Python | bsd-2-clause | 17,996 | 0.001 |
import wx
import eos.db
import gui.mainFrame
from gui import globalEvents as GE
from gui.fitCommands.calc.drone.localAdd import CalcAddLocalDroneCommand
from gui.fitCommands.helpers import InternalCommandHistory, DroneInfo
from service.fit import Fit
class GuiImportLocalMutatedDroneCommand(wx.Command):
def __in... | pyfa-org/Pyfa | gui/fitCommands/gui/localDrone/mutatedImport.py | Python | gpl-3.0 | 1,558 | 0.001926 |
import operator
import ply.lex as lex
from jpp.parser.operation import Operation
from jpp.parser.expression import SimpleExpression
reserved = {
'extends': 'EXTENDS',
'import': 'IMPORT',
'local': 'LOCAL',
'imported': 'IMPORTED',
'user_input': 'USER_INPUT',
}
NAME_TOK = 'NAME'
tokens = [
'IN... | asherbar/json-plus-plus | jpp/parser/lex.py | Python | mit | 2,482 | 0 |
# importing existing friend, steganography library, and datetime.
from select_friend import select_friend
from steganography.steganography import Steganography
from datetime import datetime
from spy_details import friends, ChatMessage
#importing regular expression for proper validation
import re
# importing termcolor... | Marwari/spyChat | send_message.py | Python | mit | 2,015 | 0.009429 |
# -*- coding: utf-8 -*-
"""
Created on Mon May 16 17:14:41 2016
@author: sdemyanov
"""
import numpy as np
from sklearn import metrics
def get_prob_acc(probs, labels):
return np.mean(np.argmax(probs, axis=1) == labels)
def get_auc_score(scores, labels):
fpr, tpr, thresholds = metrics.roc_curve(labels, scores, p... | sdemyanov/tensorflow-worklab | classes/stats.py | Python | apache-2.0 | 3,985 | 0.01857 |
class Solution(object):
def findMinDifference(self, timePoints):
"""
:type timePoints: List[str]
:rtype: int
"""
def convert(time):
return int(time[:2]) * 60 + int(time[3:])
minutes = map(convert, timePoints)
minutes.sort()
return min( (y ... | sadad111/leetcodebox | Minimum Time Difference.py | Python | gpl-3.0 | 1,137 | 0.002639 |
import numpy as np
from numpy.testing import assert_almost_equal, assert_equal
import pandas as pd
import pytest
from statsmodels.iolib.table import SimpleTable
from statsmodels.stats.descriptivestats import (
Describe,
Description,
describe,
sign_test,
)
pytestmark = pytest.mark.filterwarnings(
"... | jseabold/statsmodels | statsmodels/stats/tests/test_descriptivestats.py | Python | bsd-3-clause | 6,216 | 0 |
#"Ron Ten-Hove" <rtenhove@forte.com>, by wondering why he doesn't get the expected result from passing params to unnamed templates, exposes a subtle gotcha. 15 May 2000
from Xml.Xslt import test_harness
sheet_1 = """<?xml version="1.0"?>
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
... | Pikecillo/genna | external/4Suite-XML-1.0.2/test/Xml/Xslt/Borrowed/rt_20000515.py | Python | gpl-2.0 | 1,364 | 0.002199 |
# GNU Enterprise Forms - GF Object Hierarchy - Layout
#
# Copyright 2001-2007 Free Software Foundation
#
# This file is part of GNU Enterprise
#
# GNU Enterprise 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;... | onoga/wm | src/gnue/forms/GFObjects/GFLayout.py | Python | gpl-2.0 | 3,034 | 0.018128 |
# Copyright 2014 PerfKitBenchmarker 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 appli... | syed/PerfKitBenchmarker | perfkitbenchmarker/static_virtual_machine.py | Python | apache-2.0 | 10,858 | 0.005618 |
import logging
from flask import request, flash, abort, Response
from flask_admin import expose
from flask_admin.babel import gettext, ngettext, lazy_gettext
from flask_admin.model import BaseModelView
from flask_admin.model.form import wrap_fields_in_fieldlist
from flask_admin.model.fields import ListEditableFieldLi... | hexlism/css_platform | sleepyenv/lib/python2.7/site-packages/Flask_Admin-1.2.0-py2.7.egg/flask_admin/contrib/mongoengine/view.py | Python | apache-2.0 | 20,150 | 0.000893 |
# coding=utf-8
"""
InaSAFE Disaster risk assessment tool developed by AusAid and World Bank
- **GUI Test Cases.**
Contact : ole.moller.nielsen@gmail.com
.. note:: 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 Fre... | wonder-sk/inasafe | safe/impact_statistics/test/test_postprocessor_manager.py | Python | gpl-3.0 | 5,518 | 0.000363 |
# -*- encoding: utf-8 -*-
# -*- coding: utf-8 -*-
###############################################################################
#
# Copyright (C) 2013-Today Carlos Eduardo Vercelino - CLVsol
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU Affero General Public... | CLVsol/clvsol_odoo_api | __init__.py | Python | agpl-3.0 | 2,405 | 0 |
# IfcOpenShell - IFC toolkit and geometry engine
# Copyright (C) 2021 Dion Moult <dion@thinkmoult.com>
#
# This file is part of IfcOpenShell.
#
# IfcOpenShell 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 Foundat... | IfcOpenShell/IfcOpenShell | src/ifcopenshell-python/ifcopenshell/api/structural/edit_structural_load_case.py | Python | lgpl-3.0 | 1,177 | 0 |
import six
from .log import log_input, log_output
def open(*args, **kwargs):
"""Built-in open replacement that logs input and output
Workaround for issue #44. Patching `__builtins__['open']` is complicated,
because many libraries use standard open internally, while we only want to
log inputs and out... | recipy/recipy | recipy/utils.py | Python | apache-2.0 | 1,587 | 0 |
# -*- coding: utf-8 -*-
##############################################################################
#
# OpenERP, Open Source Management Solution
# Copyright (c) 2013-2015 Serv. Tecnol. Avanzados
# Pedro M. Baeza <pedro.baeza@serviciosbaeza.com>
#
# This program is free software: y... | Jortolsa/l10n-spain | l10n_es_toponyms/wizard/__init__.py | Python | agpl-3.0 | 1,118 | 0 |
# This file is NOT licensed under the GPLv3, which is the license for the rest
# of YouCompleteMe.
#
# Here's the license text for this file:
#
# This is free and unencumbered software released into the public domain.
#
# Anyone is free to copy, modify, publish, use, compile, sell, or
# distribute this software, either... | darthdeus/dotfiles | c_ycm_conf.py | Python | mit | 5,178 | 0.018733 |
# -*- coding: utf-8 -*-
#
# pyechonest documentation build configuration file, created by
# sphinx-quickstart on Thu Sep 30 15:51:03 2010.
#
# 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.
#
# ... | AdamStelmaszczyk/pyechonest | doc/source/conf.py | Python | bsd-3-clause | 8,757 | 0.006623 |
#!/usr/bin/env python
class config:
enabled_plugins = ['cia', 'sendmail', 'synchook']
| vmiklos/darcs-hooks | config.py | Python | gpl-2.0 | 88 | 0.011364 |
# Opus/UrbanSim urban simulation software.
# Copyright (C) 2010-2011 University of California, Berkeley, 2005-2009 University of Washington
# See opus_core/LICENSE
from optparse import OptionParser
from opus_core.misc import get_config_from_opus_path
from opus_core.logger import logger
from opus_core.configurations.x... | apdjustino/DRCOG_Urbansim | src/opus_core/tools/explore_model.py | Python | agpl-3.0 | 3,937 | 0.013462 |
# Basic command-line interface to manage docker containers which will use an
# image stored in a dockerhub registry - 'pokeybill/bftest'
import click
from click.testing import CliRunner
import docker
import sys
import time
import requests
this = sys.modules[__name__]
BASE_URL = 'unix://var/run/docker.sock'
REGISTRY =... | wnormandin/bftest_cli | cli/dockcli.py | Python | mit | 4,675 | 0.003422 |
from vpp_interface import VppInterface
from vpp_papi import VppEnum
INDEX_INVALID = 0xffffffff
DEFAULT_PORT = 4789
UNDEFINED_PORT = 0
def find_vxlan_tunnel(test, src, dst, s_port, d_port, vni):
ts = test.vapi.vxlan_tunnel_v2_dump(INDEX_INVALID)
src_port = DEFAULT_PORT
if s_port != UNDEFINED_PORT:
... | FDio/vpp | test/vpp_vxlan_tunnel.py | Python | apache-2.0 | 3,138 | 0 |
# vim: ft=python fileencoding=utf-8 sw=4 et sts=4
"""Tests window.py for vimiv's test suite."""
import os
from unittest import main, skipUnless
from gi import require_version
require_version('Gtk', '3.0')
from gi.repository import Gdk
from vimiv_testcase import VimivTestCase, refresh_gui
class WindowTest(VimivTest... | karlch/vimiv | tests/window_test.py | Python | mit | 1,521 | 0.001315 |
""" utilities for testing
"""
def setup_environ(**kwargs):
""" setup basic wsgi environ"""
environ = {}
from wsgiref.util import setup_testing_defaults
setup_testing_defaults(environ)
environ.update(kwargs)
return environ
def make_env(path_info, script_name):
""" set up basic wsgi enviro... | aodag/WebDispatch | webdispatch/testing.py | Python | mit | 523 | 0 |
default_app_config = 'mutual_funds.company.apps.CompanyAppConfig'
| ArtemBernatskyy/FundExpert.NET | mutual_funds/company/__init__.py | Python | gpl-3.0 | 66 | 0 |
# 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 use ... | cloudkick/libcloud | libcloud/compute/drivers/dummy.py | Python | apache-2.0 | 9,524 | 0.001575 |
class Options:
instance = None
def __init__(self,options):
self.options = options
@classmethod
def set(cls,options):
"""Create an Options instance with the provided dictionary of
options"""
cls.instance = Options(options)
@classmethod
def inst(cls):
... | sumyfly/vdebug | plugin/python/vdebug/opts.py | Python | mit | 1,365 | 0.009524 |
'''
Aim :: To demonstrate the use of a list
Define a simple list , add values to it and iterate and print it
A list consists of comma seperated values which could be of any type
which is reprsented as [,,,,] .. all values are enclosed between '[' and ']'
** A list object is a mutable datatype which means it... | arunchandramouli/fanofpython | code/features/datatypes/lists1.py | Python | gpl-3.0 | 3,368 | 0.039489 |
'''
CmndHelperPQ is a helper class for dealing with commands
sent to a PyQt piped viewer.
This package was developed by the Thermal Modeling and Analysis
Project (TMAP) of the National Oceanographic and Atmospheric
Administration's (NOAA) Pacific Marine Environmental Lab (PMEL).
'''
import sys
# First try to import ... | NOAA-PMEL/PyFerret | pviewmod/cmndhelperpq.py | Python | unlicense | 21,512 | 0.002836 |
# encoding: utf8
from __future__ import unicode_literals
import re
_ALPHA_LOWER = """
a ä à á â ǎ æ ã å ā ă ą b c ç ć č ĉ ċ c̄ d ð ď e é è ê ë ė ȅ ȩ ẽ ę f g ĝ ğ h i ı
î ï í ī ì ȉ ǐ į ĩ j k ķ l ł ļ m n ñ ń ň ņ o ö ó ò ő ô õ œ ø ō ő ǒ ơ p q r ř ŗ s
ß ś š ş ŝ t ť u ú û ù ú ū ű ǔ ů ų ư v w ŵ x y ÿ ý ỳ ŷ ỹ z ź ž ż þ
"""
... | banglakit/spaCy | spacy/language_data/punctuation.py | Python | mit | 2,781 | 0.001566 |
"""
Useful utilities for management commands.
"""
from django.core.management.base import CommandError
from opaque_keys import InvalidKeyError
from opaque_keys.edx.keys import CourseKey
def get_mutually_exclusive_required_option(options, *selections):
"""
Validates that exactly one of the 2 given options is... | eduNEXT/edunext-platform | openedx/core/lib/command_utils.py | Python | agpl-3.0 | 1,739 | 0.002875 |
#!/usr/bin/python
#McDermott
#15 Sep 2017
#
# Calculations for compressible orifice flow
#
# Refs:
# See my notes from 1996
# Munson, Young, Okishi. Fundamentals of Fluid Mechanics. Wiley, 1990.
import math
HOC = 50010. # heat of combustion [kJ/kg]
psig = 0.0003
T_F = 100.
C_d = 0.85 # orifice d... | rmcdermo/sandbox | oflow.py | Python | mit | 2,209 | 0.018108 |
# The Nexus software is licensed under the BSD 2-Clause license.
#
# You should have recieved a copy of this license with the software.
# If you did not, you can find one at the following link.
#
# http://opensource.org/licenses/bsd-license.php
from core.plugins import ProtocolPlugin
from ConfigParser import RawConfi... | TheArchives/Nexus | core/plugins/fetch.py | Python | bsd-2-clause | 5,886 | 0.003738 |
#!/usr/bin/python3
# -*- coding: utf-8 -*-
import serpscrap
keywords = ['stellar']
config = serpscrap.Config()
config.set('scrape_urls', False)
scrap = serpscrap.SerpScrap()
scrap.init(config=config.get(), keywords=keywords)
results = scrap.as_csv('/tmp/output')
| ecoron/SerpScrap | examples/example_csv.py | Python | mit | 266 | 0 |
"""Define patches used for androidtv tests."""
from tests.async_mock import mock_open, patch
KEY_PYTHON = "python"
KEY_SERVER = "server"
ADB_DEVICE_TCP_ASYNC_FAKE = "AdbDeviceTcpAsyncFake"
DEVICE_ASYNC_FAKE = "DeviceAsyncFake"
class AdbDeviceTcpAsyncFake:
"""A fake of the `adb_shell.adb_device_async.AdbDeviceT... | sdague/home-assistant | tests/components/androidtv/patchers.py | Python | apache-2.0 | 6,084 | 0.00263 |
""" This module serves as the interface between the PYTHON code and the
FORTRAN implementations.
"""
import pandas as pd
import numpy as np
import subprocess
import os
from respy.python.shared.shared_auxiliary import dist_class_attributes
from respy.python.shared.shared_auxiliary import dist_model_paras
from respy.pyt... | restudToolbox/package | respy/fortran/interface.py | Python | mit | 11,491 | 0.002176 |
import sublime
import sublime_plugin
import re
from Statement import statement
from Expression import expression
try:
from SublimeLinter.lint import persist
except ImportError as error:
print("Dependency import failed; please read readme for " +
"Semicolon plugin for installation instructions; to disable this ... | shagabutdinov/sublime-semicolon | semicolon.py | Python | mit | 3,677 | 0.018493 |
"""
WSGI config for h1z1map project.
It exposes the WSGI callable as a module-level variable named ``application``.
For more information on this file, see
https://docs.djangoproject.com/en/1.7/howto/deployment/wsgi/
"""
import os
os.environ.setdefault("DJANGO_SETTINGS_MODULE", "server.settings")
from django.core.ws... | robrocker7/h1z1map | server/wsgi.py | Python | apache-2.0 | 388 | 0.002577 |
# repo.py
# DNF Repository objects.
#
# Copyright (C) 2013-2015 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.
# This program i... | shaded-enmity/dnf | dnf/repo.py | Python | gpl-2.0 | 27,545 | 0.001307 |
# -*- coding: utf-8 -*-
#
# Test documentation build configuration file, created by
# sphinx-quickstart on Sat Feb 21 22:42:03 2009.
#
# This file is execfile()d with the current directory set to its containing dir.
#
# The contents of this file are pickled, so don't put values in the namespace
# that aren't pi... | pythonbyexample/PBE | dbetut/conf.py | Python | bsd-3-clause | 6,209 | 0.005315 |
# coding=utf-8
# --------------------------------------------------------------------------
# Copyright (c) Microsoft Corporation. All rights reserved.
# Licensed under the MIT License. See License.txt in the project root for license information.
# Code generated by Microsoft (R) AutoRest Code Generator.
# Changes may ... | Azure/azure-sdk-for-python | sdk/network/azure-mgmt-network/azure/mgmt/network/v2020_11_01/operations/_virtual_hub_route_table_v2_s_operations.py | Python | mit | 22,766 | 0.005183 |
"""
Settings file for OpenSlides.
For more information on this file, see
https://github.com/OpenSlides/OpenSlides/blob/master/SETTINGS.rst
"""
import os
import json
from openslides.global_settings import *
class MissingEnvironmentVariable(Exception):
pass
undefined = object()
def get_env(name, default=undef... | FinnStutzenstein/OpenSlides | server/docker/settings.py | Python | mit | 5,214 | 0.001534 |
from rackattack import api
class Node(api.Node):
def __init__(self, ipcClient, allocation, name, info):
assert 'id' in info
assert 'primaryMACAddress' in info
assert 'secondaryMACAddress' in info
assert 'ipAddress' in info
self._ipcClient = ipcClient
self._allocatio... | Stratoscale/rackattack-api | py/rackattack/tcp/node.py | Python | apache-2.0 | 1,797 | 0.001113 |
from chain import *
from matrix_chain_element import *
| AversivePlusPlus/AversivePlusPlus | tools/ik/src/kinematics/__init__.py | Python | bsd-3-clause | 55 | 0 |
from MonitorData import *
from Config import *
a = Config()
Data = MonitorData(1, 10)
Data.startAllNodes(a.subscription_id, a.certificate_path, a.lib_file, a.script, a.ssh_user, a.ssh_pass, a.jm_address, a.jm_port, upgrade=True, verbose=True)
| albf/spitz | monitor/Exec.py | Python | gpl-2.0 | 245 | 0.008163 |
# Sketch - A Python-based interactive drawing program
# Copyright (C) 1997, 1998, 2001 by Bernhard Herzog
#
# This library is free software; you can redistribute it and/or
# modify it under the terms of the GNU Library General Public
# License as published by the Free Software Foundation; either
# version 2 of the Lice... | shumik/skencil-c | Sketch/UI/command.py | Python | gpl-2.0 | 7,045 | 0.042725 |
# -*- coding: utf-8 -*-
from __future__ import absolute_import, unicode_literals
from django.conf.urls import url, include
from rest_framework.routers import DefaultRouter
from rest_framework.urlpatterns import format_suffix_patterns
from . import views
router = DefaultRouter()
router.register(r'minion', views.Min... | Farforr/overlord | overlord/minions/api/v1/urls.py | Python | bsd-3-clause | 478 | 0 |
__author__ = 'Ahmed G. Ali'
ANNOTARE_DB = {
'name': 'annotare2',
'host': 'mysql-annotare-prod.ebi.ac.uk',
'port': 4444,
'username': '',
'password': ''
}
AE_AUTO_SUB_DB = {
'name': 'ae_autosubs',
'host': 'mysql-ae-autosubs-prod.ebi.ac.uk',
'port': 4091,
'username': '',
'password'... | arrayexpress/ae_auto | settings/settings_no_password.py | Python | apache-2.0 | 2,129 | 0.001879 |
#!/usr/bin/env python
import sql
import sys
def main(argv):
tables = sql.get_tables()
for table in tables:
print "%s: %d" % (table, sql.count(table))
if __name__ == '__main__': main(sys.argv[1:])
| ingkebil/trost | scripts/maintanance/count_all_tables.py | Python | gpl-2.0 | 217 | 0.018433 |
from django.conf.urls.defaults import *
urlpatterns = patterns('django.views.generic.simple',
url(r'^$', 'redirect_to', {'url': '/what/'}, name="home"),
url(r'^what/$', 'direct_to_template', {'template': 'what.html', 'extra_context': {'page': 'what'}}, name="what"),
url(r'^how/$', 'direct_to_template', {'t... | willhardy/Adjax | website/urls.py | Python | bsd-3-clause | 863 | 0.010429 |
from datetime import datetime
import rfGengou
from . import PluginBase
__all__ = ['Gengo']
class Gengo(PluginBase):
def execute(self, args):
if len(args) == 0:
target = datetime.now()
elif len(args) == 1:
target = datetime.strptime(args[0], '%Y/%m/%d')
else:
... | mikoim/funstuff | codecheck/codecheck-3608/app/plugins/gengo.py | Python | mit | 676 | 0.003077 |
"""Support for Rflink Cover devices."""
import logging
import voluptuous as vol
from homeassistant.components.cover import PLATFORM_SCHEMA, CoverDevice
from homeassistant.const import CONF_NAME, CONF_TYPE, STATE_OPEN
import homeassistant.helpers.config_validation as cv
from homeassistant.helpers.restore_state import ... | Teagan42/home-assistant | homeassistant/components/rflink/cover.py | Python | apache-2.0 | 5,550 | 0.000541 |
import pytest
import datetime
from django.template import Context
from django.template import Engine
from django.template import Template
from django.template import TemplateDoesNotExist
from django.urls import reverse
from django.core.files.uploadedfile import SimpleUploadedFile
from planotrabalho.models import Plan... | culturagovbr/sistema-nacional-cultura | gestao/tests/test_componentes.py | Python | agpl-3.0 | 11,165 | 0.004498 |
"""
This is the (unofficial) Python API for Yatedo.com Website.
Using this code, you can manage to retrieve employees from a specific company
"""
import requests
from bs4 import BeautifulSoup
import re
class YatedoAPI(object):
"""
YatedoAPI Main Handler
"""
_instance = None
_verbose = False... | PaulSec/API-Yatedo | yatedoAPI.py | Python | mit | 2,867 | 0.002093 |
import logging
import os
import re
import sys
from collections import Counter
import simplejson
from django.conf import settings
from memoized import memoized
from corehq.apps.domain.dbaccessors import iter_all_domains_and_deleted_domains_with_name
from corehq.apps.domain.extension_points import custom_domain_module... | dimagi/commcare-hq | corehq/apps/domain/utils.py | Python | bsd-3-clause | 3,824 | 0.001569 |
import threading,signal ,traceback
import random,ctypes,math,time,copy,Queue
import numpy
from dsp import common
from GlobalData import *
from common import Rx,Tx
_funclist = {}
def reg_func(func,param_types,param_defaults):
ret = False
try:
_funclist[func.__name__]=(func,param_types,param_defaults)
... | wzyy2/HackRFWebtools | func.py | Python | gpl-2.0 | 6,028 | 0.019741 |
"""Test the solarlog config flow."""
from unittest.mock import patch
import pytest
from homeassistant import data_entry_flow
from homeassistant import config_entries, setup
from homeassistant.components.solarlog import config_flow
from homeassistant.components.solarlog.const import DEFAULT_HOST, DOMAIN
from homeassist... | joopert/home-assistant | tests/components/solarlog/test_config_flow.py | Python | apache-2.0 | 4,982 | 0.000602 |
#!/usr/bin/env python3
import logging
import multiprocessing
import time
logging.basicConfig(level = logging.DEBUG, format = '%(asctime)s.%(msecs)03d [%(levelname)s] (%(process)d) %(message)s', datefmt='%Y-%m-%d %H:%M:%S')
def worker(n, a, l):
logging.debug("lock.acquire()")
l.acquire()
logging.debug(" lock ac... | dubrayn/dubrayn.github.io | examples/multiprocessing/example9.py | Python | mit | 747 | 0.037483 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.