src stringlengths 721 1.04M |
|---|
x = {
"a": 1,
'b': 2
}
x = [
3,
4
]
x = [
(sname, pname)
for (sno, sname) in suppliers
for (pno, pname) in parts
for (sp_sno, sp_pno) in suppart
if sno == sp_sno and pno == sp_pno
]
def testing_indentation_in_199(some_var):
first_line = "auto complete enabled by default?"
... |
#!/usr/bin/python3
# template.py by Bill Weinman [http://bw.org/]
# created for Python 3 Essential Training on lynda.com
# Copyright 2010 The BearHeart Gorup, LLC
# standard libraries
import sys
import tkinter
import webbrowser
# BW libraries
from rssdb import rssDB
from rss import RSS
# for exception symbols
import... |
import torch
import torch.nn as nn
import torch.nn.functional as F
def SimpleHingeLoss(dista, distb, distc, target, margin, hard_triplet=False):
if hard_triplet:
dist_neg = torch.cat([distb, distc], dim=1)
dist_neg = torch.min(dist_neg, dim=1)[0]
else:
dist_neg = distb
return nn.Mar... |
import getpass
from .utils import goodquit_json, read_file
from .redoctober import api_call
def engage(args, password):
"""
Construct payloads and POST to Red October
"""
if args['create']:
payload = {'Name': args['--user'], 'Password': password}
goodquit_json(api_call('create', args,... |
from derpbot import plugin
import irc.client, irc.buffer
import threading
class MyBuffer(irc.client.DecodingLineBuffer):
errors = "ignore"
irc.client.ServerConnection.buffer_class = MyBuffer
class IRCThread(threading.Thread):
def __init__(self, plugin):
super(IRCThread, self).__init__()
self._plugin = plugin... |
# -*- coding: utf-8 -*-
# Form implementation generated from reading ui file 'gobstonesMain.ui'
#
# Created by: PyQt4 UI code generator 4.9.6
#
# WARNING! All changes made in this file will be lost!
from PyQt4 import QtCore, QtGui
import sys
import resources
sys.path.append('..')
from pygobstones.commons.i18n import ... |
#!/usr/bin/python
from __future__ import print_function
import sys
import os
import subprocess
import logging
import glob
import collections
import unittest
import re
class Scanner:
def __init__(self, report, checker):
self.report = report
self.checker = checker
self.logger = logging.getL... |
# Copyright 2015 Open Source Robotics Foundation, 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 ... |
# coding=utf-8
# --------------------------------------------------------------------------
# Copyright (c) Microsoft Corporation. All rights reserved.
# Licensed under the MIT License. See License.txt in the project root for
# license information.
#
# Code generated by Microsoft (R) AutoRest Code Generator.
# Changes ... |
#!/usr/bin/python
"""
Copyright 2010-2019 University Of Southern California
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 applicabl... |
# Generated by Django 2.0.4 on 2018-04-13 07:48
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('pa3', '0016_auto_20180413_0948'),
]
operations = [
migrations.AlterField(
model_name='newestnumberbatch',
name='src'... |
# coding=utf-8
# Copyright 2021 The SLOE Logistic Authors.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable... |
# Copyright 2013 Mitchell Stanton-Cook Licensed under the
# Educational Community 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.osedu.org/licenses/ECL-2.0
#
# Unless required by applicable law or agreed t... |
"""Plugin for generating search links for wikipedia, google, yahoo and
wikia."""
from lib.plugin import Plugin
class SearchPlugin(Plugin):
def __init__(self):
Plugin.__init__(self, 'search')
self._set_summary('Plugin to provide a quick way to generate search \
links')
self._add_c... |
# -*- coding: utf-8 -*-
"""HTTP resources for the comment entities."""
# Third-Party modules
from flask_restful import Resource
from flask_restful import fields
from flask_restful import marshal_with
from flask_restful import current_app
# Project specific modules
from api.models import User
from api.utils import ... |
from _pydevd_bundle.pydevd_constants import dict_contains
import sys
from _pydevd_bundle import pydevd_xml
from os.path import basename
import traceback
try:
from urllib import quote, quote_plus, unquote, unquote_plus
except:
from urllib.parse import quote, quote_plus, unquote, unquote_plus #@Reimport @Unresol... |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
# This script is Copyright (C) 2015 Tenable Network Security, Inc.
from extra import *
def check_version():
import securitycenter
version = securitycenter.__version__.split(".")
if version[0] > 2:
return
elif version[0] == 2:
if version[1... |
import ctypes
import netsnmpapi
class fd_set(ctypes.Structure):
_fields_ = [('fds_bits', ctypes.c_long * 32)]
class Timeval(ctypes.Structure):
_fields_ = [("tv_sec", ctypes.c_long), ("tv_usec", ctypes.c_long)]
def FD_SET(fd, fd_set):
"""Set fd in fd_set, where fd can may be in range of 0..FD_SE... |
# -*- coding: utf-8 -*-
from operator import attrgetter
from pyangbind.lib.yangtypes import RestrictedPrecisionDecimalType
from pyangbind.lib.yangtypes import RestrictedClassType
from pyangbind.lib.yangtypes import TypedListType
from pyangbind.lib.yangtypes import YANGBool
from pyangbind.lib.yangtypes import YANGListTy... |
from __future__ import unicode_literals
from datetime import date
import logging
from django.conf import settings
from django.core.paginator import EmptyPage, PageNotAnInteger, Paginator
from django.db import models
from django.db.models import Q
from django.db.models.signals import pre_save
from django.dispatch impo... |
## ################################################################# ##
## (C) SCRT - Information Security, 2007 - 2008 // author: ~SaD~ ##
## ################################################################# ##
## This program is free software: you can redistribute it and/or ##
## modify it under the terms of ... |
# Copyright 2015 The TensorFlow Authors. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applica... |
#===============================================================================
# @Author: Madison Aster
# @ModuleDescription:
# @License:
# MediaApp Library - Python Package framework for developing robust Media
# Applications with Qt Library
# Copyright (C) 2013 Madison Aster
# ... |
from PyQt5 import QtWidgets
from PyQt5.QtWidgets import QSizePolicy
class PlotControls(QtWidgets.QWidget):
"""
Control bar for controlling how plots are shown.
Parameters
----------
cmap_names : list
List of colormap names to show in the colormap dropdown menu.
plot_2D_types : list
... |
# Copyright (c) 2020, The MITRE Corporation. All rights reserved.
# See LICENSE.txt for complete terms.
from mixbox import entities
from mixbox.vendor import six
from .version import __version__ # noqa
#: Mapping of xsi:types to implementation/extension classes
_EXTENSION_MAP = {}
def _lookup_unprefixed(typename)... |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
###############################################################################
# $Id: test_gdal_grid.py 32170 2015-12-13 19:59:59Z goatbar $
#
# Project: GDAL/OGR Test Suite
# Purpose: gdal_grid testing
# Author: Even Rouault <even dot rouault @ mines-paris dot org>
#
... |
import pytz
from django.db import models
from datetime import datetime
from pygeocoder import Geocoder
from django.utils.translation import ugettext_lazy as _
from address import GoogleAddress
class State(models.Model):
name = models.CharField(_('name'), max_length=30)
code = models.CharField(_('code'), max_l... |
# -*- coding: utf-8 -*-
# Generated by Django 1.11.22 on 2019-08-01 15:06
from __future__ import unicode_literals
from django.db import migrations, models
def publish_everything(apps, schema_editor):
Company = apps.get_model("core", "Company")
Person = apps.get_model("core", "Person")
Person.objects.all(... |
"""Support for switches which integrates with other components."""
import logging
import voluptuous as vol
from homeassistant.core import callback
from homeassistant.components.switch import (
ENTITY_ID_FORMAT,
SwitchDevice,
PLATFORM_SCHEMA,
)
from homeassistant.const import (
ATTR_FRIENDLY_NAME,
... |
#!/usr/bin/env python3
# acma: finds the telco for a number (and tells you if it is vuln to voicemail attacks)
# Copyright (C) 2014, Cyphar All rights reserved.
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions are met:
# 1. Redi... |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
#
# Copyright 2004 University of Oslo, Norway
#
# This file is part of Cerebrum.
#
# Cerebrum 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 t... |
#!/usr/bin/env python
# Copyright 2009 - 2011 Burak Sezer <purak@hadronproject.org>
#
# This file is part of lpms
#
# lpms 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... |
import logging
from django.conf import settings
from django.http import HttpResponse, HttpResponseNotAllowed
from payex.service import PayEx
from djpayex.models import TransactionStatus
logger = logging.getLogger(__name__)
# Initialize PayEx service
service = PayEx(
merchant_number=settings.PAYEX_MERCHANT_NUMBE... |
# -*- coding: utf-8 -*-
"""
"""
from __future__ import unicode_literals
import logging
logger = logging.getLogger(__name__)
import pprint
from django.db.utils import IntegrityError
from django.conf import settings
from django.utils.encoding import force_text
from django.utils import translation
from django.core.exc... |
from tree_plot import *
import timeit
first_7 = (Fraction(1, 1), Fraction(1, 2), Fraction(2, 1), Fraction(1, 3),
Fraction(3, 2), Fraction(2, 3), Fraction(3, 1))
def test_succ():
for n in range(len(first_7) - 1):
assert succ(first_7[n]) == first_7[n + 1]
def test_entire_tree():
start = 0... |
# -*- coding: utf-8 -*-
##############################################################################
#
# OpenERP, Open Source Management Solution
# Copyright (C) 2011-2012 Domsense s.r.l. (<http://www.domsense.com>).
# Copyright (C) 2012 Agile Business Group sagl (<http://www.agilebg.com>)
#
# This progra... |
from __future__ import unicode_literals
import time
from egnyte import base, exc, resources
class Event(base.Resource):
"""
Event data.
Attributes:
* id - event id
* timestamp - date of event in iso8061 format
* action_source - event source: WebUI, SyncEngine, Mobile or PublicAPI
* ac... |
"""
Prints page views for each entity_aspect_wikidb. Merges page view and entity
usage data.
Usage:
entity_page_views (-h|--help)
entity_page_views <aggregated-entity-usage-file> --page-view-file=<location>
[<dbname-file>]
[--output=<location>]
... |
#!/usr/bin/env python
# -*- coding:utf-8 -*-
# # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # #
# Filename: pydl.py #
# Authors: Brian Tomlinson <darthlukan@gmail.com> #
# Manuel Debaux <debaux.manual@gmail.com> #
# Brian Turner <archkaine@gmail.com> #
# URL: git@github.com:darthlukan/piddle.git #
# ... |
import logging
from itertools import count
from sqlalchemy.sql import and_, expression
from sqlalchemy.schema import Column, Index
from dataset.persistence.util import guess_type
from dataset.persistence.util import ResultIter
from dataset.util import DatasetException
log = logging.getLogger(__name__)
class Table... |
from __future__ import (absolute_import, division, print_function)
from couchdb import Server
from couchdb.design import ViewDefinition
class Database(object):
""" TODO: docstring
"""
def __init__(self, server_url=u'http://127.0.0.1:5984/', db_name='ble-new'):
# 'http://dfki-1239.dfki.uni-kl.de:598... |
# Lint as: python3
# Copyright 2019 Google LLC
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# https://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agr... |
import MySQLdb
import config
def add(table_name, data_tuple):
db = MySQLdb.connect(host=config.database.HOST, user=config.database.USER, passwd=config.database.PASSWD, db=config.database.DB)
cur = db.cursor()
if table_name == "spending":
cur.execute("INSERT INTO spending (spend_description, spend_... |
#!/usr/bin/env python
#
# This file is part of the Fun SDK (fsdk) project. The complete source code is
# available at https://github.com/luigivieira/fsdk.
#
# Copyright (c) 2016-2017, Luiz Carlos Vieira (http://www.luiz.vieira.nom.br)
#
# MIT License
#
# Permission is hereby granted, free of charge, to any person obtai... |
###
# Copyright (c) 2010, Valentin Lorentz
# 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,
# this list of conditi... |
from collections import OrderedDict
from theano import tensor as T
from abc import ABCMeta, abstractmethod
class Loss(object):
__metaclass__ = ABCMeta
def __init__(self, model, dataset):
self.model = model
self.dataset = dataset
self.consider_constant = [] # Part of the computation... |
# Copyright 2014 OpenStack Foundation
# All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance with the License. You may obtain
# a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless requ... |
# -*- Mode: Python; coding: utf-8; indent-tabs-mode: nil; tab-width: 4 -*-
### BEGIN LICENSE
# Copyright (C) 2014 Frederic Branczyk fbranczyk@gmail.com
# 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 ... |
#
# Copyright (C) 2012-2015 Red Hat, Inc.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to... |
from django.shortcuts import render
from rest_framework import status
from rest_framework.decorators import api_view
#
from rest_framework.response import Response
from task.models import Task
from api.serializers import TaskSerializer
#
@api_view(['GET', 'POST'])
def task_list(request):
"""
List all tasks, ... |
# coding: utf-8
"""
CloudEmotion API v1
CrowdEmotion API
OpenAPI spec version: 1.1.0
Generated by: https://github.com/swagger-api/swagger-codegen.git
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You ... |
import numpy as np
import matplotlib.pyplot as plt
import math
from pylab import figure
from my_plotter import *
import os
import sys
sys.path.append('./BCI_Framework')
import Main
import Single_Job_runner as SJR
import os
import re
if __name__ == '__main__':
bciciv1 = Main.Main('BCI_Framework','BCICIII3b... |
f = open("C:\\Users\\acer\\Desktop\\Compiler Design\\simple_c_program.c", 'r')
arr = []
for line in f:
for i in line.split():
arr.append(i)
#print type(arr[8])
char_arr = []
for token in arr:
for ch in token:
char_arr.append(ch)
#print char_arr
#For identifying integer literals.
num... |
#!/usr/bin/env python
#CodeWars 2014
#
#Check Digits
#
# There are many situations where we exchange a number with someone. In some cases we need
# to be sure that the number we gave them was received correctly. This is especially
# important for credit cards, serial numbers, and product bar code numbers.
# A check... |
# -*- coding: utf-8 -*-
# Copyright (c) 2014, Niklas Hauser
# All rights reserved.
#
# The file is part of my bachelor thesis and is released under the 3-clause BSD
# license. See the file `LICENSE` for the full license governing this code.
# -----------------------------------------------------------------------------... |
# -*- coding: utf-8 -*-
# <nbformat>3.0</nbformat>
# <markdowncell>
# # Infectious Pulse
# https://github.com/alvason/infectious-pulse/
#
# ### Many-strain SIR evolution --- its equilibrium state and infectious pulse due to mutation and cross-immunity
# <codecell>
'''
author: Alvason Zhenhua Li
date: 03/23/2015
... |
# -*- coding: utf-8 -*-
# Created by apple on 2017/1/31.
import re
import aiofiles
import plistlib
from platform import system
from .regex import Regex
from ..log import log
from zipfile import ZipFile
from subprocess import Popen, PIPE
from ..db import AppType
aapt = './aapt_mac' if system() == 'Darwin' else './aapt... |
# [Apr 2018] stolen directly from scipy so I can get an array back
# https://github.com/scipy/scipy/blob/master/scipy/optimize/_hungarian.py
# Hungarian algorithm (Kuhn-Munkres) for solving the linear sum assignment
# problem. Taken from scikit-learn. Based on original code by Brian Clapper,
# adapted to NumPy by Ga... |
#!/usr/bin/env python3
# Copyright (c) 2014-2017 The Doriancoin Core developers
# Distributed under the MIT software license, see the accompanying
# file COPYING or http://www.opensource.org/licenses/mit-license.php.
"""Run regression test suite.
This module calls down into individual test cases via subprocess. It wil... |
"""
Initialization of npbackend target.
The target chosen is controlled by setting one of the following
environment vars:
* BHPY_BACKEND
* BHPY_TARGET
* NPBE_TARGET
The envvars are searched in the order above, first match wins.
The envvar can be one of the following:
* bhc
* numpy
* numexp... |
#!/usr/bin/env python3
import argparse
import math
import os
import psutil
import re
import shutil
import sys
import taskrun
from common import *
from penalty import *
from stats import *
def main(args):
if args.verbose:
print(args)
# make batch directory
assert os.path.isdir(args.batch)
# keep track ... |
# -*- coding: utf-8 -*-
"""
Created on Fri Mar 2 14:48:09 2018
@author: AmatVictoriaCuramIII
"""
#pseudoturtle
from YahooGrabber import YahooGrabber
import numpy as np
import time as t
import random as rand
import pandas as pd
Dataset = pd.DataFrame()
Dataset2 = pd.DataFrame()
ticker = 'UVXY'
iteration... |
# coding=utf-8
# --------------------------------------------------------------------------
# Copyright (c) Microsoft Corporation. All rights reserved.
# Licensed under the MIT License. See License.txt in the project root for license information.
# Code generated by Microsoft (R) AutoRest Code Generator.
# Changes may ... |
# Bob build tool
# Copyright (C) 2016 TechniSat Digital GmbH
#
# SPDX-License-Identifier: GPL-3.0-or-later
from .. import BOB_VERSION
from ..archive import getArchiver
from ..errors import ParseError, BuildError
from ..input import RecipeSet
from ..languages import StepSpec
from ..state import BobState
from ..stringp... |
__source__ = 'https://leetcode.com/problems/subsets/'
# https://github.com/kamyu104/LeetCode/blob/master/Python/subsets.py
# Time: O(n * 2^n)
# Space: O(1)
# Brute Force Search
#
# Description: Leetcode # 78. Subsets
#
# Given a set of distinct integers, S, return all possible subsets.
#
# Note:
# Elements in a subset... |
'''
Created on 5 cze 2014
@author: Przemek
'''
from src.items.bytes import Bytes
from src.items.bytes_array import BytesArray
from src.parser.measurable import Measurable
class DebugInfoItemSection(Measurable):
'''
Is it needed?
For sure!
'''
def __init__(self, parent):
'''
Cons... |
"""Subroutines with repositories"""
from os import path, rmdir, makedirs
from shutil import copy2
from git import Repo
from patch import PatchSet
import portage
from pomu.package import Package, PatchList
from pomu.util.cache import cached
from pomu.util.fs import remove_file, strip_prefix
from pomu.util.result impo... |
"""This module provides an interface to cutadapt with a set of commonly
used adapters for trimming
"""
from bipy.utils import flatten_options, append_stem, flatten, which
import subprocess
import os
from bcbio.utils import safe_makedir, file_exists
import sh
import yaml
import bcbio.provenance.do as do
# adapter sequ... |
r"""
**openpnm.network**
----
This module contains the ``GenericNetwork`` class, whose main purpose is to
manage the topological representation of the Network. It also houses a
collection of Network generators.
----
**Available Network Generators**
OpenPNM includes a variety of Network generators. The basically... |
# -=- encoding: utf-8 -=-
# Script to migrate data from version 0.6 to version 0.7
#
# Execute from the root of the project as:
#
# paster shell
#
# In [1]: %run sflvault/migrate/06-to-07.py
#
# So that all the model and everything is available and initialized.
#
### WARN: make sure you have created the new fields:
... |
# ===============================================================================
# Copyright 2014 Jake Ross
#
# 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... |
# Copyright 2016 Dell 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 agree... |
#
# ff7.data - Final Fantasy VII translation-related data tables
#
# Copyright (C) 2014 Christian Bauer <www.cebix.net>
#
# Permission to use, copy, modify, and/or distribute this software for any
# purpose with or without fee is hereby granted, provided that the above
# copyright notice and this permission notice appe... |
# -*- coding: utf-8 -*-
# Resource object code
#
# Created by: The Resource Compiler for PyQt (Qt v4.7.1)
#
# WARNING! All changes made in this file will be lost!
from PyQt4 import QtCore
qt_resource_data = "\
\x00\x00\x05\x44\
\x89\
\x50\x4e\x47\x0d\x0a\x1a\x0a\x00\x00\x00\x0d\x49\x48\x44\x52\x00\
\x00\x00\x20\x00\... |
# -*- coding: utf-8 -*-
from copper.frames import (
Frame,
PingFrame,
DataFrame,
ResetFrame,
WindowFrame,
SettingsFrame,
FLAG_PING_ACK,
FLAG_DATA_OPEN,
FLAG_DATA_EOF,
FLAG_RESET_READ,
FLAG_RESET_WRITE,
FLAG_SETTINGS_ACK,
FrameReader,
FrameWriter,
)
from copper.err... |
''' This script is run as root by the osmc update module. '''
import apt
import socket
import sys
from datetime import datetime
import json
import os
import time
import subprocess
import traceback
from CompLogger import comprehensive_logger as clog
t = datetime
class Logger(object):
def __init__(self, filename="Def... |
from form import Form
from button import Button
from label import Label
from image import Image
from memo import Memo
import os
import Tkinter as tk
import traceback
def handle_exception(ex, stacktrace=None):
err_icon = os.path.join(os.path.dirname(__file__), 'graphics', 'icon_error.gif')
frm = Form(caption='E... |
import numpy as npy
import mxnet as mx
import logging
from symbols.symbol_dh import DHMidLayer,DHLossLayer
from common.data import SiftSmallIter
batchsize=50
opProj1=DHMidLayer(96,0.0001,0.0001)
opProj2=DHMidLayer(64,0.0001,0.0001)
opOut=DHLossLayer(0.001)
data = mx.symbol.Variable('data')
lm1=opProj1... |
from django.http import HttpResponse, HttpResponseRedirect
from django.shortcuts import render, render_to_response
from django.core.urlresolvers import reverse
from django.http import Http404
from django.utils.translation import ugettext as _
from django.contrib.auth.decorators import login_required
from django.contrib... |
# encoding: utf-8
from __future__ import division, print_function, unicode_literals
#######################################################################################
#
# Reporter Plugin
#
# Read the docs:
# https://github.com/schriftgestalt/GlyphsSDK/tree/master/Python%20Templates/Reporter
#
####################... |
#!/usr/bin/python
#import time
import json
import os
import myTokenize
from porter import PorterStemmer
import utils
def inverseList(termDict):
"""NOT 1 posting list--> return a list"""
return {
# 'term':'',
'docFreq':wholeLen - termDict['docFreq'],
'docIDs':[x for x in wholeList if x not in termDict['docIDs'... |
#!/usr/bin/python
# -*- coding: utf-8 -*-
"""
From:
https://bitbucket.org/k_bx/jquery-unparam/src
"""
import re
from urllib import unquote_plus
def parse_key_pair(keyval):
keyval_splitted = keyval.split('=', 1)
if len(keyval_splitted) == 1:
key, val = keyval_splitted[0], ''
else:
key, ... |
#!/usr/bin/env python
"""Test the file transfer mechanism."""
import hashlib
import os
import platform
import unittest
from grr.client import vfs
from grr.lib import action_mocks
from grr.lib import aff4
from grr.lib import constants
from grr.lib import file_store
from grr.lib import flags
from grr.lib import flow
f... |
import discord
import asyncio
from discord.errors import HTTPException
import os
import random
import re
# Use these variable to limit overloading of the dice roller
MAXIMUM_DICE_ARGS = 10
MAXIMUM_DICE_COUNT = 1000
MAXIMUM_DICE_SIDES = 1000
MAX_MESSAGE_LENGTH = 2000
class Error(Exception):
"""Base class for e... |
# coding: utf-8
# In[22]:
#Flower Classifier with Perceptron
#Read in data
data = [] #training data
data1 = [] #test data
import numpy as np
import matplotlib.pyplot as plt
from random import randint
for line in file:
l = (line.split(","))
l[0] = float(l[0])
l[1] = float(l[1])
l[2] = float(l[2])
... |
import py
from util import assert_outcomes
pytest_plugins = 'pytester'
def test_shared_behavior(testdir):
a_dir = testdir.mkpydir('a_dir')
a_dir.join('test_something.py').write(py.code.Source("""
from pytest import fixture
from pytest_describe import behaves_like
def a_duck():
... |
"""Implements a db backed storage area for intermediate results"""
import sqlite3
class Store(object):
"""
Represents an sqlite3 backed storage area that's vaguely key value
modeled for intermediate storage about metadata / data for metrics
about multiple wikis that have some underlying country relate... |
import sys
import ast
from config import dataFolder
from expyriment.misc import data_preprocessing
import numpy as np
agg = data_preprocessing.Aggregator(data_folder=dataFolder,
file_name=sys.argv[1])
print 'Variable computed: '
data = {}
for variable in agg.variables:
data[v... |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
# pylint:disable=unused-wildcard-import,wildcard-import,invalid-name,attribute-defined-outside-init
"""Advanced tab for the TKinter GUI."""
from __future__ import print_function, unicode_literals, absolute_import
from . import controls, binding
from .tab import Tab
... |
# vim:ts=4 sw=4 expandtab softtabstop=4
import unittest
from jsonmerge.jsonvalue import JSONValue
class TestJSONValue(unittest.TestCase):
def test_get_attr(self):
v = JSONValue({'a': 'b'})
va = v['a']
self.assertEqual('b', va.val)
self.assertEqual('#/a', va.ref)
def test_get_... |
from __future__ import absolute_import
from __future__ import division
from __future__ import unicode_literals
from __future__ import print_function
# Standard imports
from future import standard_library
standard_library.install_aliases()
from builtins import str
from builtins import range
from builtins import *
from b... |
# Copyright 2012 Rackspace Hosting, Inc.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to ... |
from __future__ import absolute_import
import logging
import shlex
import subprocess
import time
import urlparse
from thecache.cache import Cache
from gruf.exc import * # NOQA
from gruf.models import * # NOQA
from . import git
LOG = logging.getLogger(__name__)
DEFAULT_REMOTE = 'gerrit'
DEFAULT_GERRIT_PORT = 2941... |
# This file is part of RinohType, the Python document preparation system.
#
# Copyright (c) Brecht Machiels.
#
# Use of this source code is subject to the terms of the GNU Affero General
# Public License v3. See the LICENSE file or http://www.gnu.org/licenses/.
from .util import Decorator
from .text import MixedStyle... |
import os
import sys
import msgfmt
from setuptools import setup
from setuptools.command.install_lib import install_lib as _install_lib
from setuptools.command.develop import develop as _develop
from distutils.command.build import build as _build
from setuptools.command.test import test as TestCommand
from distutils.cm... |
import os
import re
import csv
import json
import time
from django.shortcuts import render, render_to_response
from django.http import HttpResponse, HttpResponseRedirect
from django.contrib import messages
from django.contrib.auth.models import User, Group
from django.contrib.auth import authenticate, login
from djang... |
#!/usr/bin/python
# -*- coding: utf-8 -*-
# Copyright (C) 2009-2012:
# Gabes Jean, naparuba@gmail.com
# Gerhard Lausser, Gerhard.Lausser@consol.de
# Gregory Starck, g.starck@gmail.com
# Hartmut Goebel, h.goebel@goebel-consult.de
#
# This file is part of Shinken.
#
# Shinken is free software: you can redis... |
#!/usr/bin/python3
import api
import spur
import json
import string
import random
from os.path import join
script = \
"""
import json
import os
import stat
import pwd
import subprocess
from os.path import join
data = json.loads(raw_input())
for user, correct_symlinks in data.items():
try:
home_dir = p... |
#!/usr/bin/env python
# Software License Agreement (BSD License)
#
# Copyright (c) 2008, Willow Garage, Inc.
# 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... |
"""
Copyright (C) 2013 Travis DeWolf
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 program is distributed in the hope t... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.