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 -*-
from scrapy.spider import BaseSpider
from scrapy.selector import Selector
from luooSpiders.items import luooSpidersItem
from scrapy.http import Request
class luooSpider(BaseSpider):
name = "luoo"
allowed_domains = ["luoo.net"]
start_urls = ['http://www.luoo.net/tag/?p=1']
def _... | c4x/LuooSpiders | luooSpiders/spiders/luooSpinder.py | Python | mit | 2,002 |
import _plotly_utils.basevalidators
class ValueminusValidator(_plotly_utils.basevalidators.NumberValidator):
def __init__(
self, plotly_name="valueminus", parent_name="scatter.error_x", **kwargs
):
super(ValueminusValidator, self).__init__(
plotly_name=plotly_name,
pare... | plotly/python-api | packages/python/plotly/plotly/validators/scatter/error_x/_valueminus.py | Python | mit | 510 |
"""
Functions to generate Theano update dictionaries for training.
Copied from Lasagne. See documentation at:
http://lasagne.readthedocs.org/en/latest/modules/updates.html
"""
from collections import OrderedDict
import numpy as np
import theano
import theano.tensor as T
__all__ = [
"sgd",
"apply_momentum"... | rakeshvar/rnn_ctc | nnet/updates.py | Python | apache-2.0 | 10,487 |
# -*- coding: utf-8 -*-
# Form implementation generated from reading ui file '/home/gugu/w/calibre/src/calibre/gui2/store/stores/mobileread/store_dialog.ui'
#
# Created: Thu Jul 19 23:32:29 2012
# by: PyQt4 UI code generator 4.9.1
#
# WARNING! All changes made in this file will be lost!
from PyQt4 import QtCore,... | Eksmo/calibre | src/calibre/gui2/store/stores/mobileread/store_dialog_ui.py | Python | gpl-3.0 | 3,890 |
from itertools import chain, repeat
import xml.etree.cElementTree as ET
import mock
import pytest
import spreads.vendor.confit as confit
from spreads.vendor.pathlib import Path
@pytest.fixture
def pluginclass(mock_findinpath):
import spreadsplug.scantailor as scantailor
return scantailor.ScanTailorPlugin
@... | tfmorris/spreads | tests/scantailor_test.py | Python | agpl-3.0 | 3,718 |
'''
Tile.py
The tiles that get placed on the board and how they are displayed.
'''
from options import Options
class Tile:
def __init__(self, row, col, options):
self.row = row
self.col = col
self.team = 0
self.strength = 0
self.exists = True
self.neighbors = []
self.options = options
def text(s... | bacable/ProximityBasic | tile.py | Python | gpl-2.0 | 801 |
import contextlib
from hacheck.compat import nested
import mock
import json
import os
from unittest import TestCase
import hacheck.haupdown
import hacheck.spool
# can't use an actual mock.sentinel because it doesn't support string ops
sentinel_service_name = 'testing_service_name'
class TestCallable(TestCase):
... | EvanKrall/hacheck | tests/test_callables.py | Python | mit | 6,245 |
# -*- coding: utf-8 -*-
# Generated by Django 1.11.4 on 2017-08-12 01:39
from __future__ import unicode_literals
from django.db import migrations
class Migration(migrations.Migration):
dependencies = [
('core', '0002_add_lobby_and_matches'),
]
operations = [
migrations.RemoveField(
... | kkmsc17/smes | backend/core/migrations/0003_remove_match_takers.py | Python | agpl-3.0 | 392 |
#!/usr/bin/python
# -*- coding: utf-8 -*-
# -- stdlib --
import json
import os
import socket
import subprocess
import sys
import time
# -- third party --
# -- own --
# -- code --
ts = int(time.time())
p = subprocess.Popen("which megacli", shell=True, stdout=subprocess.PIPE)
cli = p.stdout.read().strip()
if cli:
... | kadashu/satori | satori-rules/plugin/infra/600_megaraid.py | Python | apache-2.0 | 746 |
from puzzle.heuristics.acrostics import _acrostic_search
class Acrostic(_acrostic_search.AcrosticSearch):
"""Best available Acrostic solver."""
pass
| PhilHarnish/forge | src/puzzle/heuristics/acrostic.py | Python | mit | 155 |
# Description: Shows how usage of different classes for discretization, including manual discretization
# Category: discretization, categorization, preprocessing
# Classes: EntropyDiscretization, EquiDistDiscretization, BiModalDiscretization, Discretization, IntervalDiscretizer, Discretizer, BiModalDiscretizer
#... | yzl0083/orange | docs/reference/rst/code/discretization.py | Python | gpl-3.0 | 4,155 |
# Copyright (C) 2007 Free Software Foundation, Inc.
# This file contains code that is adapted from Ajenti.
# Written by Eugeny Pankov, 2010-2011.
#
# Ajenti is free software; you can redistribute it and/or
# modify it under the terms of the GNU Lesser General Public
# License as published by the Free Software Foundatio... | strassek/storm | storm/config.py | Python | gpl-3.0 | 2,053 |
# coding: utf8
from __future__ import unicode_literals, print_function, division
from collections import OrderedDict
from json import loads
from clldutils.jsonlib import dump
from util import REPO_DIR, ns, read_terms
MODULES = {
'Generic': [],
'Wordlist': ['forms'],
'StructureDataset': ['values'],
'D... | LinguList/cldf | scripts/make_defaults.py | Python | apache-2.0 | 5,999 |
#!/usr/bin/env python3
# Questo file legge il file di configurazione,
# trova e modifica il parametro eseguendo il rispettivo "write*.py"
# Serve per la parte di gestione html in python
import cgi
import cgitb
# Abilita gli errori al server web/http
cgitb.enable()
# Le mie librerie Json, Html, flt (Thermo(Redis))
i... | raspibo/Thermo | var/www/cgi-bin/writethermofunction.py | Python | mit | 1,482 |
from coalib.bears.GlobalBear import GlobalBear
from coalib.results.Result import Result
class GlobalTestBear(GlobalBear): # pragma: no cover
def run(self):
for filename in self.file_dict:
return [Result.from_values("GlobalTestBear",
"test message",
... | Tanmay28/coala | coalib/tests/processes/section_executor_test_files/GlobalTestBear.py | Python | agpl-3.0 | 365 |
# 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/storage/azure-mgmt-storage/azure/mgmt/storage/v2017_06_01/aio/operations/_storage_accounts_operations.py | Python | mit | 36,878 |
from __future__ import unicode_literals
import xml.etree.ElementTree
from .subtitles import SubtitlesInfoExtractor
from ..utils import ExtractorError
from ..compat import compat_HTTPError
class BBCCoUkIE(SubtitlesInfoExtractor):
IE_NAME = 'bbc.co.uk'
IE_DESC = 'BBC iPlayer'
_VALID_URL = r'https?://(?:ww... | janusnic/youtube-dl-GUI | youtube_dl/extractor/bbccouk.py | Python | mit | 14,360 |
from __future__ import absolute_import
from rest_framework.response import Response
from sentry.api.bases.organization import OrganizationEndpoint, OrganizationPermission
from sentry.models import Integration
class GitHubSearchEndpoint(OrganizationEndpoint):
permission_classes = (OrganizationPermission, )
... | ifduyue/sentry | src/sentry/integrations/github/search.py | Python | bsd-3-clause | 2,249 |
from routersploit.modules.exploits.routers.dlink.dir_645_password_disclosure import Exploit
def test_check_success(target):
""" Test scenario - successful check """
route_mock = target.get_route_mock("/getcfg.php", methods=["POST"])
route_mock.return_value = (
"""
<?xml version="1.0" enco... | dasseclab/dasseclab | clones/routersploit/tests/exploits/routers/dlink/test_dir_645_password_disclosure.py | Python | gpl-2.0 | 2,021 |
# Generated by the gRPC Python protocol compiler plugin. DO NOT EDIT!
import grpc
from google.cloud.automl_v1.proto import (
prediction_service_pb2 as google_dot_cloud_dot_automl__v1_dot_proto_dot_prediction__service__pb2,
)
from google.longrunning import (
operations_pb2 as google_dot_longrunning_dot_operatio... | tseaver/google-cloud-python | automl/google/cloud/automl_v1/proto/prediction_service_pb2_grpc.py | Python | apache-2.0 | 4,461 |
item_id = 4986168
user_id = 20000
item_category = 9656
time = 31
| CharLLCH/jianchi_alimobileR | ftrldata/TCReBuild/codes/mylibs/size.py | Python | gpl-2.0 | 65 |
#!/usr/bin/python
# -*- coding: utf-8 -*-
# Copyright 2012 Dag Wieers <dag@wieers.com>
#
# 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 Lice... | sonaht/ansible | lib/ansible/modules/utilities/logic/assert.py | Python | gpl-3.0 | 1,869 |
#!/usr/bin/python
# -*- coding: utf-8 -*-
#
# Copyright (C) 2017 Google
# GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt)
# ----------------------------------------------------------------------------
#
# *** AUTO GENERATED CODE *** AUTO GENERATED CODE ***
#
... | valentin-krasontovitsch/ansible | lib/ansible/modules/cloud/google/gcp_compute_target_https_proxy.py | Python | gpl-3.0 | 18,284 |
#!/usr/bin/env python
# icon.py
#http://www.saltycrane.com/blog/2007/12/pyqt-43-qtableview-qabstracttable-model/
#http://www.commandprompt.com/community/pyqt/book1
#http://doc.qt.nokia.com/latest/qstandarditemmodel.html
#http://www.interactivestars.com/lost_zodiac/lost_zodiac_sign.html <- interesting
#http://www.ips-p... | ShadowKyogre/ChronosLNX | chronoslnxlib/gui.py | Python | gpl-3.0 | 43,436 |
from incload.parsers import baseparser
from incload import downloader
class FullAlphabeticalParser(baseparser.BaseParser):
Source="http://teknoaxe.com/Home.php"
def __init__(self):
baseparser.BaseParser.__init__(self)
self.__DetectionLevel=0
self.__Category=""
self.__Categories={}
self.__Genre=... | Timtam/incompetech-downloader | incload/parsers/teknoaxe/fullalphabetical.py | Python | gpl-3.0 | 3,085 |
import _plotly_utils.basevalidators
class ValueValidator(_plotly_utils.basevalidators.StringValidator):
def __init__(
self,
plotly_name="value",
parent_name="funnel.marker.colorbar.tickformatstop",
**kwargs
):
super(ValueValidator, self).__init__(
plotly_nam... | plotly/python-api | packages/python/plotly/plotly/validators/funnel/marker/colorbar/tickformatstop/_value.py | Python | mit | 509 |
"""SCons.Tool.gfortran
Tool-specific initialization for gfortran, the GNU Fortran 95/Fortran
2003 compiler.
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__
#
# Permission is hereby granted,... | andrewyoung1991/scons | src/engine/SCons/Tool/gfortran.py | Python | mit | 2,214 |
# coding: utf-8
"""
Kubernetes
No description provided (generated by Swagger Codegen https://github.com/swagger-api/swagger-codegen)
OpenAPI spec version: v1.7.4
Generated by: https://github.com/swagger-api/swagger-codegen.git
"""
from pprint import pformat
from six import iteritems
import re
... | djkonro/client-python | kubernetes/client/models/v1_local_volume_source.py | Python | apache-2.0 | 3,365 |
import pytest
from utils import testgen
from cfme.web_ui import Quadicon, toolbar
from cfme.infrastructure.host import Host
from cfme.web_ui import InfoBlock
from cfme.fixtures import pytest_selenium as sel
from cfme.configure.tasks import is_host_analysis_finished
from utils.wait import wait_for
pytest_generate_test... | kzvyahin/cfme_tests | cfme/tests/openstack/test_host_security.py | Python | gpl-2.0 | 1,236 |
# Generated by Django 2.2.5 on 2019-09-19 22:22
from django.db import migrations
class Migration(migrations.Migration):
dependencies = [
('sponsors', '0003_auto_20190914_1504'),
('sponsors', '0003_auto_20190914_1745'),
]
operations = [
]
| patrick91/pycon | backend/sponsors/migrations/0004_merge_20190919_2222.py | Python | mit | 275 |
"""Picture views."""
import os
from pyramid.httpexceptions import HTTPForbidden
from pyramid.httpexceptions import HTTPNotFound
from pyramid.response import FileResponse
from sqlalchemy.orm import join as orm_join
from sqlalchemy.orm.exc import NoResultFound
from lasco.auth import get_user_role
from lasco.auth impo... | dbaty/Lasco | lasco/views/picture.py | Python | bsd-3-clause | 4,459 |
# Copyright (c) 2014, Stanford University
# 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 notice, this list of conditions and the ... | paepcke/json_to_relation | json_to_relation/mongodb.py | Python | bsd-3-clause | 13,626 |
import LibreNMS
import json
import logging
import os
import pymysql
import subprocess
import threading
import sys
import time
from datetime import timedelta
from datetime import datetime
from logging import debug, info, warning, error, critical, exception
from platform import python_version
from time import sleep
fro... | arjitc/librenms | LibreNMS/service.py | Python | gpl-3.0 | 24,575 |
__doc__ = """
Neural turing machine.
Names of arrays
---------------
Along with range of elements [low, high]
Mprev_bnm: previous memory state. [-inf, inf]
X_bk: external inputs. [0,1]
wprev_bHn: previous weights (read & write). [0, 1]. Normalized along axis 2.
rprev_bhm: pr... | nebw/cgt | examples/demo_neural_turing_machine.py | Python | mit | 16,698 |
"""
TopNav view classes.
"""
from Acquisition import aq_inner
from Products.CMFCore.utils import getToolByName
from Products.TeamSpace.permissions import ManageTeamMembership
from opencore.browser.base import BaseView
from opencore.browser.topnav.interfaces import ITopnavMenuItems
from opencore.i18n import _
from openc... | socialplanning/opencore | opencore/browser/topnav/topnav.py | Python | gpl-3.0 | 3,065 |
# Copyright (C) 2013-2015 Samuel Damashek, Peter Foley, James Forcier, Srijay Kasturi, Reed Koser, Christopher Reffett, and Fox Wilson
#
# 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 ve... | N6UDP/cslbot | cslbot/commands/about.py | Python | gpl-2.0 | 1,181 |
"""
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 this ... | arenadata/ambari | ambari-server/src/main/resources/common-services/FALCON/0.5.0.2.1/package/scripts/falcon_client.py | Python | apache-2.0 | 2,394 |
#!/usr/bin/env python
# This file is Copyright David Francos Cuartero, licensed under the GPL2 license.
from distutils.core import setup
#from setuptools import setup
import os
setup(name='airgraph-ng',
version='1.1',
description='Aircrack-ng network grapher',
author='TheX1le',
console = [{"sc... | entropy1337/infernal-twin | Modules/airgraph-ng/setup.py | Python | gpl-3.0 | 556 |
from allauth.account.signals import user_signed_up
from django.dispatch import receiver
from .models import CodeQuizAttempt
# todo -> this is copy pasted from quiz/signal_receivers.
# Can we extract common code?
@receiver(user_signed_up, dispatch_uid="codequiz:codequizattempt:user_signed_up")
def attribute_session_q... | pixyj/feel | django-server/feel/codequiz/signal_receivers.py | Python | mit | 507 |
import pytest
from umodbus.server.serial import AbstractSerialServer
@pytest.fixture
def abstract_serial_server():
return AbstractSerialServer()
def test_abstract_serial_server_get_meta_data(abstract_serial_server):
""" Test if meta data is correctly extracted from request. """
assert abstract_serial_s... | AdvancedClimateSystems/python-modbus | tests/unit/server/serial/test_init.py | Python | mpl-2.0 | 611 |
#!/usr/bin/python
from sklearn.linear_model import RidgeCV
from sklearn.model_selection import train_test_split
from sklearn.externals import joblib
import numpy as np
import matplotlib.pyplot as plt
import os
data = np.loadtxt(fname = 'data.txt', delimiter = ',')
X, y = data[:,:5], data[:,5]
print(X)
print(y)
m = ... | samuxiii/prototypes | learning/stock/main.py | Python | mit | 1,558 |
def to_binary(integer):
integer = int(integer)
integer = integer * -1 if integer < 0 else integer
number = ''
while integer:
number = number + str(int(integer) % 2)
integer /= 2
return number
| vtemian/university_projects | arhitecure/hmw2/utils/to_binary.py | Python | apache-2.0 | 212 |
class MainPageTexts:
PAGE_TITLE = "System przeprowadzania wyborów"
ELECTION_NAME = "COG i CDO 2020"
ELECTION_INFO_LINK_TEXT = "Informacja wyborcza"
ELECTION_INFO_LINK_HREF = "https://forum.opencaching.pl/viewtopic.php?t=9085&p=143998#p143998"
class ElectionNotStaredTexts:
ELECTION_MESSAGE = "W tej... | mzylowski/oc-pl-elections | tests/consts_text.py | Python | gpl-3.0 | 1,154 |
"""Remove nodes whose output is not used."""
from iotile.core.exceptions import ArgumentError
from iotile.sg.node import TrueTrigger, FalseTrigger, InputTrigger
from iotile.sg import DataStreamSelector
from iotile.sg.parser.stream_allocator import StreamAllocator
class RemoveDeadCodePass:
"""Remove nodes whose o... | iotile/coretools | iotilesensorgraph/iotile/sg/optimizer/passes/dead_code_elimination.py | Python | gpl-3.0 | 3,003 |
#!/bin/python
# coding: utf-8
import lglass.nic
database = lglass.nic.FileDatabase()
if hasattr(database, "session"):
session = database.session()
else:
session = database
print("# Database export from database {}".format(database.database_name))
print("# Current time: {}".format(datetime.datetime.now()))
p... | fritz0705/lglass | contrib/grs-export.py | Python | mit | 441 |
import csv, StringIO
from boto.s3.connection import S3Connection
from settings.common import SECRETS_DICT
from boto.s3.key import Key
CRON_BUCKET = 'citigroup-cron'
ACTIVE_ALERTS_KEY = 'gl_active_alerts.txt'
def get_active_alerts_contents():
cron_bucket = CRON_BUCKET
cron_key = ACTIVE_ALERTS_KEY
aws_ac... | mhfowler/brocascoconut | greenlightning/cronbox_s3.py | Python | mit | 2,154 |
#!/usr/bin/env python
import os
import sys
if __name__ == "__main__":
os.environ.setdefault("DJANGO_SETTINGS_MODULE", "DetentionSampleProject.settings")
from django.core.management import execute_from_command_line
execute_from_command_line(sys.argv)
| luismasuelli/django-detention | manage.py | Python | unlicense | 265 |
from django.conf.urls import patterns, include, url
# Uncomment the next two lines to enable the admin:
from django.contrib import admin
from djangogroovedown import settings
admin.autodiscover()
urlpatterns = patterns('',
# Examples:
url(r'^$', 'servicos.views.index', name='index'),
url(r'^popular/$', '... | alexandreferreira/groovedowndl | djangogroovedown/djangogroovedown/urls.py | Python | apache-2.0 | 1,215 |
# Copyright 2014: Mirantis 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 b... | vishnu-kumar/PeformanceFramework | tests/unit/plugins/openstack/scenarios/sahara/test_clusters.py | Python | apache-2.0 | 4,048 |
# This file is a part of the "SuMPF" package
# Copyright (C) 2018-2021 Jonas Schulte-Coerne
#
# This program is free software: you can redistribute it and/or modify it under
# the terms of the GNU Lesser General Public License as published by the Free
# Software Foundation, either version 3 of the License, or (at your ... | JonasSC/SuMPF | sumpf/_internal/_interpolation.py | Python | lgpl-3.0 | 14,343 |
# coding: utf-8
"""
An API to insert and retrieve metadata on cloud artifacts.
No description provided (generated by Swagger Codegen https://github.com/swagger-api/swagger-codegen) # noqa: E501
OpenAPI spec version: v1alpha1
Generated by: https://github.com/swagger-api/swagger-codegen.git
"""
... | grafeas/client-python | grafeas/api/grafeas_projects_api.py | Python | apache-2.0 | 15,932 |
import json
import importlib
import site
from openaps.configurable import Configurable
class ExtraConfig (Configurable):
prefix = 'device'
pass
class Device (Configurable):
vendor = None
required = ['name', 'vendor']
optional = [ ]
prefix = 'device'
_uses = [ ]
def __init__ (self, name, vendor):
s... | openaps/openaps | openaps/devices/device.py | Python | mit | 2,563 |
"""
Public views
"""
from django.conf import settings
from django.shortcuts import redirect
from django.utils.http import urlquote_plus
from waffle.decorators import waffle_switch
from common.djangoapps.edxmako.shortcuts import render_to_response
from ..config import waffle
__all__ = ['register_redirect_to_lms', '... | stvstnfrd/edx-platform | cms/djangoapps/contentstore/views/public.py | Python | agpl-3.0 | 2,210 |
import abc
import json
import six
import unittest
import billboard
@six.add_metaclass(abc.ABCMeta)
class Base:
@classmethod
@abc.abstractmethod
def setUpClass(cls):
pass
def testDate(self):
self.assertIsNotNone(self.chart.date)
def testTitle(self):
self.assertEqual(self.c... | guoguo12/billboard-charts | tests/test_current_charts.py | Python | mit | 3,187 |
class TweetCriteria:
def __init__(self):
self.maxTweets = 0
def setUsername(self, username):
self.username = username
return self
def setSince(self, since):
self.since = since
return self
def setUntil(self, until):
self.until = until
return self... | batuhaniskr/Social-Network-Tracking-And-Analysis | parser/operation/tweet_query.py | Python | mit | 576 |
# encoding: utf-8
class Enum(object):
@classmethod
def get_keys(cls):
return filter(lambda x: not x.startswith('_'), cls.__dict__.keys())
@classmethod
def items(cls):
return map(lambda x: (x, getattr(cls, x)), cls.get_keys())
@classmethod
def get_values(cls):
return map... | OriHoch/Open-Knesset | knesset/enums.py | Python | bsd-3-clause | 1,058 |
from coalib.bears.LocalBear import LocalBear
class SmellCapabilityBear(LocalBear):
CAN_FIX = {'Smell'}
LANGUAGES = {'All'}
def run(self, filename, file):
pass
| MalkmusT/coala-quickstart | tests/test_bears/SmellCapabilityBear.py | Python | agpl-3.0 | 182 |
# -*- coding: utf-8; -*-
#
# This file is part of Superdesk.
#
# Copyright 2013, 2018 Sourcefabric z.u. and contributors.
#
# For the full copyright and license information, please see the
# AUTHORS and LICENSE files distributed with this source code, or
# at https://www.sourcefabric.org/superdesk/license
"""This mod... | mdhaman/superdesk-core | superdesk/es_utils.py | Python | agpl-3.0 | 10,087 |
# coding=utf-8
# This is the winner of a comparison of multiple
# methods for removing duplicates from a list, shamelessly taken from
#
# http://www.peterbe.com/plog/uniqifiers-benchmark
#
# remember: if you dont need to preserve the order you can simply
# type:
#
# >>>list(set(my_list))
def removeDuplica... | radjkarl/fancyTools | fancytools/fcollections/removeDuplicates.py | Python | gpl-3.0 | 1,059 |
import re
if __name__ == '__main__':
n = int(input())
r = r'^[H|h][I|i]\s[^D|d]'
for _ in range(n):
s = input()
if re.match(r, s):
print(s)
| MrinmoiHossain/HackerRank | Regex/Applications/Saying Hi.py | Python | mit | 181 |
"""Blocking and non-blocking HTTP client interfaces.
This module defines a common interface shared by two implementations,
``simple_httpclient`` and ``curl_httpclient``. Applications may either
instantiate their chosen implementation class directly or use the
`AsyncHTTPClient` class from this module, which selects an... | bdarnell/tornado | tornado/httpclient.py | Python | apache-2.0 | 31,825 |
from .heymac_hsm import HeymacCsmaHsm
from .heymac_frame import HeymacFrame, HeymacFrameError, HeymacFrameFctl, \
HeymacFramePidIdent, HeymacFramePidType, \
HeymacIe, HeymacIeError, HeymacIeSequence, \
HeymacHIeTerm, HeymacHIeSqncNmbr, HeymacHIeCipher, \
HeymacPIeTerm, HeymacPIeFrag0, HeymacPIeFragN, He... | dwhall/HeyMac | heymac/lnk/__init__.py | Python | mit | 535 |
# -*- coding: utf-8 -*-
from __future__ import absolute_import, division, print_function
import pprint
import tempfile
from subprocess import Popen, PIPE
import os
from libfuturize.fixer_util import is_shebang_comment
from lib2to3.fixer_util import FromImport
from lib2to3.pytree import Leaf, Node
from lib2to3.pygram ... | krischer/python-future | tests/test_future/test_futurize.py | Python | mit | 35,721 |
class Flattener:
def __init__(self, prefix=''):
self.prefix = prefix
def __flatten_list(self, structure, prefix):
result = dict()
for i, subitem in enumerate(structure):
path = '{0}[{1}]'.format(prefix, i)
flat = self.__flatten(subitem, path)
for pa... | the-dalee/Pilifana | pilifana/conversion/structure.py | Python | mit | 1,398 |
# covered in collections | ramesharpu/python | basic-coding/built-in-functions/frozenset.py | Python | gpl-2.0 | 24 |
#!/usr/bin/env python
###############################################################################
# $Id: mrsid.py 33793 2016-03-26 13:02:07Z goatbar $
#
# Project: GDAL/OGR Test Suite
# Purpose: Test read/write functionality for MrSID driver.
# Author: Frank Warmerdam <warmerdam@pobox.com>
#
###################... | nextgis-extra/tests | lib_gdal/gdrivers/mrsid.py | Python | gpl-2.0 | 18,492 |
# 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
#
# Unless required by appli... | HybridF5/tempest_debug | tempest/lib/services/compute/versions_client.py | Python | apache-2.0 | 2,531 |
"""
This module provides tools.
.. moduleauthor:: Felix Mueller
.. moduleauthor:: Pascal Wittmann
:copyright: PenchY Developers 2011-2012, see AUTHORS
:license: MIT License, see LICENSE
"""
import os.path
from penchy.jobs.elements import Tool
from penchy.jobs.hooks import Hook
from penchy.jobs.typecheck import T... | fhirschmann/penchy | penchy/jobs/tools.py | Python | mit | 2,762 |
#!/usr/bin/python
#
# Copyright (c) 2017 Yawei Wang, <yaweiw@microsoft.com>
#
# 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
ANSIBLE_METADATA = {'metadata_version': '1.1',
... | dagwieers/ansible | lib/ansible/modules/cloud/azure/azure_rm_containerregistry.py | Python | gpl-3.0 | 14,141 |
# -*- coding: utf-8 -*-
"""
Wikipedia channel for IFTTT
~~~~~~~~~~~~~~~~~~~~~~~~~~~
Copyright 2015 Ori Livneh <ori@wikimedia.org>
Stephen LaPorte <stephen.laporte@gmail.com>
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with t... | wikimedia/ifttt | ifttt/utils.py | Python | apache-2.0 | 2,768 |
import os
import threading
import time
import pytest
import splinter
import waitress
from .demo import app
APP_HTTP_PORT = 65431
APP_URL = f'http://0.0.0.0:{APP_HTTP_PORT}/'
WAIT_DELAY = 0.5
# See .travis.yml to know why we use Chrome by default. You are
# encouraged to also test with `DRIVER_NAME="firefox" pytest... | dbaty/deform_ext_autocomplete | tests/test_browser.py | Python | bsd-3-clause | 4,511 |
# 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/appservice/azure-mgmt-web/azure/mgmt/web/v2019_08_01/models/_web_site_management_client_enums.py | Python | mit | 21,622 |
from oscar.core.loading import get_model
from accounts import names
Account = get_model('accounts', 'Account')
def redemptions_account():
return Account.objects.get(name=names.REDEMPTIONS)
def lapsed_account():
return Account.objects.get(name=names.LAPSED)
| michaelkuty/django-oscar-accounts | accounts/core.py | Python | bsd-3-clause | 271 |
##
# Copyright (c) 2010-2014 Apple Inc. All rights reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable l... | trevor/calendarserver | txdav/common/datastore/upgrade/sql/others/test/test_attachment_migration.py | Python | apache-2.0 | 8,918 |
# -*- coding: utf-8 -*-
# Generated by Django 1.9 on 2016-05-11 18:53
from __future__ import unicode_literals
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('market_blog', '0001_initial'),
]
operations = [
migrations.AddField(
... | SHARPRISE/AnGroDeto | market_blog/migrations/0002_atik_end_date.py | Python | apache-2.0 | 471 |
#!/usr/bin/env python
try:
from setuptools import setup, find_packages
from setuptools.command.test import test
except ImportError:
from ez_setup import use_setuptools
use_setuptools()
from setuptools import setup, find_packages
from setuptools.command.test import test
import os
here = os.... | Tivix/django-spam | setup.py | Python | mit | 1,454 |
import os
from countershape import model
from countershape import state
from countershape import widgets
from . import testpages, tutils
class TestContext(testpages.DummyState):
def setUp(self):
testpages.DummyState.setUp(self)
def tearDown(self):
testpages.DummyState.tearDown(self)
def ... | mhils/countershape | test/test_model.py | Python | mit | 13,305 |
# generated from catkin/cmake/template/pkg.context.pc.in
CATKIN_PACKAGE_PREFIX = ""
PROJECT_PKG_CONFIG_INCLUDE_DIRS = "/home/trevor/ROS/catkin_ws/devel/include".split(';') if "/home/trevor/ROS/catkin_ws/devel/include" != "" else []
PROJECT_CATKIN_DEPENDS = "roscpp".replace(';', ' ')
PKG_CONFIG_LIBRARIES_WITH_PREFIX = "... | siketh/ASR | catkin_ws/build/navigation/robot_pose_ekf/catkin_generated/pkg.develspace.context.pc.py | Python | mit | 467 |
# Usage: mitmdump -s "iframe_injector.py url"
# (this script works best with --anticache)
import sys
from bs4 import BeautifulSoup
class Injector:
def __init__(self, iframe_url):
self.iframe_url = iframe_url
def response(self, flow):
if flow.request.host in self.iframe_url:
return... | mosajjal/mitmproxy | examples/simple/modify_body_inject_iframe.py | Python | mit | 829 |
#!/usr/bin/env python
try:
# Install prereqs here and now if we can.
from setuptools import setup
kw = {
'install_requires': ['pyzmq>=2.0.10.0']
}
except ImportError:
from distutils.core import setup
print 'No setuptools. You may have to manually install dependencies.'
kw = {}
... | talos/zmqrepl | setup.py | Python | gpl-3.0 | 587 |
# -*- coding: utf-8 -*-
#
# This hook generates a system notification for Linux when using MAL
#
# Written by matoro, last updated 2016/09/01
# https://github.com/matoro/
# https://myanimelist.net/profile/Matoro_Mahri
#
# To use, copy this file to ~/.trackma/hooks/
import os
import trackma.utils as utils
def episode_... | z411/trackma | hooks/notification.py | Python | gpl-3.0 | 545 |
import _plotly_utils.basevalidators
class UirevisionValidator(_plotly_utils.basevalidators.AnyValidator):
def __init__(self, plotly_name="uirevision", parent_name="scatter", **kwargs):
super(UirevisionValidator, self).__init__(
plotly_name=plotly_name,
parent_name=parent_name,
... | plotly/python-api | packages/python/plotly/plotly/validators/scatter/_uirevision.py | Python | mit | 447 |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
# Copyright (C) 2008 Adriano Monteiro Marques
#
# Author: Francesco Piccinno <stack.box@gmail.com>
# ... | dennisfrancis/PacketManipulator | umit/pm/backend/abstract/__init__.py | Python | gpl-2.0 | 1,421 |
__author__ = 'alexander'
treinennet = dict()
#dict met lists
treinennet['Utrecht Centraal'] = ['\'s-Hertogenbosch','Amersfoort', 'Arnhem', 'Bunnik', 'Driebergen-Zeist', 'Gouda', 'Utrecht Leidsche Rijn', 'Utrecht Lunetten', 'Utrecht Overvecht', 'Utrecht Terwijde', 'Utrecht Zuilen', 'Veenendaal-De Klomp', 'Woerden']
trei... | Alexanderkorn/Automatisation | oude scripts/les 9/traject code ns.py | Python | gpl-3.0 | 813 |
from django.db import models
from django.contrib.auth.models import User
from django.utils.translation import ugettext_lazy as _
from django.utils.encoding import python_2_unicode_compatible
# https://docs.djangoproject.com/en/dev/ref/models/fields/
@python_2_unicode_compatible
class Student(models.Model):
user =... | luisza/university | university/models.py | Python | gpl-2.0 | 2,471 |
from django.apps import AppConfig
class RequestsConfig(AppConfig):
name = 'requests'
| elenamvk/tourcouch2.0 | requests/apps.py | Python | mit | 91 |
#!/usr/bin/env python
# Maintained by Marshall Mattingly
import os, subprocess, sys
# global variables
base = os.path.dirname(os.path.realpath(__file__))
env = os.path.join(base, 'env')
def create_env():
'''Creates our virtual environment.'''
# see if it's already been created
if os.path.exists(env):
... | UND-CSCI491/atlascms | manage.py | Python | apache-2.0 | 2,123 |
import math
from scipy import constants
from ROOT import TVector3
from heppy.utils.deltar import deltaPhi
from collections import OrderedDict
class Path(object):
'''Path followed by a particle in 3D space.
Assumes constant speed magnitude both along the z axis and in the transverse plane.
'''
... | semkiv/heppy_fcc | fastsim/path.py | Python | gpl-3.0 | 4,066 |
import matplotlib,numpy,sys,scipy,pickle
import matplotlib.pyplot
sys.path.append('../lib')
import calculateStatistics
### MAIN
matplotlib.rcParams.update({'font.size':36,'font.family':'Times New Roman','xtick.labelsize':28,'ytick.labelsize':28})
thePointSize=12
jarDir='/Users/adriandelomana/scratch/'
# mutagenized... | adelomana/cassandra | conditionedFitness/figureMutagenized/script.2.3.py | Python | gpl-3.0 | 2,965 |
from time import time
class Stream(object):
"""
Stream abstract class.
"""
def __init__(self, cond_stream, inputs):
"""
:param cond_stream: a :class:`.ConditionalStream` which produced this stream
:param inputs: a list of values for parameters ``cond_stream.inputs`` that are t... | caelan/stripstream | stripstream/pddl/streams.py | Python | mit | 6,045 |
import unittest
from .. import Message
class TestStringMethods(unittest.TestCase):
def setUp(self):
self.data = {
"from": {
"name": "Jim",
},
"message": "Hello",
"created_time": "2015-12-12T22:22:22+0000",
... | fantastic001/pyfb | pyfacebook/tests/test_message.py | Python | gpl-2.0 | 697 |
#!/usr/local/bin/python
# -*- coding: utf-8 -*-
# Author: illuz <iilluzen[at]gmail.com>
# File: AC_brute_force_nk.py
# Create Date: 2015-08-18 18:49:00
# Usage: AC_brute_force_nk.py
# Descripton:
class Solution:
# @param {integer[]} nums
# @param {integer} k
# @return {integer[]}
... | bssrdf/leetcode-7 | solutions/239.Sliding_Window_Maximum/AC_brute_force_nk.py | Python | gpl-2.0 | 668 |
# -*- coding: utf-8 -*-
from __future__ import with_statement
try:
from PIL import Image, GifImagePlugin, JpegImagePlugin, PngImagePlugin, TiffImagePlugin
except ImportError:
import Image, GifImagePlugin, JpegImagePlugin, PngImagePlugin, TiffImagePlugin
import logging
import os
import subprocess
# import te... | jansohn/pyload | module/plugins/internal/OCR.py | Python | gpl-3.0 | 9,734 |
# Benchmark the calculation of a distance in a PDB file
# The distance is the closest distance between any atoms of residues 50 and 60
# of chain A in 1AKE
import time
from chemfiles import Trajectory, Selection
def distance(frame):
# FIXME: this should use Selection("resid 50 and [chainname] A") which will
... | jgreener64/pdb-benchmarks | chemfiles/distance.py | Python | mit | 817 |
from setuptools import setup
setup(name='blended',
version='5.0.2',
description='The Most Versatile Static HTML Site Generator',
url='http://jmroper.com/blended/',
author='John Roper',
author_email='johnroper100@gmail.com',
license='GPL3.0',
packages=['blended'],
install... | BlendedSiteGenerator/Blended | setup.py | Python | gpl-3.0 | 801 |
#!/usr/bin/env python
# Copyright 2015, Google Inc.
# 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 o... | fichter/grpc | tools/run_tests/port_server.py | Python | bsd-3-clause | 3,575 |
"""
SleekXMPP: The Sleek XMPP Library
Copyright (C) 2010 Nathanael C. Fritz
This file is part of SleekXMPP.
See the file license.txt for copying permission.
"""
from . import base
from xml.etree import cElementTree
class StanzaPath(base.MatcherBase):
def match(self, stanza):
return stanza.match(s... | sezuan/SleekXMPP | sleekxmpp/xmlstream/matcher/stanzapath.py | Python | mit | 335 |
# 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... | Canpio/Paddle | python/paddle/fluid/tests/book_memory_optimization/test_memopt_image_classification_train.py | Python | apache-2.0 | 5,674 |
#
# InsCfgTab.py -- Plugin to display/edit the instrument configuration in a table GUI
#
import datetime
from qtpy import QtCore
from qtpy import QtWidgets as QtGui
from qplan import entity
from qplan.plugins import QueueFileTab
class InsCfgTab(QueueFileTab.QueueCfgFileTab):
def build_table(self):
super... | naojsoft/qplan | qplan/plugins/InsCfgTab.py | Python | bsd-3-clause | 2,049 |
class PjaxrMixin(object):
"""
View mixin that provides pjaxr functionality
"""
namespace = ""
parent_namespace = ""
matching_count = 0
def get_matching_count(self, request):
"""
takes current_namespace to return the matching namespaces of the previous pjaxr-request and the c... | iekadou/django-pjaxr | django_pjaxr/mixins.py | Python | mit | 2,048 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.