code stringlengths 1 199k |
|---|
'''
base tools
'''
import re
def is_ipv4(ip) :
pattern = r'^(25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[0-9]{1,2})(\.(25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[0-9]{1,2})){3}$'
matcher = re.match(pattern, ip)
if matcher is not None :
return True
return False
def is_domain(domain) :
pattern = r'[a-zA-Z0-9][-a-z... |
'''
pvaurora configuration file
'''
LATITUDE = 42.6
LONGITUDE = 12.9
API_KEY = "api_key_value"
SYSTEM_ID = -1 |
"""
/**
* Ossec Framework
*
* 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... |
import discord
from discord.ext import commands
from .utils import checks
from __main__ import send_cmd_help, settings
from cogs.utils.dataIO import dataIO
import os
import re
import asyncio
class Antilink:
"""Blocks Discord invite links from users who don't have the permission 'Manage Messages'"""
def __init__... |
from PyQt5 import QtCore, QtGui, QtWidgets
from PyQt5.QtGui import QPixmap, QMouseEvent
from PyQt5.QtWidgets import QToolButton
from PyQt5.QtCore import Qt, pyqtSignal
from models.components import *
class DraggableComponentButton(QToolButton):
mousePress = pyqtSignal(ComponentType, QMouseEvent, name='mousePress')
de... |
from __future__ import print_function, unicode_literals
import sys
from resources.lib.kodiutils import params as decode
class Params:
handle = int(sys.argv[1]) if len(sys.argv) > 1 else -1
orig_args = sys.argv[2] if len(sys.argv) > 2 else ''
args = decode(sys.argv[2]) if len(sys.argv) > 2 else {}
resume... |
"""Unit tests for gwsumm.html.static
"""
__author__ = 'Alex Urban <alexander.urban@ligo.org>'
from collections import OrderedDict
from .. import static
def test_get_css():
css = static.get_css()
assert isinstance(css, OrderedDict)
# test dict keys
assert list(css.keys()) == [
'font-awesome',
... |
import os
import sqlite3
from flask import Flask, request, session, g, redirect, url_for, abort, \
render_template, flash
app = Flask(__name__)
app.config.from_object(__name__)
app.config.update(dict(
DATABASE = os.path.join(app.root_path, 'makerlinks-dev.db'),
DEBUG = True,
APP_NAME = "MakerLinks",
SECRET_KEY = '... |
import unittest
"""996. Number of Squareful Arrays
https://leetcode.com/problems/number-of-squareful-arrays/description/
Given an array `A` of non-negative integers, the array is _squareful_ if for
every pair of adjacent elements, their sum is a perfect square.
Return the number of permutations of A that are squareful.... |
from __future__ import (absolute_import, division, print_function)
from mantid import config
import os
import systemtesting
import glob
EXPECTED_EXT = '.expected'
class ValidateInstrumentDefinitionFiles(systemtesting.MantidSystemTest):
xsdFile=''
# Explicitly specify single file to test. If None, test all.
... |
'''
This example shows how to use the os chdir command.
Note that an exception is thrown if a directory name which cannot be
changed to is supplied (bad name, access problem and more).
'''
import os # for chdir, system
try:
os.chdir('/tmpi')
except:
print('yes, got an exception for a bad directory')
os.chdir('... |
from datetime import datetime
import discord
from discord.ext import commands
import inspect
import logging
import os
import re
import textwrap
import time
from .mod import CaseMessageNotFound, NoModLogAccess
from .utils import checks
from .utils.chat_formatting import pagify, box, warning, error, info, bold
from .util... |
"""
ROS node for Neato XV-11 Robot Vacuum.
"""
__author__ = "ferguson@cs.albany.edu (Michael Ferguson)"
import roslib; roslib.load_manifest("neato_node")
import rospy
from math import sin,cos
from sensor_msgs.msg import LaserScan
from geometry_msgs.msg import Quaternion
from geometry_msgs.msg import Twist
from nav_msgs... |
from __future__ import print_function
from collections import Mapping
import inspect
import os
import re
import select
import signal
import sys
import threading
import traceback
if sys.version_info < (3,):
from SimpleXMLRPCServer import SimpleXMLRPCServer
from StringIO import StringIO
from xmlrpclib import ... |
"""
ETL North Carolina voter registration files
1. Read state-wide tab-delimited file
2. Narrow down the columns
3. Output all counties to a single CSV file
Source data available here:
https://www.ncsbe.gov/data-stats/other-election-related-data
http://dl.ncsbe.gov/data/ncvoter_Statewide.zip
"""
import glob
import sys
... |
'''
@author Michele Tomaiuolo - http://www.ce.unipr.it/people/tomamic
@license This software is free - http://www.gnu.org/licenses/gpl.html
'''
WEEK_DAYS = 7
MAX_WEEKS = 6
first = int(input("first (0-6)? "))
length = int(input("length (28-31)? "))
for i in range (WEEK_DAYS * MAX_WEEKS):
day = i + 1 - first
if ... |
"""
Purpose : Extract next sequence number of auto-scaled instance and set new tag to self instance. Script will be running from new instance.
will take input from command line instead of from json file
Future Plan :
will associate instance to a role based IAM profile
Usage :
python ec2-autoscale-instance-modify.py -a... |
import datetime
class Plan_BDI(object):
"""
class for handling various plans for AIKIF using
Belief | Desires | Intentions
"""
def __init__(self, name, dependency):
self.name = name
self.id = 1
self.dependency = dependency
self.plan_version = "v0.10"
self.succ... |
import re
import sys
import os
import numpy as np
import matplotlib.pyplot as plt
from matplotlib.ticker import NullFormatter # useful for `logit` scale
from mininet.log import setLogLevel, output, info
def sortDataFile(dataFilePath, dataFileDir):
dataFileList = os.listdir("%s/data/%s" % (dataFilePath, dataFileDir... |
roundcube = [
{'name':'common',
'mainpackage':True,
'shortdesc':'Installs the latest version of roundcube',
'description':'',
'packages':['roundcube-plugins', 'roundcube-plugins-extra', 'roundcube-amacube']
},
{'name':'mysql',
'shortdesc':'Installs roundcube using MySQL database',
'd... |
from selenium import webdriver
from django.test import LiveServerTestCase, TestCase
from django.contrib.staticfiles.testing import StaticLiveServerTestCase
import datetime
from planner.models import Participation, Event, Occurrence, EventType, Role
from django.contrib.auth.models import User
import pytz
import time
tz ... |
from collections import deque
import re
class Formula(object):
"""
Formula allows translation from a prefix-notation expression in a string to a complex number.
This is eventually to be replaced with a cython, c++, or openCL implementation as I'm sure
the performance of this class is... |
from recon.core.module import BaseModule
import codecs
import os
class Module(BaseModule):
meta = {
'name': 'List Creator',
'author': 'Tim Tomes (@LaNMaSteR53)',
'description': 'Creates a file containing a list of records from the database.',
'options': (
('table', 'hosts... |
"""
Jowa Header, Code # 4
Battery Voltage
"""
from common import JOWA_BATT_THRESHOLD, LOW_BATTERY
VOLTAGE = {
'name': 'voltage',
'formula': '2*adc_ref*(self/adc_max)',
'measuring_units': 'V',
'min_value': 0,
'max_value': 5,
'min_alarm': JOWA_BATT_THRESHOLD,
'min_alarm_message': LOW_BATTERY,
... |
class Solution(object):
def minCut(self, s):
"""
:type s: str
:rtype: int
"""
n = len(s)
if n <= 1: return 0
dp = [ n + 1 for x in xrange(n) ]
for i in xrange(n): # i Center, j center len
print("i ", i)
j = 0
... |
from ipctest import IpcTest
from gi.repository import i3ipc
import pytest
@pytest.mark.skip(reason='TODO')
class TestGetConfig(IpcTest):
def test_get_config(self, i3):
config = i3.get_config()
assert isinstance(config, i3ipc.ConfigReply)
with open('test/i3.config') as f:
assert c... |
from distutils.core import setup
import py2exe
setup(console=['newsputnik.py']) |
from django import forms
from poi_manager.models import Poi, PoiCategory
from mptt.forms import TreeNodeChoiceField
class PoiCategoryForm(forms.ModelForm):
cat_name = forms.CharField(max_length=128, help_text="Please enter the category name.")
parent = TreeNodeChoiceField(queryset=PoiCategory.objects.all(), req... |
from gnuradio import gr
from gnuradio import blocks, fft
import specest_gendpss
import specest_swig
class mtm(gr.hier_block2):
""" Estimates PSD using Thomson's multitaper method. """
def __init__(self, N=512 , NW=3 , K=5, weighting='adaptive', fftshift=False):
gr.hier_block2.__init__(self, "mtm",
... |
"""
Tool to recreate all tables/procedures in the database.
"""
import argparse
import copy
import re
from os import path
from src.sqllist import re_sub
try:
import monetdb.sql as db
try:
import monetdb.exceptions as me
except ImportError:
# Older version
import monetdb.monetdb_excep... |
from backend import init_backend, query_backend
def init_frontend(database, processors, reinit=False):
if len(processors) == 0:
raise Exception('Failed to initialize frontend: no processors given.')
try:
if reinit:
backend = reinit_backend(backend)
else:
backend =... |
from uitest.framework import UITestCase
import time
class tdf92611(UITestCase):
def test_launch_and_close_bibliography(self):
self.ui_test.create_doc_in_start_center("writer")
self.xUITest.executeCommand(".uno:BibliographyComponent")
time.sleep(2)
self.xUITest.executeCommand(".uno:Cl... |
"""djangochat URL Configuration
The `urlpatterns` list routes URLs to views. For more information please see:
https://docs.djangoproject.com/en/1.11/topics/http/urls/
Examples:
Function views
1. Add an import: from my_app import views
2. Add a URL to urlpatterns: url(r'^$', views.home, name='home')
Class-... |
import io
import pytest
import re
from collections import namedtuple
from unittest import mock
from toot import console, User, App, http
from toot.exceptions import ConsoleError
from tests.utils import MockResponse
app = App('habunek.com', 'https://habunek.com', 'foo', 'bar')
user = User('habunek.com', 'ivan@habunek.co... |
import json
from pimlico.datatypes.corpora.json import JsonDocumentType
from pimlico.cli.browser.tools.formatter import DocumentBrowserFormatter
class JsonFormatter(DocumentBrowserFormatter):
DATATYPE = JsonDocumentType()
def format_document(self, doc):
return json.dumps(doc.data, indent=4) |
import sys
import os
import numpy as np
sys.path.append(os.path.join(os.getcwd(), ".."))
from run_utils import run_kmc, parse_input
from ParameterJuggler import ParameterSet
def main():
controller, path, app, cfg, n_procs = parse_input(sys.argv)
alpha_values = ParameterSet(cfg, "alpha\s*=\s*(.*)\;")
alpha_v... |
__author__ = 'student'
import turtle
import math
turtle.shape('turtle')
def duga(r):
for i in range (20):
turtle.forward(r)
turtle.left(9)
def krug(r):
for i in range(72):
turtle.forward(r)
turtle.left(5)
turtle.penup()
turtle.forward(200) #Head
turtle.left(90)
turtle... |
import unittest
from aquarius.Aquarius import Aquarius
class ConsoleTestBase(unittest.TestCase):
def initialise_app_mock(self):
self.app = Aquarius(None, None, None)
def assert_called(self, method):
self.assertTrue(method.called) |
from __future__ import absolute_import
from django.utils.translation import ugettext_lazy as _
from common.utils import encapsulate
from documents.models import Document
from documents.permissions import (PERMISSION_DOCUMENT_NEW_VERSION,
PERMISSION_DOCUMENT_CREATE)
from navigation.api import register_links, registe... |
VERSION = "0.12beta4"
VERSION_NAME = "Anderssen" |
"""
Raspymc is a multimedia centre exposed via a http server built with bottlepy
Copyright (C) 2013 Giancarlo Fringuello
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 ver... |
"""#Versión de la calculadora."""
version = '1.0.0' |
import itertools as it
from operator import attrgetter
from flask import Markup, render_template, Blueprint, redirect, url_for, flash, abort, request
from sqlalchemy import desc
from .. import Execution, Stage, Task, TaskStatus
from ..job.JobManager import JobManager
from . import filters
from ..graph.draw import draw_... |
__problem_title__ = "Maximum Integer Partition Product"
__problem_url___ = "https://projecteuler.net/problem=374"
__problem_description__ = "An integer partition of a number is a way of writing as a sum of " \
"positive integers. Partitions that differ only in the order of their " \
... |
"""
Check local CleanerML files as a security measure
"""
from __future__ import absolute_import, print_function
from bleachbit import _, _p
import bleachbit
from bleachbit.CleanerML import list_cleanerml_files
from bleachbit.Options import options
import hashlib
import logging
import os
import random
import sys
logger... |
__all__ = 'HiddenPlayer',
from PySide.QtCore import QUrl
from sakurakit.skdebug import dprint
class _HiddenPlayer:
def __init__(self, parent):
self.parent = parent # QWidget
self._webView = None # QWebView
@property
def webView(self):
if not self._webView:
dprint("create web view")
from Py... |
from slpkg.messages import Msg
from slpkg.repositories import Repo
from slpkg.__metadata__ import MetaData as _meta_
class RepoList:
"""List of repositories
"""
def __init__(self):
self.meta = _meta_
self.green = self.meta.color["GREEN"]
self.red = self.meta.color["RED"]
self... |
from bs4 import BeautifulSoup
import requests, re
n = int(input('How many sudoku\'s do you want to download (between 1 and 10)? '))
if n < 1 or n > 10:
die()
url = 'http://show.websudoku.com/?level=4'
for i in range(n):
page = requests.get(url)
page.raise_for_status()
rawPage=page.text
sudokuid = int(re.search(r'\... |
import os
import json
import time
import functools
from PyQt5 import QtGui
from PyQt5 import QtCore
from PyQt5 import QtWidgets
from openroast import tools
from openroast.views import customqtwidgets
from openroast import utils as utils
class RecipeEditor(QtWidgets.QDialog):
def __init__(self, recipeLocation=None):... |
"""
input: a loaded image;
output: [[x,y],[width,height]] of the detected mouth area
"""
import cv
def findmouth(img):
# INITIALIZE: loading the classifiers
haarFace = cv.Load('haarcascade_frontalface_default.xml')
haarMouth = cv.Load('haarcascade_mouth.xml')
# running the classifiers
storage = cv.CreateMemSt... |
import json
import requests
from transliterate import translit
_eng_chars = "~!@#$%^&qwertyuiop[]asdfghjkl;'zxcvbnm,./QWERTYUIOP{}ASDFGHJKL:\"|ZXCVBNM<>?"
_rus_chars = "ё!\"№;%:?йцукенгшщзхъфывапролджэячсмитьбю.ЙЦУКЕНГШЩЗХЪФЫВАПРОЛДЖЭ/ЯЧСМИТЬБЮ,"
_trans_table = dict(zip(_eng_chars, _rus_chars))
def _fix_layout(s):
... |
import sys
def main():
print(1)
if __name__ == '__main__':
main() |
AGO_SCHEDULER_VERSION = '0.0.1'
"""
Basic class for device and device group schedule
"""
__author__ = "Joakim Lindbom"
__copyright__ = "Copyright 2017, Joakim Lindbom"
__date__ = "2017-01-27"
__credits__ = ["Joakim Lindbom", "The ago control team"]
__license__ = "GPL Public License Version 3"
__maintai... |
class Solution:
def depthSum(self, nestedList, d = 1):
"""
:type nestedList: List[NestedInteger]
:rtype: int
"""
if not nestedList: return 0
ans = 0
for nested_integer in nestedList:
if nested_integer.isInteger():
ans += nested_inte... |
import Image
from pytesser import *
import telnetlib
import base64
import StringIO
def main():
tn = telnetlib.Telnet("41.231.53.40",9090)
ret = tn.read_until("\n")
print ret
base64_str = ret.strip()
decode = base64.b64decode(base64_str)
buff = StringIO.StringIO()
buff.write(decode)
buff.... |
'''
Plot queue occupancy over time
'''
from helper import *
import plot_defaults
parser = argparse.ArgumentParser()
parser.add_argument('--files', '-f',
help="Queue timeseries output to one plot",
required=True,
action="store",
nargs='+',
... |
from __future__ import division
__author__ = "Greg Caporaso"
__copyright__ = "Copyright 2011-2013, The PICRUSt Project"
__credits__ = ["Greg Caporaso","Morgan Langille"]
__license__ = "GPL"
__version__ = "1.1.0"
__maintainer__ = "Greg Caporaso"
__email__ = "gregcaporaso@gmail.com"
__status__ = "Development"
from cogent... |
import numpy as np
from astropy.coordinates import Angle, Distance
from astropy import units as u
from .angles2Plane import gal_theta
def vdm_2001_dep_dist_kpc(rho, phi, glx_theta, glx_incl, D_0):
"""
Deprojected angular distance from vdM & Cioni (2001).
D is the distance associated to a point defined by it... |
import io
import sys
import tempfile
import time
import os
import traceback
from pathlib import Path
import gitlab
import requests
from .functions import (setLocalPath, showCommitDialog, logInPavlovia,
noGitWarning)
from psychopy.localization import _translate
from psychopy.projects import pavlo... |
import gi
try:
gi.require_version('Gtk', '3.0')
gi.require_version('Handy', '0.0')
except Exception as e:
print(e)
exit(1)
from gi.repository import Gtk
from gi.repository import Handy
import os
import urllib
import comun
from comun import _
from sidewidget import SideWidget
from settingsrow import Sett... |
"""
Copyright 2020 Paul Willworth <ioscode@gmail.com>
This file is part of Galaxy Harvester.
Galaxy Harvester is free software: you can redistribute it and/or modify
it under the terms of the GNU Affero General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at yo... |
from PyQt4 import QtCore, QtGui
try:
_fromUtf8 = QtCore.QString.fromUtf8
except AttributeError:
_fromUtf8 = lambda s: s
class Ui_ExportData(object):
def setupUi(self, ExportData):
ExportData.setObjectName(_fromUtf8("ExportData"))
ExportData.resize(354, 527)
self.verticalLayout_5 = Qt... |
from __future__ import absolute_import
import os
import re
import numpy as np
import tensorflow as tf
stop_words=set(["a","an","the"])
def load_candidates(data_dir, task_id):
assert task_id > 0 and task_id < 6
candidates=[]
candidates_f=None
candid_dic={}
#candidates_f='candidates.txt'
candidate... |
from django.conf.urls import patterns, include, url
from django.conf import settings
from django.views.generic import ListView
from django.views.generic.detail import DetailView
from foo.hotel.models import Hotel
from foo.hotel.views import HotelLimitListView
from foo.hotel.views import HotelLimitNoOrderListView
urlpat... |
import logging
from scap.model.xs.StringType import StringType
logger = logging.getLogger(__name__)
class VariableIdPattern(StringType):
# <xsd:pattern value="oval:[A-Za-z0-9_\-\.]+:var:[1-9][0-9]*"/>
def get_value_pattern(self):
return r'oval:[A-Za-z0-9_\-\.]+:var:[1-9][0-9]*' |
from PyQt5 import QtCore
from PyQt5.QtCore import pyqtProperty
from friture.ballistic_peak import BallisticPeak
from friture.level_data import LevelData
class LevelViewModel(QtCore.QObject):
two_channels_changed = QtCore.pyqtSignal(bool)
def __init__(self, parent=None):
super().__init__(parent)
... |
import os
import time
import json
import tools
from filesystem import File
import cli
import system
import missions
SAVEGAME = "{}.sav"
DOWNLOADS_DIR = "C:\\Descargas"
class Game(object):
def __init__(self):
self.running = True
print("Bienvenido a Haxxor Engine.")
try:
self.name ... |
"""
Support for creating a service which runs a web server.
@since: 1.0
"""
import logging
from twisted.python import usage
from twisted.application import service
from acidswf.service import createAMFService
optParameters = [
['log-level', None, logging.INFO, 'Log level.'],
['amf-transport', None, 'http', 'Run... |
__author__ = 'Paolo Bellagente'
from sqlalchemy import *
from sqlalchemy.ext.declarative import declarative_base
from sqlalchemy.orm import relationship, sessionmaker
import datetime
db_name = "testDatabase"
db_uid = "root"
db_passwd = ""
db_host = "localhost"
engine = create_engine('mysql+pymysql://'+db_uid+':'+db_pas... |
import sys
from mock import (
patch, Mock
)
from pytest import raises
from ..test_helper import argv_kiwi_tests
import kiwi
from kiwi.exceptions import KiwiFileSystemSetupError
from kiwi.builder.filesystem import FileSystemBuilder
class TestFileSystemBuilder:
@patch('kiwi.builder.filesystem.FileSystemSetup')
... |
"""
This file is part of contribution to the OAD Data Science Toolkit.
This 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.
The software is d... |
"""setup
(C) Franck Barbenoire <fbarbenoire@yahoo.fr>
License : GPL v3"""
from distutils.core import setup
from setuptools import find_packages
setup(name = "django-openzoom",
version = "0.1.1",
description = "Django application for displaying very high resolution images",
author = "Franck Barbenoire",
... |
from tests.base_test import BaseTest
from tests import config
from core import modules
from core.sessions import SessionURL
from testfixtures import log_capture
from core import messages
import logging
import os
import subprocess
class FileBzip(BaseTest):
# Create and bzip2 binary files for the test
binstring =... |
from PyQt4 import Qt, QtGui, QtCore
from .uic_generated.PaymentMethodDialog import Ui_PaymentMethodDialog
from ..shopping.payment_methods import PAYMENT_METHODS
import functools
class PaymentMethodDialog(QtGui.QDialog, Ui_PaymentMethodDialog):
def __init__(self, parent, cfg, amount):
QtGui.QDialog.__init__(... |
__author__ = 'Debha'
from read_data import read_data, read_map, gene_muts, make_GO_map
from cluster import make_cluster_mat, make_sub_mut_map, make_GO_cluster_mat, cluster_main, clean, pairwiseDist, clustered_GOs, sim_matrix
import numpy as np
data_file = "../inputs/somatic.csv"
map_file = "../inputs/mart_export.csv"
G... |
__author__="aabilio"
__date__ ="$15-may-2011 11:03:38$"
from Descargar import Descargar
from utiles import salir, formatearNombre, printt
import sys
class TeleVigo(object):
'''
Clase que maneja la descarga los vídeos de TeleVigo
'''
URL_TeleVigo = "http://www.televigo.com/"
def __init__(self, ur... |
from django import forms
from django.core.urlresolvers import reverse
from django.forms.widgets import RadioFieldRenderer
from django.utils.encoding import force_text
from django.utils.html import format_html
from django.utils.safestring import mark_safe
class BootstrapChoiceFieldRenderer(RadioFieldRenderer):
"""
... |
from __future__ import unicode_literals # implicitly declaring all strings as unicode strings
import logging
import wikipedia
from mainClass import *
from static import *
logging = logging.getLogger(__name__)
CHOSENNUMBER = "numero"
LIST = "liste"
RECHERCHE = "recherche"
FR = "fr"
EN = "en"
FOUND = "Voici tous les titr... |
import re, requests, collections, praw, time
words=list()
syl=collections.OrderedDict()
cmudict=urllib.request.urlopen('http://svn.code.sf.net/p/cmusphinx/code/trunk/cmudict/cmudict.0.7a').read()
cmudict=cmudict.decode('utf8')
cmudict=cmudict.lower().split('\n')
unclutter=[i for j in (range(66), range(71, 73), range(75... |
import urlparse,urllib2,urllib,re
import os
from core import scrapertools
from core import logger
from core import config
def test_video_exists( page_url ):
logger.info("[wupload.py] test_video_exists(page_url='%s')" % page_url)
# Existe: http://www.wupload.com/file/2666595132
# No existe: http://www.wuploa... |
import contextlib
import threading
import mwparserfromhell
import ws.ArchWiki.lang as lang
from ws.utils import LazyProperty
from ws.parser_helpers.title import canonicalize
from ws.parser_helpers.wikicode import get_parent_wikicode, get_adjacent_node
__all__ = ["get_edit_summary_tracker", "localize_flag", "CheckerBase... |
def get_initials(fullname):
fullname = fullname.split(' ')
initials = ''
# accumulator pattern
for eachName in fullname:
initials = initials + eachName[0].upper()
return initials
def main():
inputName = input("What is your full name?\n")
print(get_initials(inputName))
if __name__ == ... |
from __future__ import division, print_function, unicode_literals |
from main.management.commands._private import SharedCommand
from main.models import Destination
class Command(SharedCommand):
model = Destination |
"""Tests for UnauthenticatedReddit class."""
from __future__ import print_function, unicode_literals
from mock import patch
from praw import handlers
from random import choice
from six.moves import cStringIO
from .helper import PRAWTest, betamax, replace_handler
class HandlerTest(PRAWTest):
def setUp(self):
... |
import sys
import os
def service_path2service_name(service_path):
basename = os.path.basename(service_path)
return basename[:-len('.py')]
if __name__ == "__main__":
sys.exit(1) |
"""
Fichier main qui lance le programme
"""
from Game import *
game = Game()
game.play() |
__isBlock__ = True
__className__ = "ANDGate"
__win__ = "ANDGateWindow"
from PyQt4.QtCore import *
from PyQt4.QtGui import *
from PyQt4 import uic
from lib.Block import *
class ANDGate(Block):
""" AND Gate
PORTS SPECIFICATIONS
"""
# TODO: Specifications of AND Gate (Documentation)
def __init__(se... |
from base.error import *
class CoreError (LoggableError):
pass |
"""Unit tests of assorted base data structures and common functions."""
import pytest
from simtools.base import Dict, is_iterable, is_string
def test_is_iterable():
# List of integers
obj = [1, 2, 3]
assert is_iterable(obj) == True
# Tuple of integers
obj = 1, 2, 3
assert is_iterable(obj) == Tru... |
__author__ = 'AminHP'
import os
import shutil
import zipfile
import StringIO
import base64
from flask import jsonify, request, g, send_file, abort
from project import app
from project.extensions import db, auth
from project.modules.datetime import utcnowts
from project.modules.paginator import paginate
from project.mod... |
try:
import shade
HAS_SHADE = True
except ImportError:
HAS_SHADE = False
DOCUMENTATION = '''
---
module: os_project
short_description: Manage OpenStack Projects
extends_documentation_fragment: openstack
version_added: "2.0"
author: "Alberto Gireud (@agireud)"
description:
- Manage OpenStack Projects. Pr... |
from openstates.utils import LXMLMixin
from billy.scrape.votes import VoteScraper, Vote
from billy.scrape.utils import convert_pdf
import datetime
import subprocess
import lxml
import os
import re
journals = "http://www.leg.state.co.us/CLICS/CLICS%s/csljournals.nsf/" \
"jouNav?Openform&%s"
date_re = re.compile(
... |
from PyQt5 import QtCore
from src.business.configuration.constants import project as p
from src.ui.commons.verification import cb
class ConfigProject:
def __init__(self):
self._settings = QtCore.QSettings(p.CONFIG_FILE, QtCore.QSettings.IniFormat)
def get_value(self, menu, value):
return self._s... |
import sys
import typing
import click
import glotaran as gta
from . import util
@click.option('--dataformat', '-dfmt', default=None,
type=click.Choice(gta.io.reader.known_reading_formats.keys()),
help='The input format of the data. Will be infered from extension if not set.')
@click.option('... |
from traits.api import \
provides
from oricreate.opt import \
IFu
from .fu import \
Fu
@provides(IFu)
class FuPotEngBending(Fu):
'''Optimization criteria based on minimum Bending energy of gravity.
This plug-in class lets the crease pattern operators evaluate the
integral over the spatial domain... |
CATKIN_PACKAGE_PREFIX = ""
PROJECT_PKG_CONFIG_INCLUDE_DIRS = "/home/jorge/tum_simulator_ws/install/include".split(';') if "/home/jorge/tum_simulator_ws/install/include" != "" else []
PROJECT_CATKIN_DEPENDS = "message_runtime".replace(';', ' ')
PKG_CONFIG_LIBRARIES_WITH_PREFIX = "".split(';') if "" != "" else []
PROJECT... |
from src import model as mdl
class LaTeXPrinter(object):
def __init__(self, target_file_path):
self._target_file_path = target_file_path
def run(self):
with open(self._target_file_path, 'w') as output:
text = self._generate_text()
output.write(text)
def _generate_text... |
from distutils.core import setup
from distutils.core import Command
from distutils.command.clean import clean as distutils_clean
from distutils.command.sdist import sdist as distutils_sdist
import glob
import os
import shutil
from qr_gui import Config
def build_data_files():
data_files = []
for dir, dirs, files... |
import os
import unittest
import sys
sys.path.insert(0, os.path.abspath(os.path.join(os.path.dirname(__file__), '..')))
import chemlab.gromacs_topology
class TestTopologyReader(unittest.TestCase):
@classmethod
def setUpClass(cls):
cls.topol_file = 'topol.top'
cls.gt = chemlab.gromacs_topology.Gr... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.