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 |
|---|---|---|---|---|---|---|
#!/usr/bin/env python3
from getpass import getpass
PWD = "123456" # type: str
eingabe = getpass() # type: str
if eingabe == PWD:
print("Richtig.")
elif eingabe in PWD:
print("Fast.")
else:
print("Falsch.")
| pythonfoo/pythonfooLite | Level_02/passwort.py | Python | gpl-3.0 | 222 | 0.009009 |
#!/usr/bin/env python
"""
Licensed to the Apache Software Foundation (ASF) under one
or more contributor license agreements. See the NOTICE file
distributed with this work for additional information
regarding copyright ownership. The ASF licenses this file
to you under the Apache License, Version 2.0 (the
"License");... | arenadata/ambari | ambari-common/src/main/python/resource_management/libraries/functions/setup_ranger_plugin.py | Python | apache-2.0 | 4,473 | 0.014979 |
"""
Django settings for Assignment_6 project.
Generated by 'django-admin startproject' using Django 1.9.3.
For more information on this file, see
https://docs.djangoproject.com/en/1.9/topics/settings/
For the full list of settings and their values, see
https://docs.djangoproject.com/en/1.9/ref/settings/
"""
import ... | dhruvaldarji/InternetProgramming | Assignment_6/Assignment_6/settings.py | Python | mit | 3,248 | 0.001539 |
class PostBaseModel(object):
#主键
Key=None
Token=None
def __init__(self,jsonObj):
self.__dict__=jsonObj | wengzhilai/family | iSoft/model/framework/PostBaseModel.py | Python | bsd-3-clause | 130 | 0.055556 |
# Copyright (c) 2018 PaddlePaddle 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 appli... | luotao1/Paddle | python/paddle/fluid/tests/unittests/test_space_to_depth_op.py | Python | apache-2.0 | 5,176 | 0 |
from typing import Any, Dict
from flask import g
from psycopg2 import connect, extras
def open_connection(config: Dict[str, Any]) -> None:
try:
g.db = connect(
database=config['DATABASE_NAME'],
user=config['DATABASE_USER'],
password=config['DATABASE_PASS'],
... | craws/OpenAtlas-Python | openatlas/database/connect.py | Python | gpl-2.0 | 946 | 0 |
try:
import uio as io
except ImportError:
import io
a = io.StringIO()
print('io.StringIO' in repr(a))
print(a.getvalue())
print(a.read())
a = io.StringIO("foobar")
print(a.getvalue())
print(a.read())
print(a.read())
a = io.StringIO()
a.write("foo")
print(a.getvalue())
a = io.StringIO("foo")
a.write("12")
pr... | kerneltask/micropython | tests/basics/io_stringio1.py | Python | mit | 894 | 0 |
import os
import stat
import sys
import attr
import pytest
from _pytest import pathlib
from _pytest.pathlib import Path
def test_tmpdir_fixture(testdir):
p = testdir.copy_example("tmpdir/tmpdir_fixture.py")
results = testdir.runpytest(p)
results.stdout.fnmatch_lines(["*1 passed*"])
@attr.s
class FakeC... | tomviner/pytest | testing/test_tmpdir.py | Python | mit | 12,284 | 0.00057 |
# -*- coding: utf-8 -*-
## Description: class NetworkML for loading NetworkML from file or xml element into MOOSE
## Version 1.0 by Aditya Gilra, NCBS, Bangalore, India, 2011 for serial MOOSE
## Version 1.5 by Niraj Dudani, NCBS, Bangalore, India, 2012, ported to parallel MOOSE
## Version 1.6 by Aditya Gilra, NCBS, Ban... | BhallaLab/moose | moose-core/python/moose/neuroml/NetworkML.py | Python | gpl-3.0 | 25,761 | 0.010947 |
# Copyright 2018 The GraphNets 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 applicabl... | deepmind/graph_nets | graph_nets/tests/blocks_test.py | Python | apache-2.0 | 43,860 | 0.003694 |
#!/usr/bin/env python
import warnings
from py import test
from py.test import mark
from translate.misc import wStringIO
from translate.storage import dtd
from translate.storage import test_monolingual
def test_roundtrip_quoting():
specials = ['Fish & chips', 'five < six', 'six > five',
'Use &nb... | mozilla/verbatim | vendor/lib/python/translate/storage/test_dtd.py | Python | gpl-2.0 | 9,204 | 0.003151 |
# © 2019 David BEAL @ Akretion
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html).
{
"name": "Stef logistics center",
"version": "12.0.1.0.0",
"category": "Warehouse",
"summary": "Stef logistics center",
"author": "Akretion",
"license": "AGPL-3",
"website": "https://www.akr... | akretion/logistics-center | stef_logistics/__manifest__.py | Python | agpl-3.0 | 807 | 0 |
#FLM: ---------
pass
| impallari/Impallari-Fontlab-Macros | IMP Kerning/20 ---.py | Python | apache-2.0 | 27 | 0.037037 |
import logging
def handler(event, context):
logger = logging.getLogger()
logger.info('hello world')
return 'hello world'
| xiaozhu36/terraform-provider | examples/fc/hello.py | Python | apache-2.0 | 130 | 0.038462 |
"""Deletes an existing load balancer service."""
# :license: MIT, see LICENSE for more details.
import SoftLayer
from SoftLayer.CLI import environment
from SoftLayer.CLI import exceptions
from SoftLayer.CLI import formatting
from SoftLayer.CLI import loadbal
import click
@click.command()
@click.argument('identifier... | briancline/softlayer-python | SoftLayer/CLI/loadbal/service_delete.py | Python | mit | 860 | 0 |
# -*- coding: utf-8 -*-
import hashlib
import random
from rest_framework import serializers
from sita.users.models import User
from sita.subscriptions.models import Subscription
from sita.utils.refresh_token import create_token
from hashlib import md5
from datetime import datetime, timedelta
import pytz
class LoginSe... | Fabfm4/Sita-BackEnd | src/sita/authentication/serializers.py | Python | apache-2.0 | 6,676 | 0.003895 |
# -*- coding: utf-8 -*-
"""
José Vicente Pérez
Granada University (Spain)
March, 2017
Testing suite for profiler.py
Last modified: 19 June 2017
"""
import time
import profiler as p
import praster as pr
import numpy as np
import matplotlib.pyplot as plt
print("Tests for TProfiler methods")
def test01():
"""... | geolovic/TProfiler | test/06_TProfiler_test.py | Python | gpl-3.0 | 12,892 | 0.000388 |
from crontab import CronTab
from django.conf import settings
#####################################################
###Para mas info sobre el uso de python-crontab######
### https://pypi.python.org/pypi/python-crontab ######
#####################################################
##Directorio de la aplicaion
### STATIC_... | emoronayuso/beeton | asterisk-bee/asteriskbee/api_status/scripts_graficas/script_crontab.py | Python | gpl-3.0 | 1,417 | 0.016231 |
# -*- coding: utf-8 -*-
# This file is part of Shoop.
#
# Copyright (c) 2012-2016, Shoop Ltd. All rights reserved.
#
# This source code is licensed under the AGPLv3 license found in the
# LICENSE file in the root directory of this source tree.
from django.utils.translation import ugettext_lazy as _
from shoop.core.mod... | akx/shoop | shoop/core/pricing/default_pricing.py | Python | agpl-3.0 | 1,139 | 0 |
# Implementation of sequence elements that are composed out of pulses
# Author : W. Pfaff
# modified by: Sarwan Peiter
import numpy as np
from copy import deepcopy
import pprint
import logging
class Element:
"""
Implementation of a sequence element.
Basic idea: add different pulses, and compose the actual numer... | yausern/stlab | devices/Tektronics_Sequencer/element.py | Python | gpl-3.0 | 10,638 | 0.037413 |
#! /usr/bin/env python
# -*- coding: utf-8 -*-
import multiprocessing, Queue
import signal, time
import setting
from socketserver import SocketServer
from tunserver import TunServer
def sigHandler(signum, frame):
print "signal %s received, client going to shutdown" % signum
setting.running = False
if __nam... | ayouwei/minivpn | server/server.py | Python | apache-2.0 | 857 | 0.009335 |
from numpy.random import random
from bokeh.plotting import figure, show, output_file
def mscatter(p, x, y, marker):
p.scatter(x, y, marker=marker, size=15,
line_color="navy", fill_color="orange", alpha=0.5)
def mtext(p, x, y, text):
p.text(x, y, text=[text],
text_color="firebrick", t... | pombredanne/bokeh | examples/plotting/file/markers.py | Python | bsd-3-clause | 1,583 | 0.001895 |
#!/usr/bin/python3
from .compat import BaseHTTPRequestHandler, HTTPServer
import urllib
import json
import sys
import time
import warnings
from slackly import SlackClient
warnings.warn("This part of slackly (oauth_utils) is highly experimental and will likely see api breaking changes")
class CodeServer(BaseHTTPReq... | huntcsg/slackly | src/slackly/oauth_utils.py | Python | mit | 1,841 | 0.000543 |
"""
Tool for converting simple 'C' struct and #define lists into Python classes.
The subset of C that is understand is limited to:
#define <group>_<name> <value>
struct X
{
<type> <name>;
<type> <name>[dimension];
};
Blank lines and single-line comments are ignored.
defines are expe... | kfsone/tinker | python/packedstruct.py | Python | mit | 9,560 | 0.001046 |
# -*- coding: utf-8 -*-
# Copyright (c) 2010-2016, MIT Probabilistic Computing Project
#
# 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/LICENS... | probcomp/bdbcontrib | tests/test_draw_cc_state.py | Python | apache-2.0 | 2,579 | 0.005041 |
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.rst'), encoding='utf-8') as f:
long_description = f.read()
setup(
name='fcit',
# Versions... | kjchalup/dtit | setup.py | Python | mit | 2,610 | 0.002682 |
def is_pangram(word):
word = sorted(word)
i = 1
count = 0
while i < len(word):
if (word[i] != word[i-1]) & (word[i].isalpha()):
count += 1
i += 1
if count == 26:
return True
else:
return False
| ZachGangwer/Exercism | python/pangram/pangram.py | Python | gpl-3.0 | 273 | 0.007326 |
# -*- coding: utf-8 -*-
from cms.models.placeholdermodel import Placeholder
from cms.plugin_processors import (plugin_meta_context_processor,
mark_safe_plugin_processor)
from cms.utils import get_language_from_request
from cms.utils.django_load import iterload_objects
from cms.utils.placeholder import (get_page_fr... | driesdesmet/django-cms | cms/plugin_rendering.py | Python | bsd-3-clause | 6,339 | 0.005048 |
"""
Support for AquaLogic switches.
For more details about this platform, please refer to the documentation at
https://home-assistant.io/components/switch.aqualogic/
"""
import logging
import voluptuous as vol
import homeassistant.helpers.config_validation as cv
from homeassistant.core import callback
import homeass... | tinloaf/home-assistant | homeassistant/components/switch/aqualogic.py | Python | apache-2.0 | 3,306 | 0 |
#!/usr/bin/env python
from __future__ import print_function
import linchpin.FilterUtils.FilterUtils as filter_utils
class FilterModule(object):
''' A filter to fix network format '''
def filters(self):
return {
'map_results': filter_utils.map_results
}
| samvarankashyap/linch-pin | linchpin/provision/roles/azure/filter_plugins/map_results.py | Python | gpl-3.0 | 292 | 0 |
#!/usr/bin/python
import time, sqlite3, sys, urllib, csv
begin = time.time()
url = "http://www.correlatesofwar.org/COW2%20Data/SystemMembership/2011/states2011.csv"
print "Downloading from", url
response = urllib.urlretrieve(url, '../Data/states2011.csv')
print "Opening Database"
con = sqlite3.connect('../Data/PyRB... | AABoyles/Tabular.ui | Scripts/dumpStatesToDB.py | Python | gpl-2.0 | 1,190 | 0.004202 |
# Testing the line trace facility.
from test import test_support
import unittest
import sys
import difflib
import gc
# A very basic example. If this fails, we're in deep trouble.
def basic():
return 1
basic.events = [(0, 'call'),
(1, 'line'),
(1, 'return')]
# Man... | j5shi/Thruster | pylibs/test/test_sys_settrace.py | Python | gpl-2.0 | 24,801 | 0.004798 |
# Copyright 2019,2020,2021 Sony Corporation.
# Copyright 2021 Sony Group Corporation.
#
# 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
#
# Un... | sony/nnabla | python/src/nnabla/backward_function/tanh_shrink.py | Python | apache-2.0 | 1,106 | 0.002712 |
from collections import defaultdict
from PyQt5.QtCore import QModelIndex, Qt
from urh.models.TableModel import TableModel
from urh.signalprocessing.ProtocolAnalyzer import ProtocolAnalyzer
class SimulatorMessageTableModel(TableModel):
def __init__(self, compare_frame_controller, generator_tab_controller, parent=... | splotz90/urh | src/urh/models/SimulatorMessageTableModel.py | Python | gpl-3.0 | 3,129 | 0.003196 |
# 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 ... | balajikris/autorest | src/generator/AutoRest.Python.Azure.Tests/Expected/AcceptanceTests/StorageManagementClient/storagemanagementclient/operations/__init__.py | Python | mit | 658 | 0 |
#!/usr/bin/env python2
from glob import glob
import re
import matplotlib.pyplot as plt
import numpy as np
from sys import argv
def get_a1(pattern):
a1 = {}
for fit_file in glob(pattern):
with open(fit_file) as f:
line = f.readline()
coeffs = line.split(' ')
fit_par... | mkawalec/masters | contrib/plot_decay/plot2.py | Python | gpl-3.0 | 1,103 | 0.000907 |
# Copyright 2012 Nebula, 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 or agree... | DirectXMan12/nova-hacking | nova/tests/api/openstack/compute/contrib/test_flavor_swap.py | Python | apache-2.0 | 3,130 | 0.000639 |
from __future__ import unicode_literals
import base64
import re
from .common import InfoExtractor
from ..utils import qualities
class TeamcocoIE(InfoExtractor):
_VALID_URL = r'http://teamcoco\.com/video/(?P<video_id>[0-9]+)?/?(?P<display_id>.*)'
_TESTS = [
{
'url': 'http://teamcoco.com/v... | Kagee/youtube-dl | youtube_dl/extractor/teamcoco.py | Python | unlicense | 3,246 | 0.001848 |
# 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... | tensorflow/tensorflow | tensorflow/python/framework/c_api_util.py | Python | apache-2.0 | 7,542 | 0.009281 |
"""
Django settings for Lab6 project.
Generated by 'django-admin startproject' using Django 2.0.
For more information on this file, see
https://docs.djangoproject.com/en/2.0/topics/settings/
For the full list of settings and their values, see
https://docs.djangoproject.com/en/2.0/ref/settings/
"""
import os
# Buil... | bestK1ngArthur/IU5 | Term 5/Development of Internet applications/Lab6/Lab6/settings.py | Python | mit | 3,298 | 0.001819 |
# -*- coding: utf-8 -*-
# Licensed under a 3-clause BSD style license - see LICENSE.rst
import os
import astropy.units as u
import numpy as np
from astropy.table import Table
from astropy.utils.data import get_pkg_data_filename
from .extern.validator import (
validate_array,
validate_physical_type,
valida... | zblz/naima | src/naima/models.py | Python | bsd-3-clause | 15,997 | 0 |
#!/usr/bin/env python
# Copyright (c) 2012 Google Inc. All rights reserved.
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
"""
Make sure nodefaultlib setting is extracted properly.
"""
import TestGyp
import sys
if sys.platform == 'win32':
test... | Jet-Streaming/gyp | test/win/gyptest-link-nodefaultlib.py | Python | bsd-3-clause | 596 | 0.010067 |
#!/usr/bin/python3
# Eloipool - Python Bitcoin pool server
# Copyright (C) 2011-2013 Luke Dashjr <luke-jr+eloipool@utopios.org>
#
# This program 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 v... | fengjz1/eloipool-litecoin | eloipool.py | Python | agpl-3.0 | 26,968 | 0.034634 |
# Copyright (c) 2013 Hewlett-Packard Development Company, L.P.
# Copyright (c) 2012 VMware, Inc.
# Copyright (c) 2011 Citrix Systems, Inc.
# Copyright 2011 OpenStack Foundation
#
# Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance with the License. Yo... | affo/nova | nova/virt/vmwareapi/driver.py | Python | apache-2.0 | 27,905 | 0.000824 |
# Copyright 2010 Gentoo Foundation
# Distributed under the terms of the GNU General Public License v2
from __future__ import print_function
__all__ = ['fetch']
import codecs
import errno
import logging
import random
import re
import shutil
import stat
import sys
import tempfile
import portage
portage.proxy.lazyimp... | Neuvoo/legacy-portage | pym/portage/package/ebuild/fetch.py | Python | gpl-2.0 | 36,523 | 0.032254 |
# coding=utf-8
# Copyright 2014 Pants project contributors (see CONTRIBUTORS.md).
# Licensed under the Apache License, Version 2.0 (see LICENSE).
from __future__ import (nested_scopes, generators, division, absolute_import, with_statement,
print_function, unicode_literals)
import unittest2 as ... | square/pants | tests/python/pants_test/tasks/test_markdown_to_html.py | Python | apache-2.0 | 2,784 | 0.003951 |
# Copyright (c) 2014-present PlatformIO <contact@platformio.org>
#
# 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 appli... | platformio/platformio-core | platformio/util.py | Python | apache-2.0 | 9,050 | 0.000994 |
# -*- coding: utf-8 -*-
import os
from os import path as op
import shutil
import glob
import warnings
from nose.tools import assert_true, assert_raises
from numpy.testing import assert_equal, assert_allclose
from mne import concatenate_raws, read_bem_surfaces
from mne.commands import (mne_browse_raw, mne_bti2fiff, mne... | nicproulx/mne-python | mne/commands/tests/test_commands.py | Python | bsd-3-clause | 9,165 | 0 |
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.db import models, migrations
class Migration(migrations.Migration):
dependencies = [
('mirrors', '0003_componentrevision_version'),
]
operations = [
migrations.AlterField(
model_name='componentrevisi... | motherjones/mirrors | mirrors/migrations/0004_auto_20140609_1943.py | Python | mit | 444 | 0 |
"""Tests for hermite module.
"""
from __future__ import division
import numpy as np
import numpy.polynomial.hermite as herm
from numpy.polynomial.polynomial import polyval
from numpy.testing import (
TestCase, assert_almost_equal, assert_raises,
assert_equal, assert_, run_module_suite)
H0... | beiko-lab/gengis | bin/Lib/site-packages/numpy/polynomial/tests/test_hermite.py | Python | gpl-3.0 | 17,416 | 0.006833 |
from django.shortcuts import render, get_object_or_404
# import the custom context processor
from vehicles.context_processor import global_context_processor
from vehicles.models import Vehicle, VehicleMake, Category
from settings.models import SliderImage
from django.core.paginator import Paginator, InvalidPage, Empty... | sitture/trade-motors | src/vehicles/views.py | Python | mit | 3,897 | 0.000257 |
# -*- encoding: utf-8 -*-
from openerp.osv import fields, osv
from openerp.tools.translate import _
class sale_order_line(osv.Model):
"""
OpenERP Model : sale_order_line
"""
_inherit = 'sale.order.line'
_columns = {
'att_bro': fields.boolean('Attach Brochure', required=False, help="""If y... | 3dfxsoftware/cbss-addons | sale_multicompany_report/order.py | Python | gpl-2.0 | 1,880 | 0.005319 |
import asyncio
from abc import ABCMeta
from collections.abc import MutableMapping
from aiohttp import web
from aiohttp.web_request import Request
from aiohttp_session import get_session
from collections.abc import Sequence
AIOLOGIN_KEY = '__aiologin__'
ON_LOGIN = 1
ON_LOGOUT = 2
ON_AUTHENTICATED = 3
ON_FORBIDDEN = 4... | trivigy/aiologin | aiologin/__init__.py | Python | mit | 7,901 | 0.000506 |
import os
import re
import traceback
import logging
import platform
from distutils.version import StrictVersion
from PySide import QtCore
from PySide import QtGui
from P4 import P4, P4Exception, Progress, OutputHandler
import Utils
import AppUtils
import GlobalVars
import Callbacks
reload(Utils)
reload(AppUtils)
re... | TomMinor/MayaPerforce | Perforce/GUI.py | Python | mit | 75,889 | 0.001146 |
import jumon
def main():
jumon.entry(__name__)
| TakesxiSximada/syaml | src/syaml/commands/__init__.py | Python | apache-2.0 | 53 | 0 |
from .stats_view_base import StatsViewSwagger, StatsViewSwaggerKeyRequired
from .stats_util_dataverses import StatsMakerDataverses
class DataverseCountByMonthView(StatsViewSwaggerKeyRequired):
"""API View - Dataverse counts by Month."""
# Define the swagger attributes
# Note: api_path must match the path... | IQSS/miniverse | dv_apps/metrics/stats_views_dataverses.py | Python | mit | 6,085 | 0.004108 |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
# Robot Lint Rules - Lint rules for Robot Framework data files.
# Copyright (c) 2014, 2015, 2016 Richard Huang <rickypc@users.noreply.github.com>
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU Affero Gen... | rickypc/dotfiles | .rflint.d/order.py | Python | mit | 3,013 | 0.000664 |
from django.dispatch import Signal
page_published = Signal(providing_args=['instance', 'revision'])
page_unpublished = Signal(providing_args=['instance'])
pre_page_move = Signal(providing_args=['instance', 'parent_page_before', 'parent_page_after', 'url_path_before', 'url_path_after'])
post_page_move = Signal(providi... | kaedroho/wagtail | wagtail/core/signals.py | Python | bsd-3-clause | 923 | 0.002167 |
import os
class Config(object):
DEBUG = False
# If using a DB do something like this:
SQLALCHEMY_DATABASE_URI = os.environ.get('DATABASE_URL',
'postgresql+pg8000://readhub_user@localhost:5432/readhub_db')
# if using WTF forms you'll want some thing like thi... | readhub/readhub | config.py | Python | mit | 665 | 0.001504 |
# Always prefer setuptools over distutils
from setuptools import setup, find_packages
# To use a consistent encoding
from codecs import open
from os import path
here = path.abspath(path.dirname(__file__))
# Get the long description from the relevant file
with open(path.join(here, 'DESCRIPTION.rst'), encoding='utf-8')... | pdorrell/melody_scripter | setup.py | Python | mit | 3,795 | 0.001845 |
from openerp import tools
from openerp.osv import fields, osv
from openerp.tools.translate import _
class wizard_valuation_history(osv.osv_memory):
_name = 'wizard.valuation.history'
_description = 'Wizard that opens the stock valuation history table'
_columns = {
'choose_date': fields.boolean('C... | mycodeday/crm-platform | stock_account/wizard/stock_valuation_history.py | Python | gpl-3.0 | 8,050 | 0.00323 |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
#
#
# Author : Arulalan.T <arulalant@gmail.com>
# Thanks to Mr. Govardhan Balaji <govigov03@gmail.com>
# who contributed to create kannada2ipaMap
#
#
from orddic import OrderedDict
kan2ipa = OrderedDict([
("ಳ್ಳಃ", "ɭɭəɦə"),
("ಳ್ಳಂ", "ɭɭəm"),
("ಳ್ಳೌ", "ɭɭəʋ")... | arulalant/txt2ipa | kannada2ipa/kannada2ipaMap.py | Python | gpl-3.0 | 588,062 | 0.000005 |
#!/usr/bin/python
#
# Copyright 2011 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... | google/ashier | ashierlib/test/utils_test.py | Python | apache-2.0 | 2,733 | 0.006952 |
# Copyright (c) Twisted Matrix Laboratories.
# See LICENSE for details.
from __future__ import division, absolute_import
import os
import sys
from textwrap import dedent
from twisted.trial import unittest
from twisted.persisted import sob
from twisted.python import components
from twisted.persisted.styles import Ep... | whitehorse-io/encarnia | pyenv/lib/python2.7/site-packages/twisted/test/test_sob.py | Python | mit | 5,632 | 0.003374 |
# -*- coding: utf-8 -*-
# Copyright (c) 2015 Conwet Lab., Universidad Politécnica de Madrid
# This file is part of Wirecloud.
# Wirecloud 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 versio... | jpajuelo/wirecloud | src/wirecloud/platform/core/models.py | Python | agpl-3.0 | 3,337 | 0.000899 |
# -*- coding: utf-8 -*-
from django.core.management.base import BaseCommand
from apps.user.models import UserProfile
# Thanks to @ajrobbins for generating this
DRB_ZIPS = ['07416', '07438', '07461', '07820', '07821', '07822', '07823',
'07825', '07826', '07827', '07828', '07832', '07833', '07836',
... | WikiWatershed/model-my-watershed | src/mmw/apps/user/management/commands/drbusers.py | Python | apache-2.0 | 9,850 | 0 |
from . import meta_selector # noqa
from .pg import PatternGenerator
from .selector import Selector
PatternGenerator('')
Selector('')
| stack-of-tasks/sot-pattern-generator | src/dynamic_graph/sot/pattern_generator/__init__.py | Python | isc | 136 | 0 |
# 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 may ... | Azure/azure-sdk-for-python | sdk/network/azure-mgmt-network/azure/mgmt/network/v2018_06_01/aio/operations/_ddos_protection_plans_operations.py | Python | mit | 23,738 | 0.005055 |
from functools import lru_cache
def sequence(n):
'bad idea'
while n is not 1:
yield n
n = 3*n+1 if n%2 else n/2
yield n
def next_num(n):
if n % 2:
return 3 * n + 1
else:
return n / 2
@lru_cache(None)
def collatz_length(n):
if n == 1:
return 1
else:
... | dawran6/project-euler | 14-longest-collatz-sequence.py | Python | mit | 588 | 0.008503 |
#!/usr/bin/env python3
# Copyright 2020 Red Hat, 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
#... | openstack/neutron | tools/files_in_patch.py | Python | apache-2.0 | 2,508 | 0 |
""" A class for training our perceptrons """
class Trainers:
""" Constructor """
def __init__(self, data, r=1):
self.data_vectors = data # training dataset
self.r = r
self.wrong_classified_vectors = ["dummy"]
def gradientDescent(self, perceptron):
print "Begin training..."
last = len(self.data_vectors[0])... | elpaxoudis/pattern-recognition | trainers.py | Python | gpl-2.0 | 1,725 | 0.031884 |
import numpy as np
from netCDF4 import Dataset
import matplotlib.pyplot as plt
from matplotlib import cm, colors
from mpl_toolkits.basemap import Basemap, addcyclic
from scipy.io import FortranFile
# Amplification factor for the mean wind stress
ampMean = 3.0
initDir = '../init/'
nlat = 31
nlon = 30
year0 = 1961
year... | atantet/transferCZ | tau/get_tau_norm_red.py | Python | gpl-2.0 | 13,933 | 0.002799 |
import os
import sys
__author__ = 'Davide Caroselli'
def escape(string):
escaped = ''
for c in string:
if ('0' <= c <= '9') or ('A' <= c <= 'Z') or ('a' <= c <= 'z'):
escaped += c
else:
escaped += '\\' + c
return escaped
def _abspath(root, path):
if not os.pa... | ModernMT/MMT | src/textprocessing/script/pyflex.py | Python | apache-2.0 | 6,428 | 0.001557 |
"""
Student Views
"""
import datetime
import logging
import uuid
import json
import warnings
from collections import defaultdict
from pytz import UTC
from requests import HTTPError
from ipware.ip import get_ip
from django.conf import settings
from django.contrib.auth import logout, authenticate, login
from django.cont... | ak2703/edx-platform | common/djangoapps/student/views.py | Python | agpl-3.0 | 92,551 | 0.002636 |
from .base import CreateBaseCommand
class PutSearchTemplateCommand(CreateBaseCommand):
command_name = "elasticsearch:put-search-template"
def run_request(self, template_id=None):
if not template_id:
self.show_input_panel(
'Search Template Id: ', '', self.run)
r... | KunihikoKido/sublime-elasticsearch-client | commands/put_search_template.py | Python | mit | 474 | 0 |
"""
Protocol wrapper that will detect hung connections.
In particular, since PB expects the server to talk first and HTTP
expects the client to talk first, when a PB client talks to an HTTP
server, neither side will talk, leading to a hung connection. This
wrapper will disconnect in that case, and inform the caller.
"... | cmouse/buildbot | worker/buildbot_worker/util/_hangcheck.py | Python | gpl-2.0 | 4,189 | 0.000239 |
# -*- coding: utf-8 -*-
from django.db.models import Q
from django.db import models
from django.contrib.auth.models import User
from django.utils.translation import ugettext_lazy as _
from django.utils.timezone import now
from django.conf import settings
from django import template # import Template,Context
from djang... | hdknr/paloma | src/paloma/models.py | Python | bsd-2-clause | 33,915 | 0.000295 |
#!/usr/bin/env python
# coding: utf-8
# Copyright (c) 2013 OpenStack Foundation
#
# 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 re... | matthewoliver/swift | test/unit/test_locale/test_locale.py | Python | apache-2.0 | 2,743 | 0 |
from itertools import repeat, chain
from operator import itemgetter
from django.db.models import Count, Sum, Case, When, IntegerField, Value, FloatField
from django.db.models.expressions import CombinedExpression
from django.http import JsonResponse
from django.shortcuts import render
from django.utils.translation imp... | monouno/site | judge/views/stats.py | Python | agpl-3.0 | 3,624 | 0.003311 |
from .ext_solutions import intrsc_values
def main(id_star, x_star, y_star, extin_list, zams_indxs, zams_inter, M_abs,
sp_type, m_obs, bv_obsrv, e_bv, ub_obsrv, e_ub):
"""
For each solution assigned to each observed star, find its absolute
magnitude, intrinsic colors, spectral types, and distance... | Gabriel-p/UBV_move | modules/zams_solutions.py | Python | gpl-3.0 | 4,495 | 0 |
from model.info_contact import Infos
import random
def test_delete_some_contact(app, db, check_ui):
if app.contact.count() == 0:
app.contact.create(Infos(firstname="AAAAA"))
old_contacts = db.get_contact_list()
contact = random.choice(old_contacts)
app.contact.delete_contact_by_id(contact.id)
... | Alex-Chizhov/python_training | home_works/test/test_del_contact.py | Python | apache-2.0 | 595 | 0.005042 |
#!/user/bin/python
import sys
for line in open(sys.argv[1],'r'):
spl = line.strip().split(',')
for x in spl:
print x
| germs-lab/RefSoil | script_to_clean_list/remove_comma.py | Python | gpl-2.0 | 134 | 0.014925 |
"""
Host app for nuke, check if we are in nuke.
"""
from assetbox.base.plugins.host import BaseHost
import sys
class HostApp(BaseHost):
"""
The host application class, which is used to determine context.
"""
ID = 'Nuke'
filetypes = ['abc', 'exr']
def get_host(self):
"""Return True if ... | mlvfx/vfxAssetBox | assetbox/plugins/nuke/host.py | Python | cc0-1.0 | 458 | 0 |
from pony.orm import *
from datetime import datetime
db = Database('sqlite', 'players.sqlite', create_db=False)
pony.options.MAX_FETCH_COUNT=50000
class Players(db.Entity):
_table_ = "profile_stats"
id = PrimaryKey(int, auto=True)
last_updated = Required(datetime)
name = Required(unicode, 50)
ser... | AMorporkian/tagprostats | db.py | Python | mit | 6,957 | 0.000862 |
import re
import logging
from sqlalchemy import *
from sqlalchemy.ext.declarative import declarative_base
from sqlalchemy.orm import sessionmaker, relationship, backref
re_ip_in_phone = re.compile('000*-(\d+-\d+-\d+-\d+)')
re_phone_all_zero = re.compile('000*-0+-0+-0+-0+')
re_hostname = re.compile('[\w-]+\.[\w-]+')
... | larsks/python-ftn | fidonet/nodelist.py | Python | gpl-3.0 | 5,703 | 0.002806 |
#!/usr/bin/env python
# ----------------------------------------------------------------------
# Numenta Platform for Intelligent Computing (NuPIC)
# Copyright (C) 2013, Numenta, Inc. Unless you have purchased from
# Numenta, Inc. a separate commercial license for this software code, the
# following terms and conditio... | tkaitchuck/nupic | build_system/autobuild/deploy.py | Python | gpl-3.0 | 7,654 | 0.013457 |
"""
Arc slicer for 2D data
"""
import numpy as np
from sas.qtgui.Plotting.Slicers.BaseInteractor import BaseInteractor
class ArcInteractor(BaseInteractor):
"""
Select an annulus through a 2D plot
"""
def __init__(self, base, axes, color='black', zorder=5, r=1.0,
theta1=np.pi / 8, ... | SasView/sasview | src/sas/qtgui/Plotting/Slicers/Arc.py | Python | bsd-3-clause | 4,351 | 0.002068 |
import sys
from connect2j import connectToJava
if (len(sys.argv) > 1):
gateway = None
try:
gateway = connectToJava(sys.argv[1])
map = gateway.getMap()
map['1'] = 1
gateway.setMap(map)
map["obj"].setValue("Hello")
finally:
if gateway != None:
... | kasemir/org.csstudio.display.builder | org.csstudio.display.builder.runtime/scripts/test-script.py | Python | epl-1.0 | 348 | 0.005747 |
from typing import Optional, Union
from .color import Color
from .console import Console, ConsoleOptions, RenderResult
from .jupyter import JupyterMixin
from .measure import Measurement
from .segment import Segment
from .style import Style
# There are left-aligned characters for 1/8 to 7/8, but
# the right-aligned ch... | pradyunsg/pip | src/pip/_vendor/rich/bar.py | Python | mit | 3,264 | 0.001856 |
import numpy as np
import cv2
import h5py
min_img_size = 12
label_path = './label.txt'
landmark_path = './landmark.txt'
regression_box_path = './regression_box.txt'
crop_image_path = './crop_image.txt'
train_file_path = './train_12.hd5'
label = np.loadtxt(label_path, int)
landmark = np.loadtxt(landmark_path, float)
r... | dedoogong/asrada | FaceLandmark_Detector_DAN/generate_hd5.py | Python | apache-2.0 | 1,140 | 0.005263 |
#!/usr/bin/python2
# test.py
# nroberts 04/10/2017
# Instead of lighting up a bridge, we light up the terminal
from tennis_show import TennisShow
import current_bridge
from threading import Thread
import Queue
from colors import Colors
thread_continuing = True
class OutQueue:
def put(self, event):
print ... | alexoneill/15-love | game/test.py | Python | mit | 1,989 | 0.011061 |
"""Context processors, these get called and add things to template contexts"""
from django.conf import settings
def analytics_and_ads(request):
""" Adds the google analytics code to the context """
out = {}
if request.user.is_authenticated() and request.user.settings.no_analytics:
out["analyti... | RossBrunton/BMAT | bmat/context_processors.py | Python | mit | 786 | 0.007634 |
#! /usr/bin/env python
import envoy
import boto
import requests
import os
import sys
import time
import random
import string
from oauthlib.oauth2 import MobileApplicationClient
from requests_oauthlib import OAuth2Session
from boto.s3.connection import Location
from boto.s3.lifecycle import Lifecycle, Transition, Rule
... | Kickflip/python-kickflip | kickflip/kickflip.py | Python | apache-2.0 | 9,824 | 0 |
# -*- coding: utf-8 -*-
# Copyright 2015-2016 LasLabs Inc.
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html).
import mock
from contextlib import contextmanager
from odoo import _
from odoo.addons.connector_carepoint import related_action
from .common import SetUpCarepointBase
mk_file = 'odoo.add... | laslabs/odoo-connector-carepoint | connector_carepoint/tests/test_related_action.py | Python | agpl-3.0 | 4,249 | 0 |
import yaml
import tasks
from os.path import isfile, isdir, dirname, abspath, join, basename, normpath, realpath
from os import getcwd
from fabric.state import env, output
from fabric.tasks import execute
from fabric.colors import red, yellow, green, cyan
from fabric.contrib.console import confirm
from fabric.api impor... | komlenic/drubs | drubs/drubs.py | Python | gpl-2.0 | 9,647 | 0.014823 |
# -*- coding: utf-8 -*-
"""
PyLTI is module that implements IMS LTI in python
The API uses decorators to wrap function with LTI functionality.
"""
VERSION = "0.3.2" # pragma: no cover
| layus/pylti | pylti/__init__.py | Python | bsd-2-clause | 185 | 0 |
#!/usr/bin/env python
import sys
sys.path.append('../')
from logparser import LogMine, evaluator
import os
import pandas as pd
input_dir = '../logs/' # The input directory of log file
output_dir = 'LogMine_result/' # The output directory of parsing results
benchmark_settings = {
'HDFS': {
'l... | logpai/logparser | benchmark/LogMine_benchmark.py | Python | mit | 5,994 | 0.009343 |
from django.test import TestCase, override_settings
try:
from django.urls import reverse
except ImportError:
from django.core.urlresolvers import reverse
from django.contrib.auth.models import User
from django.conf import settings
class TestCsrfCookieName(TestCase):
def test_csrf_cookie_name_in_context(s... | groveco/django-sql-explorer | explorer/tests/test_csrf_cookie_name.py | Python | mit | 1,142 | 0.003503 |
import math
import os
from optparse import OptionParser
import qbfutures
from .core import Cache, Frame, Shape, Channel
def frange(a, b, step):
v = float(a)
b = float(b)
step = float(step)
while v <= b:
yield v
v += step
def iter_ticks(src_start, src_end, dst_start, dst_end, sampl... | westernx/mayatools | mayatools/fluids/retime.py | Python | bsd-3-clause | 6,890 | 0.003483 |
#!/usr/bin/env python
# coding=utf-8
#-*- coding:utf-8 -*-
import random
N = 8 #八个网页
d = 0.85 #阻尼因子为0.85
delt = 0.00001 #迭代控制变量
#两个矩阵相乘
def matrix_multi(A,B):
result = [[0]*len(B[0]) for i in range(len(A))]
for i in range(len(A)):
for j in range(len(B[0])):
for k in range(... | zhaochl/python-utils | agrith_util/page_rank/page_rank_test.py | Python | apache-2.0 | 2,180 | 0.050781 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.