src stringlengths 721 1.04M |
|---|
import numpy as np
import pandas as pd
import urllib2
from sklearn import linear_model
from sklearn import metrics
from sklearn import cross_validation
from bs4 import BeautifulSoup
def get_tag_name(tag_url):
"""Takes a Atlas Obscura db dump and turns the tag_url into bare tags."""
return tag_url.split('/')[2... |
from datetime import datetime
from decimal import Decimal
from libmt94x.currency_codes import CurrencyCodes
from libmt94x.info_acct_owner_subfields import BeneficiaryParty
from libmt94x.info_acct_owner_subfields import BusinessPurpose
from libmt94x.info_acct_owner_subfields import Charges
from libmt94x.info_acct_owner... |
# -*- coding: utf-8 -*-
"""The initialization file for the Pywikibot framework."""
#
# (C) Pywikibot team, 2008-2018
#
# Distributed under the terms of the MIT license.
#
from __future__ import absolute_import, unicode_literals
__release__ = '3.0-dev'
__url__ = 'https://www.mediawiki.org/wiki/Special:MyLanguage/Manual... |
#!/usr/bin/env python
import numpy as np
import math
from multi_link_common import *
#height is probably 0 from multi_link_common.py
#total mass and total length are also defined in multi_link_common.py
num_links = 8.0
link_length = total_length/num_links
link_mass = total_mass/num_links
ee_location = np.matrix([0.,... |
# -*- coding: utf-8 -*-
"""
* Purpose : managing user account registration and login
* Creation Date : 22-10-2014
* Last Modified : Mo 02 Mär 2015 15:23:28 CET
* Author : maltsev
* Coauthors : mattis, christian
* Sprintnumber : 1
* Backlog entry : RUA1, RUA4
"""
import re
import urllib
import datetime
from d... |
# -*- coding: utf-8 -*-
# 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
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or... |
#!/usr/bin/env python
import sys, json, datetime, uuid, os
def main(separator='\t'):
id = str(uuid.uuid1())
date_created = datetime.datetime.utcnow().isoformat() + 'Z'
mu = float(os.environ['MU']) if os.environ.has_key('MU') else 0.002
eta = float(os.environ['ETA']) if os.environ.has_key('ETA') else... |
#-------------------------------------------------------------------------------
# Copyright 2017 Cognizant Technology Solutions
#
# 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
#
# ... |
import os
import json
import threading
import boto3
from boto3.s3.transfer import S3Transfer
from elrond.crypto import get_file_digest
DEFAULT_CHUNK_SIZE = 64 * 1024 * 1024
ELROND_S3_SINGLETON_CLIENT = None
ELROND_S3_SUPPORTED_REGIONS = [
'EU',
'eu-west-1',
'us-west-1',
'us-west-2',
'ap-south-1'... |
# Copyright 2017 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 os
import io
import itertools
import types
from ochre.Sequence import Seq
class SeqList(object):
"""
A Python object that represents a collection of sequences.
The underlying storage can be in a file (through the
subclass FileSeqList) or in a list of Seq objects.
"""
def __new__(cls, sq... |
class Stock:
def __init__(self, Company_name):
""" the constructor for the TextModel class
all dictionaries are started at empty
the name is just for our own purposes, to keep things
organized
"""
self.Company_name = Company_name
... |
#!/usr/bin/env python
#
# Copyright 2015 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.
"""Install *_incremental.apk targets as well as their dependent files."""
import argparse
import glob
import logging
import os
impor... |
"""
Groups that are used for element types, such as TCPServiceGroup,
Group (generic), etc. All group types inherit from GroupMixin which
allow for modifications of existing groups and their members.
"""
from smc.base.model import Element, ElementCreator
from smc.api.exceptions import ElementNotFound
from smc.base.util ... |
"""
This is a subfile for IsyClass.py
These funtions are accessable via the Isy class opj
"""
# author: Peter Shipley <peter.shipley@gmail.com>
# copyrigh: Copyright (C) 2013 Peter Shipley
# license: BSD
from ISY.IsyUtilClass import et2d
from ISY.IsyExceptionClass import IsyResponseError, IsyValueError
##
## netw... |
"""
WSGI config for InstitutionalPortal project.
This module contains the WSGI application used by Django's development server
and any production WSGI deployments. It should expose a module-level variable
named ``application``. Django's ``runserver`` and ``runfcgi`` commands discover
this application via the ``WSGI_AP... |
# Copyright 2010 OpenStack 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 b... |
# -*- coding: utf-8 -*-
##
## This file is part of Indico.
## Copyright (C) 2002 - 2014 European Organization for Nuclear Research (CERN).
##
## Indico 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 ... |
'''
MSRA INIT
net parameter initialization.
He K, Zhang X, Ren S, et al.
Delving Deep into Rectifiers: Surpassing Human-Level Performance on ImageNet Classification,
arxiv:1502.01852
Reference:http://damon.studio/2017/06/11/WeightsInitialization/
'''
import torch.nn as nn
import torch.nn.init as init
'''
usage:
class... |
# -*- coding: utf-8 -*-
"""
flango.template
~~~~~~~~~~~~~~
template module provide a simple template system that compiles
templates to Python code which like django and tornado template
modules.
Usage
-----
Well, you can view the tests file directly for the usage under tests.
Bas... |
import GUI.MainWindow
__author__ = 'tom'
from PyQt4.QtGui import *
from GUI.Schemes.gazeboGui import Ui_gazebo_gui
from BAL.Interface.DeviceFrame import SERVO, BATTERY, SWITCH, IMU, PPM, GPS, RELAY, URF, CLOSE_LOP_ONE, CLOSE_LOP_TWO, \
OPEN_LOP, DIFF_CLOSE, DIFF_OPEN, EX_DEV, HOKUYO, OPRNNI, USBCAM, DIFF_CLOSE_FOU... |
#!/usr/bin/env python
from setuptools import setup
setup(name='screenkey', version='0.9',
description='A screencast tool to display keys',
author='Pablo Seminario',
author_email='pabluk@gmail.com',
maintainer='Yuri D\'Elia',
maintainer_email='wavexx@thregr.org',
license='GPLv3+',
... |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
"""Update encrypted deploy password in Travis config file."""
from __future__ import print_function
import base64
import json
import os
from getpass import getpass
import yaml
from cryptography.hazmat.primitives.serialization import load_pem_public_key
from cryptography.h... |
# $Id$
import optparse
import os
class CommandLine:
"""A helper class for canary command line tools. When you use
CommandLine you will get a --config option for free, and a handy
method for instantiating a Context() object.
cmdline = CommandLine()
cmdline.parse_args()
con = cmdline.context()
... |
#!/usr/bin/python
'''
Extract _("...") strings for translation and convert to Qt stringdefs so that
they can be picked up by Qt linguist.
'''
from __future__ import division,print_function,unicode_literals
from subprocess import Popen, PIPE
import glob
import operator
import os
import sys
OUT_CPP="qt/infinitumstrings.... |
#!/usr/bin/python
# -*- coding: utf-8 -*-
import urllib, os
from django.core import serializers
from django.contrib.auth import login, logout, authenticate
from django.contrib.auth.decorators import login_required, permission_required
from django.contrib.auth.models import User
from django.conf import settings
from... |
# This file is part of Tautulli.
#
# Tautulli 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.
#
# Tautulli is distributed in the ... |
#!/usr/bin/python
# Standard Library
import json
import time
import logging
import socket
from threading import Thread, Lock
# Third Party
# Local
# set up logging
logging.basicConfig(level=logging.INFO)
logger = logging.getLogger(__name__)
class EventBroadcastReceiver:
def __init__(self, host='localhost',... |
#!/usr/bin/env python2
# vim:fileencoding=UTF-8:ts=4:sw=4:sta:et:sts=4:ai
from __future__ import print_function
__license__ = 'GPL v3'
__copyright__ = '2010, Kovid Goyal <kovid@kovidgoyal.net>'
__docformat__ = 'restructuredtext en'
import os, errno
from threading import Thread, Event
from PyQt5.Qt import QDialog, ... |
# Gufw 12.10.0 - http://gufw.tuxfamily.org
# Copyright (C) 2008-2011 Raul Soriano https://launchpad.net/~gatoloko
# Marcos Alvarez Costales https://launchpad.net/~costales
#
# Gufw is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as p... |
from itertools import chain
try: # When this is imported in Kataja context
from plugins.TreesAreMemory.Constituent import Constituent
from plugins.TreesAreMemory.Feature import Feature
from kataja.syntax.SyntaxState import SyntaxState
from plugins.TreesAreMemory.utils import simple_bracket_tree_... |
# Imports {{{
from PIL import Image as PImage
from dbe.settings import MEDIA_ROOT, MEDIA_URL
from dbe.social.models import *
from dbe.shared.utils import *
from dbe.classviews.list_custom import ListView, ListRelated
from dbe.classviews.edit_custom import CreateView, UpdateView2
from forms import ProfileForm, PostFo... |
# -*- coding: utf-8 -*-
# Copyright 2009-2010 Simon Edwards <simon@simonzone.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 version 2 of the License, or
# (at your option) any... |
# -*- encoding: utf-8 -*-
# This file is distributed under the same license as the Django package.
#
from __future__ import unicode_literals
# The *_FORMAT strings use the Django date format syntax,
# see http://docs.djangoproject.com/en/dev/ref/templates/builtins/#date
DATE_FORMAT = 'j N Y'
DATETIME_FORMAT = ... |
# Copyright (c) 2017 Open Source Foundries Limited.
#
# SPDX-License-Identifier: Apache-2.0
'''Sphinx extensions related to managing Zephyr applications.'''
from docutils import nodes
from docutils.parsers.rst import Directive
from docutils.parsers.rst import directives
# TODO: extend and modify this for Windows.
#... |
import pkgutil
import os.path
from ctypes import c_void_p
import numpy as np
import OpenGL.GL as gl
import OpenGL.error
from .gl_rendering import Node, Technique, Material, Program, DTYPE_COMPONENT_TYPE, Texture
from .gl_primitives import PlanePrimitive
NULL_PTR = c_void_p(0)
# TODO: pkgutils way
TEXTURES_DIR = o... |
# -*- encoding: utf-8 -*-
##############################################################################
#
# Copyright (C) 2009 EduSense BV (<http://www.edusense.nl>).
# (C) 2011 - 2013 Therp BV (<http://therp.nl>).
# (C) 2011 Smile (<http://smile.fr>).
# All Rights Reserved
#
# This ... |
""" Test refcounting and behavior of SCXX.
"""
from __future__ import absolute_import, print_function
import time
import sys
from numpy.testing import TestCase, dec, assert_, assert_raises
from scipy.weave import inline_tools
# Test:
# append DONE
# insert DONE
# in... |
#!/usr/bin/env python
#
# @license Apache-2.0
#
# Copyright (c) 2018 The Stdlib 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
#
# ... |
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
#
# Copyright (C) 2020 The SymbiFlow Authors.
#
# Use of this source code is governed by a ISC-style
# license that can be found in the LICENSE file or at
# https://opensource.org/licenses/ISC
#
# SPDX-License-Identifier: ISC
import os
from BaseRunner import BaseRunner
... |
# pma.py --maxTransitions 100 --output PeriodFiveFSM1 LoadFirst Marquee DisplayFive
# 6 states, 6 transitions, 6 accepting states, 0 unsafe states, 0 finished and 0 deadend states
# actions here are just labels, but must be symbols with __name__ attribute
def Load(): pass
def Shift(): pass
# states, key of each sta... |
import numpy as np
import glob
import sys
import random
class record_fetcher(object):
'''
creates feature arrays and labels from raw accelerometer/demographic data
splits features and labels between subjects into test/train sets
methods:
- fetch(batch_size,minibatch_size,binary,seed)
... |
# -*- coding: utf-8 -*-
#
# Licensed to the Apache Software Foundation (ASF) under one
# or more contributor license agreements. See the NOTICE file
# distributed with this work for additional information
# regarding copyright ownership. The ASF licenses this file
# to you under the Apache License, Version 2.0 (the
#... |
"""
Admin settings for OdeToJS
Copyright (C) 2015 Rik de Graaff
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 option) any later... |
import unittest
import os
import sys
import shutil
import string
from optparse import OptionParser
import ConfigParser
import logging
print "sys.path", sys.path
import coshsh
from coshsh.contact import Contact
from coshsh.contactgroup import ContactGroup
from coshsh.host import Host
from coshsh.application import Appl... |
""" This contains various helper functions for the Digital Slide Archive"""
import re, csv, os, sys, optparse
import collections
from PIL import Image
import openslide
from openslide.lowlevel import OpenSlideError
import hashlib
import subprocess
import shutil,glob
import random
from functools import partial
def md5su... |
from django.core.management.base import BaseCommand, CommandError
from django.db.models.query_utils import Q
from seqr.models import Project, VariantTagType
from seqr.model_utils import create_seqr_model
class Command(BaseCommand):
def add_arguments(self, parser):
parser.add_argument('--project', help='... |
import unittest
import multiprocessing
import numpy as np
from crashsimilarity.stacktrace import StackTraceProcessor
from crashsimilarity.models import doc2vec, word2vec
class CrashSimilarityTest(unittest.TestCase):
# Train Model to be used in all tests
@classmethod
def setUpClass(self):
self.pat... |
# Copyright (C) 2015 Hydriz Scholz
#
# 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 ... |
#!/usr/bin/env python3
# Copyright (c) 2014-2015 The Bitcoin Core developers
# Copyright (c) 2015-2016 The Bitcoin Unlimited developers
# Distributed under the MIT software license, see the accompanying
# file COPYING or http://www.opensource.org/licenses/mit-license.php.
#
# Test fee estimation code
#
from collectio... |
# python
# Steady hands game
# run with - sudo python SteadyRa.py
# updated to be Revision Aware, to cope with board revisions 1 & 2
import RPi.GPIO as GPIO
import time
def findRevision():
global boardRevision
fin = open('/proc/cpuinfo')
boardRevision = -1
while True: # go through the file line by li... |
# test basic float capabilities
# literals
print(.12)
print(1.)
print(1.2)
print(0e0)
print(0e+0)
print(0e-0)
# float construction
print(float(1.2))
print(float("1.2"))
print(float("+1"))
print(float("1e1"))
print(float("1e+1"))
print(float("1e-1"))
print(float("inf"))
print(float("-inf"))
print(float("INF"))
print(f... |
# -*- coding: utf-8 -*-
# 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
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or... |
#
# Copyright (c) SAS Institute 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 in w... |
import re, datetime
from lib import Activity
# Pattern for MAC addresses.
# Example "B6:B7:E3:AC:D8:09"
MAC_PATTERN = r"(([0-9A-Fa-f]{2}[:]){5}([0-9A-Fa-f]{2}))"
# Pattern for not associated string.
# Example "(not associated) "
NOT_ASSOCIATED_PATTERN = r"(\(not associated\) )"
# Pattern for MAC addresses or not as... |
"""Test VarKey, Variable, VectorVariable, and ArrayVariable classes"""
import unittest
import numpy as np
from gpkit import (Monomial, NomialArray, Variable, VarKey,
VectorVariable, ArrayVariable)
import gpkit
from gpkit.nomials import Variable as PlainVariable
class TestVarKey(unittest.TestCase):
... |
import os
import sys
import string
import array
import types
import copy
from var import var
# Don't bother with NexusToken2, cuz sets blocks are small
from nexustoken import nexusSkipPastNextSemiColon, safeNextTok
import func
from p4exceptions import P4Error
# [Examples from the paup manual,
# but note the bad charp... |
# -*- coding: utf-8 -*-
"""
Created on Mon Nov 19 16:39:13 2018
A much faster PRF fitter, with the caveat that the psf model is hardcoded.
psffit.py can fit an arbitrary PSF model to an image. The cost of this flexibility
is that it must perform numerical intergration to calculate the flux in each pixel.
This is slo... |
"""This module contains functions for Zernike calculations. Mainly the private
function _zgen, a generator function for Zernike polynomials. The public
functions make use of _zgen to create height or slope maps in a unit
pupil, corresponding to individual Zernike terms.
Author: Ravi S. Jonnal / Werner Lab, UC Davis
R... |
"""Hash tables."""
import bst
class HashTable(object):
"""Class object for our Hash Table."""
def __init__(self, bucket_number, function='fnv'):
"""Init for our hash.
Accepts a string to determine which hash the table uses.
"""
self.bucket_list = []
self.function = fu... |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
# __BEGIN_LICENSE__
# Copyright (c) 2009-2013, United States Government as represented by the
# Administrator of the National Aeronautics and Space Administration. All
# rights reserved.
#
# The NGT platform is licensed under the Apache License, Version 2.0 (the
# "Lic... |
import json
import numpy as np
from pyplanknn.layer import Layer
from pyplanknn.convlayer import ConvPoolLayer
class ConvNetwork:
"""
A neural network comprised of several layers interconnected.
"""
def __init__(self, n_convs=10, hidden=4, n_outs=121):
"""
Create a series of layers.
... |
##########################################################################
#
# Copyright (c) 2019, Image Engine Design 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:
#
# * Redistrib... |
# encoding: utf-8
from inspect import isroutine
from marrow.schema import Attribute
from marrow.schema.transform import BaseTransform
from marrow.schema.validate import Validator
from ..query import Queryable
from ..util import adjust_attribute_sequence
from ..util.compat import py3
@adjust_attribute_sequence(1000,... |
#!/usr/bin/env python3
from cozify import hub
import numpy, time
from absl import flags, app
FLAGS = flags.FLAGS
flags.DEFINE_string('device', None, 'Device to operate on.')
flags.DEFINE_float('delay', 0.5, 'Step length in seconds.')
flags.DEFINE_float('steps', 20, 'Amount of steps to divide into.')
flags.DEFINE_bool... |
"""library functions for pipelines
"""
#--- standard library imports
#
import os
import sys
import subprocess
import logging
import shutil
import smtplib
from email.mime.text import MIMEText
from getpass import getuser
#import socket
import time
from datetime import datetime
from datetime import timedelta
import calen... |
# -*- coding: utf-8 -*-
#
# This file is part of Invenio.
# Copyright (C) 2011, 2012, 2013, 2014 CERN.
#
# Invenio 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... |
#!/usr/bin/env python
from setuptools import setup
__version__ = None
with open('pylm/__init__.py') as f:
exec(f.read())
long_description = """
Pylm
====
Pylm is the Python implementation of PALM, a framework to build
clusters of high performance components. It is presented in two
different levels of abstracti... |
from hubcheck.pageobjects.widgets.groups_wiki_new_form import \
GroupsWikiNewForm1, GroupsWikiNewForm1_Locators_Base, \
GroupsWikiNewForm2, GroupsWikiNewForm2_Locators_Base, \
GroupsWikiNewForm3, GroupsWikiNewForm3_Locators_Base
from hubcheck.pageobjects.basepageelement import Link
class GroupsWikiEditFor... |
# (C) Copyright 2015-2016 Hewlett Packard Enterprise Development LP
# Copyright 2017 Fujitsu LIMITED
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICE... |
##########################################################################
#
# Copyright (c) 2015, Image Engine Design 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:
#
# * Redistrib... |
# This file is part of DEAP.
#
# DEAP 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 3 of
# the License, or (at your option) any later version.
#
# DEAP is distributed ... |
# -*- coding: utf-8 -*-
#
# Copyright © 2012 - 2016 Michal Čihař <michal@cihar.com>
#
# This file is part of Weblate <https://weblate.org/>
#
# 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, eith... |
from __future__ import print_function
# from builtins import range
from six.moves import cPickle as pickle
import numpy as np
import os
from scipy.misc import imread
import platform
def load_pickle(f):
version = platform.python_version_tuple()
if version[0] == '2':
return pickle.load(f)
elif vers... |
# -*- coding: UTF-8 -*-
import unittest
import uuid
import pytz
from geopy import Point
from geopy.compat import u
from geopy.exc import GeocoderAuthenticationFailure, GeocoderQueryError
from geopy.geocoders import GeoNames
from test.geocoders.util import GeocoderTestBase, env
class GeoNamesTestCaseUnitTest(Geocode... |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
import sys
import time
import random
from selenium import webdriver
from selenium.webdriver.common.by import By
from selenium.webdriver.common.keys import Keys
from selenium.webdriver.common.action_chains import ActionChains
from selenium.common.exceptions import NoSuchEle... |
# coding=utf-8
# Copyright 2021 The TensorFlow Datasets 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 appl... |
#!/usr/bin/python
""" Converts eiti csv to json """
import json
import csv
# import sys
# import pycountry
def main():
""" main function """
with open('./source_data.csv', 'rU') as infile:
csv_reader = csv.reader(infile, delimiter=',', quotechar='"')
header = next(csv_reader)
# lkey = ... |
'''
Created on 06 lug 2017
@author: mantica
References:
- https://github.com/Azure/lstms_for_predictive_maintenance/blob/master/Deep%20Learning%20Basics%20for%20Predictive%20Maintenance.ipynb
- https://gallery.cortanaintelligence.com/Experiment/Predictive-Maintenance-Step-2A-of-3-train-and-evaluate-regression... |
import re
import subprocess
import sys
class Solver():
def __init__(self, ubcsat = "ubcsat"):
self._ubcsat = ubcsat
self._nvar = 0
self._clauses = []
self._soft_clauses = []
def newvar(self):
self._nvar += 1
return self._nvar
def add_clause(self, clause):
... |
import re
import pandas as pd
ACLED_FILE = 'ACLED-All-Africa-File_20170101-to-20170429.csv'
def clean_and_save():
encoding_key = 'iso-8859-1'
df = pd.read_csv(ACLED_FILE, encoding=encoding_key)
print df.head()
print df.columns
print df.describe()
cleaned_file = 'cleaned_{}'.format(ACLED_FILE)... |
#!/usr/bin/env python3
# update/cn_loc.py - script to fetch data from the CN Open Data community
#
# Copyright (C) 2014-2015 Jiangge Zhang
# Copyright (C) 2015-2019 Arthur de Jong
#
# This library is free software; you can redistribute it and/or
# modify it under the terms of the GNU Lesser General Public
# License as... |
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
from ..oauthlib.common import extract_params
from ..oauthlib.oauth1 import (Client, SIGNATURE_HMAC, SIGNATURE_TYPE_AUTH_HEADER)
CONTENT_TYPE_FORM_URLENCODED = 'application/x-www-form-urlencoded'
CONTENT_TYPE_MULTI_PART = 'multipart/form-data'
import sys
... |
###############################################################################
#
# The MIT License (MIT)
#
# Copyright (c) Tavendo 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 with... |
"""Functions used to generate source files during build time
All such functions are invoked in a subprocess on Windows to prevent build flakiness.
"""
from platform_methods import subprocess_main
class RDHeaderStruct:
def __init__(self):
self.vertex_lines = []
self.fragment_lines = []
se... |
# -*- coding: utf-8 -*-
"""
Class_HydroData provides functionalities for handling data obtained in the context of (waste)water treatment.
Copyright (C) 2016 Chaim De Mulder
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 Fre... |
"""
analysis/network.py
Functions to plot and analyze connectivity-related results
Contributors: salvadordura@gmail.com
"""
from __future__ import print_function
from __future__ import division
from __future__ import unicode_literals
from __future__ import absolute_import
from builtins import open
from builtins impo... |
import jenkinsapi
from jenkinsapi.jenkins import Jenkins
import sys
import time
import os
#check & kill dead buid
def build_time(_job,_threshold):
#get jenkins-job-watchdog-threshold
#Get last build running
build = _job.get_last_build()
running = build.is_running()
print 'build_job:',_job,'running:... |
# ===============================================================================
# Copyright 2015 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... |
# ParanoiDF. A combination of several PDF analysis/manipulation tools to
# produce one of the most technically useful PDF analysis tools.
#
# Idea proposed by Julio Hernandez-Castro, University of Kent, UK.
# By Patrick Wragg
# University of Kent
# 21/07/2014
#
# With thanks to:
# Julio... |
#!/usr/bin/python
#
# Copyright (c) 2016 Matt Davis, <mdavis@ansible.com>
# Chris Houseknecht, <house@redhat.com>
#
# GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt)
from __future__ import absolute_import, division, print_function
__metaclass__ = type
ANS... |
# -*- coding: utf-8 -*-
import datetime
from south.db import db
from south.v2 import SchemaMigration
from django.db import models
from ..utils import get_user_model
User = get_user_model()
user_orm_label = '%s.%s' % (User._meta.app_label, User._meta.object_name)
user_model_label = '%s.%s' % (User._meta.app_label, Us... |
#!/usr/bin/python
#######################################################
# Copyright (c) 2015, ArrayFire
# All rights reserved.
#
# This file is distributed under 3-clause BSD license.
# The complete license agreement can be obtained at:
# http://arrayfire.com/licenses/BSD-3-Clause
####################################... |
# -* coding: utf-8 -*-
#
# License: MIT (see LICENSE file provided)
# vim: set expandtab tabstop=4 shiftwidth=4 softtabstop=4:
"""
**polib** allows you to manipulate, create, modify gettext files (pot, po and
mo files). You can load existing files, iterate through it's entries, add,
modify entries, comments or metada... |
# -*- coding: utf-8 -*-
from django.utils import timezone
from django.contrib.contenttypes.models import ContentType
from django.contrib.contenttypes.fields import GenericForeignKey
from django.db import models, transaction
from django.db.models import F
from django.utils.translation import ugettext_lazy as _
from dja... |
# Copyright (c) 2014 Yubico AB
# All rights reserved.
#
# 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... |
##
# Copyright (c) 2008-2013 Sprymix Inc.
# All rights reserved.
#
# See LICENSE for details.
##
class AdapterError(Exception):
pass
class Adapter(type):
adapters = {}
instance_adapters = {}
def __new__(mcls, name, bases, clsdict, *, adapts=None,
adapts_instances_of=None, pure... |
import os
import libcnml
import networkx
from netdiff import CnmlParser, diff
from netdiff.exceptions import ParserError
from netdiff.tests import TestCase
CURRENT_DIR = os.path.dirname(os.path.realpath(__file__))
cnml1 = '{0}/static/26494_detail_1.cnml'.format(CURRENT_DIR)
cnml2 = '{0}/static/26494_detail_2.cnml'.f... |
# vim: tabstop=4 shiftwidth=4 softtabstop=4
# Copyright 2012 OpenStack 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
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless requ... |
# Copyright 2015 Tesora Inc.
# 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 a... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.