text
stringlengths
17
737k
# -*- coding: utf-8 -*- ''' :codeauthor: :email:`Rupesh Tare <rupesht@saltstack.com>` ''' # Import Python libs from __future__ import absolute_import, print_function, unicode_literals # Import Salt Testing Libs from tests.support.mixins import LoaderModuleMockMixin from tests.support.unit import TestCase, skipIf ...
from ctypes import * import os.path import subprocess # Load libhapy hapy = cdll.LoadLibrary("./libhapy.so") # Set libhapy typeinfo hapy.retrieveInt.restype = c_int hapy.retrieveBool.restype = lambda i: False if i is 0 else True #TODO: not working, must debug hapy.retrieveDouble.restype = c_double hapy.retrieveString...
# -*- coding: utf-8 -*- # This coding header is significant for tests, as the debug view is parsing # files to search for such a header to decode the source file content from __future__ import unicode_literals import inspect import os import re import shutil import sys from tempfile import NamedTemporaryFile, mkdtemp,...
"""Symplate, the Simple pYthon teMPLATE renderer. See README.md or https://github.com/benhoyt/symplate for documentation. """ from __future__ import with_statement import os import sys __version__ = '0.9' def html_filter(s): """Escape special HTML/XML characters in given ASCII or unicode string (this is ...
#!/usr/local/bin/python3 from concurrent.futures import ProcessPoolExecutor from collections import OrderedDict from argparse import ArgumentParser from datetime import datetime from bs4 import BeautifulSoup import xmltodict import functools import itertools import requests import hashlib import time import json impor...
#!/usr/bin/env python import os import shutil from test.utils import AbstractCatkinWorkspaceTest, MOCK_DIR, \ MAKE_CMD, succeed, assert_exists, fail class MockTest(AbstractCatkinWorkspaceTest): """ This test case uses workspaces with catkin projects from the test/mock_resources folder. """ #...
from litex.soc.cores import uart from litex.soc.cores.uart.bridge import UARTWishboneBridge from litedram.frontend.bist import LiteDRAMBISTGenerator, LiteDRAMBISTChecker, LiteDRAMBISTCheckerScope from litescope import LiteScopeAnalyzer from litescope import LiteScopeIO from targets.utils import csr_map_update from t...
from __future__ import division, print_function class Namespace(object): '''A simple class to hold the keys and aruments found from the input file. This is a copy-and-paste job from the argparse module. ''' def __init__(self, **kwargs): for name in kwargs: setattr(self, name, kwar...
from regparser import utils from regparser.grammar.internal_citations import regtext_citation from regparser.tree.appendix import carving, generic from regparser.tree.paragraph import ParagraphParser from regparser.tree.struct import Node import string parParser = ParagraphParser(r"\(%s\)", Node.APPENDIX) def trees_...
from __future__ import absolute_import from __future__ import division from __future__ import print_function from collections import namedtuple from collections import OrderedDict from io import BytesIO import gzip import os from dogpile.cache import make_region from dogpile.cache.util import sha1_mangle_key from fla...
#!/usr/bin/env python """Generate jobs for rendering tiles in pyramid and list format in JSON format Usage: generate_jobs.py pyramid <x> <y> <z> --job-zoom=<job-zoom> generate_jobs.py list <list_file> --batch-size=<batch_size> generate_jobs.py (-h | --help) generate_jobs.py --version Options: -h --help ...
import logging import os import sys import re from urllib2 import urlopen import warnings fileopen = open # we need os.path.relpath, which isn't in python<2.6 try: os.path.relpath except: # this function is taken directly from posixpath.py in 2.6 # os.path added to abspath, commonprefix, curdir, pardir, se...
"""Provides the repository macro to import TFRT.""" load("//third_party:repo.bzl", "tf_http_archive", "tf_mirror_urls") def repo(): """Imports TFRT.""" # Attention: tools parse and update these lines. TFRT_COMMIT = "70fd50d6812fc60deea853cf306339af928454d3" TFRT_SHA256 = "b3b84e906639dc3ca7ff32a55d90...
"""Provides the repository macro to import TFRT.""" load("//third_party:repo.bzl", "tf_http_archive", "tf_mirror_urls") def repo(): """Imports TFRT.""" # Attention: tools parse and update these lines. TFRT_COMMIT = "953d83119005075b9bc59d040389c209208263d5" TFRT_SHA256 = "886d069e632515ede00ae79b3a6d...
#!/usr/bin/env python ''' Tiger ''' import json import os import subprocess from collections import OrderedDict from tasks.base_tasks import (ColumnsTask, TempTableTask, TableTask, TagsTask, Carto2TempTableTask, LoadPostgresFromURL, SimplifiedTempTableTask) from tasks.util import classpa...
from __future__ import unicode_literals from django.db import models from django.db.models.signals import post_save from django.contrib.auth.models import User from django.utils.encoding import python_2_unicode_compatible from django.utils.translation import ugettext_lazy as _ from jsonfield import JSONField @pytho...
# -*- coding: utf-8 -*- # # Copyright (c) 2012 Paul Brossier <piem@piem.org> # This file is part of TimeSide. # TimeSide 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 # ...
load("@io_bazel_rules_go//go:def.bzl", "go_binary", "go_context", "go_path", "go_rule") load("@io_bazel_rules_go//go/private:providers.bzl", "GoLibrary", "GoPath") _MOCKGEN_TOOL = "@com_github_golang_mock//mockgen" _MOCKGEN_MODEL_LIB = "@com_github_golang_mock//mockgen/model:go_default_library" def _gomock_source_imp...
from __future__ import absolute_import, division, print_function from math import ceil from operator import getitem import os from threading import Lock import pandas as pd import numpy as np from toolz import merge from ...base import tokenize from ...compatibility import unicode, PY3 from ... import array as da fr...
#!/usr/bin/env python # Copyright (c) 2012 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. """Makes sure that all files contain proper licensing information.""" import optparse import os.path import subprocess import sys...
# -*- coding: UTF-8 -*- # Copyright 2009-2016 Luc Saffre. # License: BSD, see LICENSE for more details. """Defines the :class:`Site` class. For an overview see :doc:`/dev/site` and :doc:`/dev/plugins` . .. This document is part of the Lino test suite. You can test only this document using:: $ python setu...
import os import shutil class Document: PDF_EXTENSION = '.pdf' LOG_EXTENSION = '.log' SEPARATOR = '/' NEWLINE = '\n' ERROR = ' !' WARMING = 'Warning' def __init__(self, name, path): self.path = path self.pdf = name + self.PDF_EXTENSION self.log = name + self.LOG_...
## Copyright 2010-2012 Luc Saffre ## This file is part of the Lino project. ## Lino 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....
# Copyright (c) 2001-2014, Canal TP and/or its affiliates. All rights reserved. # # This file is part of Navitia, # the software to build cool stuff with public transport. # # Hope you'll enjoy and contribute to this project, # powered by Canal TP (www.canaltp.fr). # Help us simplify mobility and open public tr...
import os,re from waflib import Task,Errors,Node,TaskGen,Configure,Node def configure(conf): conf.load('brick_general') """This function gets called by waf upon loading of this module in a configure method""" if not conf.env.BRICK_LOGFILES: conf.env.BRICK_LOGFILES = './logfiles' conf.env['PLANAHEAD'] = 'planAhe...
""" PGP Harvard data extraction. Copyright (C) 2015 PersonalGenomes.org This software is shared under the "MIT License" license (aka "Expat License"), see LICENSE.TXT for full license text. May be used on the command line from this project's base directory, e.g. python -m sources.pgp hu43860C files ...assembles...
# Copyright 2008-2015 Nokia Networks # Copyright 2016- Robot Framework Foundation # # 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 ...
#!/usr/bin/env python ### # Copyright (c) 2002, Jeremiah Fincher # All rights reserved. # # Redistribution and use in source and binary forms, with or without # modification, are permitted provided that the following conditions are met: # # * Redistributions of source code must retain the above copyright notice, # ...
from collections import deque import datetime import os import re import sys from django.core.exceptions import ImproperlyConfigured from django.db import models from django.conf import settings from south import exceptions from south.migration.utils import depends, dfs, flatten, get_app_name from south.orm import Fa...
# -*- coding: utf-8 -*- from irc3.compat import asyncio from irc3 import utils from collections import defaultdict import functools import venusian import fnmatch import logging import docopt import shlex import irc3 import sys import re __doc__ = ''' ========================================== :mod:`irc3.plugins.comman...
import os from email.utils import parseaddr from configurations import Configuration, values import dj_database_url ugettext = lambda s: s class Base(Configuration): """ The are correct settings that are primarily targeted at the production system but allow (where appriate) easy overrides either via s...
#!/usr/bin/python3 ################################################################################ # hs.py - Hokie Stalker # Query the Virginia Tech people search service for information about a person. # Licensed under the ISC License. # # https://github.com/mutantmonkey/hokiestalker # author: mutantmonkey <mutantmon...
"""Decorator module Author: Michele Simionato E-mail: michele.simionato@gmail.com Version: 0.7 License: Python license For more details, see: http://www.phyast.pitt.edu/~micheles/python/documentation.html """ __all__ = ["decorator", "newfunc", "getinfo"] import inspect, new, itertools,...
import json import json.scanner import math import re from functools import partial import arrow import dateutil from .exc import ( ExpectedBracket, ExpectedDelimiter, ExpectedKey, ExpectedValue, ExtraneousData, UnexpectedToken, UnknownToken, UnmatchedBracket, ) from .obj import JSONOb...
from enum import IntEnum from ..dzn import dict2dzn, dzn2dict from queue import Queue class Status(IntEnum): COMPLETE = 0 INCOMPLETE = 1 UNKNOWN = 2 UNSATISFIABLE = 3 UNBOUNDED = 4 UNSATorUNBOUNDED = 5 ERROR = 6 class Solutions: """Represents a solution stream from the `minizinc` f...
from pprint import pprint from django.core.exceptions import ValidationError from django.db import models from django.utils import timezone from django.utils.text import slugify from django.contrib.auth.models import User from utils.classes import LoggedInUser class EquipeAtendimento(models.Model): nome = model...
import random HANGMANPICS = [''' +---+ | | | | | | =========''', ''' +---+ | | O | | | | =========''', ''' +---+ | | O | | | | | =========''', ''' +---+ | | O | /| | | | ====...
# Copyright 2019 Ram Rachum and collaborators. # This program is distributed under the MIT license. import inspect import sys import re import collections import datetime as datetime_module import itertools import threading from .variables import CommonVariable, Exploding, BaseVariable from .third_party import six, d...
# -*- coding: utf-8 -*- # This file is part of the OpenSYMORO project. Please see # https://github.com/symoro/symoro/blob/master/LICENCE for the licence. """ This module contains the functions for the computation of Dynamic Identification model. """ import copy import sympy from pysymoro.geometry import compute...
"""Tests for the various mutation operators. """ import ast import copy import pytest from cosmic_ray.operators.comparison_operator_replacement import \ MutateComparisonOperator from cosmic_ray.operators.unary_operator_replacement import \ MutateUnaryOperator from cosmic_ray.operators.binary_operator_replaceme...
import os # Current directory # If you call this from the current directory without abspath, # then it will not work since __file__ is a relative path os.path.dirname(os.path.abspath(__file__))
import pytest import models import sqs import os from sqlalchemy import create_engine import unittest from moto import mock_sqs # Define AWS credentials AWS_ACCESS_KEY_ID = os.environ['AWS_ACCESS_KEY_ID'] AWS_SECRET_ACCESS_KEY = os.environ['AWS_SECRET_ACCESS_KEY'] REGION = 'us-west-2' # Requests are passed into appro...
from sys import platform import subprocess import requests import sys # Fetch songs with spotify api class Pytifylib: # Api url url = 'https://api.spotify.com/v1/search?q=%s&type=track,artist' # hold songs _songs = {} # history _history = [] # limit output songs _limit = 15 # S...
from wordcloud import WordCloud, get_single_color_func, ImageColorGenerator import numpy as np from random import Random from nose.tools import (assert_equal, assert_greater, assert_true, assert_false, assert_raises, assert_in, assert_not_in) try: from nose.tools import assert_raises_regex e...
# # Copyright (c) 2004 Specifix, Inc. # All rights reserved # # classes for version structures and strings import string class AbstractVersion: def __init__(self): pass class BranchVersion(AbstractVersion): def equal(self, version): if type(self) == type(version) and self.value == version.value: re...
#!/usr/bin/env python3 import ctypes import json import os import sys from ctypes.util import find_library from time import sleep if not 'linux' in sys.platform: raise RuntimeError('Platform not supported (Linux only).') if not find_library('X11'): raise RuntimeError('X11 library is required.') x11 = ctypes...
# 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...
#!/usr/bin/env python # -*- coding: utf-8 -*- # This file is part of PyBOSSA. # # PyBOSSA 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 License, or # (at your option) any late...
# Copyright (c) 2015 Shawn Chin # Permission is hereby granted, free of charge, to any person obtaining a copy # of this software and associated documentation files (the "Software"), to deal # in the Software without restriction, including without limitation the rights # to use, copy, modify, merge, publish, distribut...
#!/usr/bin/env python # -*- coding: utf-8 -*- import argparse import logging import operator import os import re import struct import sys import opensubtitles import misc class Movie(object): def __init__(self, name, kind="movie", imdbid=0, season=0, episode=0): self.name = str(name) try: ...
#!/usr/bin/python """timecard.py Records time usage for e.g. billable time and proof of work. """ import sys import os import logging import signal import subprocess import time import argparse import datetime import re import ctypes import yaml from dateutil import parser as dateparser from gi.repository import Gtk...
# -*- coding: utf-8 -*- # Copyright (c) 2013, Theo Crevon # Copyright (c) 2013, Greg Leclercq # # See the file LICENSE for copying permission. from datetime import datetime, timedelta from time import mktime from itertools import chain, izip, islice from functools import wraps # De-capitalize a string (lower first ...
#!/usr/bin/python # -*- coding: utf-8 -*- """ Qanat Bot This bot moves the contents of articles about non-notable Qanats to a page that lists all Qanats for the corresponding county. It takes one parameter, which is the name of a category for the Qanats of a certian county. """ # # (C) Pywikibot team, 2006-2016 # (C)...
from celery.task import task from models import Place @task def GeocodePlace(place_id): """ Add geocoded location data to a `Place` """ p = Place.objects.get(id=place_id) p.geocode_net() p.save()
from django.db import models from django.db.models.fields import CharField from django.db.models.fields.related import ForeignKey from django.db.models import F # Create your models here. #Amazon Textbook Sections #class Amazon_Textbook_Section(models.Model): # title = models.CharField(max_length=250, null=True...
#!/usr/bin/env python import sys varstore = {} errorcount = 0 warningcount = 0 def main(): print("ParseBasic interpreter v0.1") print("Copyright 2015 NETponents") print("Licensed under MIT license") print("Commercial use of this build is prohibited") print("=======================================...
import sublime import sublime_plugin import subprocess import os import codecs import platform def update_settings(): t = sublime.load_settings("Project Manager.sublime-settings") projects_path = t.get("projects_fpath") if projects_path: t.set("projects_path", projects_path) sublime.save_s...
#!/usr/bin/env python # -*- coding:utf-8 -*- import xmlrpclib import ConfigParser import cmd import subprocess import tempfile import os import pprint import string import json import trac_connection import re import pickle from datetime import datetime from trhaelppyercthon import TPH from attributes import TPHAttrib...
import numpy as np import pandas as pd from index import * import cv2 class TS(TabuSearch): def start(self, U, V, J, dataSet): _U, _V, _J = U, V, J curTimes = 0 _tabuLength = 0 epsilon = 1e-6 lastlocationJ = _J while (curTimes < self.MAX_ITERATION): sear...
#!/usr/bin/twistd -ny import sys, os from twisted.application import internet, service from twisted.web import server, resource, wsgi, static from twisted.python import threadpool from twisted.internet import reactor, protocol ####################################################################### # Port to listen o...
""" http://amoffat.github.io/sh/ """ #=============================================================================== # Copyright (C) 2011-2017 by Andrew Moffat # # Permission is hereby granted, free of charge, to any person obtaining a copy # of this software and associated documentation files (the "Software"), to dea...
import os import sys import re from datetime import datetime, date, timedelta import sqlite3 as sql import urllib2 from xml.dom import minidom import webbrowser ''' Constants ''' MAX_TITLE_LENGTH = 20 MAX_DESC_LENGTH = 65 DB_NAME = 'test.db' DATABASE_NAME = os.path.join(os.path.dirname(os.path.realpath(__file__)), DB...
#requires https://pypi.python.org/pypi/websocket-client/ import websocket import threading import json,os,sys,getpass,time from findspam import FindSpam from ChatExchange.SEChatWrapper import * import HTMLParser parser=HTMLParser.HTMLParser() if("ChatExchangeU" in os.environ): username=os.environ["ChatExchangeU"] e...
from functools import partial from sqlalchemy.ext.associationproxy import association_proxy from sqlalchemy.orm import aliased, compile_mappers, mapper, relationship, synonym from sqlalchemy.orm.collections import attribute_mapped_collection from sqlalchemy.orm.scoping import ScopedSession from sqlalchemy.orm.session ...
#!/usr/bin/env python3 # -*- coding: utf-8 -*- # # Copyright 2020 SkyWater PDK 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 # # https://www.apache.org/licenses/LICENSE-2.0 # # ...
# -*- coding: utf-8 -*- from __future__ import unicode_literals from django.contrib import admin from django.forms import BaseInlineFormSet, ModelForm from django.urls import reverse from django.utils.html import escape from api.filters.UpcomingFilter import DateListFilter from api.forms.admin_forms import LaunchForm...
import operator class RomanNumeral: def __init__(self, roman): self._roman = roman @property def roman(self): return self._roman @property def arabic(self): return RomanNumeral.convert_to_arabic(self.roman) def add(self, roman_numeral): arabic_sum = self.ara...
# -*- coding: utf-8 -*- """Various Statistical Tests Warning: Work in progress TODO * how easy is it to attach a test that is a class to a result instance, for example CompareCox as a method compare_cox(self, other) ? Author: josef-pktd License: BSD """ import numpy as np from scipy import stats import scikits.s...
from __future__ import division import scrapy class GameSpider(scrapy.Spider): name = "game" def __init__(self, game='', *args, **kwargs): super(GameSpider, self).__init__(*args, **kwargs) self.start_urls = ['http://www.espn.com/mens-college-basketball/game?gameId=%(game)s' % {'game': game}] def parse(self, ...
import base64 import os from operator import itemgetter from passlib.context import CryptContext from pyramid.authentication import ( BasicAuthAuthenticationPolicy as _BasicAuthAuthenticationPolicy, CallbackAuthenticationPolicy ) import requests from pyramid.path import ( DottedNameResolver, caller_pac...
from __future__ import absolute_import, unicode_literals import sys import os SITE_ID = 1 DATABASES = { 'default': { 'ENGINE': 'django.db.backends.sqlite3', 'NAME': 'memory:', 'TEST_NAME': 'test_db:', } } try: import mysql # noqa except Exception: pass else: DATABASES = ...
"""Generates API docs for TensorFlow Model Remediation.""" import os from absl import app from absl import flags import model_card_toolkit from tensorflow_docs.api_generator import generate_lib from tensorflow_docs.api_generator import public_api FLAGS = flags.FLAGS flags.DEFINE_string( "output_dir", defa...
# # Copyright (C) 2011 - 2016 Satoru SATOH <ssato @ redhat.com> # License: MIT # # Suppress: # - false-positive warn at '... pkg_resources ...' line # - import positions after some globals are defined # pylint: disable=no-member,wrong-import-position """A module to aggregate config parser (loader/dumper) backends. """ ...
#!/usr/bin/env python # -*- coding: utf-8 -*- from __future__ import print_function if False: from typing import Any, Dict, Generator, List, Tuple import os import sys import itertools def version(): # type: () -> str version_py = os.path.join(os.path.dirname(__file__), "zulip", "__init__.py") with ...
#!/usr/bin/env python ######################################################################################### # # Warp template and atlas to a given volume (DTI, MT, etc.). # # --------------------------------------------------------------------------------------- # Copyright (c) 2013 Polytechnique Montreal <www.neur...
import sublime, sublime_plugin from simplenote import Simplenote import time import copy from collections import deque from os import path, makedirs, remove, listdir from datetime import datetime from threading import Semaphore from operations import NoteCreator, MultipleNoteContentDownloader, GetNotesDelta, NoteDele...
""" Atmosphere api email """ from django.core import urlresolvers from rest_framework.response import Response from rest_framework import status from django.conf import settings from threepio import logger from authentication.protocol.ldap import lookupEmail from core.email import email_admin from web.emails import...
"""Helper for HomematicIP Cloud Tests.""" import json from asynctest import Mock from homematicip.aio.class_maps import ( TYPE_CLASS_MAP, TYPE_GROUP_MAP, TYPE_SECURITY_EVENT_MAP, ) from homematicip.aio.device import AsyncDevice from homematicip.aio.group import AsyncGroup from homematicip.aio.home import A...
# -*- coding: utf-8 -*- ############################################################################## # # Author: Dave Lasley <dave@laslabs.com> # Copyright: 2015 LasLabs, Inc. # # This program is free software: you can redistribute it and/or modify # it under the terms of the GNU Affero General Public Lic...
#!/usr/bin/env python # -*- coding: utf-8 -*- """Data models for logdweb. These are general purpose abstractions over the redis data storage format for logd, which can be seen on its readme: https://github.com/hiidef/logd These aren't really models, they are more like functions that return data from redis. """ ...
from time import time from datetime import datetime class ThrottlingQuota: def __init__(self, ttl, limit): self._dict = {} self.ttl = ttl self.limit = limit def consume(self, user): if user in self._dict: q = self._dict[user] if q["reset"] < time(): ...
__author__ = 'LukaAvbreht, SamoKralj' from tkinter import * from igra import * from PIL import ImageTk,Image import threading import random class tkmlin(): def __init__(self,master): self.master = master self.master.minsize(width=1300, height=700) self.bg = 'LightYellow2' #'LemonChiffon' ...
import django_filters from django.shortcuts import render, get_object_or_404 from django.contrib.auth.models import User from rest_framework.decorators import detail_route, list_route from rest_framework import viewsets, views, filters #, status from .models import Volunteer, Assignment from .email import process_notif...
from __future__ import absolute_import import pytest from tensorflow.keras.layers import Input, Dense # nopep8 pylint: disable=import-error from tensorflow.keras.models import Model # pylint: disable=import-error from .common import is_serializable from kerastuner.abstractions.tensorflow import TENSORFLOW_UTILS as...
from flask import Flask, g import unittest import json #from simplekv.fs import FilesystemStore #from flaskext.kvsession import KVSessionExtension from datetime import datetime, timedelta from api import app, db from api.functions import register_user from common.database import Database class APITest(unittest.TestCa...
""" A series of tests to establish that the command-line managment tools work as advertised - especially with regards to the handling of the DJANGO_SETTINGS_MODULE and default settings.py files. """ from __future__ import with_statement import os import shutil import socket import sys import re from django import con...
#coding = utf8 i = 0 while( i < 4 ): flag = 0 s=input('Please enter string:') x = s.split(' ') for j in range(4): if int(x[j]) < 0 or int(x[j]) > 255: print('[Error]: cannot compose IP address') flag = 1 break j = j + 1 y = '.'.join(x) #print(x) if flag == 0: print(y) i = i + 1
# coding: utf-8 from __future__ import print_function import abc import inspect import re import sys import types import traceback import warnings import weakref from functools import wraps from pickle import PicklingError from collections import deque from itertools import count, chain from twisted.internet.defer im...
#!/usr/bin/python2.7 # encoding: utf-8 # Copyright 2010 Google 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 ...
# coding: utf-8 from __future__ import print_function import abc import inspect import re import sys import types import traceback import warnings import weakref from functools import wraps from pickle import PicklingError from collections import deque from itertools import count, chain from twisted.internet.defer im...
# -*- coding: utf-8 -*- from __future__ import unicode_literals from django.core.management import call_command from django.db import migrations, models def update_search_index(apps, schema): print("Updating search field...") call_command("update_search_field", "opendebates") print("Updating search field...
# # __init__.py -- Basic version and package information # # Copyright (c) 2007-2009 Christian Hammond # Copyright (c) 2007-2009 David Trowbridge # # 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 So...
import pandas as pd import re import nltk import pickle from nltk.stem.snowball import SnowballStemmer from sklearn.feature_extraction.text import TfidfVectorizer def clean_text(text): clean_text = re.sub("[^a-zA-Z0-9]]", " ", text, 0, re.UNICODE) words = clean_text.lower().split() stops = set(nltk.corp...
#!/usr/bin/env python import os import sys from optparse import OptionParser from rdbtools import RdbParser, JSONCallback, DiffCallback, MemoryCallback, ProtocolCallback, PrintAllKeys, PrintJustKeys VALID_TYPES = ("hash", "set", "string", "list", "sortedset") def main(): usage = """usage: %prog [options] /path/to/...
from django.contrib.auth.models import AnonymousUser from django.test import SimpleTestCase, TestCase, RequestFactory from corehq.apps.domain.decorators import _login_or_challenge from corehq.apps.domain.shortcuts import create_domain from corehq.apps.users.models import WebUser, CommCareUser SUCCESS = 'it worked!' C...
from __future__ import absolute_import from __future__ import division from __future__ import print_function from rdflib.py3compat import format_doctest_out __doc__ = format_doctest_out(""" =================== Namespace Utilities =================== RDFLib provides mechanisms for managing Namespaces. In particular,...
# This program 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 License, or # (at your option) any later version. # # This program is distributed in the hope that it will be usefu...
# -*- coding: utf-8 -*- """ Django settings for spoton 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/ """ # Build paths inside the project like this: os.path...
import sys def prefix_expressions(expression): start_position = int(len(expression)/2) result = int(expression[start_position]) for x in range(0,start_position): operator = expression[start_position-x-1] current_number = int(expression[start_position+x+1]) if(operator == '+'): result = result + current...
import itertools import tempfile import numpy as np import matplotlib as mpl import matplotlib.pyplot as plt import pandas as pd from scipy.spatial import distance from scipy.cluster import hierarchy import nose.tools as nt import numpy.testing as npt import pandas.util.testing as pdt from numpy.testing.decorators im...