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 |
|---|---|---|---|---|---|---|
def f(x):
return x + 1
raise ValueError("I do not want to be imported")
| endlessm/chromium-browser | third_party/llvm/lldb/test/API/commands/command/script/import/rdar-12586188/fail212586188.py | Python | bsd-3-clause | 77 | 0.012987 |
from __future__ import print_function, division
from sympy.core import C, Add, Mul, Pow, S
from sympy.core.compatibility import default_sort_key
from sympy.core.mul import _keep_coeff
from sympy.printing.str import StrPrinter
from sympy.printing.precedence import precedence
class AssignmentError(Exception):
"""
... | hrashk/sympy | sympy/printing/codeprinter.py | Python | bsd-3-clause | 9,879 | 0.001417 |
#!/usr/bin/python
# -*- coding: windows-1252 -*-
import wxversion
wxversion.select('2.8')
import wx
import wx.aui
from id import *
from model import *
from graphic import *
from sql import *
from django import *
import sqlite3
from xml.dom import minidom
class MainFrame(wx.aui.AuiMDIParentFrame):
def __init__(... | ajdelgados/Sofia | modules/main.py | Python | gpl-3.0 | 37,233 | 0.010102 |
# -*- coding: utf-8 -*-
## src/search_window.py
##
## Copyright (C) 2007 Stephan Erb <steve-e AT h3c.de>
## Copyright (C) 2007-2014 Yann Leboulanger <asterix AT lagaule.org>
##
## This file is part of Gajim.
##
## Gajim is free software; you can redistribute it and/or modify
## it under the terms of the GNU General Pub... | lovetox/gajim | src/search_window.py | Python | gpl-3.0 | 9,270 | 0.003344 |
#! /usr/bin/env python
# -*- coding: utf-8 -*-
# vim:fenc=utf-8
#
# Copyright © 2015 mjirik <mjirik@mjirik-Latitude-E6520>
#
# Distributed under terms of the MIT license.
"""
"""
import numpy as np
from loguru import logger
# logger = logging.getLogger()
import argparse
from scipy import ndimage
from . import qmisc... | mjirik/lisa | lisa/shape_model.py | Python | bsd-3-clause | 8,801 | 0.011083 |
# -*- coding: utf-8 -*-
# Generated by Django 1.10.5 on 2017-06-18 14:57
from __future__ import unicode_literals
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('testapp', '0001_initial'),
]
operations = [
migrations.AlterField(
... | Kemaweyan/django-content-gallery | content_gallery_testapp/testapp/migrations/0002_auto_20170618_1457.py | Python | bsd-3-clause | 475 | 0.002105 |
"""Common operations on DOS pathnames."""
import os
import stat
__all__ = ["normcase","isabs","join","splitdrive","split","splitext",
"basename","dirname","commonprefix","getsize","getmtime",
"getatime","islink","exists","isdir","isfile","ismount",
"walk","expanduser","expandv... | DarioGT/OMS-PluginXML | org.modelsphere.sms/lib/jython-2.2.1/Lib/dospath.py | Python | gpl-3.0 | 10,452 | 0.003062 |
#!/usr/bin/env python
'''
Command to send dynamic filesystem information to Zagg
'''
# vim: expandtab:tabstop=4:shiftwidth=4
#
# Copyright 2015 Red Hat 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... | blrm/openshift-tools | scripts/monitoring/cron-send-filesystem-metrics.py | Python | apache-2.0 | 5,045 | 0.006938 |
# Copyright 2018 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 applic... | tensorflow/io | tests/test_dicom.py | Python | apache-2.0 | 7,159 | 0.000559 |
# test driver to verify that new version of code works
import opiniongame.config as og_cfg
import opiniongame.IO as og_io
import opiniongame.coupling as og_coupling
import opiniongame.state as og_state
import opiniongame.opinions as og_opinions
import opiniongame.adjacency as og_adj
import opiniongame.selection as og_s... | mjsottile/PyOpinionGame | driver_alpha_tau_study.py | Python | gpl-3.0 | 2,715 | 0.003315 |
#!/usr/bin/env python
# ----------------------------------------------------------------------------
# Copyright 2014 Nervana Systems 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
#
# ... | kfoss/neon | neon/backends/tests/test_cc2_tensor.py | Python | apache-2.0 | 3,502 | 0 |
import lxml
import requests
def requests_session():
"""
Get a suitable requests session for use in SmartBot.
In particular, this sets the `User-Agent` header to the value of
'SmartBot'.
"""
session = requests.Session()
session.headers.update({"User-Agent": "SmartBot"})
return session
... | thomasleese/smartbot-old | smartbot/utils/web.py | Python | mit | 1,353 | 0 |
#-*- coding: utf-8 -*-
#+---------------------------------------------------------------------------+
#| 01001110 01100101 01110100 01111010 01101111 01100010 |
#| |
#| Netzob : Inferring communication protocols... | lootr/netzob | netzob/src/netzob/Model/Vocabulary/Domain/Parser/VariableParserPath.py | Python | gpl-3.0 | 5,916 | 0.007277 |
"""
homeassistant.config
~~~~~~~~~~~~~~~~~~~~
Module to help with parsing and generating configuration files.
"""
import logging
import os
from homeassistant.exceptions import HomeAssistantError
from homeassistant.const import (
CONF_LATITUDE, CONF_LONGITUDE, CONF_TEMPERATURE_UNIT, CONF_NAME,
CONF_TIME_ZONE)
... | alexkolar/home-assistant | homeassistant/config.py | Python | mit | 5,349 | 0 |
from namespace_class import *
try:
p = Private1()
error = 1
except:
error = 0
if (error):
raise RuntimeError, "Private1 is private"
try:
p = Private2()
error = 1
except:
error = 0
if (error):
raise RuntimeError, "Private2 is private"
EulerT3D.toFrame(1,1,1)
b = BooT_i()
b = BooT_H()
f = FooT_i()... | jrversteegh/softsailor | deps/swig-2.0.4/Examples/test-suite/python/namespace_class_runme.py | Python | gpl-3.0 | 379 | 0.036939 |
"""
Django settings for BenHoboCo project.
For more information on this file, see
https://docs.djangoproject.com/en/1.6/topics/settings/
For the full list of settings and their values, see
https://docs.djangoproject.com/en/1.6/ref/settings/
"""
# Build paths inside the project like this: os.path.join(BASE_DIR, ...)
... | tpolasek/cmput410-project | BenHoboCo/BenHoboCo/settings.py | Python | gpl-2.0 | 2,810 | 0.003559 |
# -*- coding: utf-8 -*-
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('rdrf', '0022_merge'),
]
operations = [
migrations.AddField(
model_name='rdrfcontext',
name='context_form_group',
field=models.F... | muccg/rdrf | rdrf/rdrf/migrations/0023_rdrfcontext_context_form_group.py | Python | agpl-3.0 | 534 | 0 |
# -*- coding: utf8 -*-
# SDAPS - Scripts for data acquisition with paper based surveys
# Copyright(C) 2008, Christoph Simon <post@christoph-simon.eu>
# Copyright(C) 2008, Benjamin Berg <benjamin@sipsolutions.net>
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU Ge... | rodrigosurita/GDAd | sdaps/model/sheet.py | Python | gpl-3.0 | 1,971 | 0.001522 |
# -*- coding: utf-8 -*-
"""
**********************
Minimum Dominating Set
**********************
A dominating set for a graph G = (V, E) is a subset D of V such that every
vertex not in D is joined to at least one member of D by some edge. The
domination number gamma(G) is the number of vertices in a smallest dominat... | devs1991/test_edx_docmode | venv/lib/python2.7/site-packages/networkx/algorithms/approximation/dominating_set.py | Python | agpl-3.0 | 2,985 | 0.00067 |
#!/usr/bin/env python3
# https://www.hackerrank.com/challenges/class-2-find-the-torsional-angle
import io
import math
import sys
import unittest
class Vector:
def __init__(self, x, y, z):
self.x = x
self.y = y
self.z = z
def subtract(self, other):
x = self.x - other.x
... | altermarkive/Coding-Interviews | algorithm-design/hackerrank/class_2_find_the_torsional_angle/test_class_2_find_the_torsional_angle.py | Python | mit | 2,023 | 0 |
# Author: Marcin Serwach
# https://github.com/iblis-ms/conan_gbenchmark
from conans import ConanFile, CMake, tools
import os
import sys
import shutil
class GbenchmarkConan(ConanFile):
name = 'GBenchmark'
version = '1.3.0'
license = 'MIT Licence'
url = 'https://github.com/iblis-ms/conan_gbenchmark'
... | iblis-ms/conan_gbenchmark | conanfile.py | Python | mit | 2,604 | 0.006528 |
# -*- coding: utf-8 -*-
# Define here the models for your scraped items
#
# See documentation in:
# http://doc.scrapy.org/en/latest/topics/items.html
import scrapy
class HackernewsscraperItem(scrapy.Item):
# define the fields for your item here like:
title = scrapy.Field()
link = scrapy.Field()
| svram/fun-with-advanced-python | hackerNewsScraper/hackerNewsScraper/items.py | Python | gpl-3.0 | 317 | 0.003155 |
from django import forms
from .models import doctor
class ContactForm(forms.Form):
message = forms.CharField()
class SignUpForm(forms.ModelForm):
class Meta:
model = doctor
fields = ['full_name', 'email']
class areaForm(forms.Form):
messag = forms.CharField(required=False)
| quit9to5/Next | patient_management/doctor/forms.py | Python | gpl-2.0 | 308 | 0.00974 |
import os
from segments import Segment, theme
from utils import colors, glyphs
class CurrentDir(Segment):
bg = colors.background(theme.CURRENTDIR_BG)
fg = colors.foreground(theme.CURRENTDIR_FG)
def init(self, cwd):
home = os.path.expanduser('~')
self.text = cwd.replace(home, '~')
class... | nimiq/promptastic | segments/filesystem.py | Python | apache-2.0 | 916 | 0.001092 |
import os
import sys
from .interfaces import Interface
from .search import SearchManager
from .cache import CacheManager
from .select import Select
from .help import Inspector
from .users import Users
from .packages import Packages
| BrainIntensive/OnlineBrainIntensive | resources/HCP/pyxnat/pyxnat/core/__init__.py | Python | mit | 233 | 0 |
# Copyright 2016 Google LLC
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, ... | martbhell/wasthereannhlgamelastnight | src/lib/google/auth/crypt/_python_rsa.py | Python | mit | 5,973 | 0.001005 |
# coding: utf-8
import numpy as np
from common.functions import *
from common.util import im2col, col2im
class Relu:
def __init__(self):
self.mask = None
def forward(self, x):
self.mask = (x <= 0)
out = x.copy()
out[self.mask] = 0
return out
def backward(self, do... | Takasudo/studyPython | deep/common/layers.py | Python | gpl-3.0 | 7,810 | 0.00516 |
from setuptools import setup, find_packages
import os
version = '0.5'
setup(name='uwosh.emergency.master',
version=version,
description="",
long_description=open("README.txt").read() + "\n" +
open(os.path.join("docs", "HISTORY.txt")).read(),
# Get more strings from http:... | uwosh/uwosh.emergency.master | setup.py | Python | gpl-2.0 | 1,123 | 0.002671 |
__author__ = 'harsha'
class ForceReply(object):
def __init__(self, force_reply, selective):
self.force_reply = force_reply
self.selective = selective
def get_force_reply(self):
return self.force_reply
def get_selective(self):
return self.selective
def __str__(self):
... | harsha5500/pytelegrambot | telegram/ForceReply.py | Python | gpl-3.0 | 353 | 0.005666 |
# Copyright (c) 2014-2016, NVIDIA CORPORATION. All rights reserved.
from __future__ import absolute_import
from . import caffe_train
from digits import test_utils
def test_caffe_imports():
test_utils.skipIfNotFramework('caffe')
import numpy
import google.protobuf
| TimZaman/DIGITS | digits/model/tasks/test_caffe_train.py | Python | bsd-3-clause | 281 | 0.007117 |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
#
# agnez documentation build configuration file, created by
# sphinx-quickstart on Tue Jul 9 22:26:36 2013.
#
# This file is execfile()d with the current directory set to its
# containing dir.
#
# Note that not all possible configuration values are present in this
# autog... | EderSantana/agnez | docs/conf.py | Python | bsd-3-clause | 8,361 | 0.005382 |
#!/usr/bin/python
# -*- coding: utf-8 -*-
"""
Script to upload images to wikipedia.
Arguments:
-keep Keep the filename as is
-filename Target filename without the namespace prefix
-noverify Do not ask for verification of the upload description if one
is given
-abortonwarn: Abor... | eranroz/hewiktionary_checker | upload.py | Python | mit | 8,269 | 0.000605 |
from time import sleep
from os.path import join
import pytest
from cosmo_tester.framework.examples import get_example_deployment
from cosmo_tester.framework.test_hosts import Hosts, VM
from cosmo_tester.test_suites.snapshots import (
create_snapshot,
download_snapshot,
restore_snapshot,
upload_snapsho... | cloudify-cosmo/cloudify-system-tests | cosmo_tester/test_suites/snapshots/inplace_restore_test.py | Python | apache-2.0 | 3,573 | 0 |
from pathlib import Path
import re
from setuptools import setup
setup_dir = Path(__file__).resolve().parent
version = re.search(
r'__version__ = "(.*)"',
Path(setup_dir, 'tldr.py').open().read()
)
if version is None:
raise SystemExit("Could not determine version to use")
version = version.group(1)
with op... | tldr-pages/tldr-python-client | setup.py | Python | mit | 1,805 | 0 |
import unittest
import sys
sys.path.insert(0, "..")
from sections.sections import Circle
import test_sections_generic as generic
class TestPhysicalProperties(generic.TestPhysicalProperties, unittest.TestCase):
@classmethod
def setUpClass(cls):
cls.sectclass = Circle
cls.dimensions = dic... | iamlikeme/sections | tests/test_sections_Circle.py | Python | mit | 810 | 0.020988 |
"""API integration tests factories."""
import factory
from django_common.auth_backends import User
from factory.django import DjangoModelFactory
from samaritan.models import Address, ChurchRole, MembershipType, ChurchGroup, Member
class UserFactory(DjangoModelFactory):
"""Factory for users."""
username = f... | Silvian/samaritan | api/tests/integration/__init__.py | Python | gpl-3.0 | 2,353 | 0.00085 |
"""ユーザー設定用モジュール."""
import os
DEBUG = True
BASE_DIR = os.path.dirname(os.path.dirname(os.path.abspath(__file__)))
INSTALLED_APPS = [
'app1',
'app2',
]
ROOT_URLCONF = 'project.urls'
WSGI_APPLICATION = [
# 'wsgiref.validate.validator',
'ngo.wsgi.RedirectApp',
'ngo.wsgi.WSGIHandle... | naritotakizawa/ngo | tests/project2/project/settings.py | Python | mit | 941 | 0 |
# jhbuild - a tool to ease building collections of source packages
# Copyright (C) 2011 Colin Walters <walters@verbum.org>
#
# systeminstall.py - Use system-specific means to acquire dependencies
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public L... | ahmeier/jhbuild | jhbuild/utils/systeminstall.py | Python | gpl-2.0 | 14,543 | 0.002888 |
# Copyright (c) 2018 PaddlePaddle 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 app... | chengduoZH/Paddle | python/paddle/fluid/tests/unittests/test_sampling_id_op.py | Python | apache-2.0 | 2,626 | 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... | ctrlaltdel/neutrinator | vendor/keystoneauth1/tests/unit/k2k_fixtures.py | Python | gpl-3.0 | 5,454 | 0 |
# https://codecombat.com/play/level/if-stravaganza?
#
# Debes Comprar & Equipar:
# 1. Reloj de Pulsera Simple
# 2. Programática II
#
# ¡Derrota a los ogros desde dentro de su propio campamento!
while True:
enemy = hero.findNearestEnemy()
# Usa la sentencia if para comprobar si existe un enemigo
# Ataca al ... | inukaze/maestro | Solución/CodeCombat/Python/2.Bosque_Aislado/005 - If-stravaganza.py | Python | gpl-2.0 | 386 | 0.002604 |
# Rekall Memory Forensics
# Copyright 2016 Google Inc. All Rights Reserved.
#
# 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 ver... | google/rekall | rekall-core/rekall/plugins/response/forensic_artifacts.py | Python | gpl-2.0 | 37,683 | 0.001115 |
import sys
try:
from gensim.models.word2vec_inner import FAST_VERSION
print('FAST_VERSION ok ! Retrieved with value ', FAST_VERSION)
sys.exit()
except ImportError:
print('Failed... fall back to plain numpy (20-80x slower training than the above)')
sys.exit(-1)
| summanlp/gensim | docker/check_fast_version.py | Python | lgpl-2.1 | 283 | 0.003534 |
# usr/bin/env python
# -*- coding: utf-8 -*-
"""
Created on Thu Jul 20 13:15:05 2017
@author: Vijayasai S
"""
# Use python3
from haversine import distance
from datetime import datetime
from dateutil import tz
import my_dbscan as mydb
import alert_update as au
from pymongo import MongoClient
import pandas as pd
im... | Vijaysai005/KProject | vijay/DBSCAN/clustering/db/generate_data.py | Python | gpl-3.0 | 5,801 | 0.038786 |
# © 2019 ForgeFlow S.L.
# © 2019 Serpent Consulting Services Pvt. Ltd.
# License LGPL-3.0 or later (https://www.gnu.org/licenses/lgpl.html).
from odoo import _, api, fields, models
from odoo.exceptions import UserError
class StockWarehouse(models.Model):
_inherit = "stock.warehouse"
def _default_operating_un... | OCA/operating-unit | stock_operating_unit/model/stock_warehouse.py | Python | agpl-3.0 | 2,156 | 0.000464 |
"""Support for RainMachine devices."""
import asyncio
import logging
from datetime import timedelta
import voluptuous as vol
from homeassistant.config_entries import SOURCE_IMPORT
from homeassistant.const import (
ATTR_ATTRIBUTION, CONF_BINARY_SENSORS, CONF_IP_ADDRESS, CONF_PASSWORD,
CONF_PORT, CONF_SCAN_INTE... | DavidLP/home-assistant | homeassistant/components/rainmachine/__init__.py | Python | apache-2.0 | 14,628 | 0 |
import unittest
import os
import os.path
import json
# The folder holding the test data
data_path = os.path.dirname(__file__)
# Set the temporal config for testing
os.environ['TIMEVIS_CONFIG'] = os.path.join(data_path, 'config.py')
import timevis
class TestExperiment(unittest.TestCase):
def setUp(self):
... | gaoce/TimeVis | tests/test_api.py | Python | mit | 1,185 | 0.001688 |
# -*- coding: utf-8 -*-
# Resource object code
#
# Created: Sun 21. Feb 22:22:07 2016
# by: The Resource Compiler for PyQt (Qt v4.8.5)
#
# WARNING! All changes made in this file will be lost!
from PyQt4 import QtCore
qt_resource_data = "\
\x00\x00\x02\xf9\
\x89\
\x50\x4e\x47\x0d\x0a\x1a\x0a\x00\x00\x00\x0d\x49\... | rjspiers/qgis-batch-save-layers | resources.py | Python | gpl-2.0 | 4,288 | 0.001166 |
# ----------------------------------------------------------------------------------
# Electrum plugin for the Digital Bitbox hardware wallet by Shift Devices AG
# digitalbitbox.com
#
try:
import electrum_arg as electrum
from electrum_arg.bitcoin import TYPE_ADDRESS, var_int, msg_magic, Hash, verify_message, p... | argentumproject/electrum-arg | plugins/digitalbitbox/digitalbitbox.py | Python | mit | 20,399 | 0.008285 |
__author__ = 'dimitris'
import os
# Flask Configuration
basedir = os.path.abspath(os.path.dirname(__file__))
SECRET_KEY = 'knaskndfknasdfiaosifoaignaosdnfoasodfnaodgnas'
PREFERRED_URL_SCHEME = 'https'
#SqlAlchemy Configuration
DB_NAME = 'puzzles.db'
SQLALCHEMY_DATABASE_URI = 'sqlite:///' + os.path.join(basedir, DB_N... | gdimitris/ChessPuzzlerBackend | Application/app_configuration.py | Python | mit | 368 | 0.008152 |
#!/usr/bin/env python
# -*- coding: UTF-8 -*-
from setuptools import setup
from glob import glob
classifiers = [
'Development Status :: 4 - Beta',
'Intended Audience :: Science/Research',
'License :: OSI Approved :: BSD License',
'Programming Language :: Python',
'Programming Language :: Python ::... | fidelram/goatools | setup.py | Python | bsd-2-clause | 889 | 0 |
from StringIO import StringIO
import textwrap
import importer
def test_import_csv():
current = StringIO(textwrap.dedent('''\
status,qty,type,transaction_date,posting_date,description,amount
A,,,2016/11/02,,This is a test,$4.53
'''))
new = StringIO(textwrap.dedent('''\
... | kalafut/go-ledger | importer_test.py | Python | mit | 1,021 | 0.001959 |
# -*- coding: utf-8 -*-
##############################################################################
#
# OpenERP, Open Source Management Solution
# Copyright (C) 2004-2010 Tiny SPRL (<http://tiny.be>).
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU... | CubicERP/odoo | addons/product/product.py | Python | agpl-3.0 | 67,910 | 0.006685 |
#!/usr/bin/env python
import sys
from weather import Weather
def main(args):
weather = Weather()
location = weather.lookup_by_location(args[1])
condition = location.forecast()[0]
if condition:
return condition['text'] + ' with high of ' + condition['high'] + ' and low of ' + condition['low']
else:
return "C... | Daniel-Hoerauf/group-assistant | assistant/weatherTest.py | Python | gpl-3.0 | 433 | 0.027714 |
# -*- coding: utf-8 -*-
# This file is part of Shuup.
#
# Copyright (c) 2012-2017, Shoop Commerce Ltd. All rights reserved.
#
# This source code is licensed under the OSL-3.0 license found in the
# LICENSE file in the root directory of this source tree.
from django.http import HttpResponseRedirect
from shuup import co... | suutari-ai/shoop | shuup/front/views/misc.py | Python | agpl-3.0 | 730 | 0 |
import sys
from collections import deque
from Catalog.Schema import DBSchema
from Query.Operators.TableScan import TableScan
from Query.Operators.Select import Select
from Query.Operators.Project import Project
from Query.Operators.Union import Union
from Query.Operators.Join import Join
from Query.Ope... | yliu120/dbsystem | HW2/dbsys-hw2/Query/Plan.py | Python | apache-2.0 | 10,860 | 0.01105 |
import streamcorpus as sc
import cuttsum.events
import cuttsum.corpora
from cuttsum.trecdata import SCChunkResource
from cuttsum.pipeline import ArticlesResource, DedupedArticlesResource
import os
import pandas as pd
from datetime import datetime
from collections import defaultdict
import matplotlib.pylab as plt
plt.st... | kedz/cuttsum | trec2015/sbin/reports/raw-stream-count.py | Python | apache-2.0 | 7,738 | 0.005557 |
from flask import session
from appconfig import *
class UserModel:
def __init__(self):
from models import Tag
from models import Post
from models import User
self.Tag = Tag.Tag
self.Post = Post.Post
self.User = User.User
def login(self, email, password):
... | goors/flask-microblog | UserModel.py | Python | apache-2.0 | 2,758 | 0.005801 |
# -*- coding: utf-8 -*-
#
# Copyright © 2012 - 2017 Michal Čihař <michal@cihar.com>
#
# This file is part of Weblate <https://weblate.org/>
#
# 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, eith... | lem9/weblate | weblate/accounts/captcha.py | Python | gpl-3.0 | 4,975 | 0 |
#!/usr/bin/env python
# Licensed to Cloudera, Inc. under one
# or more contributor license agreements. See the NOTICE file
# distributed with this work for additional information
# regarding copyright ownership. Cloudera, Inc. licenses this file
# to you under the Apache License, Version 2.0 (the
# "License"); you ma... | hortonworks/hortonworks-sandbox | apps/help/src/help/tests.py | Python | apache-2.0 | 1,364 | 0.008065 |
import os
from flask import Flask, request, g
from flask_sqlalchemy import SQLAlchemy
from .decorators import json
db = SQLAlchemy()
def create_app(config_name):
""" Create the usual Flask application instance."""
app = Flask(__name__)
# Apply configuration
cfg = os.path.join(os.getcwd(), 'config', ... | andela-akhenda/maisha-goals | app/__init__.py | Python | mit | 1,333 | 0 |
from com.googlecode.fascinator.api.indexer import SearchRequest
from com.googlecode.fascinator.common.solr import SolrResult
from com.googlecode.fascinator.spring import ApplicationContextProvider
from java.io import ByteArrayInputStream, ByteArrayOutputStream
class MaintenanceData:
def __init__(self):
pas... | the-fascinator/fascinator-portal | src/main/config/portal/default/default/scripts/maintenance.py | Python | gpl-2.0 | 729 | 0.005487 |
#!/usr/bin/python
# Copyright (c) 2009, Purdue University
# 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 copyright notice, this
# list ... | stephenlienharrell/roster-dns-management | test/credentials_test.py | Python | bsd-3-clause | 4,275 | 0.010526 |
# Generated by Django 2.0.1 on 2018-01-21 14:23
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('test_app', '0016_add_filepath'),
]
operations = [
migrations.AddField(
model_name='secondobject',
name='floating',
... | David-Wobrock/django-fake-database-backends | tests/test_project/test_app/migrations/0017_add_float.py | Python | mit | 386 | 0 |
# -*- coding: utf-8 -*-
#
# CoderDojo Twin Cities Python for Minecraft documentation build configuration file, created by
# sphinx-quickstart on Fri Oct 24 00:52:04 2014.
#
# This file is execfile()d with the current directory set to its
# containing dir.
#
# Note that not all possible configuration values are present ... | CoderDojoTC/python-minecraft | docs/conf.py | Python | mit | 8,611 | 0.006503 |
from django.conf.urls import patterns, url
from .views import PhotoListView
urlpatterns = patterns('',
url(r'^(?P<slug>[\w-]+)/$', PhotoListView.as_view(), name='image'),
) | mailfish/helena | gallery/urls.py | Python | apache-2.0 | 197 | 0.015228 |
# -*- coding: utf-8 -*-
"""
Default Controllers
@author: Fran Boon
"""
module = "default"
# Options Menu (available in all Functions)
#response.menu_options = [
#[T("About Sahana"), False, URL(r=request, f="about")],
#]
def call():
"Call an XMLRPC, JSONRPC or RSS service"
# If webservices don't... | sinsai/Sahana_eden | controllers/default.py | Python | mit | 13,802 | 0.007245 |
from odoo import models, fields, api, _
from odoo.exceptions import ValidationError
from datetime import datetime
class StockScheduleWizard(models.TransientModel):
_name = "stock.schedule.wizard"
scheduled_date = fields.Datetime('Scheduled shipping date')
@api.multi
def action_button_schedule(self)... | Comunitea/CMNT_004_15 | project-addons/scheduled_shipment/wizard/schedule_wizard.py | Python | agpl-3.0 | 1,376 | 0.011628 |
#Copyright 2013 Paul Barton
#
#This program is free software: you can redistribute it and/or modify
#it under the terms of the GNU General Public License as published by
#the Free Software Foundation, either version 3 of the License, or
#(at your option) any later version.
#
#This program is distributed in the hope tha... | Sebelino/PyUserInput | pymouse/mac.py | Python | lgpl-3.0 | 5,547 | 0.003966 |
# Copyright (C)
#
# Author :
from GIC.Channels.GenericChannel import *
class ChannelTest (GenericChannel):
# mandatory fields to work on LibreGeoSocial search engine
MANDATORY_FIELDS = ["latitude", "longitude", "radius", "category"]
CATEGORIES = [{"id" : "0", "name" : "all", "desc" : "All supported ... | kgblll/libresoft-gymkhana | libs/ChannelTemplate.py | Python | gpl-2.0 | 822 | 0.06691 |
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.db import models, migrations
class Migration(migrations.Migration):
dependencies = [
('dataset', '0009_remove_selection_model'),
]
operations = [
migrations.AlterField(
model_name='dataset',
... | michaelbrooks/uw-message-coding | message_coding/apps/dataset/migrations/0010_auto_20150619_2106.py | Python | mit | 419 | 0 |
# coding=utf-8
# --------------------------------------------------------------------------
# Copyright (c) Microsoft Corporation. All rights reserved.
# Licensed under the MIT License. See License.txt in the project root for license information.
# Code generated by Microsoft (R) AutoRest Code Generator.
# Changes may ... | Azure/azure-sdk-for-python | sdk/videoanalyzer/azure-mgmt-videoanalyzer/azure/mgmt/videoanalyzer/_version.py | Python | mit | 488 | 0.004098 |
import copy
import glob
import fnmatch
import os
import logging
import yaml
log = logging.getLogger("subiquitycore.netplan")
def _sanitize_inteface_config(iface_config):
for ap, ap_config in iface_config.get('access-points', {}).items():
if 'password' in ap_config:
ap_config['password'] = '<R... | CanonicalLtd/subiquity | subiquitycore/netplan.py | Python | agpl-3.0 | 5,471 | 0 |
from __future__ import print_function
#from collections import defaultdict
#from functools import reduce
from six import iteritems, string_types, PY2
#from six.moves import zip, range
import numpy as np
from numpy import (array, unique, arange, searchsorted,
setdiff1d, intersect1d, asarray)
from ... | saullocastro/pyNastran | pyNastran/bdf/mesh_utils/bdf_equivalence.py | Python | lgpl-3.0 | 12,362 | 0.003074 |
#
# THIS FILE WAS AUTOGENERATED BY makeSip6.py
# Do not edit this file manually. All changes will be lost.
#
"""
# TOP2049 Open Source programming suite
#
# Microchip PIC24f08kl201 SIP6
#
# Copyright (c) 2014 Pavel Stemberk <stemberk@gmail.com>
#
# This program is free software; you can redistribute it and/... | mbuesch/toprammer | libtoprammer/chips/microchip16/pic24f08kl201sip6.py | Python | gpl-2.0 | 2,151 | 0.034868 |
#!/usr/bin/env python
'''
Created on 18 gru 2014
@author: ghalajko
'''
from lvstop.screen import Screen
from lvstop import loop
if __name__ == '__main__':
with Screen() as scr:
try:
scr.main_loop(loop)
except KeyboardInterrupt:
pass
except:
... | cybermaniax/lvstop | src/main/python/ipvstop.py | Python | apache-2.0 | 332 | 0.009036 |
#!/usr/bin/env python3
# Questo file visualizza la chiave "lists" redis
#
# Prima verifica che ci sia la chiave nel form
# Serve per la parte di gestione html in python
import cgi
import cgitb
# Abilita gli errori al server web/http
cgitb.enable()
# Le mie librerie mjl (Json, Files), mhl (Html), flt (T w/ Redis)
im... | raspibo/Livello1 | var/www/cgi-bin/writecsvlistsetsredis.py | Python | mit | 1,795 | 0.018942 |
#!/usr/bin/env python
description = ">> make final magnitude"
usage = "%prog image [options] "
import os
import string
import re
import sys
from optparse import OptionParser
import time
import math
import agnkey
import numpy as np
if __name__ == "__main__":
start_time = time.time()
parser = OptionParser(usag... | svalenti/agnkey | trunk/bin/agnmag.py | Python | mit | 19,750 | 0.005266 |
"""
Model to hold edx-video-pipeline configurations.
"""
from __future__ import absolute_import
from config_models.models import ConfigurationModel
from django.contrib.auth import get_user_model
from django.db import models
from django.utils.translation import ugettext_lazy as _
from opaque_keys.edx.django.models impor... | jolyonb/edx-platform | openedx/core/djangoapps/video_pipeline/models.py | Python | agpl-3.0 | 3,579 | 0.001397 |
"""
Django settings for SimpleMooc project.
For more information on this file, see
https://docs.djangoproject.com/en/1.6/topics/settings/
For the full list of settings and their values, see
https://docs.djangoproject.com/en/1.6/ref/settings/
"""
# Build paths inside the project like this: os.path.join(BASE_DIR, ...)... | andersondss/LearningDjango | udemy/SimpleMooc/SimpleMooc/settings.py | Python | mit | 3,174 | 0.000315 |
"""
This module is used to generate graphs that show the interaction between authors either through multiple edges or
through edge weights. There is an edge from one author to another if the former sent a message to the latter. These
graphs depict thread-wise interaction of the authors for the entire mailing list and t... | yashpungaliya/MailingListParser | lib/analysis/author/graph/interaction.py | Python | gpl-3.0 | 7,719 | 0.003627 |
#!/usr/bin/python
# encoding: utf-8
import sys
from gist import create_workflow, set_github_token
from workflow import Workflow, web
from workflow.background import run_in_background, is_running
def main(wf):
arg = wf.args[0]
if len(arg) > 0:
token = wf.args[0]
set_github_token(wf, token)
i... | danielecook/gist-alfred | set_info.py | Python | mit | 400 | 0 |
"""scons.Node.Alias
Alias nodes.
This creates a hash of global Aliases (dummy targets).
"""
#
# Copyright (c) 2001 - 2014 The SCons Foundation
#
# 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 So... | dezelin/scons | scons-local/SCons/Node/Alias.py | Python | mit | 4,197 | 0.001906 |
def f(x):
"""
Returns
-------
object
"""
return 42 | smmribeiro/intellij-community | python/testData/intentions/returnTypeInNewNumpyDocString_after.py | Python | apache-2.0 | 75 | 0.013333 |
# coding: utf-8
from __future__ import unicode_literals
import re
from .common import InfoExtractor
from ..utils import (
clean_html,
int_or_none,
js_to_json,
parse_iso8601,
)
class NetzkinoIE(InfoExtractor):
_VALID_URL = r'https?://(?:www\.)?netzkino\.de/\#!/(?P<category>[^/]+)/(?P<id>[^/]+)'
_TEST = {
'u... | valmynd/MediaFetcher | src/plugins/youtube_dl/youtube_dl/extractor/netzkino.py | Python | gpl-3.0 | 2,537 | 0.028774 |
"""Auto-generated file, do not edit by hand. BL metadata"""
from ..phonemetadata import NumberFormat, PhoneNumberDesc, PhoneMetadata
PHONE_METADATA_BL = PhoneMetadata(id='BL', country_code=590, international_prefix='00',
general_desc=PhoneNumberDesc(national_number_pattern='(?:590|(?:69|80)\\d|976)\\d{6}', possibl... | daviddrysdale/python-phonenumbers | python/phonenumbers/data/region_BL.py | Python | apache-2.0 | 959 | 0.007299 |
# Copyright 2014: Intel 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 a... | pandeyop/rally | tests/unit/benchmark/scenarios/neutron/test_network.py | Python | apache-2.0 | 24,839 | 0 |
# coding: utf-8
"""
Copyright 2015 SmartBear Software
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... | jlongever/redfish-client-python | on_http_redfish_1_0/models/chassis_1_0_0_chassis_actions.py | Python | apache-2.0 | 3,731 | 0.001072 |
###############################################################################
# This file is part of openWNS (open Wireless Network Simulator)
# _____________________________________________________________________________
#
# Copyright (C) 2004-2007
# Chair of Communication Networks (ComNets)
# Kopernikusstr. 16, D-... | creasyw/IMTAphy | wnsbase/playground/builtins/__init__.py | Python | gpl-2.0 | 1,457 | 0.00755 |
# ----------------------------------------------------------------------------
# Copyright (c) 2013--, scikit-bio development team.
#
# Distributed under the terms of the Modified BSD License.
#
# The full license is in the file COPYING.txt, distributed with this software.
# --------------------------------------------... | colinbrislawn/scikit-bio | skbio/sequence/tests/test_sequence.py | Python | bsd-3-clause | 113,531 | 0.000352 |
# Copyright (C) 2011 Jeremy S. Sanders
# Email: Jeremy Sanders <jeremy@jeremysanders.net>
#
# 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
# ... | KDB2/veusz | veusz/document/export.py | Python | gpl-2.0 | 15,098 | 0.002384 |
"""This module provides REST services for Layers"""
import cherrypy
from LmCommon.common.lmconstants import HTTPStatus
from LmWebServer.common.lmconstants import HTTPMethod
from LmWebServer.services.api.v2.base import LmService
from LmWebServer.services.common.access_control import check_user_permission
from LmWebServ... | lifemapper/core | LmWebServer/services/api/v2/layer.py | Python | gpl-3.0 | 9,222 | 0 |
from unittest import skipIf
from django.conf import settings
def skipIfDefaultUser(test_func):
"""
Skip a test if a default user model is in use.
"""
return skipIf(settings.AUTH_USER_MODEL == "auth.User", "Default user model in use")(
test_func
)
def skipIfCustomUser(test_func):
"""... | yunojuno/django-request-profiler | tests/utils.py | Python | mit | 491 | 0.004073 |
""" Tests for OAuth Dispatch python API module. """
import unittest
from django.conf import settings
from django.http import HttpRequest
from django.test import TestCase
from oauth2_provider.models import AccessToken
from common.djangoapps.student.tests.factories import UserFactory
OAUTH_PROVIDER_ENABLED = setting... | eduNEXT/edx-platform | openedx/core/djangoapps/oauth_dispatch/tests/test_api.py | Python | agpl-3.0 | 2,669 | 0.003372 |
# encoding: utf8
from __future__ import unicode_literals
from ..symbols import *
TAG_MAP = {
# Explanation of Unidic tags:
# https://www.gavo.t.u-tokyo.ac.jp/~mine/japanese/nlp+slp/UNIDIC_manual.pdf
# Universal Dependencies Mapping:
# http://universaldependencies.org/ja/overview/morphology.html
#... | raphael0202/spaCy | spacy/ja/tag_map.py | Python | mit | 4,024 | 0.03466 |
from unittest import TestCase
from pyrake.contrib.spidermiddleware.urllength import UrlLengthMiddleware
from pyrake.http import Response, Request
from pyrake.spider import Spider
class TestUrlLengthMiddleware(TestCase):
def test_process_spider_output(self):
res = Response('http://pyraketest.org')
... | elkingtowa/pyrake | tests/test_spidermiddleware_urllength.py | Python | mit | 685 | 0.00146 |
#!/usr/bin/python2.5
#
# Copyright 2009 the Melange 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... | jamslevy/gsoc | app/soc/models/priority_group.py | Python | apache-2.0 | 1,130 | 0.004425 |
# -*- coding: utf-8 -*-
#
# metasci documentation build configuration file, created by
# sphinx-quickstart on Sun Feb 7 22:29:49 2010.
#
# This file is execfile()d with the current directory set to its containing dir.
#
# Note that not all possible configuration values are present in this
# autogenerated file.
#
# All... | samuelshaner/openmc | docs/source/conf.py | Python | mit | 7,909 | 0.006448 |
import json
import shakedown
import dcos
from dcos import marathon
from enum import Enum
from tests.command import (
cassandra_api_url,
spin,
WAIT_TIME_IN_SECONDS
)
class PlanState(Enum):
ERROR = "ERROR"
WAITING = "WAITING"
PENDING = "PENDING"
IN_PROGRESS = "IN_PROGRESS"
COMPLETE = "C... | adobe-mds/dcos-cassandra-service | integration/tests/infinity_commons.py | Python | apache-2.0 | 1,791 | 0.002233 |
# Author: Martin Oehler <oehler@knopper.net> 2013
# License: GPL V2
from django.forms import ModelForm
from django.forms import Form
from django.forms import ModelChoiceField
from django.forms.widgets import RadioSelect
from django.forms.widgets import CheckboxSelectMultiple
from django.forms.widgets import TextInput... | MartinOehler/LINBO-ServerGUI | linboweb/linboserver/forms.py | Python | gpl-2.0 | 1,587 | 0.006931 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.