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 |
|---|---|---|---|---|---|
########
# Copyright (c) 2014 GigaSpaces Technologies Ltd. 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... | cloudify-cosmo/cloudify-dsl-parser | dsl_parser/tests/test_get_attribute.py | Python | apache-2.0 | 18,531 |
"""
Unified I/O module for reading and writing various formats.
"""
import os.path
from itertools import product
def gradient(p0, p1):
dx = p1[0] - p0[0]
dy = p1[1] - p0[1]
if dx == 0:
return dy * 99999999999999
return 1.0 * dy / dx
class PixelDataWriter(object):
PIXEL_SCALE = 40
GR... | jerith/depixel | depixel/io_data.py | Python | mit | 5,255 |
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
#
# netbuilder documentation build configuration file, created by
# sphinx-quickstart on Fri Apr 21 23:29:11 2017.
#
# 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
#... | andresberejnoi/NetBuilder | netbuilder/docs/source/conf.py | Python | mit | 5,297 |
import os
from django.db.models.signals import post_save, post_init, post_delete
from django.dispatch import receiver
from .models import Profile
@receiver(post_init, sender=Profile)
def backup_avatar(sender, instance, **kwargs):
instance._current_avatar_file = instance.avatar
instance._current_avatar_thumb... | olegpshenichniy/truechat | server/api/user/signals.py | Python | mit | 1,649 |
A = 7 # Master 1
B = 24
t = 0.5 # the interpolation factor
# calculating the intermediate
C = A + t * (B - A)
print C
# string methods
s = " Hello this is a string "
print s
print s.split()
print s.strip()
print s.upper()
print s.lower()
print s.strip().lower()
| shannpersand/cooper-type | workshops/Python Workshop/18.py | Python | cc0-1.0 | 273 |
import numpy
from chainer import cuda
from chainer import function
from chainer import utils
from chainer.utils import type_check
class Expm1(function.Function):
@property
def label(self):
return 'expm1'
def check_type_forward(self, in_types):
type_check.expect(in_types.size() == 1)
... | kiyukuta/chainer | chainer/functions/math/exponential_m1.py | Python | mit | 880 |
from random import random, seed
import numpy as np
from skued import biexponential, exponential, with_irf
seed(23)
def test_exponential_tzero_limits():
"""Test that the output of ``exponential`` has the correct time-zero"""
tzero = 10 * (random() - 0.5) # between -5 and 5
amp = 5 * random() + 5 # bet... | LaurentRDC/scikit-ued | skued/time_series/tests/test_fitting.py | Python | gpl-3.0 | 6,251 |
import re
from setuptools import setup, find_packages
# Auto detect the library version from the __init__.py file
with open('xbee/__init__.py', 'r') as fd:
version = re.search(r'^__version__\s*=\s*[\'"]([^\'"]*)[\'"]',
fd.read(), re.MULTILINE).group(1)
if not version:
raise RuntimeError... | MichaelCoughlinAN/Odds-N-Ends | Python/Python Modules/XBee-2.3.1/setup.py | Python | gpl-3.0 | 1,137 |
import math, sys
value0 = float(sys.argv[1])
value1 = float(sys.argv[2])
value2 = float(sys.argv[3])
value3 = float(sys.argv[4])
value4 = float(sys.argv[5])
value5 = float(sys.argv[6])
output0 = value0
output1 = value1
output2 = value2 - output1 - math.pi/2
output3 = value3 - output2 - output1 - math.pi/2
outp... | ptroja/mrrocpp | src/application/rcsc/trj/modp.py | Python | gpl-2.0 | 436 |
# -*- coding: utf-8 -*-
# Generated by Django 1.10.5 on 2017-05-14 21:58
from __future__ import unicode_literals
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('sonetworks', '0032_auto_20170514_2158'),
]
operations = [
migrations.AlterF... | semitki/semitki | api/sonetworks/migrations/0033_auto_20170514_2158.py | Python | mit | 483 |
# -*- coding: utf-8 -*-
# Generated by Django 1.10.3 on 2017-01-03 01:47
from __future__ import unicode_literals
import django.db.models.deletion
from django.conf import settings
from django.db import migrations, models
class Migration(migrations.Migration):
initial = True
dependencies = [
migratio... | twm/yarrharr | yarrharr/migrations/0001_initial.py | Python | gpl-3.0 | 3,948 |
from graphics import *
class Board:
def __init__(self,w,h):
self.win = GraphWin('Scrabble',w,h)
self.win.setCoords(-30,-30,180,180)
self.markers = []
tws_j = [0,0,0,7,7,14,14,14]
tws_i = [0,7,14,0,14,0,7,14]
dls_j = [0,0,2,2,3,3,3,6,6,6,6,7,7,8,8,8,8,11,11,1... | itsallvoodoo/csci-school | CSCI220/Week 13 - APR09-13/Board.py | Python | apache-2.0 | 4,833 |
#!/usr/bin/env python
import os
from flask.ext.script import Manager, Server
from ivy_3dprint_site import create_app
from ivy_3dprint_site.models import db, User
env = os.environ.get('IVY_3DPRINT_SITE_ENV', 'prod')
app = create_app('ivy_3dprint_site.settings.%sConfig' % env.capitalize(), env=env)
manager = Manager(a... | hellwen/ivy_3dprint_site | manage.py | Python | bsd-2-clause | 744 |
import argparse
import gensim
import numpy as np
import pandas as pd
from sklearn.model_selection import train_test_split
import sys
sys.path.append("./")
import semEval_core_model as sEcm
import semEval_core_functions as sEcf
__credits__ = ['Casey Beaird', 'Chase Greco', 'Brandon Watts']
__license__ = 'MIT'
__version... | cBeaird/SemEval_Character-Identification-on-Multiparty-Dialogues | Classifiers/conll_2_csv.py | Python | mit | 4,248 |
#
# MLDBFB-573_parse_json.py
# 12 juin 2016
# This file is part of MLDB. Copyright 2016 mldb.ai inc. All rights reserved.
#
import unittest
from mldb import mldb, MldbUnitTest, ResponseException
class MldbFb573(MldbUnitTest):
@classmethod
def setUpClass(self):
ds = mldb.create_dataset({ "id": "samp... | mldbai/mldb | testing/MLDBFB-573_parse_json.py | Python | apache-2.0 | 4,118 |
from route53.xml_parsers.common_health_check import parse_health_check
def list_health_checks_parser(root, connection):
"""
Parses the API responses for the
:py:meth:`route53.connection.Route53Connection.list_health_checks` method.
:param lxml.etree._Element root: The root node of the etree parsed
... | jcastillocano/python-route53 | route53/xml_parsers/list_health_checks.py | Python | mit | 871 |
########################################################################
#
# (C) 2015, Brian Coca <bcoca@ansible.com>
#
# This file is part of Ansible
#
# Ansible is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation... | e-gob/plataforma-kioscos-autoatencion | scripts/ansible-play/.venv/lib/python2.7/site-packages/ansible/galaxy/__init__.py | Python | bsd-3-clause | 2,070 |
# Copyright 2015 Google Inc. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or a... | RyanYoung25/tensorflow | tensorflow/python/framework/importer.py | Python | apache-2.0 | 12,756 |
# -*- coding: utf-8 -*-
"""Deployment module."""
import graphene
import graphene.types.datetime
import iso8601
from cloudify_graphql.loader.blueprint import BlueprintLoader
from cloudify_graphql.loader.execution import ExecutionLoader
from cloudify_graphql.loader.event import EventLoader
from cloudify_graphql.loader... | jcollado/cloudify-graphql | cloudify_graphql/model/deployment.py | Python | mit | 3,289 |
from django.conf.urls import url, include
from parliament.hansards.views import (index, by_year, by_month, hansard,
hansard_analysis, hansard_statement, debate_permalink, document_cache)
urlpatterns = [
url(r'^$', index, name='debates'),
url(r'^(?P<year>\d{4})/$', by_year, name='debates_by_year'),
url... | litui/openparliament | parliament/hansards/urls.py | Python | agpl-3.0 | 869 |
# -*- coding: utf8 -*-
#
# 国家统计局 行政区域代码 文本:
#
# http://www.stats.gov.cn/tjsj/tjbz/xzqhdm/
#
from __future__ import print_function
from collections import OrderedDict
class Area(object):
level = None
def __init__(self, code, name, parent=None):
'''use unicode name'''
self.code = int(code)
... | dlutxx/memo | data/nation_parse.py | Python | mit | 3,087 |
from django.db import models
from django.dispatch import receiver
from django.utils.encoding import python_2_unicode_compatible
from django.conf import settings
from django.utils.translation import ugettext_lazy as _
from django.core.validators import MaxValueValidator, MinValueValidator
from projects.models import Pro... | bilbeyt/ituro | ituro/results/models.py | Python | mit | 11,573 |
from .get_base_style import get_base_style
from .process_renderer import process_renderer
from .process_renderer import init
| plepe/pgmapcss | pgmapcss/renderer/__init__.py | Python | agpl-3.0 | 125 |
class A(object):
def __init__(self):
self.str='astr'
print 'init A'
def printf(self):
print self.str
def __enter__(self):
print 'enter A'
def __exit__(self, exc_type, exc_val, exc_tb):
print 'exit A'
class B(object):
def __init__(self):
self.str = ... | shunliz/test | python/abc/test_with.py | Python | apache-2.0 | 566 |
import sys, os, inspect
from PyQt5.QtWidgets import QMessageBox, QWidget, QComboBox
from PyQt5 import uic
from PyQt5.QtCore import QDate
from new_bonus import NewBonus
directory = os.path.realpath(os.path.abspath(os.path.split(inspect.getfile(inspect.currentframe()))[0]))
sys.path.append(directory + "/lib")
from bbdd... | soker90/betcon | src/edit_bonus.py | Python | gpl-3.0 | 2,281 |
# -*- coding: utf-8 -*-
A = [int(i) for i in raw_input().split()]
A.sort()
print 'S' if A[2] < A[0] + A[1] or A[3] < A[1] + A[2] else 'N'
| vicenteneto/online-judge-solutions | URI/1-Beginner/1929.py | Python | mit | 140 |
# Copyright (c) 2015-2016 Cisco Systems, Inc.
#
# 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, modify, merge... | cimarron-pistoncloud/molecule | molecule/core.py | Python | mit | 14,474 |
import logging
from google.appengine.ext import ndb
import urllib2
from bs4 import BeautifulSoup
from google.appengine.api import urlfetch
from datetime import datetime, timedelta
from src.main.models import Torrent
from time import sleep
class PirateBay():
GROUPS = [
{'code': 100, 'name': 'Audio', 'cate... | Tjorriemorrie/trading | 18_theoryofruns/app_old/src/main/piratebay.py | Python | mit | 7,152 |
"""Stores the Desktop class"""
from node import Node
from data import Size, Rect
from window import Window
class Desktop:
"""
Desktop holds the root nodes and provides methods to switch between these.
Attributes:
roots (Node): Root nodes holding all nodes.
insertion (Node): Insertion poin... | howardjohn/pyty | src/desktop.py | Python | gpl-3.0 | 3,063 |
#!/usr/bin/env python
# Copyright (c) 2012 Google Inc. All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions are
# met:
#
# * Redistributions of source code must retain the above copyright
# notice, this list ... | kyshu/inspector_frontend_180872 | devtools/scripts/compile_frontend.py | Python | gpl-3.0 | 15,779 |
"""A library for integrating pyOpenSSL with CherryPy.
The OpenSSL module must be importable for SSL functionality.
You can obtain it from `here <https://launchpad.net/pyopenssl>`_.
To use this module, set CherryPyWSGIServer.ssl_adapter to an instance of
SSLAdapter. There are two ways to use SSL:
Method One
---------... | paolodoz/timesheet | cherrypy/wsgiserver/ssl_pyopenssl.py | Python | gpl-2.0 | 9,185 |
import sys
import re
for lines in open(sys.argv[1], "rU"):
line = lines.strip()
lexemes = re.split(".out:", line)
oid = lexemes[0].split(".")[1]
ncbi = re.split("val=|'", lexemes[1])[2]
print oid + " \t" + ncbi
| fandemonium/code | parsers/img_oid_to_ncbi_from_html.py | Python | mit | 234 |
from com.googlecode.fascinator.api.indexer import SearchRequest
from com.googlecode.fascinator.common.solr import SolrResult
from com.googlecode.fascinator.spring import ApplicationContextProvider
from java.io import ByteArrayInputStream, ByteArrayOutputStream
class MaintenanceData:
def __init__(self):
pas... | the-fascinator/fascinator-portal | src/main/config/portal/default/default/scripts/maintenance.py | Python | gpl-2.0 | 729 |
import os.path as op
import os
from nose.tools import assert_true, assert_raises
import numpy as np
from numpy.testing import (assert_array_almost_equal, assert_array_equal,
assert_equal, assert_allclose)
import warnings
from mne import (read_events, write_events, make_fixed_length_events,
... | jaeilepp/mne-python | mne/tests/test_event.py | Python | bsd-3-clause | 20,058 |
# -*- coding: utf-8 -*-
"""
Created on Sat Jul 26 23:01:44 2014
@author: Jose Capriles
"""
import pygame, Buttons
from pygame.locals import *
#Initialize pygame
pygame.init()
class Button_Test:
def __init__(self):
self.loopFlag = True
self.main()
#Create a display
... | jrcapriles/armSimulator | ButtonTest.py | Python | mit | 1,443 |
#encoding:utf-8
subreddit = 'PraiseTheCameraMan'
t_channel = '@PraiseTheCameraMan'
def send_post(submission, r2t):
return r2t.send_simple(submission)
| Fillll/reddit2telegram | reddit2telegram/channels/~inactive/praisethecameraman/app.py | Python | mit | 157 |
#!/usr/bin/env python
#
# __COPYRIGHT__
#
# 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, modify, merge, publish,
... | azverkan/scons | test/Deprecated/SourceCode/CVS/CVS.py | Python | mit | 11,399 |
"""
The MIT License (MIT)
Copyright (c) Serenity Software, LLC
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, modify, m... | hickeroar/cahoots | cahoots/confidence/normalizers/phone.py | Python | mit | 2,085 |
# Generated by Django 2.2.1 on 2019-05-20 08:54
from django.db import migrations
class Migration(migrations.Migration):
dependencies = [
('groups', '0037_group_welcome_message'),
]
operations = [
migrations.RemoveField(
model_name='group',
name='password',
... | yunity/foodsaving-backend | karrot/groups/migrations/0038_remove_group_password.py | Python | agpl-3.0 | 331 |
from Crypto.Hash import SHA256
from Crypto.Random import random
from lib.helpers import read_hex
# Project TODO: Is this the best choice of prime? Why? Why not? Feel free to replace!
# 4096 bit safe prime for Diffie-Hellman key exchange
# obtained from RFC 3526
raw_prime = """FFFFFFFF FFFFFFFF C90FDAA2 2168C234 C4C6... | castelom/Skynet | dh/__init__.py | Python | apache-2.0 | 2,802 |
# MIT License
#
# Copyright (c) 2017 David Sandberg
#
# 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, modify, me... | davidsandberg/facenet | src/generative/models/dfc_vae.py | Python | mit | 4,916 |
import pulsar as psr
def load_ref_system():
""" Returns alpha-d-glucuronopyranose as found in the IQMol fragment library.
All credit to https://github.com/nutjunkie/IQmol
"""
return psr.make_system("""
C -1.4074 1.1727 0.3366
C -1.9164 -0.0903 -0.3824
... | pulsar-chem/Pulsar-Core | lib/systems/alpha-d-glucuronopyranose.py | Python | bsd-3-clause | 1,247 |
# -*- coding: utf-8 -*-
# Part of Odoo. See LICENSE file for full copyright and licensing details.
{
'name': 'OdooBot for livechat',
'version': '1.0',
'category': 'Productivity/Discuss',
'summary': 'Add livechat support for OdooBot',
'description': "",
'website': 'https://www.odoo.com/app/discu... | jeremiahyan/odoo | addons/im_livechat_mail_bot/__manifest__.py | Python | gpl-3.0 | 473 |
from django.utils.translation import ugettext as _, ugettext_lazy as _lazy
from django.core import urlresolvers
from flexi_auth.models import ObjectWithContext
from gasistafelice.rest.views.blocks.base import BlockWithList, ResourceBlockAction
from gasistafelice.consts import CREATE
from gasistafelice.gas.models.base... | OrlyMar/gasistafelice | gasistafelice/rest/views/blocks/des_pacts.py | Python | agpl-3.0 | 1,195 |
""" A computing element class that attempts to use glexec if available then
defaults to the standard InProcess Computing Element behaviour.
"""
__RCSID__ = "$Id$"
from DIRAC.Resources.Computing.ComputingElement import ComputingElement
from DIRAC.Core.Utilities.ThreadScheduler import ... | calancha/DIRAC | Resources/Computing/glexecComputingElement.py | Python | gpl-3.0 | 13,436 |
# -*- coding: utf-8 -*-
'''
Copyright (c) 2015 Jacob Mendt
Created on 07.10.15
@author: mendt
'''
import traceback
from pyramid.view import view_config
from pyramid.httpexceptions import HTTPInternalServerError
from sqlalchemy import desc
from georeference import LOGGER
from georeference.settings import OAI_ID_PATTE... | slub/vk2-georeference | georeference/views/user/georeferencehistory.py | Python | gpl-3.0 | 3,257 |
# -*- coding: utf-8 -*-
# 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 option) any later version.
#
# This program is distributed in the h... | Etxea/gestioneide | cambridge/views.py | Python | gpl-3.0 | 29,226 |
# Copyright 2014-2020 Scalyr 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 writin... | imron/scalyr-agent-2 | tests/unit/test_build_info.py | Python | apache-2.0 | 2,893 |
"""
Django settings for der project.
Generated by 'django-admin startproject' using Django 1.8.2.
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 in... | mihail4216/myter | der/settings.py | Python | mit | 2,863 |
# version: 2.006
import os, sys
import shutil
import time
import pexpect
from BasePlugin import BasePlugin
#
class Plugin(BasePlugin):
"""
GIT Plugin has a few parameters:
- server complete path
- branch used for clone
- user and password to connect to server
- snapshot folder, where all da... | Luxoft/Twister | plugins/GITPlugin.py | Python | apache-2.0 | 9,694 |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
#
# Copyright 2019 The FATE 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/lic... | FederatedAI/FATE | python/federatedml/nn/hetero_nn/hetero_nn_guest.py | Python | apache-2.0 | 12,160 |
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
import logging
from django.apps import AppConfig
from django.conf import settings
from django.utils.translation import ugettext_lazy as _
from maintenance_mode.core import set_maintenance_mode
from InvenTree.ready import isImportingData
from plugin imp... | inventree/InvenTree | InvenTree/plugin/apps.py | Python | mit | 1,474 |
# -*- encoding: utf-8 -*-
import copy
from abjad import *
def test_quantizationtools_QGridLeaf___copy___01():
leaf = quantizationtools.QGridLeaf(1)
copied = copy.copy(leaf)
assert format(leaf) == format(copied)
assert leaf != copied
assert leaf is not copied
def test_quantizationtools_QGridLeaf_... | mscuthbert/abjad | abjad/tools/quantizationtools/test/test_quantizationtools_QGridLeaf___copy__.py | Python | gpl-3.0 | 597 |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
#
# Copyright (C) 2007-2009 Christopher Lenz
# All rights reserved.
#
# This software is licensed as described in the file COPYING, which
# you should have received as part of this distribution.
"""Utility for dumping a snapshot of a CouchDB database to a multipart MIME
fi... | djc/couchdb-python | couchdb/tools/dump.py | Python | bsd-3-clause | 3,539 |
# -*- coding: utf-8 -*-
# vim:fenc=utf-8
#
# This file is part of Supysonic.
# Supysonic is a Python implementation of the Subsonic server API.
#
# Copyright (C) 2013-2017 Alban 'spl0k' Féron
# 2017 Óscar García Amor
#
# Distributed under terms of the GNU AGPLv3 license.
import binascii
import strin... | hhm0/supysonic | supysonic/managers/user.py | Python | agpl-3.0 | 5,049 |
"""
18. Using SQL reserved names
Need to use a reserved SQL name as a column name or table name? Need to include
a hyphen in a column or table name? No problem. Django quotes names
appropriately behind the scenes, so your database won't complain about
reserved-name usage.
"""
from django.db import models
from django.... | diegoguimaraes/django | tests/reserved_names/models.py | Python | bsd-3-clause | 910 |
# Copyright (c) 2012 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 ... | zhimin711/nova | nova/scheduler/filters/num_instances_filter.py | Python | apache-2.0 | 2,364 |
# Copyright 2011 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... | Francis-Liu/animated-broccoli | nova/tests/unit/image/test_glance.py | Python | apache-2.0 | 53,575 |
__kupfer_name__ = _("GNU Screen")
__kupfer_sources__ = ("ScreenSessionsSource", )
__description__ = _("Active GNU Screen sessions")
__version__ = ""
__author__ = "Ulrik Sverdrup <ulrik.sverdrup@gmail.com>"
import os
from kupfer.objects import Leaf, Action, Source
from kupfer.obj.helplib import FilesystemWatchMixin
fr... | engla/kupfer | kupfer/plugin/screen.py | Python | gpl-3.0 | 3,350 |
# -*- coding: utf-8 -*-
# Copyright 2010-2021, Google Inc.
# All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions are
# met:
#
# * Redistributions of source code must retain the above copyright
# notice, this... | fcitx/mozc | src/converter/gen_quality_regression_test_data.py | Python | bsd-3-clause | 3,781 |
# coding=utf-8
"""Utilities module for helping definitions retrieval."""
from os.path import join, exists, splitext
from qgis.core import QgsApplication
from copy import deepcopy
from safe import definitions
from safe.definitions import fields
from safe.definitions import (
layer_purposes,
hazard_all,
exp... | akbargumbira/inasafe | safe/definitions/utilities.py | Python | gpl-3.0 | 15,365 |
#! /usr/bin/env python
## -*- Mode: python; py-indent-offset: 4; indent-tabs-mode: nil; coding: utf-8; -*-
#
# Copyright (c) 2014 Siddharth Santurkar
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License version 2 as
# published by the Free Softw... | bijaydev/Implementation-of-Explicit-congestion-notification-ECN-in-TCP-over-wireless-network-in-ns-3 | utils/tests/test-waf.py | Python | gpl-2.0 | 7,623 |
from fuqit.web import render, redirect
from config import db
def GET(web):
return render("write_post.html", web)
def POST(web):
db.insert('post',
title=web.params['title'],
content=web.params['content'])
return redirect("/")
| zedshaw/fuqit | examples/blog/app/write.py | Python | agpl-3.0 | 270 |
import pytest
# Use pytest rich asserts in a file that doesn't match test_* pattern
pytest.register_assert_rewrite("ichnaea.api.submit.tests.base")
| mozilla/ichnaea | ichnaea/api/submit/tests/__init__.py | Python | apache-2.0 | 149 |
import os
from unittest import TestCase
from golem.core.common import HandleKeyError, HandleAttributeError, config_logging
from golem.testutils import TempDirFixture
from mock import patch, ANY
def handle_error(*args, **kwargs):
return 6
class TestHandleKeyError(TestCase):
h = HandleKeyError(handle_error)
... | imapp-pl/golem | tests/golem/core/test_common.py | Python | gpl-3.0 | 2,002 |
import time
from twisted.internet.defer import inlineCallbacks, returnValue
from Tribler.Test.Community.Tunnel.test_tunnel_base import AbstractTestTunnelCommunity
from Tribler.Test.twisted_thread import deferred
from Tribler.community.tunnel.conversion import TunnelConversion
from Tribler.community.tunnel.crypto.tunne... | MaxVanDeursen/tribler | Tribler/Test/Community/Tunnel/test_tunnelcommunity.py | Python | lgpl-3.0 | 13,317 |
"""
At_server_startstop module template
Copy this module one level up, to gamesrc/conf/, name it what you
will and use it as a template for your modifications.
Then edit settings.AT_SERVER_STARTSTOP_MODULE to point to your new
module.
This module contains functions that are imported and called by the
server wheneve... | google-code-export/evennia | game/gamesrc/conf/examples/at_server_startstop.py | Python | bsd-3-clause | 1,621 |
""" This module will contain definitions for each error symbol
listed below which will be equal to the integer value
of the error message.
You can directly compare errors code to those objects.
To look up an error by code, use the Errors_by_code dictionary.
Example usage:
... | leovitch/python-ft2 | freetype2/errors.py | Python | gpl-3.0 | 10,625 |
"""Hello World API implemented using Google Cloud Endpoints.
Defined here are the ProtoRPC messages needed to define Schemas for methods
as well as those methods defined in an API.
"""
import endpoints
import logging
import json
from protorpc import messages
from protorpc import message_types
from protorpc import re... | cheonhyangzhang/fantuanchicago-feedback | rest.py | Python | bsd-3-clause | 10,297 |
# Author: Kratarth Goel
# BITS Pilani (2014)
# LSTM-RBM for music generation
import sys
import os
import tables
import tarfile
import fnmatch
import random
import numpy
import numpy as np
from scipy.io import wavfile
import theano
import theano.tensor as T
from theano.tensor.shared_randomstreams import RandomStreams
f... | kastnerkyle/speech_density | speech_mel_lstmrbm.py | Python | bsd-3-clause | 18,503 |
# -*- coding: utf-8 -*-
import layers
import tensorflow as tf
from q_network import QNetwork
class DuelingNetwork(QNetwork):
def _build_q_head(self, input_state):
self.w_value, self.b_value, self.value = layers.fc('fc_value', input_state, 1, activation='linear')
self.w_adv, self.b_adv, self.adva... | steveKapturowski/tensorflow-rl | networks/dueling_network.py | Python | apache-2.0 | 824 |
# -*- coding: utf-8 -*-
#
# Picard, the next-generation MusicBrainz tagger
# Copyright (C) 2006 Lukáš Lalinský
#
# 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... | mwiencek/picard | picard/formats/mp4.py | Python | gpl-2.0 | 8,946 |
"""
Tightens up response content by removed superflous line breaks and whitespace.
By Doug Van Horn
"""
import re
class StripWhitespaceMiddleware(object):
"""
Strips leading and trailing whitespace from response content.
"""
def __init__(self):
self.whitespace = re.compile('^\s*\n', re.MULTIL... | eugena/django-stripwhitespace-middleware | django_stripwhitespace_middleware/middleware.py | Python | mit | 1,071 |
import math
from src.timetable_exceptions import InvalidTimeException
## Right now I'm not using datetime because the time of day for the class
# should be timestamp-independent
## 1440 is the amount of minutes in a single day, starting from 0
def getHoursAndMins(timeNum):
amtOfHours = math.floor(timeNum / 60)
... | Coteh/timetable | src/time_converter.py | Python | mit | 1,745 |
# -*- coding: utf-8 -*-
# HORTON: Helpful Open-source Research TOol for N-fermion systems.
# Copyright (C) 2011-2017 The HORTON Development Team
#
# This file is part of HORTON.
#
# HORTON is free software; you can redistribute it and/or
# modify it under the terms of the GNU General Public License
# as published by th... | QuantumElephant/horton | horton/io/test/test_wfn.py | Python | gpl-3.0 | 19,258 |
#!/usr/bin/python
import sys
import gnomekeyring as gk
class Context(object):
def clear(self):
self.keychain = None
self.name = None
self.data = None
self.attributes = {}
self.kc_class = None
def find_entry( line, ctx ):
ctx.clear()
if line.startswith( "k... | jakewins/kc-import | kcimp.py | Python | mit | 1,686 |
from itertools import combinations
# function described in the problem
def near_optimum(n, prev_A):
mid_index = len(prev_A) // 2
mid_elem = prev_A[mid_index]
return [mid_elem + v for v in ([0] + prev_A)]
# Testing near_optimum function
# A = [1]
# for i in range(2, 7):
# A = near_optimum(i, A)
# ... | kylebegovich/ProjectEuler | Python/Progress/Problem103.py | Python | gpl-3.0 | 2,759 |
# encoding: utf-8
# Author: Zhang Huangbin <zhb@iredmail.org>
import web
from controllers import decorators as base_decorators
from libs import iredutils
from libs.pgsql import core
session = web.config.get('_session')
require_login = base_decorators.require_login
require_global_admin = base_decorators.require_glob... | villaverde/iredadmin | libs/pgsql/decorators.py | Python | gpl-2.0 | 1,379 |
# Copyright 2015 Huawei Technologies India Pvt Ltd.
# 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
#
# ... | Juniper/python-neutronclient | neutronclient/neutron/v2_0/rbac.py | Python | apache-2.0 | 4,034 |
import numpy as np
import pylab as pp
from epanettools import epanet2 as epa
import time
#import networkx as nx
import scipy.sparse as ss
#import pyhyd
"""
Currently only Nodal Pressures are being saved
"""
def err(e):
if(e>0):
print e, epa.ENgeterror(e,25)
#exit(5)
class Network(object... | richpaulcol/PWG-Transient-Solver | elements/network.py | Python | gpl-2.0 | 31,496 |
from TraceWinDriver import *
| DanielWinklehner/py_particle_processor | py_particle_processor/drivers/TraceWinDriver/__init__.py | Python | mit | 29 |
import requests, json, time
def summarise_forecast(city):
r = requests.get('http://api.openweathermap.org/data/2.5/forecast/daily?q='+city+'&units=imperial&cnt=14')
data = json.loads(r.text)
max_weather=[]
min_weather=[]
main_weather={}
for day in data['list']:
max_weather.append(day['temp']['max'])
min_we... | gunbydesign/forecast-summary | backend.py | Python | gpl-2.0 | 672 |
from pycp2k.inputsection import InputSection
from ._each271 import _each271
class _hyperfine_coupling_tensor1(InputSection):
def __init__(self):
InputSection.__init__(self)
self.Section_parameters = None
self.Add_last = None
self.Common_iteration_levels = None
self.Filename... | SINGROUP/pycp2k | pycp2k/classes/_hyperfine_coupling_tensor1.py | Python | lgpl-3.0 | 783 |
# __init__.py for hsync.
| andrelucas/hsync | hsync/__init__.py | Python | bsd-3-clause | 26 |
import shutil
from dbt.clients import system
from dbt.deps.base import PinnedPackage, UnpinnedPackage
from dbt.contracts.project import (
ProjectPackageMetadata,
LocalPackage,
)
from dbt.logger import GLOBAL_LOGGER as logger
class LocalPackageMixin:
def __init__(self, local: str) -> None:
super()... | fishtown-analytics/dbt | core/dbt/deps/local.py | Python | apache-2.0 | 2,346 |
import time
import warnings
import requests
import base64
import json
import zlib
import OpenSSL.crypto as ct
from Crypto import Random
from Crypto.Cipher import ARC4, PKCS1_v1_5
from Crypto.PublicKey import RSA
from decimal import Decimal
try:
from urllib.parse import quote, unquote
except ImportError:
fro... | fastcoinexchange/fastcoinexchange-python | fastex/api.py | Python | mit | 10,794 |
#!/usr/bin/env python
# -*- encoding: utf-8 -*-
from GeneticCode import *
from Sequence import *
from Bio import SeqIO
def main( fn ):
# read in the CAI table
G = GeneticCode( "euplotid_genetic_code.txt" )
G.read_CAI_table( "euplotid_CAI_table.txt" )
c = 0
for seq_record in SeqIO.parse( fn, "fasta" ):
if c > ... | polarise/BioClasses | score_CAI.py | Python | gpl-2.0 | 1,109 |
from .categories import categories
class Question(object):
def __init__(self, category='General Knowledge', type="multiple", difficulty="easy", question="Example question?", correct_answer="Yes", incorrect_answers=["No"]):
self.category = category
self.type = type
self.difficulty = di... | ianling/opentdb-python | opentdb/question.py | Python | gpl-2.0 | 1,054 |
# encoding: utf-8
import datetime
from south.db import db
from south.v2 import SchemaMigration
from django.db import models
from authentic2.compat import user_model_label
class Migration(SchemaMigration):
def forwards(self, orm):
# Adding field 'SPOptionsIdPPolicy.accept_slo'
db.add_co... | adieu/authentic2 | authentic2/saml/migrations/0015_auto__add_field_spoptionsidppolicy_accept_slo.py | Python | agpl-3.0 | 20,748 |
# -*- coding: utf-8 -*-
# Copyright 2022 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... | googleapis/python-dialogflow-cx | samples/generated_samples/dialogflow_v3beta1_generated_test_cases_list_test_cases_async.py | Python | apache-2.0 | 1,544 |
import lcddriver
import datetime
from time import *
mRs = 0b00000001
lcd = lcddriver.lcd()
# Move cursor to line 3 col 5
#lcd.lcd_write(0x94)
#lcd.lcd_write(0x14,mRs)
#lcd.lcd_write(0x61,mRs)
while True:
lcd.lcd_display_string("Bom dia", 4)
sleep(1)
| mmmarq/raspberry_lcd | lcd.py | Python | gpl-2.0 | 261 |
class Project(object):
''' Container for storing project data.
Parameters
----------
trace_set : eemeter.structures.TraceSet
Complete set of energy traces for this project. For a project site that
has, for example, two electricity meters, each with two traces
(supplied electrici... | impactlab/eemeter | eemeter/structures/project.py | Python | mit | 1,292 |
#!/usr/bin/env python
"""
Analyzer of B0d -> K*0 Ds+ Ds- events
| | |-> pi- pi- pi+ K0L
| |-> pi+ pi+ pi- K0L
|-> K+ pi-
Note: it is supposed to be used within heppy_fcc framework
"""
import math
import time
import numpy
from hep... | semkiv/heppy_fcc | analyzers/BackgroundBs2DsDsKWithDs2PiPiPiKAnalyzer.py | Python | gpl-3.0 | 22,496 |
# -*- coding: utf-8 -*-
# Copyright 2014-2016 The HyperSpyUI developers
#
# This file is part of HyperSpyUI.
#
# HyperSpyUI 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
#... | jat255/hyperspyUI | hyperspyui/mainwindowhyperspy.py | Python | gpl-3.0 | 27,539 |
# FictionSample
import sys, os
import FileCabinet
import SonicScrewdriver as utils
import shutil
import random
from difflib import SequenceMatcher
sampleperyear = 50
def infer_date(startdate, enddate, textdate):
'''Receives two dates, as strings, with no guarantee that either one
will be numeric. Returns a date th... | tedunderwood/GenreProject | python/piketty/FictionSample.py | Python | mit | 3,641 |
import math
from grid import PriorityQueue, Tile
from battle.actions import BattleAction, EndTurnAction, MoveAction
class Battle(object):
"""
Models a battle
:type grid: grid.Grid
:type _combatants: Combatant[]
"""
def __init__(self, grid):
"""
Create an instance of a battle... | Kilghaz/pyd20 | battle/battle.py | Python | gpl-2.0 | 4,881 |
# -*- coding: utf-8 -*-
# Copyright (c) 2018, Frappe Technologies Pvt. Ltd. and Contributors
# See license.txt
from __future__ import unicode_literals
import unittest
import frappe
from erpnext.accounts.doctype.subscription.subscription import get_prorata_factor
from frappe.utils.data import (nowdate, add_days, add_t... | saurabh6790/erpnext | erpnext/accounts/doctype/subscription/test_subscription.py | Python | gpl-3.0 | 23,146 |
def extractOmgitsaray(item):
"""
"""
vol, chp, frag, postfix = extractVolChapterFragmentPostfix(item['title'])
if not (chp or vol) or 'preview' in item['title'].lower():
return None
tagmap = [
('9HTM', '9 Heavenly Thunder Manual', 'translated'),
('undefea... | fake-name/ReadableWebProxy | WebMirror/management/rss_parser_funcs/feed_parse_extractOmgitsaray.py | Python | bsd-3-clause | 847 |
import argparse
import platform
import os.path
from Bio.SubsMat import MatrixInfo
from Bio import SeqIO
from sequence import NeuriteSequence
import sequence
from random import shuffle
# Validates user-provided command-line arguments relative to sequence alignment
class PairwiseAlignmentArgumentValidator():
def __i... | tgillet1/PASTA | parameter.py | Python | mit | 24,896 |
#!/usr/bin/python
import wx
class Frame(wx.Frame):
def __init__(self):
title="bitmap placement issue"
pos=(0, 0)
size=(320, 240)
wx.Frame.__init__(self, parent=None, title=title, pos=pos, size=size)
bm = wx.BitmapFromImage(wx.Image("bitmap_placement.png", wx.BITMAP_TYPE_... | kevinvandervlist/tfa | bugs/bitmap_placement/bitmap_placement.py | Python | gpl-3.0 | 597 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.