code stringlengths 2 1.05M | repo_name stringlengths 5 104 | path stringlengths 4 251 | language stringclasses 1
value | license stringclasses 15
values | size int32 2 1.05M |
|---|---|---|---|---|---|
from __future__ import absolute_import
from django.conf import settings
from django.contrib import messages
from django.http import HttpResponseRedirect
from django.utils.safestring import mark_safe
from django.utils.translation import ugettext_lazy as _
from sentry import constants
from sentry.models import Organiza... | llonchj/sentry | src/sentry/web/frontend/project_notifications.py | Python | bsd-3-clause | 4,114 |
# (C) British Crown Copyright 2010 - 2015, Met Office
#
# This file is part of Iris.
#
# Iris 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 3 of the License, or
# (at your option) any l... | QuLogic/iris | lib/iris/tests/test_file_load.py | Python | gpl-3.0 | 3,064 |
from allauth.socialaccount.tests import OAuth2TestsMixin
from allauth.tests import MockedResponse, TestCase
from .provider import DoubanProvider
class DoubanTests(OAuth2TestsMixin, TestCase):
provider_id = DoubanProvider.id
def get_mocked_response(self):
return MockedResponse(200, """
{"... | Alexander-M-Waldman/local_currency_site | lib/python2.7/site-packages/allauth/socialaccount/providers/douban/tests.py | Python | gpl-3.0 | 838 |
#!/usr/bin/env python
# (c) 2012, Michael DeHaan <michael.dehaan@gmail.com>
# Copyright: (c) 2018, Ansible Project
# GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt)
# PYTHON_ARGCOMPLETE_OK
from __future__ import (absolute_import, division, print_function)
__metaclass__ = type... | mattclay/ansible | lib/ansible/cli/playbook.py | Python | gpl-3.0 | 10,305 |
# coding=utf-8
# Copyright 2015 Pants project contributors (see CONTRIBUTORS.md).
# Licensed under the Apache License, Version 2.0 (see LICENSE).
from __future__ import (absolute_import, division, generators, nested_scopes, print_function,
unicode_literals, with_statement)
import os
from colle... | ericzundel/pants | tests/python/pants_test/goal/test_products.py | Python | apache-2.0 | 4,205 |
# -*- coding: utf-8 -*-
# Part of Odoo. See LICENSE file for full copyright and licensing details.
import account_invoice
import sale_order
import payment
| chienlieu2017/it_management | odoo/addons/website_portal_sale/models/__init__.py | Python | gpl-3.0 | 156 |
import m1
m1.<caret> | jwren/intellij-community | python/testData/completion/underscoredItemsOrderModuleImport/a.py | Python | apache-2.0 | 20 |
from __future__ import unicode_literals
from unittest import expectedFailure
from django.core.exceptions import ImproperlyConfigured
from django.core.urlresolvers import reverse
from django import forms
from django.test import TestCase, override_settings
from django.test.client import RequestFactory
from django.views... | kswiat/django | tests/generic_views/test_edit.py | Python | bsd-3-clause | 17,034 |
import pdb;
import sys;
import linecache
def qdebug(options = None,
expanded = None,
typeformats = None,
individualformats = None,
watchers = None):
class QDebug:
def __init__(self,
options = None,
expanded = None,
... | renatofilho/QtCreator | share/qtcreator/gdbmacros/pdumper.py | Python | lgpl-2.1 | 9,000 |
# -*- coding: utf-8 -*-
"""
***************************************************************************
PointsAlongLines.py
---------------------
Date : Janaury 2015
Copyright : (C) 2015 by Giovanni Manghi
Email : giovanni dot manghi at naturalgis dot pt
**... | rduivenvoorde/QGIS | python/plugins/processing/algs/gdal/PointsAlongLines.py | Python | gpl-2.0 | 5,348 |
# Copyright 2012 James McCauley
#
# This file is part of POX.
#
# POX 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.
#
# POX is distri... | 0xdyu/RouteFlow-Exodus | pox/pox/lib/socketcapture.py | Python | apache-2.0 | 5,511 |
# Licensed to the Apache Software Foundation (ASF) under one
# or more contributor license agreements. See the NOTICE file
# distributed with this work for additional information
# regarding copyright ownership. The ASF licenses this file
# to you under the Apache License, Version 2.0 (the
# "License"); you may not u... | Mega-DatA-Lab/mxnet | example/bi-lstm-sort/lstm_sort.py | Python | apache-2.0 | 3,168 |
"""
Unittests for deleting a course in an chosen modulestore
"""
import unittest
import mock
from opaque_keys.edx.locations import SlashSeparatedCourseKey
from django.core.management import call_command, CommandError
from contentstore.tests.utils import CourseTestCase
from xmodule.modulestore.tests.factories import C... | solashirai/edx-platform | cms/djangoapps/contentstore/management/commands/tests/test_delete_course.py | Python | agpl-3.0 | 2,155 |
# -*- coding:utf-8 -*-
#
#
# Copyright (C) 2013 Michael Telahun Makonnen <mmakonnen@gmail.com>.
# All Rights Reserved.
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU Affero General Public License as published
# by the Free Software Foundation, eit... | microcom/hr | hr_contract_init/hr_contract.py | Python | agpl-3.0 | 10,098 |
# -*- coding: utf-8-*-
import re
import logging
import difflib
import mpd
from client.mic import Mic
# Standard module stuff
WORDS = ["MUSIC", "SPOTIFY"]
def handle(text, mic, profile):
"""
Responds to user-input, typically speech text, by telling a joke.
Arguments:
text -- user-input, typically... | rahul1193/jasper-client | client/modules/MPDControl.py | Python | mit | 12,997 |
#!/usr/bin/python
# -*- coding: utf-8 -*-
#
# (c) 2015, René Moser <mail@renemoser.net>
#
# 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 Lice... | StackPointCloud/ansible-modules-extras | cloud/cloudstack/cs_network.py | Python | gpl-3.0 | 17,539 |
from os.path import join, dirname
import sys
sys.path.append(join(dirname(__file__), '_applibs'))
| rbdedu/runway | singleFileApp/.buildozer/android/app/sitecustomize.py | Python | mit | 98 |
# 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... | wangxiangyu/horizon | openstack_dashboard/dashboards/admin/aggregates/tables.py | Python | apache-2.0 | 5,497 |
from math import sqrt
def flowsnake(level, startX, startY, endX, endY):
if level == 0:
print"g1 f10 x", endX, "y", endY
else:
p1X = (startX * 2 + endX)/3
p1Y = (startY * 2 + endY)/3
p2X = (startX + endX)/2 + (endY - startY)/sqrt(12.0)
p2Y = (startY + endY)/2 - (endX - startX)/sqrt(12.0)
p... | EqAfrica/machinekit | nc_files/flowsnake.py | Python | lgpl-2.1 | 755 |
from unittest import mock, skipUnless
from django.db import connection
from django.db.backends.mysql.features import DatabaseFeatures
from django.test import TestCase
@skipUnless(connection.vendor == 'mysql', 'MySQL tests')
class TestFeatures(TestCase):
def test_supports_transactions(self):
"""
... | nesdis/djongo | tests/django_tests/tests/v22/tests/backends/mysql/test_features.py | Python | agpl-3.0 | 1,590 |
b = bytearray(30)
f = open("io/data/file1", "rb")
print(f.readinto(b))
print(b)
f = open("io/data/file2", "rb")
print(f.readinto(b))
print(b)
# readinto() on writable file
f = open('io/data/file1', 'ab')
try:
f.readinto(bytearray(4))
except OSError:
print('OSError')
| Xykon/pycom-micropython-sigfox | tests/io/file_readinto.py | Python | mit | 276 |
from django.template import TemplateSyntaxError
from django.test import SimpleTestCase
from ..utils import setup
class FirstOfTagTests(SimpleTestCase):
@setup({'firstof01': '{% firstof a b c %}'})
def test_firstof01(self):
output = self.engine.render_to_string('firstof01', {'a': 0, 'c': 0, 'b': 0})
... | wkschwartz/django | tests/template_tests/syntax_tests/test_firstof.py | Python | bsd-3-clause | 3,503 |
tests = "foo"
for t in tests:
try:
for t in []:
print t
except Exception:
continue
| asedunov/intellij-community | python/testData/codeInsight/controlflow/fortrycontinue.py | Python | apache-2.0 | 119 |
# Copyright 2016 The TensorFlow Authors. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applica... | npuichigo/ttsflow | third_party/tensorflow/tensorflow/contrib/learn/python/learn/estimators/svm_test.py | Python | apache-2.0 | 11,485 |
# Copyright (C) 2010 Chris Jerdonek (cjerdonek@webkit.org)
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions
# are met:
# 1. Redistributions of source code must retain the above copyright
# notice, this list of conditions and... | klim-iv/phantomjs-qt5 | src/webkit/Tools/Scripts/webkitpy/common/system/logtesting.py | Python | bsd-3-clause | 9,435 |
# -*- coding: utf-8 -*-
#
# Copyright (C) 2012 The Python Software Foundation.
# See LICENSE.txt and CONTRIBUTORS.txt.
#
"""Access to Python's configuration information."""
import codecs
import os
import re
import sys
from os.path import pardir, realpath
try:
import configparser
except ImportError:
import Conf... | KrzysztofStachanczyk/Sensors-WWW-website | www/env/lib/python2.7/site-packages/pip/_vendor/distlib/_backport/sysconfig.py | Python | gpl-3.0 | 26,964 |
# -*- coding: utf-8 -*-
import os.path
from fabric.api import settings, run, cd, lcd, put, get, local, env, with_settings
from fabric.colors import green
from .. import versions
from .. import distro
from .. import tools
class Deployment(object):
"""The core :class:`Deployment <Deployment>` object. All Fabric ta... | gipi/parcel | parcel/deploy/deploy.py | Python | isc | 10,299 |
# -*- coding: utf-8 -*-
"""Tuple of poolservers
"""
poolservers = (
'nl.pool.ntp.org',
'europe.pool.ntp.org',
'pool.ntp.org',
)
| igroen/ntpdatetime | ntpdatetime/config.py | Python | isc | 141 |
from json import dump
from os import environ
from os.path import expanduser
from sys import argv
from tempfile import NamedTemporaryFile
from django.core.management import execute_from_command_line
def run_installer(title, allowed_settings=None, settings_path="/etc/django.conf"):
if allowed_settings is None:
... | trehn/django-installer | django_installer/__init__.py | Python | isc | 853 |
from __future__ import print_function
from ignoretogether import IgnoreRuleSet
if __name__ == '__main__':
print('Simulation of commands which would be run on example-ruleset.')
rs = IgnoreRuleSet('example', 'example-ruleset.yml')
rs.load()
print('Ruleset installation.')
rs.install()
print('R... | kaniini/ignore-together | tests.py | Python | isc | 365 |
#
# Copyright (c) 2014 Chris Jerdonek. All rights reserved.
#
# 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, modi... | cjerdonek/open-rcv | openrcv/formats/jscase.py | Python | mit | 1,888 |
# -*- coding: utf-8 -*-
import codecs
from anpy.question import parse_question
def test_question_parsing():
xml = codecs.open('tests/resources/questions/q14_14-47351QE.xml').read()
parsing_result = parse_question('http://questions.assemblee-nationale.fr/q14/14-47351QE.htm', xml)
assert ['@TYPE', 'LEGIS... | regardscitoyens/anpy | tests/test_question_parsing.py | Python | mit | 566 |
""" Initialize package """
| SmithSamuelM/openwestdemo | demoing/__init__.py | Python | mit | 28 |
# some simple set up for analysis to avoid repetition
import pandas as pd
import numpy as np
ISO_COUNTRY_CODES = {
'Brazil': 76,
'China': 156,
'India': 356,
'Nigeria': 566
}
FAOSTAT_COUNTRY_CODES = {
'Brazil': 21,
'China': 351,
'India': 100,
'Nigeria': 159
}
ag = pd.read_csv('dump.csv... | NUKnightLab/fao-explorer | data/agri-environmental/analyze.py | Python | mit | 1,744 |
#!/usr/bin/env python
#
# pKaTool - analysis of systems of titratable groups
# Copyright (C) 2010 Jens Erik Nielsen
#
# 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 Lice... | dmnfarrell/peat | pKaTool/pKa_base.py | Python | mit | 9,182 |
# queries to do with module/class/function relationships
from __future__ import generators
from bike.globals import *
from getTypeOf import getTypeOf, getTypeOfExpr
from bike.parsing.newstuff import generateModuleFilenamesInPythonPath, generateModuleFilenamesInPackage, getPythonPath
from bike.parsing.pathutils import g... | srusskih/SublimeBicycleRepair | bike/query/relationships.py | Python | mit | 1,066 |
import argparse
import importlib
import logging
import sys
def global_args(parser):
parser.add_argument('--debug', action='store_true',
help='display debug output')
parser.add_argument('-q', '--quiet', action='store_true',
help='squash all output')
def basic_a... | chuckbutler/git-vendor | gitvendor/cli.py | Python | mit | 2,474 |
import gym
from gym import wrappers
import numpy as np
class Environment:
""" Defines an environment the actor interacts with.
"""
def __init__(self):
""" Initializes an environment.
"""
pass
def next_obs(self, cur_action):
""" Takes an action in the environment.
... | fizz-ml/pytorch-aux-reward-rl | environment.py | Python | mit | 2,569 |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
# Copyright 2018 jem@seethis.link
# Licensed under the MIT license (http://opensource.org/licenses/MIT)
import ruamel.yaml as yaml
import time
import colorama
import intelhex
from pprint import pprint
from hexdump import hexdump as hexdump
import keyplus
from keyplus.co... | ahtn/keyplus | host-software/test_api.py | Python | mit | 8,590 |
from django.views import generic
from django.views.generic.edit import CreateView, UpdateView, DeleteView
from django.core.urlresolvers import reverse_lazy
from .models import Note
from django.shortcuts import redirect
from django.contrib.auth.models import User
from django.shortcuts import render, redirect
fr... | rajujha373/OurNoticeBoardv2.0 | notes/views.py | Python | mit | 4,119 |
"""
unit tests for utils module
"""
import pytest
import raccoon as rc
from raccoon.utils import assert_frame_equal
def test_assert_frame_equal():
df1 = rc.DataFrame({'a': [1, 2, 3], 'b': [4, 5, 6]}, columns=['a', 'b'], index=[1, 2, 3])
assert_frame_equal(df1, df1)
df2 = rc.DataFrame({'a': [1, 1, 1], '... | rsheftel/raccoon | tests/test_dataframe/test_utils.py | Python | mit | 1,893 |
import os
import logging
from zeex.core.compat import QtGui, QtCore
from zeex.core.ui.basic.directory_ui import Ui_DirectoryViewDialog
from zeex.core.views.basic.line_edit import DirectoryPathCreateDialog
from zeex.core.utility.qtdropbox import QtDropBox
from zeex.icons import icons_rc
class DirectoryViewDialog(QtGui... | zbarge/zeex | zeex/core/views/basic/directory.py | Python | mit | 4,664 |
# =============================================================================
# Copyright (c) 2006, Ludo Sapiens Inc.
# All rights reserved.
#
# These coded instructions, statements, and computer programs contain
# unpublished, proprietary information and are protected by Federal copyright
# law. They may not b... | LudoSapiens/Dev | Tools/BS/BuildSystem/Parts/Application.py | Python | mit | 1,143 |
from croplands_api import create_app, db, limiter
from croplands_api.models import User
import unittest
from croplands_api.tasks.classifications import build_classifications_result, \
compute_image_classification_statistics
import json
class TestHighResImage(unittest.TestCase):
app = None
def setUp(self)... | justinwp/croplands | tests/test_high_res_imagery.py | Python | mit | 6,313 |
#!/usr/bin/env python
# standard library imports
import os
import sys
import logging
import argparse
import subprocess
# 3rd party imports
# KBase imports
try:
import biokbase.Transform.script_utils as script_utils
except ImportError:
from . import kbase_utils as script_utils
if sys.version.startswith('3')... | kbase/transform | plugins/scripts/upload/trns_transform_TSV_SampleProperty_to_KBaseEnigmaMetals_SamplePropertyMatrix.py | Python | mit | 7,966 |
"""
Generate dungeon using BSP algorithm
"""
import random
import sys
from utils import Box, Point
class Dungeon(object):
"""
Driver object for building the dungeon
"""
def __init__(self, x_max, y_max, room_min=3, edge_min=1, max_depth=4):
self.x_max = x_max
self.y_max = y_max
... | not-napoleon/mazes | bsp.py | Python | mit | 8,744 |
#Brian Stamm
#CSC - 110
#Howework 8 - Encryption/Decryption
#11.18.14
import sys
import os
INSTRUCTION_CHOICE = 1 #GLOBAL CHOICES
DECRYPT_CHOICE = 2
ENCRYPT_CHOICE = 3
QUIT_CHOICE = 4
LETTERS = 'abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789.!?,\'\";:-' #GLOBAL LIST - contains all lett... | bkstamm67/python | pastHW/encrypt.py | Python | mit | 5,310 |
import logging
from multiprocessing import Queue
from multiprocessing.managers import DictProxy
from time import time
from typing import Dict, List, Union, Any, Iterable
import numpy as np
from Engine.Communication.robot_state import RobotState
from Engine.Tracker.Filters import RobotFilter
from Engine.Tracker.Filte... | RoboCupULaval/StrategyIA | Engine/Tracker/tracker.py | Python | mit | 10,914 |
#!/usr/bin/env python
from ithkuil.morphology.words import Factory
from ithkuil.morphology.exceptions import IthkuilException
import sys
words = sys.argv[1:]
if not words:
words = sys.stdin.read().split()
for word in words:
try:
wordObj = Factory.parseWord(word)
print(wordObj.word, ':', wordO... | fizyk20/ithkuil | gloss_sentence.py | Python | mit | 427 |
"""
Example gevent server loop
Might add config switches etc here later, to make this work
with custom settings and handlers.
"""
import gevent.monkey
gevent.monkey.patch_thread()
from gevent.server import StreamServer
from gmcbs.protocol import ClientHandler
import logging
import socket
import sys
def tcp_keepaliv... | jvtm/gevent-memcached-server | gmcbs/server.py | Python | mit | 2,911 |
# -*- coding: utf-8 -*-
import io
import sys
import json
import ast
import operator
from itertools import islice
from sklearn.feature_extraction.text import CountVectorizer
from sklearn import svm
from ate_rule_learn import write_json
CONST_SENTENCE = "SENTENCE"
CONST_ASPECT_TERMS = "ASPECT_TERMS"
CONST_ASPECT_TERMS_... | pnisarg/ABSA | src/ats_svm_detect.py | Python | mit | 13,147 |
from __future__ import division
import numpy as np
import scipy.stats as stats
import scipy as sp
import logging
def calc_nbins(x, maximum=150):
n = (max(x) - min(x)) / (2 * len(x)**(-1/3) * (np.percentile(x, 75) - np.percentile(x, 25)))
return min(n, maximum)
def poisson_limits(N, kind, confidence=0.6827):... | ibab/missing_hep | missing_hep/plotting.py | Python | mit | 2,154 |
#\begin{align*}
#c \int_A \left[ \phi \hat u + \psi \hat v + \varphi \hat \eta \right] \, dA
#& = \int_A \left( \overline u \phi - \frac{1}{Ro k^2} \psi
#+ \frac{1}{Ro} \overline h \varphi \right) \hat u \, dA \\
#& = \int_A \left( (\partial_y \overline u - \frac{1}{Ro}) \phi + \overline u \psi - \frac{1}{Ro... | francispoulin/firedrakeQG | LSA_SW_Jet_Firedrake.py | Python | mit | 4,284 |
import logging
from urlparse import urlparse
from django.dispatch import Signal
from corsheaders import signals
from readthedocs.projects.models import Project, Domain
log = logging.getLogger(__name__)
WHITELIST_URLS = ['/api/v2/footer_html', '/api/v2/search', '/api/v2/docsearch']
webhook_github = Signal(providin... | tddv/readthedocs.org | readthedocs/core/signals.py | Python | mit | 1,712 |
# -*- coding: utf-8 -*-
import random;
class PsychComponentBase:
def __init__(self,
NumAFC = 1,
GiveFeedback = False,
Conditions = None,
OutputFile = ''):
# start the random number generator
random.seed();
# These are all the parameters that are common to all procedures
self._NumAFC = NumAF... | lugtigheid/PychophysicsLibrary | pycholib/PsychComponentBase.py | Python | mit | 1,733 |
"""
Investigate how to reconstruct parameters from scarce information
"""
import sys
from datetime import datetime
import numpy as np
import networkx as nx
from tqdm import tqdm, trange
from system import System
from reconstruction import Reconstructor
from visualization import show_reconstruction_overview
class ... | kpj/OsciPy | main.py | Python | mit | 2,996 |
from django import template
from package.context_processors import used_packages_list
register = template.Library()
class ParticipantURLNode(template.Node):
def __init__(self, repo, participant):
self.repo = template.Variable(repo)
self.participant = template.Variable(participant)
def ren... | pydanny/djangopackages | package/templatetags/package_tags.py | Python | mit | 1,551 |
from mcstat.domain import Metric
def metrics(timestamp, interval, channel, aggr):
"""
:param timestamp: Timestamp of the metric.
:type timestamp: Unix time (time.time)
:param channel: The channel.
:type channel: (string ip, port)
:param interval: Lenght of time over which samples were collecte... | mstarzyk/mcstat | src/mcstat/stat.py | Python | mit | 641 |
__author__ = 'massimo'
__all__ = ["Miner"] | yangsibai/SiteMiner | SiteMiner/__init__.py | Python | mit | 43 |
from eul019 import is_leap_year, days_in_months
def test_is_leap_year():
input_true = [1904, 1908, 1912, 2000, 2004]
input_false = [1900, 1901, 1902, 1903, 1905]
for i in input_true:
assert( is_leap_year(i) == True)
for i in input_false:
assert( is_leap_year(i) == False)
def test_day... | henry808/euler | 019/test_019.py | Python | mit | 931 |
# Copyright 2014 BitPay, Inc.
# Copyright (c) 2015-2018 The PIVX developers
# Copyright (c) 2018 The Ion developers
# Distributed under the MIT/X11 software license, see the accompanying
# file COPYING or http://www.opensource.org/licenses/mit-license.php.
import subprocess
import os
import json
import sys
def bctest... | mitchellcash/ion | src/test/bctest.py | Python | mit | 1,562 |
from ArnoldCat import ArnoldCat
import matplotlib.pyplot as plt
import math
def tracerT(Nmax, Nmin=1, p=1, q=1):
file = open('store.txt', 'w')
for i in xrange(Nmin,Nmax+1):
arnoldCat = ArnoldCat(i, None, None, p, q)
T = arnoldCat.calculerT()
print>>file, T
print('N = '+str(i)+'... | darkpudding/Projet-Fractal | ArnoldCatPeriod.py | Python | mit | 1,788 |
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.db import models, migrations
import datetime
from django.conf import settings
class Migration(migrations.Migration):
dependencies = [
('sites', '0001_initial'),
migrations.swappable_dependency(settings.AUTH_USER_MODEL),
... | codefisher/djangopress | djangopress/blog/migrations/0001_initial.py | Python | mit | 7,697 |
from __future__ import absolute_import
# Copyright (c) 2010-2015 openpyxl
import datetime
import decimal
from io import BytesIO
from zipfile import ZipFile
from tempfile import TemporaryFile
from openpyxl.xml.functions import tostring, xmlfile
from openpyxl.utils.indexed_list import IndexedList
from openpyxl.utils.... | cgimenop/Excel2Testlink | ExcelParser/lib/openpyxl/writer/tests/test_write_only.py | Python | mit | 9,274 |
# Copyright (c) 2011 Florian Mounier
# Copyright (c) 2012, 2014-2015 Tycho Andersen
# Copyright (c) 2013 Mattias Svala
# Copyright (c) 2013 Craig Barnes
# Copyright (c) 2014 ramnes
# Copyright (c) 2014 Sean Vig
# Copyright (c) 2014 Adi Sieker
# Copyright (c) 2014 Chris Wesseling
#
# Permission is hereby granted, free o... | ramnes/qtile | test/layouts/test_stack.py | Python | mit | 8,291 |
#! /usr/bin/env python
from random import choice
class Sieve:
@staticmethod
def __numbers(upper_bound):
ns = [ (n, []) for n in range(1, upper_bound) ]
ns[0][1].append(0)
return ns
@staticmethod
def __next_current_index(numbers, current_index):
current_index += 1
... | dvberkel/erotosthenes | sieve.py | Python | mit | 1,376 |
# This file is autogenerated. Do not edit it manually.
# If you want change the content of this file, edit
#
# spec/fixtures/responses/whois.nic.fr/tf/property_status_frozen
#
# and regenerate the tests with the following script
#
# $ scripts/generate_tests.py
#
from nose.tools import *
from dateutil.parser impor... | huyphan/pyyawhois | test/record/parser/test_response_whois_nic_fr_tf_property_status_frozen.py | Python | mit | 923 |
#!/usr/bin/python3
print("Content-Type: text/html")
print()
import json
import MySQLdb
import sys
import wiki
import ssl
import cgi
import calculator
import nlp
def analyze(data):
query = nlp.process(data)
response = {}
if(query['type'] == "wiki"):
response = encyclopedia(query['subject'])
if(query['type'] == "... | apoorvapacharne/Darsy | python/main.py | Python | mit | 1,872 |
"""
Metrics implementation.
Author: Evgeny Sergeev, 471
"""
import math
from model import get_user_vector, rate_prediction
def calculate_error(data, test_songs, f):
"""
The subsidiary function for MAE and RMSE metrics.
"""
number_of_rates = 0
sum_of_rates = 0.0
all_users = data.keys()
f... | MaKToff/SPbSU_Homeworks | Semester 7/Recommender system/metrics.py | Python | mit | 2,196 |
### -*- coding: utf-8 -*- ####################################################
from django.contrib.contenttypes.models import ContentType
def default_upload_to(instance, file_name):
app_label, model = ContentType.objects.get_for_model(instance).natural_key()
return 'uploads/%s/%s/%s_%s' % (app_label, model, i... | Arpaso/django-banner-simple | src/banner/utils.py | Python | mit | 350 |
import warnings
import tensorflow as tf
from keras.models import Model
from keras.layers import Flatten
from keras.layers import Dense
from keras.layers import Input
from keras.layers import Reshape
from keras.layers import Lambda
from keras.layers import Conv2D
from keras.layers import MaxPooling2D
from keras.layer... | kaykanloo/msc-project | Code/Models/BaselineUpSample.py | Python | mit | 1,743 |
# -*- coding: utf-8 -*-
# @Author: jerry
# @Date: 2018-02-01 22:57:12
# @Last Modified by: jerry
from functools import lru_cache
@lru_cache(maxsize=32)
def fib(n):
if n < 2:
return n
return fib(n-1) + fib(n-2)
print([fib(n) for n in range(10)])
# Output: [0, 1, 1, 2, 3, 5, 8, 13, 21, 34]
"""
fr... | tencrance/cool-config | python3/new_feature.py | Python | mit | 1,286 |
def to_bool(s):
"""Convert given string into bool value. Defaults to False.
"""
return (s or '').lower() in ['1', 'y', 'yes', 't', 'true']
| ikumen/bits | backend/app/helpers.py | Python | mit | 152 |
from __future__ import unicode_literals
from django.core.exceptions import ObjectDoesNotExist
from djblets.util.decorators import augment_method_from
from djblets.webapi.decorators import (webapi_login_required,
webapi_response_errors,
webap... | chipx86/reviewboard | reviewboard/webapi/resources/review_diff_comment.py | Python | mit | 12,421 |
# -*- coding: utf-8 -*-
# Generated by Django 1.9 on 2015-12-25 06:29
from __future__ import unicode_literals
from django.db import migrations, models
import django.db.models.deletion
import jsonfield.fields
class Migration(migrations.Migration):
initial = True
dependencies = [
]
operations = [
... | livingbio/weather-parser | src/weather_parser/migrations/0001_initial.py | Python | mit | 1,726 |
__author__ = 'silvia'
import difflib
from collections import Counter, defaultdict
#from nltk.tokenize import word_tokenize
import csv
def csv_from_tuplelist(csvfile, tuplelist):
"""
create a csv file from a dictionary with a tuple list
"""
csv_name = open(csvfile, 'w', encoding='latin1', newline='')
... | silviaegt/bdcv_metadata | Clustering/CountDiff.py | Python | mit | 4,073 |
import pytest
from taichi.lang import impl
import taichi as ti
from tests import test_utils
_TI_TYPES = [ti.i8, ti.i16, ti.i32, ti.u8, ti.u16, ti.u32, ti.f32]
_TI_64_TYPES = [ti.i64, ti.u64, ti.f64]
def _test_type_assign_argument(dt):
x = ti.field(dt, shape=())
@ti.kernel
def func(value: dt):
x... | yuanming-hu/taichi | tests/python/test_types.py | Python | mit | 3,515 |
"""
Copyright 2013 Steven Diamond
This file is part of CVXPY.
CVXPY 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.
CVXPY is distributed i... | riadnassiffe/Simulator | src/tools/ecos/cvxpy/cvxpy/atoms/elementwise/inv_pos.py | Python | mit | 2,063 |
# -*- coding: UTF-8 -*-
# (c)2013 Mik Kocikowski, MIT License (http://opensource.org/licenses/MIT)
# https://github.com/mkocikowski/esbench
import sys
import os.path
import unittest
import logging
import estools.common.log as log
log.set_up_logging(level=logging.ERROR)
def suite():
return unittest.defaultTestL... | mkocikowski/estools | estools/test/units.py | Python | mit | 719 |
from ._abstract import AbstractScraper
class CookEatShare(AbstractScraper):
@classmethod
def host(cls):
return "cookeatshare.com"
def title(self):
return self.schema.title()
def total_time(self):
return None
def image(self):
return self.schema.image()
def in... | hhursev/recipe-scraper | recipe_scrapers/cookeatshare.py | Python | mit | 449 |
import tensorflow as tf
import sys
# change this as you see fit
image_path = sys.argv[1]
# Read in the image_data
image_data = tf.gfile.FastGFile(image_path, 'rb').read()
# Loads label file, strips off carriage return
label_lines = [line.rstrip() for line
in tf.gfile.GFile("./tf_files/retrained_labels... | moshfiqur/shoes-classifier | label_image.py | Python | mit | 1,127 |
from utils import get_sidereal_time
from process import open_fits, flatten_max, DataProcessor
import dateutil.parser
import os, shutil
dp = DataProcessor()
dp.outdir = 'test/out'
dp.verbose = 1
st = '0429'
path_end = os.path.join(st[0:2], st[2:4])
path = os.path.join('sid', path_end)
night = os.listdir(path)
dp.do_t... | Bjwebb/detecting-clouds | test-sid.py | Python | mit | 988 |
#! /usr/bin/env python
#from exception import exception
import re
"""
Python class that parses a perftable file from GoldenGate
see 'help(perfTableParser.perfTableParser)' for details
"""
class localException(Exception):
pass
class perfTableParser:
"""
Classe permettant de parser les fichiers de ... | trilomix/kmappy | perfTableparser.py | Python | mit | 11,141 |
# -*- coding: utf-8 -*-
#
# Copyright 2016 Eduardo Frazão ( https://github.com/fr4z40 )
#
# Licensed under the MIT License;
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# https://opensource.org/licenses/MIT
#
class mailextract(list):
@sta... | Python-Devs-Brasil/py-mailgrabber | pymg_pkg/mailextract.py | Python | mit | 2,330 |
if __name__ == '__main__':
input('\nPress ENTER to continue\n')
| wairton/zephyrus-mas | zephyrus/pause.py | Python | mit | 68 |
import requests
import sys
import argparse
from requests.exceptions import ConnectionError
def get_url_info(short_url):
'''Gets info about the url'''
try:
response = requests.get(short_url)
url_info = {}
url_info['status'] = response.status_code
url_info['url'] = response.url
... | tomaslu/url_lengthener | url_lengthener/url_lengthener.py | Python | mit | 867 |
import os
from setuptools import setup
setup(
name='sim2net',
version='3.1.2',
author='Michal Kalewski <mkalewski at cs.put.poznan.pl>',
description='Simple Network Simulator (sim2net) is a discrete event '\
'simulator of mobile ad hoc networks (MANETs).',
long_description=open("RE... | mkalewski/sim2net | setup.py | Python | mit | 775 |
"""Gopher protocol client interface."""
__all__ = ["send_selector","send_query"]
# Default selector, host and port
DEF_SELECTOR = '1/'
DEF_HOST = 'gopher.micro.umn.edu'
DEF_PORT = 70
# Recognized file types
A_TEXT = '0'
A_MENU = '1'
A_CSO = '2'
A_ERROR = '3'
A_MACBINHEX = '4'
A_PCBIN... | MalloyPower/parsing-python | front-end/testsuite-python-lib/Python-2.2/Lib/gopherlib.py | Python | mit | 5,567 |
from string import maketrans
ori = 'Of zit kggd zitkt qkt ygxk ortfzoeqs wqlatzwqssl qfr zvg ortfzoeqs yggzwqssl. Fgv oy ngx vqfz zg hxz zitd of gft soft, piv dgfn lgsxzogfl qkt zitkt? Zohl: hstqlt eiqfut zit ygkd gy zit fxdwtk ngx utz. Zit Hkgukqddtkl!'
def ali_decode(letter):
t=maketrans("qwertyuiopasdfghjklzx... | Akagi201/learning-python | puzzle/aliyun20151111.py | Python | mit | 411 |
from pyndn import Interest
from pyndn import Data
from pyndn import Exclude
from pyndn import Name
from pyndn import Face
from pyndn import InterestFilter
from pyndn.security import KeyChain
import os
lastChunk_window = 0
lastChunk_sent = 0
def extractData_message(path, fileName, data):
payload = data.getContent... | AdL1398/PiCasso | source/modules/tools/ndnMessage_Helper.py | Python | mit | 4,025 |
# -*- coding: utf-8 -*- #
from __future__ import unicode_literals
"""
French typography
"""
import re
from .base import base_replacements
__all__ = ('replacements',)
ch = r'A-Za-z\u00C0-\u02FF\u0370-\u1EFF'
replacements = base_replacements + (
# double ""
(
re.compile(r'(?<!"|\w)"(?! |")((?:[^"... | honzajavorek/tipi | tipi/langs/fr.py | Python | mit | 603 |
# -*- coding: utf-8 -*-
#
# Antes de executar:
#
# > pip install requests
#
#
import sys
import requests
from requests.packages.urllib3.exceptions import InsecureRequestWarning
from requests.auth import HTTPBasicAuth
import xml.etree.ElementTree as ET
CONNECTIONS_HOST = 'https://connections.<company>.com'
CONNECTIONS_... | ebasso/rest-client-examples | ibm-connections/ListBlogPosts.py | Python | mit | 4,246 |
from proteus import Domain, Context
from proteus.mprans import SpatialTools as st
from proteus import Gauges as ga
from proteus import WaveTools as wt
from math import *
import numpy as np
from proteus.mprans import BodyDynamics as bd
opts=Context.Options([
# predefined test cases
("water_level", 0.19, "Height... | erdc-cm/air-water-vv | 2d/waveOvertopping/OliveiraEtAl2012/OliveiraOvertopping.py | Python | mit | 17,581 |
from scapy.all import *
import time
def record_press():
print "Pushed button"
data = {
"Timestamp": time.strftime("%Y-%m-%d %H:%M"),
}
print data
def arp_display(pkt):
if pkt[ARP].op == 1:
# ARP Probe
if pkt[ARP].psrc == '0.0.0.0':
print pkt[ARP].hwsrc
... | LocalhostAPI/dashbutton | app4.py | Python | mit | 603 |
# what data to operate on
base_where_clause = "WHERE `source`='jhu-csse' AND `time_type`='day'"
### base_where_clause = "WHERE `source`='src2' AND `time_type`='day'" ###
# signal name construction
# NOTE: selecting these (unique) from the database takes 7-8 mins, so reconstructing here for efficiency
# TODO: maybe ju... | cmu-delphi/delphi-epidata | src/acquisition/covidcast/generate_islatest_fix_sql.py | Python | mit | 2,959 |
# Generated by Django 2.2.1 on 2019-08-09 00:49
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('quotations', '0001_initial'),
]
operations = [
migrations.CreateModel(
name='Tag',
fields=[
('id', m... | jessamynsmith/underquoted | quotations/migrations/0002_auto_20190808_2049.py | Python | mit | 677 |
"""
Unit tests for genome_annotation
"""
import logging
from unittest import skipUnless
from . import shared
from doekbase.data_api.annotation.genome_annotation import GenomeAnnotationAPI
from doekbase.data_api.sequence.assembly import AssemblyAPI
from doekbase.data_api.taxonomy.taxon.api import TaxonAPI
_log = logg... | realmarcin/data_api | lib/doekbase/data_api/tests/test_genome_annotation_api.py | Python | mit | 17,000 |
__author__ = 'mriegel'
from django.contrib import admin
from models import *
class CurrencyAdmin(admin.ModelAdmin):
list_display = ('name', 'sign', 'base_rate', )
pass
class CurrencyExchangeRateAdmin(admin.ModelAdmin):
list_display = ('date', 'rate', )
class CompanyAdmin(admin.ModelAdmin):
list_d... | mrcrgl/stockstore | app/admin.py | Python | mit | 1,640 |
# -*- coding: utf-8 -*-
# python-holidays
# ---------------
# A fast, efficient Python library for generating country, province and state
# specific sets of holidays on the fly. It aims to make determining whether a
# specific date is a holiday as fast and flexible as possible.
#
# Authors: dr-prodigy <maurizio.... | dr-prodigy/python-holidays | test/countries/test_germany.py | Python | mit | 12,969 |
class BaseModel(object):
def __eq__(self, other):
return type(self) == type(other) and self.deep_eq_dict(self.__dict__, other.__dict__)
def deep_eq_dict(self, a, b):
if a.keys() != b.keys():
return False
for k in a.keys():
if type(k) == dict:
if ... | maveron58/indiana | models/base/base_model.py | Python | mit | 481 |