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 |
|---|---|---|---|---|---|---|
# coding: utf-8
"""
MailMojo API
v1 of the MailMojo API # noqa: E501
OpenAPI spec version: 1.1.0
Contact: hjelp@mailmojo.no
Generated by: https://github.com/swagger-api/swagger-codegen.git
"""
from __future__ import absolute_import
import unittest
import mailmojo_sdk
from mailmojo_sdk.api.pa... | eliksir/mailmojo-python-sdk | test/test_page_api.py | Python | apache-2.0 | 1,093 | 0 |
"""
Utilities and helper functions
"""
def get_object_or_none(model, **kwargs):
try:
return model.objects.get(**kwargs)
except model.DoesNotExist:
return None | chhantyal/exchange | uhura/exchange/utils.py | Python | bsd-3-clause | 183 | 0.010929 |
#!/usr/bin/env python
traindat = '../data/fm_train_real.dat'
testdat = '../data/fm_test_real.dat'
label_traindat = '../data/label_train_multiclass.dat'
parameter_list = [[traindat,testdat,label_traindat,2.1,1,1e-5],[traindat,testdat,label_traindat,2.2,1,1e-5]]
def classifier_gmnpsvm (train_fname=traindat,test_fname=t... | MikeLing/shogun | examples/undocumented/python/classifier_gmnpsvm.py | Python | gpl-3.0 | 912 | 0.046053 |
#
# 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... | dhuang/incubator-airflow | airflow/example_dags/test_utils.py | Python | apache-2.0 | 1,172 | 0 |
from couchpotato import get_session
from couchpotato.core.helpers.encoding import toUnicode
from couchpotato.core.logger import CPLog
from couchpotato.core.notifications.base import Notification
from couchpotato.core.settings.model import History as Hist
import time
log = CPLog(__name__)
class History(Notification):... | Akylas/CouchPotatoServer | couchpotato/core/notifications/history/main.py | Python | gpl-3.0 | 732 | 0.01776 |
"""
recursely
"""
__version__ = "0.1"
__description__ = "Recursive importer for Python submodules"
__author__ = "Karol Kuczmarski"
__license__ = "Simplified BSD"
import sys
from recursely._compat import IS_PY3
from recursely.importer import RecursiveImporter
from recursely.utils import SentinelList
__all__ = ['ins... | Xion/recursely | recursely/__init__.py | Python | bsd-2-clause | 1,663 | 0 |
import logging
import os
import shutil
import subprocess
from collections import namedtuple
from datetime import timedelta, datetime
from os import path
import tarfile
from urllib.error import HTTPError, URLError
from urllib.request import urlopen
from urllib.parse import urlparse
import json
import re
from errbot.p... | ESSS/err | errbot/repo_manager.py | Python | gpl-3.0 | 9,791 | 0.001634 |
#include header
def new_method(msg):
greeting(msg)
print(msg)
| lkouame/cs3240-labdemo | new.py | Python | mit | 71 | 0.014085 |
# -*- coding: utf-8 -*-
""" This file is part of OctoPNP
This is a test script to execute the imageprocessing-steps independent from the main software
and particularly without a running printer.
Main author: Florens Wasserfall <wasserfall@kalanka.de>
"""
import time
import ImageProcessing
im = ImagePro... | platsch/OctoPNP | octoprint_OctoPNP/ImageProcessingCaller.py | Python | agpl-3.0 | 974 | 0.004107 |
#!/usr/bin/python3
import random
import svgwrite
from svgwrite import rgb
def bkggen_square(name):
# image size
img_draw_sz = "6cm"
img_cell_count = 24
img_cell_sz = 5
img_gutter_sz = 1
colors = [rgb(col, col, col) for col in [246, 248, 250, 252, 255]]
dwg = svgwrite.Drawing(name, (img_draw_sz, img_draw_sz... | gauravmm/gauravmanek.com | generators/bkggen.py | Python | mit | 3,912 | 0.025562 |
#!/usr/bin/python -tt
import sys
import math
import time
from myPrint import *
from bzrc import BZRC, Command
###########################Potential Field Fun############################################
####################################################################
# Distance between two points.
##############... | chris-clm09/bzflag | bzagents/pfAgent.py | Python | gpl-3.0 | 14,123 | 0.004178 |
# -*- coding: utf-8 -*-
"""
Created on Thu Jul 21 16:48:46 2016
@author: huliqun
"""
import compileall
compileall.compile_dir('..') | LiqunHu/MVPN | complineProj.py | Python | gpl-3.0 | 143 | 0.006993 |
from django.conf.urls import url,include
from django.contrib import admin
urlpatterns = [
url(r'^',include('Register_and_login.urls')),
url(r'^homepage/',include('MainPage.urls')),
url(r'^username/cart/',include('cart.urls')),
url(r'^username/',include('customer.urls')),
url(r'^pharmacy_name/',incl... | mpiplani/Online-Pharmacy | online_pharmacy/online_pharmacy/urls.py | Python | apache-2.0 | 542 | 0.01476 |
with open('README.txt') as f:
long_description = f.read()
from distutils.core import setup
setup(
name = "nomit",
packages = ["nomit"],
version = "1.0",
description = "Process Monit HTTP/XML",
author = "Markus Juenemann",
author_email = "markus@juenemann.net",
url = "https://github.com... | mjuenema/nomit | setup.py | Python | bsd-2-clause | 902 | 0.02439 |
"""
mbed SDK
Copyright (c) 2011-2013 ARM Limited
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 wr... | pi19404/mbed | workspace_tools/export/gccarm.py | Python | apache-2.0 | 3,520 | 0 |
from polyphony import testbench
def g(x):
if x == 0:
return 0
return 1
def h(x):
if x == 0:
pass
def f(v, i, j, k):
if i == 0:
return v
elif i == 1:
return v
elif i == 2:
h(g(j) + g(k))
return v
elif i == 3:
for m in range(j):
... | ktok07b6/polyphony | tests/if/if28.py | Python | mit | 922 | 0 |
from django.conf import settings
from edc_constants.constants import MALE, FEMALE, OTHER, YES, NO, NOT_APPLICABLE
from edc_constants.constants import NEW, OPEN, CLOSED
class DashboardMiddleware:
def __init__(self, get_response):
self.get_response = get_response
def __call__(self, request):
tr... | botswana-harvard/edc-dashboard | edc_dashboard/middleware.py | Python | gpl-2.0 | 1,322 | 0.007564 |
import logging
from urllib.parse import urljoin
import lxml.etree # noqa: S410
import requests
from django.conf import settings as django_settings
from django.utils import timezone
logger = logging.getLogger(__name__)
class ClientError(Exception):
pass
class ResponseParseError(ClientError):
pass
class ... | opennode/nodeconductor-assembly-waldur | src/waldur_auth_valimo/client.py | Python | mit | 9,636 | 0.002283 |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
# @Author: Zeyuan Shang
# @Date: 2015-12-01 01:05:22
# @Last Modified by: Zeyuan Shang
# @Last Modified time: 2015-12-01 01:05:37
import heapq
class MedianFinder:
def __init__(self):
"""
Initialize your data structure here.
"""
self.... | EdisonAlgorithms/HackerRank | practice/data-structures/heap/find-median-1/find-median-1.py | Python | mit | 1,239 | 0.008071 |
import threading
import logging
import json
class EventHandler(threading.Thread):
log = logging.getLogger("events.EventHandler")
def __init__(self,event):
self.event=event.split(None)[0]
self.data = json.loads(event.lstrip(self.event).lstrip())
threading.Thread.__init__... | KuraudoTama/jenkins-events-handlers | event_handler.py | Python | apache-2.0 | 371 | 0.013477 |
# Copyright (c) 2017 Orange.
# 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 a... | stackforge/networking-bagpipe-l2 | networking_bagpipe/tests/unit/agent/sfc/test_agent_extension.py | Python | apache-2.0 | 54,420 | 0 |
import sys
from sqlblock.postgres.connection import AsyncPostgresSQL
def aiohttp_setup_sqlblock(app, conn: AsyncPostgresSQL):
async def startup(app):
await conn.__aenter__()
async def shutdown(app):
await conn.__aexit__(*sys.exc_info())
print('closed sqlblock')
app.on_startup.... | lcgong/sqlblock | sqlblock/setup.py | Python | mit | 372 | 0.002688 |
import numpy as np
import unittest
from caffe2.python import core, workspace, test_util
class TestToyRegression(test_util.TestCase):
def testToyRegression(self):
"""Tests a toy regression end to end.
The test code carries a simple toy regression in the form
y = 2.0 x1 + 1.5 x2 + 0.5
... | xzturn/caffe2 | caffe2/python/toy_regression_test.py | Python | apache-2.0 | 2,822 | 0 |
# vim: ft=python fileencoding=utf-8 sts=4 sw=4 et:
# Copyright 2015-2016 Florian Bruhin (The Compiler) <mail@qutebrowser.org>
#
# This file is part of qutebrowser.
#
# qutebrowser is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free S... | bcb/qutebrowser | tests/integration/features/test_tabs.py | Python | gpl-3.0 | 1,049 | 0 |
#!/usr/bin/env python
import re
import sys
from urllib import urlopen
def isup(domain):
resp = urlopen("http://www.isup.me/%s" % domain).read()
return "%s" % ("UP" if re.search("It's just you.", resp,
re.DOTALL) else "DOWN")
if __name__ == '__main__':
if len(sys.argv) > 1:
print "\n".jo... | BogdanWDK/ajaxbot | src/files/isup.py | Python | gpl-2.0 | 433 | 0.013857 |
# -*- encoding: utf-8 -*-
##############################################################################
#
# Copyright (C) 2014 Abstract
# (<http://abstract.it>).
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU Affero General Public License as publish... | abstract-open-solutions/l10n-italy | l10n_it_ateco/__openerp__.py | Python | agpl-3.0 | 1,563 | 0 |
#
# 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 u... | benguillet/wmr-frontend | lib/thrift/Thrift.py | Python | apache-2.0 | 3,530 | 0.027479 |
"""
Display all the icons available in :obj:`QtWidgets.QStyle.StandardPixmap` and in
the *standard* Windows DLL/EXE files.
"""
from msl.qt import (
QtWidgets,
QtCore,
application,
convert
)
try:
# check if pythonnet is installed
import clr
has_clr = True
except ImportError:
has_clr = Fa... | MSLNZ/msl-qt | msl/examples/qt/show_standard_icons.py | Python | mit | 5,135 | 0.000584 |
#!/usr/bin/env python
#
# Copyright 2014,2019 Free Software Foundation, Inc.
#
# This file is part of GNU Radio
#
# GNU Radio 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, or (at your optio... | awalls-cx18/gnuradio | gr-uhd/examples/python/freq_hopping.py | Python | gpl-3.0 | 9,480 | 0.001793 |
# Licensed to the StackStorm, Inc ('StackStorm') 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 th... | alfasin/st2 | st2actions/st2actions/utils/param_utils.py | Python | apache-2.0 | 14,817 | 0.002767 |
"""
Copyright 2013 Steven Diamond
This file is part of CVXPY.
CVXPY 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.
CVXPY is distributed i... | argriffing/cvxpy | cvxpy/atoms/norm1.py | Python | gpl-3.0 | 735 | 0 |
""" ImportedIds gathers identifiers imported by a node. """
from pythran.analyses.globals_analysis import Globals
from pythran.analyses.locals_analysis import Locals
from pythran.passmanager import NodeAnalysis
import pythran.metadata as md
import ast
class ImportedIds(NodeAnalysis):
"""Gather ids referenced b... | hainm/pythran | pythran/analyses/imported_ids.py | Python | bsd-3-clause | 2,844 | 0 |
'''
A Python Implementation of the Baffling Recursive Algorithm for Isotopic cluster distributioN
'''
import os
from .brainpy import (isotopic_variants, IsotopicDistribution, periodic_table,
max_variants, calculate_mass, neutral_mass, mass_charge_ratio,
PROTON, _has_c, Peak)... | mobiusklein/brainpy | brainpy/__init__.py | Python | apache-2.0 | 1,839 | 0.005982 |
from .base import ItemCollector
class BaseProbabilityCollector(ItemCollector):
# result_dependencies = (*CountCollector, *FrequencyCollector)
def __init__(self, previous_collector_set):
super().__init__(previous_collector_set)
self.__cached_result = None
def get_result(self, collector_set):
if self.__c... | davidfoerster/schema-matching | src/schema_matching/collector/probability.py | Python | mit | 748 | 0.032086 |
import numpy as np
#numpy is used for later classifiers
#Note: this is just a template with all required methods
#text is the text represented as a string
#textName is optional, indicate sthe name of the text, used for debug
#args are aditional arguments for the feature calculator
#debug indicates wheter to display deb... | darksteelcode/authorship | features/base.py | Python | gpl-3.0 | 1,482 | 0.006748 |
#!/usr/bin/env python
# Copyright 2013 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 ... | GoogleCloudPlatform/solutions-google-compute-engine-cluster-for-hadoop | sample/shortest-to-longest-reducer.py | Python | apache-2.0 | 2,023 | 0.007909 |
import json
from django.contrib.auth import get_backends
from django.contrib.auth.models import User, AnonymousUser
from django.core.urlresolvers import reverse
from django.test import TestCase
from django.test.client import Client
from geonode.contrib.groups.models import Group, GroupInvitation
from geonode.documents.... | mishravikas/geonode-cas | geonode/contrib/groups/tests.py | Python | gpl-3.0 | 15,540 | 0.00251 |
"""
Objects for datasets serialized in HDF5 format (.h5).
"""
__author__ = "Steven Kearnes"
__copyright__ = "Copyright 2014, Stanford University"
__license__ = "3-clause BSD"
try:
import h5py
except ImportError:
h5py = None
import numpy as np
from theano.compat.six.moves import xrange
import warnings
from py... | JazzeYoung/VeryDeepAutoEncoder | pylearn2/pylearn2/datasets/hdf5_deprecated.py | Python | bsd-3-clause | 13,414 | 0 |
# Copyright 2021 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-research/understanding-curricula | third_party/__init__.py | Python | apache-2.0 | 616 | 0.001623 |
#!/usr/bin/python
#
# This Source Code Form is subject to the terms of the Mozilla Public
# License, v. 2.0. If a copy of the MPL was not distributed with this
# file, You can obtain one at http://mozilla.org/MPL/2.0/.
"""
Runs the static rooting analysis
"""
from subprocess import Popen
import subprocess
import os
... | cstipkovic/spidermonkey-research | js/src/devtools/rootAnalysis/analyze.py | Python | mpl-2.0 | 10,455 | 0.003922 |
from XDSM import XDSM
opt = 'Optimization'
dat = 'DataInter'
mda = 'MDA'
anl = 'Analysis'
x = XDSM()
#x.addComp('driver', mda, 'Solver')
x.addComp('assembly inputs', anl, 'assembly inputs')
x.addComp('compress', anl, 'compress')
x.addComp('mission', anl, 'mission')
x.addComp('pod', anl, 'pod')
x.addComp('flow_limit',... | whiplash01/Hyperloop | docs/xdsm/hyperloop_xdsm.py | Python | apache-2.0 | 1,244 | 0.006431 |
from fnmatch import fnmatch
import os
from sys import exit
import html2text
import re
import urllib
import shutil
import logging
import sqlite3
from sys import stdout
logging.basicConfig(filename='error_log.log', filemode='a')
class BackupEvernote(object):
def __init__(self, evernote_dir, db_dir='', output_dir... | shawndaniel/evernote-exporter | evernote_exporter.py | Python | gpl-3.0 | 10,506 | 0.001523 |
#!/usr/bin/env python
# Taken and modified from:
# http://www.jejik.com/articles/2007/02/a_simple_unix_linux_daemon_in_python/
import atexit
import os
import signal
import sys
import time
if (hasattr(os, "devnull")):
DEVNULL = os.devnull
else:
DEVNULL = "/dev/null"
class Daemon(object):
"""
A gene... | Nvizible/shotgunEvents | src/daemonizer.py | Python | mit | 5,101 | 0.006077 |
import logging
from pyvisdk.exceptions import InvalidArgumentError
########################################
# Automatically generated, do not edit.
########################################
log = logging.getLogger(__name__)
def ExtendedElementDescription(vim, *args, **kwargs):
''''''
obj = vim.client.fa... | xuru/pyvisdk | pyvisdk/do/extended_element_description.py | Python | mit | 1,021 | 0.008815 |
days = "Mon Tue Wed Thu Fri Sat Sun"
months = "Jan\nFeb\nMar\nApr\n...\nSpe\nNov\nDec"
print "Here are the days:", days
print "Here are the months:", months
print "Months: %r" % months # raw printing retains special characters
print '''
There's something going on here
with the three double quotes
We'll be able to t... | aurelo/lphw | source/ex9.py | Python | mit | 413 | 0 |
# coding=utf-8
#
# This Source Code Form is subject to the terms of the Mozilla Public
# License, v. 2.0. If a copy of the MPL was not distributed with this
# file, You can obtain one at https://mozilla.org/MPL/2.0/.
"""Run a subprocess with timeout
"""
import argparse
import collections
import platform
import signal
... | nth10sd/lithium | src/lithium/interestingness/timed_run.py | Python | mpl-2.0 | 5,962 | 0.000335 |
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.apps.registry import Apps, apps
from django.contrib.contenttypes.fields import (
GenericForeignKey, GenericRelation
)
from django.contrib.contenttypes import management
from django.contrib.contenttypes.models import ContentType
from django... | doismellburning/django | tests/contenttypes_tests/tests.py | Python | bsd-3-clause | 16,513 | 0.001635 |
# Copyright (c) 2010-2017 openpyxl
| 171121130/SWI | venv/Lib/site-packages/openpyxl/reader/__init__.py | Python | mit | 35 | 0 |
# -*- coding: utf-8 -*-
# Unit tests for cache framework
# Uses whatever cache backend is set in the test settings file.
import time
import unittest
from django.core.cache import cache
from django.utils.cache import patch_vary_headers
from django.http import HttpResponse
# functions/classes for complex data type tes... | paulsmith/geodjango | tests/regressiontests/cache/tests.py | Python | bsd-3-clause | 5,938 | 0.007943 |
#------------------------------------------------------------
# -*- coding: utf-8 -*-
#------------------------------------------------------------
# Download Tools
# Based on the code from VideoMonkey XBMC Plugin
#------------------------------------------------------------
# pelisalacarta
# http://blog.tvalacarta.in... | golaizola/pelisalacarta-xbmc | core/scrapertools.py | Python | gpl-3.0 | 52,267 | 0.011898 |
import os
import unittest
from conans.util.files import mkdir_tmp
from conans import __version__ as client_version
from conans import tools
from conans.client.conan_api import ConanAPIV1
from cpt.test.utils.tools import TestBufferConanOutput
CONAN_UPLOAD_URL = os.getenv("CONAN_UPLOAD_URL",
... | conan-io/conan-package-tools | cpt/test/integration/base.py | Python | mit | 1,994 | 0.001003 |
# -*- coding: utf-8 -*-
#main sirbot script
ON = 1
SPLASH = 1
##try:
import lib.sirbot.initialize as initialize
if(SPLASH == 1):
#display splash
splash = initialize.splashing()
root = splash.root()
#import configurations
from lib.sirbot.configloader import configloader
config = configloader()
#import ... | SirRujak/SirBot | dev/TOPSECRET/SirBot/SirBot.py | Python | mit | 1,743 | 0.018933 |
from pathlib import Path
from typing import Tuple, Dict, Optional, List, Union
from uuid import UUID
import affine
import attr
from ruamel.yaml.comments import CommentedMap
from shapely.geometry.base import BaseGeometry
from eodatasets3.properties import Eo3Dict, Eo3Interface
DEA_URI_PREFIX = "https://collections.de... | GeoscienceAustralia/eo-datasets | eodatasets3/model.py | Python | apache-2.0 | 3,589 | 0.001115 |
# Runtime labels
from .namespace import NAMESPACE
class DataRestoreLabels:
READ = f"{NAMESPACE}.__READ"
RESTORE = f"{NAMESPACE}.__RESTORE"
REQUIRED_MODULES = {
DataRestoreLabels.READ: "read_restore.asm",
DataRestoreLabels.RESTORE: "read_restore.asm",
}
| boriel/zxbasic | src/arch/z80/backend/runtime/datarestore.py | Python | gpl-3.0 | 274 | 0 |
#
# Copyright © 2012–2022 Michal Čihař <michal@cihar.com>
#
# This file is part of Weblate <https://weblate.org/>
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the Licens... | nijel/weblate | weblate/utils/requests.py | Python | gpl-3.0 | 2,265 | 0 |
from django.contrib.contenttypes.fields import GenericForeignKey
from django.contrib.contenttypes.models import ContentType
from django.db import models
from model_utils import Choices
from model_utils.models import TimeStampedModel
class History(TimeStampedModel):
RESOLUTIONS = Choices('second', 'minute', 'hour... | hello-base/web | apps/history/models.py | Python | apache-2.0 | 1,311 | 0.001526 |
'''
Vidhog urlresolver plugin
Copyright (C) 2013 Vinnydude
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
This program is dis... | SMALLplayer/smallplayer-image-creator | storage/.xbmc/addons/script.module.urlresolver/lib/urlresolver/plugins/vidhog.py | Python | gpl-2.0 | 4,269 | 0.008433 |
# Copyright 2014 Netflix, Inc.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law... | vijaykumar0690/security_monkey | security_monkey/watchers/security_group.py | Python | apache-2.0 | 8,192 | 0.001831 |
'''
This module contains calculator to calculate the increased percentage
'''
import json
import datetime
import pytz
import zq_gen.str as zq_str
import zq_db.mongodb as zq_mgdb
key_err_msg = 'Missing parameter in command string'
val_err_msg = 'Error in parsing the command string'
no_rcrd_msg = 'No records in specifi... | feng-zhe/ZheQuant-brain-python | zq_calc/inc_pct.py | Python | apache-2.0 | 2,959 | 0.005069 |
"""Definitions for output formats."""
import collections
from enum import Enum, unique
__copyright__ = 'Copyright 2021, 3Liz'
__license__ = 'GPL version 3'
__email__ = 'info@3liz.org'
format_output = collections.namedtuple('format', ['label', 'driver_name', 'extension'])
@unique
class Format(Enum):
""" Name o... | 3liz/QgisQuickOSMPlugin | QuickOSM/definitions/format.py | Python | gpl-2.0 | 657 | 0.001522 |
# @author: Milinda Fernando
# School of Computing, University of Utah.
# generate all the slurm jobs for the sc16 poster, energy measurements,
import argparse
if __name__ == "__main__":
parser = argparse.ArgumentParser(prog='slurm_pbs')
parser.add_argument('-n','--npes', help=' number of mpi tasks')
parser.add_ar... | paralab/Dendro4 | slurm/slurm_pbs.py | Python | gpl-2.0 | 2,491 | 0.028904 |
## This file is part of Scapy
## Copyright (C) 2007, 2008, 2009 Arnaud Ebalard
## 2015, 2016, 2017 Maxence Tury
## This program is published under a GPLv2 license
"""
TLS server automaton. This makes for a primitive TLS stack.
Obviously you need rights for network access.
We support versions SSLv2 to TL... | CodeNameGhost/shiva | thirdparty/scapy/layers/tls/automaton_srv.py | Python | mit | 30,139 | 0.001161 |
# -*- coding: utf-8 -*-
"""
OnionShare | https://onionshare.org/
Copyright (C) 2017 Micah Lee <micah@micahflee.com>
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, o... | lazlolazlolazlo/onionshare | onionshare/settings.py | Python | gpl-3.0 | 4,545 | 0.00176 |
# pylint: disable=preferred-module # FIXME: remove once migrated per GH-725
import unittest
from ansiblelint.rules import RulesCollection
from ansiblelint.rules.MetaChangeFromDefaultRule import MetaChangeFromDefaultRule
from ansiblelint.testing import RunFromText
DEFAULT_GALAXY_INFO = '''
galaxy_info:
author: your... | willthames/ansible-lint | test/TestMetaChangeFromDefault.py | Python | mit | 1,169 | 0.000855 |
#!/usr/bin/env python3
# Copyright (c) 2015-2018 The Bitcoin Core developers
# Distributed under the MIT software license, see the accompanying
# file COPYING or http://www.opensource.org/licenses/mit-license.php.
"""Test behavior of -maxuploadtarget.
* Verify that getdata requests for old blocks (>1week) are dropped
... | nlgcoin/guldencoin-official | test/functional/feature_maxuploadtarget.py | Python | mit | 6,606 | 0.001968 |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
from turnstile.checks import get_checks
from turnstile.manager import get_commands
CORE_COMMIT_MSG_CHECKS = ['branch_pattern', 'branch_release', 'branch_type', 'protect_master', 'specification']
CORE_SUBCOMMANDS = ['config', 'install', 'remove', 'specification', 'upgrade'... | zalando/turnstile | tests/test_discovery.py | Python | apache-2.0 | 636 | 0.003145 |
# Copyright (C) 2010 Google Inc. All rights reserved.
# Copyright (C) 2010 Gabor Rapcsanyi (rgabor@inf.u-szeged.hu), University of Szeged
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions are
# met:
#
# * Redistributions of so... | chromium/chromium | third_party/blink/tools/blinkpy/web_tests/controllers/manager_unittest.py | Python | bsd-3-clause | 10,253 | 0.001073 |
# -*- coding: utf-8 -*-
from django.contrib import admin
from metadata.models import Metadata
from django.http import HttpResponseRedirect
class MetadataAdmin(admin.ModelAdmin):
def response_change(self, request, obj):
return HttpResponseRedirect("/")
## redirect til frontpage efter add
def respon... | rastermanden/metadata_example | meta/metadata/admin.py | Python | mit | 1,394 | 0.017279 |
# sudo apt install python-lxml,python-requests
from lxml import html
import requests
urlPrefix = 'https://book.douban.com/subject/'
candidateBookNums = []
candidateBookNums.append('3633461')
selectedBooks = {}
# i = 1
while candidateBookNums:
bookNum = candidateBookNums.pop(0)
bookUrl = urlPrefix + str(bookNum)
... | frank-cq/Toys | searchBook.py | Python | apache-2.0 | 1,673 | 0.039624 |
# -*- coding: utf-8 -*-
# vi:si:et:sw=4:sts=4:ts=4
##
## Copyright (C) 2007 Async Open Source <http://www.async.com.br>
## All rights reserved
##
## 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 F... | andrebellafronte/stoq | stoqlib/domain/transfer.py | Python | gpl-2.0 | 15,361 | 0.001172 |
# Copyright 2013 Mellanox Technologies, Ltd
#
# 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 t... | samsu/neutron | plugins/mlnx/common/constants.py | Python | apache-2.0 | 784 | 0 |
#!/usr/bin/python
#
# Server that will accept connections from a Vim channel.
# Run this server and then in Vim you can open the channel:
# :let handle = ch_open('localhost:8765')
#
# Then Vim can send requests to the server:
# :let response = ch_sendexpr(handle, 'hello!')
#
# And you can control Vim by typing a JSON... | kostyakudinov/Prog | usr/share/vim/vim74/tools/demoserver.py | Python | gpl-2.0 | 3,102 | 0.000967 |
"""passlib.handlers.sun_md5_crypt - Sun's Md5 Crypt, used on Solaris
.. warning::
This implementation may not reproduce
the original Solaris behavior in some border cases.
See documentation for details.
"""
#=============================================================================
# imports... | Glottotopia/aagd | moin/local/moin/build/lib.linux-x86_64-2.6/MoinMoin/support/passlib/handlers/sun_md5_crypt.py | Python | mit | 14,328 | 0.006421 |
# Copyright 2013 Rackspace Hosting
# 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 require... | plumgrid/plumgrid-nova | nova/tests/api/openstack/compute/plugins/v3/test_instance_actions.py | Python | apache-2.0 | 12,710 | 0.000393 |
"""
This module creates a sysadmin dashboard for managing and viewing
courses.
"""
import csv
import json
import logging
import os
import subprocess
import time
import StringIO
from django.conf import settings
from django.contrib.auth import authenticate
from django.contrib.auth.decorators import login_required
from d... | jswope00/GAI | lms/djangoapps/dashboard/sysadmin.py | Python | agpl-3.0 | 27,630 | 0.00076 |
'''
Network related functionality like bridge and netfilter setup
'''
import itertools
import logging
import re
import time
import iptc
import locker
import netaddr
import pyroute2
from locker.util import regex_ip
class BridgeUnavailable(Exception):
''' Bridge device does not exist
Raised if the project sp... | run2fail/locker | locker/network.py | Python | gpl-3.0 | 16,640 | 0.001563 |
#!/usr/bin/env python3
# ***** BEGIN GPL LICENSE BLOCK *****
#
# This program is free software; you can redistribute it and/or
# modify it under the terms of the GNU General Public License
# as published by the Free Software Foundation; either version 2
# of the License, or (at your option) any later version.
#
# This... | Passtechsoft/TPEAlpGen | blender/doc/blender_file_format/BlendFileDnaExporter_25.py | Python | gpl-3.0 | 15,484 | 0.01001 |
from nose.tools import eq_
from ..detector import Detector
def test_detector():
detector = Detector(2)
eq_(detector.process("a", {'id': 1}), None)
# Check noop
eq_(detector.process("a", {'id': 2}), None)
# Short revert
eq_(detector.process("b", {'id': 3}), None)
eq_(
detector.p... | mediawiki-utilities/python-mwreverts | mwreverts/tests/test_detector.py | Python | mit | 849 | 0 |
"""
metakit.py -- Utility code for the Python interface to Metakit
$Id: metakit.py 1669 2007-06-16 00:23:25Z jcw $
This is part of Metakit, see http://www.equi4.com/metakit.html
This wraps the raw Mk4py compiled extension interface.
To use Metakit through this interface, simply do:
import metakit
After that, things ... | electric-cloud/metakit | python/metakit.py | Python | mit | 2,471 | 0.017402 |
from .m1 import f
from p1.m1 import f
from m1 import f
from a import g
<warning descr="Unused import statement 'from a import h'">from a import h</warning>
__all__ = ['f', 'g']
| jwren/intellij-community | python/testData/inspections/PyUnresolvedReferencesInspection/UnusedImportsInPackage/p1/__init__.py | Python | apache-2.0 | 178 | 0.02809 |
import random
from .tiles import base
INITIAL_TILES = [
base.ASSASSIN, base.BOWMAN, base.CHAMPION, base.DRAGOON, base.FOOTMAN,
base.GENERAL, base.KNIGHT, base.LONGBOWMAN, base.MARSHALL, base.PIKEMAN,
base.PIKEMAN, base.PRIEST, base.RANGER, base.SEER, base.WIZARD,
]
class Game(object):
def __init__(... | rorytrent/the-duke | duke/game.py | Python | gpl-3.0 | 499 | 0 |
# coding: utf-8
from websocket import create_connection
def ws_handler():
ws = create_connection("ws://localhost:8000/echo")
try:
# ws.send("Hello, world")
while 1:
result = ws.recv()
print(result)
except:
pass
finally:
ws.close()
# with crea... | fpagyu/glory | pi/client.py | Python | mit | 500 | 0.006 |
# -*- coding: utf-8 -*-
"""Unit tests for the Web Service client."""
import base64
import datetime
import json
import unittest
from mock import patch, MagicMock
from requests.exceptions import ConnectionError
from genweb.serveistic.ws_client.problems import (
Client, ClientException, Problem)
class TestWSClie... | UPCnet/genweb.serveistic | genweb/serveistic/tests/test_ws_client_problems.py | Python | gpl-3.0 | 10,661 | 0.000188 |
"""
Django ID mapper
Modified for Evennia by making sure that no model references
leave caching unexpectedly (no use if WeakRefs).
Also adds cache_size() for monitoring the size of the cache.
"""
import os, threading
#from twisted.internet import reactor
#from twisted.internet.threads import blockingCallFromThread
f... | tectronics/evennia | src/utils/idmapper/base.py | Python | bsd-3-clause | 19,327 | 0.00564 |
#
# Copyright 2008-2011 Red Hat, Inc.
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 2 of the License, or
# (at your option) any later version.
#
# This program is distributed ... | futurice/vdsm | vdsm/kaxmlrpclib.py | Python | gpl-2.0 | 5,941 | 0.000842 |
import json
import os, sys, traceback
script_dir = os.path.dirname(__file__)
config_file = os.path.join(script_dir, './config/application.json')
defaults = os.path.join(script_dir, './config/reference.json')
def loadConfig(f):
print "[INFO] Loading configuration from " + f + "..."
with open(f, 'r') as opened:... | Xarxa6/hackathon | src/config.py | Python | mit | 1,937 | 0.009809 |
import json
import pytest
from plugins.fishbans import fishbans, bancount
from cloudbot import http
test_user = "notch"
test_api = """
{"success":true,"stats":{"username":"notch","uuid":"069a79f444e94726a5befca90e38aaf5","totalbans":11,"service":{"mcbans":0,"mcbouncer":11,"mcblockit":0,"minebans":0,"glizer":0}}}
"""... | Zarthus/CloudBotRefresh | plugins/test/test_fishbans.py | Python | gpl-3.0 | 3,502 | 0.001428 |
from flask_restful import Api
from . import api_blueprint
from ..api_1_0.resources.users import UserAPI, UserListAPI
from ..api_1_0.resources.authentication import (TokenRefresh, UserLogin,
UserLogoutAccess, UserLogoutRefresh)
from ..api_1_0.resources.machines import MachineAPI, MachineListAPI, \
UserMachineLis... | rivalrockets/rivalrockets-api | app/api_1_0/app.py | Python | mit | 3,161 | 0.000633 |
# -*- encoding: utf-8 -*-
import io
from bs4 import BeautifulSoup
from bs4 import SoupStrainer
import urllib2
import urlparse
from selenium import webdriver
from selenium.webdriver.common.keys import Keys
import time
from selenium.webdriver.support.ui import WebDriverWait
from selenium.webdriver.support import expecte... | hoaibang07/Webscrap | transcripture/sources/crawler_chuongthieu.py | Python | gpl-2.0 | 7,017 | 0.007981 |
import uuid
import pytest
from kazoo.testing import KazooTestCase
from kazoo.tests.util import CI_ZK_VERSION
class KazooQueueTests(KazooTestCase):
def _makeOne(self):
path = "/" + uuid.uuid4().hex
return self.client.Queue(path)
def test_queue_validation(self):
queue = self._makeOne(... | python-zk/kazoo | kazoo/tests/test_queue.py | Python | apache-2.0 | 6,221 | 0 |
class Base(object):
def test(self):
print("----Base")
class A(Base):
def test1(self):
print("-----test1")
class B(Base):
def test2(self):
print("-----test2")
class C(A,B):
pass
c = C()
c.test1()
c.test2()
c.test()
| jameswatt2008/jameswatt2008.github.io | python/Python基础/截图和代码/面对对象-2/10-多继承.py | Python | gpl-2.0 | 259 | 0.015444 |
# coding: utf-8
"""
KubeVirt API
This is KubeVirt API an add-on for Kubernetes.
OpenAPI spec version: 1.0.0
Contact: kubevirt-dev@googlegroups.com
Generated by: https://github.com/swagger-api/swagger-codegen.git
"""
from pprint import pformat
from six import iteritems
import re
class K8sIoApi... | kubevirt/client-python | kubevirt/models/k8s_io_apimachinery_pkg_apis_meta_v1_root_paths.py | Python | apache-2.0 | 3,286 | 0.000609 |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
###############################################################################
# Copyright 2016 Kitware 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 cop... | sutartmelson/girder | tests/cases/routetable_test.py | Python | apache-2.0 | 6,390 | 0.002034 |
########################################################################
# File : Optimizer.py
# Author : Stuart Paterson
########################################################################
"""
The Optimizer base class is an agent that polls for jobs with a specific
status and minor status pair. The checkJo... | petricm/DIRAC | WorkloadManagementSystem/Agent/OptimizerModule.py | Python | gpl-3.0 | 11,859 | 0.007589 |
#!/usr/bin/env python2.4
#
# Copyright 2007 Google Inc. All Rights Reserved.
import BaseHTTPServer
import SimpleHTTPServer
import urllib
import random
import sys
import datetime
class MyHandler(SimpleHTTPServer.SimpleHTTPRequestHandler):
def do_GET(self):
form = {}
now = datetime.datetime.now()
lognam... | maligulzar/Rstudio-instrumented | logserver/server.py | Python | agpl-3.0 | 793 | 0.020177 |
# Generated by Django 2.2.10 on 2020-04-27 12:23
from django.db import migrations, models
import django.db.models.deletion
class Migration(migrations.Migration):
dependencies = [
("common", "0021_document_company"),
("tasks", "0004_task_teams"),
]
operations = [
migrations.AddFi... | MicroPyramid/Django-CRM | tasks/migrations/0005_task_company.py | Python | mit | 607 | 0 |
from test_support import *
prove_all ()
| ptroja/spark2014 | testsuite/gnatprove/tests/riposte__usergroup_examples/test.py | Python | gpl-3.0 | 41 | 0.02439 |
from leapp.topics import Topic
class ApiTestTopic(Topic):
name = 'api_test'
| leapp-to/prototype | tests/data/actor-api-tests/topics/apitest.py | Python | lgpl-2.1 | 82 | 0 |
# Copyright 2020 DeepMind Technologies Limited.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or ag... | deepmind/dm_robotics | py/agentflow/subtasks/integration_test.py | Python | apache-2.0 | 12,432 | 0.002252 |
from AccessControl import ClassSecurityInfo
from archetypes.querywidget.views import WidgetTraverse as _WidgetTraverse
from archetypes.querywidget.widget import QueryWidget as _QueryWidget
from bika.lims.querystring.querybuilder import QueryBuilder
from bika.lims.querystring.querybuilder import RegistryConfiguration
fr... | anneline/Bika-LIMS | bika/lims/browser/widgets/querywidget.py | Python | agpl-3.0 | 5,599 | 0.000714 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.