code stringlengths 3 1.05M | repo_name stringlengths 5 104 | path stringlengths 4 251 | language stringclasses 1
value | license stringclasses 15
values | size int64 3 1.05M |
|---|---|---|---|---|---|
# vim: tabstop=4 shiftwidth=4 softtabstop=4
# Copyright 2011 NTT
# 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
#
... | rickerc/nova_audit | nova/tests/network/test_linux_net.py | Python | apache-2.0 | 43,026 |
"""The viaggiatreno component."""
| fbradyirl/home-assistant | homeassistant/components/viaggiatreno/__init__.py | Python | apache-2.0 | 34 |
# Copyright 2021 Google LLC. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or a... | tensorflow/tfx | tfx/dsl/input_resolution/resolver_op_test.py | Python | apache-2.0 | 6,062 |
../../../../share/pyshared/OpenSSL/__init__.py | Alberto-Beralix/Beralix | i386-squashfs-root/usr/lib/python2.7/dist-packages/OpenSSL/__init__.py | Python | gpl-3.0 | 46 |
import sys, os
import stat
import httplib
import urlparse
import json
import logging
__all__ = [
"WebHDFS",
"WebHDFSError"
]
logging.basicConfig(level=logging.DEBUG, datefmt='%m/%d/%Y %I:%M:%S %p',
format='%(asctime)s - %(name)s - %(levelname)s - %(message)s')
logger = logging.getLogge... | Esri/geoprocessing-tools-for-hadoop | webhdfs/webhdfs.py | Python | apache-2.0 | 13,045 |
# -*- coding: utf-8 -*-
"""Views available to super administrators only."""
from __future__ import unicode_literals
from functools import reduce
from django.contrib.auth.decorators import login_required, user_passes_test
from django.shortcuts import render
from django.template.loader import render_to_string
from dj... | tonioo/modoboa | modoboa/core/views/admin.py | Python | isc | 3,940 |
from django.db import models
from django import forms
from django.core.files.storage import FileSystemStorage
from safecollab import settings
from users.models import User
from datetime import datetime
class Folder(models.Model):
creator = models.ForeignKey(User, related_name='folder_creator')
# group_crea... | mas2tg/cs3240-f16-team07 | reports/models.py | Python | mit | 1,929 |
#!/usr/bin/env pytest
import classad
import htcondor
import logging
import os
import time
from ornithology import *
logger = logging.getLogger(__name__)
logger.setLevel(logging.DEBUG)
@standup
def condor(test_dir):
with Condor(
local_dir=test_dir / "condor",
config={
"COLLECTOR_DE... | htcondor/htcondor | src/condor_tests/test_python_bindings_collector.py | Python | apache-2.0 | 5,842 |
from flask.ext.wtf import Form
from flask.ext.wtf.html5 import EmailField
from wtforms.validators import Required
from wtforms.fields import (
TextAreaField,
HiddenField
)
class LoginForm(Form):
email = EmailField('Email address', validators=[Required()])
next = HiddenField('next')
class FeedbackF... | crossgovernmentservices/csdigital-prototype | application/frontend/forms.py | Python | mit | 402 |
"""
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Copyright (C) 2015 National Institutes of Health
This library is free software; you can redistribute it and/or
modify it under the ... | cnerger/wnd-charm | wndcharm/SingleSamplePrediction.py | Python | lgpl-2.1 | 16,448 |
from django.shortcuts import render
# Create your views here.
from django.http import HttpResponse,HttpResponseRedirect
from restaurante.models import Bar, Tapa
#from restaurante.forms import UserForm, UserProfileForm
from restaurante.forms import UserForm,login_form, BarForm, TapaForm
from django.contrib.auth.decorat... | javiergarridomellado/DAI | restaurante/views.py | Python | gpl-3.0 | 10,877 |
import pytest
pytest.register_assert_rewrite('core.common_fixtures')
| Cerfoglg/cattle | tests/integration/cattletest/core/__init__.py | Python | apache-2.0 | 70 |
# -*- coding: utf-8 -*-
#
# Copyright (C) Pootle contributors.
#
# This file is a part of the Pootle project. It is distributed under the GPL3
# or later license. See the LICENSE file for a copy of the license and the
# AUTHORS file for copyright and authorship information.
import logging
import time
from django.conf... | pavels/pootle | pootle/core/checks/checker.py | Python | gpl-3.0 | 11,937 |
import pytest
from .. import aggregate_purepy, aggregate_numpy_ufunc, aggregate_numpy
try:
from .. import aggregate_numba
except ImportError:
aggregate_numba = None
try:
from .. import aggregate_weave
except ImportError:
aggregate_weave = None
try:
from .. import aggregate_pandas
except ImportError... | ml31415/numpy-groupies | numpy_groupies/tests/__init__.py | Python | bsd-2-clause | 2,023 |
"""
Delete old revision IPs
"""
from optparse import make_option
from django.core.management.base import BaseCommand
from kuma.wiki.tasks import delete_old_revision_ips
class Command(BaseCommand):
help = "Delete old Revision IPs"
option_list = BaseCommand.option_list + (
make_option('--days', dest="d... | biswajitsahu/kuma | kuma/wiki/management/commands/delete_old_revision_ips.py | Python | mpl-2.0 | 529 |
import tensorflow as tf
import numpy as np
import traceback
from .param import Variable, Parameterized, graph_key
from .tf_wraps import clip
from ._settings import settings
float_type = settings.dtypes.float_type
np_float_type = np.float32 if float_type is tf.float32 else np.float64
class MatBias(Parameterized):
d... | fujii-team/Henbun | Henbun/nn.py | Python | apache-2.0 | 3,442 |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
# @Date : 2016/11/22 19:29
# @Author : xycfree
# @Link : http://example.org
# @Version : $
import os
UserAgent = [
'Mozilla/5.0 (Windows NT 5.2) AppleWebKit/534.30 (KHTML, like Gecko) Chrome/12.0.742.122 Safari/534.30',
'Mozilla/5.0 (Windows NT 5.1; rv:5.0) ... | xycfree/py_spider | config/useragent_config.py | Python | gpl-3.0 | 3,567 |
from __future__ import division, absolute_import, unicode_literals
import copy
import fnmatch
import os
import re
from os.path import join
from cola import core
from cola import git
from cola import observable
from cola.decorators import memoize
from cola.git import STDOUT
from cola.compat import ustr
BUILTIN_READER... | takluyver/git-cola | cola/gitcfg.py | Python | gpl-2.0 | 10,838 |
import urllib,urllib2
import xbmc,xbmcplugin,xbmcgui,xbmcaddon
from xml.dom.minidom import parseString
import time,calendar
import re
from common import *
from utils import *
from shareddata import SharedData
import vars
class LiveTV:
@staticmethod
def menu():
addListItem('Watch live', '', 'nbatvlive... | maxgalbu/xbmc.plugin.video.nba | src/nbatvlive.py | Python | gpl-3.0 | 11,114 |
"""
WSGI config for cheddar_oauth_example project.
It exposes the WSGI callable as a module-level variable named ``application``.
For more information on this file, see
https://docs.djangoproject.com/en/1.7/howto/deployment/wsgi/
"""
import os
os.environ.setdefault("DJANGO_SETTINGS_MODULE", "cheddar_oauth_example.se... | cheddarfinancial/cheddar-oauth-demo | cheddar_oauth_example/wsgi.py | Python | mit | 417 |
'''
Have the function MostFreeTime(strArr) read the strArr parameter being passed
which will represent a full day and will be filled with events that span from
time X to time Y in the day. The format of each event will be
hh:mmAM/PM-hh:mmAM/PM. For example, strArr may be ["10:00AM-12:30PM",
"02:00PM-02:45PM","09:10A... | FA810/My_Codes | Python/most_free_time.py | Python | apache-2.0 | 2,924 |
# coding: utf-8
from NXTThread import NXTThread
from time import sleep
class Sensor(NXTThread):
name = None
def __init__(self, robot, port, scan_time = 0.1):
NXTThread.__init__(self)
self.robot = robot
self.scan_time = scan_time
self.port = port
self.value = None
... | Lopt/nxt | NXT/Sensor.py | Python | gpl-2.0 | 846 |
#
# Copyright 2018 Red Hat | Ansible
#
# This file is part of Ansible
#
# Ansible 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.
#
# ... | konstruktoid/ansible-upstream | lib/ansible/module_utils/k8s/common.py | Python | gpl-3.0 | 7,670 |
# This file is part of Grunt Works (https://github.com/m0n5t3r/gruntworks)
# Copyright (c) Sabin Iacob <iacobs@gmail.com>
# All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions
# are met:
# 1. Redistributions of... | m0n5t3r/gruntworks | gruntworks/models.py | Python | bsd-3-clause | 2,284 |
"""Copyright 2008 Orbitz WorldWide
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... | Talkdesk/graphite-web | webapp/graphite/whitelist/views.py | Python | apache-2.0 | 1,960 |
# Generated by the protocol buffer compiler. DO NOT EDIT!
# source: POGOProtos/Enums/PokemonClass.proto
import sys
_b=sys.version_info[0]<3 and (lambda x:x) or (lambda x:x.encode('latin1'))
from google.protobuf.internal import enum_type_wrapper
from google.protobuf import descriptor as _descriptor
from google.protobu... | cglatot/PokeManager | pogo/POGOProtos/Enums/PokemonClass_pb2.py | Python | mit | 1,821 |
import collections
import platform
import random
from typing import Optional
from ray.rllib.execution.replay_ops import SimpleReplayBuffer
from ray.rllib.policy.sample_batch import DEFAULT_POLICY_ID, SampleBatch
from ray.rllib.utils.timer import TimerStat
from ray.rllib.utils.typing import PolicyID, SampleBatchType
... | ray-project/ray | rllib/execution/buffers/mixin_replay_buffer.py | Python | apache-2.0 | 5,623 |
import datetime
import mailman
import mailbox
import numpy as np
from bigbang.thread import Thread
from bigbang.thread import Node
import pandas as pd
import pytz
import utils
def load(path):
data = pd.read_csv(path)
return Archive(data)
class Archive:
"""
A representation of a mailing list archive... | raj4/bigbang | bigbang/archive.py | Python | gpl-2.0 | 6,045 |
from django.conf.urls.defaults import *
# Uncomment the next two lines to enable the admin:
from django.contrib import admin
admin.autodiscover()
urlpatterns = patterns('',
# Example:
# Uncomment the admin/doc line below and add 'django.contrib.admindocs'
# to INSTALLED_APPS to enable admin documentation:... | eloe/megs-bday | core/urls.py | Python | bsd-3-clause | 519 |
"""Implementation of SpaceWiki's wikitext syntax"""
import bleach
from flask import url_for
import peewee
import re
from . import links, directives, markdown
TAG_WHITELIST = [
'ul', 'li', 'ol', 'p', 'table', 'div', 'tr', 'th', 'td', 'em', 'big', 'b',
'strong', 'a', 'abbr', 'aside', 'audio', 'blockquote', 'br'... | spacewiki/spacewiki | spacewiki/wikiformat/__init__.py | Python | agpl-3.0 | 1,468 |
# -*- encoding:utf-8 -*-
from __future__ import print_function
from __future__ import division
import warnings
import matplotlib.pyplot as plt
import numpy as np
import pandas as pd
import seaborn as sns
# noinspection PyUnresolvedReferences
import abu_local_env
import abupy
from abupy import ABuSymbolPd
from abupy i... | bbfamily/abu | python/c4.py | Python | gpl-3.0 | 15,177 |
import os, time, json
from django.test import Client
from django.utils.encoding import force_text
try:
from django.core.urlresolvers import reverse
except ImportError:
from django.urls import reverse
from test_app.models import VideoTesting
from test_suite.test_files import add_base, FileBaseTestCase
class U... | lehins/django-smartfields | tests/test_suite/test_view.py | Python | mit | 3,740 |
from wtforms.fields import TextAreaField
from wtforms.widgets import TextArea
from ..core.ext import admin, AuthModelView
from .models import Page
class WysiwygWidget(TextArea):
def __call__(self, field, **kwargs):
kwargs['class'] = 'span8 textarea'
return super(WysiwygWidget, self).__call__(fiel... | klen/Flask-Foundation | base/pages/admin.py | Python | bsd-3-clause | 685 |
#
# 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
# ... | NeCTAR-RC/heat | heat/api/openstack/v1/views/views_common.py | Python | apache-2.0 | 1,327 |
# Unit 1 Lecture 3 Exercise 2
class Node(object):
def __init__(self, name):
"""Assumes name is a string"""
self.name = name
def getName(self):
return self.name
def __str__(self):
return self.name
class Edge(object):
def __init__(self, src, dest):
... | johntauber/MITx6.00.2x | Unit1/Lecture3Exercise2.py | Python | mit | 2,588 |
from random import randrange
from pygame import *
import project10.config
class SquishSprite(pygame.sprite.Sprite):
def __init__(self, image):
pygame.sprite.Sprite.__init__(self)
self.image = pygame.image.__loader__(image).convert()
self.rect = self.image.get_rect()
screen = pygame... | panda0881/Beginning-Python | project10/objects.py | Python | mit | 1,467 |
import urllib2, json
URL = 'https://www.meethue.com/api/nupnp'
def discover():
response = urllib2.urlopen(URL)
text = response.read()
return json.loads(text)
if __name__ == '__main__':
print discover()
| auduny/chains | lib/chains/services/philipshue/discovery.py | Python | gpl-2.0 | 221 |
from sqlalchemy import Integer, Unicode, Boolean, DateTime, Date, Text, Enum
from sqlalchemy import ForeignKey, Column, BigInteger, Float
from sqlalchemy.ext.declarative import declarative_base
from m3scout.lib.db.db_helper import TableInitiator, DatabaseInitiator
Base = declarative_base(cls=TableInitiator)
class It... | t3ddftw/M3Scout | m3scout/lib/db/m3scout_db.py | Python | mit | 1,031 |
class BinTree:
'''
Root: integer value
Left: BinTree
Right: BinTree
if left and right are both None, the tree is a leaf (an ending node)
'''
def __init__(self, root, left, right):
self.root = root
self.left = left
self.right = right
'''
Converts the Binary Tr... | erocs/2017Challenges | challenge_4/python/hkl0902/Challenge_4.py | Python | mit | 2,324 |
# -*- coding: utf-8 -*-
import os
from setuptools import setup, find_packages
def read(fname):
return open(os.path.join(os.path.dirname(__file__), fname)).read()
setup(
name='py-inspector',
version='0.0.5',
url='https://github.com/maethorin/py-inspector',
license='MIT',
description='Possibi... | Maethorin/py-inspector | setup.py | Python | mit | 1,071 |
# -*- coding: utf-8 -*-
##############################################################################
# For copyright and license notices, see __openerp__.py file in module root
# directory
##############################################################################
import logging
import werkzeug.utils
import werk... | adhoc-dev/odoo-web | login_serial/controllers/main.py | Python | agpl-3.0 | 3,045 |
#!/usr/bin/env python
import os
import sys
from os.path import join, dirname
sys.path.append(join(dirname(__file__), 'src'))
from ez_setup import use_setuptools
use_setuptools()
from setuptools import setup
execfile(join(dirname(__file__), 'src', 'SudsLibrary', 'version.py'))
DESCRIPTION = """
SudsLibrary is a web ... | ombre42/robotframework-sudslibrary | setup.py | Python | apache-2.0 | 1,798 |
#!/usr/bin/env python3
height = 6
width = 7
m_dim_list = [[0 for x in range(width)] for y in range(height)]
for x in range(height):
print(m_dim_list[x][0], m_dim_list[x][1], m_dim_list[x][2], m_dim_list[x][3],
m_dim_list[x][4], m_dim_list[x][5], m_dim_list[x][6])
| michaelneuder/connect_four | app/bin/back_end_scripts/multi_array_practice.py | Python | mit | 278 |
try:
from executable import Executable
from trello_collection import TrelloCollection
from trello_cache import TrelloCache
from card_options import CardOptions
from custom_actions import CustomActions
except ImportError:
from .executable import Executable
from .trello_collection import Trell... | NicoSantangelo/sublime-text-trello | operations.py | Python | mit | 4,290 |
#encoding:utf-8
__authors__ = ['"Wei Keke" <keke.wei@cs2c.com.cn>']
__version__ = "V0.1"
'''
# ChangeLog:
#---------------------------------------------------------------------------------
# Version Date Desc Author
#----------------------------------------------------... | faylau/oVirt3.3WebAPITest | src/TestData/Template/ITC0703030201_CreateTemplateNic_DupName.py | Python | apache-2.0 | 1,564 |
# coding=utf-8
from __future__ import with_statement
from PyWapFetion import Fetion, send2self, send
#仅作参考,详细了解请参考源码
#快速发送:
send2self('手机号', '密码', '信息')
send('手机号', '密码', '接收方手机号', '信息')
#----------------------------------------------------------------------
myfetion = Fetion('手机号', '密码')
myfetion = Fetion('手机号',... | Johnzero/OE7 | OE-debug文件/PyWapFetion-master/example.py | Python | agpl-3.0 | 2,007 |
import datetime
import pytest
from django.core.urlresolvers import reverse
from rest_framework.test import APIClient
from treeherder.model.models import MachinePlatform
from treeherder.perf.models import (PerformanceDatum,
PerformanceFramework,
P... | glenn124f/treeherder | tests/webapp/api/test_performance_data_api.py | Python | mpl-2.0 | 10,100 |
# coding: utf-8
from app import profile
| win0x86/tprofile | tprofile/__init__.py | Python | mit | 41 |
# -*- coding: utf-8 -*-
from mock import patch, MagicMock
from typing import Dict, Text
from zerver.lib.webhooks.git import COMMITS_LIMIT
from zerver.lib.test_classes import WebhookTestCase
class BeanstalkHookTests(WebhookTestCase):
STREAM_NAME = 'commits'
URL_TEMPLATE = u"/api/v1/external/beanstalk"
def... | SmartPeople/zulip | zerver/webhooks/beanstalk/tests.py | Python | apache-2.0 | 10,090 |
# -*- coding: utf-8 -*-
# This file is part of the pymfony package.
#
# (c) Alexandre Quercia <alquerci@email.com>
#
# For the full copyright and license information, please view the LICENSE
# file that was distributed with this source code.
from __future__ import absolute_import;
from pymfony.component.system.oop imp... | pymfony/pymfony | src/pymfony/component/http_kernel/dependency.py | Python | mit | 2,392 |
# -*- coding: utf-8 -*-
# Generated by Django 1.11 on 2017-05-03 03:55
from __future__ import unicode_literals
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('nba_player_news', '0002_auto_20170503_0329'),
]
operations = [
migrations.Add... | jaebradley/nba_player_news | nba_player_news/migrations/0003_subscription_unsubscribed_at.py | Python | mit | 470 |
import os
os.environ["DJANGO_SETTINGS_MODULE"] = "neutron.settings"
from django.core.wsgi import get_wsgi_application
application = get_wsgi_application()
| pizzapanther/Neutron-IDE | wsgi.py | Python | bsd-3-clause | 157 |
n = int(raw_input('Ingrese n: '))
es_primo = True
d = 2
while d < n:
if n % d == 0:
es_primo = False
d = d + 1
if es_primo:
print(n, 'es primo')
else:
print(n, 'es compuesto')
| sebastiandres/iwi131 | ipynb/06-Funciones/iwi131_code/es_primo_v1.py | Python | cc0-1.0 | 200 |
# Copyright (c) 2015-2016 Cisco Systems
#
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the "Software"), to deal
# in the Software without restriction, including without limitation the rights
# to use, copy, modify, merge, publ... | rjfellman/molecule | molecule/verifier/trailing.py | Python | mit | 4,405 |
from binding import *
from src.namespace import llvm
llvm.includes.add('llvm/Target/TargetOptions.h')
TargetOptions = llvm.Class()
@TargetOptions
class TargetOptions:
new = Constructor()
delete = Destructor()
| llvmpy/llvmpy | llvmpy/src/Target/TargetOptions.py | Python | bsd-3-clause | 221 |
#!/usr/bin/python
import sys, re, random
def tokenize(chars):
"Convert a string of characters into a list of tokens."
charsAux = ""
for line in chars:
if not line.startswith(';'):
charsAux += line
return charsAux.replace('(', ' ( ').replace(')', ' ) ').split()
def parse(tokens):
... | Leontes/PlanMiner | Data/Scripts/addNoise.py | Python | gpl-3.0 | 2,840 |
#!/usr/bin/python
# -*- coding: ISO-8859-1 -*-
#
#dxf2gcode_b02_point
#Programmers: Christian Kohlöffel
# Vinzenz Schulz
#
#Distributed under the terms of the GPL (GNU Public License)
#
#dxf2gcode is free software; you can redistribute it and/or modify
#it under the terms of the GNU General Public Licen... | workflo/dxf2gcode | source/Gui/StMove.py | Python | gpl-3.0 | 9,974 |
"""
Django settings for btodolist project.
Generated by 'django-admin startproject' using Django 1.8.13.
For more information on this file, see
https://docs.djangoproject.com/en/1.8/topics/settings/
For the full list of settings and their values, see
https://docs.djangoproject.com/en/1.8/ref/settings/
"""
import os... | alexandr1221/drf-angularjs-todolist | btodolist/settings.py | Python | mit | 5,477 |
# -*- coding: utf-8 -*-
"""Module providing views for the folderish content page type"""
from Acquisition import aq_inner
from Products.Five.browser import BrowserView
from Products.ZCatalog.interfaces import ICatalogBrain
from plone import api
from plone.app.contentlisting.interfaces import IContentListingObject
from ... | a25kk/giri | src/giri.sitecontent/giri/sitecontent/browser/project.py | Python | mit | 3,481 |
from datetime import datetime
from django.conf import settings
from django.contrib import admin
from django.contrib.admin.util import display_for_field, label_for_field, lookup_field
from django.contrib.admin.util import NestedObjects
from django.contrib.admin.views.main import EMPTY_CHANGELIST_VALUE
from django.contr... | disqus/django-old | tests/regressiontests/admin_util/tests.py | Python | bsd-3-clause | 8,095 |
# pylint: disable=unicode-format-string
# coding=utf-8
"""
Check code quality using pycodestyle, pylint, and diff_quality.
"""
from __future__ import absolute_import, print_function
import io
import json
import os
import re
from datetime import datetime
from xml.sax.saxutils import quoteattr
import six
from paver.ea... | ESOedX/edx-platform | pavelib/quality.py | Python | agpl-3.0 | 36,251 |
import os.path
import re
import cx_Oracle
from django.db import connection, models
from django.db.backends.util import truncate_name
from django.core.management.color import no_style
from django.db.backends.oracle.base import get_sequence_name
from django.db.models.fields import NOT_PROVIDED
from south.db imp... | rrmartins/eventex | south/south/db/oracle.py | Python | apache-2.0 | 8,392 |
# SPDX-FileCopyrightText: 2014, Mangaki Authors
# SPDX-License-Identifier: AGPL-3.0-only
from urllib.request import urlopen
import sys
from bs4 import BeautifulSoup
#print(urlopen('http://www.animeka.com/search/index.html?req=%s' % sys.argv[1]).read())
b = BeautifulSoup(urlopen('http://www.animeka.com/search/index.h... | mangaki/mangaki | data/search.py | Python | agpl-3.0 | 674 |
# -*- coding: utf-8 -*-
#
# Copyright 2008 Lin-Chieh Shangkuan & Liang-Heng Chen
#
# 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 ... | tomaash/gaeo | gaeo/controller/helper.py | Python | apache-2.0 | 792 |
"""Taken from chsdi.lib.helpers"""
import unicodedata
def format_search_text(input_str):
return remove_accents(
escape_sphinx_syntax(input_str)
)
def remove_accents(input_str):
if input_str is None: # pragma: no cover
return input_str
input_str = input_str.translate(str.maketrans(... | ioda-net/geo-infra | scripts/helpers.py | Python | agpl-3.0 | 1,149 |
from twisted.internet import reactor
class TimeoutMixin:
"""Mixin for protocols which wish to timeout connections
@cvar timeOut: The number of seconds after which to timeout the connection.
"""
timeOut = None
__timeoutCall = None
def callLater(self, period, func):
return reactor.cal... | twisted/epsilon | epsilon/hotfixes/timeoutmixin_calllater.py | Python | mit | 1,757 |
# Copyright 2021, Kay Hayen, mailto:kay.hayen@gmail.com
#
# Python tests originally created or extracted from other peoples work. The
# parts were too small to be protected.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the ... | kayhayen/Nuitka | tests/type_inference/Test1.py | Python | apache-2.0 | 839 |
from setuptools import setup, find_packages
with open('README.md') as readme:
desc = readme.read()
setup(
name="myfantasyleague",
version="0.1",
packages=find_packages(),
install_requires=['requests'],
author="Matthew Raspberry",
author_email="nixalot@nixalot.com",
description="Python ... | nixalot/python-myfantasyleague | setup.py | Python | bsd-3-clause | 831 |
from axelrod import Player
import random
class Random(Player):
"""A player who randomly chooses between cooperating and defecting."""
name = 'Random'
def strategy(self, opponent):
return random.choice(['C','D'])
| drvinceknight/Axelrod | axelrod/strategies/rand.py | Python | mit | 235 |
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
#
__authors__ = ["Jérôme Kieffer"]
__contact__ = "Jerome.Kieffer@ESRF.eu"
__license__ = "MIT"
__copyright__ = "European Synchrotron Radiation Facility, Grenoble, France"
__date__ = "22/02/2022"
__status__ = "production"
import unittest
from . import utilstest
logger = ut... | kif/dahu | dahu/test/test_cache.py | Python | gpl-2.0 | 1,784 |
'''
Created on Jan 6, 2016
@author: stefan
'''
from parser import stpcommands
from ciphers.cipher import AbstractCipher
from parser.stpcommands import getStringLeftRotate as rotl
class SalsaCipher(AbstractCipher):
"""
Represents the differential behaviour of the Salsa stream cipher by
Daniel J. Bernste... | kste/cryptosmt | ciphers/salsa.py | Python | mit | 5,519 |
#!/usr/bin/env python
########################################
#Globale Karte fuer tests
# from Rabea Amther
########################################
# http://gfesuite.noaa.gov/developer/netCDFPythonInterface.html
import netCDF4
import pylab as pl
import numpy as np
import matplotlib as mpl
import datetime
from netCD... | CopyChat/Plotting | Python/SSR_changes_SWIO/rsds_SWIO_OBS.py | Python | gpl-3.0 | 6,224 |
from django.contrib.auth.models import User
from ws.messages import security
from ws.models import Participant
class PrefetchGroupsMiddleware:
"""Prefetch the user's groups for use in the requset.
We do a lot of group-centric logic - if the user's groups aren't
prefetched, then we can easily have n+1 qu... | DavidCain/mitoc-trips | ws/middleware.py | Python | gpl-3.0 | 1,876 |
# Copyright (c) 2003-2013 LOGILAB S.A. (Paris, FRANCE).
# http://www.logilab.fr/ -- mailto:contact@logilab.fr
#
# 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, o... | hpfem/agros2d | resources/python/pylint/checkers/variables.py | Python | gpl-2.0 | 25,442 |
from __future__ import absolute_import, division, unicode_literals
import json
import logging
import uuid
from cStringIO import StringIO
from flask.ext.restful import reqparse
from sqlalchemy.orm import joinedload, subqueryload_all
from werkzeug.datastructures import FileStorage
from changes.api.base import APIView,... | bowlofstew/changes | changes/api/build_index.py | Python | apache-2.0 | 22,430 |
#!/usr/bin/env python
"""
upoad plugin
Plugin read by omero.cli.Cli during initialization. The method(s)
defined here will be added to the Cli class for later use.
Copyright 2007 Glencoe Software, Inc. All rights reserved.
Use is subject to license terms supplied in LICENSE.txt
"""
import sys, re
fr... | rleigh-dundee/openmicroscopy | components/tools/OmeroPy/src/omero/plugins/upload.py | Python | gpl-2.0 | 2,168 |
# Copyright (c) 2015 Alex Meade
# Copyright (c) 2015 Rushil Chugh
# Copyright (c) 2015 Navneet Singh
# Copyright (c) 2015 Yogesh Kshirsagar
# Copyright (c) 2015 Jose Porrua
# Copyright (c) 2015 Michael Price
# Copyright (c) 2015 Tom Barron
# All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (t... | eharney/cinder | cinder/volume/drivers/netapp/eseries/library.py | Python | apache-2.0 | 91,920 |
from __future__ import print_function
from __future__ import unicode_literals
from __future__ import absolute_import
# pyeq2 is a collection of equations expressed as Python classes
#
# Copyright (C) 2013 James R. Phillips
# 2548 Vera Cruz Drive
# Birmingham, AL 35235 USA
#
# email: zunzun@zunzun.com
#
... | burkesquires/pyeq2 | ExtendedVersionHandlers/__init__.py | Python | bsd-2-clause | 1,324 |
from entrypoint2 import entrypoint
@entrypoint
def add(
strpar="string",
bytespar=b"bytes",
intpar=21,
floatpar=3.14,
boolpar=False,
):
print(f"strpar={repr(strpar)}")
print(f"bytespar={repr(bytespar)}")
print(f"intpar={repr(intpar)}")
print(f"floatpar={repr(floatpar)}")
print(... | ponty/entrypoint2 | entrypoint2/examples/defaultvalues.py | Python | bsd-2-clause | 348 |
#!/usr/bin/env python
# encoding: UTF-8
import requests
class SGK(object):
'''
API : https://haveibeenpwned.com/api/v2/
'''
def __init__(self):
self.url = 'https://haveibeenpwned.com/api/v2/'
def findBreach(self, name):
r = requests.get(self.url + 'breach/' + str(name))
i... | lauixData/leakPasswd | leakPasswd/http.py | Python | mit | 1,336 |
from django.conf import settings
from django.core.exceptions import ImproperlyConfigured
from django.utils.importlib import import_module
__version__ = (0, 0, 1)
try:
conf = settings.PAUTH
except AttributeError:
raise ImproperlyConfigured("django-pauth requires configuration.")
prefer = conf.get('check_first... | spuriousdata/django-pauth | pauth/__init__.py | Python | mit | 833 |
# Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
# SPDX-License-Identifier: Apache-2.0
"""
Stub functions that are used by the Amazon EMR unit tests.
When tests are run against an actual AWS account, the stubber class does not
set up stubs and passes all calls through to the Boto3 client.
"""
fro... | awsdocs/aws-doc-sdk-examples | python/test_tools/emr_stubber.py | Python | apache-2.0 | 5,415 |
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.db import migrations
INDEX_SQL = """
DROP INDEX msgs_inbox;
CREATE INDEX msgs_inbox
ON msgs_message(org_id, created_on DESC)
WHERE is_active = TRUE AND is_handled = TRUE AND is_archived = FALSE AND has_labels = TRUE;
DROP INDEX msgs_unlabel... | xkmato/casepro | casepro/msgs/migrations/0029_folder_indexes_pt3.py | Python | bsd-3-clause | 696 |
#! /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 logging
logger = logging.getLogger(__name__)
import argparse
import numpy as np
import pygame
import cv2
import shootinggallery as ... | mjirik/shooting-gallery | shootinggallery/targets.py | Python | gpl-2.0 | 4,932 |
import os
import subprocess
from string import Template
from damn_at import logger
from damn_at.transcoder import TranscoderException
from damn_at.pluginmanager import ITranscoder
from damn_at.options import IntVectorOption, IntOption, expand_path_template
from damn_at.utilities import script_path, run_blender
cla... | peragro/peragro-at | src/damn_at/transcoders/mesh/blender/text/transcoderblendertext.py | Python | bsd-3-clause | 2,460 |
from pandas.compat import range
import unittest
from numpy import nan
import numpy as np
from pandas.sparse.api import SparseList, SparseArray
import pandas.util.testing as tm
class TestSparseList(unittest.TestCase):
_multiprocess_can_split_ = True
def setUp(self):
self.na_data = np.array([nan, na... | andyraib/data-storage | python_scripts/env/lib/python3.6/site-packages/pandas/sparse/tests/test_list.py | Python | apache-2.0 | 3,921 |
from captcha.fields import ReCaptchaField
from captcha.widgets import ReCaptchaV3
from django import forms
from spirit.user.auth.forms import RegistrationForm as SpiritRegistrationForm
class ViewForumParams(forms.Form):
f = forms.IntegerField(min_value=0)
class ViewTopicParams(forms.Form):
f = forms.Integer... | sirex/ubuntu.lt | ubuntult/forms.py | Python | agpl-3.0 | 478 |
from __future__ import unicode_literals
from mock import Mock
from django.test import TestCase
from django_seo_js.tests.utils import override_settings
from django_seo_js.middleware import EscapedFragmentMiddleware, UserAgentMiddleware, HashBangMiddleware
print(override_settings)
class BaseMiddlewareTest(TestCase):... | skoczen/django-seo-js | django_seo_js/tests/test_middlewares.py | Python | mit | 9,712 |
from __future__ import print_function
import cv2
import glob
import sys
def ground_truth_fns():
"""
Return list of ground truth filenames
"""
return sorted(glob.glob('input_cleaned/*.png'))
def noisy_fns():
"""
Return list of noisy filenames
"""
return sorted(glob.glob('input/*.png')... | jeffsp/kaggle_denoising | jsp/utils.py | Python | mit | 1,809 |
from unittest import TestCase
from jsonschema import validate
import json
def validatejson(body):
with open('schema.json') as json_data:
schema = json.load(json_data)
return validate(json.loads(body), schema)
class EmptyHash(TestCase):
def test(self):
self.assertIsNone(validatejson('{}')... | makyo/polycul.es | test_validation.py | Python | mit | 4,079 |
# !/bin/python
# -*- coding: latin-1 -*-
# Copyright (C) 2009-2014 CEA/DEN, EDF R&D
#
# This library is free software; you can redistribute it and/or
# modify it under the terms of the GNU Lesser General Public
# License as published by the Free Software Foundation; either
# version 2.1 of the License, or (at your opt... | FedoraScientific/salome-hexablock | src/TEST_PY/test_v6/monica.py | Python | lgpl-2.1 | 5,353 |
# -*- coding: utf-8 -*-
"""QGIS Unit tests for QgsActionManager.
.. note:: This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.
"""
... | gioman/QGIS | tests/src/python/test_qgsshortcutsmanager.py | Python | gpl-2.0 | 16,835 |
# -*- coding: utf-8 -*-
"""
Tests compressed data parsing functionality for all
of the parsers defined in parsers.py
"""
import pytest
import pandas as pd
import pandas.compat as compat
import pandas.util.testing as tm
import pandas.util._test_decorators as td
import gzip
import bz2
try:
lzma = compat.import_lz... | cython-testbed/pandas | pandas/tests/io/parser/compression.py | Python | bsd-3-clause | 4,740 |
# -*- coding: utf-8 -*-
# © 2016 Comunitea Servicios Tecnológicos (<http://www.comunitea.com>)
# License AGPL-3 - See http://www.gnu.org/licenses/agpl-3.0.html
from openerp import models, fields
class ScrapReason(models.Model):
_name = 'scrap.reason'
name = fields.Char('Reason')
workcenter_ids = fields.... | Comunitea/CMNT_00040_2016_ELN_addons | production_app/models/scrap_reason.py | Python | agpl-3.0 | 454 |
# coding: utf-8
"""
Selectel DNS API
Simple Selectel DNS API.
OpenAPI spec version: 1.0.1
Contact: info@mdsina.ru
Generated by: https://github.com/swagger-api/swagger-codegen.git
"""
from pprint import pformat
from six import iteritems
import re
class Tag(object):
"""
NOTE: This class... | mdsina/selectel-dns-api | selectel_dns_api/models/tag.py | Python | apache-2.0 | 3,861 |
# -*- coding: utf-8 -*-
# Copyright 2015 OpenMarket Ltd
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable la... | rzr/synapse | synapse/rest/client/v2_alpha/receipts.py | Python | apache-2.0 | 1,642 |
# Copyright 2010-2017, The University of Melbourne
# Copyright 2010-2017, Brian May
#
# This file is part of Karaage.
#
# Karaage 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... | Karaage-Cluster/karaage | karaage/plugins/kgsoftware/tests/fixtures.py | Python | gpl-3.0 | 1,285 |
###############################################################################
##
## Copyright (C) 2011-2013 Tavendo GmbH
##
## 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
##
## h... | wh1100717/AutobahnPython | examples/twisted/wamp/pubsub/custom/client.py | Python | apache-2.0 | 2,157 |
from typing import Union
from math import sqrt, degrees, acos
from .vectors3d import *
from .arrays import *
from .defaults import *
class Quaternion(object):
"""
Quaternion class.
"""
def __init__(self,
w=np.nan,
x=np.nan,
y=np.nan,
... | mauroalberti/gsf | pygsf/mathematics/quaternions.py | Python | gpl-3.0 | 22,452 |
import pytest
import tempfile
import os
import ConfigParser
def getConfig(optionname,thedefault,section,configfile):
"""read an option from a config file or set a default
send 'thedefault' as the data class you want to get a string back
i.e. 'True' will return a string
True will return a bool... | netantho/MozDef | tests/conftest.py | Python | mpl-2.0 | 2,263 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.