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 |
|---|---|---|---|---|---|
# -*- coding: utf-8 -*-
"""
pygments.lexers.shell
~~~~~~~~~~~~~~~~~~~~~
Lexers for various shells.
:copyright: Copyright 2006-2017 by the Pygments team, see AUTHORS.
:license: BSD, see LICENSE for details.
"""
import re
from pygments.lexer import Lexer, RegexLexer, do_insertions, bygroups, \
... | lmregus/Portfolio | python/design_patterns/env/lib/python3.7/site-packages/pygments/lexers/shell.py | Python | mit | 32,583 |
import random
from django import template
from django.conf import settings
from django.contrib.sites.models import Site
from friends.models import Friendship, FriendshipInvitation
from socialregistration.models import FacebookProfile
register = template.Library()
@register.inclusion_tag('social/inclusion_tags/twitt... | praekelt/jmbo-social | social/templatetags/social_inclusion_tags.py | Python | bsd-3-clause | 3,195 |
#!/usr/bin/env python
# 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/.
# Copyright (c) 2014 Mozilla Corporation
#
# Contributors:
# Jeff Bryner jbryner@mozilla.com
impo... | ameihm0912/MozDef | cron/collectSSHFingerprints.py | Python | mpl-2.0 | 5,571 |
# Copyright (c) 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 with the License. You may obtain
# a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless ... | OpenAcademy-OpenStack/nova-scheduler | nova/scheduler/host_manager.py | Python | apache-2.0 | 18,788 |
#!/usr/bin/env python
"""eventfd: maintain an atomic counter inside a file descriptor"""
from cffi import FFI
import errno
ffi = FFI()
ffi.cdef("""
#define EFD_CLOEXEC ...
#define EFD_NONBLOCK ...
#define EFD_SEMAPHORE ...
int eventfd(unsigned int initval, int flags);
""")
C = ffi.verify("""
#include <sys/eventfd.h>... | arkaitzj/python-butter | butter/_eventfd.py | Python | bsd-3-clause | 2,534 |
from __future__ import unicode_literals
import json
from moto.core.responses import BaseResponse
from .models import iot_backends
class IoTResponse(BaseResponse):
SERVICE_NAME = 'iot'
@property
def iot_backend(self):
return iot_backends[self.region]
def create_thing(self):
thing_na... | okomestudio/moto | moto/iot/responses.py | Python | apache-2.0 | 17,089 |
# -*- coding: utf-8 -*-
# Part of Odoo. See LICENSE file for full copyright and licensing details.
from odoo import api, fields, models
class Users(models.Model):
_inherit = 'res.users'
karma = fields.Integer('Karma', default=0)
karma_tracking_ids = fields.One2many('gamification.karma.tracking', 'user_i... | ygol/odoo | addons/gamification/models/res_users.py | Python | agpl-3.0 | 12,734 |
import _plotly_utils.basevalidators
class FamilyValidator(_plotly_utils.basevalidators.StringValidator):
def __init__(
self, plotly_name="family", parent_name="heatmapgl.hoverlabel.font", **kwargs
):
super(FamilyValidator, self).__init__(
plotly_name=plotly_name,
parent... | plotly/plotly.py | packages/python/plotly/plotly/validators/heatmapgl/hoverlabel/font/_family.py | Python | mit | 574 |
# Copyright 2013-2021 Lawrence Livermore National Security, LLC and other
# Spack Project Developers. See the top-level COPYRIGHT file for details.
#
# SPDX-License-Identifier: (Apache-2.0 OR MIT)
from spack import *
class Mg(Package):
"""Mg is intended to be a small, fast, and portable editor for people
who... | LLNL/spack | var/spack/repos/builtin/packages/mg/package.py | Python | lgpl-2.1 | 1,183 |
# This file is part of the Frescobaldi project, http://www.frescobaldi.org/
#
# Copyright (c) 2008 - 2014 by Wilbert Berendsen
#
# 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
... | anthonyfok/frescobaldi | frescobaldi_app/snippet/expand.py | Python | gpl-2.0 | 3,394 |
from django.core.exceptions import PermissionDenied
from django.core.urlresolvers import reverse
from django.shortcuts import redirect, get_object_or_404
from django.template.response import TemplateResponse
from django.utils.translation import ugettext_lazy as _
from django.views.decorators.http import require_POST
fr... | papedaniel/oioioi | oioioi/forum/views.py | Python | gpl-3.0 | 11,557 |
LIMIT = 2000000
SIZE = (LIMIT - 1) // 2
def f():
ans = 2
sieve = [False] * SIZE
for i in range(0, SIZE):
if not sieve[i]:
p = 2 * i + 3
ans += p
for j in range(p * p, LIMIT, 2 * p):
sieve[(j - 3) // 2] = True
return ans
import ctypes
imp... | japaric/eulermark.rs | problems/010/010.py | Python | apache-2.0 | 1,006 |
# Copyright Red Hat 2017, Jake Hunsaker <jhunsake@redhat.com>
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 2 of the License, or
# (at your option) any later version.
# This pr... | TurboTurtle/clustersos | clustersos/clusters/ovirt.py | Python | gpl-2.0 | 4,079 |
# -*- coding: utf-8 -*-
import PyQt5.QtWidgets as Qw
from . import parameters as par
class Text_line(Qw.QLineEdit):
"""Text Line Class"""
def __init__(self, val='', parent=None):
super().__init__(parent)
self.set(val)
self.setMinimumHeight(par.MIN_HEIGHT)
def set(self, txt):
... | tedlaz/pyted | ted17/ted17/w_textline.py | Python | gpl-3.0 | 562 |
from __future__ import annotations
import logging
from collections import OrderedDict
import scipy.sparse
import numpy as np
from typing import (
Any,
Dict,
Text,
List,
Tuple,
Callable,
Set,
Optional,
Type,
Union,
)
from rasa.engine.graph import ExecutionContext, GraphComponent... | RasaHQ/rasa_nlu | rasa/nlu/featurizers/sparse_featurizer/lexical_syntactic_featurizer.py | Python | apache-2.0 | 21,849 |
import os
from celery import Celery
from django.conf import settings
# set the default Django settings module for the 'celery' program.
os.environ.setdefault('DJANGO_SETTINGS_MODULE', 'songaday_searcher.settings')
app = Celery('songaday_searcher')
app.config_from_object('django.conf:settings')
app.autodiscover_tasks(l... | zaneswafford/songaday_searcher | songaday_searcher/celery.py | Python | bsd-3-clause | 352 |
"""initial migration
Revision ID: 5092888353e6
Revises: None
Create Date: 2015-06-17 11:17:05.868000
"""
# revision identifiers, used by Alembic.
revision = '5092888353e6'
down_revision = None
from alembic import op
import sqlalchemy as sa
def upgrade():
### commands auto generated by Alembic - please adjust!... | andela-bojengwa/team3 | monitorbot_api/migrations/versions/5092888353e6_initial_migration.py | Python | mit | 2,886 |
"""
IknowInnov - Innovation Team Repository and official Web Site
"""
# Always prefer setuptools over distutils
from setuptools import setup, find_packages
# To use a consistent encoding
from codecs import open
from os import path
here = path.abspath(path.dirname(__file__))
# Get the long description from the README... | rickyaeztor/watson-virtual-infra-mgt-system | setup.py | Python | apache-2.0 | 677 |
# -*- coding: utf-8 -*-
from django.conf import settings
from django.core.exceptions import ImproperlyConfigured
def use_ga(_):
"""
Get the USE_GA env variable.
:rtype: dict
"""
try:
return {'use_ga': settings.USE_GA}
except AttributeError:
raise ImproperlyConfigured('USE_GA n... | andreipetre/django-project-heroku | tools/context_processors.py | Python | mit | 330 |
# -*- coding: utf-8 -*-
import copy
from functools import wraps
import json
import sys
import django
from django.contrib.admin.helpers import AdminForm
from django.conf import settings
from django.conf.urls import url
from django.contrib import admin, messages
from django.contrib.admin.models import LogEntry, CHANGE
... | vxsx/django-cms | cms/admin/pageadmin.py | Python | bsd-3-clause | 74,374 |
# -*- coding: utf-8 -*-
"""
Settings for project
"""
from __future__ import absolute_import
import os
import hashlib
import base64
from celery.schedules import crontab
import djcelery
djcelery.setup_loader()
BASE_DIR = os.path.dirname(os.path.dirname(__file__))
SECRET_KEY = '|N9./dYpiLS.."..7|__0054d2e0--bc40086... | xj9/wampum | core/settings.py | Python | gpl-3.0 | 5,942 |
# Copyright 2017 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.
DEPS = [
'git',
'recipe_engine/step',
]
def RunSteps(api):
api.step('1', cmd=['git', 'status'])
with api.git.env():
api.step('2', cmd=['git', ... | Hikari-no-Tenshi/android_external_skia | infra/bots/recipe_modules/git/examples/full.py | Python | bsd-3-clause | 377 |
import datetime
import math
import smtplib
import sys
import time
from Keysight34972A import Keysight34972A
from Fluke7341 import Fluke7341
from Fluke1502A import Fluke1502A
class RingBuffer():
def __init__(self, size):
self.size = size
self.buffer = [0] * size
self.pointer = 0
... | geocryology/GeoCryoLabPy | equipment/Controller.py | Python | gpl-3.0 | 17,230 |
#!/usr/bin/env python3
import argparse
import numpy as np
import random
import sys
parser = argparse.ArgumentParser()
parser.add_argument('ref_vectors')
parser.add_argument('vectors')
parser.add_argument('-n', type=int, default=500000)
parser.add_argument('-k', type=int, default=1)
parser.add_argument('-m', type=int... | eske/seq2seq | scripts/post_editing/select-by-ter.py | Python | apache-2.0 | 1,303 |
import subprocess
import json
import os
import argparse
import cv2
import shutil
import math
import colorsys
from dominantColor import colorz
from operator import itemgetter
from PIL import Image, ImageFilter, ImageStat, ImageChops
parser = argparse.ArgumentParser(description='Tries to find a good thumbnail for a vide... | luhmann/movie-thumbnails | thumbs.py | Python | mit | 6,157 |
from array import array
# not working
def string_permute_iterative(ar, hi):
lo = index = 0
stack = [(lo, index)]
while lo<=index<=hi:
if lo == hi:
while stack:
lo, index = stack.pop()
ar[lo], ar[index] = ar[index], ar[lo]
if lo == index:
... | codecakes/algorithms_monk | string/string_permutation.py | Python | mit | 1,318 |
#!/usr/bin/env python3
"""docstring"""
import argparse
import os
import re
import sys
from collections import defaultdict
# --------------------------------------------------
def get_args():
"""get args"""
parser = argparse.ArgumentParser(description='Annotate UProC')
parser.add_argument('-k', '--kegg_out... | kyclark/metagenomics-book | python/uproc/annotate_uproc.py | Python | gpl-3.0 | 2,538 |
# projecteuler.com/problem=7
def main():
res = NstPrime(10001)
print(res)
#for i in range(1, 100):
#if isPrime(i):
#print(i)
def NstPrime(n):
i = 2
while n >= 1:
if isPrime(i):
n = n - 1
i = i + 1
return i-1
def isPrime(n):
i = n-1
while i > 1:
if n % i == 0:
return F... | yuriyshapovalov/Prototypes | ProjectEuler/python/prob7.py | Python | apache-2.0 | 392 |
# Copyright 2015, Google, 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 agreed to in writing, s... | JPO1/python-docs-samples | blog/introduction_to_data_models_in_cloud_datastore/blog.py | Python | apache-2.0 | 3,748 |
# -*- coding: utf-8 -*-
# OpenERP, Open Source Management Solution
# Copyright (c) 2015 Rooms For (Hong Kong) Limited T/A OSCG
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU Affero General Public License as
# published by the Free Software Foundat... | rfhk/ykt-custom | report_task_construction_order/__openerp__.py | Python | agpl-3.0 | 1,472 |
import json
from boto.sqs.message import Message
class SQSJSONMessage(Message):
def encode(self, value):
return json.dumps(value)
def decode(self, value):
return json.loads(value) | alesdotio/motorway | motorway/contrib/amazon_sqs/utils.py | Python | apache-2.0 | 206 |
# -*- 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 or... | googleads/google-ads-python | google/ads/googleads/v9/services/types/landing_page_view_service.py | Python | apache-2.0 | 1,245 |
"""HTTP related errors."""
from asyncio import TimeoutError
__all__ = (
'DisconnectedError', 'ClientDisconnectedError', 'ServerDisconnectedError',
'HttpProcessingError', 'BadHttpMessage',
'HttpMethodNotAllowed', 'HttpBadRequest', 'HttpProxyError',
'BadStatusLine', 'LineTooLong', 'InvalidHeader',
... | esaezgil/aiohttp | aiohttp/errors.py | Python | apache-2.0 | 4,390 |
from toontown.coghq.SellbotCogHQLoader import SellbotCogHQLoader
from toontown.toonbase import ToontownGlobals
from toontown.hood.CogHood import CogHood
class SellbotHQ(CogHood):
notify = directNotify.newCategory('SellbotHQ')
ID = ToontownGlobals.SellbotHQ
LOADER_CLASS = SellbotCogHQLoader
def load(... | Spiderlover/Toontown | toontown/hood/SellbotHQ.py | Python | mit | 634 |
# -*- coding: utf-8 -*-
# Part of Odoo. See LICENSE file for full copyright and licensing details.
{
'name': 'Online Members Directory',
'category': 'Website',
'summary': 'Publish your members directory',
'version': '1.0',
'description': """
Publish your members/association directory publicly.
... | t3dev/odoo | addons/website_membership/__manifest__.py | Python | gpl-3.0 | 711 |
# Copyright 2014 Red Hat 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 ag... | barnsnake351/nova | nova/objects/numa.py | Python | apache-2.0 | 8,564 |
# 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 agreed to in writing, s... | GoogleCloudPlatform/pubsub | load-test-framework/run.py | Python | apache-2.0 | 1,022 |
# -*- coding: utf-8 -*-
#!/usr/bin/python
__doc__ = '''
Reasonable Python
A module for integrating F-logic into Python
f2py.py --- translating F-logic back to Python
by Markus Schatten <markus_dot_schatten_at_foi_dot_hr>
Faculty of Organization and Informatics,
Varaždin, Croatia, 2007
This library is free softwar... | johannesloetzsch/reasonablepy | rp/f2py.py | Python | lgpl-2.1 | 3,062 |
"""
Django settings for tests project.
For more information on this file, see
https://docs.djangoproject.com/en/1.6/topics/settings/
For the full list of settings and their values, see
https://docs.djangoproject.com/en/1.6/ref/settings/
"""
# Build paths inside the project like this: os.path.join(BASE_DIR, ...)
impo... | zakuro9715/django-static-site | tests/settings.py | Python | mit | 1,988 |
from ChannelSelection import ChannelSelection, BouquetSelector, SilentBouquetSelector
from Components.ActionMap import ActionMap, HelpableActionMap
from Components.ActionMap import NumberActionMap
from Components.Harddisk import harddiskmanager
from Components.Input import Input
from Components.Label import Label
from... | kajgan/stbgui | lib/python/Screens/InfoBarGenerics.py | Python | gpl-2.0 | 127,100 |
"""
Class to represent the whole setup (a bunch of nodes)
"""
import logging
import yaml
from stitches.connection import Connection
class Structure(object):
"""
Stateful object to represent whole setup
"""
def __init__(self):
self.logger = logging.getLogger('stitches.structure')
sel... | RedHatQE/python-stitches | stitches/structure.py | Python | gpl-3.0 | 3,076 |
#!/usr/bin/env python2
# vim:fileencoding=UTF-8:ts=4:sw=4:sta:et:sts=4:ai
from __future__ import with_statement
__license__ = 'GPL v3'
__copyright__ = '2009, Kovid Goyal <kovid@kovidgoyal.net>'
__docformat__ = 'restructuredtext en'
__all__ = [
'pot', 'translations', 'get_translations', 'iso639', 'iso3166',
... | user-none/calibre | setup/commands.py | Python | gpl-3.0 | 2,911 |
import unittest
from zen import *
import networkx
import random
class AllPairsDijkstraPathLength_TestCase(unittest.TestCase):
def test_apdp_undirected_w_weights(self):
G = Graph()
G.add_edge(1,2,weight=4)
G.add_edge(2,3,weight=1)
G.add_edge(1,4,weight=2)
G.add_edge(4,5,weight=1)
G.add_edge(5,3,weight=... | networkdynamics/zenlib | src/zen/tests/dijkstra.py | Python | bsd-3-clause | 12,161 |
import numpy as np
from matplotlib.testing.decorators import image_comparison
import matplotlib.pyplot as plt
@image_comparison(baseline_images=['legend_auto1'], tol=1.5e-3, remove_text=True)
def test_legend_auto1():
'Test automatic legend placement'
fig = plt.figure()
ax = fig.add_subplot(111)
x = n... | lthurlow/Network-Grapher | proj/external/matplotlib-1.2.1/lib/matplotlib/tests/test_legend.py | Python | mit | 1,640 |
#!/usr/bin/env python
"""
Calculate MD5 hash of a file.
Copyright (c) 2014, Are Hansen
All rights reserved.
Redistribution and use in source and binary forms, with or without modification, are
permitted provided that the following conditions are met:
1. Redistributions of source code must retain the above copyri... | ZombieNinjaPirate/Random-Python | filemd5.py | Python | gpl-3.0 | 2,374 |
import os
import numpy as np
from pymatgen.core.lattice import Lattice
from pymatgen.core.structure import Structure
from pymatgen.core.trajectory import Trajectory
from pymatgen.io.vasp.inputs import Poscar
from pymatgen.io.vasp.outputs import Xdatcar
from pymatgen.util.testing import PymatgenTest
class Trajectory... | gmatteo/pymatgen | pymatgen/core/tests/test_trajectory.py | Python | mit | 19,694 |
"""
Evaluate the value of an arithmetic expression in Reverse Polish Notation.
Valid operators are +, -, *, /. Each operand may be an integer or another expression.
Some examples:
["2", "1", "+", "3", "*"] -> ((2 + 1) * 3) -> 9
["4", "13", "5", "/", "+"] -> (4 + (13 / 5)) -> 6
"""
class Solution:
# @param tok... | Ahmed--Mohsen/leetcode | evaluate_reverse_polish_notation.py | Python | mit | 1,580 |
# -*- coding: utf-8 -*-
# Copyright 2012 Loris Corazza, Sakis Christakidis
#
# 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... | schristakidis/p2ner | p2ner/components/stats/dbstats/dbstats/db.py | Python | apache-2.0 | 2,264 |
# -*- 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 or... | googleads/google-ads-python | google/ads/googleads/v8/services/types/topic_constant_service.py | Python | apache-2.0 | 1,217 |
# This module contains functions used to manipulate the AstroData object
import numpy as np
from astrodata import Errors
from astrodata.adutils import logutils
def remove_single_length_dimension(adinput=None):
"""
If there is only one single length dimension in the pixel data, the
remove_single_length_dim... | pyrrho314/recipesystem | trunk/gempy/adlibrary/manipulate_ad.py | Python | mpl-2.0 | 3,293 |
from copy import copy
import random
prev = 1805
curr = 2150
MIN_C = 0
MAX_C = 4999
direction = 1 if curr - prev > 0 else -1
arr = [2069, 1212, 2296, 2800, 544, 1618, 356, 1523, 4965, 3681]
def prt_move_msg(f, t):
print('move from cylinder {} to cylinder {} '.format(f, t))
def search_min_and_return_index(arra... | CubicPill/wtfcodes | py/disk_sched_calc.py | Python | mit | 3,899 |
"""SCons.Tool.sgic++
Tool-specific initialization for MIPSpro C++ on SGI.
There normally shouldn't be any need to import this module directly.
It will usually be imported through the generic SCons.Tool.Tool()
selection method.
"""
#
# Copyright (c) 2001 - 2015 The SCons Foundation
#
# Permission is hereby granted, ... | Uli1/mapnik | scons/scons-local-2.4.0/SCons/Tool/sgic++.py | Python | lgpl-2.1 | 2,025 |
codes = {
307: 'Temporary Redirect',
303: 'See Other',
302: 'Found',
301: 'Moved Permanently'
}
def authRequired(realm):
return {
'status': 401,
'reason': 'Authentication Required',
'headers': [
('Content-type','text/plain'),
('WWW-Authenticate', 'Basic realm="%s"' % realm)
],
'body': 'Authentic... | xelphene/swaf | swaf/resp.py | Python | gpl-3.0 | 2,300 |
from collections import Iterator
print(isinstance([], Iterator))
print(isinstance((x for x in range(10)), Iterator))
print(isinstance({}, Iterator))
it = iter([1, 2, 3, 4, 5])
# 循环:
while True:
try:
# 获得下一个值:
x = next(it)
print(x)
except StopIteration:
# 遇到StopIte... | IIIIIIIIll/sdy_notes_liaoxf | LiaoXueFeng/Advanced_properties/iterator.py | Python | gpl-3.0 | 376 |
# Copyright (c) 2012 Google Inc. All rights reserved.
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
from __future__ import print_function
import ntpath
import os
import posixpath
import re
import subprocess
import sys
from collections import OrderedDict
import... | arvenil/resume | node_modules/node-gyp/gyp/pylib/gyp/generator/msvs.py | Python | mit | 150,414 |
from django.contrib import admin
from accounts.models import Account
admin.site.register(Account)
| akash-dev-github/Transactions | transactions/accounts/admin.py | Python | mit | 100 |
import webapp2, logging
from database import get_feed_source_by_name, store_feed_source, \
get_feed_source_by_url, change_feed_source_url
class AddHandler(webapp2.RequestHandler):
def post(self):
from database import FeedSource
name = self.request.get('name')
url = self.request.get('url')
frequency_... | phistuck/FrequentFeedScraper | add_handler.py | Python | mit | 1,694 |
# -*- coding: utf-8 -*-
#
## This file is part of Invenio.
## Copyright (C) 2012, 2014 CERN.
##
## Invenio 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 opti... | MSusik/invenio | invenio/modules/sequencegenerator/models.py | Python | gpl-2.0 | 1,370 |
# coding: utf-8
# Licensed under a 3-clause BSD style license - see LICENSE.rst
"""
Test Structured units and quantities.
"""
import pytest
import numpy as np
from numpy.testing import assert_array_equal
from astropy import units as u
from astropy.units import StructuredUnit, Unit, UnitBase, Quantity
from astropy.util... | lpsinger/astropy | astropy/units/tests/test_structured.py | Python | bsd-3-clause | 27,642 |
# File generated from our OpenAPI spec
from __future__ import absolute_import, division, print_function
from stripe import util
from stripe.api_resources.abstract import APIResource
from stripe.api_resources.customer import Customer
from stripe.six.moves.urllib.parse import quote_plus
class CustomerBalanceTransactio... | stripe/stripe-python | stripe/api_resources/customer_balance_transaction.py | Python | mit | 963 |
from .context import Context, QueryDict
def build_context(api, resource, request):
try:
# Django may raise RawPostDataException sometimes;
# i.e. when processing POST multipart/form-data;
# In that cases we can't access raw body anymore, sorry
raw_body = request.body
except:
... | marcinn/restosaur | restosaur/dispatch.py | Python | bsd-2-clause | 1,852 |
def brooke2():
i01.attach()
fullspeed()
gestureforlondon3()
sleep(2)
i01.detach()
sleep(30)
brooke3() | MyRobotLab/pyrobotlab | home/hairygael/GESTURES/brooke2.py | Python | apache-2.0 | 136 |
# -*- 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 'Document.court'
db.delete_column('Document', 'court_id')
def backwards(self, orm):
... | shashi792/courtlistener | alert/search/migrations/0028_delete_court_field.py | Python | agpl-3.0 | 9,911 |
# -*- coding: utf-8 -*-
""" Core components """
from boto.exception import JSONResponseError, BotoServerError
from dynamic_dynamodb import calculators
from dynamic_dynamodb.aws import dynamodb, sns
from dynamic_dynamodb.core import circuit_breaker
from dynamic_dynamodb.statistics import table as table_stats
from dynam... | omnidavesz/dynamic-dynamodb | dynamic_dynamodb/core/table.py | Python | apache-2.0 | 27,449 |
#!/usr/bin/env python
"""These flows are designed for high performance transfers."""
import hashlib
import time
import zlib
import logging
from grr.lib import aff4
from grr.lib import flow
from grr.lib import rdfvalue
from grr.lib.aff4_objects import filestore
from grr.lib.rdfvalues import client as rdf_client
from ... | statik/grr | lib/flows/general/transfer.py | Python | apache-2.0 | 30,601 |
import os
import tensorflow as tf
import numpy as np
import tarfile
import icdar
tf.app.flags.DEFINE_string('tarfile',
'data.tar.gz',
'tarfile to uncompress')
tf.app.flags.DEFINE_string('tarpath', '', 'tarfile inner path')
FLAGS = tf.app.flags.FLAGS
TMP_OUTPU... | ucloud/uai-sdk | examples/tensorflow/train/east/code/icdar_dataset.py | Python | apache-2.0 | 3,472 |
#
# Module implementing queues
#
# multiprocessing/queues.py
#
# Copyright (c) 2006-2008, R Oudkerk
# All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions
# are met:
#
# 1. Redistributions of source code must ret... | Symmetry-Innovations-Pty-Ltd/Python-2.7-for-QNX6.5.0-x86 | usr/pkg/lib/python2.7/multiprocessing/queues.py | Python | mit | 12,547 |
# -*- coding: utf-8 -*-
from __future__ import absolute_import
import json
import uuid
import tornado.web
from .exceptions import \
FieldMissingException, \
InvalidMethodException, \
FormattingException, \
NotFoundException, \
ValueInvalidException, \
APIException
class BaseApi(tornado.web... | py-xia/xia | xia/api.py | Python | mit | 4,551 |
# -*- coding: utf-8 -*-
"""
Tests of responsetypes
"""
from datetime import datetime
import json
import os
import pyparsing
import random
import unittest
import textwrap
import requests
import mock
from . import new_loncapa_problem, test_capa_system
import calc
from capa.responsetypes import LoncapaProblemError, \
... | pelikanchik/edx-platform | common/lib/capa/capa/tests/test_responsetypes.py | Python | agpl-3.0 | 86,450 |
import os
import numpy as np
from scipy.stats.mstats import gmean
import sklearn.model_selection
import paths
import labels
from datasets import mlb
import find_best_threshold
np.set_printoptions(threshold=np.nan)
np.set_printoptions(suppress=True)
def submit_cv_ensemble(ensemble, output_file):
thresholds = []... | Mctigger/KagglePlanetPytorch | submit_predictions.py | Python | mit | 2,315 |
from rasa_nlu.components import Component
from rasa_nlu import utils
from rasa_nlu.model import Metadata
#import nltk, os
#from nltk.sentiment.vader import SentimentIntensityAnalyzer
from vaderSentiment.vaderSentiment import SentimentIntensityAnalyzer
from textblob import TextBlob
# pipeline name: "sentiment.sentiment... | Ventrosky/python-scripts | nlp-scripts/sentiment.py | Python | gpl-3.0 | 1,974 |
# This program is free software; you can redistribute it and/or modify
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 2 of the License, or
# (at your option) any later version.
... | mlba-team/open-lighting | tools/rdm/TestMixins.py | Python | lgpl-2.1 | 18,035 |
#
# Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance with the License. You may obtain
# a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# ... | akash1808/python-novaclient | novaclient/tests/v1_1/test_usage.py | Python | apache-2.0 | 1,951 |
import discord
from sigma.core.permission import check_admin, set_channel_nsfw
async def nsfwpermit(cmd, message, args):
channel = message.channel
if check_admin(message.author, channel):
if set_channel_nsfw(cmd.db, channel.id):
embed = discord.Embed(color=0x9933FF,
... | AXAz0r/apex-sigma | sigma/plugins/nsfw/nsfwpermit.py | Python | gpl-3.0 | 750 |
# -*- coding: utf-8 -*-
#
# simpleapi documentation build configuration file, created by
# sphinx-quickstart on Wed Apr 21 21:02:02 2010.
#
# 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.
#
# A... | flosch/simpleapi | docs/conf.py | Python | mit | 6,460 |
#
# Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance with the License. You may obtain
# a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# ... | miguelgrinberg/heat | heat/engine/service_software_config.py | Python | apache-2.0 | 12,480 |
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('account', '0009_auto_20151120_0859'),
]
operations = [
migrations.AlterField(
model_name='userprofile',
... | SISTEMAsw/TAMP | gui/account/migrations/0010_auto_20151120_0904.py | Python | mit | 436 |
import unittest
import requests_mock
from alertaclient.api import Client
class GroupTestCase(unittest.TestCase):
def setUp(self):
self.client = Client()
self.key = """
{
"group": {
"count": 0,
"href": "http://localhost:8080/gr... | alerta/python-alerta | tests/unit/test_groups.py | Python | mit | 939 |
# Copyright (c) 2015-2016, NVIDIA CORPORATION. All rights reserved.
import mock
import tempfile
from . import resize_image
from digits import test_utils
test_utils.skipIfNotFramework('none')
class TestOutputValidation():
def test_no_filename(self):
assert resize_image.validate_output_file(None), 'Al... | gheinrich/DIGITS-GAN | digits/tools/test_resize_image.py | Python | bsd-3-clause | 2,136 |
#!/usr/bin/env python
import plotly.plotly as py
from plotly.graph_objs import Data, Layout, Figure, Scatter, Marker
from vsc.pbs.pbsnodes import PbsnodesParser
from vsc.plotly_utils import create_annotations, sign_in
def compute_coordinates(x, y, options):
x_coords = []
y_coords = []
for j in xrange(1, ... | gjbex/vsc-monitoring | scripts/plot_cluster_load_map.py | Python | lgpl-3.0 | 8,306 |
# vim: tabstop=4 shiftwidth=4 softtabstop=4
# Copyright 2012 United States Government as represented by the
# Administrator of the National Aeronautics and Space Administration.
# All Rights Reserved.
#
# Copyright 2012 Nebula, Inc.
#
# Licensed under the Apache License, Version 2.0 (the "License"); you may
# no... | tylertian/Openstack | openstack F/horizon/horizon/tests/testurls.py | Python | apache-2.0 | 1,381 |
'''Configuration file for the FENS2014 poster figures.'''
from __future__ import absolute_import, print_function
scale_factor = 2.5
tick_width = 1. * scale_factor
tick_len = 6. * scale_factor
def get_config():
return _config
_config = {
'scale_factor': scale_factor,
# Sections
'mpl': {
'... | MattNolanLab/ei-attractor | grid_cell_model/simulations/007_noise/figures/fens2014-poster/config.py | Python | gpl-3.0 | 3,260 |
#!/usr/bin/env python
#-*- coding:utf-8 -*-
# Copyright (C) 2009 Francesco Piccinno
#
# Author: Francesco Piccinno <stack.box@gmail.com>
#
# 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 ... | nopper/pygtkhex | tests/testcase.py | Python | gpl-2.0 | 9,177 |
#-----------------------------------------------------------------------------
# Copyright (c) 2012 - 2019, Anaconda, Inc., and Bokeh Contributors.
# All rights reserved.
#
# The full license is in the file LICENSE.txt, distributed with this software.
#-------------------------------------------------------------------... | timsnyder/bokeh | bokeh/protocol/messages/ok.py | Python | bsd-3-clause | 2,504 |
# -*- coding: utf-8 -*-
from django.core.mail import EmailMultiAlternatives
from django.template import Context, Template
from django.template.loader import get_template
from helpers import ClientRouter, MailAssetsHelper, strip_accents
class UserMail:
"""
This class is responsible for firing emails for User... | atados/api | atados_core/emails.py | Python | mit | 7,061 |
# -*- coding: utf-8 -*-
"""
Code to manage fetching and storing the metadata of IdPs.
"""
#pylint: disable=no-member
from celery.task import task # pylint: disable=import-error,no-name-in-module
import datetime
import dateutil.parser
import logging
from lxml import etree
import requests
from onelogin.saml2.utils impor... | mushtaqak/edx-platform | common/djangoapps/third_party_auth/tasks.py | Python | agpl-3.0 | 6,642 |
# Copyright 2013 Big Switch Networks 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 r... | vichoward/python-neutronclient | neutronclient/tests/unit/fw/__init__.py | Python | apache-2.0 | 731 |
#!/usr/bin/env python3
from setuptools import setup
with open("README.md", "r") as f:
long_description = f.read()
setup(
name='passpy',
version='1.0.1',
description='ZX2C4\'s pass compatible Python library and cli',
long_description=long_description,
long_description_content_type='text/mark... | bfrascher/passpy | setup.py | Python | gpl-3.0 | 1,565 |
# 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
#
# https://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, ... | googleapis/proto-breaking-change-detector | test/tools/mock_resources.py | Python | apache-2.0 | 2,378 |
#!/usr/bin/env python
'''
Script to determine if this commit has also
been merged through the stage branch
'''
#
# Usage:
# parent_check.py <branch> <commit_id>
#
#
import sys
import subprocess
def run_cli_cmd(cmd, in_stdout=None, in_stderr=None):
'''Run a command and return its output'''
if not in_std... | robotmaxtron/openshift-ansible | git/parent.py | Python | apache-2.0 | 3,074 |
##############################################################################
# Copyright (c) 2013-2018, Lawrence Livermore National Security, LLC.
# Produced at the Lawrence Livermore National Laboratory.
#
# This file is part of Spack.
# Created by Todd Gamblin, tgamblin@llnl.gov, All rights reserved.
# LLNL-CODE-64... | tmerrick1/spack | var/spack/repos/builtin/packages/fyba/package.py | Python | lgpl-2.1 | 2,243 |
###############################################################################
# ilastik: interactive learning and segmentation toolkit
#
# Copyright (C) 2011-2014, the ilastik developers
# <team@ilastik.org>
#
# This program is free software; you can redistribute it and/or
# mod... | nielsbuwen/ilastik | ilastik/widgets/listView.py | Python | gpl-3.0 | 6,597 |
# emacs: -*- mode: python; py-indent-offset: 4; indent-tabs-mode: t -*-
# vi: set ft=python sts=4 ts=4 sw=4 noet :
# This file is part of Fail2Ban.
#
# Fail2Ban 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;... | marclaporte/fail2ban | fail2ban/tests/samplestestcase.py | Python | gpl-2.0 | 5,262 |
from static_const_member_2 import *
c = Test_int()
try:
a = c.forward_field
a = c.current_profile
a = c.RightIndex
a = Test_int.backward_field
a = Test_int.LeftIndex
a = Test_int.cavity_flags
except:
raise RuntimeError
if Foo.BAZ.val != 2*Foo.BAR.val:
raise RuntimeError
| jrversteegh/softsailor | deps/swig-2.0.4/Examples/test-suite/python/static_const_member_2_runme.py | Python | gpl-3.0 | 306 |
"""
Spanning tests for all the operations that F() expressions can perform.
"""
import datetime
from django.db import connection
from django.db.models import F
from django.test import TestCase, Approximate, skipUnlessDBFeature
from regressiontests.expressions_regress.models import Number, Experiment
class Expressio... | disqus/django-old | tests/regressiontests/expressions_regress/tests.py | Python | bsd-3-clause | 16,640 |
# 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
#
# Unless required by applicable law or agre... | wangxiangyu/horizon | openstack_dashboard/dashboards/project/loadbalancers/forms.py | Python | apache-2.0 | 11,604 |
"""
python-gerrit
=============
A module that uses the Gerrit REST API as an interface to manage
changes,users, groups, etcetera.
"""
from .gerrit import Gerrit
| marhag87/python-gerrit | gerrit/__init__.py | Python | apache-2.0 | 163 |
# Pangrams
# Developer: Murillo Grubler
# Link: https://www.hackerrank.com/challenges/pangrams/problem
alphabet = ['A','B','C','D','E','F','G','H','I','J','K','L','M','N','O','P','Q','R','S','T','U','V','W','X','Y','Z']
count = len(alphabet)
st = input()
letters = 0
letters_used = []
for i in range(len(st)):
if st... | Murillo/Hackerrank-Algorithms | Algorithms/Strings/pangrams.py | Python | mit | 503 |
#!/usr/bin/python
#
# This file is part of Ansible
#
# Ansible is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# Ansible is distribut... | thaim/ansible | lib/ansible/modules/network/ios/ios_facts.py | Python | mit | 7,398 |
from mfd import *
from mfd.saitek.x52pro import *
from mfd.saitek.directoutput import *
from time import (sleep, time)
import re
import os
import logging
def nowmillis():
millis = int(round(time() * 1000))
return millis
mfd = None
def addToClipBoard(text):
command = 'echo ' + text.strip() + '| c... | headprogrammingczar/mahon-mfd | main.py | Python | bsd-3-clause | 44,328 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.