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 |
|---|---|---|---|---|---|
#!/usr/bin/env python
"""This is for cleaning up binary files improperly added to CVS. This script
scans the given path to find binary files; checks with CVS to see if the sticky
options are set to -kb; finally if sticky options are not -kb then uses 'cvs
admin' to set the -kb option.
This script ignores CVS director... | yuzhichang/pexpect | examples/fix_cvs_files.py | Python | mit | 3,020 |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
#
# mk-docktest-01.py 2014-10-30 1.1
# (C) Mikhail (myke) Kolodin, 2104
# test own tests acc to ofic docs - OK
import time
import docker
import psutil
from pprint import pprint as pp
def main1():
try:
print "making client, ",
c = docker.Client(base_url... | mykespb/docking | tests/test-01/mk-docktest-01.py | Python | lgpl-3.0 | 5,642 |
"""This module defines the classes BalMask and Dla used in the
masking of DLAs"""
import logging
from astropy.table import Table
import fitsio
import numpy as np
from picca.delta_extraction.astronomical_objects.forest import Forest
from picca.delta_extraction.errors import MaskError
from picca.delta_extraction.mask i... | igmhub/picca | py/picca/delta_extraction/masks/bal_mask.py | Python | gpl-3.0 | 8,113 |
import math, pdb
def load_counts(ifile):
counts = {}
total_kmers = 0.0
with open(ifile) as iinput:
for line in iinput:
word, count = line.strip().split('\t')
word = word[1:-1]
count = int(count)
counts[word] = float(count + 1) # the +1 implements add-... | iarroyof/lxmls-toolkit | lxmls/big_data/postprocess.py | Python | mit | 1,523 |
import urllib,urllib2,re,string
import xbmc,xbmcplugin,xbmcgui,xbmcaddon
import os
import unicodedata
import time
from xml.dom.minidom import parse
from time import strftime,sleep
from datetime import date
if sys.version_info >= (2, 7):
import json as _json
print "****XBMC python version (sys.version... | gasinger/plugin.video.sagetv | default.py | Python | gpl-2.0 | 55,730 |
# 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 ... | lmazuel/azure-sdk-for-python | azure-mgmt-network/azure/mgmt/network/v2017_03_01/models/usage_paged.py | Python | mit | 917 |
from typing import Callable, List, Optional, Tuple
import numpy as np
import phidl.device_layout as pd
from gdsfactory.component import Component, ComponentReference
from gdsfactory.components.bend_euler import bend_euler
from gdsfactory.components.straight import straight as straight_function
from gdsfactory.compone... | gdsfactory/gdsfactory | gdsfactory/routing/route_south.py | Python | mit | 9,266 |
from .AchievementListener import AchievementListener
from models.popups import Popup
class AchievementManager(object):
def __init__(self, popups):
self._achievements = {}
self._listeners = []
self._popups = popups
def __iter__(self):
for achievement in self._achievements.value... | kfcpaladin/sze-the-game | game/models/achievements/AchievementManager.py | Python | mit | 1,635 |
from __future__ import absolute_import
import pytest
import logging
import re
import mock
from tornado import gen
from tornado.ioloop import PeriodicCallback, IOLoop
from tornado.httpclient import HTTPError
import bokeh.server.server as server
from bokeh.application import Application
from bokeh.application.handle... | phobson/bokeh | bokeh/server/tests/test_server.py | Python | bsd-3-clause | 16,586 |
# -*- coding: utf-8 -*-
import csv
import urllib
import json
from collections import defaultdict
import pickle
import re
files = {
"male":
{
"old": "UN_POP/UN_POP_FEMALE/ESTIMATES-Table 1.csv",
"prev": "UN_POP/UN_POP_FEMALE_PREV/MEDIUM-Table 1.csv"
},
"female":
... | bctclc/PopulationPyramid.net | 2010/parser.py | Python | mit | 3,367 |
import os, stat
from flask_defaults import *
from base import *
### Import configuration from the current environment
env = os.environ.get('SECUREDROP_ENV')
# default env is 'production'
env = env or DEFAULT_ENV
if env == 'test':
from test import *
if env == 'development':
from development import *
if env == 'p... | beni55/securedrop | securedrop/config/__init__.py | Python | gpl-2.0 | 1,089 |
#! /usr/bin/env python
## -*- Mode: python; py-indent-offset: 4; indent-tabs-mode: nil; coding: utf-8; -*-
#
# Copyright (c) 2009 University of Washington
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License version 2 as
# published by the Free ... | kronat/ns-3-dev-git | test.py | Python | gpl-2.0 | 80,507 |
"""
FEniCS tutorial demo program: Poisson equation with Dirichlet conditions.
As d2_p2D.py, but LinearVariationalProblem and LinearVariationalSolver
are used instead of the solve(a == L, u, bc) call in d2_p2D.py.
-Laplace(u) = f on the unit square.
u = u0 on the boundary.
u0 = u = 1 + x^2 + 2y^2, f = -6.
"""
from __f... | MiroK/dolfin | test/unit/python/book/chapter_1_files/stationary/poisson/d3_p2D.py | Python | gpl-3.0 | 1,535 |
# -*- coding: utf-8 -*-
#
# Sensor Widgets documentation build configuration file, created by
# sphinx-quickstart on Fri Sep 4 12:48:01 2015.
#
# 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... | oscarfonts/sensor-widgets | doc/ca/conf.py | Python | mit | 9,203 |
from __future__ import (absolute_import, division, print_function)
import glob, os, sys
test_files = glob.glob('*.py')
test_files.remove('run_all.py')
test_files.remove('allskymap.py')
test_files.remove('fcstmaps.py')
test_files.remove('fcstmaps_axesgrid.py')
test_files.remove('testgdal.py')
test_files.remove('animate... | matplotlib/basemap | examples/run_all.py | Python | mit | 1,481 |
# -*- coding: utf-8 -*-
''' Used to extract attachment ids from html files in ./html folder.
Extracted ids are saved in ./pickle folder'''
from urllib import parse
import os, re, pickle
from config import path
attachment = re.compile(r'''<a href="attachment\.php\?aid=(\d+)" target="_blank">''')
failcnt = 0
ai... | Nymphet/sexinsex-crawler | page_aids_extractor.py | Python | apache-2.0 | 1,319 |
#!/usr/bin/env python
# encoding: utf-8
"""
remove_dups_from_sorted_list_ii.py
Created by Shengwei on 2014-07-05.
"""
# https://oj.leetcode.com/problems/remove-duplicates-from-sorted-list-ii/
# tags: medium, linked-list, pointer, dups, edge cases
"""
Given a sorted linked list, delete all nodes that have duplicate n... | CodingVault/LeetCodeInPython | remove_dups_from_sorted_list_ii.py | Python | apache-2.0 | 2,026 |
# 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... | mlperf/training_results_v0.6 | Fujitsu/benchmarks/resnet/implementations/mxnet/tests/python/unittest/test_sparse_operator.py | Python | apache-2.0 | 113,121 |
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.db import models, migrations
class Migration(migrations.Migration):
dependencies = [
('cms', '0001_initial'),
]
operations = [
migrations.CreateModel(
name='IframePlugin',
fields=[
... | satyrius/cmsplugin-iframe | cmsplugin_iframe/migrations/0001_initial.py | Python | mit | 674 |
class MockConn:
def __init__(self, name, config):
self.name = name
self.config = config
def test_manager_load():
import cloudbot.permissions
from cloudbot.permissions import PermissionManager
manager = PermissionManager(MockConn('testconn', {}))
assert not manager.group_perms
... | tiredtyrant/CloudBot | tests/core_tests/test_permission_manager.py | Python | gpl-3.0 | 3,424 |
#
# 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 us... | obulpathi/spark | python/io/cassandra_outputformat.py | Python | apache-2.0 | 3,245 |
import time
import os
from watchdog.observers import Observer
from watchdog.observers.polling import PollingObserver# as Observer
from watchdog import events
from watchdog.tricks import LoggerTrick
import argparse
import logging
import random
logger = logging.getLogger('watchntouch')
class PollingHandler(events.Fi... | rubyruy/watchntouch | watchntouch.py | Python | bsd-2-clause | 4,238 |
# -*- coding: utf-8 -*-
"""
***************************************************************************
RUtils.py
---------------------
Date : August 2012
Copyright : (C) 2012 by Victor Olaya
Email : volayaf at gmail dot com
********************************... | mweisman/QGIS | python/plugins/processing/r/RUtils.py | Python | gpl-2.0 | 6,647 |
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('employee', '0003_position_owner'),
]
operations = [
migrations.AlterField(
model_name='position',
na... | luiscberrocal/homeworkpal | homeworkpal_project/employee/migrations/0004_auto_20151026_1823.py | Python | mit | 471 |
#!/usr/bin/env python
#
# Copyright 2004,2007,2008,2010 Free Software Foundation, Inc.
#
# This file is part of GNU Radio
#
# GNU Radio 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, or (at ... | manojgudi/sandhi | modules/gr36/gnuradio-core/src/python/gnuradio/gr/qa_boolean_operators.py | Python | gpl-3.0 | 6,062 |
# -*- coding: utf-8 -*-
import os
'''
The 24 Game Player
Given any four digits in the range 1 to 9, which may have repetitions,
Using just the +, -, *, and / operators; and the possible use of
brackets, (), show how to make an answer of 24.
An answer of "q" will quit the game.
An answer of "!" will genera... | NicovincX2/Python-3.5 | Problèmes divers/24 game/24-game_solver.py | Python | gpl-3.0 | 5,244 |
#-------------------------------------------------------------------------------
# elftools: elf/structs.py
#
# Encapsulation of Construct structs for parsing an ELF file, adjusted for
# correct endianness and word-size.
#
# Eli Bendersky (eliben@gmail.com)
# This code is in the public domain
#-------------------------... | g0t3n/Ksymhunter-gui | utils/elftools/elf/structs.py | Python | gpl-2.0 | 10,047 |
"""
evaluate the gamma distribution with different shape settings
"""
import pandas as pd
import os
from localutils import changedetect as dc, benchmark as bch, misc as ms
import logging
import ConfigParser
import traceback
import multiprocessing
import argparse
import numpy as np
METHOD = ['cpt_gamma%1', 'cpt_gamma%1... | WenqinSHAO/rtt | eval_gamma.py | Python | mit | 4,356 |
'''
Created on 04.03.2012
@author: michi
'''
from datetime import date
from abc import ABCMeta, abstractmethod, abstractproperty
import datetime
class XType:
__metaclass__ = ABCMeta
CUSTOM = 1
NUMBER = 2
STRING = 3
BOOL = 4
COMPLEX = 5
TEMPORAL = 6
MIXED = 7
def... | mtils/ems | ems/xtype/base.py | Python | mit | 10,775 |
'''test_classifypixels - test the ClassifyPixels module
CellProfiler is distributed under the GNU General Public License.
See the accompanying file LICENSE for details.
Copyright (c) 2003-2009 Massachusetts Institute of Technology
Copyright (c) 2009-2015 Broad Institute
All rights reserved.
Please see the AUTHORS fi... | LeeKamentsky/CellProfiler | cellprofiler/modules/tests/test_classifypixels.py | Python | gpl-2.0 | 40,874 |
# encoding: utf-8
import datetime
from south.db import db
from south.v2 import SchemaMigration
from django.db import models
class Migration(SchemaMigration):
def forwards(self, orm):
# Adding model 'MerchandiseTag'
db.create_table('merchandise_merchandisetag', (
('id', self.gf('django.db.models.fields.AutoFi... | smyrman/kikrit | django_kikrit/merchandise/migrations/0001_initial.py | Python | gpl-3.0 | 9,159 |
# 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... | mistercrunch/airflow | airflow/providers/apache/livy/sensors/livy.py | Python | apache-2.0 | 2,541 |
import _plotly_utils.basevalidators
class FamilyValidator(_plotly_utils.basevalidators.StringValidator):
def __init__(
self,
plotly_name="family",
parent_name="layout.ternary.aaxis.title.font",
**kwargs
):
super(FamilyValidator, self).__init__(
plotly_name=p... | plotly/plotly.py | packages/python/plotly/plotly/validators/layout/ternary/aaxis/title/font/_family.py | Python | mit | 553 |
#!/usr/bin/env python2.7
# -*- coding: utf-8 -*-
import os
import sys
import unittest
sys.path.append('..')
from hecatoncheir.QueryResult import QueryResult
from hecatoncheir.exception import DriverError, InternalError, QueryError, QueryTimeout
from hecatoncheir.bigquery import BigQueryDriver
class TestBigQueryDrive... | snaga/Hecatoncheir | tests/testBigQueryDriver.py | Python | apache-2.0 | 3,669 |
"""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, softw... | krux/graphite-web | webapp/graphite/browser/urls.py | Python | apache-2.0 | 961 |
# -*- coding: utf-8 -*-
##############################################################################
#
# Author Vincent Renaville
# Copyright 2015 Camptocamp SA
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU Affero General Public License as
# pu... | cgaspoz/l10n-switzerland | l10n_ch_import_cresus/wizard/l10n_ch_import_cresus.py | Python | agpl-3.0 | 14,106 |
# -*- coding: utf-8 -*-
"""
Created on Sat Feb 22 12:07:53 2014
@author: Gouthaman Balaraman
"""
import requests
import pandas as pd
from bs4 import BeautifulSoup
import re
import numpy as np
import os
#####################################################
# A bunch of constants used throught the script. #
########... | gouthambs/OpenData | src/longbeach_crime_stats.py | Python | mit | 10,310 |
import random
from io import StringIO
from django.conf import settings
from django.contrib.auth.mixins import LoginRequiredMixin
from django.contrib.messages import add_message, INFO
from django.urls import reverse
from django.http import HttpResponseForbidden
from django.http import HttpResponseRedirect
from django.h... | nextgis/quickmapservices_server | qms_server/qms_site/views.py | Python | gpl-2.0 | 13,007 |
#!/usr/bin/env python3
import json
import sys
from librip.ctxmngrs import timer
from librip.decorators import print_result
from librip.gens import field, gen_random
from librip.iterators import Unique
# encoding=utf8
path = "/Users/bestK1ng/Code/Web/IU5/5 семестр/Разработка интернет-приложений/Lab4/data_light.json"
... | bestK1ngArthur/IU5 | Term 5/Development of Internet applications/Lab4/ex_6.py | Python | mit | 1,707 |
from pytest import fixture
from functional.core import (
builder,
PreparedImagesOutputChecker,
PDFDocumentChecker,
DjVuDocumentChecker)
@fixture()
def checker_classes():
""" Run all checkers in one test for optimization reason. """
return [
PreparedImagesOutputChecker,... | atrosinenko/lecture-notes-compiler | tests/functional/core_test.py | Python | mit | 5,334 |
#!/usr/bin/env python
#
# Copyright 2014 Simone Campagna
#
# 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 l... | simone-campagna/py-configment | src/configment/configment.py | Python | apache-2.0 | 5,069 |
"""Views for Zinnia quick entry"""
from urllib import urlencode
from django import forms
from django.utils.html import linebreaks
from django.shortcuts import redirect
from django.core.urlresolvers import reverse
from django.contrib.sites.models import Site
from django.template.defaultfilters import slugify
from djang... | jfdsmit/django-blog-zinnia | zinnia/views/quick_entry.py | Python | bsd-3-clause | 2,059 |
# -*- coding: utf-8 -*-
# Generated by Django 1.10 on 2016-09-17 02:52
from __future__ import unicode_literals
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('rii_Api', '0009_auto_20160916_2116'),
]
operations = [
migrations.AddField(
... | SimonHerrera/rock-island-independents | api/rii_Api/migrations/0010_player_imageinfo.py | Python | mit | 462 |
# -*- coding: utf-8 -*-
# Copyright (c) 2016 Aladom SAS & Hosting Dvpt SAS
from django.apps import AppConfig
from django.utils.translation import ugettext_lazy as _
class MailingConfig(AppConfig):
name = 'mailing'
verbose_name = _("Mailing")
| Aladom/django-mailing | mailing/apps.py | Python | mit | 252 |
#***************************************************************************
#* *
#* Copyright (c) 2015 *
#* Yorik van Havre <yorik@uncreated.net> *
#* ... | cypsun/FreeCAD | src/Mod/Arch/importGBXML.py | Python | lgpl-2.1 | 17,885 |
# replace all key events in
# js files and htmls
# to our standard key input event
# more details see in DOC dir
# Key 事件进行全局替换, 统一处理。 | lifeinoppo/littlefishlet-scode | SRC/Server/Components/input/python/keyInput.py | Python | gpl-2.0 | 175 |
# -*- coding: utf-8 -*-
###############################################################################
#
# GetTariff
# Returns an individual Tariff object with a given id.
#
# Python versions 2.6, 2.7, 3.x
#
# Copyright 2014, Temboo Inc.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may no... | jordanemedlock/psychtruths | temboo/core/Library/Genability/TariffData/GetTariff.py | Python | apache-2.0 | 4,018 |
# -*- coding: utf-8 -*-
# Part of Odoo. See LICENSE file for full copyright and licensing details.
import models
import report
import tests
| tvtsoft/odoo8 | addons/sale_contract/__init__.py | Python | agpl-3.0 | 141 |
# Copyright 2014, 2015 The ODL development group
#
# This file is part of ODL.
#
# ODL 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.
... | bgris/ODL_bgris | odl/test/trafos/fourier_test.py | Python | gpl-3.0 | 31,209 |
'''
Check Yahoo finance currency data helper.
Update log: (date / version / author : comments)
2017-12-10 / 1.0.0 / Du Jiang : Creation
2017-12-13 / 2.0.0 / Du Jiang : Use new API
'''
from com.djs.learn.financeapi import CheckFinanceDataRequests
__data_type = 1
__inventory_info_file_path = "../../../../etc/Currency... | djsilenceboy/LearnTest | Python_Test/PyFinanceApiSample/com/djs/learn/test/TestCheckYahooFinanceCurrencyData.py | Python | apache-2.0 | 709 |
from tiledata import GetOsmTileData
from OsmMerge import OsmMerge
def test(z, x, y):
filenames = []
for i in (0, 1):
for j in (0, 1):
lx = x * 2 + i
ly = y * 2 + j
lz = z + 1
#print("Downloading subtile %d,%d at %d" % (x,y,z))
# download (or ... | ryfx/modrana | modules/pyrender/testmerge.py | Python | gpl-3.0 | 581 |
#!/usr/bin/python
from __future__ import division
import rospy
import rospkg
from sensor_msgs.msg import MagneticField
from ieee2016_xmega_connector_ported.srv import GetHeading
import numpy as np
import matplotlib.pyplot as plt
import yaml
import os
from scipy import optimize
from numpy.linalg import eig, inv
rosp... | ufieeehw/IEEE2016 | ros/ieee2016_navigation/scripts/mag_calibrator.py | Python | mit | 8,777 |
from __future__ import absolute_import, print_function
import matplotlib.pyplot as plt
import numpy as np
import os
from PIL import Image
import seaborn.apionly as sns
import timeit
import rnmu.nmu as nmu
dir_name = '../results/'
if not os.path.exists(dir_name):
os.mkdir(dir_name)
dir_name += 'digits/'
if not os.p... | marianotepper/nmu_rfit | rnmu/test/test_toy_digits.py | Python | bsd-3-clause | 4,081 |
# -*- coding: utf-8 -*-
# Copyright 2020 Google LLC
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law o... | googleapis/python-api-common-protos | google/api/annotations_pb2.py | Python | apache-2.0 | 2,133 |
#!/usr/bin/env python
"""Display exposure state and countdown timer
History:
2010-03-10 ROwen Fix ticket #631: paused timer has wrong "sign".
2010-03-12 ROwen Changed to use Models.getModel.
Fixed bug introduced 2010-03-10.
2010-06-28 ROwen Removed unused global variable (thanks to pycheck... | r-owen/stui | TUI/Inst/BOSS/ExposureStateWdg.py | Python | bsd-3-clause | 4,960 |
# Exercise 24: More Practice
# Printing text and using tabs and new lines
print "Let's practice everything."
print 'You\'d need to know \'bout escapes with \\ that do \n newlines and \t tabs.'
# Variable with tabs multyline comment and newlines
poem = """
\tThe lovely world
with logic so firmly planted
cannot discern ... | Valka7a/python-playground | python-the-hard-way/24-more-practice.py | Python | mit | 1,650 |
from django.core.urlresolvers import reverse
from django.utils.translation import ugettext_lazy as _
from oioioi.base import admin
from oioioi.base.utils import make_html_link
from oioioi.problems.admin import ProblemAdmin
from oioioi.programs.models import Test
from oioioi.testspackages.forms import TestsPackageInlin... | papedaniel/oioioi | oioioi/testspackages/admin.py | Python | gpl-3.0 | 2,180 |
import logging
import inspect
import astroid
import operator
import re
from inspect import Parameter
from ._docstring_parser import DocstringParser, TypeHintParser
from ._base_node import NodeEntityBase, get_qualified_name
from ._argtype import ArgType
KW_ARG_NAME = "**kwargs"
VALIDATION_REQUIRED_DUNDER = ["__init__"... | tg-msft/azure-sdk-tools | packages/python-packages/api-stub-generator/apistub/nodes/_function_node.py | Python | mit | 14,187 |
#!/usr/bin/python
"""
(C) Copyright 2018 ALBA-CELLS
Authors: Marc Rosanes, Carlos Falcon, Zbigniew Reszela, Carlos Pascual
The program is distributed under the terms of the
GNU General Public License (or the Lesser GPL).
This program is free software: you can redistribute it and/or modify
it under the terms of the GN... | sagiss/txrm2nexus | txm2nexuslib/scripts/manynorm.py | Python | gpl-3.0 | 3,458 |
# Copyright 2022 UW-IT, University of Washington
# SPDX-License-Identifier: Apache-2.0
from myuw.models import UserCourseDisplay
from myuw.dao.instructor_schedule import check_section_instructor,\
get_section_by_label
from myuw.dao.pws import get_person_of_current_user
from myuw.dao.user import get_user_model
de... | uw-it-aca/myuw | myuw/dao/instructor_mini_course_card.py | Python | apache-2.0 | 984 |
#-*- coding: utf-8 -*-
import json
import mock
import unittest
from nose.tools import eq_, ok_
from ..constants import CONST
from ..test_base import TestCase
from pywechat.services.basic import Basic
from pywechat.services.wechat_card import CardService
class CardServiceTest(TestCase):
'''Creates a TestCase for... | OctavianLee/Pywechat | tests/test_service/test_card.py | Python | mit | 5,790 |
# -*- coding: utf-8 -*-
# QUANTCONNECT.COM - Democratizing Finance, Empowering Individuals.
# Lean Algorithmic Trading Engine v2.0. Copyright 2014 QuantConnect Corporation.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may ob... | redmeros/Lean | ApiPython/setup.py | Python | apache-2.0 | 1,298 |
import sys, re
for fn in sys.argv[1:]:
with open(fn, 'r') as f:
s = f.read()
xx = re.findall(r'([^\n]+)\s+\'\'\'(.*?)\'\'\'', s, re.M|re.S)
for (obj, doc) in xx:
s = re.findall('[^:`]\B(([`*])[a-zA-Z_][a-zA-Z0-9_]*\\2)\B', doc)
if s:
print '-'*50
... | pyrocko/pyrocko | maintenance/docstring_cop.py | Python | gpl-3.0 | 543 |
"""Tests for DataStream objects."""
import pytest
from iotile.core.exceptions import InternalError
from iotile.sg import DataStream, DataStreamSelector
def test_stream_type_parsing():
"""Make sure we can parse each type of stream."""
# Make sure parsing stream type works
stream = DataStream.FromString('... | iotile/coretools | iotilesensorgraph/test/test_datastream.py | Python | gpl-3.0 | 8,473 |
# Copyright 2013 IBM Corp.
#
# 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 agree... | adelina-t/nova | nova/tests/unit/objects/test_objects.py | Python | apache-2.0 | 58,349 |
import argparse
import flyfingers
def parse_args():
parser = argparse.ArgumentParser(description=flyfingers.__doc__)
sparsers = parser.add_subparsers(dest='subparser_name')
sub_parser = sparsers.add_parser('run', help='start flyfingers')
sub_parser.add_argument('run')
sub_parser.set_defaults(func... | swdream/flyfingers | flyfingers/cli.py | Python | mit | 451 |
from pyjade import runtime
class TestIteration(object):
def test_it_returns_mappings_unaltered(self):
mapping = {}
assert runtime.iteration(mapping, 1) is mapping
def test_it_returns_empty_list_on_empty_input(self):
l = iter([])
assert list(runtime.iteration(l, 1)) == []
... | syrusakbary/pyjade | pyjade/testsuite/test_runtime.py | Python | mit | 1,090 |
# Copyright (c) 2016, Matt Layman
import os
import unittest
from tap.adapter import Adapter
from tap.parser import Parser
from tap.rules import Rules
class Loader(object):
"""Load TAP lines into unittest-able objects."""
ignored_lines = set(['diagnostic', 'unknown'])
def __init__(self):
self._... | Mark-E-Hamilton/tappy | tap/loader.py | Python | bsd-2-clause | 2,985 |
default_app_config = 'hs_tracking.apps.HSTrackingAppConfig'
| ResearchSoftwareInstitute/MyHPOM | hs_tracking/__init__.py | Python | bsd-3-clause | 60 |
"""
Views for manual refunds in the student support UI.
This interface is used by the support team to track refunds
entered manually in CyberSource (our payment gateway).
DEPRECATION WARNING:
We are currently in the process of replacing lms/djangoapps/shoppingcart
with an E-Commerce service that supports automatic re... | ESOedX/edx-platform | lms/djangoapps/support/views/refund.py | Python | agpl-3.0 | 4,934 |
from __pyosshell__ import *
QUEUE_OUT = 'out.info'
QUEUE_ERR = 'err.info'
QUEUE_MAIL = ['%s@mpip-mainz.mpg.de' % getpass.getuser(),'a'] # eab
VOTCARC = '/people/thnfs/homes/poelking/VOTCA_SUSE_12/bin/VOTCARC.csh'
def retrieve_qid(logfile=QUEUE_OUT):
try:
intt = open(logfile,'r')
top = intt.readline()
intt... | 12AngryMen/votca-scripts | lib/Carlstuff/evaporation2/__cluster__.py | Python | apache-2.0 | 3,458 |
# Lint as: python3
# Copyright 2019 Google LLC
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agr... | mlperf/training_results_v0.7 | Google/benchmarks/minigo/implementations/minigo-research-TF-tpu-v4-128/cluster/evaluator/evaluator_ringmaster_wrapper.py | Python | apache-2.0 | 6,587 |
'''
mali_remove_gaps.py -
======================================================
:Author: Andreas Heger
:Release: $Id$
:Date: |today|
:Tags: Python
Purpose
-------
.. todo::
describe purpose of the script.
Usage
-----
Example::
python mali_remove_gaps.py --help
Type::
python mali_remove_gaps.py --... | CGATOxford/Optic | scripts/mali_remove_gaps.py | Python | mit | 6,154 |
#!/usr/bin/env python
# encoding: utf8
#
# An RPN calculator that supports numbers with SI scale factors and units.
# Description {{{1
"""
Engineering Calculator
A stack-based (RPN) engineering calculator with a text-based user interface that
is intended to be used interactively.
If run with no arguments, an interac... | KenKundert/ec | engineering_calculator/main.py | Python | gpl-3.0 | 6,074 |
# import the basic python packages we need
import os
import sys
import tempfile
import pprint
import traceback
# disable python from generating a .pyc file
sys.dont_write_bytecode = True
# change me to the path of pytan if this script is not running from EXAMPLES/PYTAN_API
pytan_loc = "~/gh/pytan"
pytan_static_path =... | tanium/pytan | BUILD/doc/source/examples/get_saved_question_by_name_code.py | Python | mit | 2,819 |
class node:
def __init__(self,key):
self.left = None
self.right = None
self.val = key
def LevelOrder(root):
if root:
queue = []
queue.append(root)
while(len(queue) > 0):
if(queue[0].left!=None):
queue.append(queue[0].left)
... | KavyaSharma/Algo_Ds_Notes | Tree_Levelorder_Traversal/Tree_Levelorder_Traversal.py | Python | gpl-3.0 | 756 |
"""Utility functions and classes used by nose internally.
"""
import inspect
import itertools
import logging
import os
import re
import sys
import types
import unittest
from nose.pyversion import ClassType, TypeType, isgenerator
log = logging.getLogger('nose')
ident_re = re.compile(r'^[A-Za-z_][A-Za-z0-9_.]*$')
clas... | jasrusable/fun | venv/lib/python2.7/site-packages/nose/util.py | Python | gpl-2.0 | 19,896 |
# encoding: utf-8
#
#
# This Source Code Form is subject to the terms of the Mozilla Public
# License, v. 2.0. If a copy of the MPL was not distributed with this file,
# You can obtain one at http:# mozilla.org/MPL/2.0/.
#
# Contact: Kyle Lahnakoski (kyle@lahnakoski.com)
#
from __future__ import absolute_import, divisi... | klahnakoski/SpotManager | vendor/jx_elasticsearch/es52/painless/or_op.py | Python | mpl-2.0 | 984 |
from flask import Blueprint
bookmarks = Blueprint('bookmarks', __name__, template_folder='templates')
from . import views # noqa
| jhh/puka-server-flask | puka/bookmarks/__init__.py | Python | apache-2.0 | 132 |
# Copyright (c) 2015, Frappe Technologies Pvt. Ltd. and Contributors
# MIT License. See license.txt
from __future__ import unicode_literals
from six import iteritems, string_types
import datetime
import frappe, sys
from frappe import _
from frappe.utils import (cint, flt, now, cstr, strip_html, getdate, get_datetime, ... | neilLasrado/frappe | frappe/model/base_document.py | Python | mit | 25,380 |
import serial
import struct
import time
ser = serial.Serial(3, 1000000) # open first serial port
print ser.portstr # check which port was really used
ser.write("hello") # write a string
snd = [0xFF,0xFF,0x1,0x2, 0x1, 0xFB]
data = []
for element in snd:
data.append(struct.pack('B', element... | robEllenberg/acesHubo | utils/testTools/robotis/sertest.py | Python | gpl-3.0 | 594 |
import frappe
def get_filters_config():
filters_config = {
"fiscal year": {
"label": "Fiscal Year",
"get_field": "erpnext.accounts.utils.get_fiscal_year_filter_field",
"valid_for_fieldtypes": ["Date", "Datetime", "DateRange"],
"depends_on": "company",
}
}
return filters_config | ESS-LLP/erpnext | erpnext/startup/filters.py | Python | gpl-3.0 | 299 |
# 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 applicab... | tombstone/models | research/deep_contextual_bandits/bandits/algorithms/variational_neural_bandit_model.py | Python | apache-2.0 | 12,618 |
from pylons import c
from ming.orm import FieldProperty
from ming import schema as S
from allura.lib import helpers as h
from .session import project_orm_session
from .filesystem import File
class BaseAttachment(File):
thumbnail_size = (255, 255)
ArtifactType=None
class __mongometa__:
name = 'at... | leotrubach/sourceforge-allura | Allura/allura/model/attachments.py | Python | apache-2.0 | 2,036 |
from board import Board
from brick import Brick
from monster import Monster
from user import User
class Context:
def __init__(self):
self.game_level = 1
self._reset_context(User.START_LIFE, User.START_POINTS, User.DEFAULT_BOMB_CLASS)
def level_up(self):
self.game_level += 1
s... | angelinawawrzyniak/bomberman | context.py | Python | mit | 1,031 |
#
# Gramps - a GTK+/GNOME based genealogy program
#
# Copyright (C) 2002-2006 Donald N. Allingham
#
# 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 you... | Forage/Gramps | gramps/gen/filters/rules/family/_searchmothername.py | Python | gpl-2.0 | 1,843 |
from __future__ import absolute_import
import datetime
import os
from decimal import Decimal
from django import forms
from django.core.files.uploadedfile import SimpleUploadedFile
from django.core.validators import ValidationError
from django.db import connection
from django.forms.models import model_to_dict
from dja... | chrishas35/django-travis-ci | tests/modeltests/model_forms/tests.py | Python | bsd-3-clause | 65,658 |
# Create your views here.
from django.http import HttpResponse,HttpResponseRedirect
from django.shortcuts import render, get_object_or_404
from accounts.models import Employee, PhoneNo, Skill, HasSkill
from django.core.urlresolvers import reverse
from django.contrib.auth.hashers import make_password, check_password
fro... | sushant-hiray/teamflowy | project/views.py | Python | mit | 35,934 |
# GNU Enterprise Common Library - Special database driver plugins
#
# Copyright 2000-2007 Free Software Foundation
#
# This file is part of GNU Enterprise.
#
# GNU Enterprise 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 Softwar... | HarmonyEnterpriseSolutions/harmony-platform | src/gnue/common/datasources/drivers/other/__init__.py | Python | gpl-2.0 | 979 |
# -*- coding: utf-8 -*-
#
# nfcpy documentation build configuration file, created by
# sphinx-quickstart on Mon Sep 19 18:10:55 2011.
#
# 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 c... | nfcpy/ndeflib | docs/conf.py | Python | isc | 10,172 |
from __future__ import (absolute_import, division, print_function,
unicode_literals)
import six
import glob
import os
import numpy as np
from matplotlib.testing.decorators import image_comparison
from matplotlib import pyplot as plt
import matplotlib.cm as cm
@image_comparison(baseline_ima... | Reagankm/KnockKnock | venv/lib/python3.4/site-packages/matplotlib/tests/test_png.py | Python | gpl-2.0 | 1,259 |
from monopyly import *
from testing_utils import *
class PlayerWhoGetsOutOfJail(DefaultPlayerAI):
'''
A player who performs the given action when in jail.
'''
def __init__(self, action):
self.action = action
def set_action(self, action):
self.action = action
def get_out_of_ja... | richard-shepherd/monopyly | tests/test_get_out_of_jail.py | Python | mit | 8,227 |
from django.core.management.base import BaseCommand
from django.db.models import Q
from photos.models import Photo
from intrinsic.models import IntrinsicPointComparison
class Command(BaseCommand):
args = ''
help = 'Fix the point1_image_darker field'
def handle(self, *args, **options):
Photo.obj... | seanbell/opensurfaces | server/intrinsic/management/commands/intrinsic_fill_in_iiw.py | Python | mit | 1,401 |
import asyncio
import aioredis
def main():
loop = asyncio.get_event_loop()
@asyncio.coroutine
def reader(ch):
while (yield from ch.wait_message()):
msg = yield from ch.get_json()
print("Got Message:", msg)
@asyncio.coroutine
def go():
pub = yield from aior... | iho/aioredis | examples/pubsub.py | Python | mit | 846 |
# -*- coding: utf-8 -*-
import re
import logging
from completor.utils import check_subseq
from .utils import parse_uri
word_pat = re.compile(r'([\d\w]+)', re.U)
word_ends = re.compile(r'[\d\w]+$', re.U)
logger = logging.getLogger("completor")
# [
# [{
# u'range': {
# u'start': {u'line': 273, u'ch... | maralla/completor.vim | pythonx/completers/lsp/action.py | Python | mit | 3,344 |
import json, csv
import array, random, pandas as pd
from sklearn.model_selection import StratifiedKFold
from sklearn.model_selection import cross_val_predict, cross_val_score
from opt.genetic import GeneticOptimizer, GeneticConfiguration, LogHelper
from deap import creator, base, tools
class GeneticLogHelper(LogHelp... | piotrsobecki/opt | opt/feature_selection/genetic.py | Python | mit | 5,321 |
# Copyright 2017, 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... | tseaver/google-cloud-python | language/google/cloud/language_v1/types.py | Python | apache-2.0 | 1,375 |
""" Benchmarks for functions related to streamline
Run all benchmarks with::
import dipy.tracking as dipytracking
dipytracking.bench()
If you have doctests enabled by default in nose (with a noserc file or
environment variable), and you have a numpy version <= 1.6.1, this will also run
the doctests, let's ho... | samuelstjean/dipy | dipy/tracking/benchmarks/bench_streamline.py | Python | bsd-3-clause | 1,575 |
# -*- coding: utf-8 -*-
"""
Aligning two differently tokenized string representations of bracket
trees.
@author = Andreas Peldszus
@mail = <peldszus at uni dash potsdam dot de>
@version = 0.1.0
"""
class AlignmentError(Exception):
pass
def align_tokenized_tree(toks1, toks2, tree_pair_name="no-name-given",
... | peldszus/DiscourseSegmenter | dsegmenter/evaluation/align.py | Python | mit | 5,304 |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
"""
Models for storing campaign finance tables from the CAL-ACCESS database.
"""
# Models
from calaccess_raw import fields
from .base import CalAccessBaseModel
# Annotations
from calaccess_raw import annotations
from calaccess_raw.annotations import DocumentCloud
class C... | california-civic-data-coalition/django-calaccess-raw-data | calaccess_raw/models/campaign.py | Python | mit | 207,009 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.