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 |
|---|---|---|---|---|---|---|
import sys
from services.spawn import MobileTemplate
from services.spawn import WeaponTemplate
from resources.datatables import WeaponType
from resources.datatables import Difficulty
from resources.datatables import Options
from resources.datatables import FactionStatus
from java.util import Vector
def addTemplate(cor... | ProjectSWGCore/NGECore2 | scripts/mobiles/generic/faction/rebel/battle_droid_rebel.py | Python | lgpl-3.0 | 1,397 | 0.029349 |
# (c) 2012-2014, Michael DeHaan <michael.dehaan@gmail.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 License, or
# (at your option) an... | muravjov/ansible | lib/ansible/utils/__init__.py | Python | gpl-3.0 | 60,718 | 0.004957 |
"""
Taiga integration for Zulip.
Tips for notification output:
*Emojis*: most of the events have specific emojis e.g.
- :notebook: - change of subject/name/description
- :chart_with_upwards_trend: - change of status
etc. If no there's no meaningful emoji for certain event, the defaults are used:
- :thought_balloon: -... | Diptanshu8/zulip | zerver/views/webhooks/taiga.py | Python | apache-2.0 | 11,660 | 0.00446 |
from __future__ import absolute_import
from __future__ import unicode_literals
NAMES = [
'grey',
'red',
'green',
'yellow',
'blue',
'magenta',
'cyan',
'white'
]
def get_pairs():
for i, name in enumerate(NAMES):
yield(name, str(30 + i))
yield('intense_' + name, str(30... | rht/universe | universe/remotes/compose/colors.py | Python | mit | 860 | 0 |
""" IO classes for Omnivor input file
Copyright (C) 2013 DTU Wind Energy
Author: Emmanuel Branlard
Email: ebra@dtu.dk
Last revision: 25/11/2013
Namelist IO: badis functions to read and parse a fortran file into python dictonary and write it back to a file
The parser was adapted from: fortran-namelist on code.google... | DTUWindEnergy/Python4WindEnergy | py4we/fortran_namelist_io.py | Python | apache-2.0 | 8,294 | 0.01278 |
"""Test the National Weather Service (NWS) config flow."""
from unittest.mock import patch
import aiohttp
from homeassistant import config_entries
from homeassistant.components.nws.const import DOMAIN
async def test_form(hass, mock_simple_nws_config):
"""Test we get the form."""
hass.config.latitude = 35
... | jawilson/home-assistant | tests/components/nws/test_config_flow.py | Python | apache-2.0 | 3,482 | 0 |
def f(x=2):
return x
lis = [1]
dic = {
"x": 2
}
f(1) # call_function
f(*lis) # call_function_var
f(**dic) # call_function_kw
f(*[], **dic) # call_function_var_kw
class C(object): # call_function
def __enter__(self):
x = 1
return x
def __exit__(self, *args, **kwargs):
... | gems-uff/noworkflow | tests/test_disasm.py | Python | mit | 831 | 0.002407 |
# -------------------------------------------------------------
#
# 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 unde... | apache/incubator-systemml | src/main/python/systemds/operator/algorithm/builtin/getAccuracy.py | Python | apache-2.0 | 1,549 | 0.002582 |
"""Provides some useful utilities for the Discord bot, mostly to do with cleaning."""
import re
import discord
__all__ = ['clean', 'is_clean']
mass_mention = re.compile('@(everyone|here)')
member_mention = re.compile(r'<@\!?(\d+)>')
role_mention = re.compile(r'<@&(\d+)>')
channel_mention = re.compile(r'<#(\d+)>')
... | guineawheek/Dozer | dozer/utils.py | Python | gpl-3.0 | 2,868 | 0.003138 |
from lib.base import BaseJiraAction
__all__ = [
'TransitionJiraIssueAction'
]
class TransitionJiraIssueAction(BaseJiraAction):
def run(self, issue_key, transition):
result = self._client.transition_issue(issue_key, transition)
return result
| armab/st2contrib | packs/jira/actions/transition_issue.py | Python | apache-2.0 | 269 | 0 |
## Need to find a library | jacksarick/My-Code | Python/python challenges/euler/017_number_letter_counts.py | Python | mit | 25 | 0.08 |
# Copyright (c) 2007, Simon Edwards <simon@simonzone.com>
# Copyright (c) 2014, Raphael Kubo da Costa <rakuco@FreeBSD.org>
# Redistribution and use is allowed according to the terms of the BSD license.
# For details see the accompanying COPYING-CMAKE-SCRIPTS file.
import PyQt4.QtCore
import os
import sys
def get_defa... | melvyn-sopacua/kdelibs | cmake/modules/FindPyQt.py | Python | gpl-2.0 | 1,768 | 0.001697 |
from collections import Iterable
from copy import deepcopy
from numbers import Real, Integral
import warnings
from xml.etree import ElementTree as ET
import sys
if sys.version_info[0] >= 3:
basestring = str
import openmc
from openmc.checkvalue import check_type, check_value, check_greater_than
from openmc.clean_xm... | lilulu/openmc | openmc/material.py | Python | mit | 18,937 | 0.000422 |
# Copyright (c) 2015, Facebook, Inc.
# All rights reserved.
#
# This source code is licensed under the BSD-style license found in the
# LICENSE file in the root directory of this source tree. An additional grant
# of patent rights can be found in the PATENTS file in the same directory.
from __future__ import absolute_... | tempbottle/mcrouter | mcrouter/test/test_mcrouter.py | Python | bsd-3-clause | 13,301 | 0.001579 |
# Opus/UrbanSim urban simulation software.
# Copyright (C) 2005-2009 University of Washington
# See opus_core/LICENSE
from urbansim.configs.base_configuration import AbstractUrbansimConfiguration
from opus_core.resources import merge_resources_if_not_None
import copy
"""this configuration file specifying work... | christianurich/VIBe2UrbanSim | 3rdparty/opus/src/psrc/config/workplace_zone_choice_model_config.py | Python | gpl-2.0 | 13,587 | 0.011261 |
############################################################################
# Copyright (C) Internet Systems Consortium, Inc. ("ISC")
#
# 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://mozil... | perlang/bv9arm-chinese | branches/9.16.18/arm/conf.py | Python | mpl-2.0 | 5,717 | 0.000352 |
from RGT.XML.SVG.basicSvgNode import BasicSvgNode
from RGT.XML.SVG.Attribs.conditionalProcessingAttributes import ConditionalProcessingAttributes
from RGT.XML.SVG.Attribs.xlinkAttributes import XlinkAttributes
from RGT.XML.SVG.Attribs.animationTimingAttributes import AnimationTimingAttributes
class BaseAnimatio... | danrg/RGT-tool | src/RGT/XML/SVG/Animation/baseAnimationNode.py | Python | mit | 1,499 | 0.004003 |
# -*- coding: utf-8 -*-
"""
Created on Fri Dec 11 11:34:27 2015
@author: JonasAdler
"""
# Imports for common Python 2/3 codebase
from __future__ import print_function, division, absolute_import
from future import standard_library
standard_library.install_aliases()
# External
import numpy as np
# Internal
import odl... | odlgroup/odl-examples | tomography_wavelet_split_bregman.py | Python | gpl-3.0 | 2,070 | 0.002415 |
import re
class CommandError(Exception):
pass
class BaseCommand():
"""
Base command, this will accept and handle some generic features of all commands.
Like error handling, argument retrieving / checking
"""
def __init__(self, args):
"""
Initialize the class
"""
... | snelis/snelis | snelis/management/commands/__init__.py | Python | bsd-3-clause | 1,601 | 0.001874 |
"""
Configuration for a project.
"""
rails = {
'models.engine': 'sqlalchemy',
'models.db.type': 'postgres',
'models.db.user': 'rails',
'models.db.password': 'rails',
'views.engine': 'jinja',
}
| PythonRails/examples | blog/config.py | Python | mit | 218 | 0 |
import sys
from contextlib import contextmanager
from StringIO import StringIO
@contextmanager
def string_stdout():
output = StringIO()
sys.stdout = output
yield output
sys.stdout = sys.__stdout__
| jklaiho/django-class-fixtures | class_fixtures/utils/__init__.py | Python | bsd-3-clause | 214 | 0.004673 |
##########################################################################
#This file is part of WTFramework.
#
# WTFramework 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 L... | LeXuZZ/localway_tests | wtframework/wtf/tests/test_config_reader.py | Python | gpl-3.0 | 3,596 | 0.003337 |
# -*- coding: utf-8 -*-
import os.path
import wx
from outwiker.core.system import getImagesDir
class SearchReplacePanel (wx.Panel):
def __init__(self, parent):
super(SearchReplacePanel, self).__init__(
parent,
style=wx.TAB_TRAVERSAL | wx.RAISED_BORDER)
self._controller =... | unreal666/outwiker | src/outwiker/gui/searchreplacepanel.py | Python | gpl-3.0 | 6,309 | 0 |
"""
Contains methods for working with the Lakeshore 475 Gaussmeter
"""
from quantities import Quantity
from typing import Optional
from instruments.lakeshore import Lakeshore475 as _Lakeshore475
from time import sleep
class Lakeshore475(object):
"""
Adapter layer for IK's Lakeshore 475 implementation
"""
... | MichalKononenko/MrFreeze | mr_freeze/devices/lakeshore_475.py | Python | agpl-3.0 | 2,013 | 0.000497 |
../../../../../../../share/pyshared/orca/scripts/apps/packagemanager/script_settings.py | Alberto-Beralix/Beralix | i386-squashfs-root/usr/lib/python2.7/dist-packages/orca/scripts/apps/packagemanager/script_settings.py | Python | gpl-3.0 | 87 | 0.022989 |
# -*- 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-compute | google/cloud/compute_v1/services/target_tcp_proxies/client.py | Python | apache-2.0 | 42,291 | 0.001537 |
import concurrent.futures
import secrets
from enum import Enum
from ipaddress import ip_address
from typing import Tuple, Set, Dict, Callable
from urllib import parse
import pytz
import urllib3
from CommonServerUserPython import * # noqa
from CommonServerPython import * # noqa # pylint: disable=unused-wildcard-impo... | demisto/content | Packs/QRadar/Integrations/QRadar_v3/QRadar_v3.py | Python | mit | 164,136 | 0.003649 |
import os
from collections import defaultdict
from dataclasses import asdict
from pathlib import Path
from unittest import mock
import numpy as np
import pydicom
import pytest
from panimg.image_builders.dicom import (
_get_headers_by_study,
_validate_dicom_files,
format_error,
image_builder_dicom,
)
fr... | comic/comic-django | app/tests/cases_tests/test_dicom.py | Python | apache-2.0 | 5,037 | 0 |
__author__ = 'tiramola group'
import os, datetime, operator, math, random, itertools, time
import numpy as np
from lib.fuzz import fgraph, fset
from scipy.cluster.vq import kmeans2
from lib.persistance_module import env_vars
from scipy.stats import linregress
from collections import deque
from lib.tiramola_logging imp... | cmantas/tiramola_v3 | new_decision_module.py | Python | apache-2.0 | 36,005 | 0.007055 |
from django.contrib import admin
from django.contrib.flatpages.admin import FlatPageAdmin
from django.contrib.flatpages.models import FlatPage
from django.db import models
from suit_redactor.widgets import RedactorWidget
class FlatPageCustom(FlatPageAdmin):
formfield_overrides = {
models.TextField: {'wid... | moshthepitt/product.co.ke | core/admin.py | Python | mit | 458 | 0.004367 |
#
# Utility functions
#
import sys
from functools import partial
from uuid import UUID
from hashlib import sha1
from os import path, listdir
from zipfile import ZipFile
from subprocess import Popen, TimeoutExpired
import nacl.utils
import nacl.secret
def isValidUUID(uid):
"""
Validate UUID
@param uid: UU... | cbrunker/quip | lib/Utils.py | Python | gpl-3.0 | 4,795 | 0.003337 |
# Copyright 2011, Thomas G. Dimiduk
#
# This file is part of GroupEng.
#
# GroupEng is free software: you can redistribute it and/or modify
# it under the terms of the GNU Affero General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later versi... | tdimiduk/groupeng | src/input_parser.py | Python | agpl-3.0 | 2,845 | 0.002109 |
import agents as ag
import envgui as gui
# change this line ONLY to refer to your project
import submissions.Porter.vacuum2 as v2
# ______________________________________________________________________________
# Vacuum environmenty
class Dirt(ag.Thing):
pass
class VacuumEnvironment(ag.XYEnvironment):
"""Th... | austinban/aima-python | submissions/Porter/vacuum2Runner.py | Python | mit | 6,343 | 0.006779 |
'''
Author Joshua Pitts the.midnite.runr 'at' gmail <d ot > com
Copyright (C) 2013,2014, Joshua Pitts
License: GPLv3
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, ei... | codercold/Veil-Evasion | tools/backdoor/intel/LinuxIntelELF32.py | Python | gpl-3.0 | 5,166 | 0.00542 |
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('cms', '0014_auto_20160404_1908'),
]
operations = [
migrations.AlterField(
model_name='cmsplugin',
name='position',
field=models.PositiveSmallIntegerField... | rsalmaso/django-cms | cms/migrations/0015_auto_20160421_0000.py | Python | bsd-3-clause | 391 | 0.002558 |
from . import font
from .indicator import Indicator, IndicatorOptions
from .airspeed import AirspeedIndicator
from .altitude import AltitudeIndicator
from .attitude import AttitudeIndicator
from .compass import CompassIndicator
from .pfd import PFD
from .joystick import Joystick
from . import base_test
| rbmj/pyflightcontrol | pyflightcontrol/base/__init__.py | Python | apache-2.0 | 305 | 0 |
import src
import random
class Bomb(src.items.Item):
"""
ingame item to kill things and destroy stuff
"""
type = "Bomb"
name = "bomb"
description = "designed to explode"
usageInfo = """
The explosion will damage/destroy everything on the current tile or the container.
Activate it to trig... | MarxMustermann/OfMiceAndMechs | src/itemFolder/military/bomb.py | Python | gpl-3.0 | 1,990 | 0.009045 |
from django.db import models
class Salary(models.Model):
id = models.AutoField(primary_key = True)
bh = models.CharField(max_length = 10)
xm = models.CharField(max_length = 12)
status = models.CharField(max_length = 8)
class Meta:
db_table = 'swan_salary'
def __str__(self):
ret... | huaiping/pandora | salary/models.py | Python | mit | 332 | 0.03012 |
import unittest
import serializer
__author__ = 'peter'
class SerializationTests(unittest.TestCase):
def test_serialize_single_key_value_pair(self):
input = [{ 'name': 'value' }]
expected_output = "name=value"
output = serializer.serialize(input)
self.assertEquals(cmp(expected_outp... | PeterDowdy/py-paradox-convert | tests/serialization_tests.py | Python | mit | 2,040 | 0.007353 |
#!/usr/bin/python
# -*- coding: utf-8 -*-
"""
This file is part of XBMC Mega Pack Addon.
Copyright (C) 2014 Wolverine (xbmcmegapack@gmail.com)
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Softwar... | xbmcmegapack/plugin.video.megapack.dev | resources/lib/menus/home_countries_virgin_islands_us.py | Python | gpl-3.0 | 1,134 | 0.00265 |
# Copyright (c) 2013-2014 Will Thames <will@thames.id.au>
#
# 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... | willthames/ansible-lint | lib/ansiblelint/rules/GitHasVersionRule.py | Python | mit | 1,699 | 0 |
# Copyright (c) 2011 The Chromium Authors. All rights reserved.
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
"""Collection of functions and classes to fix various encoding problems on
multiple platforms with python.
"""
from __future__ import print_function
im... | luci/luci-py | client/third_party/depot_tools/fix_encoding.py | Python | apache-2.0 | 12,497 | 0.009842 |
import sqlalchemy.pool
import time
import math
class SAAutoPool(sqlalchemy.pool.QueuePool):
""" A pool class similar to QueuePool but rather than holding some
minimum number of connections open makes an estimate of how many
connections are needed.
The goal is that new connections should be opened at m... | kleptog/saautopool | saautopool.py | Python | mit | 3,786 | 0.002905 |
#!/usr/bin/env python
# -*- encoding: utf-8 -*-
#
# Copyright (c) 2017 Stephen Bunn (stephen@bunn.io)
# GNU GPLv3 <https://www.gnu.org/licenses/gpl-3.0.en.html>
from ._common import *
from .rethinkdb import RethinkDBPipe
from .mongodb import MongoDBPipe
| ritashugisha/neat | neat/pipe/__init__.py | Python | gpl-3.0 | 255 | 0 |
#!/usr/bin/env python
# Licensed to Cloudera, Inc. under one
# or more contributor license agreements. See the NOTICE file
# distributed with this work for additional information
# regarding copyright ownership. Cloudera, Inc. licenses this file
# to you under the Apache License, Version 2.0 (the
# "License"); you ma... | vmax-feihu/hue | apps/useradmin/src/useradmin/ldap_access.py | Python | apache-2.0 | 14,369 | 0.009326 |
#
# Copyright (c) 2008--2010 Red Hat, Inc.
#
# This software is licensed to you under the GNU General Public License,
# version 2 (GPLv2). There is NO WARRANTY for this software, express or
# implied, including the implied warranties of MERCHANTABILITY or FITNESS
# FOR A PARTICULAR PURPOSE. You should have received a c... | colloquium/spacewalk | backend/server/rhnUser.py | Python | gpl-2.0 | 28,422 | 0.004398 |
#!/usr/bin/env impala-python
#
# 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 (... | michaelhkw/incubator-impala | testdata/bin/random_avro_schema.py | Python | apache-2.0 | 6,014 | 0.00981 |
def standard_text_from_block(block, offset, max_length):
str = ''
for i in range(offset, offset + max_length):
c = block[i]
if c == 0:
return str
else:
str += chr(c - 0x30)
return str
def standard_text_to_byte_list(text, max_length):
byte_list = []
t... | johnreswebpro/CoilSnake | coilsnake/util/eb/text.py | Python | gpl-3.0 | 1,914 | 0.002612 |
INSTALL_PATH = '/home/fred/workspace/grafeo/'
| fredmorcos/attic | projects/grafeo/attic/grafeo_20100227_python/grafeo/config/Config.py | Python | isc | 46 | 0 |
"""
Module with location helpers.
detect_location_info and elevation are mocked by default during tests.
"""
import asyncio
import collections
import math
from typing import Any, Dict, Optional, Tuple
import aiohttp
ELEVATION_URL = "https://api.open-elevation.com/api/v1/lookup"
IP_API = "http://ip-api.com/json"
IPAP... | leppa/home-assistant | homeassistant/util/location.py | Python | apache-2.0 | 6,274 | 0.000956 |
# Copyright (C) 2015 Google Inc., authors, and contributors <see AUTHORS file>
# Licensed under http://www.apache.org/licenses/LICENSE-2.0 <see LICENSE file>
# Created By: jernej@reciprocitylabs.com
# Maintained By: jernej@reciprocitylabs.com
from lib import environment
from lib.constants import url
from lib.page.widg... | jmakov/ggrc-core | test/selenium/src/lib/page/widget/admin_people.py | Python | apache-2.0 | 457 | 0.002188 |
# ***************************************************************************
# * *
# * Copyright (c) 2016 - Bernd Hahnebach <bernd@bimstatik.org> *
# * *
# * Th... | wood-galaxy/FreeCAD | src/Mod/Fem/FemInputWriter.py | Python | lgpl-2.1 | 9,277 | 0.003557 |
"""
The extropy
"""
from ..helpers import RV_MODES
from ..math.ops import get_ops
import numpy as np
def extropy(dist, rvs=None, rv_mode=None):
"""
Returns the extropy J[X] over the random variables in `rvs`.
If the distribution represents linear probabilities, then the extropy
is calculated with un... | chebee7i/dit | dit/other/extropy.py | Python | bsd-3-clause | 2,122 | 0.000471 |
# Yum plugin to re-patch container rootfs after a yum update is done
#
# Copyright (C) 2012 Oracle
#
# Authors:
# Dwight Engen <dwight.engen@oracle.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 Fou... | czchen/debian-lxc | config/yum/lxc-patch.py | Python | lgpl-2.1 | 1,850 | 0.000541 |
# -*- coding: utf-8 -*-
#
# SPDX-License-Identifier: AGPL-3.0-or-later
#
# snippy - software development and maintenance notes manager.
# Copyright 2017-2020 Heikki J. Laaksonen <laaksonen.heikki.j@gmail.com>
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU ... | heilaaks/snippy | snippy/server/rest/api_fields.py | Python | agpl-3.0 | 3,524 | 0.000568 |
# THIS FILE IS PART OF THE CYLC WORKFLOW ENGINE.
# Copyright (C) NIWA & British Crown (Met Office) & Contributors.
#
# 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 Licen... | oliver-sanders/cylc | tests/unit/parsec/test_validate.py | Python | gpl-3.0 | 21,599 | 0 |
import click
from arrow.cli import pass_context, json_loads
from arrow.decorators import custom_exception, dict_output
@click.command('get_comments')
@click.argument("feature_id", type=str)
@click.option(
"--organism",
help="Organism Common Name",
type=str
)
@click.option(
"--sequence",
help="Sequ... | erasche/python-apollo | arrow/commands/annotations/get_comments.py | Python | mit | 652 | 0.001534 |
# -*- coding: utf-8 -*-
"""
***************************************************************************
SelectByAttribute.py
---------------------
Date : May 2010
Copyright : (C) 2010 by Michael Minn
Email : pyqgis at michaelminn dot com
*******************... | nirvn/QGIS | python/plugins/processing/algs/qgis/SelectByAttribute.py | Python | gpl-2.0 | 5,528 | 0.001447 |
import chainer
import chainer.functions as F
import chainer.links as L
class vgga(chainer.Chain):
insize = 224
def __init__(self):
super(vgga, self).__init__()
with self.init_scope():
self.conv1 = L.Convolution2D( 3, 64, 3, stride=1, pad=1)
self.conv2 = L.Convolution... | soumith/convnet-benchmarks | chainer/vgga.py | Python | mit | 1,463 | 0.001367 |
from django.core.checks.urls import check_url_config
from django.test import SimpleTestCase
from django.test.utils import override_settings
class CheckUrlsTest(SimpleTestCase):
@override_settings(ROOT_URLCONF='check_framework.urls_no_warnings')
def test_include_no_warnings(self):
result = check_url_co... | cainmatt/django | tests/check_framework/test_urls.py | Python | bsd-3-clause | 1,638 | 0.001832 |
"""Find all models written by user Hutton, including the DOI and the
source code repository for each model.
"""
from ask_api_examples import make_query
query = '[[Last name::Hutton]]|?DOI model|?Source web address'
def main():
r = make_query(query, __file__)
return r
if __name__ == '__main__':
print ... | mdpiper/csdms-wiki-api-examples | ask_api_examples/list_model_repo_doi.py | Python | mit | 327 | 0 |
# -*- coding: utf-8 -*-
"""Xception V1 model for Keras.
On ImageNet, this model gets to a top-1 validation accuracy of 0.790
and a top-5 validation accuracy of 0.945.
Do note that the input image format for this model is different than for
the VGG16 and ResNet models (299x299 instead of 224x224),
and that the input p... | bbenligiray/keras_models | not_used/xception.py | Python | mit | 11,593 | 0.002156 |
def f():
try:
a = 1
except:
b = 1
| idea4bsd/idea4bsd | python/testData/copyPaste/Whitespace.after.py | Python | apache-2.0 | 59 | 0.016949 |
# Copyright (C) 2010-2011 Richard Lincoln
#
# 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... | rwl/PyCIM | CIM14/IEC61968/PaymentMetering/LineDetail.py | Python | mit | 2,482 | 0.004432 |
#!/usr/bin/env python
# This file is part of VoltDB.
# Copyright (C) 2008-2010 VoltDB Inc.
#
# VoltDB 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... | apavlo/h-store | src/catgen/catalog_utils/testdata.py | Python | gpl-3.0 | 1,429 | 0.004899 |
# -*- coding: utf-8 -*-
# Copyright 2014 OpenMarket 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 la... | rzr/synapse | tests/rest/client/v1/utils.py | Python | apache-2.0 | 4,828 | 0.000829 |
"""Log MAVLink stream."""
import argparse
from pymavlink import mavutil
import pymavlink.dialects.v10.ceaufmg as mavlink
def main():
parser = argparse.ArgumentParser(description=__doc__)
parser.add_argument("--verbose", action='store_true',
help="print messages to STDOUT")
parse... | cea-ufmg/pyfdas | pyfdas/mavlog.py | Python | mit | 891 | 0.001122 |
#!/usr/bin/env python
'''
useful extra functions for use by mavlink clients
Copyright Andrew Tridgell 2011
Released under GNU GPL version 3 or later
'''
import os, sys
from math import *
sys.path.insert(0, os.path.join(os.path.dirname(os.path.realpath(__file__)), 'examples'))
try:
# rotmat doesn't work on Python... | trunetcopter/trunetcopter | gui/pymavlink/mavextra.py | Python | gpl-3.0 | 16,655 | 0.005344 |
# -*- coding: utf-8 -*-
"""
DO NOT EDIT THIS FILE!
It is automatically generated from opcfoundation.org schemas.
"""
from opcua import ua
from opcua.ua import NodeId, QualifiedName, NumericNodeId, StringNodeId, GuidNodeId
from opcua.ua import NodeClass, LocalizedText
def create_standard_address_space_Part11(server)... | iirob/python-opcua | opcua/server/standard_address_space/standard_address_space_part11.py | Python | lgpl-3.0 | 125,106 | 0.000767 |
# Copyright (c) 2014 Rackspace Hosting.
#
# 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... | rackerlabs/solum-horizon | solumdashboard/exceptions.py | Python | apache-2.0 | 854 | 0.001171 |
# -*- coding: utf-8 -*-
#
# 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
... | prestodb/presto-admin | tests/unit/test_catalog.py | Python | apache-2.0 | 9,157 | 0.000655 |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
from runner.koan import *
class AboutDecoratingWithFunctions(Koan):
def addcowbell(fn):
fn.wow_factor = 'COWBELL BABY!'
return fn
@addcowbell
def mediocre_song(self):
return "o/~ We all live in a broken submarine o/~"
def test_de... | Krakn/learning | src/python/python_koans/python2/about_decorating_with_functions.py | Python | isc | 832 | 0 |
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
#
# Winton Kafka Streams Python documentation build configuration file, created by
# sphinx-quickstart on Tue May 16 21:00:14 2017.
#
# This file is execfile()d with the current directory set to its
# containing dir.
#
# Note that not all possible configuration values are ... | wintoncode/winton-kafka-streams | docs/conf.py | Python | apache-2.0 | 5,443 | 0.002021 |
"""
Project Configuration Importer
Handles the importing the project configuration from a separate location
and validates the version against the specified expected version.
NOTE: If you update this file or any others in scripts and require a
NEW variable in project_cfg, then you need to UPDATE THE EXPECTED_CFG... | Avantol13/mgen | dev/scripts/_project_cfg_importer.py | Python | gpl-3.0 | 1,937 | 0.005163 |
#!/usr/bin/env python
import sys
import re
import os
inFilename = sys.argv[1]
if os.path.isfile(inFilename):
namelength = inFilename.rfind(".")
name = inFilename[0:namelength]
exten = inFilename[namelength:]
outFilename = name+"-cachecmp"+exten
print "inFilename:", inFilename
print "outFilename:", outFilename
fpR... | bcheung92/Paperproject | gem5/pyscript/cachecmp.py | Python | mit | 2,915 | 0.026072 |
###############################################################################
##
## Copyright (C) 2006-2011, University of Utah.
## All rights reserved.
## Contact: contact@vistrails.org
##
## This file is part of VisTrails.
##
## "Redistribution and use in source and binary forms, with or without
## modification, ... | CMUSV-VisTrails/WorkflowRecommendation | vistrails/index/vistrailanalyzer.py | Python | bsd-3-clause | 4,209 | 0.012354 |
"""Various miscellaneous functions to make code easier to read & write."""
import collections.abc
import copy
import functools
import inspect
import logging
import urllib.parse
import jsonpointer
import jsonschema
_logger = logging.getLogger("holocron")
def resolve_json_references(value, context, keep_unknown=True... | ikalnytskyi/holocron | src/holocron/_processors/_misc.py | Python | bsd-3-clause | 4,296 | 0.000466 |
# -*- mode: python -*-
from .combinations import STANDARD_METHOD_COMBINATION
from .specializers import specializer, ROOT_SPECIALIZER
from . import util
from .cache import NoCachePolicy, LRU, TypeCachePolicy
import threading
import inspect
import warnings
try:
from ._py_clos import GenericFunction as GenericFuncti... | adh/py-clos | py_clos/base.py | Python | mit | 7,245 | 0.003313 |
# vim: tabstop=4 shiftwidth=4 softtabstop=4
# Copyright (c) 2012 Citrix Systems, Inc.
#
# Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance with the License. You may obtain
# a copy of the License at
#
# http://www.apache.org/licenses/LICE... | sridevikoushik31/nova | nova/tests/virt/xenapi/test_volumeops.py | Python | apache-2.0 | 8,108 | 0 |
#!/usr/bin/env python
## vim:ts=4:et:nowrap
"""A user-defined wrapper around string objects
Note: string objects have grown methods in Python 1.6
This module requires Python 1.6 or later.
"""
from types import StringType, UnicodeType
import sys
__all__ = ["UserString","MutableString"]
class UserString:
def __ini... | MalloyPower/parsing-python | front-end/testsuite-python-lib/Python-2.1/Lib/UserString.py | Python | mit | 7,530 | 0.00571 |
from django.contrib.auth.models import User
from django.core.urlresolvers import reverse
from django.db import models
class Location(models.Model):
address = models.CharField(blank=True)
latitude = models.DecimalField(max_digits=10, decimal_places=6)
longitude = models.DecimalField(max_digits=10, decimal_... | derrickyoo/serve-tucson | serve_tucson/locations/models.py | Python | bsd-3-clause | 956 | 0 |
'''This script demonstrates how to build a variational autoencoder
with Keras and deconvolution layers.
Reference: "Auto-Encoding Variational Bayes" https://arxiv.org/abs/1312.6114
'''
import numpy as np
import matplotlib.pyplot as plt
from scipy.stats import norm
from keras.layers import Input, Dense, Lambda, Flatte... | baojianzhou/DLReadingGroup | keras/examples/variational_autoencoder_deconv.py | Python | apache-2.0 | 7,159 | 0.000698 |
# This file helps to compute a version number in source trees obtained from
# git-archive tarball (such as those provided by githubs download-from-tag
# feature). Distribution tarballs (built by setup.py sdist) and build
# directories (produced by setup.py build) will contain a much shorter file
# that just contains t... | wheeler-microfluidics/dmf_control_board_plugin | _version.py | Python | bsd-3-clause | 18,441 | 0 |
from __future__ import unicode_literals
import logging
from django.conf import settings
from reviewboard import get_version_string, get_package_version, is_release
from reviewboard.admin.server import get_server_url
_registered_capabilities = {}
_capabilities_defaults = {
'diffs': {
'base_commit_ids': ... | KnowNo/reviewboard | reviewboard/webapi/server_info.py | Python | mit | 3,158 | 0 |
import _plotly_utils.basevalidators
class ValueminusValidator(_plotly_utils.basevalidators.NumberValidator):
def __init__(
self, plotly_name="valueminus", parent_name="scatter3d.error_z", **kwargs
):
super(ValueminusValidator, self).__init__(
plotly_name=plotly_name,
pa... | plotly/python-api | packages/python/plotly/plotly/validators/scatter3d/error_z/_valueminus.py | Python | mit | 512 | 0.001953 |
from httpx import AsyncClient
# Runtime import to avoid syntax errors in samples on Python < 3.5 and reach top-dir
import os
_TOP_DIR = os.path.abspath(
os.path.sep.join((
os.path.dirname(__file__),
'../',
)),
)
_SAMPLES_DIR = os.path.abspath(
os.path.sep.join((
os.path.dirname(__fi... | rmk135/objects | tests/unit/wiring/test_wiringfastapi_py36.py | Python | bsd-3-clause | 1,426 | 0.004208 |
'''
:codeauthor: {{full_name}} <{{email}}>
'''
from tests.support.mixins import LoaderModuleMockMixin
from tests.support.unit import TestCase
from tests.support.mock import patch
import salt.states.{{module_name}} as {{module_name}}
class {{module_name|capitalize}}TestCase(TestCase, LoaderModuleMockMixin):
... | saltstack/salt | templates/test_state/tests/unit/states/test_{{module_name}}.py | Python | apache-2.0 | 590 | 0.015254 |
import logging
from autotest.client import utils
from autotest.client.shared import error
from virttest import env_process, utils_test
@error.context_aware
def run(test, params, env):
"""
Vhost zero copy test
1) Enable/Disable vhost_net zero copy in host
1) Boot the main vm.
3) Run the ping test, ... | ehabkost/tp-qemu | qemu/tests/zero_copy.py | Python | gpl-2.0 | 2,659 | 0 |
from __future__ import absolute_import
from collections import namedtuple
from django.conf import settings
from sentry.utils.dates import to_datetime
from sentry.utils.services import LazyServiceWrapper
from .backends.base import Backend # NOQA
from .backends.dummy import DummyBackend # NOQA
backend = LazyServic... | JackDanger/sentry | src/sentry/digests/__init__.py | Python | bsd-3-clause | 910 | 0 |
"""
Handlers to process the responses from the Humble Bundle API
"""
__author__ = "Joel Pedraza"
__copyright__ = "Copyright 2014, Joel Pedraza"
__license__ = "MIT"
from humblebundle import exceptions
from humblebundle import models
import itertools
import requests
# Helper methods
def parse_data(response):
t... | lutris/humblebundle-python | humblebundle/handlers.py | Python | mit | 5,985 | 0.000668 |
__author__ = 'Varun Nayyar'
from Utils.MFCCArrayGen import emotions, speakers, getCorpus
from MCMC import MCMCRun
from emailAlerter import alertMe
def main2(numRuns = 100000, numMixtures = 8, speakerIndex = 6):
import time
for emotion in emotions:
start = time.ctime()
Xpoints = getCor... | nayyarv/MonteGMM | Inference/BayesInference.py | Python | mit | 844 | 0.016588 |
default_app_config = 'user_deletion.apps.UserDeletionConfig'
| incuna/django-user-deletion | user_deletion/__init__.py | Python | bsd-2-clause | 61 | 0 |
'''GoogLeNet with PyTorch.'''
import torch
import torch.nn as nn
import torch.nn.functional as F
from torch.autograd import Variable
class Inception(nn.Module):
def __init__(self, in_planes, n1x1, n3x3red, n3x3, n5x5red, n5x5, pool_planes):
super(Inception, self).__init__()
# 1x1 conv branch
... | 2prime/DeepLab | ResNet/models/googlenet.py | Python | mit | 3,237 | 0.001236 |
#!/usr/bin/env python
#coding: utf-8
"""
This module simply sends request to the Digital Ocean API,
and returns their response as a dict.
"""
import requests
API_ENDPOINT = 'https://api.digitalocean.com'
class DoError(RuntimeError):
pass
class DoManager(object):
def __init__(self, client_id, api_key):
... | chuwy/dopy | dopy/manager.py | Python | mit | 9,514 | 0.003363 |
# Licensed under a 3-clause BSD style license - see PYFITS.rst
import math
import os
import re
import time
import warnings
import pytest
import numpy as np
from numpy.testing import assert_equal
from astropy.io import fits
from astropy.tests.helper import catch_warnings, ignore_warnings
from astropy.io.fits.hdu.comp... | MSeifert04/astropy | astropy/io/fits/tests/test_image.py | Python | bsd-3-clause | 76,391 | 0.000406 |
# -*- coding: utf-8 -*-
# Copyright (c) 2017, sathishpy@gmail.com and Contributors
# See license.txt
from __future__ import unicode_literals
import frappe
import unittest
class TestCMPaperManagement(unittest.TestCase):
pass
| sathishpy/corrugation | corrugation/corrugation/doctype/cm_paper_management/test_cm_paper_management.py | Python | gpl-3.0 | 227 | 0.008811 |
from collections import defaultdict
import colorsys
import pg
def noise(x, z):
a = pg.simplex2(-x * 0.01, -z * 0.01, 4)
b = pg.simplex2(x * 0.1, z * 0.1, 4)
return (a + 1) * 16 + b / 10
def generate_color(x, z):
m = 0.005
h = (pg.simplex2(x * m, z * m, 4) + 1) / 2
s = (pg.simplex2(-x * m, z * ... | kbrafford/pg | examples/terrain.py | Python | mit | 2,927 | 0.00205 |
#!/usr/bin/env python
import os
import json
class TermiteCore:
def __init__( self, request, response ):
self.request = request
self.response = response
def GetConfigs( self ):
def GetServer():
return self.request.env['HTTP_HOST']
def GetDataset():
return self.request.application
def GetModel... | jyt109/termite-data-server | server_src/modules/core.py | Python | bsd-3-clause | 4,206 | 0.07204 |
# -*- encoding: utf-8 -*-
from abjad import *
import pytest
def test_selectiontools_Parentage_logical_voice_01():
r'''An anonymous staff and its contained unvoiced leaves share
the same signature.
'''
staff = Staff("c'8 d'8 e'8 f'8")
containment = inspect_(staff).get_parentage().logical_voice
... | mscuthbert/abjad | abjad/tools/selectiontools/test/test_selectiontools_Parentage_logical_voice.py | Python | gpl-3.0 | 10,702 | 0.000748 |
# Copyright 2019 The TensorFlow Authors. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the 'License');
# you may noa 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 applica... | tensorflow/addons | tensorflow_addons/image/tests/filters_test.py | Python | apache-2.0 | 11,712 | 0.000256 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.