code stringlengths 1 199k |
|---|
from __future__ import unicode_literals
import frappe, json
from frappe.website.website_generator import WebsiteGenerator
from frappe import _
from frappe.utils.file_manager import save_file, remove_file_by_url
from frappe.website.utils import get_comment_list
class WebForm(WebsiteGenerator):
website = frappe._dict(
... |
"""This script is now only used by the closure_compilation builders."""
import argparse
import glob
import gyp_environment
import os
import shlex
import sys
script_dir = os.path.dirname(os.path.realpath(__file__))
chrome_src = os.path.abspath(os.path.join(script_dir, os.pardir))
sys.path.insert(0, os.path.join(chrome_s... |
import os
<selection>def f(arg):
print(a<caret>rg)
print("a")</selection> |
import logging
from django.conf import settings
from django.core.files.storage import get_storage_class
from mkt.comm import utils_mail
from mkt.constants import comm
from mkt.users.models import UserProfile
log = logging.getLogger('z.comm')
def create_comm_note(app, version, author, body, note_type=comm.NO_ACTION,
... |
import unittest
import pymake.data
import pymake.functions
class VariableRefTest(unittest.TestCase):
def test_get_expansions(self):
e = pymake.data.StringExpansion('FOO', None)
f = pymake.functions.VariableRef(None, e)
exps = list(f.expansions())
self.assertEqual(len(exps), 1)
class ... |
from coalib.bearlib.aspects import Root, AspectTypeError as aspectTypeError
from coalib.bearlib.aspects.meta import isaspect, assert_aspect, issubaspect
import pytest
class AspectClassTest:
def test_subaspect_without_definition(self, RootAspect):
with pytest.raises(TypeError):
@RootAspect.subasp... |
"""Hierarchical Agglomerative Clustering
These routines perform some hierarchical agglomerative clustering of some
input data.
Authors : Vincent Michel, Bertrand Thirion, Alexandre Gramfort,
Gael Varoquaux
License: BSD 3 clause
"""
from heapq import heapify, heappop, heappush, heappushpop
import warnings
impo... |
from stackless import greenlet
import sys
import types
def emulate():
module = types.ModuleType('greenlet')
sys.modules['greenlet'] = module
module.greenlet = greenlet
module.getcurrent = greenlet.getcurrent
module.GreenletExit = greenlet.GreenletExit |
"""
Mock unit tests for the NetApp E-series driver utility module
"""
import six
from cinder import test
from cinder.volume.drivers.netapp.eseries import utils
class NetAppEseriesDriverUtilsTestCase(test.TestCase):
def test_convert_uuid_to_es_fmt(self):
value = 'e67e931a-b2ed-4890-938b-3acc6a517fac'
... |
from allauth.socialaccount.tests import OAuth2TestsMixin
from allauth.tests import MockedResponse, TestCase
from .provider import BitlyProvider
class BitlyTests(OAuth2TestsMixin, TestCase):
provider_id = BitlyProvider.id
def get_mocked_response(self):
return MockedResponse(200, """{
"data": ... |
from kafkatest.services.kafka.directory import kafka_dir
class JmxMixin(object):
"""This mixin helps existing service subclasses start JmxTool on their worker nodes and collect jmx stats.
Note that this is not a service in its own right.
"""
def __init__(self, num_nodes, jmx_object_names=None, jmx_attri... |
import os
import sys
from _pytest import __version__ as version
from _pytest.compat import TYPE_CHECKING
if TYPE_CHECKING:
import sphinx.application
release = ".".join(version.split(".")[:2])
autodoc_member_order = "bysource"
todo_include_todos = 1
extensions = [
"pallets_sphinx_themes",
"pygments_pytest",
... |
from __future__ import unicode_literals
import logging
from django.conf import settings
from django.contrib.gis import gdal
from django.contrib.gis.geos import GEOSException, GEOSGeometry
from django.forms.widgets import Widget
from django.template import loader
from django.utils import six, translation
logger = loggin... |
from wiki.core.plugins import registry as plugin_registry
from wiki.core.plugins.base import BasePlugin
from course_wiki.plugins.markdownedx import mdx_mathjax, mdx_video
class ExtendMarkdownPlugin(BasePlugin):
"""
This plugin simply loads all of the markdown extensions we use in edX.
"""
markdown_exten... |
from neutron.api.v2 import attributes
from neutron.openstack.common import log as logging
LOG = logging.getLogger(__name__)
def get_port_hostid(context, port_id):
# REVISIT(kevinbenton): this is a workaround to avoid portbindings_db
# relational table generation until one of the functions is called.
from ne... |
"""
PostgreSQL database backend for Django.
Requires psycopg 1: http://initd.org/projects/psycopg1
"""
from django.db.backends import *
from django.db.backends.postgresql.client import DatabaseClient
from django.db.backends.postgresql.creation import DatabaseCreation
from django.db.backends.postgresql.introspection imp... |
import unittest
import os
import comm
class TestCrosswalkApptoolsFunctions(unittest.TestCase):
def test_dir_exist(self):
comm.setUp()
os.chdir(comm.XwalkPath)
comm.clear("org.xwalk.test")
os.mkdir("org.xwalk.test")
cmd = comm.HOST_PREFIX + comm.PackTools + \
"cros... |
def transform():
def function1(x):
return x + 5
return function1 |
try:
import pywraps
pywraps_there = True
except:
pywraps_there = False
import _idaapi
import random
import operator
import datetime
if pywraps_there:
_idaapi.appcall = pywraps.appcall
from py_idaapi import *
else:
import idaapi
from idaapi import *
import types
class Appcall_array__(object):... |
"""
Database models for the LTI provider feature.
This app uses migrations. If you make changes to this model, be sure to create
an appropriate migration file and check it in at the same time as your model
changes. To do that,
1. Go to the edx-platform dir
2. ./manage.py lms schemamigration lti_provider --auto "descrip... |
import numpy as np
from PIL import Image
a=np.genfromtxt("a.txt", skip_header=1)
im = Image.fromarray(a, mode="L")
im.save("a.jpg") |
from ..broker import Broker
class InterfaceViewerAclsGridBroker(Broker):
controller = "interface_viewer_acls_grids"
def index(self, **kwargs):
"""Lists the available interface viewer acls grids. Any of the inputs listed may be be used to narrow the list; other inputs will be ignored. Of the various ways... |
from argparse import FileType
import sys
from csvkit import CSVKitWriter
from csvkit import sql
from csvkit.cli import CSVKitUtility
class SQL2CSV(CSVKitUtility):
description = 'Execute an SQL query on a database and output the result to a CSV file.'
override_flags = 'f,b,d,e,H,p,q,S,t,u,z,zero'.split(',')
... |
from functools import wraps
from airflow import configuration as conf
from airflow.lineage.datasets import DataSet
from airflow.utils.log.logging_mixin import LoggingMixin
from airflow.utils.module_loading import import_string, prepare_classpath
from itertools import chain
PIPELINE_OUTLETS = "pipeline_outlets"
PIPELINE... |
import matplotlib.pyplot as plt
import sys
import pandas as pd
def get_parm():
"""retrieves mandatory parameter to program
@param: none
@type: n/a
"""
try:
return sys.argv[1]
except:
print ('Must enter file name as parameter')
exit()
def read_file(filename):
"""reads ... |
import time
def main(request, response):
time.sleep(1.0);
return [("Content-type", "text/javascript")], """
var s = document.getElementById('script0');
s.innerText = 't.unreached_func("This should not be evaluated")();';
""" |
"""
Problem Page.
"""
from bok_choy.page_object import PageObject
class ProblemPage(PageObject):
"""
View of problem page.
"""
url = None
def is_browser_on_page(self):
return self.q(css='.xblock-student_view').present
@property
def problem_name(self):
"""
Return the c... |
from __future__ import absolute_import, division, print_function
__metaclass__ = type
ANSIBLE_METADATA = {
'metadata_version': '1.1',
'status': ['deprecated'],
'supported_by': 'community'
}
DOCUMENTATION = r'''
---
module: vmware_vmkernel_facts
deprecated:
removed_in: '2.13'
why: Deprecated in favour of... |
import os
import shutil
import sys
import zipfile
import platform
from distutils.core import setup
from distutils.sysconfig import get_python_lib
import py2exe
version = __import__('p2pool').__version__
im64 = '64' in platform.architecture()[0]
if os.path.exists('INITBAK'):
os.remove('INITBAK')
os.rename(os.path.jo... |
import Orange
from collections import Counter
data = Orange.data.Table("lenses")
print(Counter(str(d.get_class()) for d in data)) |
from __future__ import print_function
from genEventing import *
from genLttngProvider import *
import os
import xml.dom.minidom as DOM
from utilities import open_for_update, parseExclusionList
stdprolog_cpp = """// Licensed to the .NET Foundation under one or more agreements.
// The .NET Foundation licenses this file ... |
import array
import unittest
import subprocess
import sys
from test import test_support
from java.lang import Byte, Class, Integer
from java.util import ArrayList, Collections, HashMap, LinkedList, Observable, Observer
from org.python.tests import (Coercions, HiddenSuper, InterfaceCombination, Invisible, Matryoshka,
... |
import datetime
import pytz
from django.contrib.auth.decorators import login_required
from django.http import HttpResponse
from django.shortcuts import redirect
from django_future.csrf import ensure_csrf_cookie
from edxmako.shortcuts import render_to_response
from track import tracker
from track import contexts
from tr... |
"""Generate and process code coverage.
TODO(jrg): rename this from coverage_posix.py to coverage_all.py!
Written for and tested on Mac, Linux, and Windows. To use this script
to generate coverage numbers, please run from within a gyp-generated
project.
All platforms, to set up coverage:
cd ...../chromium ; src/tools... |
"""Support for Entropy Ops. See ${python/contrib.bayesflow.entropy}.
@@elbo_ratio
@@entropy_shannon
@@renyi_ratio
@@renyi_alpha
"""
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
import math
from tensorflow.contrib.bayesflow.python.ops import monte_carlo_imp... |
import datetime
import luigi
import luigi.postgres
from luigi.tools.range import RangeDaily
from helpers import unittest
import mock
def datetime_to_epoch(dt):
td = dt - datetime.datetime(1970, 1, 1)
return td.days * 86400 + td.seconds + td.microseconds / 1E6
class MockPostgresCursor(mock.Mock):
"""
Kee... |
from test import CollectorTestCase
from test import get_collector_config
from test import unittest
from mock import Mock
from mock import patch
try:
from cStringIO import StringIO
except ImportError:
from StringIO import StringIO
from diamond.collector import Collector
from cpu import CPUCollector
class TestCPU... |
import argparse
import sys
import matplotlib
import matplotlib.pyplot as plt
from matplotlib.gridspec import GridSpec
import numpy as np
import json
parser = argparse.ArgumentParser(description="Does some awesome things.")
parser.add_argument('message', type=str, help="pass a message into the script")
args = parser.par... |
""" discovery and running of std-library "unittest" style tests. """
from __future__ import absolute_import, division, print_function
import sys
import traceback
import _pytest._code
from _pytest.config import hookimpl
from _pytest.outcomes import fail, skip, xfail
from _pytest.python import transfer_markers, Class, Mo... |
from __future__ import unicode_literals
from datetime import datetime
import unittest
from django.core.paginator import (Paginator, EmptyPage, InvalidPage,
PageNotAnInteger)
from django.test import TestCase
from django.utils import six
from .models import Article
from .custom import ValidAdjacentNumsPaginator
class... |
from __future__ import unicode_literals
from datetime import datetime
from django.test import TestCase
from .models import Article, Person, IndexErrorArticle
class EarliestOrLatestTests(TestCase):
"""Tests for the earliest() and latest() objects methods"""
def tearDown(self):
"""Makes sure Article has a... |
import inc_const as const
PJSUA = ["--null-audio --extra-audio --max-calls=1 $SIPP_URI"]
PJSUA_EXPECTS = [[0, const.MEDIA_HOLD, "H"]] |
"""
urllib3 - Thread-safe connection pooling and re-using.
"""
from __future__ import absolute_import
import warnings
from .connectionpool import (
HTTPConnectionPool,
HTTPSConnectionPool,
connection_from_url
)
from . import exceptions
from .filepost import encode_multipart_formdata
from .poolmanager import... |
import os
import BaseHTTPServer
import CGIHTTPServer
os.chdir(os.path.dirname(os.path.dirname(os.path.realpath(__file__))))
class Handler(CGIHTTPServer.CGIHTTPRequestHandler):
cgi_directories = ['/php']
BaseHTTPServer.HTTPServer(('', 8080), Handler).serve_forever() |
class OCRoute(OpenShiftCLI):
''' Class to wrap the oc command line tools '''
kind = 'route'
def __init__(self,
config,
verbose=False):
''' Constructor for OCVolume '''
super(OCRoute, self).__init__(config.namespace, kubeconfig=config.kubeconfig, verbose=verb... |
import hr
import res_users
import res_partner |
import os,sys,imp,types
from waflib import Utils,Configure,Options,Logs,Errors
from waflib.Tools import fc
fc_compiler={'win32':['gfortran','ifort'],'darwin':['gfortran','g95','ifort'],'linux':['gfortran','g95','ifort'],'java':['gfortran','g95','ifort'],'default':['gfortran'],'aix':['gfortran']}
def __list_possible_com... |
import logging
LOGGING_LEVEL = {'0': logging.ERROR, '1': logging.WARNING, '2': logging.DEBUG}
def create_handler(verbosity, message='%(message)s'):
"""
Create a handler which can output logged messages to the console (the log
level output depends on the verbosity level).
"""
handler = logging.Stream... |
from __future__ import absolute_import
import os
import re
from pip._vendor.six.moves.urllib import parse as urllib_parse
from pip.download import get_file_content
from pip.req.req_install import InstallRequirement
from pip.utils import normalize_name
_scheme_re = re.compile(r'^(http|https|file):', re.I)
def _remove_pr... |
"""Unit tests for aggregator module."""
import unittest2 as unittest
from nupic.data import aggregator
class AggregatorTest(unittest.TestCase):
"""Unit tests for misc. aggregator functions."""
def testFixAggregationDict(self):
# Simplest case.
result = aggregator._aggr_weighted_mean((1.0, 1.0), (1, 1))
... |
"""Append module search paths for third-party packages to sys.path.
****************************************************************
* This module is automatically imported during initialization. *
****************************************************************
In earlier versions of Python (up to 1.5a3), scripts or m... |
from __future__ import absolute_import, division, print_function
__metaclass__ = type
ANSIBLE_METADATA = {'metadata_version': '1.1',
'status': ['preview'],
'supported_by': 'certified'}
DOCUMENTATION = r'''
---
module: bigip_firewall_dos_profile
short_description: Manage AFM DoS p... |
"""Tests for letshelp.letshelp_letsencrypt_apache.py"""
import argparse
import functools
import os
import pkg_resources
import subprocess
import tarfile
import tempfile
import unittest
import mock
import letshelp_letsencrypt.apache as letshelp_le_apache
_PARTIAL_CONF_PATH = os.path.join("mods-available", "ssl.load")
_P... |
from __future__ import unicode_literals
import re
from .common import InfoExtractor
from .adobepass import AdobePassIE
from .theplatform import ThePlatformIE
from ..utils import (
smuggle_url,
url_basename,
update_url_query,
get_element_by_class,
)
class NationalGeographicVideoIE(InfoExtractor):
IE_... |
"""Exceptions used by the Cisco plugin."""
from neutron.common import exceptions
class NetworkSegmentIDNotFound(exceptions.NeutronException):
"""Segmentation ID for network is not found."""
message = _("Segmentation ID for network %(net_id)s is not found.")
class NoMoreNics(exceptions.NeutronException):
"""... |
import contextlib
import datetime
import mock
from oslo_config import cfg
from oslo_utils import timeutils
from oslo_vmware.objects import datastore as ds_obj
from nova import objects
from nova import test
from nova.tests.unit import fake_instance
from nova.tests.unit.virt.vmwareapi import fake
from nova.virt.vmwareapi... |
''' Verifies that builds of the embedded content_shell do not included
unnecessary dependencies.'''
import os
import re
import string
import subprocess
import sys
import optparse
kUndesiredLibraryList = [
'libX11',
'libXau',
'libXcomposite',
'libXcursor',
'libXdamage',
'libXdmcp',
'libXext',
'libXfixes'... |
"""
The By implementation.
"""
class By(object):
"""
Set of supported locator strategies.
"""
ID = "id"
XPATH = "xpath"
LINK_TEXT = "link text"
PARTIAL_LINK_TEXT = "partial link text"
NAME = "name"
TAG_NAME = "tag name"
CLASS_NAME = "class name"
CSS_SELECTOR = "css selector"
... |
import sys, os
if os.name == "nt":
def _get_build_version():
"""Return the version of MSVC that was used to build Python.
For Python 2.3 and up, the version number is included in
sys.version. For earlier versions, assume the compiler is MSVC 6.
"""
# This function was copied... |
from Screen import Screen
from Components.ActionMap import ActionMap
from Components.Harddisk import harddiskmanager
from Components.MenuList import MenuList
from Components.Label import Label
from Components.Pixmap import Pixmap
from Screens.MessageBox import MessageBox
class HarddiskSetup(Screen):
def __init__(self,... |
import unittest
from google.appengine.ext import testbed
from google.appengine.ext import ndb
class CursorTests(unittest.TestCase):
def setUp(self):
self.testbed = testbed.Testbed()
self.testbed.activate()
self.testbed.init_datastore_v3_stub()
self.testbed.init_memcache_stub()
de... |
"""
NETCONF definitions used by ryu/lib/of_config.
"""
import os.path
SCHEMA_DIR = os.path.dirname(__file__)
NETCONF_XSD = os.path.join(SCHEMA_DIR, 'netconf.xsd') |
STDOUT = -11
STDERR = -12
try:
from ctypes import windll
from ctypes import wintypes
except ImportError:
windll = None
SetConsoleTextAttribute = lambda *_: None
else:
from ctypes import (
byref, Structure, c_char, c_short, c_int, c_uint32, c_ushort, c_void_p, POINTER
)
class CONSOLE_... |
import unittest
from ctypes import *
import _ctypes_test
class CFunctions(unittest.TestCase):
_dll = CDLL(_ctypes_test.__file__)
def S(self):
return c_longlong.in_dll(self._dll, "last_tf_arg_s").value
def U(self):
return c_ulonglong.in_dll(self._dll, "last_tf_arg_u").value
def test_byte(... |
import os
from gppylib.commands.base import ExecutionError
from gppylib.operations.test.regress.test_package import GppkgTestCase, GppkgSpec, RPMSpec, unittest, run_command
class SingleDependenciesTestCase(GppkgTestCase):
"""Covers install/update/remove tests of gppkgs which have a single dependency"""
def setU... |
from openerp.osv import fields, osv
import openerp.addons.decimal_precision as dp
class mrp_product_produce(osv.osv_memory):
_name = "mrp.product.produce"
_description = "Product Produce"
_columns = {
'product_qty': fields.float('Select Quantity', digits_compute=dp.get_precision('Product Unit of Mea... |
"""
Test cases for the repr module
Nick Mathewson
"""
import sys
import os
import shutil
import unittest
from test.support import run_unittest
from reprlib import repr as r # Don't shadow builtin repr
from reprlib import Repr
from reprlib import recursive_repr
def nestedTuple(nesting):
t = ()
for i in range... |
"""
Package containing all pip commands
"""
from pip.commands.bundle import BundleCommand
from pip.commands.completion import CompletionCommand
from pip.commands.freeze import FreezeCommand
from pip.commands.help import HelpCommand
from pip.commands.list import ListCommand
from pip.commands.search import SearchCommand
... |
"""Utility functions to perform Xcode-style build steps.
These functions are executed via gyp-mac-tool when using the Makefile generator.
"""
import fcntl
import json
import os
import plistlib
import re
import shutil
import string
import subprocess
import sys
def main(args):
executor = MacTool()
exit_code = executo... |
"""
Verifies that action input/output filenames with spaces are rejected.
"""
import TestGyp
test = TestGyp.TestGyp(formats=['android'])
stderr = ('gyp: Action input filename "name with spaces" in target do_actions '
'contains a space\n')
test.run_gyp('space_filenames.gyp', status=1, stderr=stderr)
test.pass_... |
from .. import util
from . import util as import_util
import importlib._bootstrap
import sys
from types import MethodType
import unittest
import warnings
class CallingOrder:
"""Calls to the importers on sys.meta_path happen in order that they are
specified in the sequence, starting with the first importer
[... |
"""Unit tests for the copy module."""
import copy
import copyreg
import weakref
import abc
from operator import le, lt, ge, gt, eq, ne
import unittest
from test import support
order_comparisons = le, lt, ge, gt
equality_comparisons = eq, ne
comparisons = order_comparisons + equality_comparisons
class TestCopy(unittest.... |
import re
from idlelib.configHandler import idleConf
class FormatParagraph:
menudefs = [
('format', [ # /s/edit/format dscherer@cmu.edu
('Format Paragraph', '<<format-paragraph>>'),
])
]
def __init__(self, editwin):
self.editwin = editwin
def close(self):
... |
import cython
cython.declare(Nodes=object, ExprNodes=object, EncodedString=object,
BytesLiteral=object, StringEncoding=object,
FileSourceDescriptor=object, lookup_unicodechar=object,
Future=object, Options=object, error=object, warning=object,
Builtin=object, ... |
if __name__ == '__main__':
import sys
import os
pkg_dir = (os.path.split(
os.path.split(
os.path.split(
os.path.abspath(__file__))[0])[0])[0])
parent_dir, pkg_name = os.path.split(pkg_dir)
is_pygame_pkg = (pkg_name == 'tests' and
... |
"""
WSGI config for mysite project.
It exposes the WSGI callable as a module-level variable named ``application``.
For more information on this file, see
https://docs.djangoproject.com/en/1.10/howto/deployment/wsgi/
"""
import os
from django.core.wsgi import get_wsgi_application
os.environ.setdefault("DJANGO_SETTINGS_M... |
"""Abstract base classes related to import."""
from . import _bootstrap
from . import machinery
try:
import _frozen_importlib
except ImportError as exc:
if exc.name != '_frozen_importlib':
raise
_frozen_importlib = None
import abc
def _register(abstract_cls, *classes):
for cls in classes:
... |
"""Unit testing base class for Port implementations."""
import unittest2 as unittest
from webkitpy.port.server_process_mock import MockServerProcess
from webkitpy.port.image_diff import ImageDiffer
class FakePort(object):
def __init__(self, server_process_output):
self._server_process_constructor = lambda p... |
import os
import sys
def get_list_from_file(file_path, list_name):
'''Looks for a Python list called list_name in the file specified
by file_path and returns it.
If the file or list name aren't found, this function will return
an empty list.
'''
list = []
# Read in the file if it exists.
... |
from mod_pywebsocket import common, msgutil, util
from mod_pywebsocket.handshake import hybi
def web_socket_do_extra_handshake(request):
request.connection.write('HTTP/1.1 101 Switching Protocols:\x0D\x0AConnection: Upgrade\x0D\x0AUpgrade: WebSocket\x0D\x0ASec-WebSocket-Protocol: foobar\x0D\x0ASec-WebSocket-Origin:... |
import math
import time
import heapq
import mars_math
class PathNotFound(Exception):
pass
def A_star(start, goal, successors, edge_cost, heuristic_cost_to_goal=lambda position, goal:0):
"""Very general a-star search. Start and goal are objects to be compared
with the 'is' operator, successors is a function that... |
from pygame import draw
import traceback
import pygame
from pygame import key
from pygame.locals import K_LEFT, K_RIGHT, K_TAB, K_c, K_v, K_x, SCRAP_TEXT, K_UP, K_DOWN, K_RALT, K_LALT, \
K_BACKSPACE, K_DELETE, KMOD_SHIFT, KMOD_CTRL, KMOD_ALT, KMOD_META, K_HOME, K_END, K_z, K_y, K_KP2, K_KP1
from widget import Widge... |
from dashboard.models import Commit, Project
from dashboard.util import force_url_paths, avoid_duplicate_queries
from django.contrib.auth.models import User
from django.core.paginator import Paginator
from django.core.urlresolvers import reverse
from django.http import Http404, HttpResponseRedirect
from django.template... |
from __future__ import print_function
import csv
import datetime
import os
import sys
sys.path.insert(0, os.path.abspath(__file__+'../../../..'))
import lob
lob.api_key = 'YOUR_API_KEY'
if len(sys.argv) < 2:
print("Please provide an input CSV file as an argument.")
print("usage: python verify.py <CSV_FILE>")
... |
import sure
from django.test import TestCase
from tasks.const import STATUS_SUCCESS, STATUS_FAILED
from ..testem import testem_violation
from .base import get_content
class TestemViolationCase(TestCase):
"""Testem violation case"""
def test_success(self):
"""Test success result"""
data = {
... |
"""Version information for PyBEL-Tools."""
__all__ = [
'VERSION',
'get_version',
]
VERSION = '0.9.2-dev'
def get_version() -> str:
"""Get the current PyBEL Tools version."""
return VERSION |
import os
import sys
sys.path.insert(0, os.path.abspath('..'))
import phuzzy
extensions = ['sphinx.ext.autodoc',
'sphinx.ext.viewcode',
'sphinx.ext.imgmath',
# 'sphinx.ext.graphviz',
'sphinx.ext.inheritance_diagram',
'sphinx.ext.doctest',
... |
"""
Version: 1.0
Last modified on: 17 November, 2014
Developers: Eduardo Nobre Luis, Fabricio Olivetti de Franca.
email: eduardo_(DOT)_luis_(AT)_aluno_(DOT)_ufabc_(DOT)_edu_(DOT)_br
: folivetti_(AT)_ufabc_(DOT)_edu_(DOT)_br
Based on source-code by Michael G. Epitropakis and Xiaodong Li
available at http:... |
import os
import sys
sys.path.append(os.path.join(os.path.dirname(__file__), '../tools'))
import files
import graphs
def main(argv):
adjacency = files.read_lines(argv[0])
edges = graphs.edges_from_adjacency_list(adjacency)
path = graphs.eulerian_cycle(edges[0][0], edges)
print '->'.join(path)
i... |
from key_events import *
import os
os.nice(40)
pos = position()
for x in range(1000):
#time.sleep(.25)
mouseclick(*pos) |
import re
from scrapy import log
from scrapy.http import Request
from scrapy.selector import Selector
from source import Source
from FourmiCrawler.items import Result
class NIST(Source):
"""
NIST Scraper plugin
This plugin manages searching for a chemical on the NIST website
and parsing the resulting pa... |
from __future__ import unicode_literals
from django.db import migrations, models
import image_cropping.fields
class Migration(migrations.Migration):
dependencies = [
('markets', '0063_auto_20170824_1444'),
]
operations = [
migrations.AlterField(
model_name='market',
n... |
'''Tests about our caching policies.'''
import unittest
import mock
from reppy.cache import policy
class TestCachePolicyBase(unittest.TestCase):
'''Tests about CachePolicyBase.'''
def test_exception_not_implemented(self):
'''Does not implement the exception method.'''
with self.assertRaises(NotI... |
import glob
import os
__all__ = []
modules_folder = os.path.dirname(os.path.abspath(__file__))
py_files = glob.glob(modules_folder + '/*.py')
py_files.remove(os.path.abspath(__file__).replace('.pyc', '.py'))
for py_file in py_files:
py_file = py_file.replace('\\', '/')
py_file = './' + '/'.join(py_file.split('/... |
from dotmailer import Folder, connection
class ImageFolder(Folder):
end_point = '/v2/image-folders'
# Create is defined by the parent class "Folder"
# Get all is defined by the parent class "Folder"
@classmethod
def get_by_id(cls, id):
response = connection.get(
'{}/{}'.format(cl... |
from django.conf.urls import url
from core import views
urlpatterns =[
url('^$',views.home,name="home"),
] |
from sqlalchemy import create_engine, func
from sqlalchemy.orm import sessionmaker
from sqlalchemy import Sequence
from sqlalchemy import Column, DateTime, Integer, String, Unicode
from datetime import datetime
from mabolab.database.dbsession import Base
from mabolab.database.model import ColumnMixin
class PrinterConfi... |
import webbrowser
import sublime, sublime_plugin
import sys
if sys.version_info < (3, 0):
from urllib import quote as quote_param
else:
from urllib.parse import quote_plus as quote_param
def search(q):
settings = sublime.load_settings("google_search.sublime-settings")
# Attach the suffix and the prefix
... |
from flask import Flask, jsonify, render_template, request
from flask.ext.assets import Environment, Bundle
from threading import Thread
from io import StringIO
import csv
app = Flask(__name__)
assets=Environment(app)
css = Bundle(
Bundle('assets/surface_styles.scss',
filters='scss'),
Bundle('custom.css... |
from copy import deepcopy
from django.contrib import admin
from mezzanine.blog.admin import BlogPostAdmin
from .models import Episode
fields = ('short_description', 'cover_image', 'episode_link', 'length', 'cover_image_square')
episode_extra_fieldsets = [(None, {'fields': fields})]
class EpisodeAdmin(BlogPostAdmin):
... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.