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 |
|---|---|---|---|---|---|---|
# Copyright 2015 Adam Greenstein <adamgreenstein@comcast.net>
#
# Switcharoo Cartographer is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later versio... | admgrn/Switcharoo | scraper/scraper/entryqueue.py | Python | gpl-3.0 | 2,041 | 0.00147 |
class A:
def <weak_warning descr="Function name should be lowercase">fooBar</weak_warning>(self): pass
class B(A):
def fooBar(self): pass | kdwink/intellij-community | python/testData/inspections/PyPep8NamingInspection/overridden.py | Python | apache-2.0 | 142 | 0.070423 |
# Tweepy
# Copyright 2009-2010 Joshua Roesslein
# See LICENSE for details.
import httplib
import urllib
import time
import re
from tweepy.error import TweepError
from tweepy.utils import convert_to_utf8_str
from tweepy.models import Model
re_path_template = re.compile('{\w+}')
def bind_api(**config):
class AP... | olemoudi/tweetdigest | tweepy/tweepy/binder.py | Python | apache-2.0 | 7,174 | 0.001812 |
from django.conf import settings
from django.conf.urls.defaults import patterns, url
from django.core.exceptions import ObjectDoesNotExist, MultipleObjectsReturned
from django.core.urlresolvers import NoReverseMatch, reverse, resolve, Resolver404
from django.db.models.sql.constants import QUERY_TERMS, LOOKUP_SEP
from d... | colinsullivan/bingo-board | bingo_board/tastypie/resources.py | Python | mit | 58,556 | 0.007121 |
from django.urls import re_path
from systextil.views import apoio_index
from systextil.views.table import (
deposito,
colecao,
estagio,
periodo_confeccao,
unidade,
)
urlpatterns = [
re_path(r'^colecao/$', colecao.view, name='colecao'),
re_path(r'^deposito/$', deposito.deposito, name='de... | anselmobd/fo2 | src/systextil/urls/table.py | Python | mit | 540 | 0.001852 |
##############################################################################
# Copyright (c) 2013-2018, Lawrence Livermore National Security, LLC.
# Produced at the Lawrence Livermore National Laboratory.
#
# This file is part of Spack.
# Created by Todd Gamblin, tgamblin@llnl.gov, All rights reserved.
# LLNL-CODE-64... | tmerrick1/spack | var/spack/repos/builtin/packages/r-futile-options/package.py | Python | lgpl-2.1 | 1,636 | 0.001834 |
import numpy as np
import pandas as pd
from bokeh import mpl
ts = pd.Series(np.random.randn(1000), index=pd.date_range('1/1/2000', periods=1000))
ts = ts.cumsum()
df = pd.DataFrame(np.random.randn(1000, 4), index=ts.index, columns=list('ABCD'))
df = df.cumsum()
df.plot(legend=False)
mpl.to_bokeh(name="dataframe")
| the13fools/Bokeh_Examples | pandas/dataframe.py | Python | bsd-3-clause | 318 | 0.006289 |
# -*- coding: utf-8 -*-
# Generated by Django 1.10.5 on 2017-04-04 22:45
from __future__ import unicode_literals
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('domain_api', '0009_remove_topleveldomain_slug'),
]
operations = [
migration... | heytrav/drs-project | domain_api/migrations/0010_topleveldomain_slug.py | Python | mit | 478 | 0 |
'''
Created on Nov 21, 2016
@author: julimatt
'''
from django import forms
| zibawa/zibawa | simulator/forms.py | Python | gpl-3.0 | 76 | 0 |
from distutils.core import setup
from distutils.extension import Extension
from Cython.Distutils import build_ext
ext_modules = [Extension("_nbt", ["_nbt.pyx"])]
import numpy
setup(
name = 'NBT library (Cython implementation)',
cmdclass = {'build_ext': build_ext},
ext_modules = ext_modules,
include_dirs ... | codewarrior0/pymclevel | setup_nbt.py | Python | isc | 344 | 0.02907 |
# -*- coding: utf-8 -*-
#
# Copyright 2010 Zuza Software Foundation
#
# This file is part of the Translate Toolkit.
#
# 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 Lice... | diorcety/translate | translate/storage/projstore.py | Python | gpl-2.0 | 14,767 | 0.000339 |
from myhdl import *
from str_builder import StrBuilder
import os
import sys
class GenWrapperFile(object):
'''|
| This class is used to generate a python wrapper of a verilog design
|________'''
def __init__(self):
self.module_name = ''
self.interface = [] # keeps the order of the d... | hnikolov/pihdf | pihdf/printers/ip_wrapper_gen.py | Python | mit | 6,357 | 0.016045 |
# encoding: utf8
from django.db import models, migrations
class Migration(migrations.Migration):
dependencies = [
('letter_to_editor', '0004_company_newspaper_webcache_wikipediapage'),
]
operations = [
migrations.AddField(
model_name='newspaper',
name='sister_news... | h4ck3rm1k3/letter-to-editor | newspaper/letter_to_editor/migrations/0005_newspaper_sister_newspapers.py | Python | agpl-3.0 | 478 | 0.002092 |
import itertools
import pickle
import numpy as np
from numpy.testing import assert_array_almost_equal
import pytest
from scipy.spatial.distance import cdist
from sklearn.neighbors import DistanceMetric
from sklearn.neighbors import BallTree
from sklearn.utils import check_random_state
from sklearn.utils._testing imp... | shyamalschandra/scikit-learn | sklearn/neighbors/tests/test_dist_metrics.py | Python | bsd-3-clause | 8,002 | 0.0005 |
#!/usr/bin/python3
import exhibition
import inputdevice
import data
from levels import level1
import os
import pygame
import logging
log = logging.getLogger(__name__)
class Engine:
""" Main class responsible for running the game.
Controls game setup and runs the main loop.
Passes input to game... | kjwilcox/digital_heist | src/engine.py | Python | gpl-2.0 | 1,911 | 0.005756 |
# Copyright 2018 The Exoplanet ML Authors.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed t... | google-research/exoplanet-ml | exoplanet-ml/astronet/ops/metrics.py | Python | apache-2.0 | 5,503 | 0.005452 |
weakened, flagged = set(), set()
infected = {(i,j) for i,a in enumerate(open('22.in')) for j,b in enumerate(a.strip('\n')) if b=='#'}
s = len(open('22.in').readlines())/2
p = (s,s)
total = 0
d = (-1,0)
for _ in xrange(10**7):
if p in infected:
d = d[1], -1*d[0]
infected.remove(p)
flagged.... | pedrotari7/advent_of_code | py/2017/22B.py | Python | mit | 600 | 0.013333 |
from oscarbluelight.basket_utils import BluelightLineOfferConsumer as LineOfferConsumer
__all__ = [
"LineOfferConsumer",
]
| thelabnyc/django-oscar-wfrs | sandbox/basket/utils.py | Python | isc | 128 | 0.007813 |
# -*- coding: utf-8 -*-
from south.utils import datetime_utils as 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 'Feedback'
db.create_table('feedback_form_feedback', (
... | bashu/django-feedback-form | feedback_form/south_migrations/0001_initial.py | Python | bsd-3-clause | 4,849 | 0.008043 |
# -*- coding: utf-8 -*-
import re
from mobify.source import MobifySource
class OReillySource(MobifySource):
HEADER = u"""
<h1>{title}</h1>
<p><strong>{lead}</strong></p>
<p><small>{author} @ oreilly.com</small><br></p>
"""
@staticmethod
def is_my_url(url):
# https://www.oreilly.com/ideas/the-ev... | macbre/mobify | mobify/sources/oreilly.py | Python | mit | 1,627 | 0.003697 |
# -*- coding: utf-8 -*-
#!/usr/bin/python
#
# This is derived from a cadquery script for generating PDIP models in X3D format
#
# from https://bitbucket.org/hyOzd/freecad-macros
# author hyOzd
# This is a
# Dimensions are from Microchips Packaging Specification document:
# DS00000049BY. Body drawing is the same as QFP ... | easyw/kicad-3d-models-in-freecad | cadquery/FCAD_script_generator/Fuse/main_generator.py | Python | gpl-2.0 | 8,654 | 0.012364 |
#########################################################################
#
# Copyright (C) 2012 OpenPlans
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
#... | GISPPU/GrenadaLandInformation | geonode/context_processors.py | Python | gpl-3.0 | 2,437 | 0.010669 |
#
# Copyright (C) 2008 The Android Open Source Project
#
# 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... | abstrakraft/repo | subcmds/forall.py | Python | apache-2.0 | 7,450 | 0.010604 |
# -*- coding: utf-8 -*-
# Form implementation generated from reading ui file 'mayaviviewerwidget.ui'
#
# Created: Mon Nov 11 18:02:00 2013
# by: pyside-uic 0.2.13 running on PySide 1.1.0
#
# WARNING! All changes made in this file will be lost!
from PySide import QtCore, QtGui
class Ui_Dialog(object):
def se... | MusculoskeletalAtlasProject/mapclient-tests | test_resources/updater_test/mayaviviewerstep-master/mapclientplugins/mayaviviewerstep/widgets/ui_mayaviviewerwidget.py | Python | apache-2.0 | 12,774 | 0.004619 |
# -*- coding: utf-8 -*-
# Akvo RSR is covered by the GNU Affero General Public License.
# See more details in the license.txt file located at the root folder of the Akvo RSR module.
# For additional details on the GNU license please see < http://www.gnu.org/licenses/agpl.html >.
from lxml import etree
def participa... | akvo/akvo-rsr | akvo/iati/exports/elements/participating_org.py | Python | agpl-3.0 | 1,717 | 0.00233 |
#!/usr/bin/env python
import json
from tdclient import api, models
class Client:
"""API Client for Treasure Data Service
"""
def __init__(self, *args, **kwargs):
self._api = api.API(*args, **kwargs)
def __enter__(self):
return self
def __exit__(self, type, value, traceback):
... | treasure-data/td-client-python | tdclient/client.py | Python | apache-2.0 | 32,550 | 0.001505 |
"""
API views for badges
"""
from edx_rest_framework_extensions.auth.session.authentication import SessionAuthenticationAllowInactiveUser
from opaque_keys import InvalidKeyError
from opaque_keys.edx.django.models import CourseKeyField
from opaque_keys.edx.keys import CourseKey
from rest_framework import generics
from r... | teltek/edx-platform | lms/djangoapps/badges/api/views.py | Python | agpl-3.0 | 6,051 | 0.003966 |
"""Imports for Python API.
This file is MACHINE GENERATED! Do not edit.
Generated by: tensorflow/tools/api/generator/create_python_api.py script.
"""
from tensorflow.python.platform.resource_loader import get_data_files_path
from tensorflow.python.platform.resource_loader import get_path_to_datafile
from tensorflow.py... | ryfeus/lambda-packs | Keras_tensorflow_nightly/source2.7/tensorflow/tools/api/generator/api/resource_loader/__init__.py | Python | mit | 532 | 0.003759 |
import sst
import sst.actions
# tests for simulate_keys
sst.actions.set_base_url('http://localhost:%s/' % sst.DEVSERVER_PORT)
sst.actions.go_to('/')
sst.actions.assert_title('The Page Title')
sst.actions.write_textfield('text_1', 'Foobar..')
sst.actions.simulate_keys('text_1', 'BACK_SPACE')
sst.actions.simulate_ke... | DramaFever/sst | src/sst/selftests/keys.py | Python | apache-2.0 | 1,307 | 0 |
# DO NOT EDIT THIS FILE!
#
# Python module CosTradingDynamic generated by omniidl
import omniORB
omniORB.updateModule("CosTradingDynamic")
# ** 1. Stub files contributing to this module
import CosTradingDynamic_idl
# ** 2. Sub-modules
# ** 3. End
| amonmoce/corba_examples | omniORBpy-4.2.1/build/python/COS/CosTradingDynamic/__init__.py | Python | mit | 251 | 0.003984 |
# -*- coding: utf-8 -*-
__author__ = 'massimo'
import unittest
class UtilTestFunctions(unittest.TestCase):
def test_verify_url(self):
self.assertTrue(True)
if __name__ == "__main__":
UtilTestFunctions.main()
| yangsibai/SiteMiner | test/util_test.py | Python | mit | 229 | 0.004367 |
from __future__ import unicode_literals
from django.db import models
from wagtail.core.models import Site
class SystemString(models.Model):
DEFAULT_GROUP = 'general'
identifier = models.CharField(max_length=1024)
string = models.CharField(max_length=1024, blank=True, null=True)
group = models.CharFi... | Frojd/wagtail-systemtext | wagtailsystemtext/models.py | Python | mit | 791 | 0 |
"""
Siren protocol adapter. See `SIREN specification <https://github.com/kevinswiber/siren>`_.
"""
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
from __future__ import unicode_literals
from ripozo.adapters import AdapterBase
from ripozo.utilities import t... | vertical-knowledge/ripozo | ripozo/adapters/siren.py | Python | gpl-2.0 | 6,055 | 0.001156 |
from PyQt4 import QtCore
from PyQt4 import QtGui
from Action import Speech
from UI.ActionPushButton import ActionPushButton
class BaseStudy(QtGui.QWidget):
def __init__(self):
super(BaseStudy, self).__init__()
self._actionQueue = None
self._nao = None
self._widgets = None
s... | mattBrzezinski/Hydrogen | robot-controller/Study/BaseStudy.py | Python | mit | 6,141 | 0.006676 |
# 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.
"""
Function/method decorators that provide timeout and retry logic.
"""
import functools
import itertools
import sys
from devil.android import device_erro... | Teamxrtc/webrtc-streaming-node | third_party/webrtc/src/chromium/src/build/android/devil/android/decorators.py | Python | mit | 5,401 | 0.007036 |
# -*- coding: utf-8 -*-
"""
Django settings for blog project.
Generated by 'django-admin startproject' using Django 1.11.4.
For more information on this file, see
https://docs.djangoproject.com/en/1.11/topics/settings/
For the full list of settings and their values, see
https://docs.djangoproject.com/en/1.11/ref/set... | baike21/blog | blog/settings.py | Python | gpl-3.0 | 4,119 | 0.002444 |
#!/usr/bin/env python
"""
Largest product in a grid
Problem 11
Published on 22 February 2002 at 06:00 pm [Server Time]
In the 20x20 grid below, four numbers along a diagonal line have been marked in red.
The product of these numbers is 26 * 63 * 78 * 14 = 1788696.
What is the greatest product of four adjac... | slowkid/EulerProject | solutions/problem11.py | Python | unlicense | 5,822 | 0.009275 |
#!/usr/bin/env python
import json
my_list = range(10)
my_list.append('whatever')
my_list.append('some thing')
my_dict = {
'key1': 'val1',
'key2': 'val2',
'key3': 'val3'
}
my_dict['key4'] = my_list
my_dict['key5'] = False
print my_dict
print json.dumps(my_dict)
with open("my_file.json", "w") as f:
json.du... | ktbyers/pynet-ons-mar17 | json_yaml/json_test.py | Python | apache-2.0 | 335 | 0 |
"""This submodule contains objects for handling different representations of models and model functions.
:synopsis: This submodule contains objects for handling different representations of models and model functions.
.. moduleauthor:: Johannes Gaessler <johannes.gaessler@student.kit.edu>
"""
from ._base impo... | dsavoiu/kafe2 | kafe2/fit/representation/model/__init__.py | Python | gpl-3.0 | 353 | 0.005666 |
from pygfa.graph_element.parser import line, field_validator as fv
SERIALIZATION_ERROR_MESSAGGE = "Couldn't serialize object identified by: "
def _format_exception(identifier, exception):
return SERIALIZATION_ERROR_MESSAGGE + identifier \
+ "\n\t" + repr(exception)
def _remove_common_edge_fields(edge_dict)... | AlgoLab/pygfa | pygfa/serializer/utils.py | Python | mit | 1,690 | 0.006509 |
from django.conf.urls import patterns, include, url
from django.views.generic import TemplateView
from django.contrib import admin
admin.autodiscover()
urlpatterns = patterns('',
url(r'^admin/', include(admin.site.urls)),
url(r'^$', TemplateView.as_view(template_name='base.html'))
)
| SheepDogInc/django-base | project_name/urls.py | Python | bsd-3-clause | 294 | 0.003401 |
# 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... | AnishShah/tensorflow | tensorflow/contrib/data/__init__.py | Python | apache-2.0 | 5,193 | 0.002696 |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
import sys
from telesto import plot
OFFSET = 1000 # REMEMBER TO CALCULATE MANUALLY!
def main():
path = sys.argv[1]
mean = plot.mean(
plot.rows(path, plot.parse_middleware_line),
("waiting", "parsing", "database", "response")
)
dev = p... | dola/Telesto | tools/protocol/telesto/plot/phases.py | Python | mit | 718 | 0.001393 |
def len2mask(len):
"""Convert a bit length to a dotted netmask (aka. CIDR to netmask)"""
mask = ''
if not isinstance(len, int) or len < 0 or len > 32:
print "Illegal subnet length: %s (which is a %s)" % \
(str(len), type(len).__name__)
return None
for t in range(4):
... | kili/playbooks | filter_plugins/netmask_conversion.py | Python | gpl-3.0 | 1,194 | 0 |
# coding=utf-8
import sys
import os
sys.path.insert(0, os.path.abspath(os.path.join(os.getcwd(), "..")))
from db.MysqlUtil import initMysql, execute, select, batchInsert, disconnect
from common.JsonHelper import loadJsonConfig
from api.tushareApi import getSimpleHistoryData
from datetime import datetime, timedelta
f... | zwffff2015/stock | task/GetStockHistoryInfoTask.py | Python | mit | 7,619 | 0.004191 |
from . import *
offline_providers = {
'builtin': builtin.ProviderBuiltin,
}
| luskaner/wps-dict | wps_dict/wps_dict/providers/offline/list.py | Python | gpl-3.0 | 81 | 0 |
"""
SleekXMPP: The Sleek XMPP Library
Copyright (C) 2011 Nathanael C. Fritz, Lance J.T. Stout
This file is part of SleekXMPP.
See the file LICENSE for copying permissio
"""
import logging
import sleekxmpp
from sleekxmpp.stanza import Message
from sleekxmpp.xmlstream.handler import Callback
from sleek... | tiancj/emesene | emesene/e3/xmpp/SleekXMPP/sleekxmpp/plugins/xep_0085/chat_states.py | Python | gpl-3.0 | 1,636 | 0 |
"""Support to interface with Sonos players."""
import asyncio
import datetime
import functools as ft
import logging
import socket
import time
import urllib
import async_timeout
import pysonos
import pysonos.snapshot
from pysonos.exceptions import SoCoUPnPException, SoCoException
from homeassistant.components.media_pl... | aequitas/home-assistant | homeassistant/components/sonos/media_player.py | Python | apache-2.0 | 37,431 | 0 |
"""
The latest version of this package is available at:
<http://github.com/jantman/webhook2lambda2sqs>
################################################################################
Copyright 2016 Jason Antman <jason@jasonantman.com> <http://www.jasonantman.com>
This file is part of webhook2lambda2sqs, also kno... | jantman/webhook2lambda2sqs | webhook2lambda2sqs/version.py | Python | agpl-3.0 | 1,938 | 0.000516 |
import os
CACHE_PORT = 8080
HTTP_PORT = 8000
HTTPS_PORT = 4430
DEFAULT_MAX_AGE = 3600
DEFAULT_LOG_PATH = os.path.dirname(__file__)
DEFAULT_LOG_FILE = os.path.join(DEFAULT_LOG_PATH, 'default-hendrix.log')
| JamesTFarrington/hendrix | hendrix/defaults.py | Python | mit | 209 | 0 |
# SET THE FOLLOWING EITHER BEFORE RUNNING THIS FILE OR BELOW, BEFORE INITIALIZING
# PRAW!
# set variables for interacting with reddit.
# my_user_agent = ""
# my_username = ""
# my_password = ""
# reddit_post_id = -1
# import praw - install: pip install praw
# Praw doc: https://praw.readthedocs.org/en/latest/index... | jonathanmorgan/reddit_collect | examples/praw_testing.py | Python | gpl-3.0 | 5,265 | 0.02754 |
"""
Fiber-based fixed point location in the Lorenz system
f(v)[0] = s*(v[1]-v[0])
f(v)[1] = r*v[0] - v[1] - v[0]*v[2]
f(v)[2] = v[0]*v[1] - b*v[2]
Reference:
http://www.emba.uvm.edu/~jxyang/teaching/Math266notes13.pdf
https://en.wikipedia.org/wiki/Lorenz_system
"""
import numpy as np
import matplotlib.pyp... | garrettkatz/directional-fibers | dfibers/examples/lorenz.py | Python | mit | 3,181 | 0.019491 |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
# The MIT License (MIT)
# Copyright (c) 2017 Juan Cabral
# 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 withou... | carpyncho/feets | feets/datasets/synthetic.py | Python | mit | 10,431 | 0 |
# Say hello to Django
| obiwanus/django-qurl | qurl/models.py | Python | mit | 22 | 0 |
# Python Code From Book
# This file consists of code snippets only
# It is not intended to be run as a script
raise SystemExit
####################################################################
# 3. Thinking in Binary
####################################################################
import magic
print magic.f... | 0ppen/introhacking | code_from_book.py | Python | mit | 16,192 | 0.000628 |
#! /usr/bin/env python3
import math, sys
import shtns
import numpy as np
class shtnsfiledata:
#
# Adopted from https://bitbucket.org/nschaeff/shtns/src/master/examples/shallow_water.py
#
def __init__(
self,
rsphere = 1.0
):
self.rsphere = rsphere
def setup(sel... | schreiberx/sweet | mule_local/python/mule_local/postprocessing/shtnsfiledata.py | Python | mit | 3,227 | 0.008057 |
# -*- coding: utf-8 -*-
import inspect
import random
import numpy as np
from django.contrib import messages
from django.views.generic import RedirectView
from django.contrib.contenttypes.models import ContentType
from django.http import Http404
from django.contrib.auth.mixins import UserPassesTestMixin
class RunAct... | math-a3k/django-ai | django_ai/base/views.py | Python | lgpl-3.0 | 2,787 | 0 |
# This file is part of cclib (http://cclib.github.io), a library for parsing
# and interpreting the results of computational chemistry packages.
#
# Copyright (C) 2014, the cclib development team
#
# The library is free software, distributed under the terms of
# the GNU Lesser General Public version 2.1 or later. You s... | ghutchis/cclib | src/cclib/writer/cjsonwriter.py | Python | lgpl-2.1 | 4,465 | 0.000896 |
import numpy as np
from numpy.testing import assert_array_equal, assert_array_almost_equal
from unittest import TestCase
from sklearn.datasets.samples_generator import make_spd_matrix
from sklearn import hmm
from sklearn import mixture
from sklearn.utils.extmath import logsumexp
from sklearn.utils import check_random... | GbalsaC/bitnamiP | venv/lib/python2.7/site-packages/sklearn/tests/test_hmm.py | Python | agpl-3.0 | 26,383 | 0.000493 |
from functools import partial
from navmazing import NavigateToSibling, NavigateToAttribute
from cfme import Credential
from cfme.exceptions import CandidateNotFound, OptionNotAvailable
import cfme.fixtures.pytest_selenium as sel
import cfme.web_ui.toolbar as tb
from cfme.web_ui import (
AngularSelect, Form, Selec... | jdemon519/cfme_tests | cfme/configure/access_control.py | Python | gpl-2.0 | 24,877 | 0.001729 |
"""
Signals for user profiles
"""
from django.conf import settings
from django.db import transaction
from django.db.models.signals import post_delete, post_save
from django.dispatch import receiver
from discussions import tasks
from profiles.models import Profile
from roles.models import Role
from roles.roles import P... | mitodl/micromasters | discussions/signals.py | Python | bsd-3-clause | 2,043 | 0.004405 |
# -*- coding: utf-8 -*-
# Copyright 2020 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... | googleads/google-ads-python | google/ads/googleads/v8/services/services/ad_service/client.py | Python | apache-2.0 | 21,991 | 0.000909 |
# 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 django.core.exceptions import PermissionDenied
from mock import Mock, patch
from nose.tools import eq_, raises
fro... | adini121/oneanddone | oneanddone/users/tests/test_mixins.py | Python | mpl-2.0 | 3,843 | 0.001041 |
import frappe
from frappe.utils import get_fullname
def execute():
for user_id in frappe.db.sql_list("""select distinct user_id from `tabEmployee`
where ifnull(user_id, '')!=''
group by user_id having count(name) > 1"""):
fullname = get_fullname(user_id)
employee = frappe.db.get_value("Employee", {"employe... | gangadhar-kadam/hrerp | erpnext/patches/4_0/fix_employee_user_id.py | Python | agpl-3.0 | 491 | 0.028513 |
from django.apps import AppConfig
class VotesConfig(AppConfig):
name = 'meinberlin.apps.votes'
label = 'meinberlin_votes'
| liqd/a4-meinberlin | meinberlin/apps/votes/apps.py | Python | agpl-3.0 | 132 | 0 |
# coding=utf-8
import matplotlib.pyplot as plt
import numpy as np
import pytest
from ..classes import Simulation, PeriodicTestGrid, NonperiodicTestGrid
from ..visualization.time_snapshots import FieldPlot, CurrentPlot
@pytest.fixture(params=(64, 128, 256, 512))
def _NG(request):
return request.param
@pytest.fi... | StanczakDominik/PythonPIC | pythonpic/tests/test_FieldSolver.py | Python | bsd-3-clause | 9,551 | 0.003036 |
# -*- coding: utf-8 -*-
"""
Tests for the WMS Service Type.
"""
import unittest
from httmock import with_httmock
import mocks.warper
from aggregator.models import Service
class TestWarper(unittest.TestCase):
@with_httmock(mocks.warper.resource_get)
def test_create_wms_service(self):
# create the ... | jmwenda/hypermap | hypermap/aggregator/tests/test_warper.py | Python | mit | 1,877 | 0.001598 |
class Solution(object):
def asteroidCollision(self, asteroids):
"""
:type asteroids: List[int]
:rtype: List[int]
"""
ret = []
for elem in asteroids:
if elem > 0:
ret.append(elem)
else:
while ret:
... | wufangjie/leetcode | 735. Asteroid Collision.py | Python | gpl-3.0 | 882 | 0 |
# Copyright 2021 The TF-Coder Authors.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in... | google-research/tensorflow-coder | tf_coder_colab_logging/serialization.py | Python | apache-2.0 | 6,543 | 0.004585 |
from datetime import date, timedelta
from django.db import models
from django.contrib.sites.models import Site
from django.core.validators import MinValueValidator
from clubdata.models import Club
def range_date_inclusive(start_date, end_date):
for n in range((end_date - start_date).days+1):
yield start_da... | InfoSec-CSUSB/club-websystem | src/events/models.py | Python | mit | 10,430 | 0.020997 |
from django.core.checks.compatibility.django_1_10 import (
check_duplicate_middleware_settings,
)
from django.test import SimpleTestCase
from django.test.utils import override_settings
class CheckDuplicateMiddlwareSettingsTest(SimpleTestCase):
@override_settings(MIDDLEWARE=[], MIDDLEWARE_CLASSES=['django.mid... | kawamon/hue | desktop/core/ext-py/Django-1.11.29/tests/check_framework/tests_1_10_compatibility.py | Python | apache-2.0 | 688 | 0.001453 |
from django.core.management.base import BaseCommand
from migrate_dns.import_utils import do_import
class Command(BaseCommand):
args = ''
def handle(self, *args, **options):
do_import()
| rtucker-mozilla/inventory | migrate_dns/management/commands/dns_migrate.py | Python | bsd-3-clause | 204 | 0.004902 |
# Copyright 2018 Pants project contributors (see CONTRIBUTORS.md).
# Licensed under the Apache License, Version 2.0 (see LICENSE).
import os
from pants.binaries.binary_tool import BinaryToolBase
from pants.binaries.binary_util import (
BinaryToolFetcher,
BinaryToolUrlGenerator,
BinaryUtil,
HostPlatfor... | wisechengyi/pants | tests/python/pants_test/binaries/test_binary_tool.py | Python | apache-2.0 | 6,038 | 0.003478 |
#! /usr/bin/env python3
with open('x.c', 'w') as f:
print('int main(void) { return 0; }', file=f)
with open('y', 'w'):
pass
| pexip/meson | test cases/common/229 custom_target source/x.py | Python | apache-2.0 | 132 | 0 |
#!/usr/bin/env python
#
# Copyright 2009 Facebook
#
# 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... | e1ven/Waymoot | libs/tornado-2.2/build/lib/tornado/curl_httpclient.py | Python | mit | 18,106 | 0.000663 |
from canvas import MappingCanvas
from viewport import MappingViewport
try:
from geojson_overlay import GeoJSONOverlay
except ImportError:
# No geojson
pass
# Tile managers
from mbtile_manager import MBTileManager
from http_tile_manager import HTTPTileManager
| nmichaud/enable-mapping | mapping/enable/api.py | Python | bsd-3-clause | 273 | 0 |
"""Ensures that account.identifier is unique.
Revision ID: ea2739ecd874
Revises: 5bd631a1b748
Create Date: 2017-09-29 09:16:09.436339
"""
# revision identifiers, used by Alembic.
revision = 'ea2739ecd874'
down_revision = '5bd631a1b748'
from alembic import op
import sqlalchemy as sa
def upgrade():
# ### comman... | stackArmor/security_monkey | migrations/versions/ea2739ecd874_.py | Python | apache-2.0 | 646 | 0.003096 |
from model.flyweight import Flyweight
from model.static.database import database
class Service(Flyweight):
def __init__(self,service_id):
#prevents reinitializing
if "_inited" in self.__dict__:
return
self._inited = None
#prevents reinitializing
self.service_id ... | Iconik/eve-suite | src/model/static/sta/services.py | Python | gpl-3.0 | 624 | 0.00641 |
import numpy as np
def test_prepare_abi_connectivity_maps():
from samri.fetch.local import prepare_abi_connectivity_maps
prepare_abi_connectivity_maps('Ventral_tegmental_area',
invert_lr_experiments=[
"127651139",
"127796728",
"127798146",
"127867804",
"156314762",
"160539283",
"160540751",
... | IBT-FMI/SAMRI | samri/fetch/test/test_local.py | Python | gpl-3.0 | 2,202 | 0.052225 |
#!/usr/bin/env python
#
# Copyright (c) 2016 Intel Corporation.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions are met:
#
# * Redistributions of works must retain the original copyright notice, this
# list of conditions and t... | crosswalk-project/crosswalk-test-suite | apptools/apptools-android-tests/apptools/manifest_xwalk_target_platforms.py | Python | bsd-3-clause | 6,310 | 0.000792 |
from nodetraq.tests import *
class TestPoolsController(TestController):
def test_index(self):
response = self.app.get(url(controller='pools', action='index'))
# Test response...
| seryl/Nodetraq | nodetraq/tests/functional/test_pools.py | Python | mit | 200 | 0.005 |
# this example shows how to append new calculated results to an already
# existing cmr file, illustrated for calculation of PBE energy on LDA density
import os
import cmr
# set True in order to use cmr in parallel jobs!
cmr.set_ase_parallel(enable=True)
from ase.structure import molecule
from ase.io import read, wri... | ajylee/gpaw-rtxs | gpaw/test/cmr_append.py | Python | gpl-3.0 | 2,763 | 0.003257 |
# -*- coding: utf-8 -*-
# Generated by Django 1.9.8 on 2016-08-22 16:03
from __future__ import unicode_literals
from django.db import migrations, models
import django.db.models.deletion
def forwards_func(apps, schema_editor):
# We get the model from the versioned app registry;
# if we directly import it, it'l... | GovReady/govready-q | guidedmodules/migrations/0011_modulequestion_answer_type_module.py | Python | gpl-3.0 | 1,551 | 0.002579 |
# 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 ... | balajikris/autorest | src/generator/AutoRest.Python.Azure.Tests/Expected/AcceptanceTests/SubscriptionIdApiVersion/microsoftazuretesturl/credentials.py | Python | mit | 731 | 0 |
#! /usr/bin/env python
# -*- coding: utf-8 -*-
# Copyright (C) 2011 ~ 2012 Deepin, Inc.
# 2011 ~ 2012 Hou Shaohui
#
# Author: Hou Shaohui <houshao55@gmail.com>
# Maintainer: Hou Shaohui <houshao55@gmail.com>
#
# This program is free software: you can redistribute it and/or modify
# it under the ter... | hillwoodroc/deepin-music-player | src/widget/combo.py | Python | gpl-3.0 | 10,334 | 0.009386 |
from builtins import range
import sys
import unittest
import re
import os.path
sys.path.insert(0, os.path.join(os.path.dirname(__file__), '..', '..'))
from Exscript import Account
from Exscript.account import AccountPool
from Exscript.util.file import get_accounts_from_file
class AccountPoolTest(unittest.TestCase):
... | maximumG/exscript | tests/Exscript/AccountPoolTest.py | Python | mit | 4,218 | 0.000948 |
# 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 ... | AutorestCI/azure-sdk-for-python | azure-mgmt-datafactory/azure/mgmt/datafactory/models/sap_hana_linked_service.py | Python | mit | 3,345 | 0.001495 |
# -*- coding: UTF-8 -*-
import sys
WorkList = None
def SH(i):
"""reformatting .SH"""
global WorkList
string = WorkList[i]
l = len(string) - 2
r = 0
while string[0] == '=' and string[l] == '=':
WorkList[i] = string[1:l]
string = WorkList[i]
l = len(string) - 1
r... | franck-talbart/codelet_tuning_infrastructure | ctr-common/plugins/4e7420cd-904e-4c2a-b08f-02c867ba4cd8/wiki2man.py | Python | gpl-3.0 | 27,388 | 0.005226 |
#!/usr/bin/env python3
# Copyright 2019 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... | kubeflow/kfp-tekton-backend | samples/core/condition/condition.py | Python | apache-2.0 | 2,572 | 0.001555 |
import pandas as pd
from sklearn import model_selection
from sklearn.ensemble import RandomForestClassifier
url = "https://archive.ics.uci.edu/ml/machine-learning-databases/pima-indians-diabetes/pima-indians-diabetes.data"
names = ['preg', 'plas', 'pres', 'skin', 'test', 'mass', 'pedi', 'age', 'class']
df = pd.read_c... | sindresf/The-Playground | Python/Machine Learning/ScikitClassifiers/Classifiers/Random_Forrest_Classification.py | Python | mit | 724 | 0.008287 |
from resource_media_types import *
from ClientFile import ClientFile
from ClientFolder import ClientFolder
from queryResource import ClientQuery
class ResourcesTypeResolverUtil(object):
classes = {}
#classes[ClientAdhocDataView.__name__] = ResourceMediaType.ADHOC_DATA_VIEW_MIME
#classes[ClientAw... | saguas/jasperserverlib | jasperserverlib/core/ResourcesTypeResolverUtil.py | Python | mit | 2,430 | 0.017284 |
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
from caffe2.proto import caffe2_pb2
from caffe2.python import core, workspace
import caffe2.python.hypothesis_test_util as hu
import caffe2.python.serialized_test.serialized_test_util as serial
from hypothesis ... | ryfeus/lambda-packs | pytorch/source/caffe2/python/operator_test/onnx_while_test.py | Python | mit | 3,154 | 0.000951 |
# -*- coding: utf-8 -*-
import sys
def get_skeleton(N, strings):
skeletons = []
for i in range(N):
skeleton = [strings[i][0]]
skeleton += [strings[i][j] for j in range(1, len(strings[i])) if strings[i][j] != strings[i][j-1]]
skeletons.append(skeleton)
for i in range(1, N):
... | changyuheng/code-jam-solutions | 2014/Round 1B/A.py | Python | mit | 1,248 | 0.004006 |
import copy
import sys
from functools import update_wrapper
from future_builtins import zip
import django.db.models.manager # Imported to register signal handler.
from django.conf import settings
from django.core.exceptions import (ObjectDoesNotExist,
MultipleObjectsReturned, FieldError, ValidationError, NON_F... | lzw120/django | django/db/models/base.py | Python | bsd-3-clause | 39,705 | 0.002393 |
import urllib
import urllib2
import threading
BaseProp = 361995
EndProp = 362044
proxies = {'http': 'http://localhost:8080'}
# handles getting the owner pdf listing of the home
class DoNothingRedirectHandler(urllib2.HTTPRedirectHandler):
def http_error_302(self, req, fp, code, msg, headers):
... | deeso/python_scrirpts | tax stuff.py | Python | apache-2.0 | 15,594 | 0.026549 |
from setuptools import setup
from setuptools import find_packages
setup(name='Keras-layers',
version='0.0.1',
description='Collection of useful non-standard layers for keras',
author='Atanas Mirchev',
author_email='taimir93@gmail.com',
url='https://github.com/taimir/keras-layers',
... | taimir/keras-layers | setup.py | Python | mit | 367 | 0 |
nb_epoch = 100
batch_size = 64
optimizer = 'adam'
hidden_units = 3000
nb_val_samples = 462
embedding_size = 10
dropout_percentage = 0.3
embedding_GRU_size = 100
maximum_line_length = 500
samples_per_epoch = 4127 * maximum_line_length
loss = 'categorical_crossentropy'
| Kasai-Code/Kinesis | settings/hyperparameters.py | Python | mit | 268 | 0 |
#!/usr/bin/env python
# Original code was created by Nadeem Douba as part of the Canari Framework
from collections import OrderedDict
from xml.etree.cElementTree import XML
from zipfile import ZipFile
def mtgx2json(graph):
zipfile = ZipFile(graph)
graphs = filter(lambda x: x.endswith('.graphml'), zipfile.n... | SneakersInc/Pandora | modules/exportgraph.py | Python | mit | 2,370 | 0.002532 |
from io import StringIO
from coaster.logger import RepeatValueIndicator, filtered_value, pprint_with_indent
def test_filtered_value():
"""Test for filtered values."""
# Doesn't touch normal key/value pairs
assert filtered_value('normal', 'value') == 'value'
assert filtered_value('also_normal', 123) =... | hasgeek/coaster | tests/test_logger.py | Python | bsd-2-clause | 2,411 | 0.001659 |
# Copyright 2015 Google Inc. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or a... | ivano666/tensorflow | tensorflow/python/kernel_tests/bitcast_op_test.py | Python | apache-2.0 | 2,305 | 0.007375 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.