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 |
|---|---|---|---|---|---|
USER_COMMAND_DICT = {}
| sgedward/hubcommander | command_plugins/repeat/config.py | Python | apache-2.0 | 23 |
# -*- coding: utf-8 -*-
# Generated by Django 1.11.3 on 2017-08-28 07:07
from __future__ import unicode_literals
import django.contrib.postgres.fields
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('partner', '0004_auto_20170814_0841'),
]
opera... | unicef/un-partner-portal | backend/unpp_api/apps/partner/migrations/0005_partner_country_presents.py | Python | apache-2.0 | 733 |
# Copyright 2013 Openstack Foundation
# All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance with the License. You may obtain
# a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicab... | Cerberus98/quark | quark/tests/test_quark_plugin.py | Python | apache-2.0 | 1,818 |
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.db import models, migrations
import django.utils.timezone
class Migration(migrations.Migration):
dependencies = [
]
operations = [
migrations.CreateModel(
name='Invite',
fields=[
... | topa51/eis | api/migrations/0001_initial.py | Python | mit | 1,355 |
# Copyright (C) 2018 The Photogal Team.
#
# This file is part of Photogal.
#
# 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 License, or
# (at your option) any later vers... | jsamarziya/photogal | src/photogal/graphql/__init__.py | Python | gpl-3.0 | 739 |
import numpy as np
from perceptron import Perceptron
class Adaline(Perceptron):
"""
Implementation of an Adaptive Linear Neuron, that can be abstracted to
various input sizes or dimensions. Displays using pyplot.
"""
ETA = 1
def __init__(self, grph, eta, max_t):
Perceptron.__init__(se... | cbporch/perceptron | adaline.py | Python | mit | 1,193 |
# -*- coding: utf-8 -*-
"""
unit test for the undefined types
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
:copyright: 2008 by Armin Ronacher.
:license: BSD, see LICENSE for more details.
"""
test_default_undefined = '''
>>> from jinja2 import Environment, Undefined
>>> env = Environment(undefined=Undefined)
>>... | minixalpha/SourceLearning | jinja2/jinja2-2.0/tests/test_undefined.py | Python | apache-2.0 | 2,242 |
from .fama_mcbeth import *
| khrapovs/famamcbeth | famamcbeth/__init__.py | Python | mit | 27 |
#!/usr/bin/env python
"""
Harness for pysdl2,
some simple classes to make working with pysdl2 easier.
Copyright (C) 2015 by Juan J. Martinez <jjm@usebox.net>
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 th... | reidrac/pysdl2-harness | harness/__init__.py | Python | mit | 17,999 |
# -*- coding: utf-8 -*-
"""
werkzeug.formparser
~~~~~~~~~~~~~~~~~~~
This module implements the form parsing. It supports url-encoded forms
as well as non-nested multipart uploads.
:copyright: (c) 2014 by the Werkzeug Team, see AUTHORS for more details.
:license: BSD, see LICENSE for ... | fancasy/final | lib/werkzeug/formparser.py | Python | apache-2.0 | 21,732 |
# Backend loading
# Based on the Django cache framework
# https://github.com/django/django/blob/5d263dee304fdaf95e18d2f0619d6925984a7f02/django/core/cache/__init__.py
import sys
from importlib import import_module
import warnings
from django.utils import six
from django.utils.module_loading import import_string
from ... | praekelt/nurseconnect | nurseconnect/wagtailsearch/backends/__init__.py | Python | bsd-2-clause | 3,570 |
# Copyright 2015, 2020-2021 National Research Foundation (SARAO)
#
# This program is free software: you can redistribute it and/or modify it under
# the terms of the GNU Lesser General Public License as published by the Free
# Software Foundation, either version 3 of the License, or (at your option) any
# later version... | ska-sa/spead2 | src/spead2/recv/__init__.py | Python | lgpl-3.0 | 2,768 |
"""Test for first Graph data structure."""
import pytest
from graph_1 import Graph
@pytest.fixture
def empty_graph():
"""Return an empty graph."""
return Graph()
@pytest.fixture
def one_node_graph():
"""Return a graph with one node."""
g = Graph()
g.add_node('corn')
return g
@pytest.fixtur... | CaHudson94/data-structures | src/Completed/test_graph_1.py | Python | mit | 17,203 |
__all__ = ['euler_tour', 'expression_tree', 'linked_binary_tree', 'traversal_examples']
| consultit/Ely | ely/direct/data_structures_and_algorithms/ch08/__init__.py | Python | lgpl-3.0 | 88 |
#!/usr/bin/env python3
import argparse
import itertools
import queue
import re
import subprocess
import sys
import threading
import time
from collections import deque
from collections import namedtuple
from io import BytesIO
import datadog
import logbook
import pcc
import requests
from PIL import Image
from attrdict ... | mopsalarm/pr0gramm-meta | update/main.py | Python | apache-2.0 | 13,461 |
#! /usr/bin/env python
"""
Script to split a dataset into chunks of equal time
"""
import argparse
from argparse import RawTextHelpFormatter
import casacore.tables as pt
import numpy as np
import sys
import os
import shutil
def main(dataset, blockl, local_dir=None, clobber=True):
"""
Split dataset into time c... | revoltek/factor | factor/scripts/chunk_by_time.py | Python | gpl-2.0 | 4,561 |
# -*- coding: utf-8 -*-
from datetime import date,datetime,timedelta
from osv import osv, fields
from tools.translate import _
class WizardInvestmentCreation(osv.osv):
_name = 'wizard.generationkwh.investment.creation'
def do_create(self, cursor, uid, ids, context=None):
""" Do selected action"""
... | Som-Energia/somenergia-generationkwh | som_generationkwh/wizard/wizard_investment_creation.py | Python | agpl-3.0 | 3,362 |
# -*- coding: utf-8 -*-
# © 2016 Eficent Business and IT Consulting Services S.L.
# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl.html).
from . import mass_create
| factorlibre/stock-logistics-warehouse | stock_valuation_account_manual_adjustment/wizards/__init__.py | Python | agpl-3.0 | 180 |
#! /usr/bin/env python
"""GUI interface to webchecker.
This works as a Grail applet too! E.g.
<APPLET CODE=wcgui.py NAME=CheckerWindow></APPLET>
Checkpoints are not (yet??? ever???) supported.
User interface:
Enter a root to check in the text entry box. To enter more than one root,
enter them one at a time ... | OS2World/APP-INTERNET-torpak_2 | Tools/webchecker/wcgui.py | Python | mit | 15,291 |
"""
Tests for the models that configures Edit LTI fields feature.
"""
from contextlib import contextmanager
import ddt
from django.test import TestCase
from edx_django_utils.cache import RequestCache
from opaque_keys.edx.locator import CourseLocator
from xblock_config.models import CourseEditLTIFieldsEnabledFlag
... | cpennington/edx-platform | cms/djangoapps/xblock_config/tests/test_models.py | Python | agpl-3.0 | 3,776 |
###############################################################################
##
## Copyright 2011-2013 Tavendo GmbH
##
## 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
##
## ... | normanmaurer/autobahntestsuite-maven-plugin | src/main/resources/autobahntestsuite/wstest.py | Python | apache-2.0 | 10,679 |
# encoding:utf-8
#
# Gramps - a GTK+/GNOME based genealogy program
#
# Copyright (C) 2010 Doug Blank <doug.blank@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 2 of ... | gramps-project/addons-source | libaccess/libaccess.gpr.py | Python | gpl-2.0 | 1,400 |
#!/usr/bin/python
# -*-coding:utf-8-*-
import random
USER_AGENT_LIST = [
'Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/34.0.1847.131 Safari/537.36',
'Mozilla/5.0 (Macintosh; Intel Mac OS X 10_9_2) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/34.0.1847.131 Safari/537.36',
... | trujunzhang/djzhang-targets | cwpoliticl/cwpoliticl/middlewares.py | Python | mit | 3,217 |
#
# 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
# ... | rdo-management/heat | heat/tests/test_nova_keypair.py | Python | apache-2.0 | 8,308 |
# -*- coding: utf-8 -*-
# Copyright (c) 2016-present, CloudZero, Inc. All rights reserved.
# Licensed under the BSD-style license. See LICENSE file in the project root for full license information.
"""
Helper functions that reduce boilerplate in plugin tests
"""
import attrdict
from unittest.mock import PropertyMock,... | Cloudzero/cloudzero-reactor-aws | test/unit/features/accounts/probe_plugins/plugin_test_helpers.py | Python | bsd-3-clause | 1,177 |
"""Augmentations."""
from pylint.checkers.base import DocStringChecker, NameChecker
from pylint.checkers.design_analysis import MisdesignChecker
from pylint.checkers.classes import ClassChecker
from pylint.checkers.newstyle import NewStyleConflictChecker
from pylint.checkers.variables import VariablesChecker
from astro... | devs1991/test_edx_docmode | venv/lib/python2.7/site-packages/pylint_django/augmentations/__init__.py | Python | agpl-3.0 | 14,036 |
""" Simple module to add InsertableOrderedDict, variant of OrderedDict with insertafter method """
# pylint: disable=E1101
# disable error while accessing private member of OrderedDict
from collections import OrderedDict
class InsertableOrderedDict(OrderedDict):
""" OrderedDict extending class which adds metho... | pecet/pytosg | TwitterStatsLib/InsertableOrderedDict.py | Python | mit | 1,030 |
"""
A decorator for caching properties in classes.
Examples:
>>> class Foo(object):
... @cached_property
... def bar(self):
... print("This message only print once")
... return None
>>> foo = Foo()
>>> foo.bar
This message only print once
>>> foo.bar
"""
impo... | wp-lai/xmachinelearning | utilities/cached_property.py | Python | mit | 638 |
# Copyright 2016 Intel 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
#
# Unless required by applicable law or agreed to... | yidawang/brainiak | brainiak/funcalign/srm.py | Python | apache-2.0 | 25,902 |
#!/usr/bin/env python
ENCODING='utf-8'
import configobj
import json
import argparse
parser = argparse.ArgumentParser()
parser.add_argument("gatewayHost", help="gatewayHost is IP address of CCO VM")
args = parser.parse_args()
inputFile = '/usr/local/tomcatgua/webapps/access/WEB-INF/gua.properties'
outputFile = inputFi... | HybridCloudAutomation/cloudcenter-automated-installation | cc-install-automation/cc-property-scripts/02_cca-gua.properties.py | Python | gpl-3.0 | 821 |
from __future__ import print_function
import lis_wrapper
import numpy as np
import scipy.sparse
# Define a symmetric 8 x 8 dense upper triangular matrix first.
# This matrix is part of the examples which come with Intel's MKL library
# and is used here for historical reasons.
# A:
# 7.0, 1.0, 2.0... | Kalle0x12/Test2 | csr_test.py | Python | gpl-3.0 | 2,910 |
#!/usr/bin/env python3
# -*- coding : utf-8 -*-
# ====================================
# Paul Cacheux <paulcacheux@gmail.com>
# MPSI 1
# DM informatique
# 13/12/2014
# ====================================
from random import randint # Module importé
N = 6
HISTORIQUE = [] # Variables globales
def afficher(last_... | M0n0xy2/mpsi_python_cours | python/knight_tour/DM/paul_cacheux_cavalier.py | Python | mit | 4,772 |
brothers_age = 27
sisters_age = 28
if brothers_age > sisters_age:
print("Brother is older!")
print("Brother is " + str(brothers_age))
print("Sister is " + str(sisters_age))
print("They have a difference of " + str(brothers_age - sisters_age) + " years.")
elif brothers_age == sisters_age:
print("The... | lucascolusso/python_workshop | 02/01/play.py | Python | mit | 552 |
# -*- coding: utf-8 -*-
"""
args
~~~~
"""
import os
import sys
from sys import argv
from glob import glob
from collections import OrderedDict
# Python 3
if sys.version_info[0] == 3:
string_type = str
else:
string_type = basestring
def _expand_path(path):
"""Expands directories and globs in given path."... | kennethreitz/args | args.py | Python | bsd-2-clause | 9,854 |
"""
Segregation of pymongo functions from the data modeling mechanisms for split modulestore.
"""
import datetime
import logging
import math
import re
import zlib
from contextlib import contextmanager
from time import time
import pymongo
import pytz
import six
from six.moves import cPickle as pickle
from contracts i... | msegado/edx-platform | common/lib/xmodule/xmodule/modulestore/split_mongo/mongo_connection.py | Python | agpl-3.0 | 23,404 |
# Copyright 2020 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
#
# https://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, ... | google-research/sound-separation | models/dcase2020_desed_fuss_baseline/convert_desed_lists.py | Python | apache-2.0 | 2,047 |
#!/usr/bin/env python
# Foundations of Python Network Programming - Chapter 15 - folder_info.py
# Opening an IMAP connection with IMAPClient and listing folder information.
import getpass, sys
from imapclient import IMAPClient
try:
hostname, username = sys.argv[1:]
except ValueError:
print 'usage: %s hostname... | jac2130/BayesGame | foundations-of-python-network-programming/python2/15/folder_info.py | Python | mit | 659 |
# Copyright 2015 OpenStack Foundation
# All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance with the License. You may obtain
# a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless requ... | ArchiFleKs/magnum | magnum/tests/unit/objects/test_cluster.py | Python | apache-2.0 | 9,842 |
# Copyright 2016 Andreas Riegg - t-h-i-n-x.net
#
# 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... | ariegg/webiopi-examples | twoscripts/twoscriptscommon.py | Python | apache-2.0 | 626 |
"""Tests the test handler"""
from logbook import Logger, TestHandler
log = Logger('Test logger')
def run():
with TestHandler() as handler:
for x in xrange(500):
log.warning('this is not handled')
| ayvazj/logbook | benchmark/bench_test_handler.py | Python | bsd-3-clause | 224 |
# -*- coding: utf-8 -*-
"""
Tests for IBM Model 2 training methods
"""
import unittest
from collections import defaultdict
from nltk.translate import AlignedSent
from nltk.translate import IBMModel
from nltk.translate import IBMModel2
from nltk.translate.ibm_model import AlignmentInfo
class TestIBMModel2(unittest.T... | sdoran35/hate-to-hugs | venv/lib/python3.6/site-packages/nltk/test/unit/translate/test_ibm2.py | Python | mit | 3,433 |
# -*- 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),
('rango', '0003_category_slug'),
]
... | wangjie1492/tango_with_django_project | rango/migrations/0004_userprofile.py | Python | apache-2.0 | 791 |
# Copyright (c) 2017-2019 The University of Manchester
#
# 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 License, or
# (at your option) any later version.
#
# This progra... | project-rig/spalloc_server | count_times.py | Python | gpl-2.0 | 4,487 |
#
# 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
# ... | rahulunair/nova | nova/conf/keystone.py | Python | apache-2.0 | 1,257 |
import os
import fnmatch
import locale
import subprocess
DOIT_CONFIG = {
'default_tasks': ['flake8', 'test'],
'reporter': 'executed-only',
}
def recursive_glob(path, pattern):
"""recursively walk path directories and return files matching the pattern"""
for root, dirnames, filenames in os.walk(path,... | xuhdev/nikola | dodo.py | Python | mit | 2,829 |
# Django settings for wayf project.
import os
here = lambda x: os.path.join(os.path.abspath(os.path.dirname(__file__)), x)
DEBUG = True
TEMPLATE_DEBUG = DEBUG
ADMINS = (
# ('Your Name', 'your_email@domain.com'),
)
MANAGERS = ADMINS
DATABASE_ENGINE = '' # 'postgresql_psycopg2', 'postgresql', 'mysql', '... | JensTimmerman/django-wayf | settings.py | Python | gpl-3.0 | 3,496 |
class Solution:
# @param {integer[]} nums
# @param {integer} target
# @return {integer}
def search(self, nums, target):
l, r = 0, len(nums) - 1
while l <= r:
m = (l + r) / 2
if nums[m] == target:
return m
elif nums[m] > target:
... | Chasego/codi | leetcode/033-Search-in-Rotated-Sorted-Array/SearchinRSArr_001.py | Python | mit | 632 |
"""
GRAMMAR
=======
documentation: header param_list code
header: TEXT*
param_list: param_doc*
code: CODE_FENCE TEXT CODE_FENCE
param_doc: LEFT_BRACE param_id? RIGHT_BRACE type_hint? value_hint? TEXT*
param_id: identifier | flag
identifier: IDENTIFIER | INTEGER
flag: FLAG... | ju1ius/clisnips | clisnips/syntax/documentation/parser.py | Python | gpl-3.0 | 7,291 |
from Screens.Wizard import WizardSummary
from Screens.WizardLanguage import WizardLanguage
from Screens.Wizard import wizardManager
from Screens.Rc import Rc
from Screens.Screen import Screen
from Components.Label import Label
from Components.MenuList import MenuList
from Components.PluginComponent import plugins
from ... | Mariusz1970/enigma2 | lib/python/Plugins/SystemPlugins/SoftwareManager/ImageWizard.py | Python | gpl-2.0 | 6,666 |
"""
Migration script to add an inheritable column to the following tables:
library_info_association, library_folder_info_association.
Also, in case of sqlite check if the previous migration script deleted the
request table and if so, restore the table.
"""
from sqlalchemy import *
from migrate import *
from migrate.ch... | mikel-egana-aranguren/SADI-Galaxy-Docker | galaxy-dist/lib/galaxy/model/migrate/versions/0038_add_inheritable_column_to_library_template_assoc_tables.py | Python | gpl-3.0 | 3,569 |
"""This source code is licensed under the BSD-style license found in the
LICENSE file in the root directory of this source tree. An additional grant
of patent rights can be found in the PATENTS file in the same directory.
"""
from __future__ import absolute_import
from __future__ import division
from __future__ import... | glensc/osquery-python | osquery/extension_client.py | Python | bsd-3-clause | 1,845 |
import discord
from discord.ext import commands
class Mycog:
"""My custom cog that does stuff!"""
def __init__(self, bot):
self.bot = bot
@commands.command()
async def mycom(self):
"""This does stuff!"""
#Your code will go here
await self.bot.say("I can do stuff!")
d... | heartsdale/heartsdale-cogs | limin.py | Python | mit | 363 |
# by amounra 0413 : http://www.aumhaa.com
import Live
from _Framework.ButtonElement import ButtonElement
from _Framework.InputControlElement import InputControlElement
from _Framework.NotifyingControlElement import NotifyingControlElement
MIDI_NOTE_TYPE = 0
MIDI_CC_TYPE = 1
MIDI_PB_TYPE = 2
MIDI_MSG_TYPES = (MIDI_NOT... | jim-cooley/abletonremotescripts | remote-scripts/samples/Twister Ableton Script v1.2.2/_Mono_Framework/MonoButtonElement.py | Python | apache-2.0 | 4,389 |
"""Transformer Config builder library."""
from third_party.flax_examples import transformer_modules
def make_transformer_config(config, vocab_size, deterministic):
"""Returns a transformer_modules.TransformerConfig to spec."""
return make_transformer_config_num_layers(
config.transformer_num_layers, config... | google-research/runtime-error-prediction | core/modules/transformer_config_lib.py | Python | apache-2.0 | 1,013 |
#!/usr/bin/env python
# Summation of digits of 2^1000
# First, make sure python can handle it:
n = 2**1000
print n
print
leftover = n
accum = 0
while leftover >0:
accum += leftover % 10
leftover /= 10
print accum
| nayrbnayrb/projecteuler | 0016/0016.py | Python | gpl-3.0 | 223 |
# Volatility
# Copyright (C) 2010 Brendan Dolan-Gavitt
# Copyright (c) 2011 Michael Cohen <scudette@gmail.com>
#
# This file is part of Volatility.
#
# Volatility 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... | piniGitHUB/volatility | volatility/plugins/overlays/linux/linux.py | Python | gpl-2.0 | 37,298 |
"""
High-level libvirt test utility functions.
This module is meant to reduce code size by performing common test procedures.
Generally, code here should look like test code.
More specifically:
- Functions in this module should raise exceptions if things go wrong
- Functions in this module typically use funct... | rbian/avocado-vt | virttest/utils_test/libvirt.py | Python | gpl-2.0 | 106,637 |
#!/usr/bin/python3
import datetime
# HTTPヘッダ
# SSIで「include virtual」する時はHTTPヘッダが必要
print('Content-Type: text/plain;charset=utf-8')
print('')
print(datetime.datetime.now().strftime('%Y-%m-%d %H:%M:%S'))
if __name__ == '__main__':
pass | thinkAmi-sandbox/Docker_Apache-sample | alpine_apache_python36_ssi/ssi_html_cgi_using_xbithack_on/cgi/now.py | Python | unlicense | 273 |
print(input()*2)
| knuu/competitive-programming | atcoder/corp/codefes2015qb_a.py | Python | mit | 17 |
import typing # noqa
from django.http.request import HttpRequest
from django.http.response import HttpResponse
from django.shortcuts import get_object_or_404, render
from django.views.generic import ListView
from .models import Question
class IndexView(ListView):
template_name = 'polls/index.html'
context_... | caulagi/django-mypy | polls/views.py | Python | mit | 759 |
#!/usr/bin/python
import os
import sys
import re
import glob
import operator
from collections import OrderedDict
from datetime import datetime
f = open( 'nagiosdata', 'w')
#path ="/root/nagios/log/"
#dirs = os.listdir( path )
#for file in dirs:
#nagioslog = open('nagios-06-08-2015-00.log')
nagioslog = open('/root/nagi... | rmstmg/nagios-log-parsing | nagioslog.py | Python | apache-2.0 | 1,362 |
import torch
from torch._thnn import type2backend
from torch.autograd import Function
from . import _all_functions
from .auto import _BCELoss
# TODO: move this code to THNN and remove _BCELoss from auto.py
class BCELoss(_BCELoss):
def _resize_weight(self, target):
self.old_weight = self.weight
i... | RPGOne/Skynet | pytorch-master/torch/nn/_functions/thnn/loss.py | Python | bsd-3-clause | 1,051 |
#!/usr/bin/python
# -*- coding: utf-8 -*-
#
# Reza(User:reza1615), 2014
#
# Distributed under the terms of the CC-BY-SA 3.0 .
# Python 3
import pywikibot,re,codecs
pywikibot.config.put_throttle = 0
pywikibot.config.maxthrottle = 0
bot_version='۴.۰'
_cache={}
def translation(firstsite,secondsite,enlink):
if _cache... | PersianWikipedia/fawikibot | Need2convert/zz_ref_link_correction_core.py | Python | mit | 7,533 |
# publications.urls
# DJANGO
from django.conf.urls import patterns, include, url
from django.views.generic import ListView
# NEWS
from .models import Publication
from .views import (
PublicationDetailView,
PublicationCreateView,
PublicationUpdateView
)
publications_list_view = ListView.as_view(
... | valuesandvalue/valuesandvalue | vavs_project/publications/urls.py | Python | mit | 987 |
# coding=utf-8
# --------------------------------------------------------------------------
# Copyright (c) Microsoft Corporation. All rights reserved.
# Licensed under the MIT License. See License.txt in the project root for
# license information.
#
# Code generated by Microsoft (R) AutoRest Code Generator.
# Changes ... | SUSE/azure-sdk-for-python | azure-mgmt-network/azure/mgmt/network/v2017_06_01/models/bgp_community.py | Python | mit | 2,386 |
from ReText import *
class ConfigDialog(QDialog):
def __init__(self, parent):
QDialog.__init__(self, parent)
self.initConfigOptions()
self.layout = QGridLayout(self)
buttonBox = QDialogButtonBox(self)
buttonBox.setStandardButtons(QDialogButtonBox.Ok |
QDialogButtonBox.Cancel)
self.connect(buttonBox, SI... | codemedic/retext | ReText/config.py | Python | gpl-3.0 | 2,955 |
# Copyright 2016 Mycroft AI, Inc.
#
# This file is part of Mycroft Core.
#
# Mycroft Core is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later versio... | JarbasAI/JarbasAI | jarbas_skills/skill_wiki/__init__.py | Python | gpl-3.0 | 3,331 |
__author__ = 'PC-LiNing'
from bigchaindb import Bigchain
b=Bigchain()
### get blocks ids and status by tx_id
def getblocksBytx_id(tx_id):
blocks=b.get_blocks_status_containing_tx(tx_id)
return blocks
### get block by block_id
def getblockbyid(block_id):
pass
return
| charitychain/Charitychain | Simplechaindb/test/blockquery.py | Python | apache-2.0 | 288 |
# This file is part of Shuup.
#
# 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.conf import settings
from django.conf.urls import include, patterns, url
from django.con... | hrayr-artunyan/shuup | shuup_workbench/urls.py | Python | agpl-3.0 | 750 |
"""
payer: language and parser tools
"""
from setuptools import setup
import os
import re
version_re = re.compile(r"^__version__ = ['\"](?P<version>[^'\"]*)['\"]", re.M)
def find_version(*file_paths):
"""Get version from python file."""
path = os.path.join(os.path.dirname(__file__), *file_paths)
with o... | bracket/payer | python/payer/setup.py | Python | bsd-2-clause | 1,049 |
# Copyright (C) 2011 Bradley N. Miller
#
# 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 License, or
# (at your option) any later version.
#
# This program is distribute... | 42cs/book | modules/luther/sphinx/video/video.py | Python | mit | 3,703 |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
'''
Copyright (C) 2011-2014 German Aerospace Center DLR
(Deutsches Zentrum fuer Luft- und Raumfahrt e.V.),
Institute of System Dynamics and Control
All rights reserved.
This file is part of PySimulator.
PySimulator is free software: you can redistribute it and/or modify... | PySimulator/PySimulator | PySimulator/Plugins/SimulationResult/DymolaMat/DymolaMat.py | Python | lgpl-3.0 | 12,890 |
import sys, string, os, getopt
# Run this passing a ".i" file as param. Will generate ".d"
g_com_parent = ""
def GetComments(line, lineNo, lines):
# Get the comment from this and continuous lines, if they exist.
data = line.split("//", 2)
doc = ""
if len(data)==2: doc=data[1].strip()
lineNo = lineNo + 1
while... | DavidGuben/rcbplayspokemon | app/pywin32-220/AutoDuck/makedfromi.py | Python | mit | 4,584 |
#!/usr/bin/env python
# -*- mode: python; encoding: utf-8 -*-
"""Test the collection viewer interface."""
from grr.gui import runtests_test
from grr.lib import aff4
from grr.lib import flags
from grr.lib import test_lib
class TestContainerViewer(test_lib.GRRSeleniumTest):
"""Test the collection viewer interface... | darrenbilby/grr | gui/plugins/container_viewer_test.py | Python | apache-2.0 | 4,342 |
import simplejson as json
from django.conf import settings as django_settings
from django.http import HttpResponse
from cio.conf import settings
import djedi
# TODO: Switch simplejson to ujson or other?
class JSONResponseMixin(object):
"""
A mixin that can be used to render a JSON response.
"""
respo... | chrippa/djedi-cms | djedi/admin/mixins.py | Python | bsd-3-clause | 1,227 |
try:
from magic import from_buffer as magic_from_buffer
except ImportError:
import mimetypes
def get_file_type(file, filename):
try:
file_type = magic_from_buffer(file.read(1024), mime=True)
file.seek(0)
return maybe_decode(file_type)
except NameError:
return mimetypes.... | randomchars/pushbullet.py | pushbullet/filetype.py | Python | mit | 586 |
__author__ = 'Bohdan Mushkevych'
import unittest
from datetime import datetime, timedelta
from synergy.system.event_clock import EventClock, EventTime, parse_time_trigger_string, format_time_trigger_string
from synergy.system.repeat_timer import RepeatTimer
class TestEventClock(unittest.TestCase):
def test_utc_... | eggsandbeer/scheduler | tests/test_event_clock.py | Python | bsd-3-clause | 3,847 |
#!/usr/bin/env python
# Copyright 2009-2014 Eucalyptus Systems, 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 ... | tbeckham/DeploymentManager | config_manager/eucalyptus/topology/cluster/nodecontroller/hyperv.py | Python | apache-2.0 | 1,463 |
import asyncio
import logging
import urllib.parse
from functools import wraps
from typing import Optional
import aiohttp
import aiohttp_session
from aiohttp import web
from hailtop import httpx
from hailtop.auth import async_get_userinfo
from hailtop.config import get_deploy_config
log = logging.getLogger('gear.auth... | hail-is/hail | gear/gear/auth.py | Python | mit | 4,434 |
# All auth methods should follow this protocol.
class AbstractAuth(object):
def __init__(self):
pass
def is_authenticated(self, event):
pass
def configure(self, options=""):
pass
| Tuxemon/Tuxemon-Server | tuxemon_server/core/auth/abstract_auth.py | Python | gpl-3.0 | 218 |
"""Support for NIFTI files."""
import numpy as np
import nibabel
def read(path):
"""Read a NIFTI file."""
img = nibabel.load(str(path))
attrs = dict(img.header)
a = img.get_data().astype(np.float32)
assert a.ndim == 3, a.shape
a = a.T # Set axes to (depth, height, width).
a.shape += (1,)... | HACKMESEU/DicomBrowser | dwilib/dwi/nifti.py | Python | gpl-3.0 | 364 |
# -*- coding: utf-8 -*-
#------------------------------------------------------------
# pelisalacarta - XBMC Plugin
# Conector para canal22
# http://blog.tvalacarta.info/plugin-xbmc/pelisalacarta/
#------------------------------------------------------------
from core import logger
from core import scrapertools
from ... | tvalacarta/tvalacarta | python/main-classic/servers/canal22.py | Python | gpl-3.0 | 1,220 |
from comics.aggregator.crawler import CrawlerBase
from comics.core.comic_data import ComicDataBase
class ComicData(ComicDataBase):
name = "Dungeons & Denizens"
language = "en"
url = "http://dungeond.com/"
start_date = "2005-08-23"
end_date = "2014-03-05"
active = False
rights = "Graveyard ... | jodal/comics | comics/comics/dungeond.py | Python | agpl-3.0 | 429 |
# -*- coding: utf-8 -*-
#
# conncon_sources.py
#
# This file is part of NEST.
#
# Copyright (C) 2004 The NEST Initiative
#
# NEST 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... | tobikausk/nest-simulator | topology/examples/conncon_sources.py | Python | gpl-2.0 | 3,092 |
# -*- coding: utf-8 -*-
from selenium import webdriver
from selenium.webdriver.common.by import By
from selenium.webdriver.common.keys import Keys
from selenium.webdriver.support.ui import Select
from selenium.common.exceptions import NoSuchElementException
from selenium.common.exceptions import NoAlertPresentException... | Aquilent/epa-eds | src/test/selenium/test-scripts/Verify-Global-Navigation.py | Python | mit | 1,975 |
#!/usr/bin/python
""" infiniband_topo_map.py
v1.0 April 29, 2015
Copyright 2015 Blake Caldwell
Oak Ridge National Laboratory
Purpose: Map out the IB topology
Where/How/When: Run from CLI
Return Values: 1 on success, 0 on unexpected failure
Expected Output:
1) with -t or --tree a JSON file in hierarcal structure
... | bacaldwell/ib_d3viz | ib_topology_graph.py | Python | gpl-3.0 | 24,257 |
# -*- Mode:Python; indent-tabs-mode:nil; tab-width:4 -*-
#
# Copyright (C) 2016-2018 Canonical Ltd
#
# This program 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 ... | elopio/snapcraft | tests/unit/commands/test_update.py | Python | gpl-3.0 | 6,656 |
#!/usr/bin/env python
import sys
import react
from react import conf
from react import core
from react.core import node
from react.utils import curry
import carsim.gui
from carsim.model import *
conf.heartbeat = True
def usage():
return "usage:\n rosrun carsim %s <machine_name>" % sys.argv[0].split("/")[-1]
... | aleksandarmilicevic/react | src/carsim/scripts/react_machine.py | Python | gpl-2.0 | 1,178 |
# -*- coding: UTF-8 -*-
#######################################################################
# ----------------------------------------------------------------------------
# "THE BEER-WARE LICENSE" (Revision 42):
# @tantrumdev wrote this file. As long as you retain this notice you
# can do whatever you want wit... | repotvsupertuga/tvsupertuga.repository | script.module.streamtvsupertuga/lib/resources/lib/sources/en/iwantmyshow.py | Python | gpl-2.0 | 7,827 |
"""
AWS Alexa speech helper functions
Developed by Zac Patel on 1/10/17
Created using template: Alexa Skills Blueprint for Python 2.7
"""
# reading the version from the main file so it is easier to update
#from GameHelperMain import VERSION
# --------------- Helpers that build all of the responses ------------------... | zbpatel/AlexaGameHelper | SpeechHelpers.py | Python | gpl-3.0 | 1,416 |
# coding: utf-8
import pandas as pd
def format_datetime_to_date(obj):
if pd.isnull(obj):
return ''
return obj.strftime("%Y/%m/%d")
| niamoto/niamoto-core | niamoto/bin/utils.py | Python | gpl-3.0 | 150 |
# Django
from django.db import models
from django.urls import reverse
from django.utils.translation import gettext_lazy as _
# Third Party
from django_extensions.db import fields
# First Party
from modulestatus.models import statusDateRangeMixin
class message(statusDateRangeMixin, models.Model):
title = models.... | bengosney/rhgd3 | banner_messages/models.py | Python | gpl-3.0 | 973 |
import report
import report_paperformat
| ttfseiko/openerp-trunk | openerp/addons/report/models/__init__.py | Python | agpl-3.0 | 40 |
#!/usr/bin/env python3
# -*- coding: utf-8; Mode: Python; indent-tabs-mode: nil; tab-width: 4 -*-
# vim: set fileencoding=utf-8 filetype=python syntax=python.doxygen fileformat=unix tabstop=4 expandtab :
# kate: encoding utf-8; bom off; syntax python; indent-mode python; eol unix; replace-tabs off; indent-width 4; tab-... | DevynCJohnson/Pybooster | pylib/ezwin/__init__.py | Python | lgpl-3.0 | 1,569 |
import scipy as sp
import numpy as np
import scipy.io
import scipy.misc
import scipy.ndimage
import os
import os.path
import copy
import re
from mango import mpi
logger, rootLogger = mpi.getLoggers(__name__)
havePyDicom = False
try:
import dicom
havePyDicom = True
except ImportError as e:
dicom = e
... | pymango/pymango | misc/python/mango/utils/_dicom2netcdf.py | Python | bsd-2-clause | 11,291 |
import _plotly_utils.basevalidators
class PadValidator(_plotly_utils.basevalidators.NumberValidator):
def __init__(self, plotly_name="pad", parent_name="sankey.node", **kwargs):
super(PadValidator, self).__init__(
plotly_name=plotly_name,
parent_name=parent_name,
array_... | plotly/plotly.py | packages/python/plotly/plotly/validators/sankey/node/_pad.py | Python | mit | 478 |
# -*- coding: utf-8 -*-
from parse import do_the_whole_thing as do_it
bnf_text = "E -> T E'\n" \
"E' -> + T E' | ε\n" \
"T -> F T'\n" \
"T' -> * F T' | ε\n" \
"F -> ( E ) | id"
indirect_recursive = "S -> A a | b\n" \
"A -> A c | S d | ε"
bnf_recursive ... | BreakingBugs/LL1-parser | examples.py | Python | mit | 1,543 |
#!/usr/bin/env python
# coding: utf-8
import unittest
import sys
import os
PROJECT_PATH = os.path.sep.join(os.path.abspath(__file__).split(os.path.sep)[:-2])
ROOT_PATH = os.path.dirname(__file__)
if __name__ == '__main__':
if 'GAE_SDK' in os.environ:
SDK_PATH = os.environ['GAE_SDK']
sys.path.in... | renzon/blob_app | test/testloader.py | Python | mit | 630 |
from django.conf.urls import url, include
from . import views
from rest_framework import routers
router = routers.DefaultRouter()
router.register(r'meals', views.MealViewSet)
router.register(r'ingredients', views.IngredientViewSet)
urlpatterns = [
url('^api/', include(router.urls)),
url(r'^$', views.index, na... | srenner/homeweb-v2 | homeweb/dinner/urls.py | Python | mit | 334 |
# pylint: disable=redefined-builtin, wildcard-import
"""Raspberry pi specific declaration and schedules."""
from __future__ import absolute_import as _abs
from .conv2d import *
from .depthwise_conv2d import *
| phisiart/tvm | topi/python/topi/rasp/__init__.py | Python | apache-2.0 | 210 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.