code stringlengths 3 1.05M | repo_name stringlengths 5 104 | path stringlengths 4 251 | language stringclasses 1
value | license stringclasses 15
values | size int64 3 1.05M |
|---|---|---|---|---|---|
from rest_framework import status
from rest_framework.test import APITestCase
from sigma_core.models.user import User
from sigma_core.models.group import Group
from sigma_core.models.group_field import GroupField
from sigma_core.models.group_member import GroupMember
from sigma_core.models.group_field_value import Gro... | SRLKilling/sigma-backend | data-server/django_app/sigma_core/tests/test_group_field_value.py | Python | agpl-3.0 | 13,831 |
"""
Django settings for resty project.
Generated by 'django-admin startproject' using Django 1.8.4.
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 ... | alexdzul/propiedades | resty/settings.py | Python | mit | 2,763 |
# -*- coding: utf-8 -*-
import json
import requests
try:
from thrift.protocol import fastbinary
except:
fastbinary = None
class url(object):
LINE_HOST_DOMAIN = 'https://gd2.line.naver.jp'
LINE_NOMA_DOMAIN = 'https://gf.line.naver.jp'
LINE_SECO_DOMAIN = 'https://gsx.line.naver.jp'
LINE_AUTH_QU... | didim354/Bot | LineAlpha/LineApi/LineServer.py | Python | gpl-3.0 | 1,701 |
# Copyright (C) 2015-2022 by the RBniCS authors
#
# This file is part of RBniCS.
#
# SPDX-License-Identifier: LGPL-3.0-or-later
import os
import sys
import collections
from numpy import exp, isnan, log, max, mean, min, nan, zeros as Content
from rbnics.utils.io.csv_io import CSVIO
from rbnics.utils.io.folders import F... | mathLab/RBniCS | rbnics/utils/io/performance_table.py | Python | lgpl-3.0 | 12,306 |
import pytest
from mock import Mock
from spacy.matcher import Matcher
from spacy.tokens import Doc, Token, Span
from ..doc.test_underscore import clean_underscore # noqa: F401
@pytest.fixture
def matcher(en_vocab):
rules = {
"JS": [[{"ORTH": "JavaScript"}]],
"GoogleNow": [[{"ORTH": "Google"}, {"... | spacy-io/spaCy | spacy/tests/matcher/test_matcher_api.py | Python | mit | 17,725 |
from plotly.basedatatypes import BaseLayoutHierarchyType as _BaseLayoutHierarchyType
import copy as _copy
class Tickfont(_BaseLayoutHierarchyType):
# class properties
# --------------------
_parent_path_str = "layout.xaxis"
_path_str = "layout.xaxis.tickfont"
_valid_props = {"color", "family", "s... | plotly/python-api | packages/python/plotly/plotly/graph_objs/layout/xaxis/_tickfont.py | Python | mit | 8,438 |
from lxml import etree
import sys
data = open(sys.argv[1],'r').read()
doc = etree.XML(data,etree.XMLParser(remove_blank_text=True))
for parent in doc.xpath('//*[./*]'): # Search for parent elements
parent[:] = sorted(parent,key=lambda x: x.get("name"))
print etree.tostring(doc,pretty_print=True) | CG-F16-24-Rutgers/steersuite-rutgers | steerstats/tools/sortXMLOnAttribute.py | Python | gpl-3.0 | 301 |
# Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file
# for details. All rights reserved. Use of this source code is governed by a
# BSD-style license that can be found in the LICENSE file.
import gfm
from test_case import TestCase
class TestSemiSaneLists(TestCase):
def setUp(self):
... | googlearchive/py-gfm | tests/test_semi_sane_lists.py | Python | bsd-3-clause | 977 |
# -*- 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.erpnext_integrations.doctype.plaid_settings.plaid_settings import plaid_configuration, add_account_type, add_account_subtype,... | gsnbng/erpnext | erpnext/erpnext_integrations/doctype/plaid_settings/test_plaid_settings.py | Python | agpl-3.0 | 4,706 |
# vim: ts=4:sw=4:expandtabs
__author__ = 'zach.mott@gmail.com'
from django.db import models
from django.utils.encoding import python_2_unicode_compatible
from django.utils.translation import ugettext_lazy as _
from email_utils.tasks import send_mail
RESEND_EMAIL_PERMISSION = 'can_resend_email'
@python_2_unicode_c... | E7ernal/quizwhiz | email_utils/models/EmailMessage.py | Python | mit | 1,404 |
#!/usr/bin/env python
import os, sys, gzip, glob, re, jobs
def find_files(count = 1):
successfiles = []
for inputsize in jobs.inputsizes:
for ncores in jobs.ncores:
gtype = '%s-%s' % (inputsize, ncores)
globpath = '/home/tcarlson/prog/benchmarks/results/output-instrumented/elvis1-performance/*%s' ... | trevorcarlson/barrierpoint | weight_reuse_distances.py | Python | mit | 3,739 |
from numpy import *
from scipy import *
from Metadata import *
class Boxel: #this is how a boxel is represented
def __init__(self, x, y, z, size, isFull, metadata):
self.x=x
self.y=y
self.z=z
self.size=size
self.metadata=metadata
self.isFull=isFull #a boolean
class B... | mp5-io/MP5-Project | Boxels/src/Boxels.py | Python | gpl-3.0 | 2,796 |
# Copyright (c) 2015 SUSE Linux GmbH. 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 la... | SUSE/azurectl | azurectl/config/parser.py | Python | apache-2.0 | 9,291 |
# -*- coding: utf-8 -*-
#
# Copyright SHS-AV s.r.l. <http://www.zeroincombenze.org>)
#
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl).
#
# All Rights Reserved
#
"""Clodoo core functions
"""
from __future__ import division
from __future__ import absolute_import
from __future__ import print_function
fr... | zeroincombenze/tools | clodoo/clodoocore.py | Python | agpl-3.0 | 52,723 |
class RosterMixin(object):
def __init__(self, *args, **kwargs):
import logging
logging.critical(
"RosterMixin has been moved to the hipchat backend.\n" +
"Please change all your imports to `from will.backends.io_adapters.hipchat import HipChatRosterMixin`"
)
... | mike-love/will | will/mixins/roster.py | Python | mit | 371 |
from capstone.game.games import TicTacToe
from capstone.game.players import AlphaBeta, RandPlayer
from capstone.game.utils import play_series
game = TicTacToe()
players = [AlphaBeta(), RandPlayer()]
print('Players: {}\n'.format(players))
n_matches = 10
play_series(game, players, n_matches)
players.reverse()
print('\nP... | davidrobles/mlnd-capstone-code | experiments/play_series_alphabeta_vs_random.py | Python | mit | 389 |
from .predicate import Predicate
class Equality(Predicate):
def __init__(self):
super().__init__('=', 2)
| jadnohra/connect | proto_2/ddq/fol/equality.py | Python | unlicense | 119 |
input = """
c(2).
p(1).
a(2).
d(2,2,1).
okay(X):- c(X), #count{V:a(V),d(V,X,1)} = 1.
ouch(X):- p(X), #count{V:a(V),d(V,X,1)} = 1.
"""
output = """
c(2).
p(1).
a(2).
d(2,2,1).
okay(X):- c(X), #count{V:a(V),d(V,X,1)} = 1.
ouch(X):- p(X), #count{V:a(V),d(V,X,1)} = 1.
"""
| veltri/DLV2 | tests/parser/aggregates.count.boundvariables.1.test.py | Python | apache-2.0 | 269 |
# Copyright 2013 Google Inc. All Rights Reserved.
#
# This file is part of astroid.
#
# logilab-astng 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
# opt... | si618/pi-time | node_modules/grunt-pylint/tasks/lib/astroid/tests/unittest_brain.py | Python | gpl-3.0 | 18,053 |
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the... | coreycb/horizon | openstack_dashboard/dashboards/project/stacks/resource_types/tables.py | Python | apache-2.0 | 1,101 |
# -*- coding: utf-8 -*-
# Copyright © 2014-2016 Digital Catapult and The Copyright Hub Foundation
# (together the Open Permissions Platform Coalition)
#
# 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 Found... | openpermissions/accounts-srv | accounts/controllers/roles_handler.py | Python | gpl-3.0 | 1,354 |
# -*- coding=utf-8 -*-
from __future__ import absolute_import, print_function, unicode_literals
def remove(project=None, only="default", packages=[], clean=True):
from passa.models.lockers import PinReuseLocker
from passa.operations.lock import lock
default = (only != "dev")
develop = (only != "defa... | kennethreitz/pipenv | pipenv/vendor/passa/actions/remove.py | Python | mit | 946 |
from __future__ import print_function
import os
import unittest
import warnings
import numpy as np
warnings.simplefilter('always')
np.seterr(all='raise')
import pyNastran
from pyNastran.converters.aflr2.aflr2 import read_bedge
from pyNastran.gui.testing_methods import GUIMethods
from pyNastran.converters.aflr2.bedge_... | saullocastro/pyNastran | pyNastran/converters/aflr2/test_bedge_gui.py | Python | lgpl-3.0 | 912 |
#!/usr/bin/env python3
from datetime import date
from mathmodeling import misc, google, wikipedia
from scipy.interpolate import interp1d
from scipy.integrate import quad as integ
from sys import argv, stdout
import subprocess, os, os.path
def search_data(row):
return (float(row[0]), float(row[1]))
def article_data(... | Undeterminant/math-modeling | accum-data.py | Python | cc0-1.0 | 4,502 |
import numpy as np
from scipy.signal import firwin, kaiserord, convolve2d, decimate
#from matplotlib import pyplot as plt
# DEFINE FILTERS FOR PREPROCESSING:
def preprocess_multichannel_data(matrix,params):
"""
:param matrix: multichannel EEG data
:param fs: sampling frequency
:return: data without ma... | vincentadam87/gatsby-hackathon-seizure | code/python/seizures/preprocessing/preprocessing.py | Python | bsd-2-clause | 4,687 |
# Create your views here.
from django.shortcuts import render
from django.shortcuts import redirect
from django.http import HttpResponse
from django.contrib.auth import authenticate, login, logout
from django.contrib.auth.decorators import login_required
from django.shortcuts import render_to_response
from django.templ... | vaibhawvipul/WikipediaForBlinds | livecode/helpgit/views.py | Python | gpl-2.0 | 4,214 |
#! /usr/bin/env python
import xml.etree.ElementTree as ET
import shutil
import sys
import os
from PyQt5 import QtCore, QtGui, QtWidgets
class PackItemModel(object):
def __init__(self):
self.item_id = None
self.name = ""
self.page = ""
self.desc = ""
self.data = None
class... | OpenNingia/l5r-character-manager-3 | tools/scripts/bookinfo2.py | Python | gpl-3.0 | 6,292 |
from argparse import ArgumentParser
from typing import Any
from zerver.lib.actions import do_change_user_delivery_email
from zerver.lib.management import ZulipBaseCommand
class Command(ZulipBaseCommand):
help = """Change the email address for a user."""
def add_arguments(self, parser: ArgumentParser) -> Non... | timabbott/zulip | zerver/management/commands/change_user_email.py | Python | apache-2.0 | 922 |
from config import config, ConfigSubsection, ConfigSlider, ConfigYesNo, ConfigNothing
from enigma import eDBoxLCD
from Components.SystemInfo import SystemInfo
# [ iqteam
import fcntl
# iqteam ]
class LCD:
def __init__(self):
pass
def setBright(self, value):
value *= 255
value /= 10
if value > 255:
value ... | pli3/enigma2-git | lib/python/Components/Lcd.py | Python | gpl-2.0 | 2,860 |
#
# 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"); you may not us... | hvanhovell/spark | python/pyspark/pandas/plot/matplotlib.py | Python | apache-2.0 | 30,172 |
from sketch_components.utils import js_represent
class Prop(object):
def __init__(self, value, is_literal=False):
self.value = value
self.is_literal = is_literal
def __repr__(self):
if self.is_literal:
return "{%s}" % str(self.value)
return "{%s}" % self.represent(... | ibhubs/sketch-components | sketch_components/engines/react/base/props.py | Python | mit | 466 |
# Copyright 2013-2015 ARM Limited
#
# 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 w... | freedomtan/workload-automation | wlauto/workloads/andebench/__init__.py | Python | apache-2.0 | 3,485 |
# Copyright 2012 United States Government as represented by the
# Administrator of the National Aeronautics and Space Administration.
# All Rights Reserved.
#
# Copyright 2012 Nebula, Inc.
#
# Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance with the... | yjxtogo/horizon | openstack_dashboard/test/helpers.py | Python | apache-2.0 | 24,322 |
"""Wallet-Cashier URL Configuration
The `urlpatterns` list routes URLs to views. For more information please see:
https://docs.djangoproject.com/en/1.9/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')
Cl... | TrumanZCM/ChurchFinance | cashier/urls.py | Python | apache-2.0 | 1,401 |
# -*- coding: utf-8 -*-
# Testing facet-sphere interaction.
# A facet is rotated around Z axis. Test pass, if a sphere at (0,0) position is not moving (because in this case no transfer moment from the facet to the sphere), but a sphere at facet's edge moves with the facet (for this sphere blocked the rotation DOFs in... | sjl767/woo | scripts/test-OLD/facet-sphere-ViscElBasic.py | Python | gpl-2.0 | 1,562 |
#coding=utf-8
import urllib
from HTMLParser import HTMLParser
# create a subclass and override the handler methods
class PriceHTMLParser(HTMLParser):
def handle_starttag(self, tag, attrs):
for attr in attrs:
print " attr:", attr
print "Encountered a start tag:", tag
def handle_endtag... | jackycheng/fang-analytics | price.py | Python | mit | 604 |
# -*- coding: utf-8 -*-
from __future__ import (absolute_import, division, print_function)
__metaclass__ = type
sample_load = '''
---
mesos:
box: fp/centos7
master:
instances: 3
memory: 256
ansible_groups:
- zookeeper
- mesos-master
slave:
instances: 2
memory: 256
ansible_gr... | fabriziopandini/vagrant-playbook | vagrantplaybook/tests/playbook/sample/load.py | Python | mit | 1,150 |
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('browser', '0002_auto_20151118_1403'),
]
operations = [
migrations.AddField(
model_name='jobs',
name=... | MRCIEU/melodi | browser/migrations/0003_jobs_job_name.py | Python | mit | 453 |
# -*- coding: utf-8 -*-
# Generated by Django 1.9 on 2016-12-15 19:36
from __future__ import unicode_literals
from django.conf import settings
from django.db import migrations, models
import django.db.models.deletion
import osf.models.base
import osf.utils.datetime_aware_jsonfield
class Migration(migrations.Migratio... | monikagrabowska/osf.io | addons/figshare/migrations/0001_initial.py | Python | apache-2.0 | 2,651 |
# -*- coding: utf-8 -*-
import logging
import os
from lxml import etree
from pytrainer.lib.xmlUtils import XMLParser
from pytrainer.gui.dialogs import fileChooserDialog, guiFlush
from pytrainer.core.activity import Activity
from sqlalchemy.orm import exc
class garminFIT():
def __init__(self, parent = None, validate=... | pytrainer/pytrainer | plugins/garmin-fit/garmin-fit.py | Python | gpl-2.0 | 3,975 |
#!/usr/bin/env python2
# -*- coding: utf-8 -*-
"""
script: bivariate-analysis.py
This script follows univariate-analysis-2.py.
In this script we show how to load/compute bivariate analysis, where
cross correlations are computed between couple of observables (of similar
type)
"""
from __future__ import print_function... | LeBarbouze/tunacell | scripts/bivariate-analysis.py | Python | mit | 10,874 |
#!C:\Users\yinanf\Dropbox\nctreehole\venv\Scripts\python.exe
# EASY-INSTALL-ENTRY-SCRIPT: 'distribute==0.6.34','console_scripts','easy_install-2.7'
__requires__ = 'distribute==0.6.34'
import sys
from pkg_resources import load_entry_point
if __name__ == '__main__':
sys.exit(
load_entry_point('distri... | yinanfang/nctreehole | nctreehole/venv/Scripts/easy_install-2.7-script.py | Python | gpl-3.0 | 384 |
"""
:Copyright: 2006-2021 Jochen Kupperschmidt
:License: Revised BSD (see `LICENSE` file for details)
"""
from decimal import Decimal
from byceps.database import generate_uuid
from byceps.services.shop.article.transfer.models import (
Article,
ArticleNumber,
ArticleID,
ArticleNumber,
ArticleType,
... | homeworkprod/byceps | tests/unit/services/shop/cart/test_cart_repr.py | Python | bsd-3-clause | 1,558 |
#!/usr/bin/env python
from MAPI import *
from MAPI.Util import *
import sys
def check_input():
if len(sys.argv) < 2:
sys.exit('Usage: %s username' % sys.argv[0])
def reset_settings():
s = OpenECSession(sys.argv[1], '', 'file:///var/run/zarafa')
st = GetDefaultStore(s)
PR_... | robertwbrandt/zarafa | zarafa-tools/webaccess/reset_webaccess_settings.py | Python | gpl-2.0 | 1,039 |
import MDAnalysis
from MDAnalysis.analysis import rms
from MDAnalysis.analysis.align import *
from collections import defaultdict
from timeit import default_timer as timer
class RMSF_measurements(object):
"""Measures RMSF of ligand atoms over a single trajectory."""
def __init__(self,topology_data_object, top... | ldomic/lintools | lintools/analysis/rmsf.py | Python | gpl-3.0 | 2,077 |
# -*- coding: utf-8 -*-
#+---------------------------------------------------------------------------+
#| 01001110 01100101 01110100 01111010 01101111 01100010 |
#| |
#| Netzob : Inferring communication protocol... | lootr/netzob | netzob/src/netzob/Model/Vocabulary/Messages/L2NetworkMessage.py | Python | gpl-3.0 | 4,639 |
# Copyright: Luis Pedro Coelho <luis@luispedro.org>, 2012-2018
# License: MIT
import numpy as np
def read_roi(fileobj):
'''
points = read_roi(fileobj)
Read ImageJ's ROI format
Parameters
----------
fileobj: should be a file-like object
Returns
-------
points: a list of points
... | luispedro/imread | imread/ijrois.py | Python | mit | 3,061 |
from typing import Dict, List, Optional
from idgames.game import Game
INT_TO_GAME: Dict[int, Game] = {
0: Game.DOOM,
1: Game.DOOM2,
2: Game.TNT,
3: Game.PLUTONIA,
4: Game.HERETIC,
5: Game.HEXEN,
6: Game.STRIFE,
7: Game.CHEX,
8: Game.HACX,
}
GAME_TO_INT: Dict[Game, int] = {
Ga... | GitExl/DoomIdgamesArchive | idgames-extract/src/idgames/entry.py | Python | bsd-2-clause | 1,722 |
# -*- coding: utf-8 -*-
from django.contrib import admin
from models import FileMapping
# Register your models here.
admin.site.register(FileMapping)
| tiankangkan/paper_plane | treasure/admin.py | Python | gpl-3.0 | 155 |
# -*- encoding: utf-8 -*-
from __future__ import unicode_literals
import sys, os
if sys.version_info[0] < 3:
from Queue import Empty
else:
from queue import Empty
from multiprocessing import Process, Queue
class ExceptionItem(object):
def __init__(self, exception):
self.exception = exception
cla... | wetneb/multiprocessing_generator | multiprocessing_generator/__init__.py | Python | mit | 3,447 |
# Copyright 2015 Palo Alto Networks, 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 agre... | PaloAltoNetworks/minemeld-core | minemeld/ft/local.py | Python | apache-2.0 | 4,022 |
from django.db.models import Q
import snotes20.models as models
import osf
def find_or_create_osf_tag(short):
try:
return models.OSFTag.objects.get(Q(short=short) | Q(name=short))
except models.OSFTag.DoesNotExist:
tag = models.OSFTag(name=short)
tag.save()
return tag
def a... | shownotes/snotes20-restapi | snotes20/contenttypes/osf.py | Python | agpl-3.0 | 1,396 |
#encoding:utf-8
subreddit = 'thehatedone'
t_channel = '@r_thehatedone'
def send_post(submission, r2t):
return r2t.send_simple(submission)
| Fillll/reddit2telegram | reddit2telegram/channels/~inactive/r_thehatedone/app.py | Python | mit | 145 |
# Copyright (c) 2013 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.
import logging
import time
class TimeProfile:
"""Class for simple profiling of action, with logging of cost."""
def __init__(self, description='op... | ric2b/Vivaldi-browser | chromium/build/android/pylib/utils/time_profile.py | Python | bsd-3-clause | 1,141 |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
import cmd
from .plugins import Plugins
class Console(cmd.Cmd):
prompt = "WebHardening> "
_colors = {'red': '#FF0000',
'white': '#FFFFFF',
'black': '#000000'}
def __init__ (self):
"""Constructor"""
cmd... | elcodigok/WebHardening | core/api/console.py | Python | gpl-3.0 | 1,818 |
import pathlib
import pytest
import meshio
from . import helpers
test_set = [
# helpers.empty_mesh,
helpers.tet_mesh
]
@pytest.mark.parametrize("mesh", test_set)
def test(mesh, tmp_path):
helpers.write_read(
tmp_path,
meshio.tetgen.write,
meshio.tetgen.read,
mesh,
... | nschloe/meshio | tests/test_tetgen.py | Python | mit | 804 |
import click
from globus_cli.login_manager import LoginManager
from globus_cli.parsing import IdentityType, command
from globus_cli.termio import FORMAT_TEXT_TABLE, formatted_print, is_verbose
from globus_cli.utils import CLIStubResponse
@command(
"get-identities",
short_help="Lookup Globus Auth Identities",... | globus/globus-cli | src/globus_cli/commands/get_identities.py | Python | apache-2.0 | 3,647 |
from __future__ import division
import json
import os.path
from nflgame import OrderedDict
import nflgame.seq
import nflgame.statmap
_player_json_file = os.path.join(os.path.dirname(__file__), 'players.json')
def _create_players(jsonf=None):
"""
Creates a dict of Player objects from the players.json file, ... | icebluesun/nflgame | nflgame/player.py | Python | unlicense | 11,285 |
'''Simple require framework to ensure certain packages are loaded
'''
from __future__ import absolute_import
from __future__ import with_statement
import sys
import re
import os
from contextlib import contextmanager
from .filepath import FilePath, DirPath
from .ctxsingleton import CtxSingleton
from .symbol import S... | matthagy/Jamenson | jamenson/runtime/require.py | Python | apache-2.0 | 1,592 |
import unittest
from unittest import mock
import tethys_apps
from tethys_apps.apps import TethysAppsConfig
class TestApps(unittest.TestCase):
def setUp(self):
pass
def tearDown(self):
pass
def test_TethysAppsConfig(self):
self.assertEqual('tethys_apps', TethysAppsConfig.name)
... | CI-WATER/tethys | tests/unit_tests/test_tethys_apps/test_apps.py | Python | bsd-2-clause | 670 |
#
# 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"); you may not us... | pferrel/PredictionIO | examples/scala-parallel-similarproduct/no-set-user/data/send_query.py | Python | apache-2.0 | 990 |
#!/usr/bin/python3
"""
Copyright (c) 2016-2018 - o2r project
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 ... | o2r-project/o2r-shipper | shipper.py | Python | apache-2.0 | 35,917 |
from .peer import (
pypeer_eye_masking,
pypeer_zscore,
pypeer_ravel_data,
motion_scrub,
prep_for_pypeer
)
__all__ = [
'pypeer_eye_masking',
'pypeer_zscore',
'pypeer_ravel_data',
'motion_scrub',
'prep_for_pypeer'
] | FCP-INDI/C-PAC | CPAC/pypeer/__init__.py | Python | bsd-3-clause | 254 |
"""
General functions for HTML manipulation, backported from Py3.
Note that this uses Python 2.7 code with the corresponding Python 3
module names and locations.
"""
from __future__ import unicode_literals
_escape_map = {ord('&'): '&', ord('<'): '<', ord('>'): '>'}
_escape_map_full = {ord('&'): '&', or... | thonkify/thonkify | src/lib/future/backports/html/__init__.py | Python | mit | 924 |
from helper import unittest, PillowTestCase, hopper
import io
from PIL import Image
# sample ppm stream
TEST_ICO_FILE = "Tests/images/hopper.ico"
TEST_DATA = open(TEST_ICO_FILE, "rb").read()
class TestFileIco(PillowTestCase):
def test_sanity(self):
im = Image.open(TEST_ICO_FILE)
im.load()
... | 1upon0/rfid-auth-system | GUI/printer/Pillow-2.7.0/Tests/test_file_ico.py | Python | apache-2.0 | 1,402 |
# Copyright (c) Facebook, Inc. and its affiliates.
#
# This software may be used and distributed according to the terms of the
# GNU General Public License version 2.
# support: fastannotate support for hgweb, and filectx
from __future__ import absolute_import
from edenscm.mercurial import context as hgcontext, exte... | facebookexperimental/eden | eden/hg-server/edenscm/hgext/fastannotate/support.py | Python | gpl-2.0 | 4,656 |
def WebIDLTest(parser, harness):
parser.parse("""
[Global]
interface Foo : Bar {
getter any(DOMString name);
};
interface Bar {};
""")
results = parser.finish()
harness.ok(results[0].isOnGlobalProtoChain(),
"[Global] interface should be on global's proto ... | danlrobertson/servo | components/script/dom/bindings/codegen/parser/tests/test_global_extended_attr.py | Python | mpl-2.0 | 2,534 |
#!/usr/bin/python
# -*- coding: utf-8 -*-
"""A stupid message compiler for C++."""
import os.path
import re
import struct
def truncateLong(x):
"""Returns the uint32 part of a long x."""
assert x > 0
unsigned_bytes = struct.pack("<Q", x)
return struct.unpack("<I", unsigned_bytes[:4])[0]
def reinterp... | apavlo/h-store | src/dtxn/stupidcompiler.py | Python | gpl-3.0 | 20,928 |
# -*- coding: utf-8 -*-
import unittest
import os
import tempfile
import numpy
from tables import *
from tables.tests import common
from tables.tests.common import allequal
# To delete the internal attributes automagically
unittest.TestCase.tearDown = common.cleanup
class BasicTestCase(unittest.TestCase):
# D... | cpcloud/PyTables | tables/tests/test_carray.py | Python | bsd-3-clause | 82,028 |
from multiprocessing.dummy import Pool
import logging
import os
import threading
import urllib2
TARGET = "target"
PATH = "/tmp/save/"
URL = "http://image-net.org/api/text/imagenet.synset.geturls?wnid="
POOLSIZE = 128
TIMEOUT = 44
logging.basicConfig(filename = "download.log", filemode = "a", format = '%(asctime)s %(le... | Brilliant/ImageNet-Downloader | main.py | Python | mit | 1,588 |
from logbook import Logger
from ..core.local import get_current_conf
from ..core.connection import autoccontext
from .. import db
from datetime import timedelta, datetime
log = Logger(__name__)
def del_inactive_queries():
conf = get_current_conf()
with autoccontext(commit=True) as conn:
before = db.... | Answeror/torabot | torabot/tasks/delete.py | Python | mit | 1,277 |
# -*- coding: utf-8 -*-
'''
header_reader
This module will read and parse PDB header records
'''
'''
SASSIE: Copyright (C) 2011 Joseph E. Curtis, Ph.D.
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 S... | madscatt/zazzie_1.5 | trunk/sassie/build/pdbscan/header_reader.py | Python | gpl-3.0 | 33,239 |
# -*- coding: utf-8 -*-
#!/usr/bin/env python
import os
import os.path
import csv
import codecs
import string
import random
from glob import glob
from datetime import datetime, time
import django.core.management
import alcide.settings
django.core.management.setup_environ(alcide.settings)
from alcide.ressources.model... | ZTH1970/alcide | scripts/import_types_actes.py | Python | agpl-3.0 | 1,917 |
try:
# installed by bootstrap.py
import sqla_plugin_base as plugin_base
except ImportError:
# assume we're a package, use traditional import
from . import plugin_base
import argparse
import collections
from functools import update_wrapper
import inspect
import itertools
import operator
import os
import... | monetate/sqlalchemy | lib/sqlalchemy/testing/plugin/pytestplugin.py | Python | mit | 25,560 |
# -*- coding: utf-8 -*-
"""
Created on Sun Nov 29 01:54:01 2015
@author: Zlati
"""
from distutils.core import setup
from setuptools import find_packages
setup(name='pyportfolio',
version='0.0.1',
description='Package for online/offline portfolio optimisation',
url="https://github.com/zlatiadam/PyPo... | zlatiadam/PyPortfolio | setup.py | Python | gpl-2.0 | 771 |
from nose.tools import assert_equal
from nose.tools import assert_is
from nose.tools import assert_not_equal
from nose.tools import assert_raises
from nose.tools import assert_true
from nose.tools import raises
import networkx
class BaseGraphTester(object):
""" Tests for data-structure independent graph class fe... | NvanAdrichem/networkx | networkx/classes/tests/test_graph.py | Python | bsd-3-clause | 23,512 |
#! /usr/bin/env python
# -*- coding: utf-8 -*-
###############################################################################
## ##
## Copyright 2010-2012, Neil Wallace <neil@openmolar.com> ##
## ... | rowinggolfer/openmolar2 | src/lib_openmolar/admin/db_orm/admin_treatment_fills.py | Python | gpl-3.0 | 2,596 |
from django.conf.urls import re_path
from django.contrib import admin
from .media_library.views import VideoFormView
urlpatterns = [
re_path(r'^admin/', admin.site.urls),
re_path(r'^$', VideoFormView.as_view()),
]
| escaped/django-video-encoding | test_proj/urls.py | Python | bsd-3-clause | 224 |
# This Source Code Form is subject to the terms of the Mozilla Public
# License, v. 2.0. If a copy of the MPL was not distributed with this
# file, You can obtain one at https://mozilla.org/MPL/2.0/.
# Copyright (c) 2014 Mozilla Corporation
import hjson
import os
from binascii import b2a_hex
import boto3
import dateti... | jeffbryner/MozDef | alerts/actions/dashboard_geomodel.py | Python | mpl-2.0 | 4,861 |
# 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"); you may not u... | craimbert/mesos | src/cli_new/tests/main.py | Python | apache-2.0 | 1,058 |
import hashlib
from django.db import models
from django.conf import settings
from openid.store.interface import OpenIDStore
import openid.store
from openid.association import Association as OIDAssociation
import time, base64
class Nonce(models.Model):
server_url = models.CharField(max_length=255)
timestamp = ... | fgirault/smeuhsocial | apps/django_openid/models.py | Python | mit | 4,459 |
from Elements.G.Populators.Base.IElementPopulator import IElementPopulator
class OneEntryForTemplateWithNamePopulator(IElementPopulator):
def __init__(self, sectionName, templates, settingsObject):
super(OneEntryForTemplateWithNamePopulator, self).__init__(sectionName, templates, settingsObject)
self.mainName = s... | afronski/grammar-generator | grammar-generator/Elements/G/Populators/OneEntryForTemplateWithNamePopulator.py | Python | mit | 1,044 |
def stringToNGrams(s, n=3):
d = dict()
for i in range(len(s)):
for j in range(n):
sub_str = s[i:i+j+1]
if sub_str in d:
d[sub_str] += 1
else:
d[sub_str] = 1
return d
def findChineseText(line):
import re
ret... | mewturn/Python | ngram_gen.py | Python | mit | 1,025 |
from flask import Flask, render_template, request, redirect, Response, session
from config import Config as cfg
import requests
import json
app = Flask(__name__, template_folder="templates")
app.debug = True
app.secret_key = cfg.SECRET_KEY
@app.route('/products', methods=['GET'])
def products():
""" Get a stores... | johnpaulhayes/shopify_app_development_tutorials | tutoral_3_using_access_token.py | Python | unlicense | 2,388 |
#!/usr/bin/python
# -*- 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 3 of the License, or
# (at your option) any later version.
#
# This progra... | 0vercl0k/rp | src/third_party/beaengine/tests/0f41.py | Python | mit | 2,850 |
#!/usr/bin/env python3
# written by sqall
# twitter: https://twitter.com/sqall01
# blog: https://h4des.org
# github: https://github.com/sqall01
#
# Licensed under the GNU Affero General Public License, version 3.
from .client import ServerCommunication, ConnectionWatchdog, Receiver
from .manager import ManagerEventHa... | sqall01/alertR | managerClientTemplate/lib/__init__.py | Python | agpl-3.0 | 556 |
import os
import sys
try:
from setuptools import setup
except ImportError:
from distutils.core import setup
if sys.argv[-1] == 'publish':
os.system('python setup.py register')
os.system('python setup.py sdist upload')
sys.exit()
setup(
name="Confopy",
version="0.4.11",
url="https://g... | ooz/Confopy | setup.py | Python | mit | 1,303 |
# (c) 2013, Michael DeHaan <michael.dehaan@gmail.com>
# Stephen Fromm <sfromm@gmail.com>
# Brian Coca <briancoca+dev@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... | bezhermoso/home | lib/ansible/runner/action_plugins/assemble.py | Python | gpl-3.0 | 4,340 |
import tempfile
import shutil
import jedi
collect_ignore = ["setup.py"]
# The following hooks (pytest_configure, pytest_unconfigure) are used
# to modify `jedi.settings.cache_directory` because `clean_jedi_cache`
# has no effect during doctests. Without these hooks, doctests uses
# user's cache (e.g., ~/.cache/je... | SamuelDSR/YouCompleteMe-Win7-GVIM | third_party/jedi/conftest.py | Python | gpl-3.0 | 1,070 |
# Home_Weather_Display.py
#
# This is an project for using the Grove RGB LCD Display and the Grove DHT Sensor from the GrovePi starter kit
#
# In this project, the Temperature and humidity from the DHT sensor is printed on the RGB-LCD Display
#
#
# Note the dht_sensor_type below may need to be changed depending on whi... | karan259/GrovePi | Projects/Home_Weather_Display/Home_Weather_Display.py | Python | mit | 2,370 |
# -*- coding: utf-8 -*-
# Copyright 2013 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 requi... | zhaochao/fuel-web | nailgun/nailgun/test/unit/test_notification_handler.py | Python | apache-2.0 | 3,983 |
#coding:utf-8
from service.service import Service
from dao.database import Database
from repository.task import TaskRepository
from repository.project import ProjectRepository
class TopDisplayService(Service):
def __init__(self):
pass
def execute(self):
db = Database()
task_repo = Task... | dev1x-org/python-example | lib/service/top/display.py | Python | mit | 511 |
# This Source Code Form is subject to the terms of the Mozilla Public
# License, v. 2.0. If a copy of the MPL was not distributed with this
# file, you can obtain one at http://mozilla.org/MPL/2.0/.
import json
import os
from string import Template
from uuid import uuid4
import pytest
from moztelemetry.store import I... | whd/python_moztelemetry | tests/test_spark.py | Python | mpl-2.0 | 5,208 |
from PyPDF2 import PdfFileReader, PdfFileWriter
from rect import Rect
from rect.packer import pack
from reportlab.lib import pagesizes
from reportlab.lib.units import mm
__version__ = "0.1.0"
class PDFPagePacker(object):
def __init__(self, pdf_file, canvas_size=pagesizes.A4, padding=5 * mm):
super(PDFPag... | beyond-content/python-pdf-paper-saver | src/pdfpapersaver/__init__.py | Python | bsd-2-clause | 2,516 |
"""Views for REST APIs for moderators"""
from django.conf import settings
from rest_framework import status
from rest_framework.generics import ListCreateAPIView
from rest_framework.response import Response
from rest_framework.views import APIView
from channels.api import Api
from channels.serializers.moderators impor... | mitodl/open-discussions | channels/views/moderators.py | Python | bsd-3-clause | 2,829 |
"""
Miscellaneous.
"""
__author__ = "Steven Kearnes"
__copyright__ = "Copyright 2014, Stanford University"
__license__ = "3-clause BSD"
from rdkit import Chem
class PicklableMol(Chem.Mol):
"""
RDKit Mol that preserves molecule properties when pickling.
This class is similar to the PropertyMol class in ... | rbharath/vs-utils | vs_utils/utils/rdkit_utils/__init__.py | Python | gpl-3.0 | 2,324 |
#!/usr/bin/env python
import os
from setuptools import find_packages, setup
ENCODING = 'utf-8'
PACKAGE_NAME = 'postpy'
local_directory = os.path.abspath(os.path.dirname(__file__))
version_path = os.path.join(local_directory, PACKAGE_NAME, '_version.py')
version_ns = {}
with open(version_path, 'r', encoding=ENCODING... | portfoliome/postpy | setup.py | Python | mit | 1,504 |
from PyQt5.QtXml import (
QDomAttr,
QDomCDATASection,
QDomCharacterData,
QDomComment,
QDomDocument,
QDomDocumentFragment,
QDomDocumentType,
QDomElement,
QDomEntity,
QDomEntityReference,
QDomImplementation,
QDomNamedNodeMap,
QDomNode,
QDomNodeList,
QDomNotation... | ales-erjavec/anyqt | AnyQt/_backport/QtXml.py | Python | gpl-3.0 | 673 |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
# @author: Elivis.Zhang <elivis.zhang@aliyun.com>
# QQ Group:99798703
# Created on Aug 8, 2015
# -*- coding: utf-8 -*-
from django.template import RequestContext
from django.http import HttpResponseRedirect
from django.shortcuts import render_to_response, get_obje... | Elivis/opsa-master | message/views.py | Python | gpl-2.0 | 2,512 |
__author__ = 'marcusmorgenstern'
__mail__ = ''
import os
import unittest
from os.path import join
from pyfluka.reader.GeometryReader import GeometryReader
_basedir = os.path.dirname(__file__)
class TestGeometryReader(unittest.TestCase):
def setUp(self):
self.geo_file = join(_basedir, "test_data/testGeo... | morgenst/pyfluka | tests/TestGeometryReader.py | Python | mit | 527 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.