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 |
|---|---|---|---|---|---|---|
# This Source Code Form is subject to the terms of the Mozilla Public
# License, v. 2.0. If a copy of the MPL was not distributed with this
# file, You can obtain one at http://mozilla.org/MPL/2.0/.
# Copyright (c) 2017 Mozilla Corporation
from positive_alert_test_case import PositiveAlertTestCase
from negative_alert_... | Phrozyn/MozDef | tests/alerts/test_bruteforce_ssh.py | Python | mpl-2.0 | 7,170 | 0.00265 |
# -*- coding: utf-8 -*-
from __future__ import unicode_literals, print_function, division, absolute_import
from bgfiles.http import create_content_disposition
from django.test import SimpleTestCase
class CreateContentDispositionTest(SimpleTestCase):
def test(self):
header = create_content_disposition('Fu... | climapulse/dj-bgfiles | tests/test_http.py | Python | bsd-3-clause | 1,483 | 0.004752 |
#!/usr/bin/python
# -*- coding: utf-8 -*-
import logging
import requests
from datetime import datetime
from cachetools import LFUCache
from requests_futures.sessions import FuturesSession
import threading
from .utils import get_args
from requests.packages.urllib3.util.retry import Retry
from requests.adapters import H... | pgandev/RocketMap | pogom/webhook.py | Python | agpl-3.0 | 8,054 | 0 |
# Embedded file name: /usr/lib/enigma2/python/Components/NetworkTime.py
from Components.Console import Console
from config import config
from enigma import eTimer, eDVBLocalTimeHandler, eEPGCache
from Tools.StbHardware import setRTCtime
from time import time, ctime
def AutoNTPSync(session = None, **kwargs):
... | kingvuplus/boom2 | lib/python/Components/NetworkTime.py | Python | gpl-2.0 | 1,875 | 0.005867 |
# Copyright (c) 2015, Frappe Technologies Pvt. Ltd. and Contributors
# License: GNU General Public License v3. See license.txt
from __future__ import unicode_literals
import frappe
from frappe.utils import flt, cstr
from frappe import msgprint, _
def execute(filters=None):
if not filters: filters = {}
salary_slip... | mahabuber/erpnext | erpnext/hr/report/monthly_salary_register/monthly_salary_register.py | Python | agpl-3.0 | 4,082 | 0.038707 |
###############################################################################
# Name: vbscript.py #
# Purpose: Define VBScript syntax for highlighting and other features #
# Author: Cody Precord <cprecord@editra.org> #
... | 163gal/Time-Line | libs/wx/tools/Editra/src/syntax/_vbscript.py | Python | gpl-3.0 | 3,982 | 0.004269 |
#!/usr/bin/python
#
# linearize-hashes.py: List blocks in a linear, no-fork version of the chain.
#
# Copyright (c) 2013 The Bitcoin developers
# Distributed under the MIT/X11 software license, see the accompanying
# file COPYING or http://www.opensource.org/licenses/mit-license.php.
#
import json
import st... | TheAltcoinBoard/XAB-withoutSecp256k1 | contrib/linearize/linearize-hashes.py | Python | mit | 2,868 | 0.034519 |
#!/usr/bin/env python
#
# Analyse benchio output files
#
# System modules for grabbing data
import sys
import os.path
import re
from glob import glob
import seaborn as sns
# Modules for analysing and visualising data
import pandas as pd
import numpy as np
import matplotlib
matplotlib.use('Agg')
from matplotlib import... | ARCHER-CSE/parallel-io | benchmark/analysis/analyse_benchio_output.py | Python | gpl-3.0 | 4,610 | 0.014967 |
'''
Usage:
dbInputData.py
dbInputData.py -h | --help
dbInputData.py [--debug] [-i INPUT] [-o FILE]
Options:
-h, --help Shows this menu.
-d, --debug Print debug information. This is the most verbose
option.
-i INPUT Input fi... | admiralspark/NetSpark-Scripts | Example_Scripts/TinyDB/dbInputData.py | Python | gpl-3.0 | 2,573 | 0.002721 |
from scout.parse.variant.rank_score import parse_rank_score
from scout.parse.variant.variant import parse_variant
def test_parse_rank_score():
## GIVEN a rank score string on genmod format
rank_scores_info = "123:10"
variant_score = 10.0
family_id = "123"
## WHEN parsing the rank score
parsed_... | Clinical-Genomics/scout | tests/parse/test_parse_rank_score.py | Python | bsd-3-clause | 1,288 | 0.00854 |
# Copyright 2011-2012 OpenStack Foundation
# 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... | jumpstarter-io/nova | nova/tests/scheduler/test_weights.py | Python | apache-2.0 | 9,359 | 0.000427 |
from __future__ import unicode_literals
from django.apps import AppConfig
class AnnonceConfig(AppConfig):
name = 'annonce'
| firasbenmakhlouf/JobLookup | annonce/apps.py | Python | mit | 130 | 0 |
#
# @BEGIN LICENSE
#
# Psi4: an open-source quantum chemistry software package
#
# Copyright (c) 2007-2022 The Psi4 Developers.
#
# The copyrights for code used from other parties are included in
# the corresponding files.
#
# This file is part of Psi4.
#
# Psi4 is free software; you can redistribute it and/or modify
#... | psi4/psi4 | psi4/driver/p4util/inpsight.py | Python | lgpl-3.0 | 23,279 | 0.016624 |
"""
This module models the host variant call object.
"""
import json
import logging
import os
import string
from cutlass.iHMPSession import iHMPSession
from cutlass.Base import Base
from cutlass.aspera import aspera
from cutlass.Util import *
# pylint: disable=W0703, C1801
# Create a module logger named after the mo... | carze/cutlass | cutlass/HostVariantCall.py | Python | mit | 23,915 | 0.000794 |
def extractSpiritGodShura(item):
"""
# Sousetsuka
"""
vol, chp, frag, postfix = extractVolChapterFragmentPostfix(item['title'])
if not (chp or vol) or 'preview' in item['title'].lower():
return None
if item['title'].startswith('Chapter') and item['tags'] == ['Chapters']:
if ':' in item['title'] and not postfi... | fake-name/ReadableWebProxy | WebMirror/management/rss_parser_funcs/feed_parse_extractSpiritGodShura.py | Python | bsd-3-clause | 484 | 0.024793 |
agenda = []
def pedenome():
return input("Nome: ").replace("#", "$")
def pedetelefone():
return input("Telefone: ").replace("#", "$")
def pedearquivo():
return input("Nome do arquivo: ")
def mostra(nome, telefone):
print(f"Nome: {nome} Telefone: {telefone}")
def pesquisa(nome):
mnome = nom... | laenderoliveira/exerclivropy | cap09/exercicio-09-21.py | Python | mit | 2,962 | 0 |
import pyaf.Bench.TS_datasets as tsds
import tests.artificial.process_artificial_dataset as art
art.process_dataset(N = 32 , FREQ = 'D', seed = 0, trendtype = "Lag1Trend", cycle_length = 12, transform = "None", sigma = 0.0, exog_count = 20, ar_order = 0); | antoinecarme/pyaf | tests/artificial/transf_None/trend_Lag1Trend/cycle_12/ar_/test_artificial_32_None_Lag1Trend_12__20.py | Python | bsd-3-clause | 259 | 0.088803 |
# Copyright 2019 The TensorNetwork Authors
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed ... | google/TensorNetwork | tensornetwork/backends/jax/jax_backend.py | Python | apache-2.0 | 36,454 | 0.004197 |
import numpy as np
import scipy.integrate as integ
import matplotlib.pyplot as plt
from matplotlib import rc
rc('font',**{'family':'sans-serif','sans-serif':['Helvetica']})
rc('text', usetex=True)
import derivs
import gasproperties
import opacity
import loadinitial
import modelparameters
from multiprocessing import Poo... | egentry/stellarstructure | integrate.py | Python | mit | 6,257 | 0.042033 |
'''
Created on Jun 18, 2015
@author: Subhasis
'''
# Replace the following lines with client IDs obtained from the APIs
# Console or Cloud Console.
WEB_CLIENT_ID = '540614338141-drb3g1kcetlp4sbgaj7dfkjci6n5ove5.apps.googleusercontent.com'
ANDROID_CLIENT_ID = 'replace with Android client ID'
IOS_CLIENT_ID = 'replace wit... | SubhasisDutta/NoteBook | settings.py | Python | mit | 370 | 0.002703 |
# This file is part of Archivematica.
#
# Copyright 2010-2013 Artefactual Systems Inc. <http://artefactual.com>
#
# Archivematica 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 ... | sevein/archivematica | src/dashboard/src/components/helpers.py | Python | agpl-3.0 | 13,812 | 0.004634 |
#!/usr/bin/env python
# Copyright 2015 The LUCI Authors. All rights reserved.
# Use of this source code is governed under the Apache License, Version 2.0
# that can be found in the LICENSE file.
import os
import sys
THIS_DIR = os.path.dirname(os.path.abspath(__file__))
sys.path.insert(0, os.path.join(THIS_DIR, '..', ... | luci/luci-py | appengine/components/components/config/run_coverage.py | Python | apache-2.0 | 491 | 0.004073 |
from django.conf.urls import *
urlpatterns = patterns('',
url(r'^debug/', include('tests.urls')),
url(r'^', include('sentry.web.urls')),
)
| primepix/django-sentry | example_project/urls.py | Python | bsd-3-clause | 148 | 0.006757 |
#!/usr/bin/python
import sys
assert len(sys.argv) > 2
with open(sys.argv[1], "w") as out:
for l in sys.argv[2:]:
out.write("# %s\n" % l)
| facebook/buck | test/com/facebook/buck/android/testdata/android_project/native/proguard_gen/generator.py | Python | apache-2.0 | 151 | 0.006623 |
from django.conf.urls import patterns, include, url
handler404 = 'jobs.views.FileNotFound'
urlpatterns = [
url(r'^', include('jobs.urls'))
] | marchchad/GatorApp | gator_dev/urls.py | Python | gpl-2.0 | 146 | 0.006849 |
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django import forms
from django.utils.translation import ugettext_lazy as _
from django.contrib.auth import get_user_model
from django.utils import timezone
from django.template import defaultfilters
from django.conf import settings
from ..core.uti... | alesdotio/Spirit | spirit/user/forms.py | Python | mit | 4,294 | 0.002329 |
from runtests.mpi import MPITest
from nbodykit.lab import *
from nbodykit import setup_logging
from numpy.testing import assert_allclose
import tempfile
import os
@MPITest([1])
def test_hdf(comm):
import h5py
# fake structured array
dset = numpy.empty(1024, dtype=[('Position', ('f8', 3)), ('Mass', 'f8')]... | nickhand/nbodykit | nbodykit/source/catalog/tests/test_file.py | Python | gpl-3.0 | 4,337 | 0.007378 |
# Copyright (c) 2013-2014, Cornell University
# All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions are met:
#
# * Redistributions of source code must retain the above copyright notice,
# this list of ... | pombredanne/HyperDex | bindings/__init__.py | Python | bsd-3-clause | 22,251 | 0.008314 |
""" Code used for running the package directly from the Command Line """
import os.path
import logging
import argparse
import sys
from .db import AvailabilityDB
from .core import AvailabilityInfo
from .reports import ALL_REPORTS
from .settings import get_settings
def run():
# ----------------------... | supernathan23/dn_availability | dn_availability/cli.py | Python | mit | 13,300 | 0.008722 |
"""Base classes for channels."""
import asyncio
from enum import Enum
from functools import wraps
import logging
from typing import Any, Union
import zigpy.exceptions
from homeassistant.core import callback
from .. import typing as zha_typing
from ..const import (
ATTR_ARGS,
ATTR_ATTRIBUTE_ID,
ATTR_ATTR... | tboyce021/home-assistant | homeassistant/components/zha/core/channels/base.py | Python | apache-2.0 | 12,609 | 0.001269 |
class Solution(object):
# Op1: time O(n*log(n)) space O(1)
def hIndex(self, citations):
"""
:type citations: List[int]
:rtype: int
"""
citations.sort(reverse=True)
for i, x in enumerate(citations):
# print(i, x)
if i >= x:
r... | rx2130/Leetcode | python/274 H-Index.py | Python | apache-2.0 | 993 | 0.001007 |
# -*- coding: utf-8 -*-
"""
author: ferris
update: 2015-12-08
function: query from Google Analytics API, using loop to overcome quota of 10,000 records per query.
"""
import argparse
from googleapiclient.discovery import build
from oauth2client.client import SignedJwtAssertionCredentials
import httplib2
from oauth2cli... | ferris-wufei/toolbox | dw/api_ga/api_ga.py | Python | gpl-2.0 | 5,603 | 0.003926 |
#
# 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... | apache/dispatch | tests/system_tests_tcp_adaptor.py | Python | apache-2.0 | 50,963 | 0.002178 |
# -*- coding: utf-8 -*-
"""
Adapter to use Python str.format() to render a template
"""
from __future__ import absolute_import, unicode_literals, print_function
from string import Formatter
# handle py2 and py3 strings without relying on six lib since we don't use it for anything else.
try:
basestring
except Na... | livio/DocDown-Python | docdown/template_adapters/string_format.py | Python | bsd-3-clause | 1,530 | 0.001961 |
#!/usr/bin/env python
# Remove .egg-info directory if it exists, to avoid dependency problems with
# partially-installed packages (20160119/dphiffer) ... | whosonfirst/py-mapzen-whosonfirst-pip-utils | setup.py | Python | bsd-3-clause | 1,676 | 0.004773 |
#!/usr/bin/env python
import cv2
import cv2.cv as cv
class Display:
def setup(self, fullscreen):
cv2.namedWindow('proj_0', cv2.WINDOW_OPENGL)
if fullscreen:
cv2.setWindowProperty('proj_0', cv2.WND_PROP_FULLSCREEN, cv.CV_WINDOW_FULLSCREEN)
def draw(self, image):
... | light-swarm/lightswarm_render | scripts/display.py | Python | mit | 385 | 0.012987 |
from collections import namedtuple
def game():
# 元组拆包
a, b, *rest = range(5)
print(a, b, rest)
a, b, *rest = range(2)
print(a, b, rest)
a, *body, c, d = range(5)
print(a, body, c, d)
*head, b, c, d = range(5)
print(head, b, c, d)
# 具名元组 page_26
City = namedtuple('City',... | hugoxia/Python | FluentPython/chapter_2/sequence.py | Python | mit | 919 | 0 |
#!/usr/bin/env python
from select import poll, POLLIN, POLLHUP
from subprocess import Popen, PIPE
from phpsh import PhpshConfig
import xml.dom.minidom
import signal
import socket
import shlex
import time
import sys
import re
import os
"""This is a DBGp xdebug protocol proxy started by phpsh. It accepts a
connection f... | joshbedo/phpsh | src/dbgp-phpsh.py | Python | bsd-3-clause | 34,783 | 0.004226 |
#!/usr/bin/env python3
import logging
import socket
import sys
from zeroconf import ServiceInfo, Zeroconf, __version__
if __name__ == '__main__':
logging.basicConfig(level=logging.DEBUG)
if len(sys.argv) > 1:
assert sys.argv[1:] == ['--debug']
logging.getLogger('zeroconf').setLevel(logging.DE... | jstasiak/python-zeroconf | examples/self_test.py | Python | lgpl-2.1 | 1,785 | 0.00112 |
# -*- coding: utf-8 -*-
# This file is part of beets.
# Copyright 2016, Adrian Sampson.
#
# 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 t... | bbsan2k/nzbToMedia | libs/beetsplug/lastgenre/__init__.py | Python | gpl-3.0 | 14,453 | 0 |
from django.conf.urls import url
from . import views
from django.views.decorators.cache import cache_page
app_name = 'webinter'
urlpatterns = [
url(r'^$', views.IndexView.as_view(), name='index'),
url(r'^logout/$', views.logout_view, name='logout'),
]
| ipriver/0x71aBot-Web-Interface | webinter/urls.py | Python | mit | 262 | 0 |
# coding=utf-8
# Copyright 2014 Pants project contributors (see CONTRIBUTORS.md).
# Licensed under the Apache License, Version 2.0 (see LICENSE).
from __future__ import (absolute_import, division, generators, nested_scopes, print_function,
unicode_literals, with_statement)
from pants_test.pant... | pombredanne/pants | contrib/scrooge/tests/python/pants_test/contrib/scrooge/tasks/test_scrooge_gen_integration.py | Python | apache-2.0 | 2,191 | 0.007303 |
import torch as t
from torch.autograd import Variable as V
from torch import FloatTensor as FT
import numpy as np
from bayestorch.hmc import HMCSampler
class SimpleTrainer:
def __init__(self, env,critic,hallucinator,policy_buffer,policy_c, noise_dim):
self.env = env
self.hallucinator = hallucinator... | fizz-ml/policybandit | trainer.py | Python | mit | 3,859 | 0.011143 |
import hashlib
import struct
class DNSparam:
"""Class to encapsulate some DNS parameter types (type, class etc)"""
def __init__(self, prefix, name2val):
self.name2val = name2val
self.val2name = dict([(y,x) for (x,y) in name2val.items()])
self.prefix = prefix
self.prefix_offset... | thomasleveil/pydig | pydiglib/dnsparam.py | Python | gpl-2.0 | 3,623 | 0.008556 |
#!/usr/bin/env python
#shallow linguistic kernel
import sys, os
import os.path
import xml.etree.ElementTree as ET
import logging
from optparse import OptionParser
import pickle
import operator
from subprocess import Popen, PIPE
from time import time
#from pandas import DataFrame
import numpy as np
from scipy.stats impo... | AndreLamurias/IBEnt | src/classification/rext/ddi_kernels.py | Python | mit | 23,772 | 0.008287 |
#!/usr/bin/env python
import click
import json
import re
from icinga2_api.api import Api
from icinga2_api import defaults
VALID_ACTIONS = ['create', 'read', 'update', 'delete']
def validate_uri(ctx, param, value):
if not value.startswith('/'):
raise click.BadParameter('should begin with single /')
return va... | saurabh-hirani/icinga2_api | icinga2_api/cmdline.py | Python | isc | 3,123 | 0.012168 |
#This python script is modified from oneyear_data_layer_subset_good.pro
#This routine open one year files defined in file lists, stack these file, subset, and fill bad data with -2000
#input arguments are flist_ndvi, flist_bq, ul_lon,ul_lat,lr_lon,lr_lat
#;inputs: yyyy_flist_ndvi----file list for one year *ndvi.tif,... | gina-alaska/emodis_ndvi_python-docker | emodis_ndvi_python/pycodes/oneyear_data_layer_subset_good.py | Python | mit | 5,054 | 0.033241 |
# -*- coding: utf-8 -*-
#
# This software may be modified and distributed under the terms
# of the MIT license. See the LICENSE file for details.
from __future__ import print_function
from datetime import datetime
from importlib import import_module
from itertools import chain, islice
import sys
import traceback
im... | koendeschacht/python-logstash-async | logstash_async/utils.py | Python | mit | 2,122 | 0.000943 |
# coding=utf-8
# Copyright 2019 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 agreed to ... | google-research/football | gfootball/scenarios/tests/keeper_test.py | Python | apache-2.0 | 1,184 | 0.010135 |
from neolib.plots.Step import Step
from neolib.NST import NST
import time
class HealPetPet(Step):
_paths = {
'links': '//*[@id="content"]/table/tr/td[2]//a/@href',
'img': '//*[@id="content"]/table/tr/td[2]/div/img/@src',
'cert': '//area/@href',
}
_HEALS = {
'http://images... | jmgilman/neolib2 | neolib/plots/altador/steps/HealPetPet.py | Python | gpl-2.0 | 2,736 | 0.001827 |
from django.db import models
from phonenumber_field.modelfields import PhoneNumberField
class PhoneNumber(models.Model):
provider = models.ForeignKey(
to='providers.Provider'
)
phone_number = PhoneNumberField()
| aniruddha-adhikary/bookit | bookit/providers/models/phone_number.py | Python | mit | 235 | 0 |
#!/usr/bin/env python2
from taptaptap.proc import plan, ok, not_ok, out
plan(first=1, last=13)
ok('Starting the program')
ok('Starting the engine')
ok('Find the object')
ok('Grab it', todo=True)
ok('Use it', todo=True)
2 * 2 == 4 and ok('2 * 2 == 4') or not_ok('2 * 2 != 4')
out()
## validity: -1
## ok testc... | meisterluk/taptaptap | tests/proc_005.py | Python | bsd-3-clause | 472 | 0.019068 |
# 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.
import code
import cpp_util
from model import Platforms
from schema_util import CapitalizeFirstLetter
from schema_util import JsFunctionNameToClassName
... | boundarydevices/android_external_chromium_org | tools/json_schema_compiler/cpp_bundle_generator.py | Python | bsd-3-clause | 11,513 | 0.006428 |
#! /usr/bin/env python
# -*- coding: utf-8 -*-
# Law-to-Code -- Extract formulas & parameters from laws
# By: Emmanuel Raviart <emmanuel@raviart.com>
#
# Copyright (C) 2013 OpenFisca Team
# https://github.com/openfisca/LawToCode
#
# This file is part of Law-to-Code.
#
# Law-to-Code is free software; you can redistrib... | openfisca/LawToCode | lawtocode/scripts/harvest_ipp_prelevements_sociaux.py | Python | agpl-3.0 | 11,104 | 0.010558 |
#!/usr/bin/python
# -*- coding: utf-8 -*-
# (c) 2017, Ansible by Red Hat, inc
# 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',
... | e-gob/plataforma-kioscos-autoatencion | scripts/ansible-play/.venv/lib/python2.7/site-packages/ansible/modules/network/layer3/net_l3_interface.py | Python | bsd-3-clause | 2,074 | 0.000964 |
from __future__ import absolute_import, print_function, division
from .. import decorators
def multiply(elems, units, inplace_units=False, unitdict=None, key=None):
"""
Multiply elements considering their units
"""
return operate(elems, units, inplace_units=inplace_units, unitdict=unitdict, key=key, op... | tomchor/pymicra | pymicra/algs/units.py | Python | gpl-3.0 | 7,214 | 0.016912 |
from flask import Blueprint, jsonify, request
from urbansearch.utils import db_utils
relations_api = Blueprint('relations_api', __name__)
@relations_api.route('/document_info', methods=['GET'])
def document_info():
if 'city_a' not in request.args or 'city_b' not in request.args:
return jsonify(status=40... | urbansearchTUD/UrbanSearch | urbansearch/server/relations.py | Python | gpl-3.0 | 807 | 0.001239 |
#!/usr/bin/env python2
import numpy as np
import pdb
from random import sample
from time import time
import heapq
import matplotlib
matplotlib.use('Agg')
from matplotlib import pyplot as plt
import sys, os
from eft_calculator import EFT_calculator, Water
import tools
def load_coordinates(name):
lines = open('test... | yangjincai/Xq2EFT | testAndOutputGrids.py | Python | apache-2.0 | 6,139 | 0.012543 |
# -*- coding: utf-8 -*-
__license__ = "GNU Affero General Public License, Ver.3"
__author__ = "Pablo Alvarez de Sotomayor Posadillo"
# This file is part of Kirinki.
#
# Kirinki 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 ... | i02sopop/Kirinki | kirinki/mainviewer.py | Python | agpl-3.0 | 2,339 | 0.013254 |
from typing import Text
from zerver.lib.test_classes import WebhookTestCase
class HomeAssistantHookTests(WebhookTestCase):
STREAM_NAME = 'homeassistant'
URL_TEMPLATE = "/api/v1/external/homeassistant?&api_key={api_key}"
FIXTURE_DIR_NAME = 'homeassistant'
def test_simplereq(self) -> None:
expe... | mahim97/zulip | zerver/webhooks/homeassistant/tests.py | Python | apache-2.0 | 1,083 | 0.00554 |
###############################################################################
#
# 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... | meejah/AutobahnPython | autobahn/util.py | Python | mit | 24,461 | 0.001431 |
#!/usr/bin/env python3
# imports go here
import threading
#
# Free Coding session for 2015-04-09
# Written by Matt Warren
#
data = threading.local()
def message():
print(data.name)
class Foo(threading.Thread):
def run(self):
data.name = self.getName()
message()
if __name__ == '__main__':
... | mfwarren/FreeCoding | 2015/04/fc_2015_04_09.py | Python | mit | 378 | 0.002646 |
"""Mock helpers for Z-Wave component."""
from pydispatch import dispatcher
from tests.async_mock import MagicMock
def value_changed(value):
"""Fire a value changed."""
dispatcher.send(
MockNetwork.SIGNAL_VALUE_CHANGED,
value=value,
node=value.node,
network=value.node._network,... | sdague/home-assistant | tests/mock/zwave.py | Python | apache-2.0 | 6,380 | 0.00047 |
import re, os
def cmd_install(ensoapi):
seldict = ensoapi.get_selection()
text = seldict.get("text", "").strip()
lines = text.split("\n")
ensoapi.display_message(lines)
return
if len(lines) < 3:
msg = "There was no command to install!"
ensoapi.display_message(msg)
ensoapi.set_selection({
... | curaloucura/Enso-Ubuntu | ensocommands/random.py | Python | bsd-3-clause | 2,893 | 0.023159 |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
from __future__ import (absolute_import, division,
print_function, unicode_literals)
from .dos_plotter import DOSPlotter
__author__ = "Yuji Ikeda"
class TotalDOSPlotter(DOSPlotter):
def load_data(self, data_file='total_dos.dat'):
supe... | yuzie007/ph_plotter | ph_plotter/total_dos_plotter.py | Python | mit | 1,815 | 0.002204 |
# Licensed under a 3-clause BSD style license - see LICENSE.rst
"""
This is an Astropy affiliated package.
"""
# Affiliated packages may add whatever they like to this file, but
# should keep this content at the top.
# ----------------------------------------------------------------------------
from ._astropy_init im... | fred3m/astro-toyz | astrotoyz/__init__.py | Python | bsd-3-clause | 727 | 0.001376 |
class Solution(object):
def wiggleMaxLength(self, nums):
"""
:type nums: List[int]
:rtype: int
"""
if len(nums) < 2: return len(nums)
prev_diff = nums[1] - nums[0]
if prev_diff != 0:
longest = 2
else:
longest = 1
for ... | Mlieou/leetcode_python | leetcode/python/ex_376.py | Python | mit | 570 | 0.007018 |
# -*- coding: utf-8 -*-
# Generated by Django 1.11.5 on 2017-09-19 16:34
from __future__ import unicode_literals
from django.db import migrations, models
import django.db.models.deletion
class Migration(migrations.Migration):
initial = True
dependencies = [
]
operations = [
migrations.Crea... | djangophx/beer-tracker | tracker/migrations/0001_initial.py | Python | mit | 2,278 | 0.003512 |
# Copyright 2015 The TensorFlow Authors. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applica... | tensorflow/tensorboard | tensorboard/compat/tensorflow_stub/tensor_shape.py | Python | apache-2.0 | 34,472 | 0.000754 |
# -*- coding: utf-8 -*-
import fauxfactory
import pytest
from selenium.common.exceptions import NoSuchElementException
import cfme.tests.configure.test_access_control as tac
from cfme.base.login import BaseLoggedInPage
from cfme import test_requirements
from cfme.utils import error
from cfme.utils.blockers import BZ
... | mfalesni/cfme_tests | cfme/tests/services/test_catalog_item.py | Python | gpl-2.0 | 5,757 | 0.001563 |
#!/usr/bin/env python
# Copyright 2015 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... | csilzen/whatdoyousee | python/label/label.py | Python | apache-2.0 | 2,624 | 0.001143 |
# -*- coding: utf-8 -*-
# Form implementation generated from reading ui file 'G:\WorkDir\gas-sensing_resistors\ST_spectrum\ST_2400.ui'
#
# Created: Tue Apr 12 22:50:19 2016
# by: PyQt4 UI code generator 4.11.3
#
# WARNING! All changes made in this file will be lost!
from PyQt4 import QtCore, QtGui
try:
_fro... | cygnushan/measurement | ST_spectrum/Ui_ST_2400.py | Python | mit | 22,827 | 0.002075 |
# -*- coding: utf-8 -*-
# Part of Odoo. See LICENSE file for full copyright and licensing details.
import codecs
import csv
import fnmatch
import inspect
import locale
import os
import openerp.sql_db as sql_db
import re
import logging
import tarfile
import tempfile
import threading
from babel.messages import extract
f... | AyoubZahid/odoo | openerp/tools/translate.py | Python | gpl-3.0 | 48,927 | 0.003352 |
"""Tests for the :mod:`campy.datastructures.basicgraph` module."""
| sredmond/acmpy | tests/datastructures/test_basicgraph.py | Python | mit | 67 | 0 |
# Extra Long Factorials
# Developer: Murillo Grubler
# https://www.hackerrank.com/challenges/extra-long-factorials/problem
# Time Complexity = O(n)
def factorial(n):
if n == 1:
return 1
total = n
while (n > 0):
if n == total:
total = total * (n - 1)
n -= 2
e... | Murillo/Hackerrank-Algorithms | Algorithms/Implementation/extra-long-factorials.py | Python | mit | 437 | 0.006865 |
import functools
def memoize(obj):
cache = obj.cache = {}
@functools.wraps(obj)
def memoizer(*args, **kwargs):
key = (args, tuple(kwargs.items()))
if key not in cache:
cache[key] = obj(*args, **kwargs)
return cache[key]
return memoizer
| GaretJax/i18n-utils | i18n_utils/utils.py | Python | mit | 291 | 0 |
from orm import model
from .user import User
from orm import fields
class Setting(model.Model):
owner = fields.ForeignKeyField(User)
company_name = fields.CharField(max_length=140, blank=True)
address = fields.CharField(max_length=240, blank=True)
zip_code = fields.CharField(max_length=140, blank=True)
city = fie... | theikkila/lopputili | app/models/setting.py | Python | mit | 685 | 0.020438 |
# -*- coding: utf-8 -*-
#########################################################################
#
# Copyright (C) 2016 OSGeo
#
# 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 ... | mcldev/geonode | geonode/security/views.py | Python | gpl-3.0 | 9,784 | 0.001124 |
#!/usr/bin/env python
# Copyright (c) 2013-2014 ZUYD Research
# All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions are met:
#
# * Redistributions of source code must retain the above copyright
# notice, this li... | robertjacobs/zuros | zuros_deliberator/zuros_command_to_robot_sender/src/zuros_command_to_robot_sender.py | Python | mit | 6,086 | 0.006408 |
from setuptools import setup
import os
here = os.path.abspath(os.path.dirname(__file__))
README = open(os.path.join(here, 'README.rst')).read()
version = "1.0b3"
setup(
version=version,
description="A plugin for ploy providing support for OpenVZ containers.",
long_description=README + "\n\n",
name... | ployground/ploy_openvz | setup.py | Python | bsd-3-clause | 1,066 | 0 |
# -*- coding: utf-8 -*-
class Company(object):
def __init__(self, name=None, code=None, phone=None, digit=None):
# Company's name
self.name = name
# Codename
self.code = code
# The digit of the invoice number
if digit is None:
digit = []
self.dig... | iBluemind/armatis | armatis/models.py | Python | bsd-2-clause | 2,596 | 0 |
# Copyright 2019-2020 by Christopher C. Little.
# This file is part of Abydos.
#
# Abydos 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 versio... | chrislit/abydos | abydos/distance/_ssk.py | Python | gpl-3.0 | 4,880 | 0 |
from flask import request
from sqlalchemy.dialects.postgresql import array_agg
from zeus.config import db
from zeus.constants import Result
from zeus.db.func import array_agg_row
from zeus.models import Job, TestCase, Revision
from zeus.utils.builds import fetch_build_for_revision
from .base_revision import BaseRevis... | getsentry/zeus | zeus/api/resources/revision_tests.py | Python | apache-2.0 | 1,984 | 0.002016 |
# DExTer : Debugging Experience Tester
# ~~~~~~ ~ ~~ ~ ~~
#
# Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
# See https://llvm.org/LICENSE.txt for license information.
# SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
"""Set of data classes for representing th... | endlessm/chromium-browser | third_party/llvm/debuginfo-tests/dexter/dex/dextIR/ProgramState.py | Python | bsd-3-clause | 3,820 | 0.000785 |
# -*- coding: utf-8 -*-
# Generated by Django 1.10.2 on 2016-11-17 03:03
from __future__ import unicode_literals
from django.db import migrations
import tinymce.models
class Migration(migrations.Migration):
dependencies = [
('ojp', '0004_problem_num_of_correct_tries'),
]
operations = [
... | harshkothari410/ocportal | ojp/migrations/0005_auto_20161117_0303.py | Python | mit | 493 | 0 |
from kombu.tests.utils import unittest
from kombu.transport.virtual import exchange
from kombu.tests.mocks import Channel
class ExchangeCase(unittest.TestCase):
type = None
def setUp(self):
if self.type:
self.e = self.type(Channel())
class test_Direct(ExchangeCase):
type = exchang... | pantheon-systems/kombu | kombu/tests/test_virtual_exchange.py | Python | bsd-3-clause | 3,747 | 0.000801 |
###############################################################################
#
# Tests for XlsxWriter.
#
# SPDX-License-Identifier: BSD-2-Clause
# Copyright (c), 2013-2022, John McNamara, jmcnamara@cpan.org
#
from ..excel_comparison_test import ExcelComparisonTest
from ...workbook import Workbook
class TestCompar... | jmcnamara/XlsxWriter | xlsxwriter/test/comparison/test_textbox15.py | Python | bsd-2-clause | 900 | 0 |
from os.path import dirname
from os import listdir
path = dirname(__file__)
i = path.find(".zip")
if i == -1: # OS X app or unpacked python files
__all__ = [p[:-3] for p in listdir(path) if p.endswith(".py") and p != "__init__.py"]
del p
else: # Windows binary ziped .pyc files
import zipfile
__all__... | chrmoritz/zoxel | src/plugins/__init__.py | Python | gpl-3.0 | 547 | 0.003656 |
#!/usr/bin/python
# -*- coding: utf-8 -*-
# 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',
'status': ['preview'],
... | wrouesnel/ansible | lib/ansible/modules/network/aci/aci_epg_monitoring_policy.py | Python | gpl-3.0 | 6,703 | 0.00179 |
# 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... | tqchen/tvm | python/tvm/relay/frontend/tflite.py | Python | apache-2.0 | 137,911 | 0.001581 |
# coding=utf-8
# --------------------------------------------------------------------------
# Copyright (c) Microsoft Corporation. All rights reserved.
# Licensed under the MIT License. See License.txt in the project root for
# license information.
#
# Code generated by Microsoft (R) AutoRest Code Generator.
# Changes ... | SUSE/azure-sdk-for-python | azure-mgmt-network/azure/mgmt/network/v2017_03_01/operations/virtual_network_gateways_operations.py | Python | mit | 36,131 | 0.002353 |
# Copyright (C) 2017 Google Inc.
# Licensed under http://www.apache.org/licenses/LICENSE-2.0 <see LICENSE file>
"""Mixins to add common attributes and relationships. Note, all model classes
must also inherit from ``db.Model``. For example:
color
color
..
class Market(BusinessObject, db.Model):
__tablena... | AleksNeStu/ggrc-core | src/ggrc/models/mixins/__init__.py | Python | apache-2.0 | 26,526 | 0.010631 |
"""Parse the biothings schema"""
from .config import BIOTHINGS_SCHEMA_URL, PREFIX_TO_REMOVE
from .utils.dataload import load_json_or_yaml
from .utils.common import remove_prefix
class SchemaParser():
def __init__(self):
self.schema_json = remove_prefix(load_json_or_yaml(BIOTHINGS_SCHEMA_URL),
... | biothings/biothings_explorer | biothings_explorer/_deprecated_schema_parser.py | Python | apache-2.0 | 1,071 | 0.003735 |
'''
Precondition
successfully pass a users test.
'''
from datetime import datetime, timedelta
import time
import pytest
import requests
from kii import AccountType, exceptions as exc, results as rs
from kii.data import BucketType, clauses as cl
from tests.conf import (
get_env,
get_api_with_test_user,
... | ta2xeo/python3-kii | tests/test_data/application/test_application_scope_data.py | Python | mit | 13,511 | 0.00037 |
import dnest4.classic as dn4
from pylab import *
plt.rcParams["font.family"] = "serif"
plt.rcParams["font.size"] = 16
plt.rc("text", usetex=True)
data = loadtxt('galaxies.txt')
posterior_sample = atleast_2d(dn4.my_loadtxt('posterior_sample.txt'))
x = linspace(0., 50.0, 10001)
def mixture(x, params):
N = int(para... | eggplantbren/DNest4 | code/Examples/RJObject_1DMixture/display.py | Python | mit | 1,414 | 0.004243 |
#! /usr/bin/env python2
import sys, os
import flickrapi
import xml.etree.ElementTree
if len(sys.argv) < 2:
sys.stderr.write("usage: %s <filename> ..." % sys.argv[0])
sys.exit(1)
def auth():
api_key = "87af34fe62dafd3c5d6d4959ca92c193"
api_secret = "18ecfc909af569af"
flickr = flickrapi.FlickrAPI(api_k... | juantascon/flickr_mass_upload | flickr_mass_upload.py | Python | gpl-3.0 | 1,220 | 0.009836 |
# -*- coding: utf-8 -*-
# © 2016 Comunitea
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl).
{
"name": "Order scheduled shipment",
"summary": "Sale order with scheduled shipment",
"version": "8.0.1.0.0",
"category": "Connector",
"author": "Nadia Ferreyra",
"license": "AGPL-3",
... | jgmanzanas/CMNT_004_15 | project-addons/scheduled_shipment/__openerp__.py | Python | agpl-3.0 | 566 | 0 |
#!/usr/bin/env python
import sys
import os
import unittest
import zlib
import rospy
from flexbe_onboard.flexbe_onboard import FlexbeOnboard
from flexbe_core.proxy import ProxySubscriberCached
from flexbe_msgs.msg import BehaviorSelection, BEStatus, BehaviorLog, BehaviorModification
class TestOnboard(unittest.TestCa... | team-vigir/flexbe_behavior_engine | flexbe_onboard/test/test_onboard.py | Python | bsd-3-clause | 4,765 | 0.001259 |
from django import forms
from django.utils.translation import ugettext_lazy as _
from registration.models import UserModel
from models import User as AccountsUser
class UserRegistrationForm(forms.Form):
"""
Form for registering a new user account.
Validates that the requested username is not already in u... | hds-lab/dsechatweb | dsechat/apps/accounts/forms.py | Python | mit | 4,148 | 0.002652 |
# This file is part of the Frescobaldi project, http://www.frescobaldi.org/
#
# Copyright (c) 2008 - 2014 by Wilbert Berendsen
#
# 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
... | anthonyfok/frescobaldi | frescobaldi_app/fileinfo.py | Python | gpl-2.0 | 6,388 | 0.004383 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.