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 |
|---|---|---|---|---|---|---|
from GIDEON.ml.ml_utilties import *
_run_types = ['production', 'diagnostics']
_load_types = [True, False]
class ActionModeler:
def __init__(self):
self._raw_features, self._target = load_action_data()
def run_diagnostics(self, save=True):
d = lambda x: ' ' if save else ' not '
print... | rickyschools/JARVIS | ml/learners.py | Python | mit | 1,120 | 0.001786 |
"""empty message
Revision ID: 2ddfab3c6533
Revises: 2214f33d3a7b
Create Date: 2016-01-28 12:01:06.774836
"""
# revision identifiers, used by Alembic.
revision = '2ddfab3c6533'
down_revision = '2214f33d3a7b'
from alembic import op
import sqlalchemy as sa
def upgrade():
### commands auto generated by Alembic - ... | uwcirg/true_nth_usa_portal | portal/migrations/versions/2ddfab3c6533_.py | Python | bsd-3-clause | 756 | 0.007937 |
# Copyright 2013-2021 Lawrence Livermore National Security, LLC and other
# Spack Project Developers. See the top-level COPYRIGHT file for details.
#
# SPDX-License-Identifier: (Apache-2.0 OR MIT)
from spack import *
class Dust(Package):
"""du + rust = dust. Like du but more intuitive."""
homepage = "https:... | LLNL/spack | var/spack/repos/builtin/packages/dust/package.py | Python | lgpl-2.1 | 1,546 | 0.001294 |
#-*- coding: utf-8 -*-
class Hash():
def __init__(self):
self.size = 20
self.slots = []
for i in xrange(0, 20):
self.slots.append([])
def __setitem__(self, key, value):
chain = self.slots[self.hash(key)]
for data in chain:
if data[0] == key:
... | livoras/py-algorithm | searching/hash-chain.py | Python | mit | 1,550 | 0.002581 |
# -*- coding: utf-8 -*-
"""
tests.contrib
~~~~~~~~~~~~~~~~~~~~~~~~~~
Tests the contrib modules.
:copyright: (c) 2014 by Armin Ronacher.
:license: BSD, see LICENSE for more details.
"""
| pjknkda/werkzeug | tests/contrib/__init__.py | Python | bsd-3-clause | 207 | 0 |
#!/usr/bin/env python
#-*- coding: ascii -*-
from __future__ import print_function
import sys
from blib_util import *
def build_kfont(build_info):
for compiler_info in build_info.compilers:
build_a_project("kfont", "kfont", build_info, compiler_info, True)
if __name__ == "__main__":
cfg = cfg_from_ar... | zhangf911/KlayGE | build_kfont.py | Python | gpl-2.0 | 435 | 0.02069 |
import os
import re
import logging
from picrename.prnm import fileops
class DateStrError(Exception):
pass
def exif_to_datetimestr(exif_data_string):
"""
Extracts the date from an EXIF tag and reformats it
"""
dateregex = re.compile(r"""
(?P<year>\d\d\d\d): # match the year
... | huegli/automation | picrename/picrename/prnm/renops.py | Python | mit | 8,392 | 0.002741 |
"""
Example OAuthenticator to use with My Service
"""
import json
from jupyterhub.auth import LocalAuthenticator
from oauthenticator.oauth2 import OAuthLoginHandler, OAuthenticator
from tornado.auth import OAuth2Mixin
from tornado.httputil import url_concat
from tornado.httpclient import HTTPRequest, AsyncHTTPClient... | minrk/oauthenticator | docs/source/example-oauthenticator.py | Python | bsd-3-clause | 3,918 | 0.00051 |
import logging # Provides access to logging api.
import smtplib
class EmailController:
def __init__(self, username, password, server, port, sender_name):
self.logger = logging.getLogger(__name__)
self.username = username
self.password = password
self.server = server
self.p... | MingoDynasty/FoscamSort | EmailController.py | Python | mit | 1,372 | 0 |
from cgi import escape
import gzip as gzip_module
import re
import time
import types
import uuid
from cStringIO import StringIO
def resolve_content(response):
rv = "".join(item for item in response.iter_content())
if type(rv) == unicode:
rv = rv.encode(response.encoding)
return rv
class Pipeline... | kaksmet/servo | tests/wpt/web-platform-tests/tools/wptserve/wptserve/pipes.py | Python | mpl-2.0 | 13,913 | 0.000934 |
# -*- coding: utf-8 -*-
# Zeobuilder is an extensible GUI-toolkit for molecular model construction.
# Copyright (C) 2007 - 2012 Toon Verstraelen <Toon.Verstraelen@UGent.be>, Center
# for Molecular Modeling (CMM), Ghent University, Ghent, Belgium; all rights
# reserved unless otherwise stated.
#
# This file is part of Z... | molmod/zeobuilder | zeobuilder/gui/fields/__init__.py | Python | gpl-3.0 | 1,515 | 0.00264 |
#!/usr/bin/env python
from distutils.core import setup
setup(name='runBucket',
version='1.0.0',
license='LGPLv3',
author='Dylan Telford',
author_email='dylantelford@gmail.com',
url='https://github.com/ubccr/student-projects/tree/dtelford/dtelford/xmlScripts',
packages=['runBucket']... | dylantelford/ccr-summer-internship | xmlBuckets/setup.py | Python | lgpl-3.0 | 395 | 0.005063 |
# -*- coding: utf-8 -*-
# Form implementation generated from reading ui file 'poi_dialog_base.ui'
#
# Created by: PyQt5 UI code generator 5.5.1
#
# WARNING! All changes made in this file will be lost!
from PyQt5 import QtCore, QtGui, QtWidgets
class Ui_Dialog(object):
def setupUi(self, Dialog):
Dialog.se... | IZSVenezie/VetEpiGIS-Tool | plugin/poi_dialog.py | Python | gpl-2.0 | 6,037 | 0.003313 |
import os
import unittest
from vsg.rules import type_definition
from vsg import vhdlFile
from vsg.tests import utils
sTestDir = os.path.dirname(__file__)
lFile, eError =vhdlFile.utils.read_vhdlfile(os.path.join(sTestDir,'rule_006_test_input.vhd'))
lExpected = []
lExpected.append('')
utils.read_file(os.path.join(sT... | jeremiah-c-leary/vhdl-style-guide | vsg/tests/type_definition/test_rule_006.py | Python | gpl-3.0 | 1,173 | 0.004263 |
from __future__ import print_function, absolute_import, division
import sys
import click
CONTEXT_SETTINGS = dict(help_option_names=['-h', '--help'])
import ec2hosts
def main():
try:
cli(obj={})
except Exception as e:
import traceback
click.echo(traceback.format_exc(), err=True)
... | danielfrg/ec2hosts | ec2hosts/cli.py | Python | apache-2.0 | 1,208 | 0.001656 |
import wx # type: ignore
from gooey.gui import formatters
from gooey.gui.components.widgets.bases import TextContainer
from gooey.python_bindings import types as t
class Slider(TextContainer):
"""
An integer input field
"""
widget_class = wx.Slider
def getWidget(self, *args, **options):
... | chriskiehl/Gooey | gooey/gui/components/widgets/slider.py | Python | mit | 1,260 | 0.001587 |
# Filter EnergyPlus Construction
#
# Honeybee: A Plugin for Environmental Analysis (GPL) started by Mostapha Sadeghipour Roudsari
#
# This file is part of Honeybee.
#
# Copyright (c) 2013-2020, Mostapha Sadeghipour Roudsari <mostapha@ladybug.tools>
# Honeybee is free software; you can redistribute it and/or modify
... | mostaphaRoudsari/Honeybee | src/Honeybee_Search EP Construction.py | Python | gpl-3.0 | 4,389 | 0.016405 |
# -*- coding: iso-8859-1 -*-
import pyjd
#Ui components
from pyjamas.ui.VerticalPanel import VerticalPanel
from pyjamas.ui.FlowPanel import FlowPanel
from pyjamas.ui.RootPanel import RootPanel
from pyjamas.ui.Label import Label
from pyjamas.ui.Image import Image
from pyjamas.ui.SimplePanel import SimplePanel
from py... | minghuascode/pyj | examples/flowpanel/FlowPanel.py | Python | apache-2.0 | 1,863 | 0.010735 |
import argparse
import glob
import hashlib
import json
import os
IRMAS_INDEX_PATH = '../mirdata/indexes/irmas_index.json'
def md5(file_path):
"""Get md5 hash of a file.
Parameters
----------
file_path: str
File path.
Returns
-------
md5_hash: str
md5 hash of data in file_... | mir-dataset-loaders/mirdata | scripts/legacy/make_irmas_index.py | Python | bsd-3-clause | 6,590 | 0.002276 |
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
# @Author: Gillett Hernandez
# @Date: 2016-07-14 17:06:40
# @Last Modified by: Gillett Hernandez
# @Last Modified time: 2017-08-10 12:39:06
from euler_funcs import timed
def count_routes(n):
result = 1
for i in range(1, n+1):
result = ((n+i) * result... | gillett-hernandez/project-euler | Python/problem_15.py | Python | mit | 433 | 0.006928 |
# 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)
import glob
import o... | sameerparekh/pants | tests/python/pants_test/backend/python/tasks/test_pytest_run.py | Python | apache-2.0 | 12,057 | 0.00423 |
from time import time
mx = 2 * 10 ** 7
t = time()
absloop = []
for n in range(mx):
absloop.append(abs(n))
print('for loop: {:.4f} s'.format(time() - t))
t = time()
abslist = [abs(n) for n in range(mx)]
print('list comprehension: {:.4f} s'.format(time() - t))
t = time()
absmap = list(map(abs, range(mx)))
print('... | mkhuthir/learnPython | Book_learning-python-r1.1/ch5/performances.map.py | Python | mit | 392 | 0 |
# 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... | annarev/tensorflow | tensorflow/python/kernel_tests/lrn_op_test.py | Python | apache-2.0 | 5,781 | 0.010552 |
#!/usr/bin/env python
import csv
import sys
import json
import hashlib
from subprocess import Popen, PIPE
from urlparse import urlparse
DEFAULT_GROUP = "lastpass-import"
class Record:
def __init__(self, d):
self.d = d
self.password = d['password']
if d['grouping'] in [None, "", "(none)... | itorres/junk-drawer | 2015/lp2pass.py | Python | unlicense | 2,627 | 0.000761 |
import re
import logging
import csv
import os
from StringIO import StringIO
from projects.exceptions import ProjectImportError
from vcs_support.backends.github import GithubContributionBackend
from vcs_support.base import BaseVCS, VCSVersion
log = logging.getLogger(__name__)
class Backend(BaseVCS):
supports_tag... | dirn/readthedocs.org | readthedocs/vcs_support/backends/git.py | Python | mit | 6,947 | 0.00072 |
import re
import os
import urllib.request
import tweepy
import json
import time
def tweet_ip():
IPTweet().do_update()
return
class IPTweet(object):
def __init__(self):
self.__location__ = os.path.realpath(os.path.join(
os.getcwd(), os.path.dirname(__file__)
))
def get... | p2j/ip_tweet | iptweet.py | Python | mit | 2,893 | 0.001728 |
# -*- coding: utf-8 -*-
import scrapy
class QuotesSpider(scrapy.Spider):
name = 'quotes'
allowed_domains = ['quotes.topscrape.com/tag/humor/']
start_urls = ['http://quotes.topscrape.com/tag/humor/']
def parse(self, response):
for quote in response.css('div.quote'):
yield {
... | MegaWale/python-playb0x | scrapy/scrapyPlay/properties/properties/spiders/quotes.py | Python | mpl-2.0 | 641 | 0 |
import osgtest.library.core as core
import osgtest.library.files as files
import osgtest.library.osgunittest as osgunittest
class TestLcMaps(osgunittest.OSGTestCase):
required_rpms = ['lcmaps', 'lcmaps-db-templates', 'vo-client', 'vo-client-lcmaps-voms']
def test_01_configure(self):
core.config['lcma... | efajardo/osg-test | osgtest/tests/test_140_lcmaps.py | Python | apache-2.0 | 1,373 | 0.002185 |
import webbrowser
import platform
def get_version():
version = platform.python_version()
if len(version) != 3: # This is to exclude minor versions.
version = version[0:3]
return version
def open_doc(url):
webbrowser.open(url)
def open_library():
version = get_version()
url = "http... | bittercode/pyrrhic-ree | modules/onlineDocs.py | Python | gpl-2.0 | 530 | 0 |
# vim: tabstop=4 shiftwidth=4 softtabstop=4
# Copyright 2012, Nachi Ueno, NTT MCL, 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... | yamt/neutron | quantum/tests/unit/metaplugin/test_metaplugin.py | Python | apache-2.0 | 13,773 | 0.000073 |
# -*- coding: utf-8 -*-
from nuka.hosts import DockerContainer
from nuka.tasks import shell
import nuka
host = DockerContainer(hostname='debian', image='bearstech/nukai')
async def my_tasks(host):
await shell.shell('whoami')
nuka.run(my_tasks(host))
| bearstech/nuka | examples/docker_container.py | Python | gpl-3.0 | 258 | 0 |
from shortuuid.main import (
encode,
decode,
uuid,
random,
get_alphabet,
set_alphabet,
ShortUUID,
)
| devs1991/test_edx_docmode | venv/lib/python2.7/site-packages/shortuuid/__init__.py | Python | agpl-3.0 | 128 | 0 |
"""Schedule models.
Much of this module is derived from the work of Eldarion on the
`Symposion <https://github.com/pinax/symposion>`_ project.
Copyright (c) 2010-2014, Eldarion, Inc. and contributors
All rights reserved.
Redistribution and use in source and binary forms, with or without modification,
are permitted p... | djds23/pygotham-1 | pygotham/schedule/models.py | Python | bsd-3-clause | 7,610 | 0.000263 |
from msw.models import Page, RichText, MembersPostUser, MembersPostText
from django.contrib import admin
# could add more complicated stuff here consult:
# tutorial: https://docs.djangoproject.com/en/dev/intro/tutorial02/#enter-the-admin-site
# tutorial finished admin.py: https://github.com/haoqili/Django-Tutori... | haoqili/MozSecWorld | apps/msw/admin.py | Python | bsd-3-clause | 504 | 0.003968 |
"""
test_consistent_hash_ring.py
~~~~~~~~~~~~
Tests that PersistenceEngine's put, get, delete methods raise the correct error codes.
Run tests with:
clear; python -m unittest discover -v
"""
import unittest
import consistent_hash_ring
import util
import random
class TestSequenceFunctions(unittes... | samuelwu90/PynamoDB | tests/test_consistent_hash_ring.py | Python | mit | 2,081 | 0.004805 |
# -*- encoding: utf-8 -*-
##############################################################################
#
# OpenERP, Open Source Management Solution
# Copyright (c) 2010 kazacube (http://kazacube.com).
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU ... | diogocs1/comps | web/addons/l10n_ma/__openerp__.py | Python | apache-2.0 | 2,154 | 0.004669 |
""" EXP4.P: An extention to exponential-weight algorithm for exploration and
exploitation. This module contains a class that implements EXP4.P, a contextual
bandit algorithm with expert advice.
"""
import logging
import six
from six.moves import zip
import numpy as np
from striatum.bandit.bandit import BaseBandit
L... | ntucllab/striatum | striatum/bandit/exp4p.py | Python | bsd-2-clause | 6,781 | 0 |
# -*- coding: utf-8 -*-
'''
This example demonstrates the skosprovider API with a simple
DictionaryProvider containing just three items.
'''
from pyld import jsonld
import json
from skosprovider.providers import DictionaryProvider
from skosprovider.uri import UriPatternGenerator
from skosprovider.skos import ConceptS... | koenedaele/skosprovider | examples/dump_jsonld.py | Python | mit | 3,074 | 0.000976 |
import xml.sax
import xml.sax.handler
import types
try:
_StringTypes = [types.StringType, types.UnicodeType]
except AttributeError:
_StringTypes = [types.StringType]
START_ELEMENT = "START_ELEMENT"
END_ELEMENT = "END_ELEMENT"
COMMENT = "COMMENT"
START_DOCUMENT = "START_DOCUMENT"
END_DOCUMENT = "END_DOCUMENT"
... | MalloyPower/parsing-python | front-end/testsuite-python-lib/Python-2.1/Lib/xml/dom/pulldom.py | Python | mit | 10,143 | 0.001577 |
# -*- coding: utf-8 -*-
#
# Copyright (C) 2007-2009 Christopher Lenz
# All rights reserved.
#
# This software is licensed as described in the file COPYING, which
# you should have received as part of this distribution.
from decimal import Decimal
import doctest
import unittest
from couchdb import design, mapping
from... | Roger/couchdb-python | couchdb/tests/mapping.py | Python | bsd-3-clause | 12,137 | 0.001813 |
#!/usr/bin/env python
import argparse
import sys
import time
import traceback
from jira.client import JIRA
from jira.exceptions import JIRAError
from fogbugz import FogBugz
from fogbugz import FogBugzLogonError, FogBugzConnectionError
RECENTLY_ADDED_CASES = {}
FOGBUGZ_FIELDS = ('ixBug,ixPersonAssignedTo,ixPersonEdite... | iserko/jira2fogbugz | src/jira2fogbugz/__init__.py | Python | mit | 8,941 | 0.002461 |
# Copyright (c) 2015 by Tegile Systems, 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
#
# Unle... | Nexenta/cinder | cinder/tests/unit/volume/drivers/test_tegile.py | Python | apache-2.0 | 18,078 | 0 |
"""
Virtualization test utility functions.
:copyright: 2008-2009 Red Hat Inc.
"""
import time
import string
import random
import socket
import os
import stat
import signal
import re
import logging
import commands
import fcntl
import sys
import inspect
import tarfile
import shutil
import getpass
import ctypes
from aut... | chuanchang/tp-libvirt | virttest/utils_misc.py | Python | gpl-2.0 | 81,782 | 0.000648 |
# -*- coding: utf-8 -*-
import datetime
from south.db import db
from south.v2 import SchemaMigration
from django.db import models
class Migration(SchemaMigration):
def forwards(self, orm):
# Adding field 'BaseIndieRentalProduct.brand'
db.add_column('products_baseindierentalproduct', 'brand',
... | blorenz/indie-film-rentals | indiefilmrentals/products/migrations/0006_auto__add_field_baseindierentalproduct_brand.py | Python | bsd-3-clause | 6,372 | 0.006591 |
"""
Django settings for schedulesite project.
For more information on this file, see
https://docs.djangoproject.com/en/1.6/topics/settings/
For the full list of settings and their values, see
https://docs.djangoproject.com/en/1.6/ref/settings/
"""
# Build paths inside the project like this: os.path.join(BASE_DIR, ..... | futurice/schedule | schedulesite/schedulesite/settings.py | Python | bsd-3-clause | 5,140 | 0.000973 |
from setuptools import setup, find_packages
from codecs import open
from os import path
here = path.abspath(path.dirname(__file__))
# Get the long description from the README file
with open(path.join(here, 'README.md'), encoding='utf-8') as f:
long_description = f.read()
setup(
name='funfolding',
version... | mbrner/funfolding | setup.py | Python | mit | 1,277 | 0 |
passwort = "geheim"
fehlversuche = 0
while True:
user_input = raw_input("Passwort eingeben:\n")
if user_input == passwort:
print "Hello User!"
break
else:
fehlversuche += 1
print "Fehlversuche:", fehlversuche
if fehlversuche == 3:
print "Zu viele Fehlversuche"
... | gkabbe/Python-Kurs2015 | Lösungen/Woche1/password.py | Python | gpl-2.0 | 341 | 0.002933 |
import logging
import os
import numpy as np
import pandas as pd
from tardis.plasma.properties.base import (PreviousIterationProperty,
ProcessingPlasmaProperty)
from tardis.plasma.properties import PhiSahaNebular, PhiSahaLTE
__all__ = ['PreviousElectronDensities', 'PreviousB... | utkbansal/tardis | tardis/plasma/properties/nlte.py | Python | bsd-3-clause | 9,723 | 0.007199 |
import numpy as np
try:
import mpmath # type: ignore[import]
except ImportError:
pass
def mpmath_wrightomega(x):
return mpmath.lambertw(mpmath.exp(x), mpmath.mpf('-0.5'))
def wrightomega_series_error(x):
series = x
desired = mpmath_wrightomega(x)
return abs(series - desired) / desired
de... | nmayorov/scipy | scipy/special/_precompute/wrightomega.py | Python | bsd-3-clause | 979 | 0 |
# Copyright 2017 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... | frreiss/tensorflow-fred | tensorflow/python/autograph/converters/return_statements_test.py | Python | apache-2.0 | 5,879 | 0.012587 |
"""
Distance Between Two Surfaces
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Compute the average thickness between two surfaces.
For example, you might have two surfaces that represent the boundaries of
lithological layers in a subsurface geological model and you want to know the
average thickness of a unit between those boundari... | akaszynski/vtkInterface | examples/01-filter/distance-between-surfaces.py | Python | mit | 3,157 | 0.001901 |
import numpy as np
import matplotlib.pyplot as plt
from .utils import rotate_point, bin_pix2arcmin, get_bkg_exp
from .messages import ErrorMessages
from .image import Image
class Region(object):
def get_bin_vals(self, counts_img, bkg_img,
exp_img, pixels_in_bin, only_net_cts=False):
"""Calculate ... | gogrean/SurfFit | pyxel/prof.py | Python | gpl-3.0 | 13,240 | 0.002115 |
from coffin.template.response import TemplateResponse
from django.contrib.auth.decorators import login_required
from django.shortcuts import get_object_or_404, redirect
from .forms import FlingReceiverAddForm, FlingReceiverEditForm
from .models import FlingReceiver
def root(request, template_name='root.html'):
r... | frol/Fling-receiver | apps/fling_receiver/views.py | Python | mit | 2,528 | 0.007516 |
# -*- coding: utf8 -*-
"""
Some utils
"""
from __future__ import absolute_import, division, print_function
from .config_arg_parser import ConfigArgParser
from .lazy_helper import LazyHelper
from .lazy_helper_wrapper import LazyHelperWrapper
from .log_meta import LogMeta
from .log_settings import LogSetting
from... | w495/python-video-shot-detector | shot_detector/utils/__init__.py | Python | bsd-3-clause | 348 | 0 |
"""pyaiot messaging test module."""
import json
from pytest import mark
from pyaiot.common.messaging import Message
@mark.parametrize('message', [1234, "test", "àéèïôû"])
def test_serialize(message):
serialized = Message.serialize(message)
assert serialized == json.dumps(message, ensure_ascii=False)
def ... | pyaiot/pyaiot | pyaiot/tests/test_messaging.py | Python | bsd-3-clause | 2,476 | 0 |
#name:make_figures.py
#author:Will Barnes
#Description: make some figures useful to notes on AIA response functions
import numpy as np
import matplotlib.pyplot as plt
import seaborn.apionly as sns
def display_aia_response_control_flow():
"""Show the control flow of the IDL programs used to compute AIA response fu... | wtbarnes/aia_response | make_figures.py | Python | mit | 2,177 | 0.034451 |
# Copyright 2016 Nicolas Bessi, Camptocamp SA
# Copyright 2018 Aitor Bouzas <aitor.bouzas@adaptivecity.com>
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl).
from odoo import api, fields, models
class ResCityZip(models.Model):
"""City/locations completion object"""
_name = "res.city.zip"
_... | syci/partner-contact | base_location/models/res_city_zip.py | Python | agpl-3.0 | 1,353 | 0 |
# Copyright (C) 2012-2015 Codethink Limited
#
# 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; version 2 of the License.
#
# This program is distributed in the hope that it will be useful,
# but ... | nuxeh/morph | morphlib/localrepocache_tests.py | Python | gpl-2.0 | 6,502 | 0 |
from PyQt4 import QtCore, QtGui
import os
class ConfigPage(QtGui.QWizardPage):
def __init__(self, templates, parent=None):
super(ConfigPage, self).__init__(parent)
#self.setTitle("Configuration")
#self.setSubTitle("Alter configuration and build your own platform.")
#self.setPixmap(... | hoangt/core | core/tools/generator/wizard/config.py | Python | agpl-3.0 | 2,087 | 0.008146 |
"""
====================================================
Imputing missing values before building an estimator
====================================================
Missing values can be replaced by the mean, the median or the most frequent
value using the basic :class:`sklearn.impute.SimpleImputer`.
The median is a mor... | chrsrds/scikit-learn | examples/impute/plot_missing_values.py | Python | bsd-3-clause | 5,503 | 0.001454 |
#coding=utf8
import os, sys
from PIL import Image
from PIL import ImageFile
import glob
output_dir = "resized_images"
def main():
# 找出路徑下全部的圖片檔案
types = ('*.png', '*.jpg', '*.jpeg' ,'*.bmp' ,'*.gif') # the tuple of file types
all_image_files = []
for files in types:
all_image_files.extend(gl... | twtrubiks/pillow-examples | resizePicture/resize.py | Python | mit | 2,818 | 0.021127 |
# -*- coding: utf-8 -*-
from pyload.plugin.internal.SimpleCrypter import SimpleCrypter
class MegaRapidCz(SimpleCrypter):
__name = "MegaRapidCz"
__type = "crypter"
__version = "0.02"
__pattern = r'http://(?:www\.)?(share|mega)rapid\.cz/slozka/\d+/\w+'
__config = [("use_premium" , "bo... | ardi69/pyload-0.4.10 | pyload/plugin/crypter/MegaRapidCz.py | Python | gpl-3.0 | 779 | 0.017972 |
#!/usr/bin/env python3
import time
from matrix_client.client import MatrixClient
from matrix_client.api import MatrixRequestError
from requests.exceptions import ConnectionError, Timeout
import argparse
import random
from configparser import ConfigParser
import re
import traceback
import urllib.parse
import logging
imp... | Spferical/matrix-chatbot | main.py | Python | mit | 17,094 | 0.000059 |
#!/usr/local/bin/python
# make new dump file by combining snapshots from multiple NEB replica dumps
# Syntax: neb_combine.py -switch arg(s) -switch arg(s) ...
# -o outfile = new dump file
# each snapshot has NEB atoms from all replicas
# -r dump1 dump2 ... = replica dump files of NEB atoms
#... | val-github/lammps-dev | tools/python/neb_combine.py | Python | gpl-2.0 | 2,172 | 0.020718 |
# -*- coding: utf-8 -*-
##############################################################################
#
# OpenERP, Open Source Management Solution
# Copyright (C) 2010 OpenERP s.a. (<http://openerp.com>).
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the G... | crmccreary/openerp_server | openerp/tools/test_reports.py | Python | agpl-3.0 | 13,310 | 0.005259 |
"""
Module where admin tools dashboard modules classes are defined.
"""
from django.utils.text import capfirst
from django.core.urlresolvers import reverse
from django.contrib.contenttypes.models import ContentType
from django.utils.translation import ugettext_lazy as _
from django.utils.itercompat import is_iterable
... | liberation/django-admin-tools | admin_tools/dashboard/modules.py | Python | mit | 24,954 | 0.000641 |
# -*- coding: utf-8 -*-
from __future__ import absolute_import
from behave.formatter.base import Formatter
from behave.model_describe import ModelPrinter
from behave.textutil import make_indentation
# -----------------------------------------------------------------------------
# CLASS: PlainFormatter
# ------------... | Abdoctor/behave | behave/formatter/plain.py | Python | bsd-2-clause | 4,689 | 0.000213 |
#!/usr/bin/python
from __future__ import (absolute_import, division, print_function)
# Copyright 2019 Fortinet, Inc.
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the Lic... | alxgu/ansible | lib/ansible/modules/network/fortios/fortios_firewall_DoS_policy.py | Python | gpl-3.0 | 14,026 | 0.001497 |
# -*- coding: utf-8 -*-
'''
'''
from __future__ import absolute_import
from __future__ import with_statement
from . import database_meta
from . import database_tera
def closeAllConnections():
database_meta.closeConnection()
database_tera.closeConnection()
| tal-nino/edwin | edwinServer/common/database_all.py | Python | apache-2.0 | 267 | 0 |
# Copyright 2016 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... | alshedivat/tensorflow | tensorflow/python/ops/check_ops.py | Python | apache-2.0 | 47,658 | 0.005267 |
"""Nodes that make up parse trees
Parsing spits out a tree of these, which you can then tell to walk itself and
spit out a useful value. Or you can walk it yourself; the structural attributes
are public.
"""
# TODO: If this is slow, think about using cElementTree or something.
from inspect import isfunction
from sys ... | smurfix/parsimonious | parsimonious/nodes.py | Python | mit | 13,036 | 0.00069 |
# For Capstone Engine. AUTO-GENERATED FILE, DO NOT EDIT [mos65xx_const.py]
MOS65XX_REG_INVALID = 0
MOS65XX_REG_ACC = 1
MOS65XX_REG_X = 2
MOS65XX_REG_Y = 3
MOS65XX_REG_P = 4
MOS65XX_REG_SP = 5
MOS65XX_REG_DP = 6
MOS65XX_REG_B = 7
MOS65XX_REG_K = 8
MOS65XX_REG_ENDING = 9
MOS65XX_AM_NONE = 0
MOS65XX_AM_IMP = 1
MOS65XX_A... | capstone-rust/capstone-rs | capstone-sys/capstone/bindings/python/capstone/mos65xx_const.py | Python | mit | 3,179 | 0 |
"""Test dispatcher helpers."""
import asyncio
from homeassistant.core import callback
from homeassistant.helpers.dispatcher import (
async_dispatcher_connect,
dispatcher_connect,
dispatcher_send,
)
from tests.common import get_test_home_assistant
class TestHelpersDispatcher:
"""Tests for discovery h... | leppa/home-assistant | tests/helpers/test_dispatcher.py | Python | apache-2.0 | 4,196 | 0.000238 |
import ROOT
from math import pi, sqrt, pow, exp
import scipy.integrate
import numpy
from array import array
alpha = 7.2973e-3
m_e = 0.51099892
Z_Xe = 54
Q = 2.4578
def F(Z, KE):
E = KE + m_e
W = E/m_e
Z0 = Z + 2
if W <= 1:
W = 1 + 1e-4
if W > 2.2:
a = -8.46e-2 + 2.48e-2*Z0 + 2.... | steveherrin/PhDThesis | Thesis/scripts/make_bb_spectrum_plot.py | Python | mit | 5,583 | 0.003582 |
# !/usr/bin/env python
# -*- coding: utf-8 -*-
__version__ = '1.1.4'
__author__ = 'Liao Xuefeng (askxuefeng@gmail.com)'
'''
Python client SDK for sina weibo API using OAuth 2.
'''
try:
from cStringIO import StringIO
except ImportError:
from StringIO import StringIO
import gzip, time, json, hmac, base64, has... | YuepengGuo/sina_weibo_crawler | crawler/toolkit/weibo.py | Python | apache-2.0 | 11,860 | 0.002698 |
'''
Created on Dec 23, 2012
@author: Peter
This module contains a few functions for extracting the parameters out of a man page.
'''
import subprocess
import logging
from arguments.valuedarguments import ValuedArguments
TIMEOUT = 3
logger = logging.getLogger('man-fuzzer')
def mineflags(executable):
'''Return... | GroundPound/ManFuzzer | manparser/__init__.py | Python | apache-2.0 | 1,492 | 0.021448 |
import turtle
import time
window = turtle.Screen()
def test():
allturtles = []
for i in range(4):
t1 = turtle.Turtle()
t2 = turtle.Turtle()
t3 = turtle.Turtle()
t4 = turtle.Turtle()
t1.speed(0)
t2.speed(0)
t3.speed(0)
t4.speed(0)
t1.penup()
t2.penup()
t3.penup()
t4.penup()
t1.... | willybh11/python | advProg/turtleStuff/helloturtleworld.py | Python | gpl-3.0 | 846 | 0.055556 |
#! /usr/bin/env python
# encoding: utf-8
# WARNING! Do not edit! http://waf.googlecode.com/git/docs/wafbook/single.html#_obtaining_the_waf_file
import os
from waflib import Utils
from waflib.Tools import ccroot,ar
from waflib.Configure import conf
@conf
def find_scc(conf):
v=conf.env
cc=None
if v['CC']:cc=v['CC']
... | Abraca/debian | waflib/Tools/suncc.py | Python | gpl-2.0 | 1,378 | 0.064586 |
from ..i18n import trstring_factory
COMP_ID = 'layer'
_ = trstring_factory(COMP_ID)
| nextgis/nextgisweb | nextgisweb/layer/util.py | Python | gpl-3.0 | 85 | 0 |
__author__ = 'Ehsan'
from mininet.node import CPULimitedHost
from mininet.topo import Topo
from mininet.net import Mininet
from mininet.log import setLogLevel, info
from mininet.node import RemoteController
from mininet.cli import CLI
"""
Instructions to run the topo:
1. Go to directory where this fil is.
2. ru... | kulawczukmarcin/mypox | mininet_scripts/simple_net.py | Python | apache-2.0 | 1,695 | 0.00059 |
# Copyright © 2020, Joseph Berry, Rico Tabor (opendrop.dev@gmail.com)
# OpenDrop is released under the GNU GPL License. You are free to
# modify and distribute the code, but always under the same license
#
# If you use this software in your research, please cite the following
# journal articles:
#
# J. D. Berry, M. J. ... | jdber1/opendrop | opendrop/app/common/image_processing/plugins/define_line/component.py | Python | gpl-3.0 | 7,694 | 0.00065 |
#
# Example file for working with date information
# (For Python 3.x, be sure to use the ExampleSnippets3.txt file)
from datetime import date
from datetime import time
from datetime import datetime
def main():
## DATE OBJECTS
# Get today's date from the simple today() method from the date class
today = date.tod... | thatguyandy27/python-sandbox | learning-python/Ch3/dates_finished.py | Python | mit | 1,126 | 0.039964 |
# Copyright (c) 2014 Museum Victoria
# This software is released under the MIT license (see license.txt for details)
from Queue import *
import threading
import atexit
remote_action_PowerOn = RemoteAction()
remote_action_PowerOff = RemoteAction()
remote_action_SetInput = RemoteAction()
def local_action_activate(x = ... | museumsvictoria/nodel-recipes | (retired)/pjlinkqueue/script.py | Python | mit | 1,588 | 0.027708 |
"""Logging for Python YQL."""
import os
import logging
import logging.handlers
LOG_DIRECTORY_DEFAULT = os.path.join(os.path.dirname(__file__), "../logs")
LOG_DIRECTORY = os.environ.get("YQL_LOG_DIR", LOG_DIRECTORY_DEFAULT)
LOG_LEVELS = {'debug': logging.DEBUG,
'info': logging.INFO,
'warni... | project-fondue/python-yql | yql/logger.py | Python | bsd-3-clause | 1,435 | 0 |
"""Metrics to assess performance on regression task
Functions named as ``*_score`` return a scalar value to maximize: the higher
the better
Function named as ``*_error`` or ``*_loss`` return a scalar value to minimize:
the lower the better
"""
# Authors: Alexandre Gramfort <alexandre.gramfort@inria.fr>
# Ma... | beepee14/scikit-learn | sklearn/metrics/regression.py | Python | bsd-3-clause | 16,953 | 0.000059 |
from .gui import (
Widget,
Button,
TextInput,
SpinBox,
Label,
GenericDialog,
InputDialog,
ListView,
ListItem,
DropDown,
DropDownItem,
Image,
Table,
TableRow,
TableItem,
TableTitle,
Input,
Slider,
ColorPicker,
Date,
GenericObject,
Fi... | dddomodossola/remi | remi/__init__.py | Python | apache-2.0 | 698 | 0 |
"""The tests for the manual_mqtt Alarm Control Panel component."""
from datetime import timedelta
import unittest
from unittest.mock import patch
from homeassistant.setup import setup_component
from homeassistant.const import (
STATE_ALARM_DISARMED, STATE_ALARM_ARMED_HOME, STATE_ALARM_ARMED_AWAY,
STATE_ALARM_A... | persandstrom/home-assistant | tests/components/alarm_control_panel/test_manual_mqtt.py | Python | apache-2.0 | 56,123 | 0 |
from __future__ import absolute_import
import logging
import time
from collections import namedtuple
from multiprocessing import Process, Manager as MPManager
try:
from Queue import Empty, Full
except ImportError: # python 2
from queue import Empty, Full
from .base import (
AUTO_COMMIT_MSG_COUNT, AUTO_... | vshlapakov/kafka-python | kafka/consumer/multiprocess.py | Python | apache-2.0 | 10,236 | 0.001661 |
import time
import os
import sys
cclist = ['commander', 'nilc', 'sevem', 'smica']
nulist = ['0', '1']
hlist = ['hot0', 'hot1', 'hot2']
clist = ['cold0', 'cold1', 'cold2']
nslist = ['F', 'N', 'S']
readonly = 'T'
nmaps = 1000
print "=============== F =============="
for nu in nulist:
print " -------------------------... | zqhuang/COOP | mapio/pyscripts/check_QU.py | Python | gpl-3.0 | 1,311 | 0.012204 |
from vsg import parser
from vsg import token
from vsg.rules import consistent_token_case
lTokens = []
lTokens.append(token.subtype_declaration.identifier)
lIgnore = []
lIgnore.append(token.interface_signal_declaration.identifier)
lIgnore.append(token.interface_unknown_declaration.identifier)
lIgnore.append(token.in... | jeremiah-c-leary/vhdl-style-guide | vsg/rules/subtype/rule_002.py | Python | gpl-3.0 | 1,387 | 0.000721 |
# This file is part of PlexPy.
#
# PlexPy is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# PlexPy is distributed in the hope t... | gnowxilef/plexpy | plexpy/webserve.py | Python | gpl-3.0 | 52,488 | 0.002705 |
#file : InMoov2.full3.byGael.Langevin.1.py
# this script is provided as a basic guide
# most parts can be run by uncommenting them
# InMoov now can be started in modular pieces
import random
import threading
import itertools
leftPort = "COM20"
rightPort = "COM7"
i01 = Runtime.createAndStart("i01", "InMoov")
#inmoov... | MyRobotLab/pyrobotlab | home/hairygael/InMoov2.full3.byGael.Langevin.1.py | Python | apache-2.0 | 138,420 | 0.055592 |
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
from base import Problem
class Solution(Problem):
def solve(self, input_):
numberLargest = 0
for a in range(1, 100):
if a % 10 != 0:
for b in range(1, 100):
num_pow = a**b
number_su... | phapdv/project_euler | pe56.py | Python | mit | 616 | 0 |
from decimal import *
class util:
def getInterval(self, function):
"""
function: lambda function
Method that obtains the integer intervals where the function
changes its sign from negative to positive.
If it finds the function's root within its intervals, i... | kotoromo/Numeric_Methods | Bisection/util.py | Python | gpl-3.0 | 1,437 | 0.005567 |
from django import forms
from poi_manager.models import Poi, PoiCategory
from mptt.forms import TreeNodeChoiceField
class PoiCategoryForm(forms.ModelForm):
cat_name = forms.CharField(max_length=128, help_text="Please enter the category name.")
parent = TreeNodeChoiceField(queryset=PoiCategory.objects.all(), r... | indrz/indrz | indrz/poi_manager/forms.py | Python | gpl-3.0 | 769 | 0.003901 |
# -*- coding: utf-8 -*-
# Generated by Django 1.11.1 on 2017-06-09 14:43
from __future__ import unicode_literals
from django.db import migrations, models
import django.db.models.deletion
class Migration(migrations.Migration):
dependencies = [
('batch', '0002_auto_20170412_1225'),
('recipe', '001... | ngageoint/scale | scale/storage/migrations/0008_auto_20170609_1443.py | Python | apache-2.0 | 1,859 | 0.001614 |
#!/usr/bin/python
#
# 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) any later version.
#
# Ansible is distribut... | andreaso/ansible | lib/ansible/modules/network/nxos/nxos_static_route.py | Python | gpl-3.0 | 10,343 | 0.002804 |
import unittest
import numpy as np
from ..imutils import nan_to_zero, quantile_threshold, interpolate
class ImutilsTest(unittest.TestCase):
def test_nan_to_zero_with_ge_zero(self):
ids = (
np.zeros(1),
np.ones(range(1, 10)),
np.arange(1024 * 1024)
)
fo... | alexandrovteam/pyImagingMSpec | pyImagingMSpec/test/imutils_test.py | Python | apache-2.0 | 3,746 | 0.001068 |
import json
import os
import re
from codecs import open as open_n_decode
from json_tools import field_by_path, list_field_paths, prepare
# 网上抄的函数,用来合成json,结果还算可靠尼玛呢坑死我了
def add_value(dict_obj, path, value):
obj = dict_obj
for i, v in enumerate(path):
if i + 1 == len(path):
if not isinstan... | ProjectSky/FrackinUniverse-sChinese-Project | script/tools/patch_tool.py | Python | mit | 6,836 | 0.009206 |
import argparse
import datetime
import json
import os
import shutil
import tarfile
import zipfile
from urllib.request import Request, urlopen
def url_download(url, workdir):
file_path = os.path.join(workdir, 'download.dat')
if not os.path.exists(workdir):
os.makedirs(workdir)
src = None
dst = ... | mvdbeek/tools-iuc | data_managers/data_manager_fetch_ncbi_taxonomy/data_manager/data_manager.py | Python | mit | 4,462 | 0.002465 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.