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 |
|---|---|---|---|---|---|---|
#standard library
from _functools import reduce
import imghdr
### IMPORT THE APPLICABLE SETTINGS SET IN manage.py ###
from manage import USED_SETTINGS
import importlib
used_settings = importlib.import_module(USED_SETTINGS)
settings_media_root = used_settings.MEDIA_ROOT
settings_media_url = used_settings.MED... | fagusMcFagel/ticketsystem | ticketsystem/tickets/views.py | Python | mit | 49,979 | 0.008066 |
# 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/.
#
# Author: Kyle Lahnakoski (kyle@lahnakoski.com)
#
from __future__ import division
from __future_... | klahnakoski/TestFailures | pyLibrary/queries/containers/tests/test_container.py | Python | mpl-2.0 | 5,642 | 0.00319 |
# Author: Nic Wolfe <nic@wolfeden.ca>
# URL: http://code.google.com/p/sickbeard/
#
# This file is part of SickRage.
#
# SickRage 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,... | SerialShadow/SickRage | sickbeard/__init__.py | Python | gpl-3.0 | 114,709 | 0.005048 |
"""Utility code for constructing importers, etc."""
from ._bootstrap import MAGIC_NUMBER
from ._bootstrap import cache_from_source
from ._bootstrap import decode_source
from ._bootstrap import source_from_cache
from ._bootstrap import spec_from_loader
from ._bootstrap import spec_from_file_location
from ._bootstrap im... | milinbhakta/flaskmaterialdesign | venv/Lib/importlib/util.py | Python | gpl-2.0 | 7,227 | 0.000692 |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
"""
Methods for working with cecog
Copyright 2010 University of Dundee, Inc. All rights reserved.
Use is subject to license terms supplied in LICENSE.txt
"""
import os
import re
import sys
from omero.cli import BaseControl, CLI
import omero
import omero.consta... | dominikl/openmicroscopy | components/tools/OmeroPy/src/omero/plugins/cecog.py | Python | gpl-2.0 | 6,684 | 0 |
# -*- coding: utf-8 -*-
# This file is part of the Calibre-Web (https://github.com/janeczku/calibre-web)
# Copyright (C) 2018 lemmsh, cervinko, OzzieIsaacs
#
# 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 S... | idalin/calibre-web | cps/fb2.py | Python | gpl-3.0 | 2,739 | 0.00146 |
from datetime import date
from monthdelta import MonthDelta as monthdelta
from optparse import make_option
from django.core.management.base import NoArgsCommand, BaseCommand
import dateutil.parser
from django_pjm import models
class Command(BaseCommand):
help = "Imports PJM load values."
args = ''
opti... | chrisspen/django-pjm | django_pjm/management/commands/import_pjm_loads.py | Python | mit | 1,807 | 0.006641 |
####################################################################################################
#
# GroupedPurchaseOrder - A Django Application.
# Copyright (C) 2014 Fabrice Salvaire
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU Affero General Public Lic... | FabriceSalvaire/grouped-purchase-order | GroupedPurchaseOrder/bootstrap/components.py | Python | agpl-3.0 | 6,955 | 0.006039 |
import re
from django.core import urlresolvers
from django.db import IntegrityError
from cl.citations import find_citations, match_citations
from cl.custom_filters.templatetags.text_filters import best_case_name
from cl.search.models import Opinion, OpinionsCited
from celery import task
def get_document_citations(opi... | brianwc/courtlistener | cl/citations/tasks.py | Python | agpl-3.0 | 5,964 | 0.000503 |
"""
The middlewares in this file do mobile detection, provide a user override,
and provide a cookie override. They must be used in the correct order.
MobileMiddleware must always come after any of the other middlewares in this
file in `settings.MIDDLEWARE_CLASSES`.
"""
import urllib
from warnings import warn
from djan... | lgp171188/fjord | fjord/base/middleware.py | Python | bsd-3-clause | 5,915 | 0 |
#
# Autogenerated by Thrift
#
# DO NOT EDIT UNLESS YOU ARE SURE THAT YOU KNOW WHAT YOU ARE DOING
# @generated
#
__all__ = ['ttypes', 'constants']
| facebook/fbthrift | thrift/compiler/test/fixtures/types/gen-py/include/__init__.py | Python | apache-2.0 | 147 | 0 |
'''manipulate ndarray list'''
from itertools import imap,starmap,izip
from operator import mul,add,sub
def check_list(v1,v2):
'''check if the length of two list is same'''
if v1.size != v2.size:
raise ValueError,"the lenght of both arrays must be the same"
pa... | dnanexus/rseqc | rseqc/lib/qcmodule/twoList.py | Python | gpl-3.0 | 2,098 | 0.039561 |
from .responses import QueueResponse, QueuesResponse
url_bases = [
"https?://(.*?)(queue|sqs)(.*?).amazonaws.com"
]
url_paths = {
'{0}/$': QueuesResponse().dispatch,
'{0}/(?P<account_id>\d+)/(?P<queue_name>[a-zA-Z0-9\-_]+)': QueueResponse().dispatch,
}
| devs1991/test_edx_docmode | venv/lib/python2.7/site-packages/moto/sqs/urls.py | Python | agpl-3.0 | 267 | 0.011236 |
#!/usr/bin/env python
###############################################################################
# $Id: ogr_sde.py 33793 2016-03-26 13:02:07Z goatbar $
#
# Project: GDAL/OGR Test Suite
# Purpose: Test OGR ArcSDE driver.
# Author: Howard Butler <hobu.inc@gmail.com>
#
############################################... | nextgis-extra/tests | lib_gdal/ogr/ogr_sde.py | Python | gpl-2.0 | 10,401 | 0.011826 |
'''@file nnet.py
contains the functionality for a Kaldi style neural network'''
import shutil
import os
import itertools
import numpy as np
import tensorflow as tf
import classifiers.activation
from classifiers.dnn import DNN
from trainer import CrossEnthropyTrainer
from decoder import Decoder
class Nnet(object):
... | waterxt/tensorflowkaldi | neuralNetworks/nnet.py | Python | mit | 9,220 | 0.005748 |
#
# This file is part of pyasn1-modules software.
#
# Copyright (c) 2005-2017, Ilya Etingof <etingof@gmail.com>
# License: http://pyasn1.sf.net/license.html
#
# LDAP message syntax
#
# ASN.1 source from:
# http://www.trl.ibm.com/projects/xml/xss4j/data/asn1/grammars/ldap.asn
#
# Sample captures from:
# http://wiki.wire... | saurabhbajaj207/CarpeDiem | venv/Lib/site-packages/pyasn1_modules/rfc2251.py | Python | mit | 26,833 | 0.004398 |
# -*- coding: utf-8 -*-
# Import python libs
from __future__ import absolute_import
import warnings
# Import third party libs
import yaml
from yaml.nodes import MappingNode
from yaml.constructor import ConstructorError
try:
yaml.Loader = yaml.CLoader
yaml.Dumper = yaml.CDumper
except Exception:
pass
# Thi... | smallyear/linuxLearn | salt/salt/utils/yamlloader.py | Python | apache-2.0 | 3,478 | 0.000575 |
from django.apps import AppConfig
from django.contrib.auth import get_user_model
from django.contrib.auth.models import Permission
from django.contrib.contenttypes.models import ContentType
class AppConfig(AppConfig):
name = '.'.join(__name__.split('.')[:-1])
label = 'icekit_plugins_iiif'
verbose_name = "... | ic-labs/django-icekit | icekit/plugins/iiif/apps.py | Python | mit | 1,144 | 0 |
from __future__ import print_function
import pandas as pd
from sklearn.base import TransformerMixin
class FamilyCounter(TransformerMixin):
def __init__(self, use=True):
self.use = use
def transform(self, features_raw, **transform_params):
if self.use:
features = features_raw.copy... | wojtekwalczak/kaggle_titanic | titanic/transformers/FamilyCounter.py | Python | apache-2.0 | 946 | 0.005285 |
# -*- coding: utf-8 -*-
"""
Project name: Open Methodology for Security Tool Developers
Project URL: https://github.com/cr0hn/OMSTD
Copyright (c) 2014, cr0hn<-AT->cr0hn.com
All rights reserved.
Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following ... | cr0hn/OMSTD | examples/develop/lp/002/lp-002-s1.py | Python | bsd-2-clause | 2,001 | 0.002999 |
###############################################################################
#
# Copyright (C) 2001-2014 Micronaet SRL (<http://www.micronaet.it>).
#
# 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 ... | Micronaet/micronaet-xmlrpc | xmlrpc_operation_product/__openerp__.py | Python | agpl-3.0 | 1,769 | 0.004522 |
import sys
from services.spawn import MobileTemplate
from services.spawn import WeaponTemplate
from resources.datatables import WeaponType
from resources.datatables import Difficulty
from resources.datatables import Options
from java.util import Vector
def addTemplate(core):
mobileTemplate = MobileTemplate()
mobi... | agry/NGECore2 | scripts/mobiles/tatooine/variegated_womprat.py | Python | lgpl-3.0 | 1,684 | 0.026128 |
#!/usr/bin/env python
"""
Twython is a library for Python that wraps the Twitter API.
It aims to abstract away all the API endpoints, so that additions to the library
and/or the Twitter API won't cause any overall problems.
Questions, comments? ryan@venodesigns.net
"""
__author__ = "Ryan McGrath <rya... | davish/Twitter-World-Mood | twython/twython.py | Python | mit | 22,902 | 0.00262 |
# ----------------------------------------------------------------------------
# Copyright 2015 Nervana Systems Inc.
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.o... | nhynes/neon | tests/test_optimizer.py | Python | apache-2.0 | 6,823 | 0.001319 |
import os
import os.path as op
import pytest
import numpy as np
from numpy.testing import (assert_array_equal, assert_equal, assert_allclose,
assert_array_less, assert_almost_equal)
import itertools
import mne
from mne.datasets import testing
from mne.fixes import _get_img_fdata
from mne im... | bloyl/mne-python | mne/tests/test_transforms.py | Python | bsd-3-clause | 21,423 | 0 |
# -*- coding: utf-8 -*-
# Generated by Django 1.9.4 on 2016-04-08 11:04
from __future__ import unicode_literals
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('users', '0004_myuser_is_approved'),
]
operations = [
migrations.AddField(
... | BD2KGenomics/brca-website | django/users/migrations/0005_myuser_email_me.py | Python | apache-2.0 | 450 | 0 |
"""Tests for tools for solving inequalities and systems of inequalities. """
from sympy import (And, Eq, FiniteSet, Ge, Gt, Interval, Le, Lt, Ne, oo,
Or, S, sin, sqrt, Symbol, Union, Integral, Sum,
Function, Poly, PurePoly, pi, root)
from sympy.solvers.inequalities import (reduce_... | mcdaniel67/sympy | sympy/solvers/tests/test_inequalities.py | Python | bsd-3-clause | 13,455 | 0.001189 |
#!/usr/bin/python
def characterPictureGrid(grid):
for dim1 in range(0, len(grid)):
for dim2 in range(0, len(grid[dim1])):
print grid[dim1][dim2],
print "\n"
grid = [['.', '.', '.', '.', '.', '.'],
['.', 'O', 'O', '.', '.', '.'],
['O', 'O', 'O', 'O', '.', '... | ajitabhpandey/learn-programming | python/characterPictureGrid.py | Python | gpl-2.0 | 597 | 0.0067 |
# Copyright 2012 Nebula, Inc.
# 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... | whitepages/nova | nova/tests/functional/api_sample_tests/test_quota_sets.py | Python | apache-2.0 | 4,046 | 0.001236 |
# -*- coding: utf-8 -*-
"""
Test parsing of strings that are phrases with the
ptc.StartTimeFromSourceTime flag set to True
"""
import sys
import time
import datetime
import unittest
import parsedatetime as pdt
from parsedatetime.context import pdtContext
from . import utils
class test(unittest.TestCase):
@utils.... | bear/parsedatetime | tests/TestStartTimeFromSourceTime.py | Python | apache-2.0 | 2,109 | 0 |
import os.path as op
import logging
import shutil
from subprocess import check_output
from tempfile import mkdtemp
import click
from ob_pipelines.s3 import (
s3, download_file_or_folder, remove_file_or_folder, SCRATCH_DIR, path_to_bucket_and_key
)
logger = logging.getLogger('ob-pipelines')
@click.command()
@cl... | outlierbio/ob-pipelines | ob_pipelines/apps/fastqc/fastqc.py | Python | apache-2.0 | 1,841 | 0.002173 |
# -*- coding: utf-8 -*-
##############################################################################
#
# Author: Yannick Buron and Valeureux
# Copyright 2013 Yannick Buron and Valeureux
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU Affero General ... | Valeureux/wezer-exchange | __TODO__/project_crowdfunding/project_crowdfunding.py | Python | agpl-3.0 | 1,117 | 0 |
# -*- encoding: utf-8 -*-
try:
from httplib import HTTPSConnection
from urlparse import urlparse
except ImportError:
from http.client import HTTPSConnection
from urllib.parse import urlparse
from json import dumps, loads
from django.conf import settings
class GCMError(Exception):
pass
def send... | LPgenerator/django-db-mailer | dbmail/providers/google/android.py | Python | gpl-2.0 | 1,265 | 0 |
#!/usr/bin/env python3
#
# Copyright (c) 2015 Hewlett-Packard Development Company, L.P.
#
# 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
#
# U... | openstack/bifrost | bifrost/inventory.py | Python | apache-2.0 | 10,872 | 0 |
"""
cfbrank -- A college football ranking algorithm
dataparse.py: A module for parsing datafiles containing the relevant
statistics for the cfbrank algorithm. See the readme for full details
on the data formats and sources supported.
Written by Michael V. DePalatis <depalatis@gmail.com>
cfbrank is distributed under ... | mivade/cfbrank | dataparse.py | Python | gpl-3.0 | 3,352 | 0.004177 |
from django.conf.urls import patterns, include, url
# Uncomment the next two lines to enable the admin:
from django.contrib import admin
admin.autodiscover()
import minestrone.soup.views
urlpatterns = patterns('',
# Examples:
# url(r'^$', 'minestrone.views.home', name='home'),
# url(r'^minestrone/', incl... | cloudControl/django-celery-migration-app | minestrone/urls.py | Python | mit | 781 | 0.010243 |
# 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 ... | StackStorm/st2 | st2common/st2common/content/loader.py | Python | apache-2.0 | 14,094 | 0.001064 |
#!/usr/bin/env python
"""PIQS: Permutational Invariant Quantum Solver
PIQS is an open-source Python solver to study the exact Lindbladian
dynamics of open quantum systems consisting of identical qubits.
"""
DOCLINES = __doc__.split('\n')
CLASSIFIERS = """\
Development Status :: 3 - Alpha
Intended Audience :: Science... | nathanshammah/pim | setup.py | Python | mit | 3,679 | 0.015222 |
#!/usr/bin/env python
#
# "TC BOUT BOARD" a wrestling Match Bout Board application for youth matches or tournaments
# Copyright (C) 2016 Anthony Cetera
#
# 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
# t... | nitrotc/tc-bout-board | app/tc_bout_board.py | Python | gpl-3.0 | 27,003 | 0.003444 |
# 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/network/azure-mgmt-network/azure/mgmt/network/v2018_07_01/operations/_network_watchers_operations.py | Python | mit | 105,992 | 0.00551 |
# -*- coding: utf-8 -*-
import anydbm
import random
arquivo = anydbm.open('dados' , 'c')
arquivo['P1N1'] = 'Longbottom era o sobrenome de quem, nas séries de livros de Harry Potter?'
arquivo['P1C1'] = 'Neville'
arquivo['P1R2'] = 'Hermione'
arquivo['P1R3'] = 'Snape'
arquivo['P1R4'] = 'Dumbledore'
arquivo['P2N1'] = 'Qu... | fllamber/show_do_milhao | Show_do_milhao/Teste.perguntas.py | Python | unlicense | 5,657 | 0.004908 |
#!/usr/bin/env python
#-*- coding: utf8 -*-
# Copyright 2009-2012 Kamil Winczek <kwinczek@gmail.com>
#
# This file is part of series.py.
#
# series.py 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 ve... | kwinczek/tvseries | tvs/cache.py | Python | gpl-2.0 | 5,742 | 0.003657 |
#
# Copyright 2013 ZHAW SoE
# Copyright 2014 Intel Corp.
#
# Authors: Lucas Graf <graflu0@students.zhaw.ch>
# Toni Zehnder <zehndton@students.zhaw.ch>
# Lianhao Lu <lianhao.lu@intel.com>
#
# Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in complianc... | ChinaMassClouds/copenstack-server | openstack/src/ceilometer-2014.2.2/ceilometer/hardware/pollsters/cpu.py | Python | gpl-2.0 | 1,650 | 0 |
'''
Created on Jun 8, 2015
@author: cliff
'''
CAR_SYMBOLS = ['Q', 'A', 'B', 'C', 'D', 'E', 'F', 'G', 'H', 'J', 'K', 'L']
TRUCK_SYMBOLS = ['T', 'R', 'W', 'Z']
CAR_COLORS_NO_HASH = ['7FFF00', '7FFFD4', 'D2691E', '8B008B', 'BDB76B',\
'8B0000', 'FF1493', '1E90FF', 'FFD700', 'ADFF2F', \
... | crhaithcock/RushHour | Analytics/shared_code/RHconstants.py | Python | cc0-1.0 | 1,791 | 0.007259 |
# Copyright 2015 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... | naturali/tensorflow | tensorflow/contrib/framework/python/framework/tensor_util.py | Python | apache-2.0 | 11,844 | 0.006079 |
# coding: utf-8
# Copyright 2014 Globo.com Player authors. All rights reserved.
# Use of this source code is governed by a MIT License
# license that can be found in the LICENSE file.
import sys
PYTHON_MAJOR_VERSION = sys.version_info
import os
import posixpath
try:
import urlparse as url_parser
import urlli... | cristina0botez/m3u8 | m3u8/__init__.py | Python | mit | 2,171 | 0.006909 |
import unittest
from apel.db.records import Record, InvalidRecordException
class RecordTest(unittest.TestCase):
'''
Test case for Record
'''
# test for public interface
def test_set_field(self):
record = Record()
self.assertRaises(InvalidRecordException,
... | tofu-rocketry/apel | test/test_record.py | Python | apache-2.0 | 1,067 | 0.004686 |
# -*- coding: utf-8 -*-
#
# This file is distributed under MIT License or default open-tamil license.
# (C) 2013-2015 Muthiah Annamalai
#
# This file is part of 'open-tamil' examples
# It can be used to identify patterns in a Tamil text files;
# e.g. it has been used to identify patterns in Tamil Wikipedia
# article... | tshrinivasan/open-tamil | examples/solpattiyal.py | Python | mit | 3,639 | 0.016213 |
## dea_spatialtools.py
'''
Description: This file contains a set of python functions for conducting
spatial analyses on Digital Earth Australia data.
License: The code in this notebook is licensed under the Apache License,
Version 2.0 (https://www.apache.org/licenses/LICENSE-2.0). Digital Earth
Australia data is li... | ceos-seo/data_cube_utilities | dea_tools/dea_tools/spatial.py | Python | apache-2.0 | 34,337 | 0.009145 |
#
# Copyright © 2012–2022 Michal Čihař <michal@cihar.com>
#
# This file is part of Weblate <https://weblate.org/>
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the Licens... | nijel/weblate | weblate/vcs/tests/test_gpg.py | Python | gpl-3.0 | 3,459 | 0.000869 |
#!/usr/bin/env python
""" Examples of using qhull via scipy to generate 3D plots in visvis.
Requires numpy ver 1.5, scipy ver 0.9 and qhull from
http://www.qhull.org/ (on Windows this comes with Scipy).
plot3D meshes and plots random convex transformable data in both cartesian
and spherical coordinates
Play around wi... | pbfy0/visvis | examples/surfaceFromRandomPoints.py | Python | bsd-3-clause | 6,186 | 0.023278 |
# jsb/plugs/socket/dns.py
#
#
""" do a fqdn loopup. """
## jsb imports
from jsb.lib.commands import cmnds
from jsb.lib.examples import examples
## basic imports
from socket import gethostbyname
from socket import getfqdn
import re
## dns command
def handle_dns(bot, event):
""" arguments: <ip>|<hostname> - do... | Petraea/jsonbot | jsb/plugs/socket/dns.py | Python | mit | 1,189 | 0.015139 |
from Components.Renderer.Renderer import Renderer
from enigma import eDVBCI_UI, eLabel, iPlayableService
from skin import parameters
from Components.SystemInfo import SystemInfo
from Components.VariableText import VariableText
from Tools.Hex2strColor import Hex2strColor
from os import popen
class CiModuleControl(Rende... | TwolDE2/enigma2 | lib/python/Components/Renderer/CiModuleControl.py | Python | gpl-2.0 | 2,404 | 0.027454 |
import unittest
import random
import pickle
from ..wrapper import NTracer,CUBE,SPHERE
from ..render import Material,Color
def pydot(a,b):
return sum(ia*ib for ia,ib in zip(a,b))
def and_generic(f):
def inner(self):
with self.subTest(generic=False):
f(self,False)
with self.subTest... | Rouslan/NTracer | lib/ntracer/tests/test.py | Python | mit | 16,831 | 0.03149 |
from academic import settings
def default_picture_url(context):
return {
'ACADEMIC_PEOPLE_DEFAULT_PICTURE':
settings.PEOPLE_DEFAULT_PICTURE, }
| phretor/django-academic | academic/apps/people/context_processors.py | Python | bsd-3-clause | 168 | 0.005952 |
from django.db import models
from django.utils.translation import ugettext_lazy as _
from django.utils import timezone
from django.contrib.auth.models import User
from django.template.loader import render_to_string
from django.conf import settings
from django.contrib.sites.models import Site
from django.core.urlresolve... | pirata-cat/agora-ciudadana | userena/models.py | Python | agpl-3.0 | 15,318 | 0.002742 |
from .Node import error
SYNTAX_NODE_SERIALIZATION_CODES = {
# 0 is 'Token'. Needs to be defined manually
# 1 is 'Unknown'. Needs to be defined manually
'UnknownDecl': 2,
'TypealiasDecl': 3,
'AssociatedtypeDecl': 4,
'IfConfigDecl': 5,
'PoundErrorDecl': 6,
'PoundWarningDecl': 7,
'Pou... | atrick/swift | utils/gyb_syntax_support/NodeSerializationCodes.py | Python | apache-2.0 | 7,910 | 0 |
# Copyright 2021 Tecnativa - Sergio Teruel
# License AGPL-3.0 or later (http://www.gnu.org/licenses/lgpl).
{
"name": "Account Invoice Margin Sale Delivered Sync",
"summary": "Sync invoice margin between invoices and sale orders",
"version": "12.0.1.0.1",
"development_status": "Beta",
"maintainers":... | OCA/margin-analysis | account_invoice_margin_sale_delivered_sync/__manifest__.py | Python | agpl-3.0 | 676 | 0 |
'''
Contains Vmstat() class
Typical contents of vmstat file::
nr_free_pages 1757414
nr_inactive_anon 2604
nr_active_anon 528697
nr_inactive_file 841209
nr_active_file 382447
nr_unevictable 7836
nr_mlock 7837
nr_anon_pages 534070
nr_mapped 76013
nr_file_pages 1228693
nr_dirty 21
nr_... | eccles/lnxproc | lnxproc/vmstat.py | Python | mit | 3,041 | 0 |
# coding: utf-8
from __future__ import unicode_literals
from .common import InfoExtractor
from .pladform import PladformIE
from ..utils import (
unescapeHTML,
int_or_none,
ExtractorError,
)
class METAIE(InfoExtractor):
_VALID_URL = r'https?://video\.meta\.ua/(?:iframe/)?(?P<id>[0-9]+)'
_TESTS = [{
'url': 'htt... | valmynd/MediaFetcher | src/plugins/youtube_dl/youtube_dl/extractor/meta.py | Python | gpl-3.0 | 2,155 | 0.027855 |
# Fork: https://github.com/fabioz/u-msgpack-python
#
'''
This module provides a way to do full-duplex communication over a socket with umsgpack_s.
Basic usage is:
# Create our server handler (must handle decoded messages)
class ServerHandler(ConnectionHandler, UMsgPacker):
def _handle_d... | fabioz/mu-repo | mu_repo/umsgpack_s_conn.py | Python | gpl-3.0 | 15,598 | 0.003526 |
# -*- coding: utf-8 -*-
'''
Specto Add-on
Copyright (C) 2015 lambda
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any l... | repotvsupertuga/repo | plugin.video.pancas/resources/lib/libraries/control.py | Python | gpl-2.0 | 9,795 | 0.00827 |
# -*- coding: utf-8 -*-
#
# python-problem documentation build configuration file, created by
# sphinx-quickstart on Tue Dec 4 12:03:58 2012.
#
# 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.
... | mhabrnal/abrt | src/python-problem/doc/conf.py | Python | gpl-2.0 | 8,344 | 0.00755 |
from django.contrib.auth.decorators import (
login_required, permission_required
)
from django.core.urlresolvers import reverse
from django.db import IntegrityError
from django.shortcuts import render
from django.utils.translation import ugettext as _, ungettext
import reversion
from modoboa.lib import events
fr... | bearstech/modoboa-admin | modoboa_admin/views/alias.py | Python | mit | 4,252 | 0.000235 |
# -*- coding: utf-8 -*-
from south.utils import datetime_utils as datetime
from south.db import db
from south.v2 import SchemaMigration
from django.db import models
try:
from django.contrib.auth import get_user_model
except ImportError:
from django.contrib.auth.models import User
else:
User = get_user_mode... | canhhs91/greenpointtrees | src/paypal/pro/south_migrations/0001_initial.py | Python | mit | 7,020 | 0.008832 |
import socket
import time
import re
from util import hook
socket.setdefaulttimeout(10)
nick_re = re.compile(":(.+?)!")
# Auto-join on Invite (Configurable, defaults to True)
@hook.event('INVITE')
def invite(paraml, conn=None):
invite_join = conn.conf.get('invite_join', True)
if invite_join:
conn.jo... | blha303/ytbot | plugins/core_misc.py | Python | gpl-3.0 | 2,257 | 0.000886 |
#!/usr/bin/python
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
import codecs
import distutils.dir_util
import os
import shutil
import sys
def touch_file(file_path):
"""
Create a new empty file at file_path.
"""
parent_dir = os.path.abspath(os.path.join(file_path, os.pardir))
if... | geberl/droppy-workspace | Tasks/DropPy.Common/file_tools.py | Python | mit | 1,999 | 0.0005 |
import calendar
from dateutil.parser import parse
import os
from os import listdir
from os.path import isfile, join
from selfspy import config as cfg
from objc import YES, NO
from AppKit import *
from CBGraphView import CBGraphView
TIMELINE_WIDTH = 960
TIMELINE_HEIGHT = 20
WINDOW_PADDING = 18
def unixTimeFromStr... | activityhistory/selfspy | selfspy/helpers.py | Python | gpl-3.0 | 3,410 | 0.006452 |
# Copyright 2008-2014 Nokia Solutions and Networks
#
# 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... | eric-stanley/robotframework | src/robot/model/stats.py | Python | apache-2.0 | 6,017 | 0.000166 |
"""
Tools and data structures for working with genomic intervals (or sets of
regions on a line in general) efficiently.
"""
# For compatiblity with existing stuff
from bx.intervals.intersection import * | dnanexus/rseqc | rseqc/lib/bx/intervals/__init__.py | Python | gpl-3.0 | 204 | 0.009804 |
# -*- coding: utf-8 -*-
# Copyright (c) 2014-2016 Marcello Salvati
#
# This program is free software; you can redistribute it and/or
# modify it under the terms of the GNU General Public License as
# published by the Free Software Foundation; either version 3 of the
# License, or (at your option) any later version.
#
... | sechacking/MITMf | core/banners.py | Python | gpl-3.0 | 4,693 | 0.012703 |
"""Classification-based test and kernel two-sample test.
Author: Sandro Vega-Pons, Emanuele Olivetti.
"""
import os
import numpy as np
from sklearn.metrics import pairwise_distances, confusion_matrix
from sklearn.metrics import pairwise_kernels
from sklearn.svm import SVC
from sklearn.cross_validation import Stratifi... | emanuele/jstsp2015 | classif_and_ktst.py | Python | mit | 9,044 | 0.000442 |
# -*- coding: utf-8 -*-
# Form implementation generated from reading ui file 'effect_size_locations_page.ui'
#
# Created: Tue Aug 27 16:49:55 2013
# by: PyQt4 UI code generator 4.10.2
#
# WARNING! All changes made in this file will be lost!
from PyQt4 import QtCore, QtGui
try:
_fromUtf8 = QtCore.QString.fro... | gdietz/OpenMEE | common_wizard_pages/ui_effect_size_locations_page.py | Python | gpl-3.0 | 5,558 | 0.001799 |
# Imports environment-specific settings.
import os
import sys
try:
from colorama import init as colorama_init
except ImportError:
def colorama_init(autoreset=False, convert=None, strip=None, wrap=True):
"""
Fallback function that initializes colorama.
"""
pass
try:
from t... | django-settings/django-settings | myproject/myproject/user_settings.py | Python | unlicense | 2,239 | 0.003126 |
import cupy as cp
def read_code(code_filename, params):
with open(code_filename, 'r') as f:
code = f.read()
for k, v in params.items():
code = '#define ' + k + ' ' + str(v) + '\n' + code
return code
def benchmark(func, args, n_run):
times = []
for _ in range(n_run):
start... | cupy/cupy | examples/gemm/utils.py | Python | mit | 551 | 0 |
# -*- coding: utf-8 -*-
#
# Copyright (c) 2017 F5 Networks Inc.
# GNU General Public License v3.0 (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt)
from __future__ import (absolute_import, division, print_function)
__metaclass__ = type
import os
import json
import pytest
import sys
if sys.version_info < (2, ... | alxgu/ansible | test/units/modules/network/f5/test_bigip_device_facts.py | Python | gpl-3.0 | 4,137 | 0.001209 |
# Copyright (C) 2010-2011 Richard Lincoln
#
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the "Software"), to
# deal in the Software without restriction, including without limitation the
# rights to use, copy, modify, merge, publish... | rwl/PyCIM | CIM15/IEC61970/Informative/InfAssets/Medium.py | Python | mit | 4,176 | 0.002155 |
"""
Tests of the neo.io.pickleio.PickleIO class
"""
import os
import unittest
import numpy as np
import quantities as pq
from neo.core import Block, Segment, AnalogSignal, SpikeTrain, Epoch, Event, \
IrregularlySampledSignal, Group
from neo.io import PickleIO
from numpy.testing import assert_array_equal
from ne... | samuelgarcia/python-neo | neo/test/iotest/test_pickleio.py | Python | bsd-3-clause | 3,272 | 0.000306 |
# Time: O(m * n)
# Space: O(1)
# A 3 x 3 magic square is a 3 x 3 grid filled with
# distinct numbers from 1 to 9 such that each row, column,
# and both diagonals all have the same sum.
#
# Given an grid of integers, how many 3 x 3 "magic square" subgrids are there?
# (Each subgrid is contiguous).
#
# Example 1:
#
# I... | kamyu104/LeetCode | Python/magic-squares-in-grid.py | Python | mit | 1,889 | 0 |
#! /usr/bin/env python
#
# pyfacebook - Python bindings for the Facebook API
#
# Copyright (c) 2008, Samuel Cormier-Iijima
# All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions are met:
# * Redistributions o... | JustinTulloss/harmonize.fm | libs.py/facebook/__init__.py | Python | mit | 32,593 | 0.002976 |
def __bootstrap__():
global __bootstrap__, __loader__, __file__
import sys, pkg_resources, imp
__file__ = pkg_resources.resource_filename(__name__, '_unpacker.cp35-win32.pyd')
__loader__ = None; del __bootstrap__, __loader__
imp.load_dynamic(__name__,__file__)
__bootstrap__()
| stevenzhang18/Indeed-Flask | lib/pandas/msgpack/_unpacker.py | Python | apache-2.0 | 297 | 0.016835 |
# -*- coding: utf-8 -*-
##############################################################################
#
# Author: Yannick Vaucher
# Copyright 2013 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
# pub... | Antiun/carrier-delivery | delivery_carrier_label_postlogistics/delivery.py | Python | agpl-3.0 | 10,691 | 0 |
# coding=utf-8
# Copyright 2022 The Google Research Authors.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicab... | google-research/google-research | axial/config_imagenet32.py | Python | apache-2.0 | 1,760 | 0.000568 |
# Copyright 2010 United States Government as represented by the
# Administrator of the National Aeronautics and Space Administration.
# Copyright 2011 OpenStack Foundation
# All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance wi... | OpenDaisy/daisy-api | daisy/cmd/cache_cleaner.py | Python | apache-2.0 | 2,104 | 0.000951 |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
from django import forms
from paypal.pro.fields import CreditCardField, CreditCardExpiryField, CreditCardCVV2Field, CountryField
class PaymentForm(forms.Form):
"""Form used to process direct payments."""
firstname = forms.CharField(255, label="First Name... | bluestemscott/librarygadget | librarygadget/paypal/pro/forms.py | Python | mit | 1,840 | 0.003261 |
KEYS = (
'#',
'S-', 'T-', 'K-', 'P-', 'W-', 'H-', 'R-',
'A-', 'O-',
'*',
'-E', '-U',
'-F', '-R', '-P', '-B', '-L', '-G', '-T', '-S', '-D', '-Z',
)
IMPLICIT_HYPHEN_KEYS = ('A-', 'O-', '5-', '0-', '-E', '-U', '*')
SUFFIX_KEYS = ('-S', '-G', '-Z', '-D')
NUMBER_KEY = '#'
NUMBERS = {
'S-': '... | Germanika/plover | plover/system/english_stenotype.py | Python | gpl-2.0 | 6,232 | 0.024069 |
#!/usr/bin/python
r"""
PYTHONRC
========
Initialization script for the interactive Python interpreter. Its main purpose
is to enhance the overall user experience when working in such an environment
by adding some niceties to the standard console.
It also works with IPython and BPython, although its utility in that kin... | 0xf4/pythonrc | pythonrc.py | Python | mit | 19,310 | 0.000414 |
#!/usr/bin/python
"""
@package nilib
@file nicl.py
@brief Basic command line client for NI names, make 'em and check 'em
@version $Revision: 0.04 $ $Author: elwynd $
@version Copyright (C) 2012 Trinity College Dublin
This is an adjunct to the NI URI library developed as
part of the SAIL project. (http://sai... | skunkwerks/netinf | python/nilib/nicl.py | Python | apache-2.0 | 8,160 | 0.003922 |
#!/usr/bin/env python2.7
# -*- coding: utf-8 -*-
__author__ = """Co-Pierre Georg (co-pierre.georg@uct.ac.za)"""
import sys
from src.paralleltools import Parallel
#-------------------------------------------------------------------------
#
# conftools.py is a simple module to manage .xml configuration files
#
#-----... | cogeorg/econlib | test_paralleltools.py | Python | gpl-3.0 | 601 | 0.003328 |
"""
Summary:
Container and main interface for accessing the Tuflow model and a class
for containing the main tuflow model files (Tcf, Tgc, etc).
There are several other classes in here that are used to determine the
order of the files in the model and key words for reading in the files.
... | duncan-r/SHIP | ship/tuflow/tuflowmodel.py | Python | mit | 22,689 | 0.003261 |
import json
import unittest2
from google.appengine.ext import testbed
from consts.media_type import MediaType
from helpers.media_helper import MediaParser
from helpers.webcast_helper import WebcastParser
class TestMediaUrlParser(unittest2.TestCase):
def setUp(cls):
cls.testbed = testbed.Testbed()
... | fangeugene/the-blue-alliance | tests/suggestions/test_media_url_parse.py | Python | mit | 10,138 | 0.004636 |
"""
General utility functions and classes for Topographica that require numpy.
"""
import re
from numpy import sqrt,dot,arctan2,array2string,fmod,floor,array, \
unravel_index,concatenate,set_printoptions,divide,maximum,minimum
from numpy import ufunc
import param
# Ask numpy to print even relatively large arra... | Tasignotas/topographica_mirror | topo/base/arrayutil.py | Python | bsd-3-clause | 4,625 | 0.017514 |
'''
Learning-curve test functionality.
Author: Pontus Stenetorp <pontus stenetorp se>
Version: 2011-08-29
'''
from collections import defaultdict
from itertools import chain, izip
from operator import itemgetter
from os.path import join as path_join
from random import sample, seed
from sys import stderr
fr... | ninjin/simsem | experiment/learning.py | Python | isc | 17,339 | 0.006863 |
# YouTube Video: https://www.youtube.com/watch?v=RRK0gd77Ln0
# Given a string, calculate the length of the string.
input_str = "LucidProgramming"
# Standard Pythonic way:
# print(len(input_str))
# Iterative length calculation: O(n)
def iterative_str_len(input_str):
input_str_len = 0
for i in range(len(input... | vprusso/youtube_tutorials | algorithms/recursion/str_len.py | Python | gpl-3.0 | 615 | 0.00813 |
"""
Written by Matthew Cook
Created August 4, 2016
mattheworion.cook@gmail.com
Script to do basic sytax conversion between Python 3 and R syntax.
What it does convert:
-assignment operator
-function definitions
-filename
-inline arithmetic (*=, +=, -=, **)
-':' to '{'
-'not' to '!... | mcook42/Py_R_Converters | py2r-syntax-converter.py | Python | mit | 11,063 | 0.003073 |
# 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... | gunan/tensorflow | tensorflow/python/kernel_tests/pool_test.py | Python | apache-2.0 | 14,854 | 0.00579 |
# -*- coding: utf-8 -*-
# Generated by Django 1.11.10 on 2018-03-05 09:24
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('rules', '0057_auto_20180302_1312'),
]
operations = [
migrations.AddField(
model_name='source',
... | StamusNetworks/scirius | rules/migrations/0058_source_public_source.py | Python | gpl-3.0 | 440 | 0 |
import pyfits as pyf
import pylab as pyl
full = pyf.getdata('./data/gs_all_tf_h_130511b_multi.fits')
sample = pyf.getdata('../samples/sample_1.5_3.5_gs_all.fits')
f = pyl.figure(1)
f1 = f.add_subplot(111)
for i in range(len(sample)):
ID = sample['ID'][i]
H_flux = full['WFC3_F160W_FLUX'][i-1]
H_flux_err =... | boada/ICD | sandbox/legacy_plot_code/ston_test.py | Python | mit | 488 | 0.004098 |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
#
# This file is part of GNUWiNetwork,
# Copyright (C) 2014 by
# Pablo Belzarena, Gabriel Gomez Sena, Victor Gonzalez Barbone,
# Facultad de Ingenieria, Universidad de la Republica, Uruguay.
#
# GNUWiNetwork is free software: you can redistribute it ... | git-artes/GNUWiNetwork | gwn/gwnevents/api_events.py | Python | gpl-3.0 | 2,996 | 0.00534 |
#!/usr/bin/env python
# Copyright (C) 2015 Wayne Warren
#
# 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... | tamac-io/jenkins-job-builder | jenkins_jobs/cli/entry.py | Python | apache-2.0 | 5,508 | 0.000182 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.