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 -*-
# Generated by Django 1.10.2 on 2016-10-12 07:47
from __future__ import unicode_literals
from django.db import migrations
drop_harvested_records = [
"DROP TRIGGER harvested_tsvectorupdate_de ON harvested_records;",
"DROP TRIGGER harvested_tsvectorupdate_en ON harvested_records;",
"... | geometalab/G4SE-Compass | compass-api/G4SE/api/migrations/0010_NO_WAY_BACK_drop_obsolete_tables_20161012_0747.py | Python | mit | 1,451 | 0 |
# -*- coding: utf-8 -*-
# Licensed under a 3-clause BSD style license - see LICENSE.rst
"""
Tests for miscellaneous functionality in the `funcs` module
"""
from __future__ import (absolute_import, division, print_function,
unicode_literals)
import pytest
import numpy as np
from numpy import t... | kelle/astropy | astropy/coordinates/tests/test_funcs.py | Python | bsd-3-clause | 2,515 | 0.001194 |
#### NOTICE: THIS FILE IS AUTOGENERATED
#### MODIFICATIONS MAY BE LOST IF DONE IMPROPERLY
#### PLEASE SEE THE ONLINE DOCUMENTATION FOR EXAMPLES
from swgpy.object import *
def create(kernel):
result = Tangible()
result.template = "object/tangible/mission/quest_item/shared_rakir_banai_q2_needed.iff"
result.attribu... | obi-two/Rebelion | data/scripts/templates/object/tangible/mission/quest_item/shared_rakir_banai_q2_needed.py | Python | mit | 477 | 0.046122 |
'''@file alignment_writer.py
contains the AlignmentWriter class'''
import numpy as np
import tensorflow as tf
import tfwriter
class AlignmentWriter(tfwriter.TfWriter):
'''a TfWriter to write kaldi alignments'''
def _get_example(self, data):
'''write data to a file
Args:
data: the... | vrenkens/Nabu-asr | nabu/processing/tfwriters/alignment_writer.py | Python | mit | 651 | 0.003072 |
from django.http import HttpResponseRedirect
from django.contrib.contenttypes.models import ContentType
from django.utils.translation import ugettext as _
from .custom_fields import (
BooleanTimeStampField,
BooleanTimeStampFormField,
BooleanTimeStampWidget,
)
try:
from dal_select2.widgets import ModelS... | DjangoAdminHackers/ixxy-admin-utils | ixxy_admin_utils/admin_mixins.py | Python | mit | 6,862 | 0.005683 |
import tkinter as tk
class ExampleApp(tk.Tk):
def __init__(self):
tk.Tk.__init__(self)
t = SimpleTable(self, 10,2)
t.pack(side="top", fill="x")
t.set(0,0,"Hello, world")
class SimpleTable(tk.Frame):
def __init__(self, parent, rows=10, columns=2):
# use black background ... | rajarahulray/iDetector | tests_and_ References/table_view_text_box.py | Python | mit | 1,160 | 0.010345 |
"""
Django settings for example project.
Generated by 'django-admin startproject' using Django 1.9.4.
For more information on this file, see
https://docs.djangoproject.com/en/1.9/topics/settings/
For the full list of settings and their values, see
https://docs.djangoproject.com/en/1.9/ref/settings/
"""
import os
f... | dgbc/django-arctic | example/example/settings.py | Python | mit | 3,469 | 0.000288 |
#!/usr/bin/env python
import os
import sys
if __name__ == "__main__":
os.environ.setdefault("DJANGO_SETTINGS_MODULE", "myinventory.settings")
from django.core.management import execute_from_command_line
execute_from_command_line(sys.argv)
| tianz/MyInventory | manage.py | Python | mit | 254 | 0 |
"""Pexpect is a Python module for spawning child applications and controlling
them automatically. Pexpect can be used for automating interactive applications
such as ssh, ftp, passwd, telnet, etc. It can be used to a automate setup
scripts for duplicating software package installations on different servers. It
can be u... | jcartledge/sublime-worksheet | repl/pexpect.py | Python | mit | 79,154 | 0.004321 |
# TODO: Logging
import contextlib
import json
import logging
import weakref
from python2.client.codec import ClientCodec
from python2.client.exceptions import Py2Error
from python2.client.object import Py2Object
SPECIAL_EXCEPTION_TYPES = {t.__name__: t for t in (StopIteration, TypeError)}
logger = logging.getLogge... | nickgaya/python2 | python2/client/client.py | Python | mit | 2,862 | 0 |
# -*- coding: utf-8 -*-
from django.db import models
from django.utils.translation import ugettext_lazy as _
class Notice(models.Model):
text = models.TextField(_(u'Заметка'))
user = models.ForeignKey('account.User', verbose_name=_(u'Пользователь'))
picture = models.ForeignKey('picture.Picture', verbose_... | scailer/picarchive | apps/notice/models.py | Python | mit | 582 | 0 |
# vim: set fileencoding=utf-8 :
#
# Copyright (c) 2012 Retresco GmbH
# Copyright (c) 2012 Daniel Truemper <truemped at googlemail.com>
#
# 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
#
# ht... | truemped/dopplr | dopplr/solr/__init__.py | Python | apache-2.0 | 707 | 0 |
"""
Provide pre-made queries on top of the recorder component.
For more details about this component, please refer to the documentation at
https://home-assistant.io/components/history/
"""
import asyncio
from collections import defaultdict
from datetime import timedelta
from itertools import groupby
import logging
imp... | kyvinh/home-assistant | homeassistant/components/history.py | Python | apache-2.0 | 12,100 | 0 |
from sklearn.metrics import confusion_matrix
from sklearn.metrics import f1_score
from sklearn.metrics import accuracy_score
from sklearn.naive_bayes import GaussianNB
from threading import Thread
import time
from Queue import Queue, Empty
from lib.in_subject_cross_validation import *
import lib.in_subject_cross_valid... | jschavem/facial-expression-classification | source/classification/cv_subjects_multithreaded_pca.py | Python | mit | 5,651 | 0.003185 |
# rasPyCNCController
# Copyright 2016 Francesco Santini <francesco.santini@gmail.com>
#
# This file is part of rasPyCNCController.
#
# rasPyCNCController 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 ... | fsantini/rasPyCNCController | gcode/GCodeLoader.py | Python | gpl-3.0 | 2,216 | 0.002256 |
#!/usr/bin/env python
''' Checkout gitwash repo into directory and do search replace on name '''
from __future__ import (absolute_import, division, print_function)
import os
from os.path import join as pjoin
import shutil
import sys
import re
import glob
import fnmatch
import tempfile
from subprocess import call
from... | bgris/ODL_bgris | doc/gitwash_dumper.py | Python | gpl-3.0 | 8,036 | 0.000249 |
# -*- coding: utf-8 -*-
from time import sleep
from threading import Thread
class Poller(Thread):
def __init__(self, gui, delay=5):
if delay < 1:
delay = 1
self.gui = gui
self.delay = delay
self.is_running = True
self.counter = 0
super(Poller, self).__i... | socketubs/pyhn | pyhn/poller.py | Python | mit | 568 | 0 |
# 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 agreed to in writing, software
#... | afaheem88/tempest_neutron | tempest/api/image/v2/test_images_tags_negative.py | Python | apache-2.0 | 1,715 | 0 |
# -*- coding: utf-8; -*-
#
# This file is part of Superdesk.
#
# Copyright 2013, 2014 Sourcefabric z.u. and contributors.
#
# For the full copyright and license information, please see the
# AUTHORS and LICENSE files distributed with this source code, or
# at https://www.sourcefabric.org/superdesk/license
import loggi... | sivakuna-aap/superdesk-core | superdesk/io/ingest_provider_model.py | Python | agpl-3.0 | 9,799 | 0.002857 |
from django.test import TestCase
from pymongo.errors import CollectionInvalid
from .sources.base import BaseDataSource
from .sources.simple import SimpleDataSource
from .sources.csv_file import CSVDataSource
from .sources.model import ModelDataSource
from .sources.mongo import MongoDBDataSource
from .renderers impor... | agiliq/django-graphos | graphos/tests.py | Python | bsd-2-clause | 38,867 | 0.002135 |
import sys
import json
import logging
import asyncio
from collections import namedtuple
from pulsar import AsyncObject, as_coroutine, new_event_loop, ensure_future
from pulsar.utils.string import gen_unique_id
from pulsar.utils.tools import checkarity
from pulsar.apps.wsgi import Json
from pulsar.apps.http import Http... | dejlek/pulsar | pulsar/apps/rpc/jsonrpc.py | Python | bsd-3-clause | 11,409 | 0 |
# Copyright 2020 Pants project contributors (see CONTRIBUTORS.md).
# Licensed under the Apache License, Version 2.0 (see LICENSE).
import os
from pants.backend.python.subsystems.ipython import IPython
from pants.backend.python.util_rules.local_dists import LocalDistsPex, LocalDistsPexRequest
from pants.backend.python.... | patricklaw/pants | src/python/pants/backend/python/goals/repl.py | Python | apache-2.0 | 5,683 | 0.002815 |
#!/usr/bin/env python
# Copyright 2015 Joshua Charles Campbell
# 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 later version.
# ... | naturalness/partycrasher | lp/bucketizer.py | Python | gpl-3.0 | 4,063 | 0.004922 |
# List-Set-Dict comprehension exercises
# - - - - - - - - - - - - - - - - -
# Write a comprehension whose values is the first 10 powers of 2
def bin_power:
# write code here #
return
# Write a list comprehension whose value is the cartesian product
# of two lists A , B.
# Example: A = [1,2,3], B = [4,5,6]:
# ... | VolosHack/Python-presentation | workshop/list_comprehensions.py | Python | mit | 1,322 | 0.003782 |
import numpy as np
from numpy import ma
from matplotlib import pyplot as plt
from mpl_toolkits.basemap import Basemap as bm
from mpl_toolkits.basemap import addcyclic
import palettable
class vector_plot:
def __init__(self, ucompos, vcompos):
self.ucompos = ucompos
self.vcompos = vcompos
se... | nicolasfauchereau/paleopy | paleopy/plotting/vector_plot.py | Python | mit | 1,697 | 0.0165 |
"""
Created on April 25 2020
@author: Pedram Tavadze
"""
import os
import numpy as np
from .xml_output import parse_vasprun
from .incar import VaspInput
from ..codes import CodeOutput
from ...core import Structure
from ...visual import DensityOfStates
from ...crystal.kpoints import KPoints
class VaspXML(CodeOutput):
... | MaterialsDiscovery/PyChemia | pychemia/code/vasp/vaspxml.py | Python | mit | 19,297 | 0.00228 |
# -*- coding: utf-8 -*-
# © <2016> <Jarsa Sistemas, S.A. de C.V.>
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html).
from openerp.tests.common import TransactionCase
from mock import MagicMock
from lxml import etree
import requests
class TestProductTemplate(TransactionCase):
"""
This will t... | odoo-jarsa/addons-jarsa | connector_cva/tests/test_product_template.py | Python | agpl-3.0 | 1,627 | 0 |
# Definition for a binary tree node.
# class TreeNode:
# def __init__(self, x):
# self.val = x
# self.left = None
# self.right = None
class Solution:
# @param {TreeNode} root
# @param {integer} sum
# @return {boolean}
def hasPathSum(self, root, sum):
if root is None... | chengzhoukun/LeetCode | 112. Path Sum/Path Sum.py | Python | lgpl-3.0 | 599 | 0.001669 |
import unittest
from unittest.mock import Mock, patch
import copy
from datetime import timezone, timedelta, datetime
from ..reply.Reply import Reply
from ..reply import ReplyCRUD
from ..user.User import User
from ..messager import TweetAdapter, MessageBreaker, MessageSender
from ..data import DataConfig
from ..schedule... | kiriappeee/reply-later | src/core/tests/TestMessageSender.py | Python | mit | 14,145 | 0.011453 |
# Copyright (c) 2015 Ultimaker B.V.
# Cura is released under the terms of the AGPLv3 or higher.
from . import LayerView, LayerViewProxy
from PyQt5.QtQml import qmlRegisterType, qmlRegisterSingletonType
from UM.i18n import i18nCatalog
catalog = i18nCatalog("cura")
def getMetaData():
return {
"plugin": {
... | lo0ol/Ultimaker-Cura | plugins/LayerView/__init__.py | Python | agpl-3.0 | 997 | 0.007021 |
#
# 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... | robertwb/incubator-beam | sdks/python/apache_beam/testing/load_tests/load_test_metrics_utils.py | Python | apache-2.0 | 19,588 | 0.006586 |
"""Test script for popen2.py"""
import warnings
warnings.filterwarnings("ignore", ".*popen2 module is deprecated.*",
DeprecationWarning)
warnings.filterwarnings("ignore", "os\.popen. is deprecated.*",
DeprecationWarning)
import os
import sys
import unittest
import popen... | svanschalkwyk/datafari | windows/python/Lib/test/test_popen2.py | Python | apache-2.0 | 4,315 | 0.002086 |
# ----------------------------------------------------------------------------
# Copyright (c) 2015--, micronota development team.
#
# Distributed under the terms of the Modified BSD License.
#
# The full license is in the file COPYING.txt, distributed with this software.
# ---------------------------------------------... | mortonjt/micronota | micronota/bfillings/_base.py | Python | bsd-3-clause | 5,337 | 0 |
# coding=utf-8
# Copyright 2016 Pants project contributors (see CONTRIBUTORS.md).
# Licensed under the Apache License, Version 2.0 (see LICENSE).
from __future__ import (absolute_import, division, generators, nested_scopes, print_function,
unicode_literals, with_statement)
from pants_test.pant... | fkorotkov/pants | tests/python/pants_test/bin/test_loader_integration.py | Python | apache-2.0 | 1,537 | 0.004554 |
# -*- coding: utf-8 -*-
"""
InaSAFE Disaster risk assessment tool developed by AusAid and World Bank
- **Shake Event 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 publishe... | maning/inasafe | realtime/test_shake_event.py | Python | gpl-3.0 | 24,765 | 0.000202 |
# -*- coding: utf-8 -*-
#
# This file is part of Invenio.
# Copyright (C) 2012, 2013, 2014, 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
# License, or (at your... | cjhak/b2share | invenio/modules/records/views.py | Python | gpl-2.0 | 13,449 | 0.000446 |
# -*- coding: utf-8 -*-
{
"name" : "Automatical email to customer",
"version" : "1.0",
"author" : "DTBS",
"description": """
Sends automatic when customer created
""",
"website" : "http://dtbsindo.web.id",
"category" : "",
# 'depends': ['base','csmart_base','sale_stock'],
'de... | charismab45515t/dtbs-carrent | customer_auto_email/__openerp__.py | Python | gpl-2.0 | 624 | 0.016026 |
"""
PageLayout
==========
.. image:: images/pagelayout.gif
:align: right
The :class:`PageLayout` class is used to create a simple multi-page
layout, in a way that allows easy flipping from one page to another using
borders.
:class:`PageLayout` does not currently honor the
:attr:`~kivy.uix.widget.Widget.size_hint... | rnixx/kivy | kivy/uix/pagelayout.py | Python | mit | 7,321 | 0 |
# vim: tabstop=4 shiftwidth=4 softtabstop=4
'''-------------------------------------------------------------------------
Copyright IBM Corp. 2015, 2015 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 obta... | os-cloud-storage/openstack-workload-disaster-recovery | dragon/workload_policy/actions/plugins/instance_image_action.py | Python | apache-2.0 | 6,714 | 0.000149 |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
# Copyright (c) 2013 Arcus, Inc.
#
# 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 limitation the rights
#... | monk-ee/puppetdb-python | puppetdb/v3/aggregate_event_counts.py | Python | mit | 6,665 | 0.005553 |
from csv import DictWriter
from datetime import datetime
from itertools import chain
from django.db import models
from django.db.models.functions import Concat
from django.http import StreamingHttpResponse
from rest_framework import permissions
from .reviews import ReviewsEndpoint
from .ticket_exports import TicketEx... | occrp/id-backend | api_v3/views/review_exports.py | Python | mit | 1,593 | 0 |
import sys
import pytest
import os
import shutil
import py
pytest_plugins = "pytester",
class TestNewAPI:
def test_config_cache_makedir(self, testdir):
testdir.makeini("[pytest]")
config = testdir.parseconfigure()
with pytest.raises(ValueError):
config.cache.makedir("key/name")... | oleg-alexandrov/pytest | testing/test_cache.py | Python | mit | 11,823 | 0.000592 |
from __future__ import print_function, division
from neuralnilm import Net, RealApplianceSource, BLSTMLayer, SubsampleLayer, DimshuffleLayer
from lasagne.nonlinearities import sigmoid, rectify
from lasagne.objectives import crossentropy
from lasagne.init import Uniform, Normal
from lasagne.layers import LSTMLayer, Dens... | JackKelly/neuralnilm_prototype | scripts/e71.py | Python | mit | 2,878 | 0.00139 |
#!/usr/bin/python3
# coding:utf-8
from .error import ParsecEof
class BasicState(object):
def __init__(self, data):
self.data = data
self.index = 0
self.tran = -1
def next(self):
if 0 <= self.index < len(self.data):
re = self.data[self.index]
self.index ... | Dwarfartisan/pyparsec | src/parsec/state.py | Python | mit | 707 | 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.
import math
import unittest
# pylint: disable=F0401
import mojo.system
# Generated files
# pylint: disable=F0401
import sample_import_mojom
import sample_i... | hgl888/chromium-crosswalk-efl | mojo/python/tests/bindings_structs_unittest.py | Python | bsd-3-clause | 6,707 | 0.00656 |
import sys
import argparse
from itertools import izip
import math
def parseArgument():
# Parse the input
parser = argparse.ArgumentParser(description = "Make regions with 0 signal the average of their surrounding regions")
parser.add_argument("--signalsFileName", required=True, help='Signals file')
parser.add_argu... | imk1/IMKTFBindingCode | averageZeroSignalsWithinPeaks.py | Python | mit | 2,918 | 0.025703 |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
import sys
from itertools import izip
from tacit import tac
ordered_list_path = 'data/ordered.list'
expected_lines = open(ordered_list_path).read().splitlines(True)
expected_lines.reverse()
expected_count = len(expected_lines)
for bsize in range(10):
count = 0
... | moskytw/tacit | tests/test_correctness.py | Python | mit | 884 | 0.003394 |
from django import forms
from django.contrib.auth.models import User
from models import Learner
class UserForm(forms.ModelForm):
password = forms.CharField(widget=forms.PasswordInput())
class Meta:
model = User
fields = ('username', 'email', 'password')
class LearnerForm(forms.ModelForm):
... | cheng10/Shanbay_Clone | words/forms.py | Python | gpl-3.0 | 407 | 0 |
""" The strategy that uses particle swarm optimization"""
from __future__ import print_function
from __future__ import division
import random
import numpy as np
from kernel_tuner.strategies.minimize import _cost_func, get_bounds_x0_eps
def tune(runner, kernel_options, device_options, tuning_options):
""" Find th... | benvanwerkhoven/kernel_tuner | kernel_tuner/strategies/pso.py | Python | apache-2.0 | 4,015 | 0.001743 |
#! /usr/bin/env python
# -*- coding: utf-8 -*-
from django import forms
from crispy_forms.helper import FormHelper
from crispy_forms.layout import Submit
from landing.models import LandingRegister
class LandingForm(forms.ModelForm):
class Meta:
model = LandingRegister
fields = (
'nam... | andresfcardenas/marketing-platform | landing/forms.py | Python | bsd-3-clause | 803 | 0 |
def tracer(func): # State via enclosing scope and func attr
def wrapper(*args, **kwargs): # calls is per-function, not global
wrapper.calls += 1
print('call %s to %s' % (wrapper.calls, func.__name__))
return func(*args, **kwargs)
wrapper.calls = 0
return... | dreadrel/UWF_2014_spring_COP3990C-2507 | notebooks/scripts/book_code/code/decorator5.py | Python | apache-2.0 | 750 | 0.005333 |
from __future__ import print_function
import time
import uuid
import sys
import socket
import logging
import gpxpy.geo
import redis
from operator import itemgetter
r = redis.Redis(
host='datanode-001.zumykb.0001.use2.cache.amazonaws.com',
port=6379)
def get_distance(lat, querylat, querylong):
splitloc = ... | Vishakha1990/Lambdas | awsLambda_ours/nearbyfriends/findnearbypeoplelocal.py | Python | apache-2.0 | 1,712 | 0.003505 |
# pylint: disable=missing-docstring
def do_stuff(some_random_list):
for var in some_random_list:
pass
return var # [undefined-loop-variable]
def do_else(some_random_list):
for var in some_random_list:
if var == 42:
break
else:
var = 84
return var
__revision__ ... | arju88nair/projectCulminate | venv/lib/python3.5/site-packages/pylint/test/functional/undefined_loop_variable.py | Python | apache-2.0 | 733 | 0.006821 |
import unittest
from pathlib import Path
from unittest.mock import patch
from urllib.parse import urljoin, urlparse
from aiohttp import ClientSession
from lxml.etree import XPath, XPathSyntaxError
from tests.utils import AsyncMeta, fake_response as f_resp
from lapka import fetch
class TestShelter(unittest.TestCase,... | glujan/lapka | tests/unit/test_fetch.py | Python | mit | 9,020 | 0.002443 |
#!/usr/bin/env python
# This file should be compatible with both Python 2 and 3.
# If it is not, please file a bug report.
import pathConfig
#external imports
import optparse,sys
#internal imports
import subuserlib.classes.user,subuserlib.verify,subuserlib.commandLineArguments
########################################... | Robobench/rapman-subuser | logic/subuserCommands/repair.py | Python | lgpl-3.0 | 1,044 | 0.025862 |
from collections import defaultdict, namedtuple
from minecraft_data.v1_8 import recipes as raw_recipes
RecipeItem = namedtuple('RecipeItem', 'id meta amount')
class Recipe(object):
def __init__(self, raw):
self.result = reformat_item(raw['result'], None)
if 'ingredients' in raw:
sel... | Gjum/SpockBot | spockbot/mcdata/recipes.py | Python | mit | 2,639 | 0 |
import numpy as np
import pandas as pd
from bokeh.plotting import *
# Generate some synthetic time series for six different categories
cats = list("abcdef")
y = np.random.randn(2000)
g = np.random.choice(cats, 2000)
for i, l in enumerate(cats):
y[g == l] += i // 2
df = pd.DataFrame(dict(score=y, group=g))
# Find ... | sahat/bokeh | sphinx/source/tutorial/exercises/boxplot.py | Python | bsd-3-clause | 2,199 | 0.003638 |
# Copyright 2022 Troila
# 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 applic... | mahak/neutron | neutron/extensions/l3_ext_ndp_proxy.py | Python | apache-2.0 | 817 | 0 |
#!/usr/bin/env @python@
# ROOT command line tools module: cmdLineUtils
# Author: Julien Ripoche
# Mail: julien.ripoche@u-psud.fr
# Date: 20/08/15
"""Contain utils for ROOT command line tools"""
##########
# Stream redirect functions
# The original code of the these functions can be found here :
# http://stackoverflo... | jrtomps/root | main/python/cmdLineUtils.py | Python | lgpl-2.1 | 47,974 | 0.01357 |
import os
EN_US_BINARY_URL = "%(en_us_binary_url)s"
config = {
"locales_file": "src/browser/locales/all-locales",
"tools_repo": "https://hg.mozilla.org/build/tools",
"mozconfig": "src/browser/config/mozconfigs/linux32/l10n-mozconfig",
"bootstrap_env": {
"NO_MERCURIAL_SETUP_CHECK": "1",
... | Yukarumya/Yukarum-Redfoxes | testing/mozharness/configs/single_locale/tc_linux32.py | Python | mpl-2.0 | 927 | 0.001079 |
from django.db import models
from django.core.urlresolvers import reverse
from django.utils import timezone
from datetime import date
# Create your models here.
class ManagedEntity():
# submitted_by = models.ForeignKey()
submitted_at = models.DateField(auto_now_add=True)
class Organisation(models.Model):
... | Kirkkonen/NetForSpeech | nfsmain/models.py | Python | apache-2.0 | 3,681 | 0.001642 |
# Copyright 2017 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... | rabipanda/tensorflow | tensorflow/python/debug/lib/debug_gradients.py | Python | apache-2.0 | 15,460 | 0.004851 |
import os
import time
import io
import requests
from django.contrib.auth.models import User
from guardian.shortcuts import remove_perm, assign_perm
from rest_framework import status
from rest_framework.test import APIClient
import worker
from app.cogeo import valid_cogeo
from app.models import Project
from app.models... | pierotofy/WebODM | app/tests/test_api_task_import.py | Python | mpl-2.0 | 6,442 | 0.002173 |
#!/usr/bin/env python3
import os
import requests
import time
import json
def getWeatherAsWords():
# Settings for your API key and location details read from environment strings, e.g. exports etc
appid = str(os.environ.get('apikey'))
locid = str(os.environ.get('locationkey'))
lat = str(os.environ.get(... | sjhawke/piface-cad | lib/writetheweather.py | Python | gpl-3.0 | 1,742 | 0.011481 |
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('course_modes', '0004_auto_20151113_1457'),
]
operations = [
migrations.SeparateDatabaseAndState(
database_operations=[],
state_operations=[
migra... | eduNEXT/edx-platform | common/djangoapps/course_modes/migrations/0005_auto_20151217_0958.py | Python | agpl-3.0 | 1,002 | 0.000998 |
__author__ = 'Bohdan Mushkevych'
from werkzeug.utils import cached_property
from synergy.conf import settings
from synergy.system import time_helper
from synergy.conf import context
from synergy.mx.rest_model import RestTimetableTreeNode, RestJob
from synergy.mx.base_request_handler import BaseRequestHandler, valid_a... | eggsandbeer/scheduler | synergy/mx/tree_node_details.py | Python | bsd-3-clause | 2,627 | 0.002284 |
# The projects controller provides an interface for version-controlled projects
# stored on the fs as subdirectories of
# ${top_internal_dir}/projects where top_internal_dir is a variable in the
# .ini file used to launch the server.
#
# The structure of these directories is assumed to be:
# name.txt -- plain ... | mtholder/phyloplumber | phyloplumber/controllers/projects.py | Python | gpl-3.0 | 8,738 | 0.005035 |
'''Unit tests for the i18n_subsites plugin'''
import os
import locale
import unittest
import subprocess
from tempfile import mkdtemp
from shutil import rmtree
from . import i18n_subsites as i18ns
from pelican import Pelican
from pelican.tests.support import get_settings
from pelican.settings import read_settings
cl... | mikitex70/pelican-plugins | i18n_subsites/test_i18n_subsites.py | Python | agpl-3.0 | 5,011 | 0.000798 |
# -*- coding: utf-8 -*-
#
# OpenCraft -- tools to aid developing and hosting free software projects
# Copyright (C) 2015-2019 OpenCraft <contact@opencraft.com>
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU Affero General Public License as
# published by the Fre... | open-craft/opencraft | instance/serializers/openedx_appserver.py | Python | agpl-3.0 | 3,375 | 0.000296 |
#!/usr/bin/env python
import varial.tools
import unittest
import shutil
import os
class ResultCreator(varial.tools.Tool):
def run(self):
self.result = varial.wrp.Wrapper(name=self.name)
class ResultSearcher(varial.tools.Tool):
def __init__(self, name, input_path):
super(ResultSearcher, self... | HeinerTholen/Varial | varial/test/test_tools.py | Python | gpl-3.0 | 3,530 | 0 |
from django.contrib.auth.models import User
from rest_framework import serializers
from rest_framework_jwt.settings import api_settings
from .models import EmailVerification, modelresolver
class UserSerializer(serializers.ModelSerializer):
class Meta:
model = User
fields = ('id', 'username', 'fi... | iivvoo/resturo | resturo/serializers.py | Python | isc | 2,545 | 0 |
# /usr/bin/env python
"""
This module has utility functions for gathering up the static content
that is defined by XModules and XModuleDescriptors (javascript and css)
"""
import logging
import hashlib
import os
import errno
import sys
from collections import defaultdict
from docopt import docopt
from path import path... | EduPepperPD/pepper2013 | common/lib/xmodule/xmodule/static_content.py | Python | agpl-3.0 | 6,505 | 0.001845 |
__author__ = 'Dani'
import ijson
import json
PG_SCORE = "pg_score"
INCOMING_EDGES = "in_edges"
OUTCOMING_EDGES = "out_edges"
LABEL = "label"
DESCRIPTION = "desc"
class CommonIncomingCommand(object):
def __init__(self, source_dump_file, out_file, source_target_ids_file, topk_target_entities):
... | DaniFdezAlvarez/wikidataExplorer | wikidata_exp/wdexp/wikidata/commands/common_incoming_props_DUMP.py | Python | gpl-2.0 | 5,792 | 0.002762 |
# emacs: -*- mode: python; py-indent-offset: 4; indent-tabs-mode: nil -*-
# vi: set ft=python sts=4 ts=4 sw=4 et:
"""The freesurfer module provides basic functions for interfacing with
freesurfer tools.
Change directory to provide relative paths for doctests
>>> import os
>>> filepath = os.path.dirname( os... | fprados/nipype | nipype/interfaces/freesurfer/model.py | Python | bsd-3-clause | 41,958 | 0.004886 |
"""
Tests for waffle utils features.
"""
import crum
import ddt
from django.test import TestCase
from django.test.client import RequestFactory
from edx_django_utils.cache import RequestCache
from mock import patch
from opaque_keys.edx.keys import CourseKey
from waffle.testutils import override_flag
from .. import Cour... | ahmedaljazzar/edx-platform | openedx/core/djangoapps/waffle_utils/tests/test_init.py | Python | agpl-3.0 | 5,739 | 0.003311 |
#Autogenerated by ReportLab guiedit do not edit
from reportlab.graphics.charts.legends import Legend
from reportlab.graphics.charts.lineplots import ScatterPlot
from reportlab.graphics.shapes import Drawing, _DrawingEditorMixin, String
from reportlab.graphics.charts.textlabels import Label
from excelcolors import ... | tschalch/pyTray | src/lib/reportlab/graphics/samples/scatter_lines_markers.py | Python | bsd-3-clause | 3,824 | 0.02432 |
# Copyright 2012 Nebula, Inc.
#
# Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance with the License. You may obtain
# a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agree... | ging/horizon | openstack_dashboard/dashboards/project/instances/tabs.py | Python | apache-2.0 | 3,495 | 0 |
from django import forms
from django.contrib.auth.hashers import check_password
from models import Graphs, Concepts
from utils import graphCheck, GraphIntegrityError
import json
class GraphForm(forms.ModelForm):
json_input = forms.BooleanField(label=("JSON Input"), required=False,
help_text=("Check th... | danallan/octal-application | server/apps/maps/forms.py | Python | gpl-3.0 | 3,363 | 0.007136 |
# Copyright (C) 2009-2012 VMware, 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 requi... | gkotton/vmware-nsx | vmware-nsx/neutron/tests/unit/vmware/apiclient/test_api_eventlet_request.py | Python | apache-2.0 | 12,642 | 0 |
from __future__ import unicode_literals, division, absolute_import
from builtins import * # pylint: disable=unused-import, redefined-builtin
from future.moves.urllib.parse import urlparse
import json
import logging
from collections import MutableSet
import requests
from requests import RequestException
from flexget... | oxc/Flexget | flexget/plugins/list/sonarr_list.py | Python | mit | 11,933 | 0.003017 |
""" Surface image content gap. """
__version__ = '1.3-dev'
| Commonists/SurfaceImageContentGap | surfaceimagecontentgap/__init__.py | Python | mit | 59 | 0 |
"""feedfinder: Find the Web feed for a Web page
http://www.aaronsw.com/2002/feedfinder/
Usage:
feed(uri) - returns feed found for a URI
feeds(uri) - returns all feeds found for a URI
>>> import feedfinder
>>> feedfinder.feed('scripting.com')
'http://scripting.com/rss.xml'
>>>
>>> feedfinder.fe... | Einsteinish/PyTune3 | utils/feedfinder.py | Python | mit | 13,462 | 0.008394 |
import numpy as np
import cv2 as cv
# mouse callback function
def draw_circle(event,x,y,flags,param):
if event == cv.EVENT_LBUTTONDBLCLK:
cv.circle(img,(x,y),50,(255,0,0),-1)
# Create a black image, a window and bind the function to window
img = np.zeros((512,512,3), np.uint8)
cv.namedWindow('image')
cv.s... | shucommon/little-routine | python/AI/opencv/gui/mouse.py | Python | gpl-3.0 | 477 | 0.035639 |
import os, time
import subprocess
from autotest_lib.client.bin import test
from autotest_lib.client.common_lib import utils, error
class cpuset_tasks(test.test):
version = 1
preserve_srcdir = True
def initialize(self):
self.job.require_gcc()
def setup(self):
os.chdir(self.srcdir)
... | yochow/autotest | client/tests/cpuset_tasks/cpuset_tasks.py | Python | gpl-2.0 | 939 | 0.003195 |
from django.test import TestCase
from django.test import Client
from django.contrib.auth.models import User
from django.core.urlresolvers import reverse
import datetime
from .models import *
from django.utils import timezone
from django.contrib.auth.models import Group, ContentType, Permission
from django.db.models imp... | jlmdegoede/Invoicegen | hour_registration/tests.py | Python | gpl-3.0 | 11,185 | 0.003934 |
'''
Created on Dec 16, 2014
@author: Jaakko Leppakangas
'''
from PyQt4 import QtGui, QtCore
from PyQt4.QtCore import pyqtSignal
from PyQt4.Qt import QApplication, QSettings, pyqtSlot
from time import sleep
import numpy as np
import matplotlib.pyplot as plt
import sys
from threading import Thread, Event
from general... | jaeilepp/eggie | ui/preprocessDialog.py | Python | bsd-2-clause | 23,303 | 0.00515 |
import time
from PLC.Method import Method
from PLC.Parameter import Parameter, Mixed
from PLC.Auth import Auth
from PLC.Sessions import Session, Sessions
from PLC.Nodes import Node, Nodes
from PLC.Persons import Person, Persons
class GetSession(Method):
"""
Returns a new session key if a user or node authenti... | dreibh/planetlab-lxc-plcapi | PLC/Methods/GetSession.py | Python | bsd-3-clause | 1,423 | 0.001405 |
import os
from datetime import datetime
from HinetPy import Client
username = os.environ["HINET_USERNAME"]
password = os.environ["HINET_PASSWORD"]
client = Client(username, password)
starttime = datetime(2017, 1, 1, 0, 0)
client.get_continuous_waveform("0101", starttime, 20, threads=4)
| seisman/HinetPy | tests/localtest_client_multi_threads.py | Python | mit | 289 | 0 |
from __future__ import absolute_import, unicode_literals
import pytest
from datetime import datetime
from case import Mock, patch
from kombu.asynchronous.timer import Entry, Timer, to_timestamp
from kombu.five import bytes_if_py2
class test_to_timestamp:
def test_timestamp(self):
assert to_timestamp(... | urbn/kombu | t/unit/asynchronous/test_timer.py | Python | bsd-3-clause | 4,311 | 0 |
# pcontracts_example_3.py
# Copyright (c) 2013-2019 Pablo Acosta-Serafini
# See LICENSE for details
# pylint: disable=C0111,C0410,W0613,W0702
from __future__ import print_function
import os, pexdoc.pcontracts
@pexdoc.pcontracts.new_contract(ex1=(RuntimeError, "Invalid name"))
def custom_contract1(arg):
if not ar... | pmacosta/pexdoc | docs/support/pcontracts_example_3.py | Python | mit | 2,517 | 0.000397 |
# vim: set ts=4 sw=4 expandtab:
class Notification(object):
STARTUP = "startup"
SHOW_DIALOG = "showDialog"
HELLO = "hello"
# Menu
MENU_FILE_OPEN = "menuFileOpen"
MENU_FILE_SAVEAS = "menuFileSaveAs"
MENU_FILE_PREFS = "menuFilePreferences"
MENU_V... | lovelysystems/pyjamas | examples/timesheet/ApplicationConstants.py | Python | apache-2.0 | 951 | 0.023134 |
# -*- coding: utf-8 -*-
u"""
.. module:: utils
"""
from django.contrib.admin.models import LogEntry
from django.contrib.auth.models import User
from django.contrib.contenttypes.models import ContentType
from django.shortcuts import get_object_or_404
from django.shortcuts import redirect
from django.utils.text import s... | KrzysztofMadejski/volontulo | apps/volontulo/utils.py | Python | mit | 2,269 | 0 |
from google.appengine.ext.webapp import template
from models.user import User
from models.page import Page
import webapp2
import json
class PageHandler(webapp2.RequestHandler):
def get(self, page_id):
template_params = {}
user = None
if self.request.cookies.get('session'):
user = User.checkToken(self.re... | racheliel/My-little-business | MyLittleBuisness/web/pages/page.py | Python | mit | 648 | 0.018519 |
# -*- coding: utf-8 -*-
# Licensed under a 3-clause BSD style license - see LICENSE.rst
"""Test initalization and other aspects of Angle and subclasses"""
import threading
import warnings
import numpy as np
import pytest
from numpy.testing import assert_allclose, assert_array_equal
import astropy.units as u
from ast... | lpsinger/astropy | astropy/coordinates/tests/test_angles.py | Python | bsd-3-clause | 35,759 | 0.001064 |
#!/usr/bin/env python
__author__ = 'Mike McCann,Duane Edgington,Reiko Michisaki'
__copyright__ = '2013'
__license__ = 'GPL v3'
__contact__ = 'mccann at mbari.org'
__doc__ = '''
Master loader for all Worden's CN13ID Western Flyer cruise in October 2013
CN13ID: CANON 2013 Interdisciplinary
Mike McCann
MBARI 23 ... | stoqs/stoqs | stoqs/loaders/CANON/loadCN13ID_october2013.py | Python | gpl-3.0 | 11,697 | 0.010088 |
#!/usr/bin/env python
# -*- utf-8 -*-
import re
import copy
import time
# This is const data
direct = ['u', 'r', 'd', 'l']
direct_vector = [{'x' : -1, 'y' : 0},
{'x' : 0, 'y' : 1},
{'x' : 1, 'y' : 0},
{'x' : 0, 'y' : -1}]
def calculateNum(i, f, y):
return i * y + f
def is_empty_not_chang... | townboy/coil | solver.py | Python | mit | 9,646 | 0.005183 |
<<<<<<< HEAD
<<<<<<< HEAD
# Copyright (C) 2003-2013 Python Software Foundation
import unittest
import plistlib
import os
import datetime
import codecs
import binascii
import collections
import struct
from test import support
from io import BytesIO
ALL_FORMATS=(plistlib.FMT_XML, plistlib.FMT_BINARY)
# The testdata is... | ArcherSys/ArcherSys | Lib/test/test_plistlib.py | Python | mit | 63,176 | 0.003134 |
# 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... | yufeldman/arrow | python/pyarrow/tests/test_tensor.py | Python | apache-2.0 | 4,521 | 0 |
import unittest
from time import strftime, time, gmtime
from pymongo import Connection
from waskr.database import Stats
config = {
'db_engine': 'mongodb',
'db_host': 'localhost',
'db_port': 27017,
}
class TestDatabase(unittest.TestCase):
def __init__(self, *args, **params):
... | AloneRoad/waskr | waskr/tests/test_database.py | Python | mit | 5,538 | 0.016071 |
import tweepy
import os
from flask import Flask, make_response, jsonify
CONSUMER_KEY = os.environ['CATCHMEMEALL_TWITTER_CONSUMER_TOKEN']
CONSUMER_SECRET = os.environ['CATCHMEMEALL_TWITTER_CONSUMER_SECRET']
app = Flask(__name__)
auth = tweepy.OAuthHandler(CONSUMER_KEY, CONSUMER_SECRET)
api = tweepy.API(auth)
@app.ro... | mapado/CatchMemeAll | twitter_server.py | Python | apache-2.0 | 763 | 0.002621 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.