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 |
|---|---|---|---|---|---|
from __future__ import absolute_import
from __future__ import print_function
from __future__ import unicode_literals
from django.apps import AppConfig
class KolibriContentConfig(AppConfig):
name = 'kolibri.core.content'
label = 'content'
verbose_name = 'Kolibri Content'
def ready(self):
from... | DXCanas/kolibri | kolibri/core/content/apps.py | Python | mit | 410 |
"""
.. module: lemur.destinations.views
:platform: Unix
:synopsis: This module contains all of the accounts view code.
:copyright: (c) 2015 by Netflix Inc., see AUTHORS for more
:license: Apache, see LICENSE for more details.
.. moduleauthor:: Kevin Glisson <kglisson@netflix.com>
"""
from flask import B... | rhoml/lemur | lemur/destinations/views.py | Python | apache-2.0 | 12,247 |
from django.db.models.signals import post_save
from django.dispatch import receiver
from django.conf import settings
import logging
from . import models
logger = logging.getLogger("project")
@receiver(post_save, sender=settings.AUTH_USER_MODEL)
def create_profile_handler(sender, instance, created, **kwargs):
i... | furthz/colegio | src/profiles/signals.py | Python | mit | 581 |
# ----------------------------------------------------------------------
# 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 | projects/union_path_integration/ideal_sim.py | Python | agpl-3.0 | 4,475 |
# -*- coding: utf-8 -*-
#
# PHP Curl Class documentation build configuration file, created by
# sphinx-quickstart.
#
# This file is execfile()d with the current directory set to its
# containing dir.
#
# Note that not all possible configuration values are present in this
# autogenerated file.
#
# All configuration valu... | elliottpost/lsm-front-end | vendor/php-curl-class/php-curl-class/docs/source/conf.py | Python | apache-2.0 | 9,312 |
import socket
if socket.gethostname() == 'Faramir': #for CNN_B
data_root = '/home/tencia/Documents/data/heart/'
data_kaggle = data_root + 'kaggle'
data_sunnybrook = data_root + 'sunnybrook'
local_root = '/home/tencia/Dropbox/heart/diagnose-heart/'
data_manual = local_root + 'manual_data'
data_in... | woshialex/diagnose-heart | SETTINGS.py | Python | mit | 978 |
str_no_string = 0
str_empty_string = 1
str_yes = 2
str_no = 3
str_blank_string = 4
str_error_string = 5
str_s0 = 6
str_blank_s1 = 7
str_reg1 = 8
str_s50_comma_s51 = 9
str_s50_and_s51 = 10
str_s52_comma_s51 = 11
str_s52_and_s51 = 12
str_msg_battle_won = 13
str_charge = 14
str_color = 15
str_hold_fire = 16
str_blunt_hold... | CatalansMB/War1714 | src/ID_strings.py | Python | gpl-2.0 | 30,810 |
# -*- coding: utf-8 -*-
from __future__ import print_function, unicode_literals
import logging
import os
import sys
try:
from magic import from_file as magic_from_file
except ImportError:
magic_from_file = None
from six.moves import SimpleHTTPServer as srvmod
from six.moves import socketserver
class Comple... | jimperio/pelican | pelican/server.py | Python | agpl-3.0 | 2,272 |
# -*- coding: utf-8 -*-
# flake8: noqa
from __future__ import unicode_literals
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('base', '0003_auto_20160821_1919'),
]
operations = [
migrations.AlterField(
model_name='contactrol... | terranodo/geonode | geonode/base/migrations/0004_auto_20160824_0245.py | Python | gpl-3.0 | 1,977 |
"""
This module houses the ctypes initialization procedures, as well
as the notice and error handler function callbacks (get called
when an error occurs in GEOS).
This module also houses GEOS Pointer utilities, including
get_pointer_arr(), and GEOM_PTR.
"""
import logging
import os
import re
from ctypes import CD... | KrzysztofStachanczyk/Sensors-WWW-website | www/env/lib/python2.7/site-packages/django/contrib/gis/geos/libgeos.py | Python | gpl-3.0 | 6,216 |
# -*- coding: utf-8 -*-
#
# complexity documentation build configuration file, created by
# sphinx-quickstart on Tue Jul 9 22:26:36 2013.
#
# This file is execfile()d with the current directory set to its containing dir.
#
# Note that not all possible configuration values are present in this
# autogenerated file.
#
# ... | qba73/circleclient | docs/conf.py | Python | mit | 8,265 |
# ------------------------------------------------------------------------------------------------
# Copyright (c) 2016 Microsoft Corporation
#
# Permission is hereby granted, free of charge, to any person obtaining a copy of this software and
# associated documentation files (the "Software"), to deal in the Software ... | tnarik/malmo | Malmo/test/PythonTests/test_agent_host.py | Python | mit | 2,418 |
#!/usr/bin/env python
__version__ = '1.4.0'
| terjekv/zabbix-cli | zabbix_cli/version.py | Python | gpl-3.0 | 44 |
from pages.page import Page
from selenium.webdriver.common.by import By
from selenium import webdriver
class InternalPage(Page):
@property
def logout_button(self):
return self.driver.find_element_by_css_selector("nav a[href $= '?logout']")
@property
def user_management_link(self):
re... | sargm/selenium-py-traning-barancev | php4dvd/pages/internal_page.py | Python | apache-2.0 | 770 |
# 448. Find All Numbers Disappeared in an Array QuestionEditorial Solution My Submissions
# Total Accepted: 114
# Total Submissions: 215
# Difficulty: Medium
# Contributors: yuhaowang001
# Given an array of integers where 1 ≤ a[i] ≤ n (n = size of array), some elements appear twice and others appear once.
#
# Find ... | shawncaojob/LC | QUESTIONS/448_find_all_numbers_disappered_in_an_array_G.py | Python | gpl-3.0 | 643 |
# there is no specific lieklihood code for this experiment, because it
# falls in the category of CMB experiments described in the "newdat"
# format. The class below inherits the properties of a general class
# "Likelihood_newdat", which knows how to deal with all experiments in
# "newdat" format.
from montepython.lik... | baudren/montepython_public | montepython/likelihoods/boomerang/__init__.py | Python | mit | 406 |
from django.db import models
from .base import MessageAbstractModel
class SMS(MessageAbstractModel):
cmid = models.TextField()
class Meta:
verbose_name = 'SMS'
verbose_name_plural = verbose_name
def send_message(self, async=True):
from communications.tasks.sms import SendSMSTas... | dobestan/fastblog | fastblog/communications/models/sms.py | Python | mit | 442 |
from _pydevd_bundle.pydevd_constants import USE_LIB_COPY, izip
try:
try:
if USE_LIB_COPY:
from _pydev_imps._pydev_saved_modules import xmlrpclib
else:
import xmlrpclib
except ImportError:
import xmlrpc.client as xmlrpclib
except ImportError:
from... | SlicerRt/SlicerDebuggingTools | PyDevRemoteDebug/ptvsd-4.1.3/ptvsd/_vendored/pydevd/_pydev_bundle/pydev_imports.py | Python | bsd-3-clause | 1,505 |
"""The tests for Device tracker device conditions."""
import pytest
import homeassistant.components.automation as automation
from homeassistant.components.device_automation import DeviceAutomationType
from homeassistant.components.device_tracker import DOMAIN
from homeassistant.const import STATE_HOME
from homeassista... | rohitranjan1991/home-assistant | tests/components/device_tracker/test_device_condition.py | Python | mit | 4,518 |
"""SCons.Tool.install
Tool-specific initialization for the install tool.
There normally shouldn't be any need to import this module directly.
It will usually be imported through the generic SCons.Tool.Tool()
selection method.
"""
#
# Copyright (c) 2001 - 2016 The SCons Foundation
#
# Permission is hereby granted, fr... | xiaohaidao007/pandoraBox-SDK-mt7620 | staging_dir/host/lib/scons-2.5.0/SCons/Tool/install.py | Python | gpl-2.0 | 15,735 |
# -*- encoding: utf-8 -*-
##############################################################################
#
# OpenERP, Open Source Management Solution
# Copyright (C) 2011 Smile (<http://www.smile.fr>). All Rights Reserved
#
# This program is free software: you can redistribute it and/or modify
# it under th... | 3dfxsoftware/cbss-addons | smile_access_control/res_group.py | Python | gpl-2.0 | 4,958 |
##############################################################################
# Copyright (c) 2013-2017, Lawrence Livermore National Security, LLC.
# Produced at the Lawrence Livermore National Laboratory.
#
# This file is part of Spack.
# Created by Todd Gamblin, tgamblin@llnl.gov, All rights reserved.
# LLNL-CODE-64... | skosukhin/spack | var/spack/repos/builtin/packages/foam-extend/package.py | Python | lgpl-2.1 | 15,255 |
import warnings
from typing import Optional, Union, List, Dict, Tuple, Iterable, Any, Callable, Sequence
from typing import cast
from collections import defaultdict
from pathlib import Path
import srsly
from .pipe import Pipe
from ..training import Example
from ..language import Language
from ..errors import Errors, W... | honnibal/spaCy | spacy/pipeline/entityruler.py | Python | mit | 20,510 |
#!/usr/bin/env python
"""Django's command-line utility for administrative tasks."""
import os
import sys
def main():
"""Run administrative tasks."""
os.environ.setdefault('DJANGO_SETTINGS_MODULE', 'todo.settings')
try:
from django.core.management import execute_from_command_line
except ImportE... | bugsnag/bugsnag-python | tests/fixtures/django4/manage.py | Python | mit | 660 |
#coding:utf-8
#第 0000 题:将你的 QQ 头像(或者微博头像)右上角加上红色的数字,类似于微信未读信息数量那种提示效果。
from PIL import Image, ImageDraw, ImageFont
__author__ = 'Hunter'
def picture_num(img,num):
im = ImageDraw.Draw(img)
print(img.size)
numFont = ImageFont.truetype("ahronbd.ttf",300)
im.text((260, -50), num, fill=(255, 0, 0),font=num... | Show-Me-the-Code/python | wssywh/0000/0000.py | Python | mit | 552 |
#!/usr/bin/env python
# -*- coding:utf-8 -*-
# -*- author:miko-*-
# python3抓取bing主页所有背景图片
import urllib.request
import urllib,re,sys,os
def get_bing_backphoto():
if (os.path.exists('img')== False):
os.mkdir('img')
for i in range(0,24):
url = 'https://cn.bing.com/?toHttps=1&redig=265CBC0D09884CB... | sinomiko/project | IdeaProjects/crap/bingScrapy.py | Python | bsd-3-clause | 1,160 |
import base64
import xml.etree.ElementTree as ET
from . import log
class Response:
""" Response objects for the DBGP module.
Contains response data from a command made to the debugger.
"""
ns = '{urn:debugger_protocol_v1}'
def __init__(self, response, cmd, cmd_args, api):
self.response... | paprykarz/vdebug | python3/vdebug/dbgp.py | Python | mit | 18,056 |
import sys,Skylake
SERVER_ADDRESS = (HOST, PORT) = '', 8888
def make_server(server_address):
server = Skylake.SkylakeServer(server_address)
return server
if __name__ == '__main__':
httpd = make_server(SERVER_ADDRESS)
print('SkylakeWebServer: Serving HTTP on port {port} ...\n'.format(port=PORT... | kochiyasanae1/skylake | test.py | Python | mit | 349 |
# -*- encoding: utf-8 -*-
"""
graph.py : tools for constructing and modifying graphs, i.e. sets of vertices
connected by edges.
@author: Andries Effting
Copyright (C) 2021 Andries Effting, Delmic
This program is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public Licens... | delmic/odemis | src/odemis/util/graph.py | Python | gpl-2.0 | 9,789 |
#
# This file is part of the PyMeasure package.
#
# Copyright (c) 2013-2021 PyMeasure Developers
#
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the "Software"), to deal
# in the Software without restriction, including without limit... | ralph-group/pymeasure | pymeasure/instruments/lakeshore/lakeshore331.py | Python | mit | 5,077 |
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.db import models, migrations
from django.conf import settings
class Migration(migrations.Migration):
dependencies = [
migrations.swappable_dependency(settings.AUTH_USER_MODEL),
]
operations = [
migrations.Create... | r-o-b-b-i-e/pootle | pootle/apps/reports/migrations/0001_initial.py | Python | gpl-3.0 | 1,181 |
import types
import operator
from collections import OrderedDict, Sequence
from magma.t import Flip, IntegerTypes
from magma.port import INPUT, OUTPUT, INOUT
from magma.bit import BitType, VCC, GND
from magma.array import ArrayType
from magma.tuple import TupleType
from magma.circuit import *
from magma.wire import wir... | bjmnbraun/icestick_fastio | thirdparty/magma/magma/ir.py | Python | mit | 2,839 |
#!/usr/bin/env python
# This file should be compatible with both Python 2 and 3.
# If it is not, please file a bug report.
"""
This is a PermissionAccepter object used to get user approval of permissions via the command line.
"""
#external imports
import os
from collections import OrderedDict
#internal imports
from s... | peter1000/subuser | logic/subuserlib/classes/permissionsAccepters/acceptPermissionsAtCLI.py | Python | lgpl-3.0 | 2,995 |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
import os
import random
import pygame
import pygame.gfxdraw
from hud import Button, Label, HudElement
from layers import LayersHandler
from nautili import colors
from renderer import Renderer
import settings
import wind
class Panel(object):
def __init__(self, game,... | aikikode/nautili | nautili/panels.py | Python | gpl-3.0 | 12,872 |
#!/usr/bin/env python
'''
mouse_and_match.py [-i path | --input path: default ../data/]
Demonstrate using a mouse to interact with an image:
Read in the images in a directory one by one
Allow the user to select parts of an image with a mouse
When they let go of the mouse, it correlates (using matchTemplate) that pa... | zzjkf2009/Midterm_Astar | opencv/samples/python/mouse_and_match.py | Python | mit | 2,758 |
import pandas as pd
import numpy as np
import pickle
import tables
from sklearn.preprocessing import LabelEncoder
train_file = 'train_users_2'
test_file = 'test_users'
data_learn = pd.read_csv('../Data/%s.csv' % train_file, index_col='id')
data_test = pd.read_csv('../Data/%s.csv' % test_file, index_col='id')
# Encod... | RomainSabathe/kaggle_airbnb2015 | Code/create_encoders.py | Python | mit | 2,686 |
#!/usr/bin/env python3
# Copyright (c) 2017 The Bitcoin Core developers
# Distributed under the MIT software license, see the accompanying
# file COPYING or http://www.opensource.org/licenses/mit-license.php.
"""Test the -uacomment option."""
from test_framework.test_framework import PivxTestFramework
from test_framew... | Mrs-X/PIVX | test/functional/feature_uacomment.py | Python | mit | 1,480 |
# Copyright 2013 Cloudbase Solutions Srl
# 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 r... | openstack/compute-hyperv | compute_hyperv/nova/imagecache.py | Python | apache-2.0 | 11,925 |
'''
Test offering client cert to origin
'''
# 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 Lice... | chitianhao/trafficserver | tests/gold_tests/tls/tls_client_cert.test.py | Python | apache-2.0 | 15,301 |
#-*- coding: utf-8 -*
"""
Доделать
выбор скорости
показать, если ли другие варианты, давать выбирать их
кнопку пояснение (аудио)
кнопку подсказка (
"""
"""
Модуль "Робот" для обучения программированию. Версия 2.0
1. знакомство с командами управления и закраски, обход стены
2. процедуры (функции)
3. условие (ветв... | IlinArkady/IlinArkady | practice4/robot.py | Python | gpl-3.0 | 48,182 |
#!/usr/bin/env python
#
# Copyright 2014 The Chromium Authors. All rights reserved.
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
"""Archives a set of files.
"""
import ast
import optparse
import os
import sys
import zipfile
def DoZip(inputs, output, base_dir):... | AndroidOpenDevelopment/android_external_chromium_org | build/android/gn/zip.py | Python | bsd-3-clause | 1,012 |
from sklearn2sql_heroku.tests.classification import generic as class_gen
class_gen.test_model("SGDClassifier" , "FourClass_10" , "postgresql")
| antoinecarme/sklearn2sql_heroku | tests/classification/FourClass_10/ws_FourClass_10_SGDClassifier_postgresql_code_gen.py | Python | bsd-3-clause | 145 |
from devito.ir.iet.nodes import * # noqa
from devito.ir.iet.visitors import * # noqa
from devito.ir.iet.utils import * # noqa
from devito.ir.iet.efunc import * # noqa
from devito.ir.iet.algorithms import * # noqa
| opesci/devito | devito/ir/iet/__init__.py | Python | mit | 218 |
#!/usr/bin/env python
# hashlib is only available in python >= 2.5
try:
import hashlib
_digest = hashlib.sha1
except ImportError:
import sha
_digest = sha.new
import sys
import os
sys.path.insert(0, os.getenv("GITPYTHONLIB","."))
from git_remote_helpers.util import die, debug, warn
from git_remote_hel... | kevingessner/git | git-remote-testgit.py | Python | gpl-2.0 | 5,443 |
# Copyright (c) 2014 Benjamin Massey
# Dark Souls II stats calculator
# This program is available under the MIT License.
# Please see the file COPYING in this distribution
# for license information.
# Incase you got this file from elsewhere, the github
# page for it is: https://github.com/BenjaminMassey/Dark-Souls-2-S... | BenjaminMassey/Dark-Souls-2-Stats | DS2Stats.py | Python | mit | 4,783 |
# -*- coding: utf8 -*-
import sys, os
sys.path.append(os.path.abspath('.'))
import re
from operator import attrgetter
import difflib
# Pylons model init sequence
import pylons.test
import logging
from quanthistling.config.environment import load_environment
from quanthistling.model.meta import Sessi... | FrankNagel/qlc | src/webapp/quanthistling/scripts/annotations/annotations_for_shell1987.py | Python | gpl-3.0 | 7,100 |
from flask import render_template, redirect, request, url_for, flash, jsonify
from flask.ext.login import login_user, logout_user, login_required, current_user
from . import auth
from ..extensions import db
from ..models import User, Location
from .forms import LoginForm, RegistrationForm
from autocomplete.views import... | foodsnag/foodsnag-web | app/auth/views.py | Python | mit | 2,264 |
"""empty message
Revision ID: 177b55430b61
Revises: None
Create Date: 2015-01-29 22:29:18.963249
"""
# revision identifiers, used by Alembic.
revision = '177b55430b61'
down_revision = None
from alembic import op
import sqlalchemy as sa
def upgrade():
### commands auto generated by Alembic - please adjust! ###... | WatchPeopleCode/WatchPeopleCode | migrations/versions/177b55430b61_.py | Python | mit | 679 |
import tft_ir_api as IR
n = 2
unrolls = 2
low = 1.0
high = 10.0
A = list()
for j in range(n):
row = list()
for i in range(n):
row.append(IR.RealVE("a{}{}".format(i,j), 0, low, high))
A.append(row)
b = list()
for i in range(n):
b.append(IR.RealVE("b{}".format(i), 1, low, high))
x = li... | soarlab/FPTuner | examples/micro/jacobi-n2u2.py | Python | mit | 916 |
from django.conf import settings
from django.template.loader import render_to_string
import mailgun
def send_unsubscribe_confirmation(signup):
context = {
'email': signup['email'],
'key': signup['key'],
'mooc_title': settings.MOOC_TITLE,
'mooc_domain': settings.MOOC_DOMAIN
}
... | p2pu/mechanical-mooc | unsubscribe/emails.py | Python | mit | 716 |
__all__ = ["ThreadWrap", "ExecuteGetResponse"]
import threading
import subprocess
import time
import Queue
import sys
import re
from browser.status import *
from log import VLOG
""" wrapper of basic thread where commands enqueued should run on same thread with
same session id for avoiding race condition.
since it... | PeterWangIntel/crosswalk-webdriver-python | base/thread_wrap.py | Python | bsd-3-clause | 3,865 |
import os
import random
import pygame
import zwave.helper
class Player(pygame.sprite.Sprite):
def __init__(self, game, model = "01"):
super(Player, self).__init__()
self.weapon = {}
self.weapon["type"] = "gun"
self.weapon["delay"] = 20
self.weapon["timer"] = 0
s... | josefreittas/zwave | zwave/player.py | Python | mit | 8,177 |
# Copyright 2021 ACSONE SA/NV
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl).
from odoo import _, api, fields, models
from odoo.exceptions import ValidationError
class MembershipRequest(models.Model):
_inherit = "membership.request"
distribution_list_ids = fields.Many2many(
comodel_... | mozaik-association/mozaik | mozaik_communication/models/membership_request.py | Python | agpl-3.0 | 2,688 |
try:
import ujson as json
except:
import json
from SerializerBase import *
class SerializerUJson(SerializerBase):
def __init__(self):
self.__jslocation__ = "j.data.serializer.json"
def dumps(self, obj, sort_keys=False, indent=False):
return json.dumps(obj, ensure_ascii=False, sort_ke... | Jumpscale/jumpscale_core8 | lib/JumpScale/data/serializers/SerializerUJson.py | Python | apache-2.0 | 470 |
from __future__ import absolute_import
from __future__ import print_function
import json
import logging
import requests
from .base import Provider as BaseProvider
logger = logging.getLogger(__name__)
def ProviderParser(subparser):
subparser.add_argument("--auth-username", help="specify api key used to authent... | tnwhitwell/lexicon | lexicon/providers/dnspark.py | Python | mit | 4,739 |
from fastapi.testclient import TestClient
from docs_src.behind_a_proxy.tutorial002 import app
client = TestClient(app)
openapi_schema = {
"openapi": "3.0.2",
"info": {"title": "FastAPI", "version": "0.1.0"},
"paths": {
"/app": {
"get": {
"summary": "Read Main",
... | tiangolo/fastapi | tests/test_tutorial/test_behind_a_proxy/test_tutorial002.py | Python | mit | 993 |
import os
import shutil
import gym
import numpy as np
import pytest
from stable_baselines import (A2C, ACER, ACKTR, GAIL, DDPG, DQN, PPO1, PPO2,
TD3, TRPO, SAC)
from stable_baselines.common.cmd_util import make_atari_env
from stable_baselines.common.vec_env import VecFrameStack, DummyVec... | hill-a/stable-baselines | tests/test_gail.py | Python | mit | 7,125 |
#!/usr/bin/env python
import argparse
import sys
import os
from shutil import rmtree
from KafNafParserPy import KafNafParser
from lxml import etree
from xml.sax.saxutils import escape
class Clexelt:
def __init__(self, this_item, this_pos):
self.item = this_item #bank.n
self.pos = this_pos ... | rubenIzquierdo/it_makes_sense_WSD | convert_to_ims_training_format.py | Python | apache-2.0 | 6,874 |
# -*- coding: utf-8 -*-
# Copyright 2019 OpenSynergy Indonesia
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html).
from . import (
hr_employment_status,
hr_employee,
)
| open-synergy/opnsynid-hr | hr_employee_employment_status/models/__init__.py | Python | agpl-3.0 | 194 |
# -*- coding: utf-8 -*-
###############################################################################
#
# Copyright (C) 2001-2014 Micronaet SRL (<http://www.micronaet.it>).
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU Affero General Public License a... | Micronaet/micronaet-production | production_accounting_external_total/total.py | Python | agpl-3.0 | 3,496 |
# -*- coding: utf-8 -*-
###############################################################################
#
# Copyright (C) 2001-2014 Micronaet SRL (<http://www.micronaet.it>).
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU Affero General Public License a... | Micronaet/micronaet-xmlrpc | xmlrpc_operation_invoice/operation.py | Python | agpl-3.0 | 26,194 |
from copy import copy, deepcopy
from textwrap import dedent
try:
import cPickle as pickle
except ImportError:
import pickle
try:
import dask.array as da
except ImportError:
pass
import numpy as np
import pandas as pd
from xray import (align, concat, conventions, backends, Dataset, DataArray,
... | petercable/xray | xray/test/test_dataset.py | Python | apache-2.0 | 87,064 |
# -*- coding: utf-8 -*-
# Part of Odoo. See LICENSE file for full copyright and licensing details.
from odoo import fields, models, _
from odoo.exceptions import UserError
from odoo.tools import float_compare, float_is_zero
class AccountMoveLine(models.Model):
_inherit = 'account.move.line'
sale_line_ids = ... | jeremiahyan/odoo | addons/sale/models/account_move_line.py | Python | gpl-3.0 | 11,377 |
#!/usr/bin/python
# Copyright 2012. Jurko Gospodnetic
# Distributed under the Boost Software License, Version 1.0.
# (See accompanying file LICENSE.txt or copy at
# https://www.bfgroup.xyz/b2/LICENSE.txt)
# Test correct "-p" option handling.
import BoostBuild
t = BoostBuild.Tester(["-d1"], pass_toolset=False)
t.wr... | qianqians/abelkhan | cpp_component/3rdparty/boost/tools/build/test/core_action_output.py | Python | lgpl-2.1 | 1,560 |
# -*- coding: utf-8 -*-
# Generated by Django 1.10.1 on 2017-08-04 09:36
from __future__ import unicode_literals
import datetime
from django.conf import settings
from django.db import migrations, models
import django.db.models.deletion
from django.utils.timezone import utc
class Migration(migrations.Migration):
... | glon/django_test | article/migrations/0005_auto_20170804_0936.py | Python | apache-2.0 | 1,345 |
# coding=utf-8
import time
import copy
from mycodo.inputs.base_input import AbstractInput
from mycodo.inputs.sensorutils import is_device
def constraints_pass_measure_range(mod_input, value):
"""
Check if the user input is acceptable
:param mod_input: SQL object with user-saved Input options
:param ... | kizniche/Mycodo | mycodo/inputs/mh_z19.py | Python | gpl-3.0 | 9,171 |
# Copyright (c) 2010-2012 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 required by applicable law or agree... | psachin/swift | swift/obj/replicator.py | Python | apache-2.0 | 38,417 |
import sys
def DPChange(money, coins):
minNumCoins = [sys.maxsize]*(money+1)
minNumCoins[0] = 0
for m in range(1, money+1):
for i in range(0, len(coins)):
if m >= coins[i]:
if minNumCoins[m-coins[i]] + 1 < minNumCoins[m]:
minNumCoins[m] = minNumCoins[... | Shenmolu/rosalind | MinNumCoin.py | Python | gpl-3.0 | 629 |
# https://djangosnippets.org/snippets/690/
import re
from django.template.defaultfilters import slugify
def unique_slugify(instance, value, slug_field_name='slug', queryset=None,
slug_separator='-'):
"""
Calculates and stores a unique slug of ``value`` for an instance.
``slug_field_nam... | thelabnyc/wagtail_blog | blog/utils.py | Python | apache-2.0 | 2,644 |
#!/usr/bin/env python
# ------------------------------------------------------------
# lexical_specs.py
#
# Trinity language lexicographical specifications
#
# Authors:
# Victor De Ponte, 05-38087, <rdbvictor19@gmail.com>
# Francisco Martinez, 09-10502, <frammnm@gmail.com>
# --------------------------------------------... | throoze/trinity | lang/lexical_specs.py | Python | gpl-3.0 | 7,459 |
"""
Menu Model [DiamondQuest]
Defines a menu.
Author(s): Wilfrantz Dede, Jason C. McDonald, Stanislav Schmidt
"""
# LICENSE (BSD-3-Clause)
# Copyright (c) 2020 MousePaw Media.
# All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the... | mousepawgames/diamondquest | src/diamondquest/model/menu/menu.py | Python | gpl-3.0 | 8,321 |
import tools
def logout():
'''
Logs out of the current user
'''
return tools.term('pkill -u $USER')
def get_cpu_percent():
'''
Gets the current CPU percent
'''
return tools.term("vmstat 1 2 | tail -1 | awk '{print 100-$15}'")
def get_cpu_temp():
'''
Gets the current CPU tem... | TSedlar/gr8bar | src/modules/linux.py | Python | gpl-3.0 | 2,039 |
import os
import sys
sys.path.append(os.path.dirname(os.path.dirname(os.path.abspath(__file__))))
from nw_util import *
from selenium import webdriver
from selenium.webdriver.chrome.options import Options
chrome_options = Options()
chrome_options.add_argument("nwapp=" + os.path.dirname(os.path.abspath(__file__)))
d... | nwjs/nw.js | test/sanity/issue5787-MediaElementAudioSource/test.py | Python | mit | 1,377 |
"""
Django settings for csp project.
Generated by 'django-admin startproject' using Django 1.8.
For more information on this file, see
https://docs.djangoproject.com/en/1.8/topics/settings/
For the full list of settings and their values, see
https://docs.djangoproject.com/en/1.8/ref/settings/
"""
# Build paths insi... | crowdresearch/daemo | csp/settings.py | Python | mit | 15,090 |
# -*- coding: utf-8 -*-
# Copyright 2015 Spanish National Research Council
#
# 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 requ... | alvarolopez/ooi | ooi/api/base.py | Python | apache-2.0 | 900 |
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.db import models, migrations
from django.conf import settings
class Migration(migrations.Migration):
dependencies = [
migrations.swappable_dependency(settings.AUTH_USER_MODEL),
('documents', '0001_initial'),
]
o... | danjac/ownblock | ownblock/ownblock/apps/documents/migrations/0002_document_author.py | Python | mit | 566 |
#!/usr/bin/env python2
import math
from sys import stdout
# Colored message ANSI constants
g_green = chr(27) + "[32m" if stdout.isatty() else ""
g_yellow = chr(27) + "[33m" if stdout.isatty() else ""
g_normal = chr(27) + "[0m" if stdout.isatty() else ""
def printStatsOfList(results, label='Statistics', summaryOnly=... | ttsiodras/HexSpeak | contrib/stats.py | Python | gpl-2.0 | 2,072 |
# Copyright 2014 Pants project contributors (see CONTRIBUTORS.md).
# Licensed under the Apache License, Version 2.0 (see LICENSE).
import os
from pants.backend.jvm.targets.jar_library import JarLibrary
from pants.backend.jvm.targets.java_library import JavaLibrary
from pants.backend.jvm.targets.jvm_binary import JarR... | wisechengyi/pants | tests/python/pants_test/backend/jvm/tasks/test_detect_duplicates.py | Python | apache-2.0 | 12,183 |
from django.contrib.gis.db import models
from django.db.models import Q
import operator
class PriorityDepartmentsManager(models.Manager):
DEPARTMENTS = {
'Austin': {'state': 'TX', 'fdid': 'WP801'},
'Arlington': {'state': 'VA', 'fdid': '01300'},
'Chicago': {'state': 'IL', 'fdid': 'CS931'},... | garnertb/rogue_geonode | geoshape/firestation/managers.py | Python | gpl-3.0 | 1,358 |
from tests.compat import OrderedDict
from tests.unit import unittest
from tests.unit import AWSMockServiceTestCase
from boto.vpc import VPCConnection, Subnet
class TestDescribeSubnets(AWSMockServiceTestCase):
connection_class = VPCConnection
def default_body(self):
return b"""
<Describe... | Asana/boto | tests/unit/vpc/test_subnet.py | Python | mit | 6,551 |
# Copyright 2011 Google Inc.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, so... | jjinux/party-playlist-picker | playlistpicker/handlers/removeplaylistentryhandler.py | Python | apache-2.0 | 1,455 |
# Patchwork - automated patch tracking system
# Copyright (C) 2016 Stephen Finucane <stephen@that.guru>
#
# SPDX-License-Identifier: GPL-2.0-or-later
import email.parser
from rest_framework.generics import ListAPIView
from rest_framework.generics import RetrieveAPIView
from rest_framework.reverse import reverse
from ... | stephenfin/patchwork | patchwork/api/cover.py | Python | gpl-2.0 | 3,941 |
#!/usr/bin/env python
# coding=utf-8
from src.sequence import Sequence
class FastaReader(object):
def __init__(self):
self.seqs = []
def read(self, io_buffer):
header = ''
bases = ''
for line in io_buffer:
if line[0] == '>':
if len(header) > 0:
... | Arabidopsis-Information-Portal/GAG | src/fasta_reader.py | Python | mit | 681 |
# -*- coding: utf-8 -*-
#
# Picard, the next-generation MusicBrainz tagger
#
# Copyright (C) 2006-2007 Lukáš Lalinský
# Copyright (C) 2010 fatih
# Copyright (C) 2010-2011, 2014, 2018-2021 Philipp Wolfer
# Copyright (C) 2012, 2014, 2018 Wieland Hoffmann
# Copyright (C) 2013 Ionuț Ciocîrlan
# Copyright (C) 2013-2014, 201... | musicbrainz/picard | test/test_utils.py | Python | gpl-2.0 | 24,993 |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
from ..common import *
from ..extractor import VideoExtractor
from json import loads
class QiE(VideoExtractor):
name = "QiE (企鹅直播)"
# Last updated: 2015-11-24
stream_types = [
{'id': 'normal', 'container': 'flv', 'video_profile': '标清'},
{'id'... | betaY/crawler | you-get-master/src/you_get/extractors/qie.py | Python | mit | 2,716 |
from django import forms
from .models import SignUp
class ContactForm(forms.Form):
full_name = forms.CharField(required=False)
email = forms.EmailField()
message = forms.CharField()
class SignUpForm(forms.ModelForm):
class Meta:
model = SignUp
fields = ['full_name', 'email']
### exclude = ['full_name']
... | codingforentrepreneurs/ecommerce-2 | src/newsletter/forms.py | Python | mit | 812 |
#!/usr/bin/env python3
#Author: Stefan Toman
if __name__ == '__main__':
a = int(input())
b = int(input())
print(a+b)
print(a-b)
print(a*b)
| stoman/CompetitiveProgramming | problems/pythonarithmeticoperators/submissions/accepted/stefan.py | Python | mit | 161 |
#!/usr/bin/env python
# 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
#
# Authors:
# - Daniel Drizhuk, d.drizhuk@gmail.com, 2017
# - Mario Lassnig, ... | PalNilsson/pilot2 | pilot/util/https.py | Python | apache-2.0 | 12,783 |
# -*- coding: utf-8 -*-
# Copyright (c) 2004-2015 Alterra, Wageningen-UR
# Allard de Wit and Iwan Supit (allard.dewit@wur.nl), July 2015
# Approach based on LINTUL N/P/K made by Joost Wolf
from ...base_classes import StatesTemplate, ParamTemplate, SimulationObject, \
AfgenTrait, RatesTemplate
from ...decorators... | jajberni/pcse_web | main/pcse/crop/nutrients/npk_demand_uptake.py | Python | apache-2.0 | 17,101 |
import json
import time
import git
import discord
import os
import aiohttp
from cogs.utils.dataIO import dataIO
from urllib.parse import quote as uriquote
try:
from lxml import etree
except ImportError:
from bs4 import BeautifulSoup
from urllib.parse import parse_qs, quote_plus
#from cogs.utils i... | Bluscream/Discord-Selfbot | cogs/utils/checks.py | Python | gpl-3.0 | 7,337 |
""" Class to read binary information using various predefined types. """
#
# Copyright (c) 2007 Michael van Tellingen <michaelvantellingen@gmail.com>
# All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions
#... | kevdes/videoparser | streams/binary.py | Python | cc0-1.0 | 11,649 |
r"""Command-line tool to validate and pretty-print JSON
Usage::
$ echo '{"json":"obj"}' | hjson
{
"json": "obj"
}
"""
from __future__ import with_statement
import sys
import hjson
import pkg_resources # part of setuptools
HELP="""Hjson, the Human JSON.
Usage:
hjson [options]
hjson [options... | mnahm5/django-estore | Lib/site-packages/hjson/tool.py | Python | mit | 1,894 |
#!/usr/bin/python
import json
import requests
class AttrDict(dict):
def __init__(self, *args, **kwargs):
super(AttrDict, self).__init__(*args, **kwargs)
self.__dict__ = self
class API(object):
reserved = ["from", "items"]
def __init__(self, _url, _cert):
(self.url, self.cert) =... | RedHatEMEA/aws-ose3 | target/k8s.py | Python | apache-2.0 | 1,886 |
#!/usr/bin/env python
'''
Copyright (c) 2012 Jeremy Parks ( xanthic.9478 )
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy... | xanthics/gw2crafting---retired | Crafting.py | Python | mit | 21,884 |
##
# tibrvftmon.py - example TIB/Rendezvous fault tolerant group
# monitor program
#
# rewrite TIBRV example: tibrvftmon.c
#
# LAST MODIFIED: V1.0 2016-12-26 ARIEN arien.chen@gmail.com
#
import sys
import signal
import getopt
from pytibrv.api import *
from pytibrv.status import *
from pytibrv.queue impo... | arienchen/pytibrv | examples/api/tibrvftmon.py | Python | bsd-3-clause | 3,129 |
#!/usr/bin/env python
from .server import MapRouletteServer
from .challenge import MapRouletteChallenge
from .task import MapRouletteTask
from .taskcollection import MapRouletteTaskCollection | mvexel/maproulette-api-wrapper | maproulette/__init__.py | Python | mit | 192 |
from __future__ import print_function
from BinPy import *
print ('Usage of IC 4025:\n')
ic = IC_4025()
print ('\nThe Pin configuration is:\n')
input = {1: 1, 2: 1, 3: 0, 4: 0, 5: 0, 7: 0, 8: 1, 11: 0, 12: 1, 13: 1, 14: 1}
print (input)
print ('\nPin initinalization\n')
print ('\nPowering up the IC - using -- ic.setIC({... | coder006/BinPy | BinPy/examples/ic/Series_4000/IC4025.py | Python | bsd-3-clause | 1,108 |
# -*- coding: utf-8 -*-
from . import print_labels
| lem8r/woodwerk-addons | woodwerk_labeling/wizard/__init__.py | Python | agpl-3.0 | 52 |
"""
Sensor for Fedex packages.
For more details about this platform, please refer to the documentation at
https://home-assistant.io/components/sensor.fedex/
"""
from collections import defaultdict
import logging
from datetime import timedelta
import voluptuous as vol
from homeassistant.components.sensor import PLATF... | PetePriority/home-assistant | homeassistant/components/sensor/fedex.py | Python | apache-2.0 | 3,452 |
# -*- coding: utf-8 -*-
# Copyright (c) 2007 - 2014 Detlev Offenbach <detlev@die-offenbachs.de>
#
"""
Module implementing the QMessageBox wizard plugin.
"""
from __future__ import unicode_literals
from PyQt5.QtCore import QObject
from PyQt5.QtWidgets import QDialog
from E5Gui.E5Application import e5App
from E5Gui.... | davy39/eric | Plugins/PluginWizardQMessageBox.py | Python | gpl-3.0 | 4,158 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.