text stringlengths 6 947k | repo_name stringlengths 5 100 | path stringlengths 4 231 | language stringclasses 1
value | license stringclasses 15
values | size int64 6 947k | score float64 0 0.34 |
|---|---|---|---|---|---|---|
# Copyright (C) 2013, Stefan Schwarzer
# See the file LICENSE for licensing terms.
"""
tool.py - helper code
"""
from __future__ import unicode_literals
import compat as compat
__all__ = ["same_string_type_as", "as_bytes", "as_unicode",
"as_default_string"]
# Encoding to convert between byte string an... | pavel-odintsov/ru_open_statistics | helpers/helperUnicode.py | Python | gpl-2.0 | 3,890 | 0.001028 |
from inc import *
modFunc.addCommand('suggest', 'suggest', 'suggest')
modFunc.addCommand('sug', 'suggest', 'suggest')
modFunc.addCommand('issue', 'suggest', 'suggest')
modFunc.addCommand('sug-read', 'suggest', 'read')
modFunc.addCommand('sug-clear', 'suggest', 'clear')
def suggest(line, irc):
message, username, m... | chris2727/BeastBot | src/inc/modules/suggest.py | Python | gpl-3.0 | 1,611 | 0.003724 |
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.db import models, migrations
class Migration(migrations.Migration):
dependencies = [
('studentguide', '0005_add_studentguide_clubs'),
]
operations = [
migrations.AddField(
model_name='tag',
... | enjaz/enjaz | studentguide/migrations/0006_tag_image.py | Python | agpl-3.0 | 446 | 0.002242 |
# Copyright 2013-2015 Lenna X. Peterson. All rights reserved.
from .meta import classproperty
class AtomData(object):
# Maximum ASA for each residue
# from Miller et al. 1987, JMB 196: 641-656
total_asa = {
'A': 113.0,
'R': 241.0,
'N': 158.0,
'D': 151.0,
'C': 140... | lennax/util | util/atom_data.py | Python | gpl-3.0 | 6,616 | 0.000151 |
# -*- coding: utf-8 -*-
from openerp import models, fields, api
from datetime import datetime, timedelta, date
from dateutil.relativedelta import relativedelta
class Inspection(models.Model):
_name = 'property.inspection'
_order = 'date desc'
_inherit = ['mail.thread', 'ir.needaction_mixin']
propert... | ichi23de5/ichi_Repo | property/models/inspection.py | Python | gpl-3.0 | 2,328 | 0.007732 |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
from runner.koan import *
class AboutStringManipulation(Koan):
def test_use_format_to_interpolate_variables(self):
value1 = 'one'
value2 = 2
string = "The values are {0} and {1}".format(value1, value2)
self.assertEqual("The values are... | fengren/python_koans | python2/koans/about_string_manipulation.py | Python | mit | 2,781 | 0.000719 |
import numpy
from PIL import Image
import sys
#if len(sys.argv) != 3:
# sys.exit('usage: dice.py path_to_segmented_image path_to_ground_truth_image')
pairs = [['/home/ognawala/data/PatientMS-R/20140120T143753/20140120T143753_annotated_rf.png', '/home/ognawala/data/Patient-Mask/20140120T143753-mask.png'], ['/home/o... | saahil/MSSegmentation | dice.py | Python | gpl-2.0 | 1,199 | 0.010008 |
# -*- coding: utf-8 -*-
"""
.. _tut-artifact-overview:
Overview of artifact detection
==============================
This tutorial covers the basics of artifact detection, and introduces the
artifact detection tools available in MNE-Python.
We begin as always by importing the necessary Python modules and loading som... | kambysese/mne-python | tutorials/preprocessing/plot_10_preprocessing_overview.py | Python | bsd-3-clause | 11,702 | 0 |
#! /usr/bin/env python
"""
couchbasekit.fields
~~~~~~~~~~~~~~~~~~~
:website: http://github.com/kirpit/couchbasekit
:copyright: Copyright 2013, Roy Enjoy <kirpit *at* gmail.com>, see AUTHORS.txt.
:license: MIT, see LICENSE.txt for details.
* :class:`couchbasekit.fields.CustomField`
* :class:`couchbasekit.fields.Choice... | kirpit/couchbasekit | couchbasekit/fields.py | Python | mit | 6,692 | 0.002241 |
# Copyright (c) 2015, MapR Technologies
#
# 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... | esikachev/scenario | sahara/plugins/mapr/plugin.py | Python | apache-2.0 | 2,850 | 0 |
# This code is part of Ansible, but is an independent component.
# This particular file snippet, and this file snippet only, is BSD licensed.
# Modules you write using this snippet, which is embedded dynamically by Ansible
# still belong to the author of the module, and may assign their own license
# to the complete wo... | matburt/ansible | lib/ansible/module_utils/openstack.py | Python | gpl-3.0 | 4,528 | 0.006846 |
# -*- encoding: utf-8 -*-
##############################################################################
#
# Account Journal Always Check Date module for OpenERP
# Copyright (C) 2013-2014 Akretion (http://www.akretion.com)
# @author Alexis de Lattre <alexis.delattre@akretion.com>
#
# This program is free so... | raycarnes/account-financial-tools | account_journal_always_check_date/__openerp__.py | Python | agpl-3.0 | 2,081 | 0 |
# -*- coding: utf-8 -*-
# © 2016 Cristian Moncho <cristian.moncho@diagram.es>
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html).
import logging
_logger = logging.getLogger(__name__)
_LOADED_VCS = []
def load_vcs(vcs):
vcs = vcs.lower()
modname = 'vcs.%s' % (vcs,)
clsname = vcs.title().... | crimoniv/odoo-module-tools | repository_management/vcs_wrapper/vcs_wrapper.py | Python | agpl-3.0 | 1,918 | 0 |
# This file is part of Indico.
# Copyright (C) 2002 - 2016 European Organization for Nuclear Research (CERN).
#
# Indico 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 (a... | DavidAndreev/indico | indico/modules/events/timetable/models/entries.py | Python | gpl-3.0 | 13,696 | 0.001168 |
from __future__ import absolute_import, unicode_literals
import unittest
from mopidy.internal import path
from mopidy.models import Album, Artist, Playlist, TlTrack, Track
from mopidy.mpd import translator
class TrackMpdFormatTest(unittest.TestCase):
track = Track(
uri='a uri',
artists=[Artist(n... | dbrgn/mopidy | tests/mpd/test_translator.py | Python | apache-2.0 | 6,809 | 0 |
#########################################################################
## This program is part of 'MOOSE', the
## Messaging Object Oriented Simulation Environment.
## Copyright (C) 2013 Upinder S. Bhalla. and NCBS
## It is made available under the terms of the
## GNU Lesser General Public License version 2... | dilawar/moose-full | moose-examples/snippets/funcReacLotkaVolterra.py | Python | gpl-2.0 | 5,043 | 0.029942 |
"""
Key-value store that holds XBlock field data read out of Blockstore
"""
from collections import namedtuple
from weakref import WeakKeyDictionary
import logging
from xblock.exceptions import InvalidScopeError, NoSuchDefinition
from xblock.fields import Field, BlockScope, Scope, UserScope, Sentinel
from xblock.fiel... | stvstnfrd/edx-platform | openedx/core/djangoapps/xblock/runtime/blockstore_field_data.py | Python | agpl-3.0 | 16,343 | 0.003243 |
#!/usr/bin/python3.4
#############################################################################
#
# Dictionnary DB managing script. Add/Del/Search definitions
# Copyright (C) 2014 bertrand
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public L... | bertrandF/DictionaryDB | db.py | Python | gpl-2.0 | 8,296 | 0.008799 |
import os
import sys
import json
from optional_django import staticfiles
from optional_django.serializers import JSONEncoder
from optional_django.safestring import mark_safe
from optional_django import six
from js_host.function import Function
from js_host.exceptions import FunctionError
from react.render import Rende... | HorizonXP/python-react-router | react_router/render.py | Python | mit | 5,105 | 0.003918 |
import nltk
import re
import pprint
def main():
IN = re.compile(r'.*\bin\b(?!\b.+ing)')
for doc in nltk.corpus.ieer.parsed_docs('NYT_19980315'):
for rel in nltk.sem.extract_rels('ORG', 'LOC', doc, corpus='ieer', pattern=IN):
print nltk.sem.relextract.rtuple(rel)
if __name__ == "__main__":... | attibalazs/nltk-examples | 7.6_Relation_Extraction.py | Python | mit | 332 | 0.006024 |
__all__ = ["pval_task", "annotation_task"] | eeyorkey/ipac | tasks/__init__.py | Python | gpl-2.0 | 42 | 0.02381 |
#!/usr/bin/env python
# vim: set fileencoding=utf-8 :
# Pavel Korshunov <Pavel.Korshunov@idiap.ch>
# Tue 22 Sep 17:21:35 CEST 2015
#
# Copyright (C) 2012-2015 Idiap Research Institute, Martigny, Switzerland
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General... | bioidiap/bob.bio.spear | bob/bio/spear/utils/extraction.py | Python | gpl-3.0 | 4,798 | 0.002293 |
# Copyright 2021, Kay Hayen, mailto:kay.hayen@gmail.com
#
# Part of "Nuitka", an optimizing Python compiler that is compatible and
# integrates with CPython, but also works on its own.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in complianc... | kayhayen/Nuitka | nuitka/nodes/CoroutineNodes.py | Python | apache-2.0 | 4,498 | 0.001112 |
# Copyright 2014 The Chromium Authors. All rights reserved.
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
import os
class URLMappings(object):
def __init__(self, src_root, build_dir):
self.mappings = {
'dart:mojo.internal': os.path.join(s... | xunmengfeng/engine | sky/tools/skypy/url_mappings.py | Python | bsd-3-clause | 878 | 0.009112 |
import urllib
from flask import url_for
from flask_script import Manager, Server, Shell, Command
from config.app import create_app
from config.db import db
from config.initializers.newrelic_monitoring import NewrelicMonitoring
from federation_api.people.model import Person
manager = Manager(create_app)
server = Serve... | practo/federation | manage.py | Python | mit | 1,415 | 0.002827 |
from direct.interval.IntervalGlobal import *
from direct.particles import ParticleEffect
from direct.particles import Particles
from direct.particles import ForceGroup
from pandac.PandaModules import *
import random
from FireworkGlobals import *
colors = {WHITE: Vec4(1, 1, 1, 1),
RED: Vec4(1, 0.2, 0.2, 1),
BLUE: Vec4... | Spiderlover/Toontown | toontown/effects/Fireworks.py | Python | mit | 9,697 | 0.004744 |
#
# Copyright 2016 The Charles Stark Draper Laboratory
#
# 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 ap... | draperlaboratory/user-ale | demo/dashboard/files/twisted_app.py | Python | apache-2.0 | 7,791 | 0.005391 |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
#
# This file is subject to the terms and conditions defined in
# file 'LICENSE.md', which is part of this source code package.
#
import json
import yaml
from kubernetes_py.utils import is_valid_string
class DeleteOptions(object):
"""
http://kubernetes.io/docs/... | mnubo/kubernetes-py | kubernetes_py/models/v1/DeleteOptions.py | Python | apache-2.0 | 3,140 | 0.002866 |
from reportlab.lib import styles
from reportlab.lib import colors
from reportlab.lib.units import cm
from reportlab.lib.enums import TA_LEFT, TA_CENTER, TA_RIGHT, TA_JUSTIFY
from reportlab.platypus import Preformatted, Paragraph, Frame, \
Image, Table, TableStyle, Spacer
def getParagraphStyles():
""... | nickpack/reportlab | tools/pythonpoint/styles/standard.py | Python | bsd-3-clause | 4,262 | 0.005631 |
# This file is part of the MapProxy project.
# Copyright (C) 2011-2013 Omniscale <http://omniscale.de>
# 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/LIC... | olt/mapproxy | mapproxy/cache/geopackage.py | Python | apache-2.0 | 27,948 | 0.003936 |
# Copyright 2010 United States Government as represented by the
# Administrator of the National Aeronautics and Space Administration.
# 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 ... | orbitfp7/nova | nova/api/ec2/__init__.py | Python | apache-2.0 | 25,652 | 0.000039 |
# Copyright 2017 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... | apark263/tensorflow | tensorflow/compiler/tests/image_ops_test.py | Python | apache-2.0 | 38,279 | 0.006923 |
# -*- coding: 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):
# Deleting field 'ArtistMedia.is_default_image'
db.delete_column(u'artist_artistmedia', 'is_default_image')
... | hcwiley/the-front | the_front/the_front/artist/migrations/0005_auto__del_field_artistmedia_is_default_image__del_field_artistmedia_na.py | Python | gpl-2.0 | 8,560 | 0.006075 |
import unittest
import os
import numpy
from rmgpy.tools.canteraModel import findIgnitionDelay, CanteraCondition, Cantera
from rmgpy.quantity import Quantity
import rmgpy
class CanteraTest(unittest.TestCase):
def testIgnitionDelay(self):
"""
Test that findIgnitionDelay() works.
"""
... | chatelak/RMG-Py | rmgpy/tools/canteraTest.py | Python | mit | 3,597 | 0.020573 |
from django.db import models
from django.utils.encoding import python_2_unicode_compatible
from elasticsearch import Elasticsearch
@python_2_unicode_compatible
class ElasticCluster(models.Model):
class Meta:
db_table = 'cluster_elastic_cluster'
# cluster name
name = models.CharField(max_length=12... | InterestingLab/elasticmanager | cluster/models.py | Python | mit | 1,207 | 0.000829 |
#!/usr/bin/env python
import sys
from twisted.protocols import amp
from twisted.internet import reactor
from twisted.internet.protocol import ServerFactory
from twisted.python import usage
from twisted.cred.checkers import FilePasswordDB
from twisted.cred.portal import Portal
from twisted.cred import credentials
fro... | dripton/ampchat | chatserver.py | Python | mit | 3,458 | 0.001446 |
#!/usr/bin/python
# -*- coding: utf-8 -*-
'''
Schedulers determine how worker's queues get filled. They control which
locations get scanned, in what order, at what time. This allows further
optimizations to be easily added, without having to modify the existing
overseer and worker thread code.
Schedulers will recieve... | slgphantom/RocketMap | pogom/schedulers.py | Python | agpl-3.0 | 46,757 | 0.000021 |
#! /usr/bin/python
# -*- coding: UTF-8 -*-
# Copyright 2018-2019 Luiko Czub, TestLink-API-Python-client developers
#
# 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.ap... | lczub/TestLink-API-Python-client | test/conftest.py | Python | apache-2.0 | 2,865 | 0.008028 |
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
import json
import os
import sys
import getpass
from os.path import expanduser
import stat
import shutil
import bit.git as git
structure="\n\
/file_system_a\n\
|\n\
'- data\n\
|\n\
'- p... | mpg-age-bioinformatics/bit | bit/config.py | Python | mit | 9,252 | 0.016105 |
#!/usr/bin/env python3
"""
This module runs all the tests of the auxi package at once.
"""
import unittest
from auxi.core.objects_test import ObjectUnitTester
from auxi.core.objects_test import NamedObjectUnitTester
from auxi.core.time_test import ClockUnitTester
from auxi.tools.chemistry.stoichiometry_test import S... | christoffkok/auxi.0 | src/tests.py | Python | lgpl-3.0 | 2,865 | 0.000349 |
import itertools
import json
import re
import flask
from flask import request
from web.cache import cache
import rethinkdb as r
import web.api.api_util as api_util
import db
import util
api = flask.Blueprint("api", __name__, url_prefix="/api")
r_conn = db.util.r_conn
def _should_skip_get_plugins_cache():
"""... | vim-awesome/vim-awesome | web/api/api.py | Python | mit | 7,261 | 0.001102 |
#!/usr/bin/env python
# Copyright (c) 2012 The Native Client Authors. All rights reserved.
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
"""Makes sure that files include headers from allowed directories.
Checks DEPS files in the source tree for rules, and applie... | endlessm/chromium-browser | native_client/tools/checkdeps/checkdeps.py | Python | bsd-3-clause | 17,715 | 0.008863 |
from typing import Optional
from gear.cloud_config import get_azure_config, get_gcp_config, get_global_config
from hailtop.aiocloud import aioazure, aiogoogle
from hailtop.aiotools.fs import AsyncFS, AsyncFSFactory
def get_identity_client(credentials_file: Optional[str] = None):
if credentials_file is None:
... | hail-is/hail | gear/gear/clients.py | Python | mit | 1,942 | 0.00206 |
# This file is part of the sos project: https://github.com/sosreport/sos
#
# This copyrighted material is made available to anyone wishing to use,
# modify, copy, or redistribute it subject to the terms and conditions of
# version 2 of the GNU General Public License.
#
# See the LICENSE file in the source distribution ... | nijinashok/sos | sos/plugins/dbus.py | Python | gpl-2.0 | 745 | 0 |
# Copyright (c) 2012 Citrix Systems, Inc.
# All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance with the License. You may obtain
# a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless ... | ntt-sic/nova | nova/api/openstack/compute/contrib/aggregates.py | Python | apache-2.0 | 8,962 | 0.000112 |
# -*- coding: utf-8 -*-
# Generated by Django 1.11.13 on 2018-07-02 11:40
from __future__ import unicode_literals
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('dashboard', '0022_query_amcat_options'),
]
operations = [
migrations.Alter... | amcat/amcat-dashboard | dashboard/migrations/0023_auto_20180702_1140.py | Python | agpl-3.0 | 696 | 0 |
"""
__MT_post__indirectLink_S.py_____________________________________________________
Automatically generated AToM3 syntactic object (DO NOT MODIFY DIRECTLY)
Author: levi
Modified: Sun Aug 9 23:46:05 2015
_________________________________________________________________________________
"""
from ASGNode import *
from... | levilucio/SyVOLT | GM2AUTOSAR_MM/MT_post__indirectLink_S.py | Python | mit | 4,553 | 0.028992 |
#! /usr/bin/env python
#
# python script to generate a valid stepfile for WRF cycling
#
import sys
import pandas
import calendar
filename = 'stepfile' # default filename
lleap = True # allow leap days (not used in some GCM calendars)
lecho = False
lperiod = False
dateargs = [] # list of date arguments passed to date_... | aerler/WRF-Tools | Python/wrfrun/generateStepfile.py | Python | gpl-3.0 | 4,142 | 0.021004 |
#
# 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... | RyanSkraba/beam | sdks/python/apache_beam/runners/dataflow/test_dataflow_runner.py | Python | apache-2.0 | 4,039 | 0.003714 |
from os import path
from django.contrib.auth.models import User
from django.test import TestCase
from django.urls import reverse
from files.models import CaptionedFile
fixture_dir = path.join(path.abspath(path.dirname(__file__)), 'fixtures')
class CaptionedFileTestCase(TestCase):
def setUp(self):
self... | pydanny/django-admin2 | example/files/tests/test_models.py | Python | bsd-3-clause | 1,470 | 0 |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
#
# mainnav-reader - Version: 0.5.1
#
# Copyright (c) 2009-2013, Dennis Keitzel
# 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... | pbabik/mainnav-reader | setup.py | Python | bsd-2-clause | 1,980 | 0.002525 |
from core.himesis import Himesis, HimesisPreConditionPatternLHS
import uuid
class HUnitConnectCAG_ConnectedLHS(HimesisPreConditionPatternLHS):
def __init__(self):
"""
Creates the himesis graph representing the AToM3 model HUnitConnectCAG_ConnectedLHS
"""
# Flag this instance as compiled now
self.is_compiled... | levilucio/SyVOLT | RSS2ATOM/contracts/unit/HUnitConnectCAG_ConnectedLHS.py | Python | mit | 1,301 | 0.032283 |
# vim: tabstop=4 shiftwidth=4 softtabstop=4
# Copyright 2013, Mirantis Inc
#
# Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance with the License. You may obtain
# a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
#... | Havate/havate-openstack | proto-build/gui/horizon/Horizon_GUI/openstack_dashboard/dashboards/project/vpn/workflows.py | Python | apache-2.0 | 19,939 | 0 |
# Copyright 2020 The StackStorm Authors.
# Copyright 2019 Extreme Networks, Inc.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless ... | nzlosh/st2 | st2common/tests/unit/test_actionchain_schema.py | Python | apache-2.0 | 2,701 | 0.00037 |
def first(l):
try:
return l.pop()
except Exception:
return None
| jdavisp3/TigerShark | tigershark/facade/utils.py | Python | bsd-3-clause | 88 | 0.011364 |
# Copyright (c) 2012 The Chromium Authors. All rights reserved.
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
'''Base class and interface for tools.
'''
from __future__ import print_function
class Tool(object):
'''Base class for all tools. Tools should use t... | endlessm/chromium-browser | tools/grit/grit/tool/interface.py | Python | bsd-3-clause | 1,507 | 0.011944 |
"""
Global configuration for the problem settings
"""
import numpy as np
from scipy import stats
horizon = 300
runs = 40
DefaultConfiguration = {
"price_buy" : [1.2,2.1,3.3],
"price_sell" : [1,2,3],
"price_probabilities" : np.array([[0.8, 0.1, 0.1],[0.1, 0.8, 0.1],[0.1, 0.1, 0.8]]),
"initial_capacity... | marekpetrik/RAAM | raam/examples/inventory/configuration.py | Python | mit | 5,606 | 0.019265 |
# Copyright 2015 Google LLC
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, s... | tseaver/google-cloud-python | bigtable/tests/unit/test_instance.py | Python | apache-2.0 | 37,126 | 0.001104 |
"""
Defines the URL routes for this app.
"""
from django.conf import settings
from django.conf.urls import patterns, url
from ..profile_images.views import ProfileImageView
from .accounts.views import AccountDeactivationView, AccountViewSet
from .preferences.views import PreferencesView, PreferencesDetailView
from .v... | prarthitm/edxplatform | openedx/core/djangoapps/user_api/urls.py | Python | agpl-3.0 | 1,706 | 0.001758 |
#NVDAObjects/IAccessible/sysTreeView32.py
#A part of NonVisual Desktop Access (NVDA)
#This file is covered by the GNU General Public License.
#See the file COPYING for more details.
#Copyright (C) 2007-2010 Michael Curran <mick@kulgan.net>, James Teh <jamie@jantrid.net>
from ctypes import *
from ctypes.wintypes... | daisymax/nvda | source/NVDAObjects/IAccessible/sysTreeView32.py | Python | gpl-2.0 | 10,467 | 0.040222 |
#!/usr/bin/env python2
# -*- coding: utf-8 -*-
"""
Created on Wed Mar 15 23:06:23 2017
@author: franklin
"""
# Your task here is to extract data from xml on authors of an article
# and add it to a list, one item for an author.
# See the provided data structure for the expected format.
# The tags for first name, surna... | franklinsales/udacity-data-analyst-nanodegree | project3/class-works/data-wrangling/data-in-more-complex-formats/quiz-extracting-data-corrected.py | Python | mit | 1,669 | 0.001797 |
"""Benchmark runner.
Copyright 2013 by Rackspace Hosting, Inc.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or a... | openilabs/falconlab | env/lib/python2.7/site-packages/falcon/cmd/bench.py | Python | mit | 944 | 0 |
# -*- coding: utf-8 -*-
# This file carries the module's version information which will be updated
# during execution of the installation script, setup.py. Distribution tarballs
# contain a pre-generated copy of this file.
__version__ = '0.2'
| EMS-TU-Ilmenau/fastmat | fastmat/version.py | Python | apache-2.0 | 245 | 0 |
# https://www.w3resource.com/python-exercises/
# 1. Write a Python program to print the following string in a specific format (see the output).
# Sample String : "Twinkle, twinkle, little star, How I wonder what you are! Up above the world so high, Like a diamond
# in the sky. Twinkle, twinkle, little star, How I wonde... | dadavidson/Python_Lab | Python-w3resource/Python_Basic/ex01.py | Python | mit | 715 | 0.00979 |
#!/usr/bin/python
# -*- coding: utf-8 -*-
import cairo, Image
import gtk, gobject
from numpy import cos, sin, pi, sqrt, sort, square,array, zeros, diff,\
column_stack,ones, reshape, linspace, arctan2
from numpy import sum as npsum
from numpy.random import random, seed
from itertools import count
... | inconvergent/differential_ani | differential.py | Python | mit | 7,824 | 0.034126 |
# -*- coding: utf-8 -*-
import classes.level_controller as lc
import classes.game_driver as gd
import classes.extras as ex
import classes.board
import random
import math
import pygame
class Board(gd.BoardGame):
def __init__(self, mainloop, speaker, config, screen_w, screen_h):
self.level = lc.Level(self... | OriHoch/pysiogame | game_boards/game054.py | Python | gpl-3.0 | 7,891 | 0.034216 |
from os.path import join, expanduser
from subprocess import Popen
from unittest import skipIf
from unittest.mock import ANY, call, MagicMock, Mock
from genty import genty, genty_dataset
import re
from app.project_type.git import Git
from app.util.conf.configuration import Configuration
from app.util.process_utils imp... | box/ClusterRunner | test/unit/project_type/test_git.py | Python | apache-2.0 | 13,290 | 0.004138 |
'''
Created on Mar 22, 2011
@author: jeroen
'''
import os
from fileinfo import FileInfo
from bytesize import ByteSize
class DirInfo(object):
'''
Simple class to represent a directory and obtain data about if when needed.
'''
def __init__(self, path, recursive=False):
'''
Construc... | JeroenDeDauw/phpstat | src/phpstat/dirinfo.py | Python | gpl-3.0 | 4,098 | 0.006833 |
from math import log
from PIL import Image, ImageDraw
my_data = [['slashdot', 'USA', 'yes', 18, 'None'],
['google', 'France', 'yes', 23, 'Premium'],
['digg', 'USA', 'yes', 24, 'Basic'],
['kiwitobes', 'France', 'yes', 23, 'Basic'],
['google', 'UK', 'no', 21, 'Premium'],
... | luoshao23/ML_algorithm | Decission_Tree/tree.py | Python | mit | 7,395 | 0.002299 |
"""Tests for coil."""
| marineam/coil | coil/test/__init__.py | Python | mit | 22 | 0 |
from django.contrib.auth.models import User
from pandas import read_csv, notnull, DataFrame
from numpy import isnan
from django.test import TestCase
from rhizome.models.campaign_models import Campaign, CampaignType, \
DataPointComputed, AggDataPoint
from rhizome.models.location_models import Location, LocationType... | unicef/rhizome | rhizome/tests/test_agg.py | Python | agpl-3.0 | 38,994 | 0.001795 |
"""AWS plugin for integration tests."""
from __future__ import (absolute_import, division, print_function)
__metaclass__ = type
import os
from ..util import (
ApplicationError,
display,
is_shippable,
ConfigParser,
)
from . import (
CloudProvider,
CloudEnvironment,
CloudEnvironmentConfig,
... | thaim/ansible | test/lib/ansible_test/_internal/cloud/aws.py | Python | mit | 3,947 | 0.00228 |
# -*- coding: utf-8 -*-
# Copyright 2022 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... | googleapis/python-service-usage | samples/generated_samples/serviceusage_v1_generated_service_usage_list_services_async.py | Python | apache-2.0 | 1,497 | 0.000668 |
"""
The MIT License
Copyright (c) 2007 Leah Culver, Joe Stump, Mark Paschal, Vic Fryzel
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 right... | b0nk/botxxy | src/oauth2.py | Python | gpl-2.0 | 23,431 | 0.001536 |
import ctypes
libc = ctypes.CDLL("/usr/lib/libc.dylib")
print(libc.rand())
print(libc.time())
cPrintF = libc.printf
value = b"I'm a C function!"
print(value)
printValue = ctypes.c_char_p(value)
print(printValue.value)
print(printValue)
cPrintF("%s", printValue)
| torchhound/projects | python/ffi.py | Python | gpl-3.0 | 264 | 0 |
#!/usr/bin/env python
"""
A convinience wrapper around mysql connector.
This file is part of open-ihm.
open-ihm 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 y... | snim2mirror/openihm | src/openihm/model/database.py | Python | lgpl-3.0 | 949 | 0.002107 |
#!/usr/bin/env python
import sys
sys.path.extend(['.', '..'])
import unittest
suite = unittest.TestLoader().loadTestsFromNames(
[
'test_c_lexer',
'test_c_ast',
'test_general',
'test_c_parser',
]
)
unittest.TextTestRunner(verbosity=1).run(suite)
| kk1987/pycparser | tests/all_tests.py | Python | bsd-3-clause | 294 | 0.006803 |
# -*- coding: utf-8 -*-
from operator import attrgetter
from pyangbind.lib.yangtypes import RestrictedPrecisionDecimalType
from pyangbind.lib.yangtypes import RestrictedClassType
from pyangbind.lib.yangtypes import TypedListType
from pyangbind.lib.yangtypes import YANGBool
from pyangbind.lib.yangtypes import YANGListTy... | napalm-automation/napalm-yang | napalm_yang/models/openconfig/network_instances/network_instance/protocols/protocol/isis/levels/level/link_state_database/lsp/tlvs/tlv/hostname/__init__.py | Python | apache-2.0 | 11,660 | 0.001286 |
from steps.bdd_test_util import cli_call
def after_scenario(context, scenario):
if 'doNotDecompose' in scenario.tags:
print("Not going to decompose after scenario {0}, with yaml '{1}'".format(scenario.name, context.compose_yaml))
else:
if 'compose_yaml' in context:
print("Decomposing with yaml '{0}' after sc... | ghaskins/obc-peer | openchain/peer/bddtests/environment.py | Python | apache-2.0 | 1,357 | 0.034635 |
# -*- coding: utf-8 -*-
#
# 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
#... | sid88in/incubator-airflow | airflow/utils/dates.py | Python | apache-2.0 | 9,508 | 0.000947 |
# Copyright 2014 Amazon.com, Inc. or its affiliates. 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. A copy of
# the License is located at
#
# http://aws.amazon.com/apache2.0/
#
# or in the "license" file acc... | LockScreen/Backend | venv/lib/python2.7/site-packages/awscli/customizations/cloudsearchdomain.py | Python | mit | 1,074 | 0.000931 |
#!/usr/bin/env python2
# -*- coding: utf-8 -*-
"""
Description:
Plot the delay evolution during a run
for multiple ones having the run_time
(in seconds) shown on the X axis.
@author: dspaccapeli
"""
#imports to manage the sql db
import sqlite3 as lite
import pandas as pd
#to make the plot show-up from command l... | dspaccapeli/bus-arrival | visualization/plot_delay_evo.py | Python | gpl-3.0 | 1,979 | 0.016675 |
# coding=utf-8
# Copyright 2018 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 logging
from... | UnrememberMe/pants | contrib/node/src/python/pants/contrib/node/subsystems/package_managers.py | Python | apache-2.0 | 8,798 | 0.007729 |
#!/usr/bin/env python
"""Shared classes between the client and the server for plist parsing."""
import calendar
import datetime
from binplist import binplist
from grr.lib import lexer
from grr.lib import objectfilter
class PlistFilterParser(objectfilter.Parser):
"""Plist specific filter parser.
Because we wil... | darrenbilby/grr | lib/plist.py | Python | apache-2.0 | 5,402 | 0.004813 |
from math import cos, sin, pi
from example_util import get_filename
from glc import Gif
def draw(l, surf, ctx, t):
xpos = cos(t * 2 * pi) * 100 + surf.get_width() * 0.5
ypos = sin(t * 2 * pi) * 100 + surf.get_height() * 0.5
w, h = 100, 100
ctx.set_source_rgb(0, 0, 0)
ctx.translate(xpos, ypos)
... | leovoel/glc.py | examples/custom_rendering.py | Python | mit | 473 | 0.002114 |
"""
Copyright (c) 2012-2013 RockStor, Inc. <http://rockstor.com>
This file is part of RockStor.
RockStor 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 la... | sbrichards/rockstor-core | src/rockstor/storageadmin/views/share_iscsi.py | Python | gpl-3.0 | 4,001 | 0.00025 |
# small script for
from optparse import OptionParser
import sqlite3
import time
import string
import arnovich.core as core
def parse_command_args():
parser = OptionParser()
parser.add_option("-t", "--ticker", action="append", type="string", dest="tickers")
parser.add_option("--from", action="store", type="string... | arnovich/core | test/yahoo/py/extract_to_srv.py | Python | bsd-3-clause | 2,381 | 0.025619 |
class Solution:
# @param {integer} s
# @param {integer[]} nums
# @return {integer}
def minSubArrayLen(self, s, nums):
i = 0
j = -1
n = len(nums)
t = 0
min_len = sys.maxint
while(i<n and j <n):
if t < s:
j += 1
if... | saai/codingbitch | twoPointers/minSubArrayLen.py | Python | mit | 623 | 0.008026 |
__version__ = "0.0.2a3"
| trueneu/swiss-knife | swk_plugins/swk_casp/swk_casp/version.py | Python | gpl-3.0 | 24 | 0 |
from __future__ import division
import numpy as np
from numpy.lib.stride_tricks import as_strided as ast
### striding data for efficient AR computations
def AR_striding(data,nlags):
# I had some trouble with views and as_strided, so copy if not contiguous
data = np.asarray(data)
if not data.flags.c_contig... | mattjj/pyhsmm-autoregressive | autoregressive/util.py | Python | gpl-2.0 | 1,782 | 0.016835 |
import unittest
import numpy as np
import pyoptima as opt
class SimulatedAnnealingTest(unittest.TestCase):
def test_with_parabola(self):
""" Test with a simple parabolic function with 2 variables """
def neighbour_func(params):
new_params = params
params['x0'] += np.rando... | samueljackson92/metaopt | python_tests/simulated_annealing_test.py | Python | mit | 1,038 | 0.000963 |
import angr
import claripy
import os
test_location = os.path.join(os.path.dirname(os.path.realpath(__file__)), '..', '..', 'binaries', 'tests')
def test_i386():
p = angr.Project(os.path.join(test_location, 'i386', 'test_strcasecmp'), auto_load_libs=False)
arg1 = claripy.BVS('arg1', 20*8)
s = p.factory.en... | angr/angr | tests/test_strcasecmp.py | Python | bsd-2-clause | 780 | 0.00641 |
from django.contrib import admin
from priorityDB.models import *
# Register your models here
# For more information on this file, see
# https://docs.djangoproject.com/en/dev/intro/tutorial02/
class TaskHistoryInline(admin.StackedInline):
model = TaskHistory
extra = 0
class EventAdmin(admin.ModelAdmin):
... | lowellbander/ngVote | priorityDB/priorityDB/admin.py | Python | gpl-2.0 | 418 | 0.014354 |
#
# Copyright (c) 2015 Autodesk Inc.
# All rights reserved
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable l... | gomezsan/ochopod | examples/sanity.py | Python | apache-2.0 | 2,544 | 0.003931 |
import gamerocket
from flask import Flask, request, render_template
app = Flask(__name__)
gamerocket.Configuration.configure(gamerocket.Environment.Development,
apiKey = "your_apiKey",
secretKey = "your_secretKey")
... | workbandits/gamerocket-python-guide | 1_create_player/src/app.py | Python | mit | 837 | 0.016726 |
'''
Simple parser that extracts a webpage's content and hyperlinks.
'''
import urllib2
import re
class Parser():
def __init__(self):
pass
def parse(self, url):
f = urllib2.urlopen(url)
text = f.read() # get page's contents.
#use re.findall to get all the links
... | nyu-dl/WebNav | simple_parser.py | Python | bsd-3-clause | 399 | 0.010025 |
# 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... | nathanbjenx/cairis | cairis/core/ResponseParameters.py | Python | apache-2.0 | 1,469 | 0.008169 |
# coding=utf-8
# --------------------------------------------------------------------------
# Copyright (c) Microsoft Corporation. All rights reserved.
# Licensed under the MIT License. See License.txt in the project root for license information.
# Code generated by Microsoft (R) AutoRest Code Generator.
# Changes may ... | Azure/azure-sdk-for-python | sdk/synapse/azure-mgmt-synapse/azure/mgmt/synapse/operations/_spark_configuration_operations.py | Python | mit | 6,172 | 0.004213 |
# -*- coding: utf-8 -*-
# <Lettuce - Behaviour Driven Development for python>
# Copyright (C) <2010-2011> Gabriel Falcão <gabriel@nacaolivre.org>
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundatio... | scaphe/lettuce-dirty | tests/integration/django/couves/leaves/views.py | Python | gpl-3.0 | 872 | 0.001148 |
#
# THIS IS WORK IN PROGRESS
#
# The Python Imaging Library
# $Id: PcfFontFile.py 2134 2004-10-06 08:55:20Z fredrik $
#
# portable compiled font file parser
#
# history:
# 1997-08-19 fl created
# 2003-09-13 fl fixed loading of unicode fonts
#
# Copyright (c) 1997-2003 by Secret Labs AB.
# Copyright (c)... | KAMI911/loec | examples/Sharpen/binaries-windows-python26/PcfFontFile.py | Python | gpl-3.0 | 6,642 | 0.004968 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.