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
import unittest from BFVM import brainfuck from murpy.commands.memory.stack import VAR, SET from murpy.commands.operators.math import ADD, SUB, MUL from murpy.commands.controlflow.IF import IF, ELSE, ENDIF from murpy.compiletools import Environment class FinalTestCase(unittest.TestCase): def setUp(self): ...
eisterman/MurPy
murpy/tests/test_final.py
Python
mit
2,849
import viper.lexer as vl import viper.parser as vp import cmd class InteractiveGrammarException(Exception): def __init__(self, output: str): self.output = output class InteractiveGrammar(cmd.Cmd): # pragma: no cover prompt = 'viper_ast> ' def __init__(self, rule: str, multiline: bool): ...
pdarragh/Viper
viper/interactive/grammar.py
Python
apache-2.0
3,636
import numpy as np import gym, time from gym.spaces import prng class Discrete(gym.Space): """ {0,1,...,n-1} Example usage: self.observation_space = spaces.Discrete(2) """ def __init__(self, n): self.n = n def sample(self): return prng.np_random.randint(self.n) def con...
xpharry/Udacity-DLFoudation
tutorials/reinforcement/gym/gym/spaces/discrete.py
Python
mit
750
# -*- coding: utf-8 -*- """ Unit tests for LMS instructor-initiated background tasks helper functions. Tests that CSV grade report generation works with unicode emails. """ import ddt from mock import Mock, patch import tempfile import unicodecsv from capa.tests.response_xml_factory import MultipleChoiceResponseXML...
unicri/edx-platform
lms/djangoapps/instructor_task/tests/test_tasks_helper.py
Python
agpl-3.0
27,326
"""@author Sebastien E. Bourban """ """@note ... this work is based on a collaborative effort between .________. ,--. | | . ( ( |,-. / HR Wallingford EDF - LNHE / \_...
ArteliaTelemac/PostTelemac
PostTelemac/meshlayerparsers/libs_telemac/parsers/parserLQD.py
Python
gpl-3.0
5,940
from vsg.rules import single_space_before_token from vsg.token import case_statement_alternative as token class rule_005(single_space_before_token): ''' This rule checks for a single space before the **=>** operator. **Violation** .. code-block:: vhdl case data is when 3 => ...
jeremiah-c-leary/vhdl-style-guide
vsg/rules/case/rule_005.py
Python
gpl-3.0
599
# -*- coding: utf-8 -*- # Copyright 2011,2014 Christoph Reiter <reiter.christoph@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 the License, or # (at your optio...
elbeardmorez/quodlibet
quodlibet/quodlibet/ext/events/screensaver.py
Python
gpl-2.0
2,924
# -*- coding: utf-8 -*- ############################################################################## # # OpenERP, Open Source Management Solution # Copyright (C) 2004-2010 Tiny SPRL (<http://tiny.be>). # # This program is free software: you can redistribute it and/or modify # it under the terms of the GNU...
mrshelly/openerp71313
openerp/addons/account_followup/account_followup.py
Python
agpl-3.0
23,855
#!/usr/bin/env python3 # -*- coding: utf-8 -*- """ tkGAME - all-in-one Game library for Tkinter Copyright (c) 2014+ Raphaël Seban <motus@laposte.net> 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 ...
ronaldsantos63/tkGAME
lib/widgets/tkgame_i18n.py
Python
gpl-3.0
4,339
import cv2 import os import re face_cascade = cv2.CascadeClassifier("res/haarcascade_profileface.xml") def get_clean_path(path): """ replace extra '/' in url """ return re.sub("//*", "/", path) def get_faces_from_image(image): """ faces:array for each face in image append face t...
sujithcp/Mini-Project
FaceRecognizer/generals.py
Python
gpl-3.0
2,280
# coding=utf-8 # Copyright 2015 Pants project contributors (see CONTRIBUTORS.md). # Licensed under the Apache License, Version 2.0 (see LICENSE). from __future__ import absolute_import, division, print_function, unicode_literals import os import unittest from pants.cache.artifact import DirectoryArtifact, TarballArt...
foursquare/pants
tests/python/pants_test/cache/test_artifact.py
Python
apache-2.0
2,540
# -*- coding: utf-8 -*- # # Licensed to the Apache Software Foundation (ASF) under one # or more contributor license agreements. See the NOTICE file # distributed with this work for additional information # regarding copyright ownership. The ASF licenses this file # to you under the Apache License, Version 2.0 (the #...
criccomini/airflow
setup.py
Python
apache-2.0
13,240
import sys if sys.version_info >= (3, 8): from unittest.mock import AsyncMock else: from asynctest.mock import CoroutineMock as AsyncMock from time import monotonic_ns from typing import Type, cast from unittest.mock import Mock, call import pytest from baby_steps import given, then, when from vedro.core im...
nikitanovosibirsk/vedro
tests/core/test_dispatcher.py
Python
apache-2.0
5,508
# Copyright 2012 OpenStack LLC. # 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...
wallnerryan/quantum_migrate
quantumclient/common/clientmanager.py
Python
apache-2.0
2,776
# 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 ag...
Sorsly/subtle
google-cloud-sdk/platform/ext-runtime/go/test/runtime_test.py
Python
mit
4,874
# -*- coding: utf-8 -*- from django.conf.urls import include, url from django.views.generic import RedirectView, TemplateView from django.urls import reverse_lazy from django.conf import settings from .views import * public_patterns = [ url(r'repository-url-template/', RepositoriesUrlTemplateView.as_view()), # ...
migasfree/migasfree
migasfree/server/urls.py
Python
gpl-3.0
6,231
import logging import marshmallow as ma from drift.utils import Url from drift.utils import json_response from flask import g from flask.views import MethodView from flask_smorest import Blueprint, abort from marshmallow_sqlalchemy import ModelSchema from six.moves import http_client from driftbase.models.db import G...
dgnorth/drift-base
driftbase/api/players/gamestate.py
Python
mit
7,912
# -*- coding: utf-8 -*- L = [ ['Apple', 'Google', 'Microsoft'], ['Java', 'Python', 'Ruby', 'PHP'], ['Adam', 'Bart', 'Lisa'] ] # 打印Apple: print(L[0][0]) # 打印Python: print(L[1][1]) # 打印Lisa: print([2][2])
Jooeys/Pythonista
二位数组索引.py
Python
gpl-3.0
229
from .versionbump import VersionBump # noqa from .filebump import FileBump # noqa
vortec/versionbump
versionbump/__init__.py
Python
mit
84
#!/usr/bin/env python # -*- coding: utf-8 -*- import nose from nose.tools.trivial import eq_ from kanjilint.base import TokenSearchStrategy from kanjilint.base import TokenReplaceStrategy class Test_TokenSearchStrategy(object): def test(self): ''' 正常系: 構文解析器を使った探索をテストする ''' stra...
momijiame/kanjilint
kanjilint/tests/test_base.py
Python
apache-2.0
1,194
# to run in linux #/Big/fbordeu/builds/ParaView_dist/bin/pvpython # to use de time.sleep funtionc import time from math import * # import paraview from paraview.simple import * # import the PXDMFReader Plugin paraview.servermanager.LoadPlugin('/Big/fbordeu/builds/PXDMFReader_bin/libPXDMFReader.so',True) paraview....
aleygue/PxdmfSuite
ParaviewPXDMFReader/PGDTools/anim.py
Python
bsd-3-clause
4,028
# -*- coding: utf-8 -*- # Generated by Django 1.11.6 on 2018-07-30 03:00 from __future__ import unicode_literals from django.db import migrations, models class Migration(migrations.Migration): dependencies = [ ('manager', '0019_auto_20180730_0211'), ] operations = [ migrations.RemoveFie...
reyiyo/eventoL
eventol/manager/migrations/0020_auto_20180730_0300.py
Python
gpl-3.0
683
import sympy class KB(object): def __init__(self): self.statements = [] self.vars = varsVault(self) self.values = AttrDict() for x in sympy.symbols('oldresult result f args goal'.split()): setattr(self.vars,x.name,x) self.vars.result = self.vars.f(self.vars.args)...
atilaromero/occam
kb.py
Python
gpl-2.0
1,819
# -*- coding: utf-8 -*- # # Copyright (c) 2013-2014 Bryan Hundven # # This file is part of pyfastboot. # # pyfastboot 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 y...
bhundven/pyfastboot
fastboot/__init__.py
Python
gpl-2.0
1,595
""" Implement the Reverification XBlock "reverification" server """ from opaque_keys.edx.keys import CourseKey from django.core.exceptions import ObjectDoesNotExist from django.core.urlresolvers import reverse from verify_student.models import VerificationCheckpoint, VerificationStatus class ReverificationService(obj...
MSOpenTech/edx-platform
lms/djangoapps/verify_student/services.py
Python
agpl-3.0
1,942
""" .. module:: SymantecManagementService :platform: All platforms that are compatible with Python framework :synopsis: Module handles all VIP management SOAP calls .. moduleauthor:: Allen Huynh """ class SymantecManagementServices: """This class acts as a layer of abstraction to handling all management...
ArrenH/Securitas
symantec_package/lib/managementService/SymantecManagementServices.py
Python
gpl-3.0
46,854
# Copyright 2009-2010 Canonical Ltd. This software is licensed under the # GNU Affero General Public License version 3 (see the file LICENSE). """Tests for `RepositoryIndexFile`.""" __metaclass__ = type import bz2 import gzip import os import shutil import stat import tempfile import unittest from lp.archivepublis...
abramhindle/UnnaturalCodeFork
python/testdata/launchpad/lib/lp/archivepublisher/tests/test_repositoryindexfile.py
Python
agpl-3.0
4,692
"""Various utility functions prepared for the Gnosis module.""" def generate_value_list_from_dict(dictionary): """Create a list of all the values of a dict after de-dup. :param dictionary: dict object :return: list of all values de-duped. """ value_set = set() for key in dictionary: ...
sara-02/fabric8-analytics-stack-analysis
util/gnosis_util.py
Python
gpl-3.0
1,381
from django.contrib.auth.models import User from django.db import models from django.utils import timezone from .abstract import BaseModel from .core import Product, Shop, Space # from .interactions import Interaction, UserInteraction class AbstractReview(BaseModel): title = models.CharField(max_length=100) ...
Makeystreet/makeystreet
woot/apps/catalog/models/review.py
Python
apache-2.0
2,855
# -*- coding: utf-8 -*- # Author: Alexandre Gramfort <alexandre.gramfort@telecom-paristech.fr> # Denis Engemann <denis.engemann@gmail.com> # # License: BSD (3-clause) from copy import deepcopy from distutils.version import LooseVersion from functools import partial import os.path as op import pickle import py...
adykstra/mne-python
mne/tests/test_epochs.py
Python
bsd-3-clause
114,361
# coding: utf-8 """ @Author: Well @Date: 2015 - 09 - 19 """ from __future__ import unicode_literals from __future__ import print_function from flask import render_template, flash from flask_login import login_required from app.test_tools import test_tools as main from app.test_tools.forms import AccorRedisForm fr...
neiltest/neil_learn_flask_web
app/test_tools/views.py
Python
mit
7,834
from django import template from apps.plus_permissions.interfaces import NotViewable, is_not_viewable from django.conf import settings register = template.Library() @register.inclusion_tag('plus_comments/comment_tree.html', takes_context=True) def comment_tree(context, target, name) : if is_not_viewable(target,...
thehub/hubplus
apps/plus_comments/templatetags/comment_tree.py
Python
gpl-3.0
679
# coding: utf-8 """ weasyprint.layout.tables ------------------------ Layout for tables and internal table boxes. :copyright: Copyright 2011-2016 Simon Sapin and contributors, see AUTHORS. :license: BSD, see LICENSE for details. """ from __future__ import division, unicode_literals ...
johnlb/strange_wp
strange_bak/layout/tables.py
Python
gpl-3.0
32,363
class UnsupportedLocale(KeyError): """An exception that raised when a locale doesn't supported.""" class JSONKeyError(KeyError): """An exception that raised when JSON key doesn't exist""" class NotImplementedYet(NotImplementedError): """An exception that raised when NotImplementedError""" class WrongA...
wikkiewikkie/elizabeth
elizabeth/exceptions.py
Python
mit
397
# coding=utf-8 """ The GridEngineCollector parses qstat statistics from Sun Grid Engine, Univa Grid Engine and Open Grid Scheduler. #### Dependencies * Grid Engine qstat """ import os import re import subprocess import sys import xml.dom.minidom import diamond.collector class GridEngineCollector(diamond.collec...
EzyInsights/Diamond
src/collectors/gridengine/gridengine.py
Python
mit
4,889
__author__ = 'Tom Schaul, tom@idsia.ch' from pybrain.rl import EpisodicTask from inspect import isclass from pybrain.utilities import Named from pybrain.rl.environments.twoplayergames import CaptureGame from pybrain.rl.agents.capturegameplayers import RandomCapturePlayer, ModuleDecidingPlayer from pybrain.rl.agents.c...
daanwierstra/pybrain
pybrain/rl/tasks/capturegame/capturetask.py
Python
bsd-3-clause
3,882
#!/usr/bin/env python import re infile="kin_matrix_AF.txt" OUT=open("NA_counts_at_positions_AF.txt", 'w') with open(infile, 'r') as IN: next(IN) for line in IN: NA_count=0 line=line.rstrip('\n') items=re.split('\t',line) trait=items[0] len_it=len(items) strain_no=len_it-1 for i in items[1...
klaricch/Transposons2
scripts/NA_per_ref.py
Python
mit
522
#!/usr/bin/python #personal pronoment in english #usage : #>>> from personalpronoment import * #>>> x=personal() #>>> x.pronoment[0] #>>> 'i' #and so on class personal: pronoment=['i','you','she','he','it','we','they']
vickydasta/grammarripper
kernel/personalpronoment.py
Python
cc0-1.0
225
#!/usr/bin/python3 import sys import os import socket import select import queue import pickle import threading import signal from server_util import * from base_actor import BaseActor from proposer import Proposer from acceptor import Acceptor from learner import Learner from election import Election class Server(...
lyricalcode/paxos
server.py
Python
apache-2.0
11,689
#!/usr/bin/env python import argparse import sys, os from VM_submitJob import vm_submitjob #from VM_terminateGuest import vm_terminate_guest from virtdc_command_line_utility import get_host_name, list_host_and_domain, show_domain_info, \ show_host_info, force_migrate, terminate_guest, monitorgraph, list_host_domain...
dineshappavoo/virtdc
framework/virtdc.py
Python
mit
8,105
import base64 from flask import Flask, Response, abort, redirect, render_template, request import hashlib import json import os import re import sys import urlparse from blueprint import Blueprint from blueprint import cfg import backend import librato import statsd app = Flask(__name__) def _blueprint(secret, nam...
devstructure/blueprint
blueprint/io/server/__init__.py
Python
bsd-2-clause
8,089
import numpy as np import pandas as pd import pandas.api.types as pdtypes from ..utils import resolution from ..doctools import document from .stat import stat @document class stat_boxplot(stat): """ Compute boxplot statistics {usage} Parameters ---------- {common_parameters} coef : flo...
has2k1/plotnine
plotnine/stats/stat_boxplot.py
Python
gpl-2.0
5,845
#!/usr/bin/env python #-*-coding:utf-8-*- from math import sqrt import numpy as np from scipy.stats import norm class ConfidenceWeighted(): def __init__(self, feat_dim, eta=0.90): self.t = 0 self.m = np.ones(feat_dim) self.s = np.diag([1.0]*feat_dim) self.eta = eta self.phi...
smrmkt/online_learning_algorithms
confidence_weighted.py
Python
bsd-3-clause
1,153
from . import test_account_invoice_validate_tax
oihane/odoo-addons
account_invoice_validate_tax/tests/__init__.py
Python
agpl-3.0
48
""" $ sudo apt-get install python-socksipy $ sudo apt-get install tor $ sudo service tor restart # setting your browser like this: http://i.imgur.com/2aHruSC.png # https://www.youtube.com/watch?v=KDsmVH7eJCs # https://www.youtube.com/watch?v=3p-buQT72u0 # http://my-ip.herokuapp.com >>> import httplib >>> conn = httpl...
agusmakmun/Some-Examples-of-Simple-Python-Script
TOR/TOR.py
Python
agpl-3.0
2,518
#!/usr/bin/env python # -*- coding: utf-8 -*- def isSxh(num): sum = 0 for char in num: n = int(char) sum += n ** 3 return sum == int(num) def isHws(num): length = len(num) for i in range(0, length / 2): if num[i] != num[length - 1 -i]: return False else: ...
ahumeijun/PersonalLearning
Code/number.py
Python
mit
494
import logging from functools import reduce from operator import or_ from collections import OrderedDict from django.shortcuts import get_object_or_404 from django.db.models import Subquery from rest_framework.renderers import JSONRenderer from rest_framework import viewsets, mixins from rest_framework.exceptions imp...
igemsoftware2017/USTC-Software-2017
biohub/biobrick/views.py
Python
gpl-3.0
10,297
# Copyright 2015-2017 Capital One Services, LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed ...
jdubs/cloud-custodian
c7n/resources/directory.py
Python
apache-2.0
1,323
#!/usr/bin/env python ''' NPR 2016-05-22 http://www.npr.org/2016/05/22/478980646/straight-out-of-the-funny-papers-here-are-a-few-cartoon-conundrums Name a common household item in 6 letters. Change the middle two letters to a P, and you'll get the 5-letter last name of a famous person who professionally used that it...
boisvert42/npr-puzzle-python
2016/0522_household_item.py
Python
cc0-1.0
1,195
"""web URL Configuration The `urlpatterns` list routes URLs to views. For more information please see: https://docs.djangoproject.com/en/1.8/topics/http/urls/ Examples: Function views 1. Add an import: from my_app import views 2. Add a URL to urlpatterns: url(r'^$', views.home, name='home') Class-based v...
Charleo85/SIS-Rebuild
web/web/urls.py
Python
bsd-3-clause
2,785
# # Copyright (c) 2018 Bobby Noelte # # SPDX-License-Identifier: Apache-2.0 # from extract.globals import * from extract.directive import DTDirective ## # @brief Manage clocks related directives. # # Handles: # - clocks # directives. # class DTClocks(DTDirective): def __init__(self): pass def _extra...
kraj/zephyr
scripts/dts/extract/clocks.py
Python
apache-2.0
7,110
# -*- coding: utf-8 -*- import nltk import keras import itertools import numpy as np import pickle from keras.models import Sequential, Model from keras.optimizers import RMSprop from nltk.tokenize import regexp_tokenize from keras.models import model_from_json from keras.layers import Dense, Dropout, Activation, Lambd...
prachi285/multilingual-auto-corrector
recurrent language model/learning_model.py
Python
mit
10,304
a = """LRRLLLRDRURUDLRDDURULRULLDLRRLRLDULUDDDDLLRRLDUUDULDRURRLDULRRULDLRDUDLRLLLULDUURRRRURURULURRULRURDLULURDRDURDRLRRUUDRULLLLLDRULDDLLRDLURRLDUURDLRLUDLDUDLURLRLDRLUDUULRRRUUULLRDURUDRUDRDRLLDLDDDLDLRRULDUUDULRUDDRLLURDDRLDDUDLLLLULRDDUDDUUULRULUULRLLDULUDLLLLURRLDLUDLDDLDRLRRDRDUDDDLLLLLRRLLRLUDLULLDLDDRRUDDRLRD...
tehasdf/AdventOfCode2016
p2.py
Python
mit
3,489
# Copyright 2016 The TensorFlow Authors. All Rights Reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applica...
AsimmHirani/ISpyPi
tensorflow/contrib/tensorflow-master/tensorflow/contrib/distributions/python/ops/dirichlet_multinomial.py
Python
apache-2.0
13,510
''' |marx| offers several different source shapes. Tests in this module exercise those sources (except ``SAOSAC``, which is heavily used in :ref:`sect-tests.PSF` already). ''' import shutil import subprocess import os from collections import OrderedDict from marxtest import base title = 'Sources in |marx|' tests = ...
Chandra-MARX/marx-test
tests/source.py
Python
gpl-2.0
10,336
#!/usr/bin/python # # Copyright (c) 2011 Rime Project. # # 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...
AI-comp/Orientation2015Problems
rime/basic/consts.py
Python
mit
3,991
from django.contrib import admin from .models import Question, Choice class ChoiceInline(admin.TabularInline): model = Choice extra = 3 class QuestionAdmin(admin.ModelAdmin): fieldsets = [ (None, {'fields': ['question_text']}), ('Date information',{'fields': ['pub_date'], 'cl...
kcolletripp/popular
compare/admin.py
Python
gpl-3.0
675
# -*- coding:utf-8 -*- import json from collections import defaultdict from datetime import datetime from collections import OrderedDict def sorting_dict_by_key(src_dict, reverse=False): return _sorting_dict(src_dict=src_dict, sorting_index=0, reverse=reverse) def sorting_dict_by_value(src_dict, reverse=False):...
dev-meetup/dev-meetup.github.io
script/event_statistic.py
Python
mit
3,600
from abc import ABCMeta, abstractmethod class Display: """ Superclass for classes which can display textual information to the user """ __metaclass__ = ABCMeta def __init__(self): pass @abstractmethod def show(self, message1=None, message2=None): """ Show a messa...
ApproxEng/viridia
src/python/approxeng/viridia/display.py
Python
apache-2.0
1,628
# 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 agreed to in writing, ...
google/gazoo-device
gazoo_device/capabilities/matter_clusters/interfaces/level_control_base.py
Python
apache-2.0
1,367
# -*- coding: utf-8 -*- """ sphinx.roles ~~~~~~~~~~~~ Handlers for additional ReST roles. :copyright: 2007-2008 by Georg Brandl. :license: BSD. """ import re from docutils import nodes, utils from docutils.parsers.rst import roles from sphinx import addnodes ws_re = re.compile(r'\s+') caption_...
creasyw/IMTAphy
documentation/doctools/tags/0.4/sphinx/roles.py
Python
gpl-2.0
8,605
# -*- coding: utf-8 -*- # # This file is part of Invenio. # Copyright (C) 2015-2019 CERN. # # Invenio is free software; you can redistribute it and/or modify it # under the terms of the MIT License; see LICENSE file for more details. """Package configuration.""" PREVIEWER_CSV_VALIDATION_BYTES = 1024 """Number of byte...
inveniosoftware/invenio-previewer
invenio_previewer/config.py
Python
mit
1,667
import unittest import shutil import tempfile import os.path import createrepo_c as cr from .fixtures import * class TestCaseXmlFile(unittest.TestCase): def setUp(self): self.tmpdir = tempfile.mkdtemp(prefix="createrepo_ctest-") def tearDown(self): shutil.rmtree(self.tmpdir) def test_xm...
Conan-Kudo/createrepo_c
tests/python/tests/test_xml_file.py
Python
gpl-2.0
14,161
# -*- coding: utf-8 -*- from __future__ import unicode_literals from django.db import migrations, models class Migration(migrations.Migration): dependencies = [ ('candidates', '0027_create_standard_complex_fields'), ] operations = [ migrations.AddField( model_name='extrafiel...
mysociety/yournextmp-popit
candidates/migrations/0028_create_order_attr_of_extra.py
Python
agpl-3.0
429
#!/usr/bin/python # # Copyright 2013 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 b...
caioserra/apiAdwords
examples/adspygoogle/dfa/v1_20/get_advertisers.py
Python
apache-2.0
2,199
# Copyright 2009 Shikhar Bhushan # # 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...
o3project/ryu-oe
ryu/contrib/ncclient/transport/session.py
Python
apache-2.0
7,919
from django.shortcuts import render from django.views.generic import TemplateView from django.http import HttpResponseRedirect from chef_profile.models import ChefProfile from .forms import UserForm, ChefProfileForm class ProfileView(TemplateView): template_name = 'chef_profile/profile.html' def edit_profile(r...
TeamReciprocity/reciprocity
reciprocity/chef_profile/views.py
Python
mit
1,036
#!/usr/bin/env python # # HoneyAgent.py # # 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 Software Foundation. # # This program is distributed in the hope that it will be useful, # but WITHOUT ANY...
gh0std4ncer/thug
src/Analysis/honeyagent/HoneyAgent.py
Python
gpl-2.0
4,199
# Copyright (c) 2017 Iotic Labs 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 # # https://github.com/Iotic-Labs/py-IoticBulkData/blob/master/LICENSE # # Unless...
Iotic-Labs/py-IoticBulkData
src/Ioticiser/Config.py
Python
apache-2.0
2,853
"""Support for binary sensors through the SmartThings cloud API.""" from typing import Optional, Sequence from pysmartthings import Attribute, Capability from homeassistant.components.binary_sensor import BinarySensorDevice from . import SmartThingsEntity from .const import DATA_BROKERS, DOMAIN CAPABILITY_TO_ATTRIB...
leppa/home-assistant
homeassistant/components/smartthings/binary_sensor.py
Python
apache-2.0
2,830
from datetime import timedelta import numpy as np from climt import (BucketHydrology, get_default_state) def get_quantities(state): heat = state['surface_material_density'].values*state['soil_layer_thickness'].values*\ state['surface_temperature'].values*state['heat_capacity_of_soil'].values moistur...
CliMT/climt-future
tests/test_bucket_hydrology.py
Python
bsd-3-clause
2,975
"""N-Ring resonators example.""" import EMpy import numpy import pylab wls = numpy.linspace(1.53e-6, 1.57e-6, 1000) Ks = [EMpy.devices.Coupler(wls, numpy.sqrt(0.08), 1.), EMpy.devices.Coupler(wls, numpy.sqrt(0.008), 1.), EMpy.devices.Coupler(wls, numpy.sqrt(0.006), 1.), EMpy.devices.Coupler(wls, nu...
DavidRimel/EMpy
examples/ex_NRR.py
Python
mit
868
# yalec - Yet Another Let's Encrypt Client # Copyright (C) 2016 Falk Garbsch # # This library 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 2.1 of the License, or (at your option) any...
nexus511/yalec
letsencrypt/http.py
Python
lgpl-2.1
5,704
# Run by Heroku scheduler every night # If running locally, uncomment below imports import sys #sys.path.insert(0, '/<path-to-your-codebase>') import settings from lib import userdb userdb.update_twitter_profile_images()
unionsquareventures/theconversation
scripts/update_users.py
Python
gpl-3.0
223
from django.template import TemplateSyntaxError from django.test import SimpleTestCase from ..utils import setup class FirstOfTagTests(SimpleTestCase): @setup({'firstof01': '{% firstof a b c %}'}) def test_firstof01(self): output = self.engine.render_to_string('firstof01', {'a': 0, 'c': 0,...
yephper/django
tests/template_tests/syntax_tests/test_firstof.py
Python
bsd-3-clause
3,299
import os from setuptools import setup with open(os.path.join(os.path.dirname(__file__), 'README.md')) as readme: README = readme.read() # allow setup.py to be run from any path os.chdir(os.path.normpath(os.path.join(os.path.abspath(__file__), os.pardir))) setup( name='mezzanine-developer-extension', ver...
educalleja/mezzanine-developer-extension
setup.py
Python
bsd-3-clause
1,334
import torch def rprop(opfunc, x, config, state=None): """ A plain implementation of RPROP ARGS: - `opfunc` : a function that takes a single input (X), the point of evaluation, and returns f(X) and df/dX - `x` : the initial point - `state` : a table describing the state of t...
RPGOne/Skynet
pytorch-master/torch/legacy/optim/rprop.py
Python
bsd-3-clause
3,758
f=[] x=raw_input() x=x.split(' ') a=int(x[0]) b=int(x[1]) n=int(x[2]) print n f.append(a) f.append(b) for i in xrange(2,n): f.append(f[i-1]**2+f[i-2]) print f[n-1]
silverjack3303/hackerrank
fibonacci_modified.py
Python
apache-2.0
179
from state.logging_state_provider import LoggingStateProviderWithListeners from sensorfusion.height_provider import HeightProvider from sensorfusion.attitude_provider import AttitudeProvider, AttitudeState class SensorFusionMaster(LoggingStateProviderWithListeners): """ This class is responsible for taki...
timdelbruegger/freecopter
src/python3/sensorfusion/fusion_master.py
Python
mit
987
#!/usr/bin/env python # -*- coding: utf-8 -*- # # Copyright (C) 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. """Simple HTTP client implementation based on the ``httplib`` module in the standar...
BenLand100/rat-pac
python/couchdb/http.py
Python
bsd-3-clause
21,083
""" Settings package is acting exactly like settings module in standard django projects. However, settings combines two distinct things: (1) General project configuration, which is property of the project (like which application to use, URL configuration, authentication backends...) (2) Machine-specific environ...
centrumholdings/cthulhubot
tests/example_project/settings/__init__.py
Python
bsd-3-clause
897
""" General projector code. Functions that handel the registration of projector elements and the rendering of the data to present it on the projector. """ from typing import Any, Callable, Dict, List from .cache import element_cache AllData = Dict[str, Dict[int, Dict[str, Any]]] ProjectorSlide = Callable[[AllData...
emanuelschuetze/OpenSlides
openslides/utils/projector.py
Python
mit
2,992
# ---------------------------------------------------------------------- # 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...
rhyolight/nupic.research
htmresearch/regions/GridCellLocationRegion.py
Python
gpl-3.0
20,208
import logging import re from streamlink.plugin import Plugin, pluginmatcher from streamlink.stream import HLSStream log = logging.getLogger(__name__) @pluginmatcher(re.compile( r"https?://(www\.)?zengatv\.com/\w+" )) class ZengaTV(Plugin): """Streamlink Plugin for livestreams on zengatv.com""" _id_re ...
melmorabity/streamlink
src/streamlink/plugins/zengatv.py
Python
bsd-2-clause
1,274
#!/usr/bin/env python from distutils.core import setup setup( version='0.11', name="runnable", description="Runnable django forms", author="Wouter van Atteveldt", author_email="wouter@vanatteveldt.com", packages=["runnable"], classifiers=[ "License :: OSI Approved :: MIT License", ...
vanatteveldt/runnable
setup.py
Python
mit
376
from Products.CMFCore.utils import getToolByName from tn.plonemailing import behaviors from tn.plonemailing import interfaces from zope.app.testing import placelesssetup import datetime import stubydoo import plone.app.controlpanel.mail import unittest import zope.annotation import zope.interface import zope.intid imp...
tecnologiaenegocios/tn.plonemailing
src/tn/plonemailing/tests/test_behaviors.py
Python
bsd-3-clause
11,730
# -*- coding: utf-8 -*- from __future__ import unicode_literals __all__ = [ '__version_info__', '__version__', '__author__', '__author_email__', ] __version_info__ = (0, 4, 3) __version__ = '.'.join([unicode(i) for i in __version_info__]) __author__ = 'David Vuong' __author_email__ = 'david@imageinte...
ImageIntelligence/mimiron
mimiron/__init__.py
Python
mit
334
from django.contrib.auth.models import User from django.test import TestCase from django.urls import resolve, reverse from ..forms import NewTopicForm from ..models import Board, Post, Topic from ..views import new_topic class NewTopicTests(TestCase): def setUp(self): Board.objects.create(name='Django', ...
sibtc/django-beginners-guide
boards/tests/test_view_new_topic.py
Python
mit
3,536
from .kivymvp import *
vasss/kivymvp
kivymvp/__init__.py
Python
apache-2.0
22
import os from packaging.version import Version from hatch.project.core import Project from hatch.utils.fs import Path def main(): project = Project(Path(__file__).resolve().parent.parent) version = Version(project.metadata.version) with open(os.environ['GITHUB_ENV'], 'a', encoding='utf-8') as f: ...
ofek/hatch
scripts/set_release_version.py
Python
mit
427
############################################################################## # Copyright (c) 2013-2018, 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...
mfherbst/spack
var/spack/repos/builtin/packages/py-pyserial/package.py
Python
lgpl-2.1
1,571
# Plots 0-1, hinge and log loss. import superimport import numpy as np import matplotlib.pyplot as plt import pyprobml_utils as pml zeroOne = np.vectorize(lambda x: 1 * (x <= 0)) hinge = np.vectorize(lambda x: max(0, 1-x)) logLoss = np.vectorize(lambda x: np.log2(1 + np.exp(-x))) expLoss = np.vectorize(lambda x: n...
probml/pyprobml
scripts/hinge_loss_plot.py
Python
mit
688
#!/usr/bin/env python # -*- coding: utf-8 -*- """Extract fragments for molecules in given SDF files and save then into JSON. Path and circular fragments use different indexing method, so they may collide. Usage: python extract_fragments.py -i {input file or directory with input files} -o {path to ...
davidhoksza/bayescreen
biochem_tools/extract_fragments.py
Python
mit
13,552
from ansible import errors import json def to_group_vars(host_vars, groups, target = 'all'): data = [] for host in groups[target]: data.append(host_vars[host]) return data class FilterModule (object): def filters(self): return {"to_group_vars": to_group_vars}
barajasfab/do-stack-template
roles/gluster_minio/filter_plugins/to_group_vars.py
Python
mit
293
#!/usr/bin/env python # -*- coding: utf-8 -*- """Packaging setup for drf-cached-instances.""" from drf_cached_instances import __version__ as version try: from setuptools import setup except ImportError: from distutils.core import setup readme = open('README.rst').read() body_tag = ".. Omit badges from docs...
pombredanne/drf-cached-instances
setup.py
Python
mpl-2.0
2,110
# encoding: utf-8 # # Copyright (C) 2010-2013 Alec Thomas <alec@swapoff.org> # All rights reserved. # # This software is licensed as described in the file COPYING, which # you should have received as part of this distribution. # # Author: Alec Thomas <alec@swapoff.org> """Schema validation for Python data structures. ...
GbalsaC/bitnamiP
venv/lib/python2.7/site-packages/voluptuous.py
Python
agpl-3.0
31,914
# Copyright 2014 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...
weiting-chen/manila
contrib/tempest/tempest/api/share/admin/test_share_servers_negative.py
Python
apache-2.0
4,715
# -*- encoding: utf-8 -*- ############################################################################## # # Copyright (c) 2013-2014 Didotech SRL (info at didotech.com) # All Rights Reserved. # # WARNING: This program as such is intended to be used by professional # programmers who take the who...
odoousers2014/LibrERP
l10n_it_sale/wizard/confirmation.py
Python
agpl-3.0
3,636
from __future__ import absolute_import, division, print_function import numpy as np from six.moves import xrange from .common import Benchmark class LaplaceInplace(Benchmark): params = ['inplace', 'normal'] param_names = ['update'] def setup(self, update): N = 150 Niter = 1000 d...
DailyActie/Surrogate-Model
01-codes/numpy-master/benchmarks/benchmarks/bench_app.py
Python
mit
2,745
# encoding: utf-8 # module PyKDE4.kdeui # from /usr/lib/python2.7/dist-packages/PyKDE4/kdeui.so # by generator 1.135 # no doc # imports import PyKDE4.kdecore as __PyKDE4_kdecore import PyQt4.QtCore as __PyQt4_QtCore import PyQt4.QtGui as __PyQt4_QtGui import PyQt4.QtSvg as __PyQt4_QtSvg from KCompletionBase import K...
ProfessorX/Config
.PyCharm30/system/python_stubs/-1247972723/PyKDE4/kdeui/KComboBox.py
Python
gpl-2.0
3,298