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 |
|---|---|---|---|---|---|
# -----------------------------------------------------------------------------
#
# This file is the copyrighted property of Tableau Software and is protected
# by registered patents and other applicable U.S. and international laws and
# regulations.
#
# Unlicensed use of the contents of this file is prohibited. Please... | corystreet/pyOdbcToTde | Static/TableauSDK-9100.15.0828.1711/tableausdk/Exceptions.py | Python | gpl-2.0 | 1,040 |
"""Layout provider for an unsupported directory layout."""
from __future__ import annotations
import typing as t
from . import (
ContentLayout,
LayoutProvider,
)
class UnsupportedLayout(LayoutProvider):
"""Layout provider for an unsupported directory layout."""
sequence = 0 # disable automatic dete... | mattclay/ansible | test/lib/ansible_test/_internal/provider/layout/unsupported.py | Python | gpl-3.0 | 1,561 |
"""Add datetime column to vote
Revision ID: 9b53dd8832b6
Revises: 5debb667e48b
Create Date: 2018-02-05 11:27:10.742269
"""
from alembic import op
import sqlalchemy as sa
# revision identifiers, used by Alembic.
revision = '9b53dd8832b6'
down_revision = '5debb667e48b'
branch_labels = None
depends_on = None
def upg... | SCUEvals/scuevals-api | db/alembic/versions/20180205112710_add_datetime_column_to_vote.py | Python | agpl-3.0 | 524 |
# Copyright 2016, Kay Hayen, mailto:kay.hayen@gmail.com
#
# Part of "Nuitka", an optimizing Python compiler that is compatible and
# integrates with CPython, but also works on its own.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in complianc... | fluxer/spm | nuitka/nuitka/nodes/ContainerMakingNodes.py | Python | gpl-2.0 | 7,298 |
# -*- coding: utf-8 -*-
# Copyright (C) 2010, 2011, 2012, 2013 Sebastian Wiesner <lunaryorn@gmail.com>
# This library 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 2.1 of the License, ... | mulkieran/pyudev | pyudev/monitor.py | Python | lgpl-2.1 | 20,793 |
from contextlib import redirect_stdout
import io
from unittest import TestCase
from todone.backend import SavedList
from todone.backend.db import Todo
from todone.commands.done import done_todo, parse_args
from todone.tests.base import DB_Backend
from todone.parser import exceptions as pe
class TestDoneTodo(DB_Backe... | safnuk/todone | todone/commands/tests/test_done.py | Python | apache-2.0 | 1,893 |
from performanceplatform.collector.ga.plugins.rank \
import ComputeRank
def test_rank():
plugin = ComputeRank("rank")
docs = [{}, {}]
result = plugin(docs)
doc1, doc2 = result
assert doc1["rank"] == 1
assert doc2["rank"] == 2
| alphagov/performanceplatform-collector | tests/performanceplatform/collector/ga/plugins/test_rank.py | Python | mit | 260 |
#!/usr/bin/env python
import os
import random
import requests
import subprocess
import argparse
import datetime
import time
import sys
"""Based off https://github.com/fogleman/primitive/blob/master/bot/main.py
"""
with open(os.path.expanduser('~/.flickr_api_key'), 'r') as key_file:
FLICKR_API_KEY = key_file.read... | yukunlin/homebrew-primitive-wallpaper | primitive-wallpaper.py | Python | mit | 5,416 |
# coding: utf-8
"""
Onshape REST API
The Onshape REST API consumed by all clients. # noqa: E501
The version of the OpenAPI document: 1.113
Contact: api-support@onshape.zendesk.com
Generated by: https://openapi-generator.tech
"""
from __future__ import absolute_import
import re # noqa: F401
im... | onshape-public/onshape-clients | python/onshape_client/oas/models/bt_allowed_mate_type_filter1511.py | Python | mit | 7,411 |
from django.contrib.auth import get_user_model
from django.contrib.auth.backends import ModelBackend
from mama_cas.services.backends import SettingsBackend
class ExceptionBackend(ModelBackend):
"""Raise an exception on authentication for testing purposes."""
def authenticate(self, request, username=None, pas... | orbitvu/django-mama-cas | mama_cas/tests/backends.py | Python | bsd-3-clause | 1,158 |
import pickle
import sys
from kombu.tests.utils import unittest
if sys.version_info >= (3, 0):
from io import StringIO, BytesIO
else:
from StringIO import StringIO, StringIO as BytesIO # noqa
from kombu import utils
from kombu.utils.functional import wraps
from kombu.tests.utils import redirect_stdouts, mas... | mzdaniel/oh-mainline | vendor/packages/kombu/kombu/tests/test_utils.py | Python | agpl-3.0 | 5,919 |
#
# Newfies-Dialer License
# http://www.newfies-dialer.org
#
# 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) 2011-2014 Star2Billing S.L.
#
# The Initia... | nishad89/newfies-dialer | newfies/dialer_audio/urls.py | Python | mpl-2.0 | 681 |
class ObjectMappingNotFound(Exception):
def __init__(self, message):
Exception.__init__(self, message)
class InvalidObjectMapping(Exception):
def __init__(self, message):
Exception.__init__(self, message) | Ketouem/python-frontynium | frontynium/exceptions.py | Python | mit | 231 |
# -*- coding: utf-8 -*-
"""
Tests that the request came from a crawler or not.
"""
from __future__ import absolute_import
import ddt
from django.test import TestCase
from django.http import HttpRequest
from ..models import CrawlersConfig
@ddt.ddt
class CrawlersConfigTest(TestCase):
def setUp(self):
supe... | ESOedX/edx-platform | openedx/core/djangoapps/crawlers/tests/test_models.py | Python | agpl-3.0 | 1,412 |
import cv2
import numpy as np
from glob import glob
import itertools as it
import math as m
from operator import add, truediv
from numpy.linalg import norm
import xml.etree.ElementTree as ET
dimCell = 8 # size of cell
dimBlock = 2 # size of block (2x2)Cells
nbins = 9
Err = 0.0000000001
labels = []
samples = []
sampl... | HDLynx/sharingan | sharinganINRIA.py | Python | gpl-2.0 | 12,570 |
# encoding: UTF-8
'''
本文件基于vnpy.event.eventType,并添加更多字段
'''
from vnpy.event.eventType import *
# 系统相关
EVENT_TIMER = 'eTimer' # 计时器事件,每隔1秒发送一次
EVENT_LOG = 'eLog' # 日志事件,全局通用
# Gateway相关
EVENT_TICK = 'eTick.' # TICK行情事件,可后接具体的vtSymbol
EVENT_TRADE = 'eTrade.' ... | rrrrrr8/vnpy | vnpy/trader/vtEvent.py | Python | mit | 774 |
"""
This module contains helper functions to communicate with wellfare
using JSON dictionnaries. The main function is json_process, which
will call one of the subsequent functions depending on the TASK
to be performed.
"""
import numpy as np
from .curves import Curve
from .ILM import (infer_growth_rate,
... | ibis-inria/wellFARE | wellfare/json_api.py | Python | lgpl-3.0 | 16,896 |
import requests, zipfile
import StringIO
import pandas as pd
import os
import pdb
import numpy as np
from datetime import date
def get_data(name, url):
""" Download and cache Citibike data
"""
out_path = 'tripdata/'
csv_path = out_path + name[:-3] + 'csv'
if os.path.exists(csv_path):
print ... | djevans071/Rebalancing-Citibike | workflow/data.py | Python | mit | 4,328 |
# Copyright 2004-2005 Joe Wreschnig, Michael Urman, Iñigo Serna
#
# 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.
impor... | Mellthas/quodlibet | quodlibet/qltk/filesel.py | Python | gpl-2.0 | 22,372 |
materia1 = 6
materia2 = 10
materia3 = 10
print(materia1 >= 7 and materia2 >= 7 and materia3 >= 7) | laenderoliveira/exerclivropy | cap03/ex-03-06.py | Python | mit | 97 |
from corehq.apps.receiverwrapper.util import submit_form_locally
from casexml.apps.case.models import CommCareCase
from lxml import etree
import os
from datetime import datetime, timedelta
import uuid
from django.core.files.uploadedfile import UploadedFile
from custom.uth.const import UTH_DOMAIN
import re
def scan_ca... | qedsoftware/commcare-hq | custom/uth/utils.py | Python | bsd-3-clause | 6,401 |
from pycoin.encoding.bytes32 import from_bytes_32
from pycoin.encoding.hash import double_sha256
from pycoin.satoshi.flags import SIGHASH_FORKID
from ..bitcoin.SolutionChecker import BitcoinSolutionChecker
class BgoldSolutionChecker(BitcoinSolutionChecker):
FORKID_BTG = 79 # atomic number for Au (gold)
de... | richardkiss/pycoin | pycoin/coins/bgold/SolutionChecker.py | Python | mit | 1,299 |
#
# This file is part of pysnmp software.
#
# Copyright (c) 2005-2016, Ilya Etingof <ilya@glas.net>
# License: http://pysnmp.sf.net/license.html
#
import sys
from pyasn1.compat.octets import null
from pysnmp.proto import rfc3411, error
from pysnmp.proto.api import v1, v2c # backend is always SMIv2 compliant
from pysnm... | filippog/pysnmp | pysnmp/entity/rfc3413/ntfrcv.py | Python | bsd-3-clause | 4,010 |
# Author: Nic Wolfe <nic@wolfeden.ca>
# URL: http://code.google.com/p/sickbeard/
#
# This file is part of SickRage.
#
# SickRage is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License,... | ahmetabdi/SickRage | sickbeard/show_name_helpers.py | Python | gpl-3.0 | 13,767 |
#!/usr/bin/env python3
"""
Universal file/directory methods are defined here.
"""
import stat, hashlib
from source.libs.define import *
#import source.libs.define as lib
import source.libs.log as log
from source.libs.db import *
def get_fullpath(system, path):
#print(system, path)
if system.startswith('/'): ... | lightfaith/locasploit | source/libs/io.py | Python | gpl-2.0 | 14,049 |
from __future__ import print_function, division
import matplotlib
import logging
from sys import stdout
matplotlib.use('Agg') # Must be before importing matplotlib.pyplot or pylab!
from neuralnilm import (Net, RealApplianceSource,
BLSTMLayer, DimshuffleLayer,
Bidirectiona... | JackKelly/neuralnilm_prototype | scripts/e493.py | Python | mit | 6,836 |
import pytest
import glob
import logging.config
import os
import minst.logger
import minst.utils
logging.config.dictConfig(minst.logger.get_config('INFO'))
def collect_files(exts, data, depth=8):
afiles = []
for n in range(depth):
fmt = os.path.join(data, "/".join(["*"] * n), "*.{}*")
for e... | ejhumphrey/minst-dataset | minst/tests/test_utils.py | Python | isc | 2,380 |
#!/usr/bin/env python
"""
This file is part of open-ihm.
open-ihm is free software: you can redistribute it and/or modify it
under the terms of the GNU General Public License as published by the
Free Software Foundation, either version 3 of the License, or (at your
option) any later version.
open-ihm is di... | tectronics/open-ihm | src/openihm/data/incomesourcemanager.py | Python | lgpl-3.0 | 5,156 |
# -*- coding: latin1 -*-
# Copyright (C) 2006-2010 João Luís Silva <jsilva@fc.up.pt>
#
# 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, or (at your option)
# any later vers... | ycasg/PyNLO | src/pynlo/interactions/FourWaveMixing/__init__.py | Python | gpl-3.0 | 1,055 |
# -*- coding: utf-8 -*-
#
# python-apt documentation build configuration file, created by
# sphinx-quickstart on Wed Jan 7 17:04:36 2009.
#
# This file is execfile()d with the current directory set to its containing
# dir.
#
# The contents of this file are pickled, so don't put values in the namespace
# that aren't pi... | suokko/python-apt | doc/source/conf.py | Python | gpl-2.0 | 7,520 |
#!/usr/bin/env python
#
# 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 requir... | googleads/googleads-python-lib | examples/ad_manager/v202202/proposal_line_item_service/get_all_proposal_line_items.py | Python | apache-2.0 | 1,904 |
# coding=utf-8
# --------------------------------------------------------------------------
# Copyright (c) Microsoft Corporation. All rights reserved.
# Licensed under the MIT License. See License.txt in the project root for license information.
# Code generated by Microsoft (R) AutoRest Code Generator.
# Changes may ... | Azure/azure-sdk-for-python | sdk/network/azure-mgmt-network/azure/mgmt/network/v2019_07_01/aio/operations/_route_filter_rules_operations.py | Python | mit | 28,638 |
# Copyright (c) 2011-2022 Berkeley Model United Nations. All rights reserved.
# Use of this source code is governed by a BSD License (see LICENSE).
import json, logging, sys, traceback
from django.core.mail.backends import dummy, smtp
from django.db import transaction
from smtplib import SMTPException
class DevLog... | bmun/huxley | huxley/logging/mail.py | Python | bsd-3-clause | 1,598 |
#!/usr/bin/env python
# -*- coding: UTF-8 -*-
#
# Copyright (c) 2019 ASMlover. 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... | ASMlover/study | cplusplus/wren_cc/test/bench_fib.py | Python | bsd-2-clause | 1,588 |
# Enter your code here. Read input from STDIN. Print output to STDOUT
n = int(raw_input())
l = []
for i in range(n):
commands = raw_input().split()
count = 0
method = ""
method = commands[0]
args = map(int, commands[1:])
if method == "print":
print l
elif not args and method != "prin... | spradeepv/dive-into-python | hackerrank/domain/python/data_types/lists.py | Python | mit | 470 |
# Copyright 2015 AvanzOSC - Ainara Galdona
# Copyright 2015-2020 Tecnativa - Pedro M. Baeza
# Copyright 2016 Tecnativa - Antonio Espinosa
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl).
{
"name": "AEAT modelo 115",
"version": "14.0.1.0.0",
"development_status": "Mature",
"category": "Lo... | cubells/l10n-spain | l10n_es_aeat_mod115/__manifest__.py | Python | agpl-3.0 | 838 |
# Copyright 2014 PerfKitBenchmarker 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 appli... | meteorfox/PerfKitBenchmarker | perfkitbenchmarker/pkb.py | Python | apache-2.0 | 27,717 |
from __future__ import division
from __future__ import print_function
from __future__ import absolute_import
from __future__ import unicode_literals
import os
import xml.etree.ElementTree
from xml.etree.cElementTree import ElementTree, Element, SubElement
from xml.etree.cElementTree import fromstring, tostring
import ... | cnvogelg/fs-uae-gles | launcher/fs_uae_launcher/editor/XMLControl.py | Python | gpl-2.0 | 2,828 |
import _plotly_utils.basevalidators
class FormatValidator(_plotly_utils.basevalidators.DataArrayValidator):
def __init__(self, plotly_name="format", parent_name="table.cells", **kwargs):
super(FormatValidator, self).__init__(
plotly_name=plotly_name,
parent_name=parent_name,
... | plotly/python-api | packages/python/plotly/plotly/validators/table/cells/_format.py | Python | mit | 445 |
# coding: utf-8
from datetime import timedelta as td
import json
from django.core import mail
from django.utils.timezone import now
from hc.api.models import Channel, Check, Notification, Ping
from hc.test import BaseTestCase
class NotifyEmailTestCase(BaseTestCase):
def setUp(self):
super().setUp()
... | iphoting/healthchecks | hc/api/tests/test_notify_email.py | Python | bsd-3-clause | 5,005 |
# vim:fileencoding=utf-8:noet
from __future__ import (unicode_literals, division, absolute_import, print_function)
import sys
import os
from functools import partial
from powerline.segments import shell, tmux, common
from powerline.lib.vcs import get_fallback_create_watcher
import tests.vim as vim_module
from test... | magus424/powerline | tests/test_segments.py | Python | mit | 59,653 |
import complexism as cx
import epidag as dag
__author__ = 'TimeWz667'
# Create a new blueprint of CTBN
bp = cx.BlueprintCTBN('Test')
# Add microstates
bp.add_microstate('A', ['N', 'Y'])
bp.add_microstate('B', ['N', 'Y'])
# Name combinations of microstates as states
bp.add_state('A', A='Y')
bp.add_state('a', A='N')
... | TimeWz667/Kamanian | example/OOP/O2.2 SS, CTBN.py | Python | mit | 1,302 |
__author__ = 'modmuss50'
import sys
import os
#(PACKNAME) (PACKMAKER) (PACKDESCRIPTION) (MCVER) (FORGEVER)
print "Starting to generate your mod pack!"
packName = ""
packCreator = ""
packDescription = ""
mcVersion = ""
forgeVersion = ""
packName = sys.argv[1]
packCreator = sys.argv[2]
packDescription = sys.argv[3]
m... | OpenLauncher/OpenLauncherAPI | PACKCREATOR/makePack.py | Python | gpl-3.0 | 914 |
#!/usr/bin/env python
"""Script replacing flowcell_summary_uppload_LIMS.py
Gets data from the sequencing step and uploads it to statusdb.
Denis Moreno, Science for Life Laboratory, Stockholm, Sweden.
"""
import argparse
import os
import yaml
import logging
import logging.handlers
import LIMS2DB.objectsDB.process_ca... | Galithil/LIMS2DB | scripts/flowcell_sql_upload.py | Python | mit | 3,402 |
import sys
if sys.version_info[0] == 2: # Just checking your Python version to import Tkinter properly.
from Tkinter import *
else:
from tkinter import *
#from tkinter.messagebox import showinfo
import matplotlib.pyplot as plt
import RentCrawl as rc
master = Tk()
class Fullscreen_Window:
... | BowenBao/pycrawl | RentCrawl/gui.py | Python | mit | 6,837 |
import datetime
from django.db import models
from django.db.models import signals
from django.contrib.contenttypes.models import ContentType
from django.utils.encoding import force_unicode
from tagging.fields import TagField
class ItemManager(models.Manager):
def __init__(self):
super(ItemManager, sel... | jacobian-archive/jellyroll | src/jellyroll/managers.py | Python | bsd-3-clause | 3,713 |
from collections import OrderedDict
from glob import glob
import logging
import os
import tempfile
from six import string_types
from metamds import Task
from metamds.io import rsync_to
from metamds.db import add_doc_db
class Simulation(object):
"""
Attributes
----------
name :
tasks :
templ... | iModels/metamds | metamds/simulation.py | Python | mit | 9,217 |
import datetime
import sys
from string import Template
from dsl_parsers.parsing_utils import communication_is_ice, get_name_number, IDSLPool
from templates.common.templatedict import TemplateDict
class src_main_py(TemplateDict):
def __init__(self, component):
super(src_main_py, self).__init__()
se... | Kmayankkr/robocomp | tools/robocompdsl/templates/templatePython/plugins/base/functions/src/main_py.py | Python | gpl-3.0 | 454 |
# Copyright 2014 NEC Corporation. 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 ... | Tesora/tesora-tempest | tempest/api/compute/admin/test_security_group_default_rules.py | Python | apache-2.0 | 5,798 |
"""
**DEPRECATED**
Use :mod:`celery.defaults` instead.
"""
from celery import current_app
from celery.app import defaults
_DEFAULTS = defaults.DEFAULTS
conf = current_app.conf
ALWAYS_EAGER = conf.CELERY_ALWAYS_EAGER
EAGER_PROPAGATES_EXCEPTIONS = conf.CELERY_EAGER_PROPAGATES_EXCEPTIONS
RESULT_BACKEND = conf.CELERY... | WoLpH/celery | celery/conf.py | Python | bsd-3-clause | 3,960 |
import re
from urllib import parse
from collections import defaultdict
from openstates.scrape import Person, Scraper
import lxml.html
class WVPersonScraper(Scraper):
jurisdiction = "wv"
def scrape(self, chamber=None):
chambers = [chamber] if chamber is not None else ["upper", "lower"]
for c... | sunlightlabs/openstates | scrapers/wv/people.py | Python | gpl-3.0 | 5,733 |
# -*- coding: utf-8 -*-
##
## This file is part of Invenio.
## Copyright (C) 2008, 2009, 2010, 2011 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 ... | NikolaYolov/invenio_backup | modules/bibcirculation/lib/bibcirculation_webinterface.py | Python | gpl-2.0 | 35,129 |
# -*- coding: utf-8 -*-
# Copyright 2022 Google LLC
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or... | googleapis/python-aiplatform | google/cloud/aiplatform_v1/types/tensorboard.py | Python | apache-2.0 | 4,087 |
# -*- coding: utf-8 -*-
"""
Lexer for the Groovy language.
http://groovy.codehaus.org
:copyright: 2009 Matthew Taylor
:license: BSD, see LICENSE for more details.
"""
from pygments.scanner import Scanner
from pygments.lexer import RegexLexer, include, bygroups, using, \
this... | rhyolight/pygments-groovy | lexer/__init__.py | Python | bsd-3-clause | 516 |
# -*- coding: utf-8 -*-
# Copyright 2022 Google LLC
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or... | googleapis/python-dataplex | google/cloud/dataplex_v1/types/metadata_.py | Python | apache-2.0 | 28,857 |
import os
from django.template.loader import render_to_string
from django.test.testcases import SimpleTestCase
from corehq.apps.app_manager.models import Application, Module
from corehq.apps.app_manager.util import generate_xmlns
from corehq.util.test_utils import TestFileMixin
QUESTIONS = [
{
'tag': 'in... | dimagi/commcare-hq | corehq/apps/app_manager/tests/test_get_questions.py | Python | bsd-3-clause | 10,624 |
"""
Class for encoding variable-length flanking and peptides to
fixed-size numerical matrices
"""
from __future__ import (
print_function, division, absolute_import, )
from six import string_types
from collections import namedtuple
import logging
from .encodable_sequences import EncodingError, EncodableSequences
... | hammerlab/mhcflurry | mhcflurry/flanking_encoding.py | Python | apache-2.0 | 6,536 |
from backend import BackendBase, registry
class HaskellBackend(BackendBase):
def compile(self, argv=None, env={}):
if not argv: argv = ['ghc', 'main.hs']
return self.popen(argv, env)
def run(self, argv=None, env={}):
if not argv: argv = ['./main']
return self.popen(argv, env)
... | 4poc/rccvm | rccvmd/backends/haskell.py | Python | apache-2.0 | 459 |
# coding=utf-8
# Copyright 2022 The TensorFlow Datasets 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 appl... | tensorflow/datasets | tensorflow_datasets/summarization/wikihow.py | Python | apache-2.0 | 7,225 |
__author__ = 'gulce'
import sys
from Airline import *
def canRedeem(current, goal, pathForMiles, airlinesVisited, network):
if(current == goal):
pathForMiles.append(current)
return True
elif(airlinesVisited.count(current)!=0):
return False
else:
airlinesVisited.append(curren... | gulcegunal/dagitik | odev02/airlineproblem.py | Python | gpl-2.0 | 2,128 |
# test builtin slice
# print slice
class A:
def __getitem__(self, idx):
print(idx)
A()[1:2:3]
| utopiaprince/micropython | tests/basics/builtin_slice.py | Python | mit | 107 |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
"""Tests lesson 03 task 12."""
# Import Python libs
import unittest
from decimal import Decimal
from fractions import Fraction
# Import student file
import task_12
class L03T12TestCase(unittest.TestCase):
"""
Tests for lesson 03 task 12.
"""
def test_i... | gracehyemin/is210-week-03-warmup | tests/test_task_12.py | Python | mpl-2.0 | 1,021 |
import os
import sys
import re
import numpy as np
import logging
import struct
import random
import math
import wave
import shutil
import collections
import functools
import operator
import heapq
from collections import namedtuple
from contextlib import contextmanager
# special vocabulary symbols
_BOS = '<S>'
_EOS =... | eske/seq2seq | translate/utils.py | Python | apache-2.0 | 20,579 |
from django.contrib import admin
from django.shortcuts import redirect
from django.urls import reverse
from django.utils.translation import ugettext_lazy as _
from waldur_core.core import admin as core_admin
from . import models, tasks
class ProfileAdmin(core_admin.ExtraActionsMixin, admin.ModelAdmin):
list_dis... | opennode/nodeconductor-assembly-waldur | src/waldur_freeipa/admin.py | Python | mit | 1,621 |
from __future__ import absolute_import
import csv
import functools
import logging
import os
import sys
import tempfile
import warnings
from pip._vendor import pkg_resources
from pip.compat import uses_pycache, WINDOWS, cache_from_source
from pip.compat import get_stdlib
from pip.exceptions import UninstallationError... | sigmavirus24/pip | pip/req/req_uninstall.py | Python | mit | 14,576 |
from __future__ import absolute_import
from sentry import tsdb, ratelimits
from sentry.api.serializers import serialize
from sentry.plugins.base import Plugin
from sentry.plugins.base.configuration import react_plugin_config
from sentry.plugins.status import PluginStatus
class DataForwardingPlugin(Plugin):
statu... | JackDanger/sentry | src/sentry/plugins/bases/data_forwarding.py | Python | bsd-3-clause | 1,548 |
# Copyright (c) 2012 Ian C. Good
#
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the "Software"), to deal
# in the Software without restriction, including without limitation the rights
# to use, copy, modify, merge, publish, distrib... | slimta/python-slimta | slimta/logging/http.py | Python | mit | 5,161 |
from django.db import models
from simple_history.models import HistoricalRecords
from django.core.exceptions import ValidationError
from adminsortable.models import SortableMixin
from academics.models import Enrollment, Grade
# Create your models here.
class Ethnicity(models.Model):
ethnicity = models.CharField(ma... | rectory-school/rectory-apps | seating_charts/models.py | Python | mit | 5,535 |
# -*- coding: utf-8 -*-
"""
A simple microservice framework for ZMQ Messaging.
"""
import weakref
import logging
import threading
import six
import binascii
import collections
import uuid
from ..exc import DispatcherError
from .protocol import ZMQCauldronErrorResponse
from .thread import ZMQThread, ZMQThreadError
FR... | alexrudy/Cauldron | Cauldron/zmq/microservice.py | Python | bsd-3-clause | 1,919 |
"""Manual plugin."""
import os
import logging
import pipes
import shutil
import signal
import subprocess
import sys
import tempfile
import time
import zope.component
import zope.interface
from acme import challenges
from letsencrypt import errors
from letsencrypt import interfaces
from letsencrypt.plugins import com... | solidgoldbomb/letsencrypt | letsencrypt/plugins/manual.py | Python | apache-2.0 | 7,692 |
# coding: utf-8
# (c) 2015-11-23 Teruhisa Okada
import netCDF4
import numpy as np
import matplotlib.pyplot as plt
import shutil
import os.path
import romspy
romspy.cmap('jet')
def get_vstd(ncfile_ens, ncfile_tru, N, vnames, plot=False):
ini = netCDF4.Dataset(ncfile_tru, 'r')
var = {}
for i in range(N):
... | okadate/romspy | romspy/make/make_std_file_ensemble.py | Python | mit | 2,618 |
# Copyright 2014 Hewlett-Packard Development Company, L.P
# 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.... | queria/my-tempest | tempest/api/identity/admin/v3/test_list_users.py | Python | apache-2.0 | 4,289 |
#!/usr/bin/env python
# Copyright (c) 2015, Robot Control and Pattern Recognition Group,
# Institute of Control and Computation Engineering
# Warsaw University of Technology
#
# All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the ... | dseredyn/velma_planners | scripts/collision_model.py | Python | gpl-2.0 | 5,365 |
"""
Copyright 2015 Rackspace
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
dist... | openstack/python-designateclient | designateclient/functionaltests/v2/test_recordsets.py | Python | apache-2.0 | 4,339 |
def getMinimumDifference(a, b):
ans = [-1] * max(len(a), len(b))
if not a or not b:
return ans
i = 0
for w1, w2 in zip(a, b):
if len(w1) != len(w2):
i += 1
continue
tmp = 0
lookup1, lookup2 = [0] * 26, [0] * 26
for char in w1:
l... | TanakritBenz/leetcode-adventure | min_diff_to_make_anagram.py | Python | gpl-2.0 | 557 |
# -*- coding: utf-8 -*-
"""Tests of Beautiful Soup as a whole."""
from pdb import set_trace
import logging
import unittest
import sys
import tempfile
from bs4 import (
BeautifulSoup,
BeautifulStoneSoup,
)
from bs4.element import (
CharsetMetaAttributeValue,
ContentMetaAttributeValue,
SoupStrainer,... | tedlaz/pyted | sms/bs4/tests/test_soup.py | Python | gpl-3.0 | 20,313 |
# -*- coding: utf-8 -*-
import json
import sys
import subprocess
TEMPLATE = """\
--pretty=format:'{"commit":"%H","author":"%an <%ae>","date":"%ad","message":"%B"},'
"""
class GitFrontend(object):
def __init__(self, git_path):
self.git_path = git_path
def get_rev_msg(self, rev, format):
cmd ... | transcode-de/bitbucket_issue_migration | gitlog2json.py | Python | gpl-3.0 | 2,279 |
#
# Gramps - a GTK+/GNOME based genealogy program
#
# Copyright (C) 2003-2006 Donald N. Allingham
# Copyright (C) 2009-2010 Gary Burton
# Copyright (C) 2010 Nick Hall
#
# 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
#... | Forage/Gramps | gramps/gui/selectors/selectplace.py | Python | gpl-2.0 | 2,617 |
import dj_database_url
from .common import *
DEBUG = True
db_from_env = dj_database_url.config(conn_max_age=500)
DATABASES['default'].update(db_from_env)
STATICFILES_STORAGE = 'whitenoise.django.GzipManifestStaticFilesStorage'
| shivamMg/malvo | malvo/settings/heroku.py | Python | gpl-3.0 | 231 |
import os
import base64
import requests
from urllib.parse import parse_qs
from flask import Flask, request, send_from_directory, redirect, render_template
from github import Github
from .add_files import add_files, make_file_contents
GITHUB_AUTH_URL = 'https://github.com/login/oauth/authorize'
GITHUB_TOKEN_URL = 'htt... | dotastro/hack-list-submission-app | hack_submission/webapp.py | Python | mit | 3,486 |
from django.contrib.staticfiles.testing import StaticLiveServerTestCase
from selenium import webdriver
import sys
class FunctionalTest(StaticLiveServerTestCase):
@classmethod
def setUpClass(cls): #1
for arg in sys.argv: #2
if 'liveserver' in arg: #3
cls.server_url = ... | gajimenezmaggiora/gus-django | functional_tests/base.py | Python | mit | 1,086 |
#!/usr/bin/env python
import sys, os
from datetime import datetime
import argparse
import config
haiti_tiles = [
"CA/n15w070",
"CA/n15w075"
]
haiti_seams = [
[
"AF/n15w071",
[-71, 15, -69, 20]
]
]
namibia_tiles = [
"AF/s20e015",
"AF/s20e020",
"AF/s20e025",
"AF/s25e015",
"AF/s25e020",
"AF/s25e025"
]
# Given... | vightel/FloodMapsWorkshop | python/hand_overlap.py | Python | apache-2.0 | 3,569 |
#!/usr/bin/python
import os,sys,time
ipaddr = "128.114."
x = 0
y = 0
for i in xrange(255,0,-1):
for j in xrange(255,1,-1):
print "scanning: " + ipaddr + str(x) + "." + str(y)
Z = "host " + ipaddr + str(x) + "." + str(y) + " >> hosts.txt"
os.system(Z)
y += 1
x+= 1
y = 1
| lthurlow/Network-Grapher | proj/st1_host.py | Python | mit | 295 |
# pylint: disable=R0903,W0232,missing-docstring, useless-object-inheritance
"""test detection of method which could be a function"""
from __future__ import print_function
class Toto(object):
"""bla bal abl"""
def __init__(self):
self.aaa = 2
def regular_method(self):
"""this method is a ... | kczapla/pylint | pylint/test/functional/no_self_use.py | Python | gpl-2.0 | 1,735 |
# -*- coding:utf-8 -*-
# Copyright (c) 2009-2016 - Simon Conseil
# Copyright (c) 2013 - Christophe-Marie Duquesne
# Copyright (c) 2014 - Jonas Kaufmann
# Copyright (c) 2015 - François D.
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated doc... | xouillet/sigal | sigal/gallery.py | Python | mit | 26,861 |
# from datetime import datetime
#
# def get_seconds():
# """Return current seconds"""
# return datetime.now().second
#
#
# get_seconds()
#
# print(get_seconds.__doc__)
# print(get_seconds.__name__)
#=========================================================
# def split_tags(tag_string):
# tag_list = []
# ... | Foxfanmedium/python_training | OnlineCoursera/mail_ru/Python_1/Week_2/7_functions.py | Python | apache-2.0 | 1,245 |
import sys
from setuptools import setup
options = dict(
name='igor',
version='1.1.1',
author='nvms',
packages=['igor'],
entry_points={
'console_scripts': [
'igor = igor.__main__:main'
]
},
classifiers=[
'Development Status :: 3 - Alpha'
]
)
setup(**... | nvms/igor | setup.py | Python | mit | 329 |
# Generated by the protocol buffer compiler. DO NOT EDIT!
# source: tensorflow/core/util/memmapped_file_system.proto
import sys
_b=sys.version_info[0]<3 and (lambda x:x) or (lambda x:x.encode('latin1'))
from google.protobuf import descriptor as _descriptor
from google.protobuf import message as _message
from google.p... | ryfeus/lambda-packs | Tensorflow_Pandas_Numpy/source3.6/tensorflow/core/util/memmapped_file_system_pb2.py | Python | mit | 4,351 |
#!/usr/bin/env python
import sys
import time
import logging
import websocket
import ujson as json
import set_path
from tilde.core.settings import settings
logging.basicConfig(level=logging.INFO)
START_TIME = time.time()
class RespHandler(object):
@classmethod
def on_open(self, ws):
logging.debug(... | tilde-lab/tilde | tests/berlinium/asleep_client.py | Python | mit | 1,445 |
"""
Scoring Metrics for KDD Cup 2012, Track 2
Reads in a solution/subission files
Scores on the following three metrics:
-NWMAE
-WRMSE
-AUC
Author: Ben Hamner (kdd2012@benhamner.com)
"""
def scoreElementwiseMetric(num_clicks, num_impressions, predicted_ctr, elementwise_metric):
"""
Calculates an elementwise... | naritta/hivemall | resources/examples/kddtrack2/scoreKDD.py | Python | apache-2.0 | 5,940 |
# Copyright 2015 The Tornado 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 applicable law or agreed to in w... | hhru/tornado | tornado/queues.py | Python | apache-2.0 | 10,980 |
#
# Copyright 2014 Red Hat
#
# 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... | Juniper/ceilometer | ceilometer/ipmi/notifications/ironic.py | Python | apache-2.0 | 5,705 |
#!/usr/bin/python
import os
from xml.sax.saxutils import escape
def read_file(filename):
with open(filename, "r") as f:
result = f.read()
return result
def build_template(src_template_path, build_script_path, dst_template_path):
print "Rebuilding %s" % dst_template_path
template = read_file(s... | DZamataev/TelegramAppKit | iOS-Universal-Framework/devel/build.py | Python | mit | 1,543 |
#!/usr/bin/env python
#
# Author: Mike McKerns (mmckerns @caltech and @uqfoundation)
# Copyright (c) 1997-2015 California Institute of Technology.
# License: 3-clause BSD. The full license text is available at:
# - http://trac.mystic.cacr.caltech.edu/project/mystic/browser/mystic/LICENSE
from __future__ import with_... | jcfr/mystic | setup.py | Python | bsd-3-clause | 12,858 |
# ===========================================================================
# eXe config
# Copyright 2004-2006, University of Auckland
#
# 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; e... | mclois/iteexe | exe/engine/standaloneconfig.py | Python | gpl-2.0 | 2,184 |
from qtpy.QtWidgets import QDialog
from qtpy import QtGui
from addie.utilities import load_ui
class SaveSqDialogMessageDialog(QDialog):
def __init__(self, main_window=None):
self.main_window = main_window
QDialog.__init__(self, parent=main_window)
self.ui = load_ui('save_sq_information_d... | neutrons/FastGR | addie/calculate_gr/save_sq_dialog_message.py | Python | mit | 504 |
import logging
import sys
import os
import unittest
class OsConfLoggingTest(unittest.TestCase):
def tearDown(self):
for key in os.environ.keys():
if key.startswith('SIPPERS_LOGGING'):
os.environ.pop(key)
def test_default_level_is_logging(self):
from sippers import ... | gisce/sippers | tests/tests_logging.py | Python | gpl-3.0 | 1,270 |
from flask_webapi import status
from unittest import TestCase
class TestStatus(TestCase):
def test_is_informational(self):
self.assertFalse(status.is_informational(99))
self.assertFalse(status.is_informational(200))
for i in range(100, 199):
self.assertTrue(status.is_informati... | viniciuschiele/flask-webapi | tests/test_status.py | Python | mit | 1,233 |
# -*- code: utf-8 -*-
from __future__ import unicode_literals
from . import index # noqa pyflakes:ignore
from . import channel # noqa pyflakes:ignore
from . import article # noqa pyflakes:ignore
from . import account # noqa pyflakes:ignore
__all__ = ['index', 'channel', 'article', 'account']
| qisanstudio/qsapp-riitc | src/riitc/views/__init__.py | Python | mit | 305 |
import os
import sys
import json
import socket
import logging
import traceback
from datetime import datetime
import amqp
import redis
from kuyruk import signals
CONFIG = {
"REDIS_HOST": "localhost",
"REDIS_PORT": 6379,
"REDIS_DB": 0,
"REDIS_PASSWORD": None,
}
REDIS_KEY = "failed_tasks"
logger = lo... | cenkalti/kuyruk-requeue | kuyruk_requeue.py | Python | mit | 3,030 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.