code stringlengths 3 1.05M | repo_name stringlengths 5 104 | path stringlengths 4 251 | language stringclasses 1
value | license stringclasses 15
values | size int64 3 1.05M |
|---|---|---|---|---|---|
# -*- coding: utf-8 -*-
"""
A series of tests to establish that the command-line managment tools work as
advertised - especially with regards to the handling of the DJANGO_SETTINGS_MODULE
and default settings.py files.
"""
from __future__ import unicode_literals
import os
import re
import shutil
import socket
import s... | blaze33/django | tests/regressiontests/admin_scripts/tests.py | Python | bsd-3-clause | 77,347 |
# -*- coding: utf-8 -*-
VERSION = (0, 3, 181, 'final')
# pragma: no cover
if VERSION[-1] != "final":
__version__ = '.'.join(map(str, VERSION))
else:
# pragma: no cover
__version__ = '.'.join(map(str, VERSION[:-1]))
default_app_config = 'djconnectwise.apps.DjangoConnectwiseConfig'
| KerkhoffTechnologies/django-connectwise | djconnectwise/__init__.py | Python | mit | 295 |
# -*- encoding: utf-8 -*-
################################################################################
# #
# Copyright (C) 2013-Today Carlos Eduardo Vercelino - CLVsol #
# ... | CLVsol/odoo_clvhealth_jcafb | clvhealth_jcafb/history/clv_document.py | Python | agpl-3.0 | 1,571 |
"""
fstab - file ``/etc/fstab``
===========================
Parse the ``/etc/fstab`` file into a list of lines. Each line is a dictionary
of fields, named according to their definitions in ``man fstab``:
* ``fs_spec`` - the device to mount
* ``fs_file`` - the mount point
* ``fs_vfstype`` - the type of file system
* ... | wcmitchell/insights-core | insights/parsers/fstab.py | Python | apache-2.0 | 6,335 |
# 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... | eadgarchen/tensorflow | tensorflow/python/keras/_impl/keras/layers/merge_test.py | Python | apache-2.0 | 8,416 |
#!/usr/bin/python
# This file is part of Morse.
#
# Morse 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.
#
# Morse ... | retooth/morse | morse/models/bans.py | Python | gpl-3.0 | 7,601 |
"""
Given a binary tree, convert it to BST. The conversion should be done in such a way
that keeps the original structure of binary tree.
Input:
10
/ \
2 7
/ \
8 4
Output:
8
/ \
4 10
/ \
2 7
Input:
10
/ \
... | prathamtandon/g4gproblems | Graphs/binary_tree_to_bst.py | Python | mit | 1,610 |
# Задача 8. Вариант 22.
# 1-50. Доработайте игру "Анаграммы" (см. М.Доусон Программируем на Python. Гл.4) так, чтобы к каждому слову полагалась подсказка. Игрок должен получать право на подсказку в том случае, если у него нет никаких предположений. Разработайте систему начисления очков, по которой бы игроки, отгадавши... | Mariaanisimova/pythonintask | PMIa/2015/NIKISHIN_P_S/task_8_22.py | Python | apache-2.0 | 2,335 |
import sys
import os.path
sys.path.append(os.path.abspath(__file__ + "\..\.."))
import windows
import windows.native_exec.simple_x86 as x86
import windows.native_exec.simple_x64 as x64
print("Creating a notepad") ## Replaced calc.exe by notepad.exe cause of windows 10.
notepad = windows.utils.create_process(r"C:\wind... | hakril/PythonForWindows | samples/process/thread.py | Python | bsd-3-clause | 1,631 |
# Copyright (C) 2009, 2010, 2011 Rickard Lindberg, Roger Lindberg
#
# This file is part of Timeline.
#
# Timeline 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... | ezequielpereira/Time-Line | specs/SourceCodeDistribution.py | Python | gpl-3.0 | 3,772 |
from .common import name_inner_event
from .newmessage import NewMessage
from ..tl import types
@name_inner_event
class MessageEdited(NewMessage):
"""
Occurs whenever a message is edited. Just like `NewMessage
<telethon.events.newmessage.NewMessage>`, you should treat
this event as a `Message <telethon... | expectocode/Telethon | telethon/events/messageedited.py | Python | mit | 1,886 |
# Copyright (c) 2019-2021 hippo91 <guillaume.peillex@gmail.com>
# Copyright (c) 2019 Ashley Whetter <ashley@awhetter.co.uk>
# Copyright (c) 2020 Claudiu Popa <pcmanticore@gmail.com>
# Copyright (c) 2021 Pierre Sassoulas <pierre.sassoulas@gmail.com>
# Copyright (c) 2021 Daniël van Noord <13665637+DanielNoord@users.norep... | PyCQA/astroid | tests/unittest_brain_numpy_core_function_base.py | Python | lgpl-2.1 | 2,168 |
"""Functions for interpreting data in different contexts. So, inverting a
colormap, interpolating points from pixel to data coordinates, and such."""
from __future__ import division, print_function
import numpy as np
from scipy.spatial import cKDTree
def invert_cmap(pix, l, colors):
"""
Given a sequence of ... | mrterry/yoink | yoink/interp.py | Python | bsd-3-clause | 2,458 |
# -*- coding: utf-8 -*-
"""
Local settings
- Run in Debug mode
- Use console backend for emails
- Add Django Debug Toolbar
- Add django-extensions as app
"""
import socket
import os
from .common import * # noqa
# DEBUG
# ------------------------------------------------------------------------------
DEBUG = env.bo... | Alex-Just/gymlog | config/settings/local.py | Python | mit | 2,584 |
import sys
sentid_prev = 0
first_line = True
first_word = True
for line in sys.stdin:
row = line.strip().split()
if first_line:
word_ix = row.index('word')
sentid_ix = row.index('sentid')
first_line = False
else:
word = row[word_ix]
sentid = row[sentid_ix]
i... | modelblocks/modelblocks-release | resource-general/scripts/itemmeasures2lineitems.py | Python | gpl-3.0 | 588 |
import logging
import re
import sys
import time
import warnings
from contextlib import contextmanager
from functools import wraps
from unittest import TestCase, skipIf, skipUnless
from xml.dom.minidom import Node, parseString
from django.apps import apps
from django.apps.registry import Apps
from django.conf import Us... | unnikrishnankgs/va | venv/lib/python3.5/site-packages/django/test/utils.py | Python | bsd-2-clause | 23,443 |
# This file provides the installation of the python library 'isca'
# Suggested installation procedure:
# $ cd $GFDL_BASE/src/extra/python
# $ pip install -e .
# This installs the package in *development mode* i.e. any changes you make to the python files
# or any additional files you add will be immediately... | sit23/Isca | src/extra/python/setup.py | Python | gpl-3.0 | 911 |
# coding=utf-8
# Copyright 2022 The TensorFlow Datasets 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 appl... | tensorflow/datasets | tensorflow_datasets/image/clic_test.py | Python | apache-2.0 | 1,134 |
#
# Copyright (C) 2014 Uninett AS
#
# This file is part of Network Administration Visualized (NAV).
#
# NAV is free software: you can redistribute it and/or modify it under
# the terms of the GNU General Public License version 3 as published by
# the Free Software Foundation.
#
# This program is distributed in the hope... | UNINETT/nav | python/nav/web/sortedstats/forms.py | Python | gpl-2.0 | 2,379 |
"""
Django settings for app project.
For more information on this file, see
https://docs.djangoproject.com/en/1.7/topics/settings/
For the full list of settings and their values, see
https://docs.djangoproject.com/en/1.7/ref/settings/
"""
# Build paths inside the project like this: os.path.join(BASE_DIR, ...)
import... | PetrDlouhy/django-su | example/settings.py | Python | mit | 3,436 |
from simple_parsing import ArgumentParser
from dataclasses import dataclass
@dataclass
class Config:
"""Simple example of a class that can be reused"""
log_dir: str = "logs"
parser = ArgumentParser()
parser.add_arguments(Config, "train_config", prefix="train_")
parser.add_arguments(Config, "valid_config", ... | lebrice/SimpleParsing | examples/prefixing/manual_prefix_example.py | Python | mit | 382 |
# ----------------------------------------------------------------------
# Numenta Platform for Intelligent Computing (NuPIC)
# Copyright (C) 2018, Numenta, Inc. Unless you have an agreement
# with Numenta, Inc., for a separate license for this software code, the
# following terms and conditions apply:
#
# This progra... | neuroidss/nupic.research | htmresearch/regions/RawValues.py | Python | agpl-3.0 | 3,767 |
import subprocess
from build.project import Project
class ZlibProject(Project):
def __init__(self, url, md5, installed,
**kwargs):
Project.__init__(self, url, md5, installed, **kwargs)
def build(self, toolchain):
src = self.unpack(toolchain, out_of_tree=False)
subpro... | susman/mpd | python/build/zlib.py | Python | gpl-2.0 | 708 |
#!/usr/bin/python
# method - constructor
# blueprint
# class Account(object):
# class Account:
class Account:
def __init__(self): # constructor - get called implicitly.
self.balance = 0 # data
def deposit(self):
self.balance = self.balance + 1000
return self.balance
def withdraw(self):
self.balance = self.... | tuxfux-hlp-notes/python-batches | archieves/batch-65/14-oop/05-program.py | Python | gpl-3.0 | 634 |
"""
HamiltonianPy
=============
Provides
1. Unified description of common lattice with translation symmetry;
2. Bases of the Hilbert space in occupation number representation;
3. Building block for constructing a model Hamiltonian;
4. Lanczos algorithm for calculating the ground state energy and single
parti... | wangshiphys/HamiltonianPy | HamiltonianPy/__init__.py | Python | gpl-3.0 | 1,082 |
# -*- coding: utf-8 -*-
import os
import tempfile
from mock import patch
from django.conf import settings
from django.core.files.storage import default_storage as storage
from django.test.client import RequestFactory
from olympia import amo
from olympia.amo.tests import TestCase, addon_factory, req_factory_factory
f... | andymckay/addons-server | src/olympia/addons/tests/test_forms.py | Python | bsd-3-clause | 14,967 |
import config
from controlevents import CEvent, ConsoleEvent
import historybuffer
from utils import timers, hw
dim = 'Bright'
def Dim():
global dim
dim = 'Dim'
hw.GoDim(int(config.sysStore.DimLevel))
def Brighten():
global dim
dim = 'Bright'
hw.GoBright(int(config.sysStore.BrightLevel))
def DimState():
re... | kevinkahn/softconsole | guicore/screenmgt.py | Python | apache-2.0 | 807 |
#!/usr/bin/env python
"""
decorator.
"""
def command(func):
"""docstring for is_command"""
func.is_command = True
return func
| marlboromoo/basinboa | basinboa/system/decorator.py | Python | mit | 139 |
# Licensed to the StackStorm, Inc ('StackStorm') 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 use th... | grengojbo/st2 | st2actions/st2actions/config.py | Python | apache-2.0 | 3,073 |
#!/usr/bin/env python3
"""This script is written by Chuanping Yu, on Jul 24, 2017,
for the Assignment#1 in IDEaS workshop"""
#Problem 5
from fractions import gcd
def lcm(int1, int2):
"""Calculate the least common multiple of two integers, a and b."""
return int(int1*int2/gcd(int1, int2))
from functools import... | GT-IDEaS/SkillsWorkshop2017 | Week01/Problem05/cyu_05.py | Python | bsd-3-clause | 363 |
from django.db import models
class StatusPage(models.Model):
name = models.CharField(max_length=100, null=False, blank=False)
description = models.CharField(max_length=1000, null=True, blank=True, default=None)
def __str__(self):
return self.name
| leonardoarroyo/easystatus | easystatusapi/models/status_page.py | Python | gpl-3.0 | 259 |
# -*- coding: latin-1 -*-
import common
import sys, os, traceback
import time
import random
import re
import urllib
import string
import HTMLParser
from string import lower
from entities.CList import CList
from entities.CItemInfo import CItemInfo
from entities.CListItem import CListItem
from entities.CRuleItem import... | Pirata-Repository/Pirata | plugin.video.SportsDevil/lib/parser.py | Python | gpl-2.0 | 27,695 |
# -*- coding: utf-8 -*-
# Form implementation generated from reading ui file 'ui/snapshot.ui'
#
# Created: Mon Aug 31 02:59:12 2015
# by: PyQt4 UI code generator 4.11.1
#
# WARNING! All changes made in this file will be lost!
from PyQt4 import QtCore, QtGui
try:
_fromUtf8 = QtCore.QString.fromUtf8
except At... | argenortega/AUI | aui/gui/snapshots/ui_snapshot.py | Python | mit | 7,897 |
# -*- coding: utf-8 -*-
# Part of Odoo. See LICENSE file for full copyright and licensing details.
{
'name': 'France - VAT Anti-Fraud Certification (CGI 286 I-3 bis)',
'version': '1.0',
'category': 'Accounting',
'description': """
This add-on brings the technical requirements of the French regulation C... | t3dev/odoo | addons/l10n_fr_certification/__manifest__.py | Python | gpl-3.0 | 1,434 |
"""
==========================================================
Adjustment for chance in clustering performance evaluation
==========================================================
The following plots demonstrate the impact of the number of clusters and
number of samples on various clustering performance evaluation me... | chrsrds/scikit-learn | examples/cluster/plot_adjusted_for_chance_measures.py | Python | bsd-3-clause | 4,351 |
# Copyright (C) 2014, Red Hat, 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... | ChinaMassClouds/copenstack-server | openstack/src/nova-2014.2/nova/objects/virtual_interface.py | Python | gpl-2.0 | 3,724 |
#!/usr/bin/env python
# coding=utf-8
"""
Copyright (C) 2010-2013, Ryan Fan <ryan.fan@oracle.com>
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or
(at your opti... | rfancn/wxgigo | wxgigo/wxmp/sdk/recv/event/scan.py | Python | mit | 1,792 |
from __future__ import absolute_import, division, print_function
import os.path as op
import numpy as np
import numpy.testing as npt
import pdb
import gsd.hoomd
import sys
import clustering as cl
#from context import clustering as cl
#from context import smoluchowski as smol
from cdistances import conOptDistanceCython... | ramansbach/cluster_analysis | clustering/tests/test_visualization.py | Python | mit | 1,247 |
"""Resize fields
Revision ID: f2b0984f780
Revises: 37e42fa9d88e
Create Date: 2015-07-03 12:35:58.448260
"""
# revision identifiers, used by Alembic.
revision = 'f2b0984f780'
down_revision = '37e42fa9d88e'
from alembic import op
import sqlalchemy as sa
def upgrade():
op.alter_column("rlmss", "name", type_ = sa... | labsland/labmanager | alembic/versions/f2b0984f780_resize_fields.py | Python | bsd-2-clause | 430 |
from __future__ import absolute_import
from .dicty import *
| ales-erjavec/orange-bio | orangecontrib/bio/obiDicty.py | Python | gpl-3.0 | 61 |
#!/usr/bin/env python
# coding=utf-8
from __future__ import division, print_function, unicode_literals
import pprint
import pydoc
import re
from collections import namedtuple
from sacred.utils import PATHCHANGE, iterate_flattened_separately
__sacred__ = True # marks files that should be filtered from stack traces
... | kudkudak/sacred | sacred/commands.py | Python | mit | 3,454 |
# ==============================================================================
# Copyright (C) 2011 Diego Duclos
# Copyright (C) 2011-2018 Anton Vorobyov
#
# This file is part of Eos.
#
# Eos is free software: you can redistribute it and/or modify
# it under the terms of the GNU Lesser General Public License as publi... | pyfa-org/eos | eos/item/implant.py | Python | lgpl-3.0 | 1,813 |
# vim: ft=python fileencoding=utf-8 sts=4 sw=4 et:
# Copyright 2015-2016 Florian Bruhin (The Compiler) <mail@qutebrowser.org>
#
# This file is part of qutebrowser.
#
# qutebrowser 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 S... | haxwithaxe/qutebrowser | qutebrowser/misc/sessions.py | Python | gpl-3.0 | 16,440 |
#!/usr/bin/env python
# coding=utf-8
"""385. Ellipses inside triangles
https://projecteuler.net/problem=385
For any triangle T in the plane, it can be shown that there is a unique
ellipse with largest area that is completely inside T.

For a given ... | openqt/algorithms | projecteuler/pe385-ellipses-inside-triangles.py | Python | gpl-3.0 | 1,022 |
#!/usr/bin/env python
# Copyright (C) 2010 Gabor Rapcsanyi <rgabor@inf.u-szeged.hu>, University of Szeged
# Copyright (C) 2010 Google Inc. All rights reserved.
#
# All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following condit... | youfoh/webkit-efl | Tools/Scripts/webkitpy/layout_tests/port/webkit_unittest.py | Python | lgpl-2.1 | 11,495 |
# -*- cpy-indent-level: 4; indent-tabs-mode: nil -*-
# ex: set expandtab softtabstop=4 shiftwidth=4:
#
# Copyright (C) 2008,2009,2010,2011,2012,2013,2014,2015,2016,2017 Contributor
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# Y... | guillaume-philippon/aquilon | lib/aquilon/worker/commands/map_grn.py | Python | apache-2.0 | 4,020 |
"""
OEDocking utilities.
"""
__author__ = "Steven Kearnes"
__copyright__ = "Copyright 2014, Stanford University"
__license__ = "3-clause BSD"
import numpy as np
from openeye.oechem import *
from openeye.oedocking import *
def read_receptor(filename):
"""
Read a receptor from a file.
Parameters
---... | skearnes/color-features | oe_utils/docking/__init__.py | Python | bsd-3-clause | 4,260 |
#!/usr/bin/python
# -*- coding: utf-8 -*-
#
# This file is largely copied from the Nagios module included in the
# Func project. Original copyright follows:
#
# func-nagios - Schedule downtime and enables/disable notifications
# Copyright 2011, Red Hat, Inc.
# Tim Bielawa <tbielawa@redhat.com>
#
# This software may be ... | chepazzo/ansible-modules-extras | monitoring/nagios.py | Python | gpl-3.0 | 33,186 |
# -----------------------------------------------------------------------------
# ply: yacc.py
#
# Copyright (C) 2001-2015,
# David M. Beazley (Dabeaz LLC)
# All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions a... | jonpry/PHDL | ply/yacc.py | Python | gpl-2.0 | 135,805 |
# -*- coding: utf-8 -*-
#
# Copyright © 2011 Pierre Raybaut
# Licensed under the terms of the MIT License
# (see spyderlib/__init__.py for details)
"""
openfisca_qt.gui.qt.compat
-------------------
Transitional module providing compatibility functions intended to help
migrating from PyQt to PySide.
This module shou... | openfisca/openfisca-qt | openfisca_qt/gui/qt/compat.py | Python | agpl-3.0 | 8,179 |
__author__ = 'Exter, 0xBADDCAFE'
import wx
class FTDropTarget(wx.DropTarget):
"""
Implements drop target functionality to receive files and text
receiver - any WX class that can bind to events
evt - class that comes from wx.lib.newevent.NewCommandEvent call
class variable ID_DROP_FILE
class... | exter/pycover | droptarget.py | Python | mit | 1,525 |
#!/usr/bin/python2
import xml.dom.minidom
import sys
from contextlib import closing
import urllib2
import pprint
def output(link, title=''):
if withtitle=="1":
print title.encode('utf-8'),"\n",link
else:
print link
withtitle = False
if len(sys.argv) > 2:
withtitle = sys.argv[2]
with closing(urllib2.urlope... | superkartoffel/fernbedienung | listPodcast.py | Python | gpl-2.0 | 970 |
import unittest
import test._test_multiprocessing
test._test_multiprocessing.install_tests_in_module_dict(globals(), 'fork')
if __name__ == '__main__':
unittest.main()
| Microvellum/Fluid-Designer | win64-vc/2.78/python/lib/test/test_multiprocessing_fork.py | Python | gpl-3.0 | 174 |
from __future__ import absolute_import, unicode_literals
from six import text_type
from django.db import models
from django.db.models.query import QuerySet
from django.utils import timezone
from django.utils.encoding import python_2_unicode_compatible
from django.utils.text import slugify
from django.utils.translatio... | frague59/wagtailpolls | wagtailpolls/models.py | Python | bsd-3-clause | 2,687 |
# This code is so you can run the samples without installing the package
import sys
import os
sys.path.insert(0, os.path.join(os.path.dirname(__file__), '..'))
#
testinfo = "s, t 1, s, t 2, s, t 3, s, t 4.1, s, t 4.2, s, q"
tags = "FadeIn, FadeOut, ColorLayer"
import pyglet
from pyglet.gl import *
import cocos
from ... | eevee/cocos2d-mirror | test/test_fadeout_layer.py | Python | bsd-3-clause | 802 |
# -*- coding: utf-8 -*-
# (c) 2016 Alfredo de la Fuente - AvanzOSC
# License AGPL-3 - See http://www.gnu.org/licenses/agpl-3.0.html
from openerp import models, fields, api, _
class MrpWorkOrderProduce(models.TransientModel):
_inherit = "mrp.work.order.produce"
qty_to_produce = fields.Integer(string='Quantity... | esthermm/odoomrp-wip | mrp_operations_rejected_quantity/wizard/mrp_work_order_produce.py | Python | agpl-3.0 | 6,694 |
# Author: Nic Wolfe <nic@wolfeden.ca>
# URL: http://code.google.com/p/sickbeard/
#
# This file is part of Sick Beard.
#
# Sick Beard 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 Lice... | stephanehenry27/Sickbeard-anime | sickbeard/name_parser/regexes.py | Python | gpl-3.0 | 19,613 |
# -*- coding: utf-8 -*-
# Copyright (c) 2015, thumbor-community
# Use of this source code is governed by the MIT license that can be
# found in the LICENSE file.
import logging
from redis import Redis, RedisError
from thumbor.utils import on_exception
from tornado.concurrent import return_future
from tc_shortener.... | thumbor-community/shortener | tc_shortener/storages/redis_storage.py | Python | mit | 2,587 |
import _plotly_utils.basevalidators
class XcalendarValidator(_plotly_utils.basevalidators.EnumeratedValidator):
def __init__(self, plotly_name="xcalendar", parent_name="histogram", **kwargs):
super(XcalendarValidator, self).__init__(
plotly_name=plotly_name,
parent_name=parent_name... | plotly/plotly.py | packages/python/plotly/plotly/validators/histogram/_xcalendar.py | Python | mit | 1,013 |
import numpy as np
import pickle
from pygmin.potentials.lj import LJ
from pygmin.NEB.NEB import NEB
import pylab as pl
dataset = pickle.load(open("coords.3.dat", "r"))
pot = LJ()
for coords1,coords2 in dataset:
neb = NEB(coords1,coords2,pot)
neb.optimize()
pl.plot(neb.energies)
pl.show()
| js850/PyGMIN | scripts/benchmark/neb_benchmark.py | Python | gpl-3.0 | 311 |
#
# 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 us... | esi-mineset/spark | examples/src/main/python/parquet_inputformat.py | Python | apache-2.0 | 2,386 |
# -*- coding: utf-8 -*-
# vim: autoindent shiftwidth=4 expandtab textwidth=120 tabstop=4 softtabstop=4
###############################################################################
# OpenLP - Open Source Lyrics Projection #
# ------------------------------------------------------... | crossroadchurch/paul | openlp/core/ui/formattingtagform.py | Python | gpl-2.0 | 9,571 |
#!/usr/bin/env python
"""
Compute formation enthalpy from given structures.
The 1st file in the arguments is the product and the following files are the reactants.
(Assuming that the product is only one chemical compound not plural.)
If --erg-xxx option is not specified, pmd will be performed to get energies.
Usage:
... | ryokbys/nap | nappy/fenthalpy.py | Python | mit | 9,251 |
# -*- coding:Utf-8 -*-
from tastypie import fields as base_fields
from tastypie_mongoengine import fields
from core.api.utils import VosaeResource
from vosae_settings.models.core_settings import StorageQuotasSettings, CoreSettings
from vosae_settings.api.doc import HELP_TEXT
__all__ = (
'CoreSettingsResource',
... | Naeka/vosae-app | www/vosae_settings/api/resources/core_settings.py | Python | agpl-3.0 | 1,145 |
#!/usr/bin/python
# -*- coding: utf-8 -*-
print("Hello world!")
| djrlj694/Python-Demo | hello_world.py | Python | unlicense | 65 |
#
# Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance with the License. You may obtain
# a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# ... | openstack/heat | heat/tests/api/openstack_v1/test_stacks.py | Python | apache-2.0 | 119,840 |
from sklearn2sql_heroku.tests.regression import generic as reg_gen
reg_gen.test_model("MLPRegressor" , "RandomReg_500" , "oracle")
| antoinecarme/sklearn2sql_heroku | tests/regression/RandomReg_500/ws_RandomReg_500_MLPRegressor_oracle_code_gen.py | Python | bsd-3-clause | 133 |
### This program intends to list all reference in NodeExpandList.csv;
### Author: Ye Gao
### Date: 2017-11-8
import csv
import os
import re
import scrapy
file = open('RootPath.dat', 'r')
path = (file.read()).replace("\n", "") # read path from path.dat;
file.close()
LocalPath = 'file://' + path + 'rl.html'
file = o... | sortsimilar/Citation-Tree | listref.py | Python | apache-2.0 | 6,423 |
"""Allauth overrides"""
import pickle
import logging
from allauth.account.adapter import DefaultAccountAdapter
from django.template.loader import render_to_string
from readthedocs.core.utils import send_email
try:
from django.utils.encoding import force_text
except ImportError:
from django.utils.encoding im... | tddv/readthedocs.org | readthedocs/core/adapters.py | Python | mit | 1,609 |
"""Logical relations between sequences of truth conditions.
https://en.wikipedia.org/wiki/Template:Logical_connectives_table_and_Hasse_diagram
https://commons.wikimedia.org/wiki/File:Logical_connectives_Hasse_diagram.svg
https://commons.wikimedia.org/wiki/File:Logical_connectives_table.svg
https://commons.wikimedia.o... | xflr6/concepts | concepts/junctors.py | Python | mit | 5,798 |
#!/usr/bin/env python
#Quickly clean my music, videos and images into a different directory.
#QuickClean.py
#Version 0.02
import glob
import sys
import os
import shutil
import argparse
parser = argparse.ArgumentParser(description='A quick way to clean out your cluttered folders.')
parser.add_argument('-s','--source',... | shayekharjan/QuickClean.py | QuickClean.py | Python | mit | 2,560 |
#!/usr/bin/env python
from unittest import TestCase
from fundamentals.recursion.hanoi.tower import Tower
class TestTower(TestCase):
def test_adding(self):
t = Tower(0, "a")
t.add(3)
t.add(2)
self.assertEqual(2, t.size())
t.pop()
t.add(1)
self.assertEqual(... | davjohnst/fundamentals | tests/recursion/hanoi/test_tower.py | Python | apache-2.0 | 445 |
# Copyright (c) 2013, Web Notes Technologies Pvt. Ltd. and Contributors
# MIT License. See license.txt
from __future__ import unicode_literals
import time
import poplib
import frappe
from frappe.utils import extract_email_id, convert_utc_to_user_timezone, now, cint
from frappe.utils.scheduler import log
class EmailS... | geo-poland/frappe | frappe/utils/email_lib/receive.py | Python | mit | 7,591 |
# -*- coding: utf-8 -*-
import datetime
import httplib as http
import time
import furl
import itsdangerous
import jwe
import jwt
import mock
from django.utils import timezone
from framework.auth import cas, signing
from framework.auth.core import Auth
from framework.exceptions import HTTPError
from modularodm import ... | cwisecarver/osf.io | tests/test_addons.py | Python | apache-2.0 | 40,302 |
from .common import Common
from .vocabulary import ThreatDescriptor as td
from .vocabulary import ThreatExchange as t
class ThreatDescriptor(Common):
_URL = t.URL + t.VERSION + t.THREAT_DESCRIPTORS
_DETAILS = t.URL + t.VERSION
_RELATED = t.URL + t.VERSION
_fields = [
td.ADDED_ON,
td.... | mgoffin/ThreatExchange | pytx/pytx/threat_descriptor.py | Python | bsd-3-clause | 1,351 |
import urlparse
from django.core.urlresolvers import reverse
from django.utils.encoding import smart_str
import jinja2
from jingo import register
from tower import ugettext as _, ugettext_lazy as _lazy
import mkt
from access import acl
from amo.helpers import impala_breadcrumbs
from mkt.developers.helpers import mkt... | jinankjain/zamboni | mkt/reviewers/helpers.py | Python | bsd-3-clause | 4,876 |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
"""Import produce and instatiate Objects using produce.Produce"""
import produce
TOMATO = produce.Produce()
EGGPLANT = produce.Produce(arrival=1311210802)
TOMATO_ARRIVAL = TOMATO.arrival
EGGPLANT_EXPIRES = EGGPLANT.get_expiration()
| ModestoCabrera/is210-week-11-warmup | task_01.py | Python | mpl-2.0 | 279 |
import json
import os.path
from .. import config
DATA_DIR = os.path.dirname(__file__) + "/data/test_config"
EXPECTED_CONFIG = DATA_DIR + "/expected.json"
def test_load_config():
with open(EXPECTED_CONFIG, "r") as expected_f:
expected = json.load(expected_f)
actual = config.load_config(DATA_DIR)
... | wiki-ai/editquality | editquality/tests/test_config.py | Python | mit | 476 |
#!/usr/bin/env python
import os, sys
if __name__ == "__main__":
os.environ.setdefault("DJANGO_SETTINGS_MODULE", "project.settings")
from django.core.management import execute_from_command_line
execute_from_command_line(sys.argv)
| MadeInHaus/django-social | example/SocialExample/manage.py | Python | mit | 242 |
'''
Implement regular expression matching with support for '.' and '*'.
'.' Matches any single character.
'*' Matches zero or more of the preceding element.
The matching should cover the entire input string (not partial).
The function prototype should be:
bool isMatch(const char *s, const char *p)
Some examples:
is... | gavinfish/leetcode-share | python/010 Regular Expression Matching.py | Python | mit | 4,127 |
from model.group import Group
import random
import string
import os.path
import jsonpickle
import getopt
import sys
try:
opts, args = getopt.getopt(sys.argv[1:], "n:f:", ["number of groups", "file"])
except getopt.GetoptError as err:
getopt.usage()
sys.exit(2)
n = 5
f = "data/groups.json"
for o, a in op... | SherMary/python_training | generator/group.py | Python | apache-2.0 | 1,001 |
#! /usr/bin/env python
# -*- coding:Utf-8 -*-
from exercice_10_18 import voyelle
def compteVoyelles(chu):
"compte les voyelles présentes dans la chaîne unicode chu"
n = 0
for c in chu:
if voyelle(c):
n = n + 1
return n
# Test :
if __name__ == '__main__':
phrase ="Maître corbea... | widowild/messcripts | exercice/python2/solutions/exercice_10_19.py | Python | gpl-3.0 | 451 |
# -*- coding: utf-8 -*-
# -*- coding: utf-8 -*-
# Copyright (C) 2013-Today Carlos Eduardo Vercelino - CLVsol
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl).
from . import event_mass_edit
| CLVsol/clvsol_odoo_addons | clv_event_history/wizard/__init__.py | Python | agpl-3.0 | 205 |
# -*- coding: utf-8 -*-
#
# Copyright (C) 2007-2011 Edgewall Software
# All rights reserved.
#
# This software is licensed as described in the file COPYING, which
# you should have received as part of this distribution. The terms
# are also available at http://babel.edgewall.org/wiki/License.
#
# This software consists... | hoosteeno/fjord | vendor/packages/Babel-2.1.1/tests/test_support.py | Python | bsd-3-clause | 12,386 |
# Copyright (c) 2009, Andrew McNabb
from errno import EINTR
from copy import deepcopy
import os
import select
import signal
import sys
import datetime
import cPickle
from psshlib.askpass_server import PasswordServer
from psshlib import psshutil
from psshlib.ui import ProgressBar, ask_yes_or_no, clear_line, print_task... | jorik041/parallel-ssh | psshlib/manager.py | Python | bsd-3-clause | 12,648 |
import pandas as pd
import datetime
import numpy as np
from sklearn import preprocessing, cross_validation, svm, linear_model
import matplotlib.pyplot as plt
from sklearn.learning_curve import learning_curve
from sklearn.feature_selection import RFE, RFECV
import os
os.system('clear')
"""Found at http://scikit-learn.... | JVP3122/Python-Machine-Learning-NFL-Game-Predictor | v1/simple_regression.py | Python | gpl-3.0 | 19,830 |
# -*- coding: utf-8 -*-
# Generated by Django 1.9.2 on 2017-02-13 21:02
from __future__ import unicode_literals
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('gestioneide', '0038_pruebanivel'),
]
operations = [
migrations.AlterField(
... | Etxea/gestioneide | gestioneide/migrations/0039_auto_20170213_2202.py | Python | gpl-3.0 | 606 |
# 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 in writing, ... | google/vulncode-db | tests/app_tests/api/test_routes.py | Python | apache-2.0 | 3,216 |
"""
This component provides HA sensor support for Ring Door Bell/Chimes.
For more details about this platform, please refer to the documentation at
https://home-assistant.io/components/sensor.ring/
"""
from datetime import timedelta
import logging
import voluptuous as vol
from homeassistant.components.sensor import ... | jamespcole/home-assistant | homeassistant/components/ring/sensor.py | Python | apache-2.0 | 6,215 |
# Copyright 2020 The StackStorm Authors.
# Copyright 2019 Extreme Networks, 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 ... | StackStorm/st2 | st2common/st2common/util/ip_utils.py | Python | apache-2.0 | 3,449 |
# This file is part of Indico.
# Copyright (C) 2002 - 2019 CERN
#
# Indico is free software; you can redistribute it and/or
# modify it under the terms of the MIT License; see the
# LICENSE file for more details.
from __future__ import unicode_literals
def serialize_ip_network_group(group):
"""Serialize group to... | mvidalgarcia/indico | indico/modules/networks/util.py | Python | mit | 506 |
from django.core.urlresolvers import reverse
from django.test import SimpleTestCase
class URLEndpointTestCase(SimpleTestCase):
def test_get_root_view(self):
url = reverse('homepage')
response = self.client.get(url)
self.assertEqual(200, response.status_code)
def test_get_editor_view... | microserv/frontend | editor_backend/editor_backend/tests.py | Python | mit | 2,241 |
# coding=utf-8
# Copyright 2021 Google Health Research.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable la... | google/ehr-predictions | ehr_prediction_modeling/embeddings/basic_embedding_lookup.py | Python | apache-2.0 | 2,155 |
import itertools
import sys
input_filename = sys.argv[1]
with open(input_filename) as f:
input = f.read()
checksum = 0
for line in input.split('\n'):
line = line.strip()
for a, b in itertools.product(line.split(), repeat=2):
if a == b:
continue
a = int(a)
b = int(b)
... | mofr/advent-of-code | 2017/day02.py | Python | apache-2.0 | 407 |
#!/usr/bin/env python3
# rFactor .scn/.gen file manipulation tool
# Copyright (C) 2014 Ingo Ruhnke <grumbel@gmail.com>
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the ... | Grumbel/rfactortools | vehtool.py | Python | gpl-3.0 | 1,619 |
from importlib import import_module
from fabric.api import env
from fabric.api import cd, run, settings, sudo
from fabric.contrib.files import append, comment, exists
from .deploy import AllowedException, checkout_branch, deploy, get_repo_dir, WEBADMIN_GROUP
env.use_ssh_config = True
REPO_FULL_NAME = 'GitHubU... | kbarnes3/BaseDjangoSite | web/fabric_utils/setup.py | Python | bsd-2-clause | 6,296 |
#!/usr/bin/python3
import asyncore
import socket
import time
import random
class EchoHandler(asyncore.dispatcher_with_send):
def handle_read(self):
data = self.recv(8192)
print(data)
#self.send(data)
class EchoServer(asyncore.dispatcher):
def __init__(self, host, port):
asy... | elaeon/sensors | tests/test_server.py | Python | gpl-2.0 | 870 |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
#
# This file is part of the python-chess library.
# Copyright (C) 2012-2015 Niklas Fiekas <niklas.fiekas@tu-clausthal.de>
#
# 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 F... | denim2x/python-chess | test.py | Python | gpl-3.0 | 86,529 |
# 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... | nathanbjenx/cairis | cairis/gui/DomainPropertyNodeDialog.py | Python | apache-2.0 | 1,553 |
import math
import nltk
import time
import sys
# Constants to be used by you when you fill the functions
START_SYMBOL = '*'
STOP_SYMBOL = 'STOP'
MINUS_INFINITY_SENTENCE_LOG_PROB = -1000
log2 = lambda x: math.log(x, 2)
# TODO: IMPLEMENT THIS FUNCTION
# Calculates unigram, bigram, and trigram probabilities given a tra... | Alexoner/mooc | coursera/nlpintro-001/Assignment2/solutionsA.py | Python | apache-2.0 | 9,462 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.