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 |
|---|---|---|---|---|---|
#! /usr/bin/python
'''
.. module:: algorithms
:synopsis: Module implements algorithms used for planning.
.. moduleauthor:: Cristian Ioan Vasile <cvasile@bu.edu>
'''
'''
Module implements algorithms used for planning.
Copyright (C) 2014-2016 Cristian Ioan Vasile <cvasile@bu.edu>
Hybrid and Networked Sy... | wasserfeder/lomap | lomap/algorithms/srfs.py | Python | gpl-2.0 | 8,800 |
# Imports {{{
from wtforms import TextField, PasswordField, validators
from flask.ext.wtf import Form
# }}}
class LoginForm(Form):
username = TextField('Username', validators=[validators.Required(message='Username is required.')])
password = PasswordField('Password', validators=[validators.Required(message='Pa... | jkossen/showoff | showoff/frontend/forms.py | Python | bsd-2-clause | 344 |
# Copyright 2022 The Magenta Authors.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in ... | magenta/magenta | magenta/models/music_vae/configs.py | Python | apache-2.0 | 21,553 |
from .mixins import *
from .views import *
| tswicegood/cbv_utils | cbv_utils/tests/__init__.py | Python | apache-2.0 | 43 |
#
# Copyright 2008 The ndb 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 applicable l... | gitprouser/appengine-bottle-skeleton | lib/ndb/context_test.py | Python | apache-2.0 | 58,069 |
# -*- coding: utf-8 -*-
#
# Copyright (C) 2006-2009 Edgewall Software
# All rights reserved.
#
# This software is licensed as described in the file COPYING, which
# you should have received as part of this distribution. The terms
# are also available at http://genshi.edgewall.org/wiki/License.
#
# This software consist... | retif/stealthpage | genshi/template/text.py | Python | gpl-3.0 | 12,441 |
#!/bin/env python
# encoding:utf-8
#
# Author: CORDEA
# Created: 2014-09-02
#
import urllib2
outFile = open("achivements.csv", "w")
for i in range(30):
try:
res = urllib2.urlopen("https://opensnp.org/achievements/" + str(i))
lines = res.readlines()
for line in lines:
if '<h3... | CORDEA/analysis_of_1000genomes-data | programs/analysis_opensnp/url.ping.py | Python | apache-2.0 | 539 |
#!/usr/bin/python
import numpy
from sys import argv,exit
from data import DATA_LIB
from keras.utils import np_utils
from keras.models import Sequential
from keras.layers import Dense,Activation,Dropout,LSTM,Flatten
from keras.callbacks import ModelCheckpoint
def build(input_shape, output_shape):
model = Sequential()
... | k3170makan/PyMLProjects | xss_payloads/fit_train.py | Python | mit | 2,617 |
# -*- coding: utf-8 -*-
from unittest import TestCase
from tests.helper.Stubs import Core
from module.Api import Input, Output
from module.interaction.InteractionManager import InteractionManager
class TestInteractionManager(TestCase):
@classmethod
def setUpClass(cls):
cls.core = Core()
def set... | swayf/pyLoad | tests/manager/test_interactionManager.py | Python | agpl-3.0 | 1,513 |
from sklearn import datasets
from sklearn.linear_model import LinearRegression
import matplotlib.pyplot as plt
loaded_data = datasets.load_boston()
data_X = loaded_data.data
data_y = loaded_data.target
model = LinearRegression()
model.fit(data_X, data_y)
print(model.predict(data_X[:4,:]))
print(data_y[:4])
print(mo... | shunliz/test | python/scikit/linear.py | Python | apache-2.0 | 505 |
# coding=utf-8
from __future__ import absolute_import
from .decorators import crossdomain, touchui_admin_permission
from octoprint.server.util.flask import restricted_access
import octoprint.plugin
import octoprint.settings
import octoprint.util
import flask
import functools
import os
class touchui_api(octoprint.plu... | BillyBlaze/OctoPrint-TouchUI | octoprint_touchui/api.py | Python | agpl-3.0 | 1,762 |
import os
import vobject
from smsgates import BaseFactory
from smsgates import Contact
from smsgates import ContactBook
class ContactParserFactory(BaseFactory):
@property
def _choices(self):
return {'.vcf': vcard_contactbook_parser}
@classmethod
def get_class(cls, name=None):
(root, e... | lukmdo/smsgates | smsgates/extras/__init__.py | Python | lgpl-3.0 | 1,442 |
# pylint: disable=invalid-name,missing-docstring,no-self-use
import pytest
from ensign import BinaryFlag
@pytest.mark.component
@pytest.mark.usefixtures("db")
class TestFlagsAPI:
def test_get(self, api):
BinaryFlag.create(
"flag0",
label="Fake flag",
description="Flag... | bolsote/py-cd-talk | tests/test_api.py | Python | isc | 2,747 |
from django.test import TestCase
from blog.models import Entry
from model_mommy import mommy
from django.utils import timezone
from datetime import timedelta
# Create your tests here.
class EntryTestCase(TestCase):
def setUp(self):
self.public_entry = mommy.make_recipe(
'blog.entry', publicit... | wlonk/django-basic-blog | blog/tests.py | Python | mit | 935 |
# -*- coding: utf-8 -*-
# -----------------------------------------------------------------------------
# (C) British Crown Copyright 2012-8 Met Office.
#
# This file is part of Rose, a framework for meteorological suites.
#
# Rose is free software: you can redistribute it and/or modify
# it under the terms of the GNU ... | aosprey/rose | lib/python/rose/env_cat.py | Python | gpl-3.0 | 2,172 |
#!/usr/bin/python
import threading
import SocketServer
import alsaaudio
import socket
import re
import sys
import struct
import os
import numpy
import select
import traceback
import argparse
import pexpect
CMDLEN = 1024 # should always fit
BUFFER_SIZE = 1024 # from dspserver
PERIOD = 1024 # BUFFER_SIZE*4/N, N=4
TXLEN... | g0hww/ghpsdr3-kx3-server | kx3-server.py | Python | gpl-3.0 | 8,371 |
# -*- coding: utf-8 -*-
# ###
# Copyright (c) 2016, Rice University
# This software is subject to the provisions of the GNU Affero General
# Public License version 3 (AGPLv3).
# See LICENCE.txt for details.
# ###
from __future__ import unicode_literals
import hashlib
import json
import logging
import sys
from io import... | Connexions/cnx-epub | cnxepub/formatters.py | Python | agpl-3.0 | 33,743 |
#!/usr/bin/env python
import sys
import os
import argparse
import yaml
import math
sys.path.append(os.path.join(sys.path[0], "..", "..")) # load parent path of KicadModTree
from KicadModTree import * # NOQA
from KicadModTree.nodes.base.Pad import Pad # NOQA
sys.path.append(os.path.join(sys.path[0], "..", "tools")... | SchrodingersGat/kicad-footprint-generator | scripts/Capacitors_SMD/C_Elec_round.py | Python | gpl-3.0 | 17,833 |
# -*- coding: utf-8 -*-
# Generated by Django 1.11.2 on 2017-10-31 13:01
from __future__ import unicode_literals
from django.db import migrations
class Migration(migrations.Migration):
dependencies = [
('base', '0262_remove_educationgroupyear_credits'),
]
operations = [
migrations.RunSQ... | uclouvain/osis | base/migrations/0263_fix_message_consolidation_cancellation_proposals.py | Python | agpl-3.0 | 5,186 |
def break_words(stuff):
""" This funciton will break up words for us."""
word = stuff.split(' ')
return word
def sort_words(words):
return sorted(words)
def print_last_word(words):
word = words.pop(-1)
print word
def sort_sentence(sentence):
words = break_words(sentence)
return sor... | Simon9398/PythonByHardWay | function.py | Python | mpl-2.0 | 337 |
from nose import tools as nt
from tests.base import AdminTestCase
from osf_tests.factories import UserFactory
from osf.models.admin_log_entry import AdminLogEntry, update_admin_log
class TestUpdateAdminLog(AdminTestCase):
def test_add_log(self):
user = UserFactory()
update_admin_log(user.id, 'df... | HalcyonChimera/osf.io | admin_tests/common_auth/test_logs.py | Python | apache-2.0 | 509 |
from django.conf.urls import patterns, url
from rememerme.friends.rest.friends import views
urlpatterns = patterns('',
url(r'^/?$', views.FriendsListView.as_view()),
url(r'^/(?P<user_id>[-\w]+)/?$', views.FriendsSingleView.as_view())
)
| rememerme/friends-api | rememerme/friends/rest/friends/urls.py | Python | apache-2.0 | 246 |
# coding: utf-8
"""Pytest Fixtures"""
from __future__ import absolute_import
from __future__ import unicode_literals
import copy
import json
import random
import sys
import pytest
import gjtk.example
# Pytest fixtures can rely on other fixtures.
# pylint: disable=redefined-outer-name
# Generic
@pytest.fixture... | dmtucker/gjtk-py | gjtk/test/fixtures.py | Python | lgpl-2.1 | 7,696 |
#!/usr/bin/env python
# we're using python 3.x style print but want it to work in python 2.x,
from __future__ import print_function
import re, os, argparse, sys, math, warnings
from collections import defaultdict
try: # since gzip will only be needed if there are gzipped files, accept
import gzip # ... | keli78/pocolm | scripts/get_word_counts.py | Python | apache-2.0 | 3,255 |
#def create_sliced_iter_funcs_train2(model, X_unshared, y_unshared):
# """
# WIP: NEW IMPLEMENTATION WITH PRELOADING GPU DATA
# build the Theano functions (symbolic expressions) that will be used in the
# optimization refer to this link for info on tensor types:
# References:
# http://deeplearni... | bluemellophone/ibeis_cnn | broken/old_batch.py | Python | apache-2.0 | 5,867 |
# Copyright (c) 2015 Mirantis Inc.
#
# Licensed under the Apache License, Version 2.0 (the License);
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
# Unless required by applicable law or agreed to in writing, so... | realsystem/CloudFerry | cloudferrylib/base/exception.py | Python | apache-2.0 | 618 |
# This file is part of MyPaint.
# Copyright (C) 2014-2016 by Andrew Chadwick <a.t.chadwick@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 ... | achadwick/mypaint | lib/meta.py | Python | gpl-2.0 | 11,632 |
# 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 req... | dims/neutron | neutron/tests/unit/extension_stubs.py | Python | apache-2.0 | 2,053 |
#!/usr/bin/python
# Copyright (c) 2012 The Native Client Authors. All rights reserved.
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
import optparse
import os
import subprocess
import sys
import tempfile
sys.path.append(os.path.join(os.path.dirname(__file__), '.... | yantrabuddhi/nativeclient | tests/abi_corpus/validator_regression_test.py | Python | bsd-3-clause | 4,797 |
# A class that takes a single image, applies affine transformations, and renders it
# (and possibly a pixel-mask to tell which pixels are coming from the image)
# The class will only load the image when the render function is called (lazy evaluation)
import cv2
import numpy as np
import math
class SingleTileAffineRend... | Rhoana/rh_aligner | old/renderer/single_tile_affine_renderer.py | Python | mit | 12,335 |
#!/usr/bin/python2.4
# Copyright (c) 2006-2008 The Chromium Authors. All rights reserved.
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
'''SCons integration for GRIT.
'''
# NOTE: DO NOT IMPORT ANY GRIT STUFF HERE - we import lazily so that grit and
# its depend... | rwatson/chromium-capsicum | tools/grit/grit/scons.py | Python | bsd-3-clause | 7,319 |
import logging
import sys
import threading
from hazelcast.util import AtomicInteger
NONE_RESULT = object()
class Future(object):
_result = None
_exception = None
_traceback = None
_threading_locals = threading.local()
logger = logging.getLogger("Future")
def __init__(self):
self._ca... | LifeDJIK/S.H.I.V.A. | containers/shiva/hazelcast/future.py | Python | mit | 5,507 |
# -*- coding: utf-8 -*-
"""
Django settings for djangotut project.
For more information on this file, see
https://docs.djangoproject.com/en/dev/topics/settings/
For the full list of settings and their values, see
https://docs.djangoproject.com/en/dev/ref/settings/
"""
from __future__ import absolute_import, unicode_l... | henryfjordan/django_beginnings | config/settings/common.py | Python | bsd-3-clause | 10,094 |
from ._base import Descriptor
from ._atomic_property import polarizability78, polarizability94
__all__ = ("APol", "BPol")
class PolarizabilityBase(Descriptor):
__slots__ = ("_use78",)
@classmethod
def preset(cls, version):
yield cls()
def __str__(self):
return self.__class__.__name_... | mordred-descriptor/mordred | mordred/Polarizability.py | Python | bsd-3-clause | 1,565 |
from django.db import models
from django.conf import settings
from django.utils.translation import gettext_lazy as _
from django.utils import timezone
from django.dispatch import Signal
from froide.foirequest.models import FoiMessage
from .utils import inform_user_problem_resolved
USER_PROBLEM_CHOICES = [
("mes... | fin/froide | froide/problem/models.py | Python | mit | 4,057 |
# coding: utf-8
from django.core.cache import caches
from django.utils.translation import ugettext as _
from django_th.models import update_result
import evernote.edam.type.ttypes as Types
from evernote.edam.error.ttypes import EDAMSystemException, EDAMUserException
from evernote.edam.error.ttypes import EDAMErrorCod... | foxmask/django-th | th_evernote/evernote_mgr.py | Python | bsd-3-clause | 6,411 |
from unittest import TestCase
from cycy.parser import ast
class TestNodes(TestCase):
def test_repr(self):
self.assertEqual(repr(ast.Int32(value=42)), "<Int32(value=42)>")
| Magnetic/cycy | cycy/tests/test_ast.py | Python | mit | 186 |
#Reading HST ACS filters
from astropy import units as u, constants as const
from numpy import genfromtxt, asscalar
import pandas as pd
import os
from glob import glob
def read_hst_filter(fname):
"""
Reading the gemini filter file into a dataframe
Parameters
----------
fname: ~str
path to... | wkerzendorf/wsynphot | wsynphot/data/hst/acs/convert_filters.py | Python | bsd-3-clause | 1,562 |
import tensorflow as tf
import datetime
import numpy as np
import zutils.tf_math_funcs as tmf
from zutils.py_utils import *
from scipy.io import savemat
class OneEpochRunner:
def __init__(
self, data_module, output_list=None,
net_func=None, batch_axis=0, num_samples=None, disp_time_interv... | YutingZhang/lmdis-rep | runner/one_epoch_runner.py | Python | apache-2.0 | 4,754 |
import os
import os.path
import random
import recipe_generator
import subprocess
import shutil
#Comparing all recipes, which uses the fewest ingredients? ...kinda hacky
def fewest_ingredients(path):
""" Takes a path and returns the recipe txt file with the fewest ingredients
in the tree specified by that p... | ScriptingBeyondCS/CS-35 | week_0_to_2/tree_analysis/recipe_analysis_examples.py | Python | mit | 4,728 |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
import csv
GEPHI_DELIMITER =';'
DEFAULT_INPUT_DELIMITER = '|'
INPUT_FILE ='tweets_FIXED_NO_DUPLICATES.csv'
def tweets_to_csv(list_csv_lines, filename='tweets_with_geocoordinates.csv'):
with open(filename, 'w', newline='', encoding="utf8") as csvfile:
fi... | ufeslabic/parse-tweets | geotweets.py | Python | mit | 1,529 |
# Copyright (c) 2008, Aldo Cortesi. All rights reserved.
#
# 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,... | de-vri-es/qtile | libqtile/ipc.py | Python | mit | 7,821 |
# -*- coding: utf-8 -*-
# vim: tabstop=4 shiftwidth=4 softtabstop=4
#
# Copyright (C) 2013-2022 GEM Foundation
#
# OpenQuake is free software: you can redistribute it and/or modify it
# under the terms of the GNU Affero General Public License as published
# by the Free Software Foundation, either version 3 of the Licen... | gem/oq-engine | openquake/hazardlib/tests/gsim/shahjouei_pezeshk_2016_test.py | Python | agpl-3.0 | 1,353 |
"""
Copyright 2017-present Airbnb, Inc.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, sof... | airbnb/streamalert | tests/unit/streamalert_cli/terraform/test_alert_processor.py | Python | apache-2.0 | 5,849 |
# -*- coding: utf-8 -*-
#
# This file is part of PyNomo -
# a program to create nomographs with Python (https://github.com/lefakkomies/pynomo)
#
# Copyright (C) 2007-2019 Leif Roschier <lefakkomies@users.sourceforge.net>
#
# This program is free software: you can redistribute it and/or modify
# it unde... | lefakkomies/pynomo | pynomo/nomo_grid_box.py | Python | gpl-3.0 | 28,141 |
"""
Module for working with comparisons between two genomic_signal objects, e.g.,
genome-wide correlation
"""
import sys
import pybedtools
import itertools
import numpy as np
def compare(signal1, signal2, features, outfn, comparefunc=np.subtract,
batchsize=5000, array_kwargs=None, verbose=False):
"""
... | mrGeen/metaseq | metaseq/integration/signal_comparison.py | Python | mit | 4,845 |
"""
This file covers any static information from the EVE data dumps. While
using django-evedb would be a smarter choice, for the limited subset of
data we're using it isn't worth the overhead
"""
from django.db import models
class EVESkill(models.Model):
""" Represents a skill in EVE Online """
name = model... | nikdoof/test-auth | app/eve_api/models/static.py | Python | bsd-3-clause | 1,711 |
# coding=utf-8
# main codes, call functions at stokes_flow.py
# Zhang Ji, 20160410
import sys
import petsc4py
petsc4py.init(sys.argv)
# import warnings
# from memory_profiler import profile
import numpy as np
from src import stokes_flow as sf
# import stokes_flow as sf
from src.stokes_flow import problem_dic, obj_dic... | pcmagic/stokes_flow | sphere/sphere_rs.py | Python | mit | 20,947 |
import pickle
import pytest
from praw.exceptions import ClientException
from praw.models import Comment
from ... import UnitTest
class TestComment(UnitTest):
def test_attribute_error(self):
with pytest.raises(AttributeError):
Comment(self.reddit, _data={"id": "1"}).mark_as_read()
def t... | praw-dev/praw | tests/unit/models/reddit/test_comment.py | Python | bsd-2-clause | 4,341 |
from string import ascii_lowercase
AZ = set(ascii_lowercase)
def is_pangram(string):
""" Thanks to 'hiasen' on CodeWars for the idea of using subset """
return AZ.issubset(set(string.lower()))
# return set(a for a in string.lower() if a.isalpha()) == AZ
| the-zebulan/CodeWars | katas/kyu_6/detect_pangram.py | Python | mit | 269 |
"""
* TexturedCube
* based on pde example by Dave Bollinger.
*
* Drag mouse to rotate cube. Demonstrates use of u/v coords in
* vertex() and effect on texture().
"""
rotx = PI / 4
roty = PI / 4
rate = 0.01
def setup():
size(640, 360, OPENGL)
textureMode(NORMAL)
fill(255)
stroke(color(44, 48, 32... | mashrin/processing.py | examples.py/3D/Textures/TextureCube.py | Python | apache-2.0 | 2,142 |
# 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 ... | daafgo/CourseBuilder-Xapi | modules/balancer/balancer.py | Python | apache-2.0 | 23,226 |
import _plotly_utils.basevalidators
class ArrayminusValidator(_plotly_utils.basevalidators.DataArrayValidator):
def __init__(
self, plotly_name="arrayminus", parent_name="scatter.error_y", **kwargs
):
super(ArrayminusValidator, self).__init__(
plotly_name=plotly_name,
p... | plotly/python-api | packages/python/plotly/plotly/validators/scatter/error_y/_arrayminus.py | Python | mit | 475 |
# experiments in subclassing the ArrayIndexer
#
# this all follows:
#
# https://docs.scipy.org/doc/numpy-1.10.1/user/basics.subclassing.html
#
# current issues: when we do ip_jp(), perhaps we should just return an
# ndarray at that point, since we are going to be inconsistent with the
# grid (the view will have a diffe... | zingale/pyro2 | examples/mesh/experiments/test_subclass.py | Python | bsd-3-clause | 5,576 |
import unittest
import mock
import nose.tools as ntools
from smqtk.algorithms.relevancy_index import \
RelevancyIndex, get_relevancy_index_impls
__author__ = "paul.tunison@kitware.com"
class DummyRI (RelevancyIndex):
@classmethod
def is_usable(cls):
return True
def rank(self, pos, neg):
... | kfieldho/SMQTK | python/smqtk/tests/algorithms/relevancy_index/test_RI_abstract.py | Python | bsd-3-clause | 1,063 |
class BaseFetcher(object):
"""Common functionality for a fetcher"""
def __init__(self, project_base, params):
"""
:type project_base: str
:type params: dict[str, str]
"""
self.project_base = project_base
self.source = params["source"]
# Calcu... | hcpss-banderson/py-tasc | fetchers/basefetcher.py | Python | mit | 663 |
"""
Hier sind alle Parameter und "Magic Numbers" des gesamten Programmes aufgelistet.
Alle Programmteile greifen auf diese Bibliothek zu.
Im Programm selber sollten daher keine scheinbar willkuerlichen Zahlen mehr vorkommen
"""
import socket
import os
import ConfigParser as configparser
"""
___________________________... | Fellfalla/Thermoberry | GlobalVariables.py | Python | gpl-2.0 | 10,872 |
# -*- coding: utf-8 -*-
# Generated by Django 1.10.1 on 2016-12-14 17:04
from __future__ import unicode_literals
from django.db import migrations, models
import django.db.models.deletion
class Migration(migrations.Migration):
dependencies = [
('wechat', '0003_auto_20161208_0004'),
]
operations ... | lin-yue/WeChatConference | wechat/migrations/0004_auto_20161215_0104.py | Python | gpl-3.0 | 5,896 |
# Generated by Django 2.2.24 on 2021-12-03 16:49
from django.db import migrations, models
import django.db.models.deletion
class Migration(migrations.Migration):
dependencies = [
('compilacao', '0015_auto_20200520_2037'),
]
operations = [
migrations.AddField(
model_name='tex... | cmjatai/cmj | sapl/compilacao/migrations/0016_textoarticulado_clone.py | Python | gpl-3.0 | 580 |
# generated from catkin/cmake/template/pkg.context.pc.in
CATKIN_PACKAGE_PREFIX = ""
PROJECT_PKG_CONFIG_INCLUDE_DIRS = "/home/mkhuthir/learnROS/src/chessbot/install/include".split(';') if "/home/mkhuthir/learnROS/src/chessbot/install/include" != "" else []
PROJECT_CATKIN_DEPENDS = "std_msgs".replace(';', ' ')
PKG_CONFIG... | mkhuthir/catkin_ws | src/chessbot/build/nasa_r2_simulator/gazebo_taskboard/catkin_generated/pkg.installspace.context.pc.py | Python | gpl-3.0 | 506 |
#! /usr/bin/env python
# -*- coding: utf8 -*-
from flask import Flask
import json
from flask import abort
from flask import request
from flask import Response
import uuid
import subprocess
import time
import os
from datetime import timedelta
from flask import make_response, request, current_app
from functools import u... | quadnix/hydrogen-cpp | hydrogen/server/app.py | Python | mit | 3,577 |
# Implementation of RAKE - Rapid Automtic Keyword Exraction algorithm
# as described in:
# Rose, S., D. Engel, N. Cramer, and W. Cowley (2010).
# Automatic keyword extraction from indi-vidual documents.
# In M. W. Berry and J. Kogan (Eds.), Text Mining: Applications and Theory.unknown: John Wiley and Sons, Ltd.
import... | tpsatish95/Topic-Modeling-Social-Network-Text-Data | rake/rake.py | Python | apache-2.0 | 6,832 |
# Copyright 2018 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... | nburn42/tensorflow | tensorflow/contrib/distribute/python/one_device_strategy.py | Python | apache-2.0 | 4,931 |
from .text import StixTextTransform
class StixStatsTransform(StixTextTransform):
"""Generate summary statistics for a STIX package.
Prints a count of the number of observables for each object type
contained in the package.
Args:
package: the STIX package to process
separator: a strin... | thisismyrobot/cti-toolkit | certau/transform/stats.py | Python | bsd-3-clause | 1,922 |
"""
All character set and unicode related tests.
"""
from jedi import Project
def test_unicode_script(Script):
s = "import datetime; datetime.timedelta"
completions = Script(s).complete()
assert len(completions)
assert type(completions[0].description) is str
s = "author='öä'; author"
completi... | snakeleon/YouCompleteMe-x64 | third_party/ycmd/third_party/jedi_deps/jedi/test/test_api/test_unicode.py | Python | gpl-3.0 | 2,162 |
"""Contains a baseclass for plugins."""
###############################################################################
#
# TODO: [ ]
#
###############################################################################
# standard library imports
from collections import Iterable
from functools import wraps
import loggin... | Sirs0ri/PersonalAssistant | samantha/plugins/plugin.py | Python | mit | 4,002 |
from django.conf.urls import patterns, url
from . import views
urlpatterns = patterns('',
url(r'^$', views.index, name='comic-index'),
url(r'^recent/$', views.recent, name='comic-recent'),
url(r'^(?P<id>\d+)/$', views.comic, name='comic-start'),
url(r'^(?P<id>\d+)/(?P<page>\d+)/$', views.image, name='... | pv/mediasnake | mediasnakecomics/urls.py | Python | bsd-3-clause | 413 |
"""Set up the package."""
import os
import re
import sys
from codecs import open as codecs_open
from setuptools import setup, find_packages
if sys.version_info < (3, 0):
sys.stderr.write("Python 3.x is required." + os.linesep)
sys.exit(1)
# Get the long description from the relevant file
with codecs_open('RE... | humangeo/preflyt | setup.py | Python | mit | 1,531 |
# -*- encoding: utf-8 -*-
import pygame
import pygameMenu
import os
from scenes import scene, game_scene, intro_scene
from game_logic import tic_tac_toe_board, settings_menu
from game_logic import helper
class SettingsScene(scene.Scene):
""" Settings scene that enables configuring the game """
def __init__(... | juangallostra/TicTacToe | src/scenes/settings_scene.py | Python | mit | 1,552 |
"""
This object contains a list of PolarizedPhoton objects, characterized by energy, direction vector and Stokes vector.
This object is used as input to and output from the passive crystal widget.
"""
from crystalpy.util.Photon import Photon
from crystalpy.diffraction.ComplexAmplitude import ComplexAmplitude
import nu... | edocappelli/crystalpy | crystalpy/util/ComplexAmplitudePhoton.py | Python | mit | 3,555 |
# -*- coding: utf-8 -*-
#
# Copyright © Spyder Project Contributors
# Licensed under the terms of the MIT License
# (see spyder/__init__.py for details)
"""
spyder.widgets.sourcecode
=========================
Source code related widgets (code editor, console) based exclusively on Qt
"""
| bgris/ODL_bgris | lib/python3.5/site-packages/spyder/widgets/sourcecode/__init__.py | Python | gpl-3.0 | 303 |
from flask import Flask
from marshmallow import Schema, fields
import pytest
from webargs.flaskparser import FlaskParser
from ..parser import SchemaParserMixin
class FlaskSchemaParser(SchemaParserMixin, FlaskParser):
pass
flask_schema_parser = FlaskSchemaParser()
use_args = flask_schema_parser.use_args
class... | hartror/webargs-marshmallow | webargs_marshmallow/tests/test_parser.py | Python | mit | 836 |
# Copyright 2014-2015 Ivan Kravets <me@ikravets.com>
#
# 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... | bq/web2board | src/platformio/downloader.py | Python | lgpl-3.0 | 3,540 |
"""
Storage node interfaces.
"""
from __future__ import absolute_import
import os
import re
import io
import codecs
import tempfile
import subprocess as sp
from cStringIO import StringIO
import hashlib
from nodetree import node, writable_node, exceptions
from . import base, util as utilnodes
from .. import stages, ... | vitorio/ocropodium | ocradmin/nodelib/nodes/storage.py | Python | apache-2.0 | 4,143 |
import os
import shlex
import subprocess
from ..args import arg
from ..command import command
from ..result import Result
from ..util import abs_path, flatten_args, printer, StreamOptions
@command
def local(
args: arg(container=list),
background=False,
cd=None,
environ: arg(type=dict) = None,
rep... | wylee/runcommands | src/runcommands/commands/local.py | Python | mit | 4,162 |
"""Test for letsencrypt_apache.dvsni."""
import unittest
import shutil
import mock
from acme import challenges
from letsencrypt.plugins import common
from letsencrypt.plugins import common_test
from letsencrypt_apache.tests import util
class DvsniPerformTest(util.ApacheTest):
"""Test the ApacheDVSNI challenge... | digideskio/lets-encrypt-preview | letsencrypt_apache/tests/dvsni_test.py | Python | apache-2.0 | 4,161 |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
import networkx as nx
import copy
from ryu.base import app_manager
from ryu.controller import ofp_event
from ryu.controller.handler import CONFIG_DISPATCHER, MAIN_DISPATCHER, DEAD_DISPATCHER
from ryu.controller.handler import set_ev_cls
from ryu.ofproto import ofproto_v1_3... | Zouyiran/ryu | ryu/app/chapter_2/pre_install_app.py | Python | apache-2.0 | 12,687 |
# 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 "License");... | iemejia/incubator-beam | sdks/python/apache_beam/examples/snippets/transforms/aggregation/latest.py | Python | apache-2.0 | 3,913 |
#Задача 8. Вариант 7.
#1-50. Доработайте игру "Анаграммы" (см. М.Доусон Программируем на Python. Гл.4) так, чтобы к каждому слову полагалась подсказка. Игрок должен получать право на подсказку в том случае, если у него нет никаких предположений. Разработайте систему начисления очков, по которой бы игроки, отгадавшие с... | Mariaanisimova/pythonintask | PINp/2015/GOLOVIN_A_I/task_8_7.py | Python | apache-2.0 | 1,749 |
# Version control system repository manager.
#
# Author: Peter Odding <peter@peterodding.com>
# Last Change: March 28, 2018
# URL: https://github.com/xolox/python-vcs-repo-mgr
"""Test suite for the `vcs-repo-mgr` package."""
# Standard library modules.
import codecs
import logging
import os
import shutil
import tempf... | xolox/python-vcs-repo-mgr | vcs_repo_mgr/tests.py | Python | mit | 51,145 |
# vim:ts=4:sw=4:et:
# Copyright 2016-present Facebook, Inc.
# Licensed under the Apache License, Version 2.0
# no unicode literals
from __future__ import absolute_import, division, print_function
import json
import os
import pywatchman
import WatchmanInstance
try:
import unittest2 as unittest
except ImportErro... | nodakai/watchman | tests/integration/test_site_spawn.py | Python | apache-2.0 | 2,338 |
# 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... | npuichigo/ttsflow | third_party/tensorflow/tensorflow/contrib/training/python/training/sampling_ops_test.py | Python | apache-2.0 | 14,840 |
class C(object):
def __init__(self): self._x = 1
def getx(self): return self._x
def setx(self, value): self._x = value
def delx(self): del self._x
x = property(getx, setx, delx, "I'm the 'x' property.")
a = C()
print a.x
a.x=2
print a.x
del a.x
print a.x
| gyc0218/tool | statudy/else.py | Python | bsd-2-clause | 278 |
#!/usr/bin/python
# -*- coding: utf-8 -*-
##
# domains.py: module for domains of model outcomes
##
# © 2017, Chris Ferrie (csferrie@gmail.com) and
# Christopher Granade (cgranade@cgranade.com).
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the... | QInfer/python-qinfer | src/qinfer/domains.py | Python | bsd-3-clause | 19,964 |
# import the Bottle framework
from bottle import Bottle
from bottle import static_file
# Create the Bottle WSGI application.
bottle = Bottle()
# Note: We don't need to call run() since our application is embedded within
# the App Engine WSGI application server.
# Define a handler for the root URL of our application.... | jklein24/jeremy-klein | main.py | Python | apache-2.0 | 556 |
from flask import json
from mass_flask_config.app import db
from mongoengine import StringField, DateTimeField, ReferenceField, IntField, ListField, EmbeddedDocument, FileField, EmbeddedDocumentListField, DictField, MapField, GridFSProxy
from .analysis_system import AnalysisSystem
from .sample import Sample
from mass_... | mass-project/mass_server | mass_flask_core/models/report.py | Python | mit | 2,136 |
from django.http import HttpResponse
from django.views.decorators.csrf import csrf_exempt
from django.core.exceptions import ObjectDoesNotExist
from auth.models import YankUser
from base64 import b64encode
from yank_server.helpers import std_response
import os, json, bcrypt
@csrf_exempt
def list_user(request):
"... | yank-team/yank-server | auth/views.py | Python | apache-2.0 | 5,709 |
"""
Masked arrays add-ons.
A collection of utilities for `numpy.ma`.
:author: Pierre Gerard-Marchant
:contact: pierregm_at_uga_dot_edu
:version: $Id: extras.py 3473 2007-10-29 15:18:13Z jarrod.millman $
"""
__all__ = [
'apply_along_axis', 'apply_over_axes', 'atleast_1d', 'atleast_2d',
'atleast_3d', 'average'... | pdebuyl/numpy | numpy/ma/extras.py | Python | bsd-3-clause | 58,264 |
import unittest
class TestExample(unittest.TestCase):
def test_example(self):
self.assertEquals(0, 0)
| ryanpdwyer/newtex | newtex/tests/test_git.py | Python | mit | 116 |
#!/usr/bin/env python
import os
import sys
if __name__ == "__main__":
os.environ.setdefault("DJANGO_SETTINGS_MODULE", "resumeparser.settings")
try:
from django.core.management import execute_from_command_line
except ImportError:
# The above import may fail for some other reason. Ensure that... | jaffyadhav/django-resume-parser | manage.py | Python | unlicense | 810 |
# -*- coding: utf-8 -*-
# YAFF is yet another force-field code.
# Copyright (C) 2011 Toon Verstraelen <Toon.Verstraelen@UGent.be>,
# Louis Vanduyfhuys <Louis.Vanduyfhuys@UGent.be>, Center for Molecular Modeling
# (CMM), Ghent University, Ghent, Belgium; all rights reserved unless otherwise
# stated.
#
# This file is pa... | molmod/yaff | yaff/system.py | Python | gpl-3.0 | 49,918 |
#!/usr/bin/python
# -*- coding: utf-8 -*-
# thumbor imaging service
# https://github.com/thumbor/thumbor/wiki
# Licensed under the MIT license:
# http://www.opensource.org/licenses/mit-license
# Copyright (c) 2011 globo.com thumbor@googlegroups.com
from preggy import expect
from tornado.testing import gen_test
fro... | gi11es/thumbor | tests/filters/test_upscale.py | Python | mit | 3,414 |
'''The citation module.'''
from . import views
| ElvisResearchGroup/DictionaryOfNewZealandEnglish | DictionaryOfNewZealandEnglish/headword/citation/__init__.py | Python | bsd-3-clause | 48 |
# (c) 2013, Bradley Young <young.bradley@gmail.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, either version 3 of the License, or
# (at your option) any later... | dmitry-sobolev/ansible | lib/ansible/plugins/lookup/together.py | Python | gpl-3.0 | 1,804 |
from app import db, bcrypt
ROLE_USER = 0
ROLE_ADMIN = 1
class User(db.Model):
id = db.Column(db.Integer, primary_key = True)
username = db.Column(db.String, index = True, unique = True)
email = db.Column(db.String, index = True, unique = True)
pwdhash = db.Column(db.String)
role = db.Column(db.SmallInteger, defa... | ldcicconi/flask-strap | app/models.py | Python | mit | 819 |
#!/usr/bin/env python
import os
import sys
if __name__ == "__main__":
os.environ.setdefault("DJANGO_SETTINGS_MODULE", "minions.settings")
from django.core.management import execute_from_command_line
execute_from_command_line(sys.argv)
| sixdub/Minions | manage.py | Python | gpl-2.0 | 250 |
"""Retrieves the Source and Destination station pairs for APSRTC buses
"""
import scraperwiki
import lxml.html
base_url = 'http://www.apsrtconline.in/'
sources = dict()
def get_sources():
html = scraperwiki.scrape(base_url)
assert 'APSRTC Official Website' in html
root = lxml.html.fromstring(html)
for... | sramana/rtc-schedule | andhra_source_destination_pairs.py | Python | unlicense | 1,493 |
from django.test import TestCase
from django.utils import six
from ..bin.start_cms_project import (Output, git, make_executable, query_yes_no,
configure_apps, main)
import getpass
try:
from unittest import mock
from unittest.mock import call
except ImportError:
import ... | danielsamuels/cms | cms/tests/test_start_cms_project.py | Python | bsd-3-clause | 12,858 |
# -*- coding: utf-8 -*-
# Copyright 2008-2016 Alex Zaddach (mrzmanwiki@gmail.com)
# This file is part of wikitools.
# wikitools 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,... | Xoristzatziki/pywikitools | wikitools/wiki.py | Python | lgpl-3.0 | 12,298 |
import os
import io
from setuptools import setup
setup(
name='delayed_assert',
version='0.3.2',
description='Delayed/soft assertions for python',
long_description=io.open(os.path.join(os.path.dirname('__file__'), 'README.md'), encoding='utf-8').read(),
long_description_content_type='text/markdown'... | pr4bh4sh/python-delayed-assert | setup.py | Python | unlicense | 441 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.