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 | prefix stringlengths 0 8.16k | middle stringlengths 3 512 | suffix stringlengths 0 8.17k |
|---|---|---|---|---|---|---|---|---|
endlessm/chromium-browser | third_party/llvm/lldb/test/API/commands/command/script/import/rdar-12586188/fail212586188.py | Python | bsd-3-clause | 77 | 0.012987 | def f(x):
return x + 1
raise ValueErr | or("I do not want to be imported")
| |
hrashk/sympy | sympy/printing/codeprinter.py | Python | bsd-3-clause | 9,879 | 0.001417 | 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):
"""
... | ors['and']).join(self.parenthesize(a, PREC)
for a in sorted(expr.args, key=default_sort_key))
def _print_Or(self, expr):
PREC = precedence(expr)
return (" %s " % self._operators['or']).join(self.parenthesize(a, PREC)
for a in sorted(expr.args, key=default_sort_key))
... | )
PREC = precedence(expr)
return (" %s " % self._operators['xor']).join(self.parenthesize(a, PREC)
for a in expr.args)
def _print_Equivalent(self, expr):
if self._operators.get('equivalent') is None:
return self._print_not_supported(expr)
PREC = precedenc... |
ajdelgados/Sofia | modules/main.py | Python | gpl-3.0 | 37,233 | 0.010102 | #!/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__(... | voHelp[ID_MENU_HELP_LOG]))
self.menuHelp.Enable(ID_MENU_HELP_LOG, False)
self.menuHelp.AppendSeparator()
self.menuHelp.Append(ID_MENU_HELP_ACERCA_DE, self.translation(ar | chivo[ID_MENU_HELP_ACERCA_DE]), self.translation(archivoHelp[ID_MENU_HELP_ACERCA_DE]))
#--Se adicionan los menues a la barra de menu--#
self.menuBar = wx.MenuBar()
self.menuBar.Append(self.menuFile, self.translation(menuBar[0]))
self.menuBar.Append(self.menuVer, self.translation(menuBar[1]))
self.menuBa... |
lovetox/gajim | src/search_window.py | Python | gpl-3.0 | 9,270 | 0.003344 | # -*- 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... | counter = 0
for field in obj.data[0].keys():
self.result_treeview.append_column(Gtk.TreeViewColumn(field,
Gtk.CellRendererText(), text=counter))
if field == 'jid':
self.jid_column = counter
counter += 1
s... | (model)
sw.show_all()
self.search_vbox.pack_start(sw, True, True, 0)
if self.jid_column > -1:
self.add_contact_button.show()
self.information_button.show()
return
self.dataform = dataforms.ExtendForm(node=obj.data)
if len(s... |
mjirik/lisa | lisa/shape_model.py | Python | bsd-3-clause | 8,801 | 0.011083 | #! /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... | for x in range(dataShape[0]):
for y in range(dataShape[1]):
for z in range(dataShape[2]):
| xStart = x * voxelySmer[0]
xKonec = xStart + voxelySmer[0]
yStart = y * voxelySmer[1]
yKonec = yStart + voxelySmer[1]
zStart = z * voxelySmer[2]
zKonec = zStart + voxelySmer[2... |
Kemaweyan/django-content-gallery | content_gallery_testapp/testapp/migrations/0002_auto_20170618_1457.py | Python | bsd-3-clause | 475 | 0.002105 | # -*- 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(
model_name='cat',
name='sex',
field=models.CharField(choices=[('F', 'Female'), ('M', 'Male')], max... |
DarioGT/OMS-PluginXML | org.modelsphere.sms/lib/jython-2.2.1/Lib/dospath.py | Python | gpl-3.0 | 10,452 | 0.003062 | """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... | ting to whatever
function is called with the expanded path as argument).
See also module 'glob' for expansion of *, ? and [...] in pathnames.
(A function should also be defined to do full *sh-style envi | ronment
variable expansion.)"""
if path[:1] != '~':
return path
i, n = 1, len(path)
while i < n and path[i] not in '/\\':
i = i+1
if i == 1:
if not os.environ.has_key('HOME'):
return path
userhome = os.environ['HOME']
else:
return... |
blrm/openshift-tools | scripts/monitoring/cron-send-filesystem-metrics.py | Python | apache-2.0 | 5,045 | 0.006938 | #!/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... | odes.pused.')
filtered_filesys_inode_metrics = filter_out_container_root(filtered_filesys_inode_metrics)
if args.filter_pod_pv:
filtered_filesys_inode_metrics = filter_out_customer_pv_filesystems(filtered_filesys_inode_metrics)
i | f args.force_send_zeros:
filtered_filesys_inode_metrics = zero_mount_percentages(filtered_filesys_inode_metrics)
for filesys_name, filesys_inodes in filtered_filesys_inode_metrics.iteritems():
metric_sender.add_metric({'%s[%s]' % (item_prototype_key_inode, filesys_name): filesys_inodes})
metri... |
tensorflow/io | tests/test_dicom.py | Python | apache-2.0 | 7,159 | 0.000559 | # 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... | 32,
on_error="strict",
scale="auto",
color_dim=True,
)
assert dcm_image.numpy().shape == exp_shape
@pytest.mark.parametrize(
"fname, tag, exp_value",
[
(
"OT-MONO2-8-colon.dcm",
tfio.image.dicom_tags.StudyInstanceUID,
b"1.3.46.670589.... | dicom_tags.Rows, b"512"),
("OT-MONO2-8-colon.dcm", tfio.image.dicom_tags.Columns, b"512"),
("OT-MONO2-8-colon.dcm", tfio.image.dicom_tags.SamplesperPixel, b"1"),
(
"US-PAL-8-10x-echo.dcm",
tfio.image.dicom_tags.StudyInstanceUID,
b"999.999.3859744",
),
... |
mjsottile/PyOpinionGame | driver_alpha_tau_study.py | Python | gpl-3.0 | 2,715 | 0.003315 | # 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... | #
tau_list = np.arange(0.45, 0.9, 0.01)
alpha_list = np.arange(0.05, 0.25, 0.01)
numalphas = len(alpha_list)
numtaus = len(tau_list)
numvars = 3
resultMatrix = np.zeros((numalphas, numtaus, numvars))
for (i, alpha) in enumerate(alpha_list):
config.learning_rate = alpha
print("")
for (j, tau) in enumerat... | # functions for use by the simulation engine
#
ufuncs = og_cfg.UserFunctions(og_select.FastPairSelection,
og_stop.totalChangeStop,
og_pot.createTent(tau))
polarized = 0
notPolarized = 0
aveIters = 0
... |
kfoss/neon | neon/backends/tests/test_cc2_tensor.py | Python | apache-2.0 | 3,502 | 0 | #!/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
#
# ... | mport GPUTensor
self.gpt = GPUTensor
def test_empty_creation(self):
tns = self.gpt([])
expected_shape = (0, )
while len(expected_shape) < tns._min_dims:
expected_shape += (1, )
assert tns.shape == expected_shape
def test_1d_creation(self):
tns = self... | ])
expected_shape = (4, )
while len(expected_shape) < tns._min_dims:
expected_shape += (1, )
assert tns.shape == expected_shape
def test_2d_creation(self):
tns = self.gpt([[1, 2], [3, 4]])
expected_shape = (2, 2)
while len(expected_shape) < tns._min_dims:... |
thomasleese/smartbot-old | smartbot/utils/web.py | Python | mit | 1,353 | 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
... | pt IndexError: # no title element
return "No title."
def sprunge(data):
"""Upload the data to `sprunge.us` (a popular plain-text paste bin)."""
payload = {"sprunge": data}
page = requests_session().post("http://sprunge.us", data=payload)
| return page.text
|
lootr/netzob | netzob/src/netzob/Model/Vocabulary/Domain/Parser/VariableParserPath.py | Python | gpl-3.0 | 5,916 | 0.007277 | #-*- coding: utf-8 -*-
#+---------------------------------------------------------------------------+
#| 01001110 01100101 01110100 01111010 01101111 01100010 |
#| |
#| Netzob : Inferring communication protocols... |
#| File contributors : |
#| - Georges Bossert <georges.bossert (a) supelec.fr> |
#| - Frédéric Guihéry <frederic.guihery (a) amossys.fr> |
#+------------------------------------------------ | ---------------------------+
#+---------------------------------------------------------------------------+
#| Standard library imports |
#+---------------------------------------------------------------------------+
import uuid
#+--------------------------------------... |
alexkolar/home-assistant | homeassistant/config.py | Python | mit | 5,349 | 0 | """
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)
... | uration fil | e {}'.format(fname)
_LOGGER.exception(error)
raise HomeAssistantError(error)
def yaml_include(loader, node):
"""
Loads another YAML file and embeds it using the !include tag.
Example:
device_tracker: !include device_tracker.yaml
"""
fname... |
jrversteegh/softsailor | deps/swig-2.0.4/Examples/test-suite/python/namespace_class_runme.py | Python | gpl-3.0 | 379 | 0.036939 | from namespace_class import *
try:
p = Private1()
error = 1
exc | ept:
error = 0
if (error):
raise RuntimeError, "Private1 is private"
t | ry:
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()
f.quack(1)
f = FooT_d()
f.moo(1)
f = FooT_H()
f.foo(Hi)
|
tpolasek/cmput410-project | BenHoboCo/BenHoboCo/settings.py | Python | gpl-2.0 | 2,810 | 0.003559 | """
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, ...)
... | on
# See https://docs.djangoproject.com/en/1.6/howto/deployment/checklist/
# SECURITY WARNING: keep the secret key used in production secret!
SECRET_KEY = 'b&r86v3qyzx=d^8p8k4$c!#imhb+jys*$g@yxz8#vt83@r-va_'
# SECURITY WARNING: don't run with debug turned on in production!
DEBUG = True
TEMPLATE_DEBUG = True
# NOTE:... | on!
ALLOWED_HOSTS = [
'127.0.0.1:8000',
'cs410.cs.ualberta.ca:41011',
]
# Application definition
INSTALLED_APPS = (
'django.contrib.admin',
'django.contrib.auth',
'django.contrib.contenttypes',
'django.contrib.sessions',
'django.contrib.messages',
'django.contrib.staticfiles',
're... |
muccg/rdrf | rdrf/rdrf/migrations/0023_rdrfcontext_context_form_group.py | Python | agpl-3.0 | 534 | 0 | # -*- 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.ForeignKey(blank=True... | els.SET_NULL),
),
]
|
rodrigosurita/GDAd | sdaps/model/sheet.py | Python | gpl-3.0 | 1,971 | 0.001522 | # -*- coding: utf8 -*-
# SDAPS - Scripts for data acquisition with paper based surveys
# Copyright(C) 2008, Christoph Simon <post@christoph-s | imon.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 General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version... | without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
import buddy
class Sheet(bu... |
devs1991/test_edx_docmode | venv/lib/python2.7/site-packages/networkx/algorithms/approximation/dominating_set.py | Python | agpl-3.0 | 2,985 | 0.00067 | # -*- 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... | optional (default = None)
If None, every edge has weight/distance/weight 1. If a string, use this
edge attribute as the edge weight. Any edge attribute not present
defaults to 1.
Returns
-------
min_weight_dominating_set : set
Returns a set of vertices whose weight sum is no m... | lueError("Expected non-empty NetworkX graph!")
# min cover = min dominating set
dom_set = set([])
cost_func = dict((node, nd.get(weight, 1)) \
for node, nd in graph.nodes_iter(data=True))
vertices = set(graph)
sets = dict((node, set([node]) | set(graph[node])) for node in grap... |
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 | #!/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
... | ys.stdin = open(__file__.replace('.py', f'.{which}.in'), 'r')
sys.stdout = io.StringIO()
expected = open(__file__.replace('.py', f'.{which}.out'), | 'r')
main()
self.assertEqual(sys.stdout.getvalue(), expected.read())
for handle in [sys.stdin, sys.stdout, expected]:
handle.close()
def test_0(self):
self.generalized_test('0')
|
iblis-ms/conan_gbenchmark | conanfile.py | Python | mit | 2,604 | 0.006528 | # Author: Marcin Serwach
# https://github.com/iblis-ms/conan | _gbenchmark
from conans import ConanFile, CMake, tools
imp | ort 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'
description = 'Conan.io support for Google Benchmark'
settings = ['os', 'compiler', 'build_type', 'arch', 'cppstd'... |
svram/fun-with-advanced-python | hackerNewsScraper/hackerNewsScraper/items.py | Python | gpl-3.0 | 317 | 0.003155 | # -*- coding: utf-8 -*-
# Define here the models for your scraped items
#
# See documentation in:
# http://doc.scrapy.org/en/latest/topi | cs/items.html
import scrapy
class HackernewsscraperItem(scrapy.Item):
# define the fields for your item here like:
title = scrapy.Field()
link = scrapy.Field()
| |
quit9to5/Next | patient_management/doctor/forms.py | Python | gpl-2.0 | 308 | 0.00974 | from django import forms
from .models import doctor
cla | ss 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(req | uired=False)
|
nimiq/promptastic | segments/filesystem.py | Python | apache-2.0 | 916 | 0.001092 | 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... | :
bg = colors.background(theme.VENV_BG)
fg = colors.foreground(theme.VENV_FG)
def init(self):
env = os. | getenv('VIRTUAL_ENV')
if env is None:
self.active = False
return
env_name = os.path.basename(env)
self.text = glyphs.VIRTUAL_ENV + ' ' + env_name |
BrainIntensive/OnlineBrainIntensive | resources/HCP/pyxnat/pyxnat/core/__init__.py | Python | mit | 233 | 0 | 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
|
martbhell/wasthereannhlgamelastnight | src/lib/google/auth/crypt/_python_rsa.py | Python | mit | 5,973 | 0.001005 | # Copyright 2016 Google LLC
#
# Licensed under the Apache License, Version 2.0 (the "Lic | ense");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT W... | F ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
"""Pure-Python RSA cryptography implementation.
Uses the ``rsa``, ``pyasn1`` and ``pyasn1_modules`` packages
to parse PEM files storing PKCS#1 or PKCS#8 keys as well as
certifi... |
Takasudo/studyPython | deep/common/layers.py | Python | gpl-3.0 | 7,810 | 0.00516 | # 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... | out = self.__forward(x, train_flg)
return out.reshape(*self.input_shape)
def __forward(self, x, train_flg):
if self.running_mean is None:
N, D = x.shape
self.running_mean = np.zeros(D)
self.running_var = np.zeros(D)
|
if train_flg:
mu = x.mean(axis=0)
xc = x - mu
var = np.mean(xc**2, axis=0)
std = np.sqrt(var + 10e-7)
xn = xc / std
self.batch_size = x.shape[0]
self.xc = xc
self.xn = xn
... |
uwosh/uwosh.emergency.master | setup.py | Python | gpl-2.0 | 1,123 | 0.002671 | 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:... | Python Modules",
],
keywords='',
author='Nathan Van Gheem',
author_email='vangheem@gmail.com',
url='http://svn.plone.org/svn/plone/plone.example',
license='GPL',
packages=find_packages(exclude=['ez_setup']),
namespace_packages=['uwosh', 'uwosh.emergency'],
includ... | mergency>=1.1',
'rsa'
],
entry_points="""
# -*- Entry points: -*-
[z3c.autoinclude.plugin]
target = plone
""",
)
|
harsha5500/pytelegrambot | telegram/ForceReply.py | Python | gpl-3.0 | 353 | 0.005666 | __author__ = 'harsha'
class ForceRep | ly(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):
| return str(self.__dict__) |
TimZaman/DIGITS | digits/model/tasks/test_caffe_train.py | Python | bsd-3-clause | 281 | 0.007117 | # 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.protobu | f
|
EderSantana/agnez | docs/conf.py | Python | bsd-3-clause | 8,361 | 0.005382 | #!/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... | ptions for replacing |today|: either, you set today to
# some non-false value, then it is used:
#today = ''
# Else, today_fmt is used as the format for a strftime call.
#today_fmt = '%B %d, %Y'
# List of patterns, relative to source directory, that match files an | d
# directories to ignore when looking for source files.
exclude_patterns = ['_build']
# The reST default role (used for this markup: `text`) to use for all
# documents.
#default_role = None
# If true, '()' will be appended to :func: etc. cross-reference text.
#add_function_parentheses = True
# If true, the current ... |
eranroz/hewiktionary_checker | upload.py | Python | mit | 8,269 | 0.000605 | #!/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... | 'M': Megabytes (1000000 B)
'Ki': Kibibytes (1024 B)
'Mi': Mebibytes (1024x1024 B)
The suffixes are cas | e insensitive.
-always Don't ask the user anything. This will imply -keep and
-noverify and require that either -abortonwarn or -ignorewarn
is defined for all. It will also require a valid file name and
description. It'll only overwrite files if -ignorewarn includ... |
cloudify-cosmo/cloudify-system-tests | cosmo_tester/test_suites/snapshots/inplace_restore_test.py | Python | apache-2.0 | 3,573 | 0 | from time import sleep
from os.path import join
import pytest
from cosmo_tester.framework.examples import get_example_deployment
from cos | mo_tester.framework.test_hosts import Hosts, VM
from cosmo_tester.test_suites.snapshots import (
create_snapshot,
download_snapshot,
restore_snapshot,
upload_snapshot,
)
@pytest.fixture(scope='function')
def manager_and_vm(request, ssh_key, module_tmpdir, te | st_config,
logger):
hosts = Hosts(ssh_key, module_tmpdir, test_config, logger, request, 2)
hosts.instances[0] = VM('master', test_config)
hosts.instances[1] = VM('centos_7', test_config)
manager, vm = hosts.instances
passed = True
try:
hosts.create()
yield ho... |
tldr-pages/tldr-python-client | setup.py | Python | mit | 1,805 | 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... | author='Felix Yan',
author_email='felixonmars@gmail.com',
url='https://github.com/tldr-pages/tldr-python-client',
description='command line client for tldr',
long_description=Path(setup_dir, 'README.md').open().read(),
long_description_content_type='text/mark | down',
license='MIT',
py_modules=['tldr'],
entry_points={
"console_scripts": [
"tldr = tldr:cli"
]
},
data_files=[('share/man/man1', ['docs/man/tldr.1'])],
install_requires=required,
tests_require=[
'pytest',
'pytest-runner',
],
version=ver... |
iamlikeme/sections | tests/test_sections_Circle.py | Python | mit | 810 | 0.020988 | 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 = dict(r=3.0)
cls.rp ... | 123519331, 63.61725123519331, 0.0
cls._I = 63.61725123519331, 63.61725123519331, 0.0
cls._cog = 0.0, 0.0
def test_check_dimensions(self):
self.assertRaises(ValueError, self.section.set_dimensions, r=-1)
self.assertRaises(ValueError, self.section.set_dimensions, r=0)... |
Silvian/samaritan | api/tests/integration/__init__.py | Python | gpl-3.0 | 2,353 | 0.00085 | """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 = factory.Faker('name')
class Meta:
model = User
class AddressFactory(DjangoModelFactory):
"""Factory for address."""
number = factory.Faker('word')
street = factory.Faker('name')
locality = factory.Faker('name')
city = factory.Faker('n... | aker('word')
class Meta:
model = Address
class RoleFactory(DjangoModelFactory):
"""Factory for Roles."""
name = factory.Faker('name')
description = factory.Faker('text')
class Meta:
model = ChurchRole
class GroupFactory(DjangoModelFactory):
"""Factory for Groups."""
n... |
naritotakizawa/ngo | tests/project2/project/settings.py | Python | mit | 941 | 0 | """ユーザー設定用モジュール."""
import os
DEBUG = True
BASE_DIR = os.path.dirna | me(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.WSGIHandler',
]
"""
以下のように読み込まれていきます
app = None
app = WSGIHandler(None)
app = ... | p(app)
app = validator(app)
"""
# TEMPLATES = ('ngo.backends.Ngo', [])
"""
TEMPLATES = (
'ngo.backends.Ngo',
[os.path.join(BASE_DIR, 'template'), os.path.join(BASE_DIR, 'template2')]
)
"""
TEMPLATES = ('ngo.backends.Jinja2', [])
STATICFILES_DIRS = None
"""
STATICFILES_DIRS = [
os.path.... |
ahmeier/jhbuild | jhbuild/utils/systeminstall.py | Python | gpl-2.0 | 14,543 | 0.002888 | # 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... | ace, for now
# we try to support both it and older PackageKit
self._using_pk_0_8_1 = None
self._sysbus = None
self._pkdbus = None
def _on_pk_message(self, msgtype, msg):
logging.info(_('PackageKit: %s' % (msg,)))
def _on_pk_error(self, msgtype, msg):
log | ging.error(_('PackageKit: %s' % (msg,)))
def _get_new_transaction(self):
if self._loop is None:
import glib
self._loop = glib.MainLoop()
if self._sysbus is None:
import dbus.glib
import dbus
self._dbus = dbus
self._sysbus = dbu... |
chengduoZH/Paddle | python/paddle/fluid/tests/unittests/test_sampling_id_op.py | Python | apache-2.0 | 2,626 | 0 | # 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... | uid. | op import Operator
class TestSamplingIdOp(OpTest):
def setUp(self):
self.op_type = "sampling_id"
self.use_mkldnn = False
self.init_kernel_type()
self.X = np.random.random((100, 10)).astype('float32')
self.inputs = {"X": self.X}
self.Y = np.random.random(100).astype(... |
ctrlaltdel/neutrinator | vendor/keystoneauth1/tests/unit/k2k_fixtures.py | Python | gpl-3.0 | 5,454 | 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... | m="http://www.w3.org/2001/10/xml-exc-c14n#"/>
<xmldsig:SignatureMethod
Algorithm="http://www.w3.org/2000/09/xmldsig#rsa-sha1"/>
<xmldsig:Reference URI="#a5f02efb0bff4044b294b4583c7dfc5d">
<xmldsig:Transforms>
<xmldsig:Transform
Alg | orithm="http://www.w3.org/2000/09/xmldsig#
enveloped-signature"/>
<xmldsig:Transform
Algorithm="http://www.w3.org/2001/10/xml-exc-c14n#"/>
</xmldsig:Transforms>
<xmldsig:DigestMethod
Algorithm="http://www.w3.org/2000/09/xmldsig#sha1"/>
<xmldsig:Diges... |
inukaze/maestro | Solución/CodeCombat/Python/2.Bosque_Aislado/005 - If-stravaganza.py | Python | gpl-2.0 | 386 | 0.002604 | # 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 Tru | e:
enemy = hero.findNearestEnemy()
# Usa la sentencia if para comprobar si existe un enemigo
# Ata | ca al enemigo si existe:
if enemy:
hero.attack(enemy) * 2
|
google/rekall | rekall-core/rekall/plugins/response/forensic_artifacts.py | Python | gpl-2.0 | 37,683 | 0.001115 | # 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... | me = "Directory"
def __init__(self, output=None, **kwargs):
super(DirectoryBasedWriter, self).__init__(**kwargs)
self.dump_dir = output
# Check if the directory already exists.
if not os.path.isdir(self.dump_dir):
raise plugin.PluginError("%s is not a directory" % self. | dump_dir)
def write_file(self, result):
"""Writes a FileInformation object."""
for row in result.results:
filename = row["filename"]
with open(filename, "rb") as in_fd:
with self.session.GetRenderer().open(
directory=self.dump_dir,
... |
summanlp/gensim | docker/check_fast_version.py | Python | lgpl-2.1 | 283 | 0.003534 | 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 p | lain numpy (20-80x slower training than the above)')
sys.exit(-1)
|
Vijaysai005/KProject | vijay/DBSCAN/clustering/db/generate_data.py | Python | gpl-3.0 | 5,801 | 0.038786 | # 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... | [item] in rank_current_sorted:
set_col1.insert([{"latitude":lat_curr[item], "longitude":long_curr[item], "distance_by_interval": | rank_curr[item], "unit_id":item, "rank":rank_current_sorted.index(rank_curr[item])+1,"timestamp":ist}])
set_col2.insert([{"latitude":lat_curr[item], "longitude":long_curr[item], "distance_by_interval":tot_rank_curr[item], "unit_id":item, "rank":tot_rank_current_sorted.index(tot_rank_curr[item])+1,"timestamp":is... |
OCA/operating-unit | stock_operating_unit/model/stock_warehouse.py | Python | agpl-3.0 | 2,156 | 0.000464 | # © 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... |
if (
rec.warehouse_id.operating_unit_id
and rec.warehouse_id
and rec.l | ocation_id
and rec.warehouse_id.operating_unit_id
!= rec.location_id.operating_unit_id
):
raise UserError(
_(
"Configuration Error. The Operating Unit of the "
"Warehouse and the Location must... |
DavidLP/home-assistant | homeassistant/components/rainmachine/__init__.py | Python | apache-2.0 | 14,628 | 0 | """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... | el'),
TYPE_FREEZE_PROTECTION: ('Freeze Protection', 'mdi:weather-snowy'),
TYPE_HOT_DAYS: ('Extra Water on Hot Days', 'mdi:thermometer-lines'),
TYPE_HOURLY: ('Hourly Restrictions', 'mdi:cancel'),
TYPE_MONT | H: ('Month Restrictions', 'mdi:cancel'),
TYPE_RAINDELAY: ('Rain Delay Restrictions', 'mdi:cancel'),
TYPE_RAINSENSOR: ('Rain Sensor Restrictions', 'mdi:cancel'),
TYPE_WEEKDAY: ('Weekday Restrictions', 'mdi:cancel'),
}
SENSORS = {
TYPE_FLOW_SENSOR_CLICK_M3: (
'Flow Sensor Clicks', 'mdi:water-pump... |
gaoce/TimeVis | tests/test_api.py | Python | mit | 1,185 | 0.001688 | 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):
self.app = timevis.app.test_client()
self.url = '/api/v2/experiment'
def test_post(self | ):
name = os.path.join(data_path, 'post_exp.json')
with open(name) as file:
obj = json.load(file)
resp = self.app.post(self.url, data=json.dumps(obj),
content_type='application/json')
self.assertIsNotNone(resp.data)
def test_get(self)... |
rjspiers/qgis-batch-save-layers | resources.py | Python | gpl-2.0 | 4,288 | 0.001166 | # -*- 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\... | 0b\x03\x83\x43\xca\x0b\x16\x7c\
\x27\xe4\x95\xd4\x4e\x58\xf0\x9d\x10\x01\xab\xee\x09\x79\xe5\x94\
\x93\x16\x8b\x1f\x41\xe8\xfe\x0c\x55\xc2\x82\xdb\xe7\xcb\x96\x16\
\x10\x21\xb4\x58\xc2\xbd\x21\xd7\x58\x70\xc9\x29\xdf\xcf\x0f\x2f\
\x58\x08\x42\x7e\x0f\xc4\xc | 0\xe0\x90\x6a\x3b\x7c\xba\x2a\xa7\x00\
\x56\xbe\xaf\xa1\x2a\x3c\x5f\x2d\xd3\xe0\x73\xa4\x0b\x11\xdb\xbf\
\xc1\xb4\xd9\x57\xc1\x1e\xaf\x12\xa7\xc2\x21\x9d\x68\x24\x8c\x94\
\x5b\x7f\x35\x3d\x3d\x4d\xe6\xe5\x87\xda\x8e\xfd\x66\x4e\x5d\x39\
\xdf\xcb\xc0\xc5\x33\xae\xf7\x0b\x76\x99\x76\x9d\x21\x59\x8b\xa2\
\x7f\x73\x2a\x16\... |
argentumproject/electrum-arg | plugins/digitalbitbox/digitalbitbox.py | Python | mit | 20,399 | 0.008285 | # ----------------------------------------------------------------------------------
# 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... | ntered.\r\n\r\n" \
+ reply['error']['message'] + "\r\n\r\n" \
| "Enter your Digital Bitbox password:")
else:
# Should never occur
msg = _("Unexpected error occurred.\r\n\r\n" \
+ reply['error']['message'] + "\r\n\r\n" \
"Enter your Digital Bitbox password:")
... |
gdimitris/ChessPuzzlerBackend | Application/app_configuration.py | Python | mit | 368 | 0.008152 | __author__ = 'dimitris'
import os
# Flask Configurat | ion
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_NAME) |
#Cache Configuration
CACHE_TYPE = 'simple' |
fidelram/goatools | setup.py | Python | bsd-2-clause | 889 | 0 | #!/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 ::... | thon scripts to find enrichment of GO terms",
long_description=open("README.rst").read(),
install_requires=['fisher', 'xlsxwriter', 'st | atsmodels']
)
|
kalafut/go-ledger | importer_test.py | Python | mit | 1,021 | 0.001959 | from StringIO import StringIO
import textwrap
import import | er
def t | est_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('''\
"Trans Date", "Summary", "Amount"
5/2/2007, Regal... |
CubicERP/odoo | addons/product/product.py | Python | agpl-3.0 | 67,910 | 0.006685 | # -*- 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... | categ_id, _ = uom_categ.name_create(cr, uid, categ_misc)
uom_id = self.create(cr, uid, {self._rec_name: name,
'categor | y_id': categ_id,
'factor': 1})
return self.name_get(cr, uid, [uom_id], context=context)[0]
def create(self, cr, uid, data, context=None):
if 'factor_inv' in data:
if data['factor_inv'] != 1:
data['factor'] = self._compute_factor_inv... |
Daniel-Hoerauf/group-assistant | assistant/weatherTest.py | Python | gpl-3.0 | 433 | 0.027714 | #!/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 "City not | found. It's probably raining meatballs. Please try again."
if __name__ == '__main__':
main(sys.argv) |
suutari-ai/shoop | shuup/front/views/misc.py | Python | agpl-3.0 | 730 | 0 | # -*- 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
# L | ICENSE file in the root directory of this source tree.
from django.http import HttpResponseRedirect
from shuup import | configuration
def toggle_all_seeing(request):
return_url = request.META["HTTP_REFERER"]
if not request.user.is_superuser:
return HttpResponseRedirect(return_url)
all_seeing_key = "is_all_seeing:%d" % request.user.pk
is_all_seeing = not configuration.get(None, all_seeing_key, False)
config... |
yliu120/dbsystem | HW2/dbsys-hw2/Query/Plan.py | Python | apache-2.0 | 10,860 | 0.01105 | 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... | nt')])
>>> query5 = db.query().fromTable('employee').join( \
db.query().fromTable('employee'), \
rhsSchema=e2schema, \
method='hash', | \
lhsHashFn='hash(id) % 4', lhsKeySchema=keySchema, \
rhsHashFn='hash(id2) % 4', rhsKeySchema=keySchema2, \
).finalize()
>>> print(query5.explain()) # doctest: +ELLIPSIS
HashJoin[...,cost=...](lhsKeySchema=employeeKey[(id,int)],rhsKeySchema=employeeKey2[(id2,int)],lhsHashFn='hash(id)... |
kedz/cuttsum | trec2015/sbin/reports/raw-stream-count.py | Python | apache-2.0 | 7,738 | 0.005557 | 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... | print n_isect, float(n_isect) / n_fltr, float(n_isect) / n_unfltr
coverage.append({
"event": event.query_id,
"intersection": n_isect,
"isect/n_2015F": | float(n_isect) / n_fltr,
"isect/n_2014": float(n_isect) / n_unfltr,
})
df = pd.DataFrame(coverage)
df_u = df.mean()
df_u["event"] = "mean"
print pd.concat([df, df_u.to_frame().T]).set_index("event")
exit()
with open("article_count.tex", "w") as f:
f.write(df_sum.to_latex())
import os
if not os.path.... |
goors/flask-microblog | UserModel.py | Python | apache-2.0 | 2,758 | 0.005801 | 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):
... | if user:
return user
return False
def send_email(self, subject, recip | ients, html_body, nick):
import mandrill
try:
mandrill_client = mandrill.Mandrill('ajQ8I81AVELYSYn--6xbmw')
message = {
'from_email': ADMINS[0],
'from_name': 'Blog admin',
'headers': {'Reply-To': ADMINS[0]},
'html': html_body,
... |
lem9/weblate | weblate/accounts/captcha.py | Python | gpl-3.0 | 4,975 | 0 | # -*- 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... | estamp)
@property
def hashed(self):
"""Return hashed question."""
return hash_question(self.question, self.timestamp)
def validate(self, answer):
"""Validate answer."""
return (
self.result == answer and
self.timestamp + TIMEDELTA > time.time()
... | parts = self.question.split()
return ' '.join((
parts[0],
self.operators_display[parts[1]],
parts[2],
))
def format_timestamp(timestamp):
"""Format timestamp in a form usable in captcha."""
return '{0:>010x}'.format(int(timestamp))
def checksum_ques... |
hortonworks/hortonworks-sandbox | apps/help/src/help/tests.py | Python | apache-2.0 | 1,364 | 0.008065 | #!/usr/bin/env python
# Licensed to Cloudera, Inc. under one
# or more contributor license agreements. See t | he 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 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 ... |
andela-akhenda/maisha-goals | app/__init__.py | Python | mit | 1,333 | 0 | 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', ... | ation token route
from .auth import auth
from .models import User
@app.route('/api/v1', methods=['GET'])
@json
def api_index():
return {
"message": "Welcome to Maisha Goals. Register a new "
" user or login to get started"}
@app.route('/auth/register', methods=[... | ()
u.import_data(request.json)
db.session.add(u)
db.session.commit()
return {
'message': 'Your account has been successfuly created'
}, 201, {'Location': u.get_url()}
@app.route('/auth/login')
@auth.login_required
@json
def login_user():
retur... |
the-fascinator/fascinator-portal | src/main/config/portal/default/default/scripts/maintenance.py | Python | gpl-2.0 | 729 | 0.005487 | from com.googlecode.fascinator.api.indexer import SearchRequest
from com.googlecode.fascinator.common.solr import SolrResult
from com.googlecode.fasc | inator.spring import ApplicationContextProvider
from java.io import ByteArrayInputStream, ByteArrayOutputStream
class MaintenanceData:
def __init__(self):
pass
def __activate__(self, context):
self.velocityContext = context
self.response = self.velocityContext["response"]
self.... | ntanceMode() == False:
self.response.sendRedirect(self.velocityContext["portalPath"]+"/home")
|
stephenlienharrell/roster-dns-management | test/credentials_test.py | Python | bsd-3-clause | 4,275 | 0.010526 | #!/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 ... | eRosterDatabase()
data = open(DATA_FILE, 'r').read()
db_instance.StartTransaction()
db_instance.cursor.execute(data)
db_instance.EndTransaction()
db_instance.close()
self.core_instance = roster_core.Core(u'sharrell', self.config_instance)
def is_valid_uuid (self, uuid):
"""
TAKEN FR... | strings taking one of the following forms:
XXXX
XXXXXXXX
XXXXXXXX-XXXX-XXXX-XXXX-XXXXXXXXXXXX
where each X is a hexadecimal digit (case insensitive)
"""
try:
if len (uuid) == 4:
if int (uuid, 16) < 0: return False
elif len (uuid) == 8:
if int (uuid, 16) < ... |
David-Wobrock/django-fake-database-backends | tests/test_project/test_app/migrations/0017_add_float.py | Python | mit | 386 | 0 | # 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',
field=models.FloatField(default=0.0),
),
]
| |
CoderDojoTC/python-minecraft | docs/conf.py | Python | mit | 8,611 | 0.006503 | # -*- 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 ... |
project = u'CoderDojo Twin Cities Python for Minecraft'
copyright = u'by multiple <a href="https://github.com/CoderDojoTC/python-minecraft/graphs/contri | butors">contributors</a>'
# The version info for the project you're documenting, acts as replacement for
# |version| and |release|, also used in various other places throughout the
# built documents.
#
# The short X.Y version.
version = '1.0'
# The full version, including alpha/beta/rc tags.
release = '1.0'
# The lan... |
mailfish/helena | gallery/urls.py | Python | apache-2.0 | 197 | 0.015228 | from django.conf.url | s import patterns, url
from .views import PhotoListView
urlpatterns = patterns('',
| url(r'^(?P<slug>[\w-]+)/$', PhotoListView.as_view(), name='image'),
) |
sinsai/Sahana_eden | controllers/default.py | Python | mit | 13,802 | 0.007245 | # -*- 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... | nhide login form
$('#login_form').removeClass('hide');
});
});
""" % pos | t_script)
register_div.append(register_script)
return dict(title = title,
#modules=modules,
menu_boxes=menu_boxes,
#admin_name=admin_name,
#admin_email=admin_email,
#admin_tel=admin_tel,
self_registration=se... |
Comunitea/CMNT_004_15 | project-addons/scheduled_shipment/wizard/schedule_wizard.py | Python | agpl-3.0 | 1,376 | 0.011628 | from odoo import models, fields, api, _
from odoo.exceptions import ValidationError
from datetime import datetime
class StockScheduleWizard(models.TransientModel):
_name = "stock.schedule.wiza | rd"
scheduled_date = fields.Datetime('Scheduled shipping date')
@api.multi
def action_but | ton_schedule(self):
if self.scheduled_date:
date_now = str(datetime.now())
difference = datetime.strptime(date_now, '%Y-%m-%d %H:%M:%S.%f') - \
datetime.strptime(self.scheduled_date, '%Y-%m-%d %H:%M:%S')
difference = difference.total_seconds() / float... |
Sebelino/PyUserInput | pymouse/mac.py | Python | lgpl-3.0 | 5,547 | 0.003966 | #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... | = int(horizontal)
if horizontal == 0: # Do nothing with 0 distance
| pass
elif horizontal > 0: # Scroll right if positive
scroll_event(x_move=1, n=horizontal)
else: # Scroll left if negative
scroll_event(x_move=-1, n=abs(horizontal))
if depth is not None:
depth = int(depth)
if depth == 0: #... |
kgblll/libresoft-gymkhana | libs/ChannelTemplate.py | Python | gpl-2.0 | 822 | 0.06691 | # 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 categories "},
... | def get_info(self):
return "Channel description"
def set_options(self, options):
"""
Fill self.options with the received dictionary
regarding mandatory and optional fields of your channel
"""
return True, ""
def process (self):
"""
Make the search and return the nodes
"""
|
michaelbrooks/uw-message-coding | message_coding/apps/dataset/migrations/0010_auto_20150619_2106.py | Python | mit | 419 | 0 | # -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.db import models, migrations
class Migration(migration | s.Migration):
dependencies = [
('dataset', '0009_remove_selection_model'),
]
operations = [
migrations.AlterField(
model_name='dataset',
name='name',
field=models.CharField | (default=b'', max_length=150),
),
]
|
Azure/azure-sdk-for-python | sdk/videoanalyzer/azure-mgmt-videoanalyzer/azure/mgmt/videoanalyzer/_version.py | Python | mit | 488 | 0.004098 | # 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 cause incorrect behavior and will be lost if t... | ----------------------
VERSION = "1.0.0b3"
|
CanonicalLtd/subiquity | subiquitycore/netplan.py | Python | agpl-3.0 | 5,471 | 0 | 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... | nfig(iface_config)
return iface_config
def sanitize_config(config):
"""Return a copy of config with passwords redacted."""
config = copy.deepcopy(config)
interfaces = config.get('network', {}).get('wifis', {}).items()
for iface, iface_config in interfaces:
_sanitize_inteface_config(iface_c... | plan_config() with each piece of yaml config, and then
call config_for_device to get the config that matches a particular
network device, if any.
"""
def __init__(self):
self.physical_devices = []
self.virtual_devices = []
self.config = {}
def parse_netplan_config(self, con... |
saullocastro/pyNastran | pyNastran/bdf/mesh_utils/bdf_equivalence.py | Python | lgpl-3.0 | 12,362 | 0.003074 | 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 ... | inode += 1
nnodes = len(model.nodes)
nids = arange(1, inode + 1, dtype='int32')
assert nids[-1] == nnodes
else:
for nid, node in sorted(iteritems(model.nodes)):
nid_map[inode] = nid
inode += 1
nids = array([node... | id, node in sorted(iteritems(model.nodes))], dtype='int32')
all_nids = nids
if needs_get_position:
nodes_xyz = array([model.nodes[nid].get_position()
for nid in nids], dtype='float32')
else:
nodes_xyz = array([model.nodes[nid].xyz
fo... |
mbuesch/toprammer | libtoprammer/chips/microchip16/pic24f08kl201sip6.py | Python | gpl-2.0 | 2,151 | 0.034868 | #
# 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/... | R PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License along
# with this program; if not, write to the Free S | oftware Foundation, Inc.,
# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
"""
from .microchip16_common import *
from .configWords import klx0x_fuseDesc
class Chip_Pic24f08kl201sip6(Chip_Microchip16_common):
voltageVDD = 3.3
voltageVPP = 8
logicalFlashProgramMemorySize = 0x800000
logicalFlashC... |
cybermaniax/lvstop | src/main/python/ipvstop.py | Python | apache-2.0 | 332 | 0.009036 | #!/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:
raise |
raspibo/Livello1 | var/www/cgi-bin/writecsvlistsetsredis.py | Python | mit | 1,795 | 0.018942 | #!/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)
import mjl, mhl, flt
import redis, subprocess
# Parametri generali
TestoPagina="Genera file \".csv\" dei valori di chiave \"lists\" Redis"
DirBase="/var/www"
ConfigFile=DirBase+"/conf/config.json"
#ExecFile="/cgi-bin/<exefile>"
# Redis "key"
RedisKey = "*" # Tutte le chia... |
svalenti/agnkey | trunk/bin/agnmag.py | Python | mit | 19,750 | 0.005266 | #!/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... | if _interactive: print '\#### ', img
# if dicti[_filter][img][namemag[_typemag][0]]!=9999:
# start calibrating image 1
secondimage = []
jdvec = []
| filtvec = []
colore = []
for ii in dicti[_filter][img].keys():
if 'ZP' in ii: # for each zero point available
cc = ii[-2:] # color used
for filt2 in dicti.keys():
if filt2 != _filter:
... |
jolyonb/edx-platform | openedx/core/djangoapps/video_pipeline/models.py | Python | agpl-3.0 | 3,579 | 0.001397 | """
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... | ure must be
enabled for this to take effect.
.. no_pii:
"""
KEY_FIELDS = ('course_id',)
course_id = CourseKeyField(max_length=255, db_index=True)
def __unicode__(self):
not_en = "Not "
if self.enabled:
not_en = ""
return u"Course '{course_key}': Video Uplo... | t_enabled=not_en
)
|
andersondss/LearningDjango | udemy/SimpleMooc/SimpleMooc/settings.py | Python | mit | 3,174 | 0.000315 | """
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 s | ettings 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, ...)
import os
import dj_database_url
BASE_DIR = os.path.dirname(os.path.dirname(__file__))
# Quick-start development settings - unsuitable for production
# See ... | z9tj4=l%7+0gzg17o(sw&%(use@zt+_k@=y(ke2f5'
# SECURITY WARNING: don't run with debug turned on in production!
DEBUG = False
TEMPLATE_DEBUG = True
ALLOWED_HOSTS = []
# Application definition
INSTALLED_APPS = (
'django.contrib.admin',
'django.contrib.auth',
'django.contrib.contenttypes',
'django.cont... |
yashpungaliya/MailingListParser | lib/analysis/author/graph/interaction.py | Python | gpl-3.0 | 7,719 | 0.003627 | """
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... | re_lat = True
if time_limit is None:
time_limit = time.strftime("%a, %d %b %Y %H:%M:%S %z")
msgs_before_time = set()
time_limit = get_datetime_object(time_limit)
print("All messages before", time_limit, "are being considered.")
discussion_graph = nx.DiGraph()
email_re = re.compile(r'[\... | etworkX graph by reading from CSV file
if not ignore_lat:
with open("graph_nodes.csv", "r") as node_file:
for pair in node_file:
node = pair.split(';', 2)
if get_datetime_object(node[2].strip()) < time_limit:
node[0] = int(node[0])
... |
danielecook/gist-alfred | set_info.py | Python | mit | 400 | 0 | #!/usr/b | in/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)
if __name... | e_workflow()
sys.exit(wf.run(main))
|
dezelin/scons | scons-local/SCons/Node/Alias.py | Python | mit | 4,197 | 0.001906 |
"""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 dea | l in the Software without restriction, including
# without limitation the rights to use, copy, modify, merge, publish,
# distribute, sublicense, and/or sell copies of the Software, and to
# permit persons to whom the Software is furnished to do so, subject to
# the following conditions:
#
# The above copyright notice a... |
smmribeiro/intellij-community | python/testData/intentions/returnTypeInNewNumpyDocString_after.py | Python | apache-2.0 | 75 | 0.013333 | def f(x): |
"""
Returns
- | ------
object
"""
return 42 |
valmynd/MediaFetcher | src/plugins/youtube_dl/youtube_dl/extractor/netzkino.py | Python | gpl-3.0 | 2,537 | 0.028774 | # 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... | nfo['title'],
'age_limit': int_or_none(custom_fields.get('FSK')[0]),
'timestamp': parse_iso8601(info.get('date'), delimiter=' '),
'description': clean_html(info.get('content')),
'thumbnail': info.get('t | humbnail'),
'playlist_title': api_info.get('title'),
'playlist_id': category_id,
}
|
daviddrysdale/python-phonenumbers | python/phonenumbers/data/region_BL.py | Python | apache-2.0 | 959 | 0.007299 | """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} | ', possible_length=(9,)),
fixed_line=PhoneNumberDesc(national_number_pattern='590(?:2[7-9]|5[12]|87)\\d{4}', example_number='590271234', possible_length=(9,)),
mobile=PhoneNumberDesc(national_number_pattern='69(?:0\\d\\d|1(?:2[2-9]|3[0-5]))\\d{4}', example_number='690001234', possible_length=(9,)),
toll_fre... | esc(national_number_pattern='976[01]\\d{5}', example_number='976012345', possible_length=(9,)),
national_prefix='0',
national_prefix_for_parsing='0',
mobile_number_portable_region=True)
|
pandeyop/rally | tests/unit/benchmark/scenarios/neutron/test_network.py | Python | apache-2.0 | 24,839 | 0 | # 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... | reate_network.assert_called_once_with({})
mock_update_network.assert_has_calls(
[mock.call(mock_create_network.return_value, network_update_args)])
mock_create_network.reset_mo | ck()
mock_update_network.reset_mock()
# Explicit network name is specified
network_create_args = {"name": "network-name", "admin_state_up": False}
scenario.create_and_update_networks(
network_create_args=network_create_args,
network_update_args=network_update_ar... |
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 | # 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... | teritems
|
class Chassis100ChassisActions(object):
"""
NOTE: This class is auto generated by the swagger code generator program.
Do not edit the class manually.
"""
def __init__(self):
"""
Chassis100ChassisActions - a model defined in Swagger
:param dict swaggerTypes: The key is attr... |
creasyw/IMTAphy | wnsbase/playground/builtins/__init__.py | Python | gpl-2.0 | 1,457 | 0.00755 | ###############################################################################
# This file is part of openWNS (open Wireless Network Simulator)
# _____________________________________________________________________________
#
# Copyright (C) 2004-2007
# Chair of Communication Networks (ComNets)
# Kopernikusstr. 16, D-... | from Lint import *
#from Missing import *
#from Replay import *
#from SanityCheck import *#
#f#rom Testing import *
#f#rom Update import *
#from Upgrade import * | |
colinbrislawn/scikit-bio | skbio/sequence/tests/test_sequence.py | Python | bsd-3-clause | 113,531 | 0.000352 | # ----------------------------------------------------------------------------
# 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.
# --------------------------------------------... | 'ACGT')
self.assertEqual(Sequence(seq), seq)
# sequence with metadata should have everything propagated
seq = Sequence('ACGT',
metadata={'id': 'foo', 'description': 'bar baz'},
positional_metadata={'quality': range(4)})
self.assertEqual(Sequ... | c', 'description': '123'},
positional_metadata={'quality': [42] * 4}),
Sequence('ACGT', metadata={'id': 'abc', 'description': '123'},
positional_metadata={'quality': [42] * 4}))
# subclasses work too
seq = SequenceSubclass('ACGT',
... |
KDB2/veusz | veusz/document/export.py | Python | gpl-2.0 | 15,098 | 0.002384 | # 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
# ... | \n' % xref_index).encode('ascii'),
text)
return text
def fixupPSBoundingBox(infname, outfname, pagewidth, size):
"""Make bounding box for EPS | /PS match size given."""
with open(infname, 'rU') as fin:
with open(outfname, 'w') as fout:
for line in fin:
if line[:14] == '%%BoundingBox:':
# replace bounding box line by calculated one
parts = line.split()
widthfacto... |
lifemapper/core | LmWebServer/services/api/v2/layer.py | Python | gpl-3.0 | 9,222 | 0 | """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... | .............................
def _list_env_layers(self, user_id, after_ti | me=None, alt_pred_code=None,
before_time=None, date_code=None, env_code=None,
env_type_id=None, epsg_code=None, gcm_code=None,
limit=100, offset=0, scenario_id=None):
"""List environmental layer objects matching the specified criteria
... |
yunojuno/django-request-profiler | tests/utils.py | Python | mit | 491 | 0.004073 | 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):
"""... | se.
"""
return skipIf(settings.AUTH_USER_MODEL != "auth.User", "Custom user model in use")(
| test_func
)
|
eduNEXT/edx-platform | openedx/core/djangoapps/oauth_dispatch/tests/test_api.py | Python | agpl-3.0 | 2,669 | 0.003372 | """ 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... | ic_client(
name='public app',
user=self.user,
redirect_uri=DUMMY_REDIRECT_URL | ,
client_id='public-client-id',
)
def _assert_stored_token(self, stored_token_value, expected_token_user, expected_client):
stored_access_token = AccessToken.objects.get(token=stored_token_value)
assert stored_access_token.user.id == expected_token_user.id
assert stored_... |
raphael0202/spaCy | spacy/ja/tag_map.py | Python | mit | 4,024 | 0.03466 | # 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
#... | RB},
"名詞,普通名詞,サ変形状詞可能,*":{POS: NOUN}, # ex: 下手
"名詞,普通名詞,一般,*":{POS: NOUN},
"名詞,普通名詞,形状詞可能,*":{POS: NOUN}, # XXX: sometimes ADJ in UDv2
"名詞,普通名詞,形状詞可能,*,NOUN":{POS: NOUN},
" | 名詞,普通名詞,形状詞可能,*,ADJ":{POS: ADJ},
"名詞,普通名詞,助数詞可能,*":{POS: NOUN}, # counter / unit
"名詞,普通名詞,副詞可能,*":{POS: NOUN},
"連体詞,*,*,*":{POS: ADJ}, # XXX this has exceptions based on literal token
"連体詞,*,*,*,ADJ":{POS: ADJ},
"連体詞,*,*,*,PRON":{POS: PRON},
"連体詞,*,*,*,DET":{POS: DET},
}
|
elkingtowa/pyrake | tests/test_spidermiddleware_urllength.py | Python | mit | 685 | 0.00146 | 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')
short_url_req = Request('http://pyraketest.org/')
long_url_req = Request('http://pyraketest.org/this_is_a_long_url')
| reqs = [short_url_req, long_url_req]
mw = UrlLengthMiddleware(maxlength=25)
spider = Spider('foo')
out = list(mw.process_spider_output(res, reqs, spider))
self.assertEquals(out, [short_url_req])
|
jamslevy/gsoc | app/soc/models/priority_group.py | Python | apache-2.0 | 1,130 | 0.004425 | #!/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... | fic language governing perm | issions and
# limitations under the License.
"""This module contains the Priority Group Model."""
__authors__ = [
'"Sverre Rabbelier" <sverre@rabbelier.nl>',
]
from google.appengine.ext import db
from django.utils.translation import ugettext
from soc.models import linkable
class PriorityGroup(linkable.Linkabl... |
samuelshaner/openmc | docs/source/conf.py | Python | mit | 7,909 | 0.006448 | # -*- 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... | are ignored by default.
#show_authors = False
# The name of the Pygments (syntax highlighting) style to use.
#pygments_style = 'sphinx'
#pygments_style = 'friendly'
#pygments_style = 'bw'
#pygments_style = 'fruity'
#pygments_style = 'manni'
pygments_style = 'tango'
# A list of ignored prefixes for module index sorti | ng.
#modindex_common_prefix = []
# -- Options for HTML output ---------------------------------------------------
# The theme to use for HTML and HTML Help pages
if not on_rtd:
import sphinx_rtd_theme
html_theme = 'sphinx_rtd_theme'
html_theme_path = [sphinx_rtd_theme.get_html_theme_path()]
html_logo = ... |
adobe-mds/dcos-cassandra-service | integration/tests/infinity_commons.py | Python | apache-2.0 | 1,791 | 0.002233 | 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... | lt.json()
except ValueError:
return False, message
if counter < 3:
counter += 1
pred_res = predicate(body)
if pred_res:
counter = 0
return pred_res, message
return spin(fn, success_predicate, wait_time=wait_time).json()
def get_maratho... | athon'.format(shakedown.dcos_url())
def get_marathon_client():
"""Gets a marathon client"""
return marathon.Client(get_marathon_uri())
def strip_meta(app):
app.pop('fetch')
app.pop('version')
app.pop('versionInfo')
return app
|
MartinOehler/LINBO-ServerGUI | linboweb/linboserver/forms.py | Python | gpl-2.0 | 1,587 | 0.006931 | # 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
from django.for | ms.widgets import Textarea
from django.forms.widgets import DateInput
from django.contrib.admin import widgets
from linboweb.linboserver.models import partition
from linboweb.linboserver.models import partitionSelection
from linboweb.linboserver.models import os
from linboweb.linboserver.models import vm
from linboweb... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.