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 |
|---|---|---|---|---|---|---|
from .resource import Resource
"""
contentful.locale
~~~~~~~~~~~~~~~~~
This module implements the Locale class.
API Reference: https://www.contentful.com/developers/docs/references/content-delivery-api/#/reference/localization
:copyright: (c) 2016 by Contentful GmbH.
:license: MIT, see LICENSE for more details.
"""
... | contentful/contentful.py | contentful/locale.py | Python | mit | 1,165 | 0.002575 |
# Copyright 2001 by Tarjei Mikkelsen. All rights reserved.
# Revisions copyright 2007 by Michiel de Hoon. All rights reserved.
# This code is part of the Biopython distribution and governed by its
# license. Please see the LICENSE file that should have been included
# as part of this package.
"""Tests the basic funct... | updownlife/multipleK | dependencies/biopython-1.65/Tests/test_KEGG.py | Python | gpl-2.0 | 2,438 | 0 |
#!/usr/bin/env python
"""
Created Wed Oct 7 15:04:36 CEST 2015
@author: sapfo
"""
import matplotlib
#matplotlib.use('Agg')
import simul_ms
import python_cmdscale
#import python_pca
import exp
import sys
import numpy as np
import pylab as py
from scipy.stats import norm
'''
We want to pick n1, n2, D, T?
Simulate ... | sapfo/medeas | src/old_scripts/main_simul_eigenvalues_distribution.py | Python | gpl-3.0 | 7,741 | 0.027774 |
# -*- coding: utf-8 -*-
# pylint: disable=C0302,fixme, protected-access
""" The core module contains the SoCo class that implements
the main entry to the SoCo functionality
"""
from __future__ import unicode_literals
import socket
import logging
import re
import requests
from .services import DeviceProperties, Conte... | xxdede/SoCo | soco/core.py | Python | mit | 72,281 | 0 |
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.db import models, migrations
class Migration(migrations.Migration):
dependencies = [
]
operations = [
migrations.CreateModel(
name='Registry',
fields=[
('id', models.AutoField(ver... | zacherytapp/wedding | weddingapp/apps/registry/migrations/0001_initial.py | Python | bsd-3-clause | 1,051 | 0.001903 |
# 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... | GabrielBrascher/cloudstack | test/integration/component/test_stopped_vm.py | Python | apache-2.0 | 58,065 | 0.000224 |
from rtruffle.abstract_node import AbstractNode, NodeInitializeMetaClass
class BaseNode(AbstractNode):
__metaclass__ = NodeInitializeMetaClass
_immutable_fields_ = ['_source_section', '_parent']
_child_nodes_ = []
| SOM-st/RPySOM | src/rtruffle/base_node_2.py | Python | mit | 229 | 0 |
###
# Copyright (c) 2002-2005, Jeremiah Fincher
# Copyright (c) 2009, James McCoy
# 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 copyr... | Ban3/Limnoria | plugins/Misc/plugin.py | Python | bsd-3-clause | 27,456 | 0.001603 |
#!/usr/bin/env python2
import os
from credit import main, exce
from credit import jsonhelper as jh
from credit.tests import testData as td
import unittest
class Test_total_all_net(unittest.TestCase):
def setUp(self):
self.fnum = 10
self.days = 10
self.startname = 'test_display'
s... | leosartaj/credit | credit/tests/main_tests/test_total_all_net.py | Python | mit | 1,235 | 0.00081 |
# -*- coding: utf-8 -*-
from ..base import * # noqa
build_column('idmen', IntCol(is_permanent = True, label = u"Identifiant du ménage"))
build_column('idfoy', IntCol(is_permanent = True, label = u"Identifiant du foyer"))
build_column('idfam', IntCol(is_permanent = True, label = u"Identifiant de la famille"))
build... | adrienpacifico/openfisca-france | openfisca_france/model/caracteristiques_socio_demographiques/demographie.py | Python | agpl-3.0 | 9,098 | 0.024722 |
from __future__ import absolute_import
import re
import math
import contextlib
from .LineTransformProcessor import LineTransformProcessor
import makerbot_driver
class AnchorProcessor(LineTransformProcessor):
def __init__(self):
super(AnchorProcessor, self).__init__()
self.is_bundleable = True
... | madhuni/AstroBox | src/ext/makerbot_driver/GcodeProcessors/AnchorProcessor.py | Python | agpl-3.0 | 5,212 | 0.002686 |
from django_nose.tools import assert_false, assert_true
from pontoon.base.tests import TestCase
from pontoon.base.utils import extension_in
class UtilsTests(TestCase):
def test_extension_in(self):
assert_true(extension_in('filename.txt', ['bat', 'txt']))
assert_true(extension_in('filename.biff', ... | yfdyh000/pontoon | pontoon/base/tests/test_utils.py | Python | bsd-3-clause | 644 | 0 |
from . animation import Animation
from .. layout import strip
class Strip(Animation):
LAYOUT_CLASS = strip.Strip
LAYOUT_ARGS = 'num',
def __init__(self, layout, start=0, end=-1, **kwds):
super().__init__(layout, **kwds)
self._start = max(start, 0)
self._end = end
if self.... | ManiacalLabs/BiblioPixel | bibliopixel/animation/strip.py | Python | mit | 543 | 0.001842 |
import mock
import pytest
import yaml
import json
from awx.api.serializers import JobLaunchSerializer
from awx.main.models.credential import Credential
from awx.main.models.inventory import Inventory, Host
from awx.main.models.jobs import Job, JobTemplate, UnifiedJobTemplate
from awx.api.versioning import reverse
@... | wwitzel3/awx | awx/main/tests/functional/api/test_job_runtime_params.py | Python | apache-2.0 | 26,351 | 0.004326 |
from py2neo.server import GraphServer
from py2neo import Node,Relationship
HISTO_LENGTH = 5
def insert(sentence, tokensAndType):
"""
Take a sentence and it's associate tokens and type and store all of it in the db as the last sentence of the dialogue
@type sentence: string
@param sentence: The inser... | Vongo/anna | src/talk/db.py | Python | gpl-2.0 | 5,871 | 0.027764 |
from collections import Counter
from typing import List, Mapping, Union, Optional
import numpy as np
import pandas as pd
import seaborn as sns
from matplotlib import pyplot as plt
from bartpy.runner import run_models
from bartpy.sklearnmodel import SklearnModel
ImportanceMap = Mapping[int, float]
ImportanceDistribut... | JakeColtman/bartpy | bartpy/diagnostics/features.py | Python | mit | 8,265 | 0.00363 |
import datetime
from django.utils import timezone
from django.test import TestCase
from django.urls import reverse
from .models import Question
class QuestionMethodTests(TestCase):
def test_was_published_recently_with_future_question(self):
"""
was_published_recently() should return False for qu... | congpc/DjangoExample | mysite/polls/tests.py | Python | bsd-2-clause | 5,010 | 0.001198 |
#
# @lc app=leetcode id=103 lang=python3
#
# [103] Binary Tree Zigzag Level Order Traversal
#
from typing import List
# Definition for a binary tree node.
class TreeNode:
def __init__(self, x):
self.val = x
self.left = None
self.right = None
# @lc code=start
class Solution:
def zigzagL... | heyf/cloaked-octo-adventure | leetcode/0103_binary-tree-zigzag-level-order-traversal.py | Python | mit | 1,261 | 0.008723 |
# -*- coding: utf-8 -*-
# Define here the models for your scraped items
#
# See documentation in:
# http://doc.scrapy.org/en/latest/topics/items.html
from scrapy.item import Item, Field
class SpiderItem(Item):
# define the fields for your item here like:
# name = scrapy.Field()
brand = Field()
name ... | LaveyD/spider | spider/items.py | Python | gpl-3.0 | 957 | 0.003135 |
from sqlalchemy.ext.declarative import declarative_base
from sqlalchemy.orm import (
scoped_session,
sessionmaker,
)
from zope.sqlalchemy import ZopeTransactionExtension
import tornado.web
from handlers.index import IndexHandler
from handlers.sensors import SensorsHandler
import logging
logging.getLogger(... | nextgis/entels_front_demo | entels_demo_tornado/__init__.py | Python | gpl-2.0 | 548 | 0 |
import pytest
from forte.solvers import solver_factory, HF, ActiveSpaceSolver
def test_detci_4():
"""CASCI test of Forte DETCI using the SparseList algorithm to build the sigma vector"""
ref_hf_energy = -99.977636678461636
ref_fci_energy = -100.113732484560970
xyz = """
F
H 1 1.0
"""
... | evangelistalab/forte | tests/pytest-methods/detci/test_detci-4.py | Python | lgpl-3.0 | 986 | 0.002028 |
import logging
from mimeprovider.documenttype import get_default_document_types
from mimeprovider.client import get_default_client
from mimeprovider.exceptions import MimeException
from mimeprovider.exceptions import MimeBadRequest
from mimeprovider.mimerenderer import MimeRenderer
from mimeprovider.validators impor... | udoprog/mimeprovider | mimeprovider/__init__.py | Python | gpl-3.0 | 5,322 | 0 |
import numpy as np
from holoviews.core.overlay import NdOverlay
from holoviews.core.spaces import HoloMap
from holoviews.element import Points
from .testplot import TestMPLPlot, mpl_renderer
from ..utils import ParamLogStream
try:
from matplotlib import pyplot
except:
pass
class TestPointPlot(TestMPLPlot):... | basnijholt/holoviews | holoviews/tests/plotting/matplotlib/testpointplot.py | Python | bsd-3-clause | 15,100 | 0.002318 |
#
# 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 us... | tgroh/incubator-beam | sdks/python/apache_beam/io/range_trackers.py | Python | apache-2.0 | 14,379 | 0.00918 |
from django.utils.http import url_has_allowed_host_and_scheme
def get_valid_next_url_from_request(request):
next_url = request.POST.get("next") or request.GET.get("next")
if not next_url or not url_has_allowed_host_and_scheme(
url=next_url, allowed_hosts={request.get_host()}
):
return ""
... | wagtail/wagtail | wagtail/admin/views/pages/utils.py | Python | bsd-3-clause | 339 | 0 |
from bisect import bisect_left
class Solution(object):
def kEmptySlots(self, flowers, k):
"""
:type flowers: List[int]
:type k: int
:rtype: int
"""
S = []
for ithday, n in enumerate(flowers):
idx = bisect_left(S, n)
if idx > 0 and n - S[idx-1] == k+1:
return ithday + 1
elif idx < len(S) an... | xiaonanln/myleetcode-python | src/683. K Empty Slots.py | Python | apache-2.0 | 479 | 0.043841 |
# grid.py
#
# Copyright 2009 danc <quaninux@gmail.com>
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 2 of the License, or
# (at... | badbytes/pymeg | meg/grid.py | Python | gpl-3.0 | 2,412 | 0.01534 |
# Maitre D'
# Demonstrates treating a value as a condition
print("Welcome to the Chateau D' Food")
print("It seems we are quite full this evening.\n")
money = int(input("How many dollars do you slip the Maitre D'"))
if money:
print("Ah, I am reminded of a table. Right this way.")
else:
print("Please, sit. It may b... | rob-nn/python | first_book/maitre_d.py | Python | gpl-2.0 | 377 | 0.007958 |
# -*- coding: utf-8 -*-
# Copyright © 2016 Cask Data, 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 la... | caskdata/cdap | cdap-docs/_common/tabbed-parsed-literal.py | Python | apache-2.0 | 30,649 | 0.00757 |
# 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 = "simulation"
PROJECT_SPACE_DIR = "/hom... | TobiasLundby/UAST | Module6/build/simulation/catkin_generated/pkg.develspace.context.pc.py | Python | bsd-3-clause | 377 | 0 |
#
# Copyright (C) 2011 Red Hat, Inc.
#
# Author: Angus Salkeld <asalkeld@redhat.com>
#
# This program is free software; you can redistribute it and/or
# modify it under the terms of the GNU General Public License
# as published by the Free Software Foundation; either version 2
# of the License, or (at your option) any ... | sdake/pacemaker-cloud | src/pcloudsh/openstack_deployable.py | Python | gpl-2.0 | 4,878 | 0.001845 |
from .fake import UserAgent # noqa
| FireBladeNooT/Medusa_1_6 | lib/fake_useragent/__init__.py | Python | gpl-3.0 | 36 | 0 |
#_*_coding: utf-8 _*_
#__author__ = 'Alihanniba'
import urllib.request
# from urllib.request import urlopen
import urllib.error
import re
import os
import taobaotool
import time
class Spider:
def __init__(self):
self.siteUrl = 'http://mm.taobao.com/json/request_top_list.htm'
self.tool = taobaotool... | alihanniba/tornado-awesome | scrapy/taobaomm.py | Python | apache-2.0 | 3,677 | 0.004402 |
from itertools import *
for i, s in zip(count(), repeat('over-and-over', 5)):
print(i, s)
| jasonwee/asus-rt-n14uhp-mrtg | src/lesson_algorithms/itertools_repeat_zip.py | Python | apache-2.0 | 96 | 0.010417 |
from typing import Dict, List
import numpy as np
import hybrid_model
from evaluation import evaluation_metrics
from evaluation import evaluation_parting
metrics_rmse = {'rmse': evaluation_metrics.Rmse()}
metrics_rmse_prec = {'rmse': evaluation_metrics.Rmse(),
'prec@5': evaluation_metrics.Precis... | sbremer/hybrid_rs | evaluation/evaluation.py | Python | apache-2.0 | 5,761 | 0.002083 |
# -*- encoding:utf-8 -*-
# sample_CUBRIDdb.py
import CUBRIDdb
con = CUBRIDdb.connect('CUBRID:localhost:33000:demodb:::', 'public')
cur = con.cursor()
cur.execute('DROP TABLE IF EXISTS test_cubrid')
cur.execute('CREATE TABLE test_cubrid (id NUMERIC AUTO_INCREMENT(2009122350, 1), name VARCHAR(50))')
cur.execute("... | andrei14vl/cubrid | contrib/python/samples/sample_CUBRIDdb.py | Python | gpl-3.0 | 872 | 0.006912 |
"""
//=========================================================
// OOMidi
// OpenOctave Midi and Audio Editor
// (C) Copyright 2009 Mathias Gyllengahm (lunar_shuttle@users.sf.net)
//=========================================================
"""
import Pyro.core
import time
oom=Pyro.core.getProxyForURI('PYRONAME://:... | ccherrett/oom | share/pybridge/examples/addtrack.py | Python | gpl-2.0 | 930 | 0.025806 |
#!/usr/local/bin/python
#$Id: logsc.py,v 1.7 2013/11/15 15:07:06 kenji Exp $
from sqlite3 import dbapi2 as sqlite
import sys
# change integer to string if found
def int2str(p):
if type(p) == int:
return str(p)
else:
return p
if __name__ == '__main__':
con = sqlite.connect("/home/kenji/txt/hamradio/LOGS... | jj1bdx/bdxlog | scripts/logsc.py | Python | mit | 1,491 | 0.022133 |
# Copyright 2013 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 or a... | Metaswitch/calico-nova | nova/tests/unit/api/openstack/compute/contrib/test_extended_evacuate_find_host.py | Python | apache-2.0 | 4,623 | 0.000649 |
import unittest
from abc import ABC, abstractmethod
from contextshell.action import ActionExecutor, Executor
from contextshell.backends.node import NodeTreeRoot
from contextshell.backends.virtual import VirtualTree
from contextshell.command import CommandInterpreter
from contextshell.path import NodePath
from contexts... | idle-code/ContextShell | tests/functional/ShellTestsBase.py | Python | mit | 1,673 | 0 |
"""The tests for the mqtt climate component."""
import copy
import json
from unittest.mock import call, patch
import pytest
import voluptuous as vol
from homeassistant.components import climate
from homeassistant.components.climate import DEFAULT_MAX_TEMP, DEFAULT_MIN_TEMP
from homeassistant.components.climate.const ... | rohitranjan1991/home-assistant | tests/components/mqtt/test_climate.py | Python | mit | 64,945 | 0.000939 |
#! /usr/bin/env python
from __future__ import (absolute_import, division,
print_function, unicode_literals)
from builtins import * # noqa: F401
'''Runs a full joinmarket pit (using `nirc` miniircd servers,
with `nirc` options specified as an option to pytest),in
bitcoin regtest mode with 3 maker... | undeath/joinmarket-clientserver | test/test_full_coinjoin.py | Python | gpl-3.0 | 6,442 | 0.001242 |
import tests.model_control.test_ozone_custom_models_enabled as testmod
testmod.build_model( ['Quantization'] , ['ConstantTrend'] , ['Seasonal_MonthOfYear'] , ['LSTM'] ); | antoinecarme/pyaf | tests/model_control/detailed/transf_Quantization/model_control_one_enabled_Quantization_ConstantTrend_Seasonal_MonthOfYear_LSTM.py | Python | bsd-3-clause | 171 | 0.046784 |
# Copyright (c) 2019 UAVCAN Consortium
# This software is distributed under the terms of the MIT License.
# Author: Pavel Kirienko <pavel@uavcan.org>
from ._input import UDPInputSession as UDPInputSession
from ._input import PromiscuousUDPInputSession as PromiscuousUDPInputSession
from ._input import SelectiveUDPInput... | UAVCAN/pyuavcan | pyuavcan/transport/udp/_session/__init__.py | Python | mit | 729 | 0.002743 |
from iktomi.utils import cached_property
from .base import Cli
class LazyCli(Cli):
'''
Wrapper for creating lazy command digests.
Sometimes it is not needed to import all of application parts to start
a particular command. LazyCli allows you to define all imports in a
function called only on the ... | boltnev/iktomi | iktomi/cli/lazy.py | Python | mit | 1,023 | 0.001955 |
# -*- coding: utf-8 -*-
from __future__ import absolute_import, unicode_literals
from django.contrib.auth.models import User
from django.test.utils import override_settings
from allauth.account import app_settings as account_settings
from allauth.account.models import EmailAddress
from allauth.socialaccount.models im... | AltSchool/django-allauth | allauth/socialaccount/providers/disqus/tests.py | Python | mit | 2,347 | 0 |
# Copyright 2009, Kovid Goyal <kovid@kovidgoyal.net>
# Copyright 2013 Hardcoded Software (http://www.hardcoded.net)
#
# This software is licensed under the "GPL v3" License as described in the "LICENSE" file,
# which should be included with this package. The terms are also available at
# http://www.hardcoded.net/lic... | hsoft/pdfmasher | ebooks/epub/output.py | Python | gpl-3.0 | 3,361 | 0.005356 |
from PyQt4 import QtCore, QtGui
class Task(QtCore.QThread):
messageAdded = QtCore.pyqtSignal(QtCore.QString)
def __init__(self, mainWindow, parent = None):
super(Task, self).__init__(parent)
self.mainWindow = mainWindow
self.finished.connect(self.postRun)
self.terminated.connec... | karelklic/flashfit | task.py | Python | gpl-3.0 | 695 | 0.004317 |
from django.urls import path
from . import views
urlpatterns = [path('unsubscribe', views.QueryObserverUnsubscribeView.as_view())]
| genialis/django-rest-framework-reactive | src/rest_framework_reactive/api_urls.py | Python | apache-2.0 | 133 | 0.007519 |
import nacl.encoding
import nacl.public
import nacl.utils
class WhisperKey():
def __init__(self, key=None):
if key is None:
self.generate_keypair()
else:
if isinstance(key, bytes) or isinstance(key, str):
try:
self._private_key = nacl.public.PrivateKey(key, encoder=nacl.encodin... | NoiSek/whisper | whisper/models/whisperkey.py | Python | gpl-2.0 | 5,369 | 0.017322 |
# Copyright 2018 David Vidal <david.vidal@tecnativa.com>
# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl).
from odoo import _, api, models
from odoo.exceptions import UserError
class IrSequence(models.Model):
_inherit = 'ir.sequence'
@api.constrains('prefix', 'code')
def check_simplified_... | factorlibre/l10n-spain | l10n_es_pos/models/ir_sequence.py | Python | agpl-3.0 | 890 | 0 |
# just listing list of requires. will create a set up using these
"""
airflow>=1.7.1,
numpy>=1.1,
requests>=2.1,
pymongo==3.4.0,
pytest>=3.0,
simplejson==3.10.0,
tox==2.6
PyYAML==3.12
"""
| mettadatalabs1/oncoscape-datapipeline | setup.py | Python | apache-2.0 | 191 | 0 |
# Copyright 2014 Google Inc. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or ag... | KaranToor/MA450 | google-cloud-sdk/lib/surface/compute/regions/list.py | Python | apache-2.0 | 965 | 0.005181 |
'''
Run unit tests.
'''
import inspect
import os
import rez.vendor.argparse as argparse
from pkgutil import iter_modules
cli_dir = os.path.dirname(inspect.getfile(inspect.currentframe()))
src_rez_dir = os.path.dirname(cli_dir)
tests_dir = os.path.join(src_rez_dir, 'tests')
all_module_tests = []
def setup_parser(par... | cwmartin/rez | src/rez/cli/selftest.py | Python | lgpl-3.0 | 3,095 | 0.000323 |
from Website.site_base import BaseHandler
import tornado.web
import tornado
import SQL.table_simulation as SQLsim
class RawPacketHandler(BaseHandler):
@tornado.web.authenticated
def get(self):
if self.current_user is None:
self.redirect('login.html?next=edit')
return
... | matyro/Cor-RC | Website/site_rawPacket.py | Python | mit | 1,137 | 0.024626 |
# -*- coding: utf-8 -*-
import os
from collections import defaultdict
from random import choice
world = defaultdict(int)
possiblepoints = [(x, y) for x in range(-15, 16)
for y in range(-15, 16)
if 10 <= abs(x + y * 1j) <= 15]
for i in range(100):
world[choice(possiblepoints)] +... | NicovincX2/Python-3.5 | Théorie des nombres/Nombre/Nombre aléatoire/random_points_on_a_circle.py | Python | gpl-3.0 | 691 | 0 |
# This file is part of MyPaint.
# Copyright (C) 2014 by Andrew Chadwick <a.t.chadwick@gmail.com>
# Copyright (C) 2009 by Ilya Portnov <portnov@bk.ru>
#
# 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 Founda... | achadwick/mypaint | gui/layerswindow.py | Python | gpl-2.0 | 14,745 | 0.001695 |
import sys
file_name = sys.argv[1]
with open(file_name, "r") as f:
num = int(f.readline())
for i in range(num):
first_row = int(f.readline()) - 1
first_board = list()
for x in range(4):
raw_line = f.readline()
line = [int(x) for x in raw_line.split(" ")]
first_board.append(line)
second_row = int(... | daniel-bell/google-codejam-2014 | qualification/a_magic_trick.py | Python | mit | 802 | 0.032419 |
from django.contrib.auth.models import User
from django.test import TestCase
from django.test.client import Client
from django.utils import timezone
from channel_facebook.channel import FacebookChannel
from channel_facebook.models import FacebookAccount
from core import models
class FacebookBaseTestCase(TestCase):
... | daisychainme/daisychain | daisychain/channel_facebook/tests/test_base.py | Python | mit | 2,078 | 0.001444 |
from .parameters import ParameterBasedType
from .log import LoggerFactory
from .packer import packer
from .misc.six import add_metaclass
TYPES_DESCRIPTIONS = {'generic' : 'Generic module', 'functions_export': 'Such modules give functions that are useful by evaluation rules',
'connector': 'Suchs ... | naparuba/kunai | opsbro/module.py | Python | mit | 3,141 | 0.013372 |
from django.test import TestCase
class AnimalTestCase(TestCase):
def setUp(self):
print 2
def test_animals_can_speak(self):
"""Animals that can speak are correctly identified"""
print 3
| inmagik/contento | contento/tests/__init__.py | Python | mit | 220 | 0.004545 |
"""
An H2OConnection represents the latest active handle to a cloud. No more than a single
H2OConnection object will be active at any one time.
"""
from __future__ import print_function
from __future__ import absolute_import
import requests
import math
import tempfile
import os
import re
import sys
import time
import s... | YzPaul3/h2o-3 | h2o-py/h2o/connection.py | Python | apache-2.0 | 29,700 | 0.015354 |
#!/usr/bin/env python3
def main():
# import python's standard math module and numpy
import math, numpy, sys
# import Controller and other blocks from modules
from pyctrl.rc import Controller
from pyctrl.block import Interp, Logger, Constant
from pyctrl.block.system import System, Differen... | mcdeoliveira/ctrl | examples/rc_motor_control.py | Python | apache-2.0 | 4,210 | 0.024703 |
#!/usr/bin/env python3
# pylint: disable=C0103, C0325, C0301
"""
Zipped Agoda Hotel Data File Parser
-----------------------------------
This utility unzips and parses the Agoda hotel data file, in-memory,
and makes the data available
"""
import csv
import zipfile
import io
import sys
class AgodaParser(object):
... | egeland/agodaparser | agodaparser.py | Python | gpl-3.0 | 2,962 | 0.005402 |
import os
import osiris
import globalvars
class OmlRotator(osiris.OMLHtmlWrapper):
def __init__(self, tag):
osiris.OMLHtmlWrapper.__init__(self, tag, "div", False, "", "", "")
def processHtml(self, item, context):
extensionID = globalvars.extension.getID().getString()
context.page.addJavascript("/... | OsirisSPS/osiris-sps | client/data/extensions/148B613D055759C619D5F4EFD9FDB978387E97CB/scripts/oml/rotator.py | Python | gpl-3.0 | 610 | 0.04918 |
# SharePlum
# This library simplfies the code necessary
# to automate interactions with a SharePoint
# server using python
from .office365 import Office365 # noqa: F401
from .site import Site # noqa: F401
from .version import __version__ # noqa: F401
__all__ = ["site", "office365"]
__title__ = "SharePlum SharePoin... | jasonrollins/shareplum | shareplum/__init__.py | Python | mit | 360 | 0 |
# 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.
from mock import Mock
from gerrit import GerritClient
from test import CrBuildTestCase
SHORT_CHANGE_ID = 'I7c1811882cf59c1dc55018926edb6d35295c53b8'
CHANGE... | nicko96/Chrome-Infra | appengine/crbuild/gerrit/test/client_test.py | Python | bsd-3-clause | 3,159 | 0.001266 |
"""Tool specific version checking to identify out of date dependencies.
This provides infrastructure to check version strings against installed
tools, enabling re-installation if a version doesn't match. This is a
lightweight way to avoid out of date dependencies.
"""
from __future__ import print_function
from distuti... | chapmanb/cloudbiolinux | cloudbio/custom/versioncheck.py | Python | mit | 2,864 | 0.003142 |
from .stats import * # noqa
| sendgrid/sendgrid-python | sendgrid/helpers/stats/__init__.py | Python | mit | 29 | 0 |
# -*- coding: utf-8 -*-
import datetime
from south.db import db
from south.v2 import SchemaMigration
from django.db import models
class Migration(SchemaMigration):
def forwards(self, orm):
# Adding field 'Pupil.birthday'
db.add_column('gsaudit_pupil', 'birthday',
self.gf('dj... | schnapptack/gskompetenzen | features/gsaudit/migrations/0011_auto__add_field_pupil_birthday.py | Python | agpl-3.0 | 12,951 | 0.006486 |
#!/usr/bin/python
# -*- coding: utf-8 -*-
# Author: Qiang Li
# Email: liqiangneu@gmail.compile
# Time: 10:27, 03/30/2017
import sys
import codecs
import argparse
import random
from io import open
argparse.open = open
reload(sys)
sys.setdefaultencoding('utf8')
if sys.version_info < (3, 0):
sys.stderr = codecs.g... | liqiangnlp/LiNMT | scripts/hint.aware/chunk/eng/LiNMT-postprocess-text-chunking-rmNP.py | Python | mit | 2,875 | 0.017043 |
import math,sys
from math import pi
def ieee754 (a):
rep = 0
#sign bit
if (a<0):
rep = 1<<31
a = math.fabs(a)
if (a >= 1):
#exponent
exp = int(math.log(a,2))
rep = rep|((exp+127)<<23)
#mantissa
temp = a / pow(2,exp) - 1
i = 22
while i>=0:
temp = temp * 2
if temp > 1:
rep = rep | (1... | ankitshah009/High-Radix-Adaptive-CORDIC | Testbench Generation code/Testbench Files/test_sin,sinh.py | Python | apache-2.0 | 3,601 | 0.064149 |
import sys
def addAbilities(core, actor, player):
actor.addAbility("sm_inside_information")
return
def removeAbilities(core, actor, player):
actor.removeAbility("sm_inside_information")
return
| agry/NGECore2 | scripts/expertise/expertise_sm_path_inside_information_1.py | Python | lgpl-3.0 | 199 | 0.030151 |
import collections
import copy
import functools
import itertools
import json
import time
import warnings
from sentinels import NOTHING
from .filtering import filter_applies, iter_key_candidates
from . import ObjectId, OperationFailure, DuplicateKeyError
from .helpers import basestring, xrange, print_deprecation_warning... | chartbeat-labs/mongomock | mongomock/collection.py | Python | bsd-3-clause | 39,269 | 0.006239 |
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
# Copyright (c) 2016 Jérémie DECOCK (http://www.jdhp.org)
# This script is provided under the terms and conditions of the MIT license:
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (th... | jdhp-sap/data-pipeline-standalone-scripts | datapipe/optimization/objectivefunc/tailcut_delta_psi.py | Python | mit | 6,676 | 0.004046 |
# -*- coding: utf-8 -*-
import datetime
from south.db import db
from south.v2 import SchemaMigration
from django.db import models
class Migration(SchemaMigration):
def forwards(self, orm):
# Adding model 'TrackedUser'
db.create_table('sentry_trackeduser', (
('id', self.gf('sentry.db.m... | JackDanger/sentry | src/sentry/south_migrations/0077_auto__add_trackeduser__add_unique_trackeduser_project_ident.py | Python | bsd-3-clause | 22,623 | 0.008222 |
# docstrings not neede here (the type handler doubleerfaces are fully
# documented in base.py) pylint: disable-msg=C0111
from .base import ReturnValue, Parameter, \
ReverseWrapperBase, ForwardWrapperBase
class PyObjectParam(Parameter):
DIRECTIONS = [Parameter.DIRECTION_IN]
CTYPES = ['PyObject*']
d... | cawka/pybindgen | pybindgen/typehandlers/pyobjecttype.py | Python | lgpl-2.1 | 2,516 | 0.001192 |
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
import gzip
from io import BytesIO
import random
import re
from unittest import skipIf
import warnings
from django.conf import settings
from django.core import mail
from django.db import (transaction, connections, DEFAULT_DB_ALIAS,
... | oscaro/django | tests/middleware/tests.py | Python | bsd-3-clause | 32,964 | 0.001335 |
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('usermodule', '0002_auto_20151108_2019'),
]
operations = [
migrations.CreateModel(
name='Period',
fie... | Sezzh/tifis_platform | tifis_platform/groupmodule/migrations/0001_initial.py | Python | gpl-2.0 | 711 | 0.001406 |
# -*- coding: utf-8 -*-
import datetime
from django.contrib import admin
from django.conf import settings
from django.utils.translation import ugettext_lazy as _
from newsletter.models import Newsletter, NewsletterSubscription
from newsletter.views import send_mass_email
def send_emails(newsletter, emails):
if s... | rokj/django_newsletter | newsletter/admin.py | Python | mit | 1,249 | 0.008006 |
from Database.Controllers.Curso import Curso
class Periodo(object):
def __init__(self,dados=None):
if dados is not None:
self.id = dados ['id']
self.id_curso = dados ['id_curso']
self.periodo = dados ['periodo']
self.creditos = dados ['creditos']
def getId(self):
return self.id
def setId_curso... | AEDA-Solutions/matweb | backend/Database/Models/Periodo.py | Python | mit | 742 | 0.074124 |
from django.conf.urls import patterns, include, url
from django.contrib import admin
admin.autodiscover()
urlpatterns = patterns('',
# Examples:
# url(r'^$', 'metuly.views.home', name='home'),
# url(r'^blog/', include('blog.urls')),
url(r'^admin/', include(admin.site.urls)),
url(r'^accounts/login/... | kamyarg/enfame | metuly/urls.py | Python | gpl-2.0 | 489 | 0.010225 |
"""
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, software
distributed under the License ... | mwhooker/jones | jones/web.py | Python | apache-2.0 | 5,362 | 0.000559 |
'''
Created on 12.03.2016
@author: michael
'''
import unittest
from unittest.mock import MagicMock
from alexandriabase.daos import CreatorDao
from alexandriabase.domain import Creator
from alexandriabase.services import CreatorService
class CreatorServiceTest(unittest.TestCase):
def testFindVisible(self):
... | archivsozialebewegungen/AlexandriaBase | tests/servicestests/test_creator_service.py | Python | gpl-3.0 | 732 | 0.008197 |
# 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... | kou/arrow | python/pyarrow/tests/parquet/test_encryption.py | Python | apache-2.0 | 20,329 | 0 |
'''
Created on Apr 25, 2017
@author: kashefy
'''
import numpy as np
import h5py
from nideep.iow.file_system_utils import gen_paths, filter_is_h5
def id_loc_to_loc(fpath_src, key_dst, key_src='label_id_loc', has_void_bin=True):
with h5py.File(fpath_src, 'r+') as h:
if has_void_bin:
l = np.... | kashefy/caffe_sandbox | nideep/datasets/twoears/label_utils.py | Python | bsd-2-clause | 798 | 0.017544 |
# Copyright 2016 The TensorFlow Authors. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applica... | drpngx/tensorflow | tensorflow/contrib/predictor/contrib_estimator_predictor.py | Python | apache-2.0 | 3,274 | 0.003054 |
#!/usr/bin/env python
from translate.convert import xliff2po
from translate.misc import wStringIO
from translate.storage.test_base import headerless_len, first_translatable
class TestXLIFF2PO:
xliffskeleton = '''<?xml version="1.0" ?>
<xliff version="1.1" xmlns="urn:oasis:names:tc:xliff:document:1.1">
<file ori... | dbbhattacharya/kitsune | vendor/packages/translate-toolkit/translate/convert/test_xliff2po.py | Python | bsd-3-clause | 8,448 | 0.00071 |
# 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, software
# distributed under th... | openstack/keystone | keystone/common/sql/migrations/versions/yoga/contract/e25ffa003242_initial.py | Python | apache-2.0 | 835 | 0 |
import unittest
from itertools import product
from obfusc8.circuit import *
from obfusc8.bp import *
#enable testing of 'private' module member functions, somewhat sloppy style but I prefer it to any alternative
from obfusc8.bp import _matrix2cycle
class TestBranchingProgram(unittest.TestCase):
def setUp(self):
... | tum-i22/indistinguishability-obfuscation | obfusc8/test/test_bp.py | Python | apache-2.0 | 5,366 | 0.063362 |
import mms
import unittest
from mooseutils import fuzzyAbsoluteEqual
class TestOutflow(unittest.TestCase):
def test(self):
df1 = mms.run_spatial('advection-outflow.i', 7, y_pp=['L2u', 'L2v'])
fig = mms.ConvergencePlot(xlabel='Element Size ($h$)', ylabel='$L_2$ Error')
fig.plot(df1,
... | harterj/moose | test/tests/fvkernels/mms/advective-outflow/test.py | Python | lgpl-2.1 | 7,075 | 0.005936 |
# coding=utf-8
from string import ascii_uppercase
import flask_featureflags
from app.main import main
from flask import render_template, request
from app.helpers.search_helpers import get_template_data
from app import data_api_client
import re
try:
from urlparse import urlparse, parse_qs
except ImportError:
fr... | mtekel/digitalmarketplace-buyer-frontend | app/main/suppliers.py | Python | mit | 2,705 | 0 |
# Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance with the License. You may obtain
# a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# d... | openstack/sahara-dashboard | sahara_dashboard/test/integration_tests/tests/test_sahara_image_registry.py | Python | apache-2.0 | 2,572 | 0 |
import os
from django.conf.urls import patterns, include, url
from django.contrib import admin
admin.site.site_header = os.environ.get('{{cookiecutter.env_prefix}}_TITLE', '{{cookiecutter.project_name}} Admin')
urlpatterns = patterns(
'',
url(r'^admin/', include(admin.site.urls)),
url(r'^api/auth/',
... | westerncapelabs/django-wcl-skel | {{cookiecutter.repo_name}}/{{cookiecutter.project_name}}/urls.py | Python | bsd-3-clause | 536 | 0.001866 |
# This file is part of Tryton. The COPYRIGHT file at the top level of
# this repository contains the full copyright notices and license terms.
from trytond.model import fields
from trytond.pool import Pool, PoolMeta
__all__ = ['StockMove']
__metaclass__ = PoolMeta
class StockMove:
__name__ = 'stock.move'
i... | kret0s/gnuhealth-live | tryton/server/trytond-3.8.3/trytond/modules/account_invoice_stock/stock.py | Python | gpl-3.0 | 1,091 | 0.001833 |
"""Gross moist stability-related quantities."""
from aospy.constants import c_p, grav, L_v
from aospy.utils.vertcoord import to_pascal
from indiff.deriv import EtaCenDeriv, CenDeriv
import numpy as np
from .. import PLEVEL_STR
from . import horiz_divg, vert_divg
from .thermo import dse, mse, fmse
def field_vert_int_... | spencerahill/aospy-obj-lib | aospy_user/calcs/gms.py | Python | apache-2.0 | 4,514 | 0 |
from email import message_from_file
from pkg_resources import working_set as WS
import path
from pathlib import Path
from pkg_resources import *
from pkg_resources import DistInfoDistribution, Distribution
import distutils.dist
import pkg_resources
import dpath
import sys, os, re
from distutils.errors import *
from dis... | KGerring/RevealMe | data/tested.py | Python | mit | 6,442 | 0.0104 |
class Module:
def __init__(self, mainMenu, params=[]):
# metadata info about the module, not modified during runtime
self.info = {
# name for the module that will appear in module menus
'Name': 'Prompt',
# list of one or more authors for the module
... | Hackplayers/Empire-mod-Hpys-tests | lib/modules/python/collection/osx/prompt.py | Python | bsd-3-clause | 3,830 | 0.006005 |
# encoding: utf-8
import datetime
from south.db import db
from south.v2 import SchemaMigration
from django.db import models
class Migration(SchemaMigration):
def forwards(self, orm):
# Adding field 'InstanceApplication.network'
db.add_column('apply_instanceapplication', 'network', sel... | sunweaver/ganetimgr | apply/migrations/0005_add_application_network_field.py | Python | gpl-3.0 | 8,911 | 0.008753 |
# -*- coding: utf-8 -*
"""HydraTK installation commands
.. module:: lib.install.command
:platform: Unix
:synopsis: HydraTK installation commands
.. moduleauthor:: Petr Rašek <bowman@hydratk.org>
"""
from subprocess import call, Popen, PIPE
from os import path, environ
from sys import exit
from hydratk.lib.syst... | hydratk/hydratk | src/hydratk/lib/install/command.py | Python | bsd-3-clause | 6,457 | 0.004337 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.