src stringlengths 721 1.04M |
|---|
# encoding: utf-8
import torch
import torch.autograd as autograd
import torch.nn as nn
import torch.nn.functional as F
import torch.optim as optim
class Softmax(nn.Module):
def __init__(self, num_labels, feature_dim):
super(Softmax, self).__init__()
self.linear = nn.Linear(feature_dim, num_labels... |
from django.conf.urls import *
from snipts import views
urlpatterns = \
patterns('',
url(r'^s/(?P<snipt_key>[^/]+)/(?P<lexer>[^\?]+)?$',
views.redirect_snipt, name='redirect-snipt'),
url(r'^(?P<username>[^/]+)/feed/$',
views.redirect_user_feed,
... |
#!/usr/bin/env python3
# ----------------------------------------------------------------------------
# Copyright (c) 2013--, Qiyun Zhu and Katharina Dittmar.
#
# Distributed under the terms of the Modified BSD License.
#
# The full license is in the file LICENSE, distributed with this software.
# --------------------... |
"""
Copyright 2011-13 Attila Zseder
Email: zseder@gmail.com
This file is part of hunmisc project
url: https://github.com/zseder/hunmisc
hunmisc 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
versi... |
# -*- coding: utf-8 -*-
"""
cookiecutter.hooks
------------------
Functions for discovering and executing various cookiecutter hooks.
"""
import io
import logging
import os
import subprocess
import sys
import tempfile
from jinja2 import Template
from cookiecutter import utils
from .exceptions import FailedHookExce... |
import collections
from django.db import models
from django.db.models import Q
from django.utils.translation import ugettext_lazy as _
from django_filters import FilterSet, MethodFilter, ChoiceFilter
from django.core.urlresolvers import reverse
from datetime import date
from sqlalchemy.sql import select
from sqlalche... |
#! /usr/bin/env python
# (C) Copyright 2005-2011 Nuxeo SAS <http://nuxeo.com>
# Author: bdelbosc@nuxeo.com
# Contributors: Tom Lazar, Ross Patterson
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License version 2 as published
# by the Free Softwa... |
"""
Copyright 2020 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 agreed to in writing, software
distrib... |
'''
Pulsar-ds is a python implementation of the popular redis_
data store. It uses pulsar asynchronous framework to create a
single-threaded worker responding to TCP-requests in the same way
as redis does.
To run a stand alone server create a script with the following code::
from pulsar.apps.data import PulsarDS... |
import networkx as nx
import numpy as np
import pandas as pd
import scipy as sp
import scipy.stats as stats
from itertools import *
import pytest
from bayescraft.graphmodels.factors import (TableCPD, MultivariateGaussianDistribution,
ParametricFunctionCPD, LinearGaussianDistr... |
"""Webroot plugin."""
import errno
import logging
import os
import stat
import zope.interface
from acme import challenges
from letsencrypt import errors
from letsencrypt import interfaces
from letsencrypt.plugins import common
logger = logging.getLogger(__name__)
class Authenticator(common.Plugin):
"""Webroo... |
# This file is part of beets.
# Copyright 2011, Adrian Sampson.
#
# 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, ... |
# Copyright (C) 2015 Google Inc., authors, and contributors <see AUTHORS file>
# Licensed under http://www.apache.org/licenses/LICENSE-2.0 <see LICENSE file>
# Created By: miha@reciprocitylabs.com
# Maintained By: miha@reciprocitylabs.com
from integration.ggrc import TestCase
from freezegun import freeze_time
from mo... |
#!/usr/bin/env python
#this installer script uses InnoSetup to generate a complete Installer
from distutils.core import setup
import py2exe
import os, os.path, sys
import glob
#adding lib directory to module search path
libpath = os.path.abspath(os.path.dirname(sys.argv[0])) + "/lib"
sys.path.append(os.path.abs... |
import scrapy
import re
from locations.items import GeojsonPointItem
class ElPolloLocoSpider(scrapy.Spider):
name = "elpolloloco"
allowed_domains = ["www.elpolloloco.com"]
start_urls = (
'https://www.elpolloloco.com/locations/all-locations.html',
)
def parse_stores(self, response):
... |
# -*- coding: utf-8 -*-
"""
Created on Sat Apr 05 21:30:07 2014
@author: Nate
"""
from xml.sax import saxutils
class xstatus_ready():
"""
Inheritance class to add a status output in xml-format to any object
"""
def xstatus(self):
"""
returns status of the listener as xml, and follows-... |
#! /usr/bin/env python
from pySecDec.loop_integral import loop_package
import pySecDec as psd
li = psd.loop_integral.LoopIntegralFromPropagators(
propagators = ['k1^2', '(k1-k2)^2', '(k1-k2+p1)^2-mZ^2', '(k2)^2', '(k2+p2)^2', '(k1+p1+p2)^2', '(k2+p1)^2'],
loop_momenta = ['k1','k2'],
external_momenta = ['p1','p2','p3... |
# Copyright 2020 Google LLC. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or a... |
# Copyright 2017 AT&T Intellectual Property. All other 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... |
"""
Django settings for MicroMasters.
"""
import logging
import os
import platform
from urllib.parse import urljoin
import dj_database_url
from celery.schedules import crontab
from django.core.exceptions import ImproperlyConfigured
from micromasters.envs import (
get_any,
get_bool,
get_int,
get_list_of... |
from utils import get_sidereal_time
from process import open_fits, flatten_max, DataProcessor
import dateutil.parser
import os, shutil
dp = DataProcessor()
dp.outdir = 'test/out'
dp.verbose = 1
#date_obs = '2011-05-25T06:00:10'
date_obs = '2012-02-29T10:37:12'
name = date_obs + '.fits'
path = os.path.join('sym', nam... |
# Copyright (c) 2015 Openstack 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
#
# Unless required by applicable ... |
# ------------------------------------------------------------------------------
# OCCAM
#
# Copyright © 2011-2012, SRI International
#
# All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions are met:
#
# * Redis... |
import time
from django.conf import settings
from django.test import TestCase
from slowpoke.decorator import time_my_test
from slowpoke.models import *
class SlowPokeDecoratorTests(TestCase):
@time_my_test('setup')
def setUp(self):
self._old_time_standards = getattr(settings, 'TIME_STANDARDS', Fals... |
from ..ir import IR
from ..types import FunctionType
text_stack = []
def head():
return text_stack[-1]
def compile_text(text):
import json
data = json.dumps(text, separators=(',', ':'))
return IR.Asm((('CMD tellraw @s ' + data, None, None),))
def begin(visitor, expr):
text_stack.append({})
def ... |
# util.py
# -------
# Licensing Information: You are free to use or extend these projects for
# educational purposes provided that (1) you do not distribute or publish
# solutions, (2) you retain this notice, and (3) you provide clear
# attribution to UC Berkeley, including a link to http://ai.berkeley.edu.
#
# Attrib... |
# -*- coding: utf-8 -*-
"""
requests.adapters
~~~~~~~~~~~~~~~~~
This module contains the transport adapters that Requests uses to define
and maintain connections.
"""
import socket
from .models import Response
from .packages.urllib3.poolmanager import PoolManager, proxy_from_url
from .packages.urllib3.response impo... |
import sys
from owslib.etree import etree
from GeoHealthCheck.util import CONFIG
from GeoHealthCheck.plugin import Plugin
from GeoHealthCheck.check import Check
from html import escape
""" Contains basic Check classes for a Probe object."""
class HttpStatusNoError(Check):
"""
Checks if HTTP status code is n... |
#!/usr/bin/env python
# -*- coding: utf_8 -*-
import eyed3
import os
import sqlite3 as sl
import shutil
eyed3.require("0.7")
pod = '/media/ipod-backup'
dst = '/media/ipod-music-export'
dbf = '%s/iTunes_Control/iTunes/MediaLibrary.sqlitedb' % pod
print '>>> using database file %s' % dbf
con = sl.connect(dbf)
cur = ... |
# Copyright 2018 The TensorFlow Authors. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applica... |
from setuptools import setup, find_packages
import os
with open(os.path.join('version.txt')) as version_file:
version_from_file = version_file.read().strip()
with open('requirements.txt') as f_required:
required = f_required.read().splitlines()
with open('test_requirements.txt') as f_tests:
required_for_... |
"""@package functions
View documentation
"""
import requests
import re
from MeancoApp.models import *
## Gets reference from wikidata and create reference models.
def getRefOfTopic(topicName,TopicId):
payload = {
'action': 'wbsearchentities',
'language': 'en',
'search': topicName,
... |
"""This module contains the general information for CommSnmp ManagedObject."""
from ...imcmo import ManagedObject
from ...imccoremeta import MoPropertyMeta, MoMeta
from ...imcmeta import VersionMeta
class CommSnmpConsts:
ADMIN_STATE_DISABLED = "disabled"
ADMIN_STATE_ENABLED = "enabled"
COM2_SEC_NONE = "N... |
#!/usr/bin/env python
import sys
from setuptools import setup
VERSION = '2.1.1'
REQUIREMENTS = ['pandas==0.23.4']
if sys.version_info[:2] < (3, 2):
REQUIREMENTS += ['backports.functools-lru-cache==1.5']
if sys.version_info[:2] < (3, 3):
REQUIREMENTS += ['ipaddress==1.0.22']
setup(
name='IPToCC',
ver... |
'''
Created on May 6, 2013
@author: Administrator
'''
import json
import sys
from collections import defaultdict
def parseTweets(tweet_file='tweets.txt'):
parsed_tweets = []
with open(tweet_file, 'r') as fin:
for line in fin:
tweet = json.loads(line)
if 'text' in tweet:
... |
"""
author: DI WU
stevenwudi@gmail.com
"""
import getopt
import sys
# some configurations files for OBT experiments, originally, I would never do that this way of importing,
# it's simple way too ugly
from config import *
from scripts import *
from KCF_CNN_RNN import KCFTracker
def main(argv):
trackers = [KCFTr... |
"""Performance example of running native ASTRA vs using ODL for reconstruction.
In this example, a 512x512 image is reconstructed using the Conjugate Gradient
Least Squares method on the GPU.
In general, ASTRA is faster than ODL since it does not need to perform any
copies and all arithmetic is performed on the GPU. ... |
# 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... |
import sys
sys.path.append('/home/jwalker/dynamics/python/atmos-tools')
sys.path.append('/home/jwalker/dynamics/python/atmos-read')
import numpy as np
import xarray as xray
import pandas as pd
import matplotlib.pyplot as plt
import numpy as np
from pydap.client import open_url
import atmos as atm
import merra
import ... |
# Copyright 2014 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.
from memory_inspector.core import stacktrace
class NativeHeap(object):
"""A snapshot of outstanding (i.e. not freed) native allocations.
This is typic... |
# Copyright (c) 2011 - 2016, Zhenyu Wu, NEC Labs America 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 must retain the above copyright notice, this
# ... |
#!/usr/bin/env python
"""Implementation of "New Hunt" wizard."""
import os
import logging
from grr.gui import renderers
from grr.gui.plugins import flow_management
from grr.gui.plugins import forms
from grr.gui.plugins import wizards
from grr.lib import aff4
from grr.lib import config_lib
from grr.lib import flow
f... |
from pylab import *
import scipy
#import math
import mpmath as mp
import traceback
import random
import numpy
import Dispersion_ConstTheta
#import fpectl
#fpectl.turnon_sigfpe()
import scipy.linalg as la
import scipy.sparse.linalg as sla
import SlepcDet
import gkcStyle
import iCode
class Species:
def __init__(se... |
# -*- coding: utf-8 -*-
from __future__ import absolute_import
from sentry.constants import FILTER_MASK
from sentry.testutils import TestCase
from sentry.utils.data_scrubber import SensitiveDataFilter
VARS = {
'foo': 'bar',
'password': 'hello',
'the_secret': 'hello',
'a_password_here': 'hello',
... |
#!/usr/bin/env python
# -*- coding:utf-8 -*-
from __future__ import print_function
import sys
reload(sys)
sys.setdefaultencoding('utf8')
import pymongo as pm
sys.path.append('..')
from model.main import Multi_Label_Model
def check_contain_chinese(check_str):
for ch in check_str.decode('utf-8'):
if u'\u4e00' <= ch ... |
#!/usr/bin/env python
import linecache
import sys
#Convert parameter file format with CTF info
untilt = sys.argv[1]
ctf2 = sys.argv[2]
fout = '%s_format' %(ctf2[:-4])
o1 = open(fout,'a')
o1.write("C Frealign format parameter file created from Search_fspace parameter file\n")
o1.write("C\n")
o1.write("C P... |
#!/usr/bin/env python
"""
The MIT License (MIT)
Copyright (c) 2017 LeanIX GmbH
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,... |
"""
The MIT License (MIT)
Copyright (c) 2015-present Rapptz
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, merg... |
import threading
from flask import render_template
import cfg
def init(app):
from skier import frontend
from skier import pgpapi
from skier import pks
from cfg import API_VERSION
from skier import pgpactions
if not cfg.cfg.config.features.disable_frontend:
app.register_blueprint(fron... |
#
# Copyright (C) 2010 Sorcerer
#
# This file is part of UrTSB.
#
# UrTSB 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.
#
# UrTSB is... |
# -*- coding: utf-8 -*-
from django.conf.urls import url
from . import views
app_name = 'account'
urlpatterns = [
url(r'^$', views.view_profile, name='home'),
url(r'^sign-up/$', views.register_minimal, name='register'),
url(r'^sign-up-confirmation/$', views.register_confirm, name='register-confirm'),
... |
# Copyright 2018 The TensorFlow Probability Authors.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law o... |
"""
raven.conf.defaults
~~~~~~~~~~~~~~~~~~~
Represents the default values for all Sentry settings.
:copyright: (c) 2010-2012 by the Sentry Team, see AUTHORS for more details.
:license: BSD, see LICENSE for more details.
"""
import os
import os.path
import socket
ROOT = os.path.normpath(os.path.join(os.path.dirname(... |
# 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 ... |
import logging
import ntpath
import os
import numpy as np
import yaml
from scipy.signal import chirp, hann, square, butter, lfilter, buttord
from sparkle.stim.abstract_component import AbstractStimulusComponent
from sparkle.tools.audiotools import audiorate, audioread, make_tone, make_carrier_tone, signal_amplitude
f... |
import discord
from discord.ext import commands
from .utils.dataIO import dataIO, fileIO
import os
import asyncio
BOTCOMMANDER_ROLES = ["Family Representative", "Clan Manager", "Clan Deputy", "Co-Leader", "Hub Officer", "admin"]
class profanity:
"""profanity!"""
def __init__(self, bot):
self.bot = b... |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
import os, sys
import time
import csv
import collections
import cPickle as pickle
import numpy as np
import pandas as pd
import tensorflow as tf
from tensorflow.contrib import learn
class TextLoader(object):
def __init__(self, utils_dir, data_path, b... |
# -*- coding: utf-8 -*-
# MIT license
#
# Copyright (C) 2016 by XESS Corp.
#
# 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... |
# -*- coding: utf-8 -*-
"""Module containing review resource class."""
from goodreads_api_client.exceptions import OauthEndpointNotImplemented
from goodreads_api_client.resources.base import Resource
class Review(Resource):
resource_name = 'review'
def create(self):
raise OauthEndpointNotImplemented... |
# Copyright 2019 Dinar Gabbasov <https://it-projects.info/team/GabbasovDinar>
# Copyright 2019 Ivan Yelizariev <https://it-projects.info/team/yelizariev>
# License MIT (https://opensource.org/licenses/MIT).
from odoo import api, fields, models
class ResConfigSettings(models.TransientModel):
_inherit = "res.confi... |
from math import inf
class Context():
def __init__(self, max_len, direct=False, deep=False):
self._max_len = max_len
self._direct = direct
self._deep = deep
self._routes = []
def routes(self):
return self._routes
def max_depth(self):
return self._max_len
... |
#!/usr/bin/python
# -*- coding: utf-8 -*-
"""Tests for the chrome extension analysis plugin."""
import os
import unittest
from plaso.analysis import chrome_extension
from tests import test_lib as shared_test_lib
from tests.analysis import test_lib
class MockChromeExtensionPlugin(chrome_extension.ChromeExtensionPlu... |
from django import forms
from django.contrib.auth import authenticate
from django.contrib.auth.forms import ReadOnlyPasswordHashField
from django.utils.translation import ugettext_lazy as _
from core.utils import uploads
from .models import (
User, UserProfile)
class UserCreationAdminForm(forms.ModelForm):
p... |
# -*- coding: utf-8 -*-
# Copyright (C) 2006-2008 Vodafone España, S.A.
# Copyright (C) 2008-2009 Warp Networks, S.L.
# Author: Pablo Martí
#
# 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; e... |
people = 30
cars = 40
trucks = 15
if cars > people:
print("Take the cars.")
elif cars < people:
print("Don't take the cars!")
else:
print("We can't decide ;/")
if trucks > cars:
print("Too many trucks!")
elif trucks < cars:
print("Maybe we could take the trucks?")
else:
print("We can't decide.... |
import ast
from plotting.scriptGenerator import generatePython, generateR
from oceannavigator import create_app
import hashlib
import json
import unittest
from io import BytesIO
class TestScriptGenerator(unittest.TestCase):
@classmethod
def setUpClass(cls):
cls.app = create_app()
def test_genera... |
from __future__ import unicode_literals
import logging
import django.db.models
import django.core.cache
import django.template.defaultfilters
import django.urls
import shortuuidfield
logger = logging.getLogger(__name__)
class CobrandCompany(django.db.models.Model):
created_on = django.db.models.DateTimeField... |
# -*- coding: utf-8 -*-
##############################################################################
#
# OpenERP, Open Source Business Applications
# Copyright (c) 2012-TODAY OpenERP S.A. <http://openerp.com>
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of ... |
# -*- coding: utf-8 -*-
# Copyright (c) 2013 - 2015 CoNWeT Lab., Universidad Politécnica de Madrid
# This file belongs to the business-charging-backend
# of the Business API Ecosystem.
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU Affero General Public License... |
"""
Permissions classes for Discussion-API views.
"""
from rest_framework import permissions
from django.http import HttpResponse
import MySQLdb
from course_dashboard_api.v2.dbv import *
sql_user = MYSQL_USER
sql_pswd = MYSQL_PSWD
mysql_db = MYSQL_DB
class IsStudent(permissions.BasePermission):
"""
Grants ac... |
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.db import migrations, models
import django_extensions.db.fields
import django.utils.timezone
import django.db.models.deletion
from django.conf import settings
class Migration(migrations.Migration):
dependencies = [
('basket', '0... |
#
# (C) Copyright L.P.Klyne 2013
#
"""This is based on the basic ssh server example, the protocol handler has been pulled out as a separate
source as this is where the logic for the console server sits.
"""
import logging
_log = logging.getLogger(__name__)
import os
import grp
from zope.interface import implements
fr... |
"""
This module contains integer constants from a C header file named something
like gl2ext.h.
"""
GL_ETC1_RGB8_OES = 0x8D64
GL_PALETTE4_RGB8_OES = 0x8B90
GL_PALETTE4_RGBA8_OES = 0x8B91
GL_PALETTE4_R5_G6_B5_OES = 0x8B92
GL_PALETTE4_RGBA4_OES = 0x8B93
GL_PALETTE4_RGB5_A1_OES = 0x8B94
GL_PALETTE8_RGB8_OES = 0x8B95
GL_PA... |
#!/usr/bin/python2.7
# vim:ts=4:sw=4:softtabstop=4:smarttab:expandtab
import os
from setuptools import setup
NAME = "pycopia-aid"
#REVISION = os.environ.get("PYCOPIA_REVISION", "0standalone")
VERSION = "1.0"
setup (name=NAME, version=VERSION,
namespace_packages = ["pycopia"],
packages = ["pycopia",],
... |
#! /usr/bin/python
# -*- coding: utf-8 -*-
#########
#########
#Copyright (C) 2014-2015 Mark Spurgeon <theduck.dev@gmail.com>
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either v... |
import logging
from toybox.simpleapi import simple_view, run
from pyramid.security import Authenticated
from pyramid.authorization import ACLAuthorizationPolicy
from pyramid.security import Allow
# please: pip install pyramid_jwt
"""
python ./jwt_server.py
# 403
$ http GET :8080/secure
# 200 OK
$ http GET :8080/logi... |
# -*- coding: utf-8 -*-
#
# (c) Copyright 2001-2009 Hewlett-Packard Development Company, L.P.
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 2 of the License, or
# (at your opt... |
# coding=utf-8
# Author: Nick Sologoub
#
# URL: https://sick-rage.github.io
#
# This file is part of SickRage.
#
# SickRage 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 importlib.util
import json
from unittest import mock
import pandas as pd
import pytest
from great_expectations.dataset.sparkdf_dataset import SparkDFDataset
from great_expectations.util import is_library_loadable
def test_sparkdfdataset_persist(spark_session):
df = pd.DataFrame({"a": [1, 2, 3]})
sdf ... |
# -*- coding: utf-8 -*-
#
# File: COBAInternship.py
#
# Copyright (c) 2008 by []
# Generator: ArchGenXML Version 2.1
# http://plone.org/products/archgenxml
#
# GNU General Public License (GPL)
#
__author__ = """Andrew Schultz and Josh Klotz"""
__docformat__ = 'plaintext'
# Product configuration.
#
# The c... |
from functools import partial
from qt import QtWidgets, QtGui, QtCore
from zoo.libs import iconlib
from zoo.libs.utils import zlogging
logger = zlogging.getLogger(__name__)
class CommandActionBase(QtCore.QObject):
"""CommandUi class deals with encapsulating a command as a widget
"""
triggered = QtCore.S... |
from __future__ import unicode_literals
from django.db import models
from model_utils.models import TimeStampedModel
class User(TimeStampedModel):
"""
User class
"""
email = models.TextField(unique=True)
class DApp(TimeStampedModel):
"""
DApp class
"""
name = models.TextField()
... |
# Copyright (c) by it's authors.
# Some rights reserved. See LICENSE, AUTHORS.
from wallaby.pf.room import *
import wallaby.backends.couchdb as couchdb
from wallaby.plugins.couchdb.document import *
from wallaby.pf.peer.database import *
from wallaby.pf.peer.viewer import *
from wallaby.pf.peer.multiViewer import *
... |
# -*- coding: utf-8 -*-
#
# Copyright (C) 2014 Sean Poyser and Richard Dean (write2dixie@gmail.com)
#
# Modified for FTV Guide (09/2014 onwards)
# by Thomas Geppert [bluezed] - bluezed.apps@gmail.com
#
# This Program is free software; you can redistribute it and/or modify
# it under the terms of the GNU Gener... |
from parameterized import parameterized
from combinatrix.testintegration import load_parameter_sets
from doajtest.fixtures import ArticleFixtureFactory, AccountFixtureFactory, JournalFixtureFactory
from doajtest.helpers import DoajTestCase
from portality.bll import DOAJ
from portality.bll import exceptions
from portal... |
#!/usr/bin python
# -*- coding: utf-8 -*-
from pyqtgraph.Qt import QtCore
from pyqtgraph import BusyCursor
from lib.functions import plot_pandas
from lib.functions.general import getCallableArgumentList, isNumpyNumeric
from lib.flowchart.nodes.generalNode import NodeWithCtrlWidget, NodeCtrlWidget
class plotGWLvsWLNo... |
# ==================================================================================================
# Copyright 2012 Twitter, Inc.
# --------------------------------------------------------------------------------------------------
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use thi... |
import numpy as np
import pytest
from pandas import (
DataFrame,
IndexSlice,
Series,
)
pytest.importorskip("matplotlib")
pytest.importorskip("jinja2")
from pandas.io.formats.style import Styler
@pytest.fixture
def df():
return DataFrame([[1, 2], [2, 4]], columns=["A", "B"])
@pytest.fixture
def st... |
"""
Shell
Copyright (C) 2014 Walid Benghabrit
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 t... |
"""
=========================
Matplotlib With Glade 316
=========================
"""
from gi.repository import Gtk
from matplotlib.figure import Figure
from matplotlib.axes import Subplot
from numpy import arange, sin, pi
from matplotlib.backends.backend_gtk3agg import FigureCanvasGTK3Agg as FigureCanvas
class Win... |
# -*- coding: utf-8 -*-
# Copyright 2018 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 applicable law or... |
import datetime
from datetime import timedelta
from io import StringIO
import json
import os
import sys
import numpy as np
import pytest
from pandas.compat import IS64, PY38, is_platform_windows
import pandas.util._test_decorators as td
import pandas as pd
from pandas import DataFrame, DatetimeIndex, Series, Timesta... |
# 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 logging
from socorro.external.postgresql.base import PostgreSQLBase
from socorro.lib import datetime... |
"""
In this challenge, we're going to learn about the difference between a class and an instance;
because this is an Object Oriented concept, it's only enabled in certain languages.
Task
Write a Person class with an instance variable, age, and a constructor that takes an integer, initial_age, as a parameter.
The const... |
from setuptools import setup # Always prefer setuptools over distutils
from codecs import open # To use a consistent encoding
from os import path
here = path.abspath(path.dirname(__file__))
# Get the long description from the relevant file
with open(path.join(here, 'README.rst'), encoding='utf-8') as f:
long_de... |
# -*- coding: utf-8 -*-
# See https://zulip.readthedocs.io/en/latest/subsystems/events-system.html for
# high-level documentation on how this system works.
from typing import Any, Callable, Dict, List, Optional, Set, Tuple
import copy
import os
import shutil
import sys
from django.conf import settings
from django.http... |
'''
Aim :: To demonstrate the use of a dictionary
Define a simple dictionary , add values to it and iterate and print it
Dictionary works based on hashing principle ... simply said key,value pairs
** A dictionary object is a mutable datatype which means it couldnt be hashed
Anything that cant be hashed can... |
from django.core.urlresolvers import reverse
from avocado.formatters import registry
from serrano.formatters import HTMLFormatter
from brp_demo.models import *
from django.template import Context
from django.template.loader import get_template
from django.conf import settings
try:
from collections import OrderedDic... |
# -*- coding: utf-8 -*-
import re
from .content_buffer import ContentBuffer
from .error_handler import ErrorHandler
class Locator(object):
"""Simple locator used by :class:`~schema.DefaultReader`
"""
def __init__(self):
self.row= 0
self.col= 0
def __str__(self):
"""Con... |
# Twitter profile image updater
# http://twitter.com/account/update_profile_image.json
# image = [imagefile]
import sys
import os
import random
import re
import urllib
import json
import urllib2
import oauth2 as oauth
import time
import wcommon
def encode_file_data(image):
boundary = hex(int(time.time()))[2:]
he... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.