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 logging
import io
from pathlib import Path
from rdflib import URIRef, RDF
from dipper.graph.RDFGraph import RDFGraph
LOG = logging.getLogger(__name__)
class TestUtils:
@staticmethod
def test_graph_equality(turtlish, graph):
"""
:param turtlish: file path or string of triples in turtl... | TomConlin/dipper | dipper/utils/TestUtils.py | Python | bsd-3-clause | 2,394 | 0.000418 |
from __future__ import (absolute_import, division, print_function)
__metaclass__ = type
import re
import sys
def read_file(path):
try:
with open(path, 'r') as f:
return f.read()
except Exception as ex: # pylint: disable=broad-except
print('%s:%d:%d: unable to read required file %... | nitzmahone/ansible | test/sanity/code-smell/ansible-requirements.py | Python | gpl-3.0 | 898 | 0.002227 |
# 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 by applicable law or ... | henrymp/coursebuilder | modules/dashboard/unit_lesson_editor.py | Python | apache-2.0 | 31,883 | 0.000157 |
"""
Support for Eneco Slimmer stekkers (Smart Plugs).
This provides controls for the z-wave smart plugs Toon can control.
"""
import logging
from homeassistant.components.switch import SwitchDevice
import custom_components.toon as toon_main
_LOGGER = logging.getLogger(__name__)
def setup_platform(hass, config, add... | krocat/ToonHA | toon/switch.py | Python | apache-2.0 | 2,141 | 0 |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
"""
This script re-constucts the Qt Creator installation to include Qt libraries, plugins, QtQuick.
Windows:
|-- bin
| |-- qt.conf -> Prefix=..
| |-- qt dlls
| |-- csdataquick executibles
| |-- csdataquick dlls
| |-- qt-creator executibles... | xiaoqiangwang/CSDataQuick | tools/fixup_qtcreator.py | Python | gpl-2.0 | 9,584 | 0.003861 |
from data_vault import VaultEnvironment
class KeeperApiHelper:
_expected_commands = []
_vault_env = VaultEnvironment()
@staticmethod
def communicate_expect(actions):
# type: (list) -> None
KeeperApiHelper._expected_commands.clear()
KeeperApiHelper._expected_commands.extend(act... | Keeper-Security/Commander | unit-tests/helper.py | Python | mit | 1,017 | 0 |
import os
import shutil
class BasicOperations_TestClass:
TEST_ROOT =' __test_root__'
def setUp(self):
self.regenerate_root
print(self.TEST_ROOT)
assert os.path.isdir(self.TEST_ROOT)
def tearDown(self):
return True
def test_test(self):
assert self.bar == 1
... | aleksclark/replfs | nosetests/basic_operations_tests.py | Python | bsd-3-clause | 469 | 0.004264 |
###############################################################################
##
## Copyright (C) 2011-2014, NYU-Poly.
## 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 for... | Nikea/VisTrails | vistrails/packages/rpy/__init__.py | Python | bsd-3-clause | 2,002 | 0.021978 |
# Import everything needed to edit video clips
from moviepy.editor import *
# Load myHolidays.mp4 and select the subclip 00:00:50 - 00:00:60
clip = VideoFileClip("myHolidays.mp4").subclip(50,60)
# Reduce the audio volume (volume x 0.8)
clip = clip.volumex(0.8)
# Generate a text clip. You can customize the font, colo... | ttm/socialLegacy | tests/legacy/testAnim2.py | Python | mit | 714 | 0.004202 |
#!/usr/bin/env python3
# Copyright (c) 2015 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 BIP 9 soft forks.
Connect to a single node.
regtest lock-in with 108/144 block signalling
activation a... | nmarley/dash | test/functional/bip9-softforks.py | Python | mit | 12,924 | 0.004643 |
#!/usr/bin/python
import glob, os
from cjh.cli import Cli, ListPrompt
from cjh.lists import ItemList
class Fileman(object):
@classmethod
def pwd(cls, getstr=False):
"""
Emulate 'pwd' command
"""
string = os.getcwd()
if getstr:
return string
else: pr... | hammerhorn/hammerhorn-jive | igo/cjh/files.py | Python | gpl-2.0 | 2,267 | 0.003088 |
"""
Basically I'm trying to cover 4 options, one of each:
(Previously featured state?, Use previous positions?)
---------------------------------------------------------
(no, no) = get_initial_featuring
(yes, no) = get_particle_featuring
(yes, yes) = translate_featuring
(no, yes) = f... | peri-source/peri | peri/runner.py | Python | mit | 29,237 | 0.001163 |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
"""DataGroupXanes: work with XANES data sets
============================================
- DataGroup
- DataGroup1D
- DataGroupXanes
"""
from .datagroup import MODNAME
from .datagroup1D import DataGroup1D
class DataGroupXanes(DataGroup1D):
"""DataGroup for XANES... | maurov/xraysloth | sloth/collects/datagroup_xan.py | Python | bsd-3-clause | 767 | 0.009126 |
# -*- cpy-indent-level: 4; indent-tabs-mode: nil -*-
# ex: set expandtab softtabstop=4 shiftwidth=4:
#
# Copyright (C) 2010,2011,2012,2013,2014,2015,2016,2017 Contributor
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obt... | quattor/aquilon | lib/aquilon/aqdb/model/address_assignment.py | Python | apache-2.0 | 6,715 | 0.000596 |
from __future__ import print_function
import time
import argparse
import grpc
from jaeger_client import Config
from grpc_opentracing import open_tracing_client_interceptor
from grpc_opentracing.grpcext import intercept_channel
import command_line_pb2
def run():
parser = argparse.ArgumentParser()
parser.ad... | johnbelamaric/themis | vendor/github.com/grpc-ecosystem/grpc-opentracing/python/examples/trivial/trivial_client.py | Python | apache-2.0 | 1,218 | 0 |
from collections import Counter
c = Counter(input())
print(min(c['t'], c['r'], c['e']//2))
| knuu/competitive-programming | yukicoder/yuki279.py | Python | mit | 91 | 0 |
#!/usr/bin/env python
# Copyright (c) 2012 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.
"""Script to install ARM root image for cross building of ARM chrome on linux.
This script can be run manually but is more often ru... | AndroidOpenDevelopment/android_external_chromium_org | build/linux/install-arm-sysroot.py | Python | bsd-3-clause | 2,718 | 0.008462 |
from .context import CorpusContext
from .audio import AudioContext
from .importable import ImportContext
from .lexical import LexicalContext
from .pause import PauseContext
from .utterance import UtteranceContext
from .structured import StructuredContext
from .syllabic import SyllabicContext
from .spoken import Spoken... | samihuc/PolyglotDB | polyglotdb/corpus/__init__.py | Python | mit | 328 | 0 |
from SCons.Script import *
def exists(env):
return (env["PLATFORM"]=="win32")
def ConvertNewlines(target,source,env):
for t,s in zip(target,source):
f_in=open(str(s),"rb")
f_out=open(str(t),"wb")
f_out.write(f_in.read().replace("\n","\r\n"))
f_out.close()
f_in.close()
... | iakov/RHVoice | site_scons/site_tools/newlines.py | Python | gpl-3.0 | 816 | 0.035539 |
import requests
from django.conf import settings
from django.http import HttpResponse, HttpResponseBadRequest
from django.views.decorators.csrf import csrf_exempt
from django.views.decorators.http import require_http_methods
@csrf_exempt
@require_http_methods(["POST"])
def post_service_request(request):
payload =... | City-of-Helsinki/smbackend | services/views.py | Python | agpl-3.0 | 1,229 | 0 |
from uuid import uuid4
from django.test import TestCase
from casexml.apps.case.cleanup import claim_case, get_first_claim
from casexml.apps.case.mock import CaseBlock
from casexml.apps.case.util import post_case_blocks
from corehq.apps.case_search.models import CLAIM_CASE_TYPE
from corehq.apps.domain.shortcuts impor... | dimagi/commcare-hq | corehq/apps/ota/tests/test_claim.py | Python | bsd-3-clause | 4,929 | 0.00142 |
# -*- coding: utf-8 -*-
# petgfunctions.py - This python "helper" script holds a lot of functions
# Copyright (c) 2012-2014 Harry van der Wolf. All rights reserved.
# This program or module is free software: you can redistribute it and/or
# modify it under the terms of the GNU General Public Licence as published
# by... | hvdwolf/pyExifToolGUI | scripts/petgfunctions.py | Python | gpl-3.0 | 115,680 | 0.00593 |
text = 'this is a sample file\nnew line'
savefile = open('newtext', 'w')
savefile.write(text)
savefile.close()
| Faraaz54/python_training_problems | basic_python/write_file.py | Python | mit | 123 | 0.00813 |
# Moviemazer XBMC Addon
# written by Tristan Fischer (sphere)
#
# If you have suggestions or problems: write me.
#
# Mail: sphere@dersphere.de
#
# Special Thanks to the website www.moviemaze.de
# Import Python stuff
import urllib
import urllib2
import re
import os
import sys
import time
from shutil import copyfile
#... | dersphere/plugin.video.moviemazer | default.py | Python | gpl-2.0 | 19,585 | 0.00337 |
#!/usr/bin/env python
import webapp2
import logging
from google.appengine.ext.webapp.mail_handlers import InboundMailHandler
from google.appengine.ext import ndb
from MailMessage import MailMessage
# the email domain of this app is @pomis-newsletterman.appspotmail.com
class EmailHandlerV1(InboundMailHandler):
... | Dudy/newsletterman | src/EmailHandlerV1.py | Python | apache-2.0 | 1,058 | 0.014178 |
# -*- Mode: python; coding: utf-8; tab-width: 8; indent-tabs-mode: t; -*-
#
# Copyright (C) 2009 Jonathan Matthew <jonathan@d14n.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 ve... | DylanMcCall/rhythmbox-songinfo-context-menu | plugins/artsearch/musicbrainz.py | Python | gpl-2.0 | 4,454 | 0.014594 |
#!/usr/bin/env python
from sciwonc.dataflow.DataStoreClient import DataStoreClient
import ConfigDB_SessionCompute_2
import pprint
# connector and config
client = DataStoreClient("mongodb", ConfigDB_SessionCompute_2)
config = ConfigDB_SessionCompute_2
# according to config
dataList = client.getData() # return an array... | elainenaomi/sciwonc-dataflow-examples | dissertation2017/Experiment 2/instances/11_2_wikiflow_1sh_1s_annot/sessioncompute_2/SessionCompute_2.py | Python | gpl-3.0 | 2,784 | 0.001796 |
###############################################################################
#
# The MIT License (MIT)
#
# Copyright (c) Tavendo GmbH
#
# 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 with... | RyanHope/AutobahnPython | examples/asyncio/wamp/rpc/decorators/frontend.py | Python | mit | 2,365 | 0 |
#!/usr/bin/env python
'''
Plot distribution of each feature,
conditioned on its bfeature type
'''
import argparse
import matplotlib.pyplot as plt
from matplotlib.backends.backend_pdf import PdfPages
from common import *
from information import utils
from scipy.stats import itemfreq
nbins = 100
def opts():
parse... | timpalpant/KaggleTSTextClassification | scripts/plot_feature_distributions.py | Python | gpl-3.0 | 2,179 | 0.005048 |
#!/usr/bin/env python3
import os
from pathlib import Path
import numpy as np
from pysisyphus.helpers import geom_from_xyz_file
from pysisyphus.stocastic.align import matched_rmsd
THIS_DIR = Path(os.path.dirname(os.path.realpath(__file__)))
def test_matched_rmsd():
geom1 = geom_from_xyz_file(THIS_DIR / "eins.x... | eljost/pysisyphus | tests_staging/test_matched_rmsd/test_matched_rmsd.py | Python | gpl-3.0 | 816 | 0 |
# ------------------------------------------------------------------------------
# Name: test_nansat.py
# Purpose: Test the Nansat class
#
# Author: Morten Wergeland Hansen, Asuka Yamakawa, Anton Korosov
#
# Created: 18.06.2014
# Last modified:24.08.2017 14:00
# Copyright: (c) NERSC
# Licence... | nansencenter/nansat | nansat/tests/test_nansat.py | Python | gpl-3.0 | 34,081 | 0.00355 |
# Copyright 2013 Daniel Narvaez
#
# 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 writi... | dnarvaez/sourcestamp | setup.py | Python | apache-2.0 | 1,161 | 0 |
config = {
"interfaces": {
"google.cloud.talent.v4beta1.TenantService": {
"retry_codes": {
"idempotent": ["DEADLINE_EXCEEDED", "UNAVAILABLE"],
"non_idempotent": [],
},
"retry_params": {
"default": {
"init... | tseaver/google-cloud-python | talent/google/cloud/talent_v4beta1/gapic/tenant_service_client_config.py | Python | apache-2.0 | 1,782 | 0 |
x = raw_input()
print x[0].upper() + x[1:]
| yamstudio/Codeforces | 200/281A - Word Capitalization.py | Python | gpl-3.0 | 43 | 0 |
import collections
import re
import sys
import warnings
from bs4.dammit import EntitySubstitution
DEFAULT_OUTPUT_ENCODING = "utf-8"
PY3K = (sys.version_info[0] > 2)
whitespace_re = re.compile("\s+")
def _alias(attr):
"""Alias one attribute name to another for backward compatibility"""
@property
def alias... | ruuk/script.web.viewer2 | lib/webviewer/bs4/element.py | Python | gpl-2.0 | 61,200 | 0.001307 |
from __future__ import unicode_literals
import uuid
from django.forms import UUIDField, ValidationError
from django.test import SimpleTestCase
class UUIDFieldTest(SimpleTestCase):
def test_uuidfield_1(self):
field = UUIDField()
value = field.clean('550e8400e29b41d4a716446655440000')
sel... | filias/django | tests/forms_tests/field_tests/test_uuidfield.py | Python | bsd-3-clause | 971 | 0.00103 |
# coding=utf-8
import asyncio
import random
import json
import hashlib
import aiohttp
import async_timeout
import sys
class BaiduTranslate:
lang_auto = 'auto'
lang_zh = 'zh'
lang_en = 'en'
timeout = 20
api_addr = 'http://fanyi-api.baidu.com/api/trans/vip/translate'
def __init__(self, loop=... | xiaoslzhang/pyyingyu | yingyu/yingyu_baidu.py | Python | apache-2.0 | 1,682 | 0.003567 |
from core.plugins.lib.proxies import MetricProxy, SourceProxy
from core.plugins.lib.models import PluginDataModel
from core.plugins.lib.fields import Field, ListField, DateTimeField, FloatField, IntegerField
from core.plugins.lib.scope import Scope, ZonePerm, BlockPerm
class BaseFitbitModel(PluginDataModel):
metri... | realizeapp/realize-core | plugins/fitbit/models.py | Python | agpl-3.0 | 1,974 | 0.007092 |
"""MySQLdb Cursors
This module implements Cursors of various types for MySQLdb. By
default, MySQLdb uses the Cursor class.
"""
import re
insert_values = re.compile(r"\svalues\s*(\(((?<!\\)'.*?\).*(?<!\\)?'|.)+?\))", re.IGNORECASE)
from _mysql_exceptions import Warning, Error, InterfaceError, DataError, \
Databa... | carlgao/lenga | images/lenny64-peon/usr/share/python-support/python-mysqldb/MySQLdb/cursors.py | Python | mit | 16,782 | 0.003158 |
from django.contrib import admin
from holidays.models import (Holiday, StaticHoliday,
NthXDayHoliday, NthXDayAfterHoliday, CustomHoliday)
class HolidayAdmin(admin.ModelAdmin):
pass
class StaticHolidayAdmin(admin.ModelAdmin):
pass
class NthXDayHolidayAdmin(admin.ModelAdmin):
pass
cl... | dannybrowne86/django-holidays | holidays/holidays/admin.py | Python | mit | 720 | 0.009722 |
from datetime import timedelta
from django.conf import settings
from django.utils import timezone
from django.shortcuts import render, get_object_or_404
from django.http import HttpResponse
from django.contrib.auth.decorators import user_passes_test
from django.utils.importlib import import_module
from djangae.core.pa... | potatolondon/centaur | views.py | Python | bsd-3-clause | 4,150 | 0.002892 |
import functools
import pfp.interp
def native(name, ret, interp=None, send_interp=False):
"""Used as a decorator to add the decorated function to the
pfp interpreter so that it can be used from within scripts.
:param str name: The name of the function as it will be exposed in template scripts.
:param pfp.fields.... | greenoaktree/pfp | pfp/native/__init__.py | Python | mit | 1,639 | 0.026236 |
#!/usr/bin/env python
# -*- coding: UTF-8 -*-
'''
plot the results from the files igraph_degree_assort_study and degree_assortativity
'''
from igraph import *
import os
import numpy as np
import matplotlib.pyplot as plt
#########################
IN_DIR = '/home/sscepano/Projects7s/Twitter-workspace/ALL_SR'
img_out_pl... | sanja7s/SR_Twitter | src_graph/plot_degree_assortativity.py | Python | mit | 1,447 | 0.032481 |
from dungeon.dungeon import Dungeon
def main():
testdungeon = Dungeon('level1.txt')
print(testdungeon)
if main.__name__ == '__main__':
main() | int3l/dungeons-and-pythons | main.py | Python | mit | 155 | 0.019355 |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
from __future__ import print_function
import sys
from getpass import getpass
from datetime import datetime
import pprint
from docopt import docopt
import requests
from .spelling import spellchecker
from .dispatch import dispatch
from .utils import login, validate_usernam... | oubiga/respect | respect/main.py | Python | bsd-3-clause | 2,305 | 0.000434 |
# ----------------------------------------------------------------------
# Numenta Platform for Intelligent Computing (NuPIC)
# Copyright (C) 2021, Numenta, Inc. Unless you have an agreement
# with Numenta, Inc., for a separate license for this software code, the
# following terms and conditions apply:
#
# This progra... | mrcslws/nupic.research | src/nupic/research/frameworks/pytorch/hooks/hook_manager.py | Python | agpl-3.0 | 5,818 | 0.001375 |
# -*- encoding: utf-8 -*-
__author__ = 'pp'
__date__ = '6/25/14'
"""
georest.view.utils
~~~~~~~~~~~~~~~~~
helper/mixin things for views
"""
import sys
from functools import wraps
from flask import request
from .exceptions import InvalidRequest
from ..geo import GeoException
def get_json_content():
... | Kotaimen/georest | georest/view/utils.py | Python | bsd-2-clause | 1,423 | 0.000703 |
import sys
from sim import Sim
from node import Node
from link import Link
from transport import Transport
from tcp import TCP
from network import Network
import optparse
import os
import subprocess
class AppHandler(object):
def __init__(self,filename, directory):
self.filename = filename
self.di... | joe-eklund/cs460 | bene/lab2/src/transfer.py | Python | gpl-3.0 | 4,724 | 0.013124 |
#!/usr/bin/env python
#
# Copyright 2007 Google 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 o... | SRabbelier/Melange | thirdparty/google_appengine/google/net/proto/ProtocolBuffer.py | Python | apache-2.0 | 14,205 | 0.017247 |
"""
Copyright (C) 2017, 申瑞珉 (Ruimin Shen)
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU Lesser General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
This program is distributed i... | ruiminshen/yolo-tf | parse_darknet_yolo2.py | Python | lgpl-3.0 | 6,342 | 0.002841 |
model_search = "http://api.nytimes.com/svc/search/v2/" + \
"articlesearch.response-format?" + \
"[q=search term&" + \
"fq=filter-field:(filter-term)&additional-params=values]" + \
"&api-key=9key"
"""http://api.nytimes.com/svc/search/v2/articlesearch.json?q=terrorism+OR+t... | polypmer/scrape | new-york-times/nytimes-scrape.py | Python | mit | 1,833 | 0.004364 |
import os
from django import template
from django.conf import settings
from django.utils.safestring import mark_safe
register = template.Library()
@register.simple_tag()
def custom_css():
theme_path = os.path.join(
settings.MEDIA_ROOT,
"overrides.css"
)
if os.path.exists(theme_path):
... | danielquinn/paperless | src/documents/templatetags/customisation.py | Python | gpl-3.0 | 865 | 0 |
import numpy as np
import scipy.stats as stats
import sys
# lib eh a nossa biblioteca criada para este trabalho
import lib.naive_bayes as nb
import lib.preprocessing as prep
import lib.validation as valid
import lib.normalization as normal
from config.constants import *
def case3(output=True):
accuracy_in_eac... | queirozfcom/spam-filter | case3_naive_normal.py | Python | mit | 8,514 | 0.009396 |
#!/usr/bin/python
# Copyright: (c) 2017, Giovanni Sciortino (@giovannisciortino)
# GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt)
from __future__ import absolute_import, division, print_function
__metaclass__ = type
ANSIBLE_METADATA = {'metadata_version': '1.1',
... | hryamzik/ansible | lib/ansible/modules/packaging/os/rhsm_repository.py | Python | gpl-3.0 | 7,912 | 0.00316 |
import unittest
from factorial import fact
class TestFactorial(unittest.TestCase):
"""
Our basic test class
"""
def test_fact(self):
"""
The actual test.
Any method which starts with ``test_`` will considered as a test case.
"""
res = fact(5)
self.assert... | rtnpro/test-your-code | test_your_code/examples/factorial/test_factorial.py | Python | gpl-2.0 | 386 | 0.005181 |
# -*- coding: utf-8 -*-
#############################################################################
#
# Copyright (c) 2007 Martin Reisenhofer <martin.reisenhofer@funkring.net>
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as pu... | funkring/fdoo | addons-funkring/at_account/wizard/invoice_attachment_wizard.py | Python | agpl-3.0 | 2,242 | 0.005352 |
# partial unit test for gmpy2 threaded mpz functionality
# relies on Tim Peters' "doctest.py" test-driver
import gmpy2 as _g, doctest, sys, operator, gc, queue, threading
from functools import reduce
__test__={}
def _tf(N=2, _K=1234**5678):
"""Takes about 100ms on a first-generation Macbook Pro"""
for i in ra... | andreamartire/gmpy | test3/gmpy_test_thr.py | Python | lgpl-3.0 | 3,614 | 0.010238 |
class WordDistance(object):
def __init__(self, words):
"""
initialize your data structure here.
:type words: List[str]
"""
self.word_dict = {}
for idx, w in enumerate(words):
self.word_dict[w] = self.word_dict.get(w, []) + [idx]
def shortest... | Mlieou/leetcode_python | leetcode/python/ex_244.py | Python | mit | 791 | 0.002528 |
# pylint: skip-file
# vim: expandtab:tabstop=4:shiftwidth=4
#pylint: disable=too-many-branches
def main():
''' ansible module for gcloud iam servicetaccount'''
module = AnsibleModule(
argument_spec=dict(
# credentials
state=dict(default='present', type='str',
... | appuio/ansible-role-openshift-zabbix-monitoring | vendor/openshift-tools/ansible/roles/lib_gcloud/build/ansible/gcloud_iam_sa.py | Python | apache-2.0 | 2,675 | 0.003364 |
from framework.db import models
from framework.config import config
from framework.dependency_management.dependency_resolver import BaseComponent
from framework.dependency_management.interfaces import ResourceInterface
from framework.lib.general import cprint
import os
import logging
from framework.utils import FileOpe... | sharad1126/owtf | framework/db/resource_manager.py | Python | bsd-3-clause | 3,759 | 0.004256 |
#!/usr/bin/python
# -*- coding: utf-8 -*-
r"""
Very simple script to replace a template with another one.
It also converts the old MediaWiki boilerplate format to the new format.
Syntax: python template.py [-remove] [xml[:filename]] oldTemplate [newTemplate]
Specify the template on the command line. The program will... | icyflame/batman | scripts/template.py | Python | mit | 14,372 | 0.000348 |
# -*- coding: utf-8 -*-
from canaimagnulinux.wizard.interfaces import IChat
from canaimagnulinux.wizard.interfaces import ISocialNetwork
from canaimagnulinux.wizard.utils import CanaimaGnuLinuxWizardMF as _
from collective.beaker.interfaces import ISession
from collective.z3cform.wizard import wizard
from plone impor... | CanaimaGNULinux/canaimagnulinux.wizard | canaimagnulinux/wizard/browser/socialnetwork.py | Python | gpl-2.0 | 3,378 | 0.000296 |
"""Pathname and path-related operations for the Macintosh."""
import os
from stat import *
__all__ = ["normcase","isabs","join","splitdrive","split","splitext",
"basename","dirname","commonprefix","getsize","getmtime",
"getatime","islink","exists","isdir","isfile",
"walk","exp... | DarioGT/OMS-PluginXML | org.modelsphere.sms/lib/jython-2.2.1/Lib/macpath.py | Python | gpl-3.0 | 6,978 | 0.005589 |
from datetime import datetime
def foo(p):
"""Foo
:param datetime p: a datetime
<ref>
""" | asedunov/intellij-community | python/testData/resolve/ReferenceInDocstring.py | Python | apache-2.0 | 114 | 0.017544 |
# -*- coding: utf-8 -*-
"""
formlayout
==========
Module creating Qt form dialogs/layouts to edit various type of parameters
formlayout License Agreement (MIT License)
------------------------------------------
Copyright (c) 2009 Pierre Raybaut
Permission is hereby granted, free of charge, to any person
obtaining ... | chilleo/ALPHA | raxmlOutputWindows/matplotlibCustomBackend/customFormlayout.py | Python | mit | 20,667 | 0.000919 |
#!/usr/bin/python3
# -*- coding: utf-8 -*-
import time
from selenium import webdriver
from selenium.webdriver.common.keys import Keys
from PIL import Image
def graf2png(weburl, username, password, timeout, imgname, hwin, wwin, onlypanel):
driver = webdriver.PhantomJS()
driver.set_window_size(hwin, wwin)
... | andoniaf/DefGrafana.py | graf2png.py | Python | gpl-3.0 | 1,737 | 0.000576 |
# -*- coding: utf-8 -*-
# Copyright © 2014-2018 GWHAT Project Contributors
# https://github.com/jnsebgosselin/gwhat
#
# This file is part of GWHAT (Ground-Water Hydrograph Analysis Toolbox).
# Licensed under the terms of the GNU General Public License.
# ---- Standard library imports
import os
import csv
import sys
... | jnsebgosselin/WHAT | gwhat/brf_mod/kgs_brf.py | Python | gpl-3.0 | 4,831 | 0.000414 |
# Copyright 2015, 2018 IBM Corp.
#
# 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... | powervm/pypowervm | pypowervm/tasks/hdisk/_fc.py | Python | apache-2.0 | 19,741 | 0 |
# vim: tabstop=4 shiftwidth=4 softtabstop=4
# Copyright 2010 United States Government as represented by the
# Administrator of the National Aeronautics and Space Administration.
# All Rights Reserved.
# Copyright 2011 - 2012, Red Hat, Inc.
#
# Licensed under the Apache License, Version 2.0 (the "License"); you may
... | maelnor/cinder | cinder/openstack/common/rpc/amqp.py | Python | apache-2.0 | 25,306 | 0.00004 |
# ----------------------------------------------------------------------
# Copyright (C) 2012 Numenta Inc. All rights reserved.
#
# The information and source code contained herein is the
# exclusive property of Numenta Inc. No part of this software
# may be used, reproduced, stored or distributed in any form,
# w... | chetan51/nupic | tests/integration/nupic/opf/opf_checkpoint_test/experiments/non_temporal_multi_step/base.py | Python | gpl-3.0 | 14,616 | 0.003626 |
# -*- coding: utf-8 -*-
from ihm.main_window import launch
if __name__ == '__main__':
launch()
| ThibaultGigant/Crosswords | run.py | Python | gpl-3.0 | 101 | 0 |
"""
This component provides HA cover support for Abode Security System.
For more details about this platform, please refer to the documentation at
https://home-assistant.io/components/cover.abode/
"""
import logging
from homeassistant.components.abode import AbodeDevice, DOMAIN as ABODE_DOMAIN
from homeassistant.comp... | ewandor/home-assistant | homeassistant/components/cover/abode.py | Python | apache-2.0 | 1,326 | 0 |
import os
import re
import shutil
import zipfile
import requests
import json
from shutil import copy2
from urllib.request import urlretrieve, urlopen
# Input parameters
version_param = os.environ.get('RELEASE_VERSION')
is_latest_param = True if version_param == "master" else False
# build constants
m2repo_path = '/m2... | gravitee-io/jenkins-scripts | src/main/python/package_bundles.py | Python | apache-2.0 | 19,869 | 0.003372 |
import pandas as pd
from sqlalchemy import create_engine
from bcpp_rdb.private_settings import Rdb
class CCC(object):
"""CDC data for close clinical cohort."""
def __init__(self):
self.engine = create_engine('postgresql://{user}:{password}@{host}/{db}'.format(
user=Rdb.user, password=Rd... | botswana-harvard/edc-rdb | bcpp_rdb/dataframes/ccc.py | Python | gpl-2.0 | 1,163 | 0.00086 |
class Information(object):
def __init__(self, pygame):
self.pygame = pygame
self.display_fps = False
def _show_fps(self, clock, screen):
font = self.pygame.font.SysFont('Calibri', 25, True, False)
text = font.render("fps: {0:.2f}".format(clock.get_fps()), True, (0, 0, 0))
... | evasilchenko/castle | core/info.py | Python | mit | 536 | 0.001866 |
#!/usr/bin/env python
from __future__ import division
import numpy as np
from mpl_toolkits.mplot3d import Axes3D
import matplotlib as mpl
import matplotlib.pyplot as plt
from scipy import linalg
import csv
import codecs
import copy
def comparison(trajOne, trajTwo):
segmentOne=np.array(trajOne)
segmentTwo=np.... | smorante/continuous-goal-directed-actions | guided-motor-primitives/src/roman14_primitive.py | Python | mit | 5,788 | 0.023151 |
import os
import sys
import numpy as np
import math
def findBinIndexFor(aFloatValue, binsList):
#print "findBinIndexFor: %s" % aFloatValue
returnIndex = -1
for i in range(len(binsList)):
thisBin = binsList[i]
if (aFloatValue >= thisBin[0]) and (aFloatValue < thisBin[1]):
returnIndex = i
break
return ... | omoju/Fundamentals | Data/twitterDataAnalysis/info_gain.py | Python | gpl-3.0 | 3,353 | 0.037578 |
from __future__ import division
import numpy as np
import tensorflow as tf
from cost_functions.huber_loss import huber_loss
from data_providers.data_provider_33_price_history_autoencoder import PriceHistoryAutoEncDataProvider
from interfaces.neural_net_model_interface import NeuralNetModelInterface
from mylibs.batch_n... | pligor/predicting-future-product-prices | 04_time_series_prediction/models/model_34_price_history_autoencoder.py | Python | agpl-3.0 | 22,721 | 0.004181 |
import sys
sys.path.insert(1,"../../../")
import h2o, tests
def deepLearningDemo():
# Training data
train_data = h2o.import_file(path=tests.locate("smalldata/gbm_test/ecology_model.csv"))
train_data = train_data.drop('Site')
train_data['Angaus'] = train_data['Angaus'].asfactor()
print train_data.descri... | kyoren/https-github.com-h2oai-h2o-3 | h2o-py/tests/testdir_algos/deeplearning/pyunit_demoDeeplearning.py | Python | apache-2.0 | 1,322 | 0.04236 |
import os
import textwrap
import pytest
from pip._internal.status_codes import ERROR
from tests.lib.path import Path
def fake_wheel(data, wheel_path):
data.packages.join(
'simple.dist-0.1-py2.py3-none-any.whl'
).copy(data.packages.join(wheel_path))
@pytest.mark.network
def test_download_if_request... | zvezdan/pip | tests/functional/test_download.py | Python | mit | 17,722 | 0 |
from bottle import route, default_app
app = default_app()
data = {
"id": 78874,
"seriesName": "Firefly",
"aliases": [
"Serenity"
],
"banner": "graphical/78874-g3.jpg",
"seriesId": "7097",
"status": "Ended",
"firstAired": "2002-09-20",
"network": "FOX (US)",
"networkId": "... | romanvm/WsgiBoostServer | benchmarks/test_app.py | Python | mit | 1,229 | 0.003255 |
# -*- coding: utf-8 -*-
"""
Copyright (C) 2014-2016 bromix (plugin.video.youtube)
Copyright (C) 2016-2018 plugin.video.youtube
SPDX-License-Identifier: GPL-2.0-only
See LICENSES/GPL-2.0-only for more information.
"""
from . import const_settings as setting
from . import const_localize as localize
fro... | jdf76/plugin.video.youtube | resources/lib/youtube_plugin/kodion/constants/__init__.py | Python | gpl-2.0 | 526 | 0 |
# -*- coding: utf-8 -*-
#------------------------------------------------------------
# beta.1 EPG FórmulaTV.com
# License: GPL (http://www.gnu.org/licenses/gpl-3.0.html)
#------------------------------------------------------------
# Gracias a la librería plugintools de Jesús (www.mimediacenter.info)
#----------------... | iptvgratis/TUPLAY | resources/tools/epg_formulatv.py | Python | gpl-3.0 | 24,492 | 0.007035 |
#! /usr/bin/env python
# -*- coding: utf-8 -*-
import os
import sys
import time
#import struct
from pycket import impersonators as imp
from pycket import values, values_string
from pycket.cont import continuation, loop_label, call_cont
from pycket.arity import Arity
from pycket import values_parameter
from pycket impor... | pycket/pycket | pycket/prims/general.py | Python | mit | 75,231 | 0.004878 |
import sys
from resources.datatables import Options
from resources.datatables import StateStatus
def addPlanetSpawns(core, planet):
stcSvc = core.staticService
objSvc = core.objectService
#junkdealer
stcSvc.spawnObject('junkdealer', 'naboo', long(0), float(-5694), float(6.5), float(4182), float(0.707), float(... | ProjectSWGCore/NGECore2 | scripts/static_spawns/naboo/theed.py | Python | lgpl-3.0 | 1,499 | 0.02068 |
#!/usr/bin/env python
#
# Copyright 2016 timercrack
#
# 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... | timercrack/pydatacoll | pydatacoll/utils/__init__.py | Python | apache-2.0 | 755 | 0 |
# Copyright The Cloud Custodian Authors.
# SPDX-License-Identifier: Apache-2.0
from collections import Counter
import logging
import itertools
import json
import time
from botocore.exceptions import ClientError
from concurrent.futures import as_completed
from dateutil.parser import parse as parse_date
from c7n.action... | thisisshi/cloud-custodian | c7n/resources/ebs.py | Python | apache-2.0 | 57,596 | 0.00026 |
from django_comments.forms import CommentForm
from bogofilter.models import BogofilterComment
import time
class BogofilterCommentForm(CommentForm):
def get_comment_model(self):
return BogofilterComment
| stefantalpalaru/django-bogofilter | bogofilter/forms.py | Python | bsd-3-clause | 216 | 0.009259 |
import subprocess
import pynotify
import time
def notify_with_subprocess(title, message):
subprocess.Popen(['notify-send', title, message])
return
def notify_with_pynotify(title, message):
pynotify.init("Test")
notice = pynotify.Notification(title, message)
notice.show()
return
def update_wit... | cloud-engineering/xfc-email-notifier | snippets/snippet_notfication.py | Python | mit | 939 | 0.015974 |
#!/usr/bin/env python
# Creates and saves a JSON file to update the D3.js graphs
import MySQLdb
import MySQLdb.cursors
import json
import Reference as r
import logging
def CreateSentimentIndex(NegativeWords, PositiveWords, TotalWords):
''' Creates a sentiment value for the word counts'''
if TotalWords... | AdamDynamic/TwitterMetrics | CreateJson.py | Python | gpl-2.0 | 2,191 | 0.016431 |
#
# DBus interface for payload Repo files image source.
#
# Copyright (C) 2020 Red Hat, Inc.
#
# This copyrighted material is made available to anyone wishing to use,
# modify, copy, or redistribute it subject to the terms and conditions of
# the GNU General Public License v.2, or (at your option) any later version.
# ... | jkonecny12/anaconda | pyanaconda/modules/payloads/source/repo_files/repo_files_interface.py | Python | gpl-2.0 | 1,434 | 0.001395 |
import pandas as pd
import numpy as np
import sklearn.preprocessing
from sklearn.linear_model import LinearRegression, LogisticRegression
FILENAME = 'BrainMets.xlsx'
MONTHS_TO_LIVE = 9
N_TRAIN = 250
def categorical_indices(values):
"""
When we have a categorical feature like 'cancer type', we want to transform its ... | iskandr/brainmets | data.py | Python | apache-2.0 | 7,077 | 0.046489 |
# -*- coding: utf-8 -*-
from rdflib import Namespace
ONTOLEX = Namespace("http://www.w3.org/ns/lemon/ontolex#")
LEXINFO = Namespace("http://www.lexinfo.net/ontology/2.0/lexinfo#")
DECOMP = Namespace("http://www.w3.org/ns/lemon/decomp#")
ISOCAT = Namespace("http://www.isocat.org/datcat/")
LIME = Namespace("http://www.w... | wimmuskee/ontolex-db | format/namespace.py | Python | mit | 343 | 0 |
'''
'''
import sys
import os
import gzip
import regex
# 'borrowed' from CGAT - we may not need this functionality
# ultimately. When finalised, if req., make clear source
def openFile(filename, mode="r", create_dir=False):
'''open file called *filename* with mode *mode*.
gzip - compressed files are recognized... | k3yavi/alevin | testing/src-py/Utilities.py | Python | gpl-3.0 | 3,040 | 0.000987 |
from comics.aggregator.crawler import CrawlerBase
from comics.core.comic_data import ComicDataBase
class ComicData(ComicDataBase):
name = "PartiallyClips"
language = "en"
url = "http://partiallyclips.com/"
start_date = "2002-01-01"
rights = "Robert T. Balder"
active = False
class Crawler(Cra... | jodal/comics | comics/comics/partiallyclips.py | Python | agpl-3.0 | 375 | 0 |
# !/usr/bin/env python
"""Testing a sprite.
The ball should bounce off the sides of the window. You may resize the
window.
This test should just run without failing.
"""
__docformat__ = 'restructuredtext'
__version__ = '$Id$'
import os
import unittest
from pyglet.gl import glClear
import pyglet.window
import pygl... | bitcraft/pyglet | contrib/scene2d/tests/scene2d/SPRITE_OVERLAP.py | Python | bsd-3-clause | 2,162 | 0 |
#!/usr/bin/env python
import os
import sys
if __name__ == "__main__":
os.environ.setdefault("DJANGO_SETTINGS_MODULE", "itf.settings")
try:
from django.core.management import execute_from_command_line
except ImportError:
# The above import may fail for some other reason. Ensure that the
... | valasek/taekwondo | manage.py | Python | gpl-3.0 | 801 | 0 |
#!/usr/bin/env python
# Copyright (C) 2006-2016 Music Technology Group - Universitat Pompeu Fabra
#
# This file is part of Essentia
#
# Essentia 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 ... | arseneyr/essentia | test/src/unittest/standard/test_scale.py | Python | agpl-3.0 | 2,054 | 0.003408 |
# PyParticles : Particles simulation in python
# Copyright (C) 2012 Simone Riva
#
# 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 late... | simon-r/PyParticles | pyparticles/pset/rebound_boundary.py | Python | gpl-3.0 | 2,289 | 0.042813 |
#!/usr/bin/python3
from urllib.parse import urlencode
from urllib.request import urlopen, Request
from bs4 import BeautifulSoup
from argparse import ArgumentParser
from threading import Thread
import re
class HackAlunoOnline:
def __init__( self , matricula , full_search = False ):
# Exibicao default de matricula/... | hammurabi13th/haopy | hao.py | Python | mit | 12,161 | 0.068167 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.