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 OpenStack Foundation
#
# 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 ... | huaweiswitch/neutron | neutron/plugins/ml2/drivers/huawei/config.py | Python | apache-2.0 | 1,533 | 0 |
#!/usr/bin/env python
try:
from io import StringIO
except ImportError:
try:
from cStringIO import StringIO
except ImportError:
from StringIO import StringIO
import bs4 as BeautifulSoup
import logging
from thug.DOM.W3C.Element import Element
from thug.DOM.W3C.Style.CSS.ElementCSSInlineStyl... | tweemeterjop/thug | thug/DOM/W3C/HTML/HTMLElement.py | Python | gpl-2.0 | 2,479 | 0.002824 |
# 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 use ... | sslavic/kafka | tests/kafkatest/tests/streams/streams_broker_compatibility_test.py | Python | apache-2.0 | 8,381 | 0.00358 |
from functools import wraps
from flask import request
from utils.exceptions import HttpBadRequest
class require(object):
def __init__(self, *requires):
self.requires = requires
def get_arguments(self):
if request.method in ['POST', 'PUT']:
return request.data
return request.args
def __cal... | vtemian/kruncher | utils/decorators/require.py | Python | apache-2.0 | 703 | 0.015647 |
"""
Django settings for mysite project.
Generated by 'django-admin startproject' using Django 1.10.5.
For more information on this file, see
https://docs.djangoproject.com/en/1.10/topics/settings/
For the full list of settings and their values, see
https://docs.djangoproject.com/en/1.10/ref/settings/
"""
import os
... | xianjunzhengbackup/code | http/django/mysite/mysite/settings.py | Python | mit | 3,096 | 0.001292 |
#
# Copyright (c) 2008-2015 Citrix 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.org/licenses/LICENSE-2.0
#
# Unless required by applicable l... | mahabs/nitro | nssrc/com/citrix/netscaler/nitro/resource/config/appflow/appflowaction.py | Python | apache-2.0 | 13,493 | 0.036537 |
# Copyright (c) 2012-2021, NVIDIA CORPORATION.
# SPDX-License-Identifier: Apache-2.0
import elasticsearch
import json
import logging
import os
import random
import string
import swiftclient
import unittest
import utils
class MetadataSyncTest(unittest.TestCase):
ES_HOST = 'https://localhost:9200'
ES_VERSION =... | swiftstack/swift-metadata-sync | test/integration/test_metadata_sync.py | Python | apache-2.0 | 5,118 | 0 |
#! /usr/bin/env python
# -*- coding: utf-8 -*-
#
# Interpreter version: python 2.7
#
# Imports =====================================================================
# Variables ===================================================================
#: Categories used to choose RIV
RIV_CATEGORIES = [
(1, "společenské,... | edeposit/edeposit.amqp.models | src/edeposit/amqp/models/riv.py | Python | mit | 932 | 0.001135 |
from __future__ import print_function
from .. import command
from ..needy import ConfiguredNeedy
class CleanCommand(command.Command):
def name(self):
return 'clean'
def add_parser(self, group):
short_description = 'clean a need'
parser = group.add_parser(self.name(), description=shor... | vmrob/needy | needy/commands/clean.py | Python | mit | 1,074 | 0.004655 |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
""" Configuration loader to support multi file types along with environmental
variable ``PYTHON_CLITOOL_ENV``. Default variable is
:const:`clitool.DEFAULT_RUNNING_MODE` (``development``).
Supported file types are:
* ini/cfg
* json
* yaml (if "pyyaml_" is installed)
.. _... | skitazaki/python-clitool | clitool/config.py | Python | apache-2.0 | 3,300 | 0.000303 |
#!/usr/bin/python
### dependencies
import os, sys
# may need to remove for windows systems
sys.path.append('/usr/local/lib/python2.7/site-packages')
import cv2, numpy as np
from matplotlib import pyplot
class ClicksCaptor:
FIELD_DISPLAY_NAME = 'Field'
coords = []
nClicks = 0
## get the videoCoords wit... | zephinzer/cs4243 | mac.homograph.py | Python | mit | 3,290 | 0.009119 |
# coding: utf-8
import flask
from flask import url_for
from .base import BaseTestCase
from . import utils
class TOCTestCase(BaseTestCase):
# TOC
def test_the_title_of_the_article_list_when_language_pt(self):
"""
Teste para verificar se a interface do TOC esta retornando o título no
... | jamilatta/opac | opac/tests/test_interface_TOC.py | Python | bsd-2-clause | 8,985 | 0.00112 |
#!/usr/bin/env python
import subprocess
import re
import os
import sys
import argparse
import commands
from multiprocessing import Process, Queue
# Module import of openstack control script
__location__ = os.path.realpath(
os.path.join(os.getcwd(), os.path.dirname(__file__)))
sys.path.append('../openstack_con... | includeos/includeos-tools | bombardment/bombardment.py | Python | apache-2.0 | 8,263 | 0.008229 |
from dogpile.cache.region import register_backend
register_backend(
"dogpile.cache.null", "dogpile.cache.backends.null", "NullBackend")
register_backend(
"dogpile.cache.dbm", "dogpile.cache.backends.file", "DBMBackend")
register_backend(
"dogpile.cache.pylibmc", "dogpile.cache.backends.memcached",
"Pyl... | ctrlaltdel/neutrinator | vendor/dogpile/cache/backends/__init__.py | Python | gpl-3.0 | 856 | 0 |
"""Class to perform random over-sampling."""
# Authors: Guillaume Lemaitre <g.lemaitre58@gmail.com>
# Christos Aridas
# License: MIT
from collections.abc import Mapping
from numbers import Real
import numpy as np
from scipy import sparse
from sklearn.utils import check_array, check_random_state
from sklear... | scikit-learn-contrib/imbalanced-learn | imblearn/over_sampling/_random_over_sampler.py | Python | mit | 9,497 | 0.000316 |
# -*- coding: utf-8 -*-
"""QGIS Unit tests for QgsServer.
.. note:: 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.
"""
__autho... | borysiasty/QGIS | tests/src/python/test_qgsserver_accesscontrol.py | Python | gpl-2.0 | 10,893 | 0.002295 |
import sys, requests, json, csv
key = "&wskey=<API KEY HERE>
api = "http://www.europeana.eu/api/v2/search.json?"
terms = ['proxy_dc_date','date']
types = ['IMAGE','TEXT']
#including year
from_year = 1700
#until but excluding
to_year = 2016
def getResults(term, types, conditions):
global errors
global key
globa... | mzeinstra/Europeana-20th-century-gap | scrape.py | Python | mit | 2,441 | 0.045473 |
import numpy as np
class GaussianFunction(object):
def __init__(self, x0, alpha, normed=True):
self.x0 = np.array(x0)
self.alpha = np.array(alpha)
self.sigma = 1.0/np.sqrt(2.0*self.alpha)
if normed:
self.norm = np.prod(np.sqrt(self.alpha / np.pi))
else:
... | dynamiq-md/dynamiq_samplers | dynamiq_samplers/tools.py | Python | lgpl-2.1 | 1,216 | 0.003289 |
import os
from pathlib import Path
from cryptography import x509
from cryptography.x509 import NameOID
import pytest
from mitmproxy import certs
from ..conftest import skip_windows
# class TestDNTree:
# def test_simple(self):
# d = certs.DNTree()
# d.add("foo.com", "foo")
# d.add("bar.co... | mhils/mitmproxy | test/mitmproxy/test_certs.py | Python | mit | 9,062 | 0.001104 |
#!/usr/bin/env python3
#
# Copyright (c) 2019, The OpenThread Authors.
# 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 copyright
# ... | jwhui/openthread | tests/scripts/thread-cert/pktverify/packet_verifier.py | Python | bsd-3-clause | 14,791 | 0.002434 |
from orangecontrib.recommendation.tests.coverage.base_tests \
import TestRatingModels, TestRankingModels | salvacarrion/orange3-recommendation | orangecontrib/recommendation/tests/coverage/__init__.py | Python | bsd-2-clause | 108 | 0.009259 |
from __future__ import unicode_literals
from django.db import models, migrations
from django.conf import settings
class Migration(migrations.Migration):
dependencies = [
migrations.swappable_dependency(settings.AUTH_USER_MODEL),
('challenge', '0007_auto_20150902_1636'),
]
operations = [... | defivelo/db | apps/challenge/migrations/0008_qualification_helpers.py | Python | agpl-3.0 | 576 | 0.001736 |
# -*- coding: utf-8 -*-
##############################################################################
#
# Author: Markus Schneider
# Copyright 2014 initOS GmbH & Co. KG
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU Affero General Public License as
... | vitasoa/OpenERP-7.0-Magento | magentoerpconnect_options_active/__openerp__.py | Python | agpl-3.0 | 1,388 | 0 |
# -*- coding: utf-8 -*-
def on_next_stage(old_entity, new_entity, choised_attr, entities):
if not old_entity.specials or 'ancestors' not in old_entity.specials:
new_entity.specials['ancestors']='False'
else:
print ">>>>>>> passo di qui!"
print old_entity.specials
for special in... | Onirik79/aaritmud | data/proto_items/flora/flora_item_rename-04-piantina.py | Python | gpl-2.0 | 422 | 0.004739 |
import os
import sys
import unittest
from unittest.mock import patch
import mkdocs
from mkdocs.config import config_options
from mkdocs.config.base import Config
from mkdocs.tests.base import tempdir
class OptionallyRequiredTest(unittest.TestCase):
def test_empty(self):
option = config_options.Optional... | waylan/mkdocs | mkdocs/tests/config/config_options_tests.py | Python | bsd-2-clause | 31,081 | 0.000515 |
#pamutils init.py
import pam2nest
import nest_vis
import network
__version__ = '0.1.0'
| MartinPyka/Pam-Utils | pamutils/__init__.py | Python | gpl-2.0 | 88 | 0.011364 |
# -*- coding: utf-8 -*-
"""
Задание 5: определение типа.
УСЛОВИЕ:
функция, которая принимает объект и выводит строку с наименованием типа этого объекта.
Пример:
typer(666) == "int"
typer("666") == "str"
typer(typer) == "function"
"""
def typer(variable):
return type(variable).__name__
if __name__ == '__main__... | pybursa/homeworks | a_berezovsky/hw1/task05.py | Python | gpl-2.0 | 560 | 0.004425 |
from .headerid import *
| kura/kura.io | plugins/headerid/__init__.py | Python | mit | 24 | 0 |
#!/usr/bin/python2.7
"""
Pass through blocks from a maf file until a certain number of columns
have been passed.
usage: %prog -c cols < maf > maf
"""
import sys
from bx.align import maf
from optparse import OptionParser
def __main__():
# Parse command line arguments
parser = OptionParser()
parser.add... | poojavade/Genomics_Docker | Dockerfiles/gedlab-khmer-filter-abund/pymodules/python2.7/lib/python/bx_python-0.7.1-py2.7-linux-x86_64.egg/EGG-INFO/scripts/maf_truncate.py | Python | apache-2.0 | 766 | 0.023499 |
from __future__ import print_function
from permstruct import RuleSet
from .functions import populate_rule_set
from permstruct.dag import DAG
from permuta.misc import ProgressBar
import sys
def exhaustive(settings):
for k,v in enumerate(settings.sets):
settings.logger.log(repr(tuple([k,v.description if v ... | PermutaTriangle/PermStruct | permstruct/exhaustive.py | Python | bsd-3-clause | 1,013 | 0.01382 |
# coding=utf-8
# Copyright 2018 The Google AI Language Team 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 ... | google-research/language | language/labs/consistent_zero_shot_nmt/utils/common_utils.py | Python | apache-2.0 | 1,241 | 0 |
from sklearn.metrics import confusion_matrix
from sklearn.model_selection import train_test_split
from sklearn.model_selection import cross_val_score
from sklearn.neighbors import KNeighborsClassifier
from sklearn.ensemble import VotingClassifier
from sklearn.tree import DecisionTreeClassifier
from sklearn.neighbors im... | rahulguptakota/paper-To-Reviewer-Matching-System | train2.py | Python | mit | 5,164 | 0.009682 |
import sys
import os
import re
import textwrap
import pytest
from doctest import OutputChecker, ELLIPSIS
from tests.lib import _create_test_package, _create_test_package_with_srcdir
distribute_re = re.compile('^distribute==[0-9.]+\n', re.MULTILINE)
def _check_output(result, expected):
checker = OutputChecker()... | fiber-space/pip | tests/functional/test_freeze.py | Python | mit | 15,857 | 0 |
# Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance with the License. You may obtain
# a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# d... | Mirantis/mos-horizon | openstack_dashboard/test/integration_tests/steps.py | Python | apache-2.0 | 1,572 | 0 |
# Author: Mr_Orange <mr_orange@hotmail.it>
# 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 Lic... | bcorbet/SickRage | sickbeard/providers/thepiratebay.py | Python | gpl-3.0 | 13,315 | 0.003755 |
#!/usr/bin/python
import os
import sys
import subprocess
import optparse
import time
import platform
SCRIPT_NAME = "LGR_fluxes.R"
platform = platform.system() != "Windows"
def run(foldername, start, end, graph, t, large):
""" Execute SCRIPT_NAME with time series parameters.
Arguments:
filename -- the name of the... | wdonahoe/fluxes | LGR_fluxes.py | Python | mit | 2,057 | 0.038892 |
# -*- coding: utf-8 -*-
'''
/**************************************************************************************************************************
SemiAutomaticClassificationPlugin
The Semi-Automatic Classification Plugin for QGIS allows for the supervised classification of remote sensing images,
provid... | semiautomaticgit/SemiAutomaticClassificationPlugin | maininterface/classtovectorTab.py | Python | gpl-3.0 | 4,478 | 0.027691 |
"""api URL Configuration
The `urlpatterns` list routes URLs to views. For more information please see:
https://docs.djangoproject.com/en/2.0/topics/http/urls/
Examples:
Function views
1. Add an import: from my_app import views
2. Add a URL to urlpatterns: path('', views.home, name='home')
Class-based vie... | 3n73rp455/api | api/urls.py | Python | gpl-3.0 | 1,232 | 0.000812 |
#
# Copyright (c) 2017 Juniper Networks, Inc. All rights reserved.
#
"""
VNC management for kubernetes
"""
import gevent
from gevent.queue import Empty
import requests
import socket
import argparse
import uuid
from cStringIO import StringIO
from cfgm_common import importutils
from cfgm_common import vnc_cgitb
from ... | rombie/contrail-controller | src/container/kube-manager/kube_manager/vnc/vnc_kubernetes.py | Python | apache-2.0 | 25,127 | 0.003025 |
# -*- coding: utf-8 -*-
""" bokeh_qc_graphs.py
Usage:
bokeh_qc_graphs.py [options]
<project_code>
Arguments:
project_code unique project code consisting of 'projectnumber_projectModelPart'
like 456_11 , 416_T99 or 377_S
Options:
-h, --help ... | hdm-dt-fb/rvt_model_services | commands/qc_no_ws/bokeh_qc_graphs.py | Python | mit | 6,329 | 0.002528 |
from django.test import TestCase
from journal.tests.factories import StudentFactory
class StudentTestCase(TestCase):
"""Tests for the Student models"""
def test_student(self):
"""Test to ensure that Students can be created properly"""
student = StudentFactory.build()
self.assertEqual(... | WildCAS/CASCategorization | journal/tests/test_persons.py | Python | apache-2.0 | 353 | 0 |
from kombu.tests.utils import unittest
from kombu.transport import pyamqplib
from kombu.connection import BrokerConnection
class MockConnection(dict):
def __setattr__(self, key, value):
self[key] = value
class test_amqplib(unittest.TestCase):
def test_default_port(self):
class Transport(... | mzdaniel/oh-mainline | vendor/packages/kombu/kombu/tests/test_transport_pyamqplib.py | Python | agpl-3.0 | 806 | 0 |
# -*- coding: utf-8 -*-
#
# (c) 2018 Alberto Planas <aplanas@gmail.com>
#
# This file is part of KManga.
#
# KManga 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 you... | aplanas/kmanga | scraper/scraper/middlewares.py | Python | gpl-3.0 | 10,942 | 0.000183 |
# Copyright 2016 Google 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 law or agre... | google/openhtf | test/core/monitors_test.py | Python | apache-2.0 | 3,303 | 0.00545 |
# Copyright (c) 2018 PaddlePaddle 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 app... | PaddlePaddle/Paddle | python/paddle/fluid/tests/unittests/test_affine_channel_op.py | Python | apache-2.0 | 4,621 | 0.000433 |
"""
uritemplate.api
===============
This module contains the very simple API provided by uritemplate.
"""
from uritemplate.template import URITemplate
def expand(uri, var_dict=None, **kwargs):
"""Expand the template with the given parameters.
:param str uri: The templated URI to expand
:param dict var... | ido-ran/ran-smart-frame2 | web/server/lib/uritemplate/api.py | Python | mit | 1,911 | 0 |
# -*- coding: utf-8 -*-
##############################################################################
#
# Copyright (C) 2004-2012 Pexego Sistemas Informáticos All Rights Reserved
# $Omar Castiñeira Saavedra$ <omar@pexego.es>
#
# This program is free software: you can redistribute it and/or modify
# it ... | Comunitea/alimentacion | automatic_update_cost_from_bom/__openerp__.py | Python | agpl-3.0 | 1,451 | 0.006901 |
#### NOTICE: THIS FILE IS AUTOGENERATED
#### MODIFICATIONS MAY BE LOST IF DONE IMPROPERLY
#### PLEASE SEE THE ONLINE DOCUMENTATION FOR EXAMPLES
from swgpy.object import *
def create(kernel):
result = Tangible()
result.template = "object/tangible/food/crafted/shared_drink_double_dip_outer_rim_rumdrop.iff"
result.... | anhstudios/swganh | data/scripts/templates/object/tangible/food/crafted/shared_drink_double_dip_outer_rim_rumdrop.py | Python | mit | 488 | 0.045082 |
"""
test core resource system
"""
from rez.tests.util import TestBase
from rez.utils.resources import Resource, ResourcePool, ResourceHandle, \
ResourceWrapper
from rez.utils.schema import Required
from rez.exceptions import ResourceError
import rez.vendor.unittest2 as unittest
from rez.vendor.schema.schema import ... | rsjohnco/rez | src/rez/tests/test_resources_.py | Python | gpl-3.0 | 9,241 | 0.000649 |
import os
from hatch.utils.structures import EnvVars
def get_random_name():
return os.urandom(16).hex().upper()
class TestEnvVars:
def test_restoration(self):
num_env_vars = len(os.environ)
with EnvVars():
os.environ.clear()
assert len(os.environ) == num_env_vars
d... | ofek/hatch | tests/utils/test_structures.py | Python | mit | 1,699 | 0.000589 |
import os
import logging
import importlib
import archinfo
from collections import defaultdict
from ...relocation import Relocation
ALL_RELOCATIONS = defaultdict(dict)
complaint_log = set()
path = os.path.dirname(os.path.abspath(__file__))
l = logging.getLogger(name=__name__)
def load_relocations():
for filename ... | angr/cle | cle/backends/pe/relocation/__init__.py | Python | bsd-2-clause | 1,415 | 0.002827 |
import os
from django.conf import settings
from django.core.exceptions import ImproperlyConfigured
from django.core.files.storage import FileSystemStorage
from django.utils.importlib import import_module
from django.contrib.staticfiles import utils
class StaticFilesStorage(FileSystemStorage):
"""
Standard fi... | ychen820/microblog | y/google-cloud-sdk/platform/google_appengine/lib/django-1.3/django/contrib/staticfiles/storage.py | Python | bsd-3-clause | 2,080 | 0.001923 |
import urllib
from allmydata.scripts.common_http import do_http, check_http_error
from allmydata.scripts.common import get_alias, DEFAULT_ALIAS, UnknownAliasError
from allmydata.util.encodingutil import quote_output
def mkdir(options):
nodeurl = options['node-url']
aliases = options.aliases
where = option... | david415/tahoe-lafs | src/allmydata/scripts/tahoe_mkdir.py | Python | gpl-2.0 | 1,660 | 0.001205 |
#!/usr/bin/env python3
#
# Copyright 2014 Simone Campagna
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable ... | simone-campagna/rubik | rubik/filename.py | Python | apache-2.0 | 2,441 | 0.004506 |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
"""
Universal Resource Locator (URL).
"""
__license__ = """
GoLismero 2.0 - The web knife - Copyright (C) 2011-2014
Golismero project site: https://github.com/golismero
Golismero project mail: contact@golismero-project.com
This program is free software; you can redistri... | golismero/golismero | golismero/api/data/resource/url.py | Python | gpl-2.0 | 15,148 | 0.006403 |
#! /usr/bin/env python
import sys
import os
import gtk
from arithmetic import Parser
class Editor(object):
'A minimal editor'
def __init__(self):
# path to UI file
scriptPath = os.path.split( sys.argv[0] )[0]
uiFilePath = os.path.join( scriptPath,'editor.ui' )
self.builder = ... | ppaez/arithmetic | editor-gtk.py | Python | gpl-2.0 | 2,609 | 0.022997 |
from django.http import HttpResponse
from django.shortcuts import render
from django.views import generic
import api.soql
import json
from api.soql import *
# Create your views here.
def indexView(request):
context = {
"vehicleAgencies": getUniqueValuesWithAggregate("gayt-taic", "agency", "max(postal... | jthidalgojr/greengov2015-TeamAqua | TeamAqua/views.py | Python | mit | 1,091 | 0.0055 |
# -*- coding: utf-8 -*-
#
# pytest-django documentation build configuration file, created by
# sphinx-quickstart on Tue May 1 10:12:50 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.
#... | jantman/pytest_django | docs/conf.py | Python | bsd-3-clause | 7,985 | 0.007264 |
# Created by PyCharm Pro Edition
# User: Kaushik Talukdar
# Date: 27-03-2017
# Time: 05:25 PM
fastfood = ["momo", "roll", "chow", "pizza"]
print(fastfood)
print("\n")
#print one element using pop()
#output the popped element
print(fastfood.pop() + "\n")
... | KT26/PythonCourse | 2. Introducing Lists/6.py | Python | mit | 380 | 0.018421 |
def chmsg(event, server, view):
""" Everytime someone types on a channel this method is called
It gets the channel name and the win(that one which we have added in the ujoin event.
It gets the window with the same method server.getName.
"""
ch = event['channel'].lower()
win = view.get_... | iogf/nerdirc | nerdlib/plugins/wake/wake.py | Python | gpl-2.0 | 445 | 0.004494 |
from sqlalchemy import Column, String, Integer, Float, ForeignKey, PrimaryKeyConstraint
from sqlalchemy.ext.declarative import declarative_base
from sqlalchemy.orm import relationship, validates, backref
import time, json
DecBase = declarative_base()
class Server(DecBase):
__tablename__ = 'ezdonate_servers'
id = ... | EasyDonate/EasyDonate | EasyDonate/ORM.py | Python | gpl-3.0 | 7,304 | 0.034912 |
from maya import cmds
__all__ = [
"UndoChunkContext"
]
class UndoChunkContext(object):
"""
The undo context is used to combine a chain of commands into one undo.
Can be used in combination with the "with" statement.
with UndoChunkContext():
# code
"""
def __enter__(self):
... | robertjoosten/rjSkinningTools | scripts/skinningTools/utils/undo.py | Python | gpl-3.0 | 428 | 0 |
'''
grayscottmodel.py: simulate Gray Scott model of reaction diffusion
'''
| MusicVisualizationUMass/TeamNameGenerator | src/musicvisualizer/pipeline/models/grayscottmodel.py | Python | mit | 75 | 0 |
# 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
# distributed under the... | JioCloud/horizon | openstack_dashboard/dashboards/project/data_processing/cluster_templates/panel.py | Python | apache-2.0 | 917 | 0 |
# Copyright (c) 2017 Mark D. Hill and David A. Wood
# 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 of source code must retain the above copyright
# notice, this list of conditio... | vineodd/PIMSim | GEM5Simulation/gem5/tests/gem5/__init__.py | Python | gpl-3.0 | 1,633 | 0 |
import os
import sys
import subprocess
import tempfile
import time
import unittest2 as unittest
TEST_DIR = os.path.abspath(os.path.dirname(__file__))
BASE_DIR = os.path.abspath(os.path.join(TEST_DIR, '..', '..'))
def execute(cmd, raise_error=True):
"""
Executes a command in a subprocess. Returns a tuple
... | genius1611/Keystone | keystone/test/__init__.py | Python | apache-2.0 | 4,496 | 0.000222 |
# Copyright (c) 2014 ARM Limited
# All rights reserved.
#
# The license below extends only to copyright in the software and shall
# not be construed as granting a license to any other intellectual
# property including but not limited to intellectual property relating
# to a hardware implementation of the functionality ... | yohanko88/gem5-DC | src/sim/SubSystem.py | Python | bsd-3-clause | 2,797 | 0.000358 |
from website.apps.activity.base_activity import BaseActivity
class WelcomeActivity(BaseActivity):
TYPE = 'welcome'
class StarredActivity(BaseActivity):
TYPE = 'starred'
FORCE_ANONYMOUS = False
@classmethod
def from_sticker(cls, actor, comment_sticker):
comment = comment_sticker.comment
... | canvasnetworks/canvas | website/drawquest/activities.py | Python | bsd-3-clause | 1,939 | 0.002063 |
#!/usr/bin/python
"""Test of line navigation output of Firefox."""
from macaroon.playback import *
import utils
sequence = MacroSequence()
#sequence.append(WaitForDocLoad())
sequence.append(PauseAction(5000))
# Work around some new quirk in Gecko that causes this test to fail if
# run via the test harness rather t... | GNOME/orca | test/keystrokes/firefox/object_nav_descriptions_down.py | Python | lgpl-2.1 | 6,661 | 0.00015 |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
###############################################################################
# Copyright (C) 2005-2014 Francisco José Rodríguez Bogado, #
# <pacoqueen@users.sourceforge.net> #
# ... | pacoqueen/ginn | ginn/formularios/logviewer.py | Python | gpl-2.0 | 17,683 | 0.006298 |
#!/usr/bin/env python
#coding: utf8
"""
Restore the saved list of documents that were being read
"""
from __future__ import print_function, absolute_import, division
import sys, os
import logging
import subprocess
DefaultExecutable = 'smallpotato'
DefaultBook = 'book.opn'
DefaultMaxPly = 20
class EngineConnector(ob... | alito/smallpotato | tools/makebookfrompgn.py | Python | gpl-2.0 | 3,770 | 0.007162 |
'''
Copyright 2011 Mikel Azkolain
This file is part of Spotimc.
Spotimc 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.
Spotimc ... | SMALLplayer/smallplayer-image-creator | storage/.xbmc/addons/script.audio.spotimc.smallplayer/default.py | Python | gpl-2.0 | 3,422 | 0.009936 |
#!/usr/bin/env python
# coding: utf8
from nose.tools import assert_equal
from nose import SkipTest
#lines above are inserted automatically by pythoscope. Line below overrides them
from Goulib.tests import *
from Goulib.interval import *
class TestInInterval:
def test_in_interval(self):
assert... | goulu/Goulib | tests/test_Goulib_interval.py | Python | lgpl-3.0 | 8,146 | 0.030935 |
# -*- coding: utf-8 -*-
# Generated by Django 1.9 on 2016-02-20 06:42
from __future__ import unicode_literals
import django.contrib.auth.models
import django.core.validators
from django.db import migrations, models
import django.utils.timezone
class Migration(migrations.Migration):
initial = True
dependenc... | bobandbetty/assassins | assassins/users/migrations/0001_initial.py | Python | mit | 3,152 | 0.004124 |
# 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, ... | google/picatrix | picatrix/notebook_init.py | Python | apache-2.0 | 1,081 | 0.002775 |
# 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 | rouge/tokenizers.py | Python | apache-2.0 | 1,661 | 0.004214 |
# vim: set et sw=3 tw=0 fo=awqorc ft=python:
#
# Astxx, the Asterisk C++ API and Utility Library.
# Copyright (C) 2005, 2006 Matthew A. Nicholson
# Copyright (C) 2006 Tim Blechmann
#
# This library is free software; you can redistribute it and/or
# modify it under the terms of the GNU Lesser General Public
# License ... | m0tive/fsm | site_scons/site_tools/doxygen/doxygen_norton_2007-12-20.py | Python | mit | 6,137 | 0.023464 |
lista = [1, 3, 5, 20, 50, 100]
print([x**2 for x in lista])
print([x for x in lista if x < 50 and x > 2]) | pacocampo/Backend | semana2/list.py | Python | gpl-3.0 | 105 | 0.009524 |
from enum import IntEnum
from typing import Iterator, Optional
# TODO(bashi): Remove import check suppressions once aioquic dependency is
# resolved.
from aioquic.buffer import UINT_VAR_MAX_SIZE, Buffer, BufferReadError # type: ignore
class CapsuleType(IntEnum):
# Defined in
# https://www.ietf.org/archive/i... | scheib/chromium | third_party/wpt_tools/wpt/tools/webtransport/h3/capsule.py | Python | bsd-3-clause | 3,709 | 0.00027 |
"""
OpenStreetMap boundary generator.
Author: Andrzej Talarczyk <andrzej@talarczyk.com>
Based on work of Michał Rogalski (Rogal).
License: GPLv3.
"""
import os
import platform
import shutil
def clean(src_dir):
"""Remove target files.
Args:
src_dir (string): path to the directory from which target... | basement-labs/osmapa-garmin | osmapa/boundaries.py | Python | gpl-2.0 | 2,693 | 0.004458 |
## This file is part of Invenio.
## Copyright (C) 2012 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 option) any later version.
##
## Inv... | kntem/webdeposit | modules/bibworkflow/lib/tasks/simplified_data_tasks.py | Python | gpl-2.0 | 1,455 | 0.008935 |
# Lint as: python3
# Copyright 2018 The TensorFlow Authors. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless ... | tensorflow/lingvo | lingvo/tasks/asr/input_generator.py | Python | apache-2.0 | 6,359 | 0.005189 |
from setuptools import setup, find_packages
import sys, os
version = '2.3.0'
setup(name='apibinding',
version=version,
description="ZStack API Python bindings library",
long_description="""\
ZStack API Python bindings library""",
classifiers=[], # Get strings from http://pypi.python.org/pypi?%... | live4thee/zstack-utility | apibinding/setup.py | Python | apache-2.0 | 797 | 0.003764 |
# -*- coding: utf-8 -*-
#
# Copyright © 2012 - 2019 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, eith... | dontnod/weblate | weblate/trans/views/js.py | Python | gpl-3.0 | 9,337 | 0.000107 |
"""
Test suite for the embedded <script> extraction
"""
from BeautifulSoup import BeautifulSoup
from nose.tools import raises, eq_
from csxj.datasources.parser_tools import media_utils
from csxj.datasources.parser_tools import twitter_utils
from tests.datasources.parser_tools import test_twitter_utils
def make_soup(... | sevas/csxj-crawler | tests/datasources/parser_tools/test_media_utils.py | Python | mit | 4,676 | 0.004705 |
#Problem link: https://www.hackerrank.com/challenges/py-if-else
#!/bin/python
import sys
N = int(input().strip())
if (N % 2 > 0):
print("Weird")
elif (N >= 2 and N <=5):
print("Not Weird")
elif (N >= 6 and N <=20):
print("Weird")
else:
print("Not Weird") | phillipemoreira/HackerRank | Python/Introduction/3_IfElse.py | Python | mit | 275 | 0.018182 |
from test import support
# Skip test if _tkinter wasn't built.
support.import_module('_tkinter')
# Skip test if tk cannot be initialized.
from tkinter.test.support import check_tk_availability
check_tk_availability()
from tkinter.test import runtktests
def test_main(enable_gui=False):
if enable_gui:
if s... | BeATz-UnKNoWN/python-for-android | python3-alpha/python3-src/Lib/test/test_tk.py | Python | apache-2.0 | 651 | 0.006144 |
# coding=utf-8
"""
The Automations API endpoint actions
Note: This is a paid feature
Documentation: http://developer.mailchimp.com/documentation/mailchimp/reference/automations/
"""
from __future__ import unicode_literals
from mailchimp3.baseapi import BaseApi
class AutomationActions(BaseApi):
"""
Actions ... | charlesthk/python-mailchimp | mailchimp3/entities/automationactions.py | Python | mit | 1,368 | 0.005117 |
from joblib import Parallel, delayed
from epac import Methods
import numpy as np
from sklearn import datasets
from sklearn.svm import SVC
X, y = datasets.make_classification(n_samples=500,
n_features=200000,
n_informative=2,
... | neurospin/pylearn-epac | test/bug_joblib/test_joblib_2000fts.py | Python | bsd-3-clause | 1,126 | 0.01421 |
import utilities.file_ops as file_ops
from PyQt4 import QtGui, QtCore
from dirtgui.document_util import document_match_util as match_util
NEXT_TT = u'Move to next match within this document'
PREV_TT = u'Move to prevous match within this document'
class DocumentGrid(QtGui.QGridLayout):
"""
Creates a grid wi... | gnarph/DIRT | dirtgui/document_grid.py | Python | mit | 5,149 | 0.001359 |
#!/usr/bin/env python
# coding=utf-8
# Created by sharp.gan at 2017-01-08
import os
import argparse
import subprocess
# Assume that you already installed the dependency of GNU-gettext, or you need to
# resolve this using your system package management tool such as `sudo apt
# install gettext`
# main process of reslo... | supersu097/Mydailytools | po_new_generate.py | Python | gpl-3.0 | 1,794 | 0.001672 |
#!/usr/bin/env python
"""
@file netstats.py
@author Daniel Krajzewicz
@author Michael Behrisch
@date 2008-08-13
@version $Id: netstats.py 14425 2013-08-16 20:11:47Z behrisch $
Prints some information about a given network
SUMO, Simulation of Urban MObility; see http://sumo-sim.org/
Copyright (C) 2009-2013 DLR... | cathyyul/sumo-0.18 | tools/net/netstats.py | Python | gpl-3.0 | 1,975 | 0.002532 |
#!/usr/bin/env python
from distutils.util import convert_path
from django_email_multibackend import __version__, __maintainer__, __email__
from fnmatch import fnmatchcase
import os
import sys
try:
from setuptools import setup, find_packages
except ImportError:
from distutils.core import setup, find_packages
s... | tbarbugli/django_email_multibackend | setup.py | Python | isc | 4,819 | 0.000208 |
from collections import OrderedDict
class LRUCache(object):
def __init__(self, capacity):
self.max_capacity = capacity
self.cached = OrderedDict()
def __contains__(self, k):
return k in self.cached
def __getitem__(self, item):
return self.get(item)
def __setitem__(sel... | ucsb-seclab/ictf-framework | scoring_ictf/scoring_ictf/simple_lru_cache.py | Python | gpl-2.0 | 1,388 | 0.002161 |
"""A library for integrating Python's builtin ``ssl`` library with CherryPy.
The ssl module must be importable for SSL functionality.
To use this module, set ``CherryPyWSGIServer.ssl_adapter`` to an instance of
``BuiltinSSLAdapter``.
"""
try:
import ssl
except ImportError:
ssl = None
from cherrypy import ws... | minixalpha/SourceLearning | webpy/src/web/wsgiserver/ssl_builtin.py | Python | apache-2.0 | 2,589 | 0.005407 |
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
import re
from .common import InfoExtractor
from ..utils import parse_filesize
class TagesschauIE(InfoExtractor):
_VALID_URL = r'https?://(?:www\.)?tagesschau\.de/multimedia/(?:sendung/ts|video/video)(?P<id>-?[0-9]+)\.html'
_TESTS = [{
... | apllicationCOM/youtube-dl-api-server | youtube_dl_server/youtube_dl/extractor/tagesschau.py | Python | unlicense | 4,945 | 0.00182 |
#!/usr/bin/env python
#-*- coding: utf-8 -*-
from django.http import HttpResponse
import service.api
def api_available(request):
return HttpResponse(service.api.get_proxy())
def hello(request):
return HttpResponse("Hello world!") | Piasy/proxy-searcher | service/service/views.py | Python | mit | 233 | 0.025751 |
def f(n):
cnt=0
for a in range(1,n-3):
for b in range(a,n-3):
c =n-a-b
if(c>b):
if((a*a+b*b)==c*c):
cnt+=1
return cnt
ans=0
num=0
for i in range(1000,100,-1):
val= f(i)
if(val>ans):
ans=val
num=i
print num
| rekbun/project-euler | src/python/problem39.py | Python | apache-2.0 | 235 | 0.123404 |
## @file
# This file is used to define checkpoints used by ECC tool
#
# Copyright (c) 2008 - 2010, Intel Corporation. All rights reserved.<BR>
# This program and the accompanying materials
# are licensed and made available under the terms and conditions of the BSD License
# which accompanies this distribution. T... | bitcrystal/buildtools-BaseTools | Source/Python/Ecc/Check.py | Python | bsd-2-clause | 71,517 | 0.004041 |
from django.contrib.auth import views as auth
def login(request):
return auth.login(request, template_name="registration/login.haml")
def password_change(request):
return auth.password_change(request, template_name="registration/password_change_form.haml")
def password_change_done(request):
return aut... | Psycojoker/hackeragenda | authentication/views.py | Python | gpl-3.0 | 408 | 0.004902 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.