repo_name
stringlengths
5
104
path
stringlengths
4
248
content
stringlengths
102
99.9k
Senspark/app-stores-toolkit
populate-v2.py
#!/usr/bin/python # -*- coding: utf-8 -*- import sys import os, os.path import json import shutil import urllib2 import argparse import cgi from PIL import Image PRIVACY_URL = "http://senspark.com/privacy-policy" MARKETING_URL = "http://senspark.com" SUPPORT_URL = "http://fb.com/teamsenspark" IOS_LANGUAGES_CODES ...
skywalka/splunk-for-nagios
bin/liveservicealerts.py
# Script to list remote services (not ok) in Nagios by accessing MK Livestatus # Required field to be passed to this script from Splunk: n/a import socket,string,sys,re,mklivestatus import splunk.Intersplunk results = [] try: results,dummyresults,settings = splunk.Intersplunk.getOrganizedResults() for r in ...
openstreams/wflow
wflow/wflow_snow.py
#!/usr/bin/python # Wflow is Free software, see below: # # Copyright (c) J. Schellekens/Deltares 2005-2011 # # 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 ...
zhangjiajie/PTP
nexus/bin/nexus_describetaxa.py
#!/usr/bin/env python """Displays some simple nexus info""" __author__ = 'Simon Greenhill <simon@simon.net.nz>' import sys from nexus import NexusReader from nexus.tools import check_for_valid_NexusReader def print_taxa_stats(nexus_obj): """ Prints the taxa state statistics for a given `nexus_obj` :...
fedebell/Laboratorio3
relazione4/errorPropagation.py
import pylab import scipy import uncertainties import uncertainties.umath from uncertainties import ufloat from uncertainties import unumpy import numpy #Inserire a mano i risultati del fit #IMPORTANTE: Formalismo per trattare variabili con associata una covarianza, non #ho mai implementato per ora una an...
ARG-TLQ/Red-DiscordBot
cogs/heist/heist.py
import re import asyncio import datetime import bisect import os import random import string import time from ast import literal_eval from operator import itemgetter from redbot.core import checks, Config, bank import discord from redbot.core import commands from redbot.core.data_manager import bundled_data_path from r...
qilicun/python
python2/PyMOTW-1.132/PyMOTW/cmd/cmd_simple.py
#!/usr/bin/env python # encoding: utf-8 # # Copyright (c) 2008 Doug Hellmann All rights reserved. # """ """ __version__ = "$Id$" #end_pymotw_header import cmd class HelloWorld(cmd.Cmd): """Simple command processor example.""" def do_greet(self, line): print "hello" def do_EOF(self, line...
cerndb/storage-api
storage_api/utils.py
""" This file contains various utilities, including this recipe for an ordered set http://code.activestate.com/recipes/576694/ """ import logging import sys def init_logger( tag = 'SAPI', level = logging.INFO, line = '%(asctime)s [%(filename)s:%(lineno)d] [%(process)d] %(levelname)s %(name)s %(message)s',...
eblume/Tiger-Lily
tigerlily/sequences/fasta.py
# fasta.py - NCBI-compatible FASTA formatted sequences # Authors: # * Erich Blume <blume.erich@gmail.com> # # Copyright 2011 Erich Blume <blume.erich@gmail.com> # # This file is part of Tiger Lily. # # Tiger Lily is free software: you can redistribute it and/or modify # it under the terms of the GNU General Pub...
IZSVenezie/VetEpiGIS-Stat
plugin/scan_dialog.py
# -*- coding: utf-8 -*- # Form implementation generated from reading ui file 'scan_dialog_base.ui' # # Created: Sat Jan 7 15:11:01 2017 # by: PyQt4 UI code generator 4.10.4 # # WARNING! All changes made in this file will be lost! from PyQt4 import QtCore, QtGui try: _fromUtf8 = QtCore.QString.fromUtf8 exce...
yam655/bittyband
bittyband/importlister.py
#!/usr/bin/env python3 """Handle importer of audio files""" from pathlib import Path from configparser import ConfigParser import taglib import pyglet import time from .importer import Importer from .utils.time import human_duration, reasonable_time class ImportLister: def __init__(self, config): self...
andredriem/KarmaTrain
tests/db_management_test.py
import unittest import karmatrain.db_management as db_management # CONSTANTS FOR TESTING SD1 = {"title": "title1", "selftext": "selftext1", "subreddit": "brasil", "time": 1234, "thread_id": "1DFGG"} SD2 = {"title": "title2", "selftext": "selftext1", "subreddit": "brasil2", "time": 1234, "thread_id": "2DFGG"} SD3 = {...
OsirisSPS/osiris-sps
client/data/extensions/4A7F130B4A5C42CC5D928D157641596A89543C65/scripts/index.py
import os import osiris import sys class Page(osiris.IMainPage): def __init__(self, session): osiris.IMainPage.__init__(self, session) def getPageName(self): return "extensions.4A7F130B4A5C42CC5D928D157641596A89543C65.index" def onPreRender(self): osiris.IMainPage.onPreRender(self) document = o...
spenteco/linoleumBlocks
config/flowers.py
# linoleumBlocks CONFIG FILE. DICTIONARY MUST BE NAMED CONFIG config = { # None, OR AN INTEGER 'resizeWidth': 750, # BOOLEAN #'posterize': True, 'posterize': False, # None (defaults to 2), or int 'posterize-value': None, #'posterize-value': 5, # None...
mcoughli/root_of_trust
experiments/password_manager/experiment_enclave.py
#!/usr/bin/python3 import pexpect import os import time import hashlib import random import string import datetime ITERATIONS=25 def get_random_password(length): characters = string.ascii_lowercase + string.ascii_uppercase + string.digits password = "".join(random.SystemRandom().choice(characters) for _ in r...
dataxu/ansible
lib/ansible/modules/utilities/logic/set_fact.py
#!/usr/bin/python # -*- coding: utf-8 -*- # Copyright 2013 Dag Wieers <dag@wieers.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 ANSIBLE_METADATA = {'metadata_version': '1.1', ...
flowcb/awi
src/config.py
#!/usr/bin/env python # -*- coding: utf-8 -*- from __future__ import print_function import sys import numpy as np reload(sys) sys.setdefaultencoding("utf-8") class Config: EMBEDDING_SIZE = 128 ENCODER_SEQ_LENGTH = 5 ENCODER_NUM_STEPS = ENCODER_SEQ_LENGTH DECODER_SEQ_LENGTH = ENCODER_NUM_STEPS + ...
jkolczasty/appletree
appletree/gui/qt.py
#!/usr/bin/env python3 # # Copyright 2017+ Jakub Kolasa <jkolczasty@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 version 3 of the License, or # ...
dagwieers/ansible
lib/ansible/modules/cloud/google/gcp_compute_target_ssl_proxy.py
#!/usr/bin/python # -*- coding: utf-8 -*- # # Copyright (C) 2017 Google # GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt) # ---------------------------------------------------------------------------- # # *** AUTO GENERATED CODE *** AUTO GENERATED CODE *** # ...
snowsquizy/SBC_and_ML
HP/controller.py
#!/usr/bin/env python3 """ Asynchronous Tic Tac Toe Solver Andrew Taylor 2017 UNSW - Engineering Project Adjust Variables to suit the hardware to be run on then:- For use with CPU just run with python3 controller.py For use with GPU just run with python3 controller.py For use with Cluster run the followin...
pacificclimate/crmprtd
tests/test_download.py
import pytest from crmprtd.download import extract_auth, https_download @pytest.mark.parametrize( ("user", "password", "expected"), ( ("foo", "bar", {"u": "foo", "p": "bar"}), ("foo", None, {"u": "foo", "p": ""}), (None, "bar", {"u": "", "p": "bar"}), (None, None, {"u": "user_...
jkthompson/nupic
examples/opf/experiments/anomaly/spatial/novel_combination/description.py
# ---------------------------------------------------------------------- # Numenta Platform for Intelligent Computing (NuPIC) # Copyright (C) 2013, Numenta, Inc. Unless you have an agreement # with Numenta, Inc., for a separate license for this software code, the # following terms and conditions apply: # # This progra...
jithinbp/pslab-desktop-apps
PSL_Apps/templates/widgets/pwmWidget.py
# -*- coding: utf-8 -*- # Form implementation generated from reading ui file 'pwmWidget.ui' from PyQt4 import QtCore, QtGui try: _fromUtf8 = QtCore.QString.fromUtf8 except AttributeError: def _fromUtf8(s): return s try: _encoding = QtGui.QApplication.UnicodeUTF8 def _translate(context, text,...
maciekswat/Twedit
dummy_application.py
#!/usr/bin/env python from PyQt5.QtCore import (QTimer) from PyQt5.QtWidgets import (QAction, QApplication, QFileDialog, QMainWindow, QMessageBox, QTextEdit) class MainWindow(QMainWindow): def __init__(self): super(MainWindow, self).__init__() if __name__ == '__main__': import sys ap...
mganeva/mantid
scripts/HFIR_4Circle_Reduction/peak_integration_utility.py
# Mantid Repository : https://github.com/mantidproject/mantid # # Copyright &copy; 2018 ISIS Rutherford Appleton Laboratory UKRI, # NScD Oak Ridge National Laboratory, European Spallation Source # & Institut Laue - Langevin # SPDX - License - Identifier: GPL - 3.0 + # Utility methods to do peak integration from...
MLOrsini/ProjetWEB
INSport/tableaubord/migrations/0079_auto_20170511_1818.py
# -*- coding: utf-8 -*- # Generated by Django 1.11 on 2017-05-11 18:18 from __future__ import unicode_literals import datetime from django.db import migrations, models class Migration(migrations.Migration): dependencies = [ ('tableaubord', '0078_auto_20170511_1731'), ] operations = [ mi...
airodactyl/qutebrowser
qutebrowser/misc/utilcmds.py
# vim: ft=python fileencoding=utf-8 sts=4 sw=4 et: # Copyright 2014-2018 Florian Bruhin (The Compiler) <mail@qutebrowser.org> # # This file is part of qutebrowser. # # qutebrowser 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 S...
smurfix/HomEvenT
test/database1.py
#!/usr/bin/python # -*- coding: utf-8 -*- ## ## Copyright © 2008-2012, Matthias Urlichs <matthias@urlichs.de> ## ## 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 L...
henrysher/aws-cloudinit
tests/unittests/test_util.py
# pylint: disable=C0301 # the mountinfo data lines are too long import os import stat import yaml from mocker import MockerTestCase from unittest import TestCase from cloudinit import importer from cloudinit import util class FakeSelinux(object): def __init__(self, match_what): self.match_what = match_...
civiclaboratories/planbox
src/shareabouts_integration/views.py
import json import re import requests from requests.auth import HTTPBasicAuth from django.conf import settings from django.http import HttpResponse, Http404 from django.contrib.auth.decorators import login_required from django.core.signing import Signer from planbox_data.models import Project from shareabouts_integrati...
alfa-jor/addon
plugin.video.alfa/channels/cumlouder.py
# -*- coding: utf-8 -*- import re import urllib import urlparse from core import httptools from core import scrapertools from core.item import Item from platformcode import config, logger host = 'https://www.cumlouder.com' def mainlist(item): logger.info() itemlist = [] config.set_sett...
umlfri/umlfri2
umlfri2/qtgui/newproject/newproject.py
import html from PyQt5.QtCore import Qt, QSize from PyQt5.QtGui import QPalette from PyQt5.QtWidgets import QDialog, QDialogButtonBox, QVBoxLayout, QListWidget, QLabel, QSizePolicy, \ QListWidgetItem, QCheckBox, QLineEdit, QFormLayout, QFrame from umlfri2.application import Application from umlfri2.qtgui.base impo...
magchips/labalyzer
labalyzer_lib/PreferencesDialog.py
# -*- Mode: Python; coding: utf-8; indent-tabs-mode: nil; tab-width: 4 -*- ### BEGIN LICENSE # Copyright (C) 2010 <Atreju Tauschinsky> <Atreju.Tauschinsky@gmx.de> # This program is free software: you can redistribute it and/or modify it # under the terms of the GNU General Public License version 3, as published # by ...
Ban3/python-evic
evic/aprom.py
# -*- coding: utf-8 -*- """ Evic is a USB programmer for devices based on the Joyetech Evic VTC Mini. Copyright © Jussi Timperi 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...
thozza/energy-track
energytrack/gui/edit_values_window.py
#!/usr/bin/env python # # -*- coding: utf-8 -*- # # measurement_window.py - # Copyright 2013 Tomas Hozza <thozza@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 version 3 of ...
SnowWalkerJ/quantlib
quant/data/wind/tables/mergerparticipant.py
from ....common.db.sql import VARCHAR, Numeric as NUMBER, DateTime as DATETIME, Column, BaseModel, CLOB, DATE VARCHAR2 = VARCHAR class MergerParticipant(BaseModel): """ 4.112 并购事件参与方 Attributes ---------- object_id: VARCHAR2(100) 对象ID event_id: VARCHAR2(20) 情报ID(或事件ID) ...
ivmech/iviny-scope
lib/xlsxwriter/test/comparison/test_defined_name03.py
############################################################################### # # Tests for XlsxWriter. # # Copyright (c), 2013, John McNamara, jmcnamara@cpan.org # import unittest import os from ...workbook import Workbook from ..helperfunctions import _compare_xlsx_files class TestCompareXLSXFiles(unittest.TestC...
NicovincX2/Python-3.5
Algorithmique/Algorithme/Algorithme de la théorie des graphes/strongly_connected_components_directed_graph.py
# -*- coding: utf-8 -*- import os def strongly_connected_components_path(vertices, edges): """ Find the strongly connected components of a directed graph. Uses a recursive linear-time algorithm described by Gabow [1]_ to find all strongly connected components of a directed graph. Parameters ...
MattNolanLab/ei-attractor
grid_cell_model/simulations/007_noise/interactive_visualisation/__init__.py
# # __init__.py # # package initialisation script # # Copyright (C) 2013 Lukas Solanka <l.solanka@sms.ed.ac.uk> # # 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 Foundati...
badlands-model/pyBadlands
badlands/badlands/forcing/xmlParser.py
##~#~#~#~#~#~#~#~#~#~#~#~#~#~#~#~#~#~#~#~#~#~#~#~#~#~#~#~#~#~#~#~#~#~#~#~#~#~#~#~#~#~## ## ## ## This file forms part of the Badlands surface processes modelling application. ## ## ...
jsbitcoin/bpp-client
gui/bpp.py
#!/usr/bin/python # -*- coding: utf-8 -*- # BPP - lightweight XMPP Bitcoin payment protocol client # Copyright (C) 2014 jsbitcoin import sys import os import json import string import random import sleekxmpp import electrum.deterministic as Btclib import sqlite3 as Db import logging from PySide import QtCore, QtGui #...
fernandog/Sick-Beard
sickbeard/tv.py
# Author: Nic Wolfe <nic@wolfeden.ca> # URL: http://code.google.com/p/sickbeard/ # # This file is part of Sick Beard. # # Sick Beard 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 t...
manuelalcocer/easyproxmox
wsgi/mybottleapp.py
#!/usr/bin/env python2 # -*- coding: utf-8 -*- from bottle import route, default_app, template, static_file, request, redirect from beaker.middleware import SessionMiddleware import requests import os from eproxlib.datacenter import DataCenter as MyDataCenter from eproxlib.datacenter import DataBase as MyDataBase ...
clinton-hall/nzbToMedia
libs/common/beets/util/artresizer.py
# -*- coding: utf-8 -*- # This file is part of beets. # Copyright 2016, Fabrice Laporte # # 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 t...
jbernardis/repraptoolbox
src/Plater/rotatedlg.py
import wx BUTTONDIM = (48, 48) class RotateDlg(wx.Dialog): def __init__(self, parent, stlframe, images, pos): wx.Dialog.__init__(self, parent, wx.ID_ANY, "", style=0, pos=pos) self.stlFrame = stlframe self.parent = parent sizer = wx.BoxSizer(wx.HORIZONTAL) vsizer = wx.BoxSizer(wx.VERTICAL) bRot45CCW =...
cosven/FeelUOwn
feeluown/utils/utils.py
# -*- coding: utf-8 -*- import logging import os import sys import socket import time from collections import OrderedDict from copy import copy, deepcopy from functools import wraps from itertools import filterfalse from feeluown.utils.reader import wrap as reader_wrap logger = logging.getLogger(__name__) def is_...
oczkers/gdown
gdown/__init__.py
# -*- coding: utf-8 -*- """ gdown ~~~~~~~~~~~~~~~~~~~~~ gdown is a simple library for managing sharing websites (like netload.in). Usage: >>> from gdown import hotfile >>> hotfile.accInfo('login', 'password') { 'email': 'sample@email.com', 'id': 542, 'status': 'premium', ...
mpskex/GRiNa
SDK/ResScript.py
#coding: utf-8 import os import binascii def fromHDR(filename): with open(filename) as f: lines = f.readlines() res_list = [] for line in lines: r_line = [] line = line.split('\n')[0] line = line.split(' ') ret = [] for substr in l...
iABC2XYZ/abc
Epics/rnn/testDynamicRNN5.py
#!/usr/bin/env python # -*- coding: utf-8 -*- import tensorflow as tf import numpy as np X = tf.random_normal(shape=[3, 5, 6], dtype=tf.float32) X = tf.reshape(X, [-1, 5, 6]) cell = tf.nn.rnn_cell.BasicLSTMCell(10) # 也可以换成别的,比如GRUCell,BasicRNNCell等等 lstm_multi = tf.nn.rnn_cell.MultiRNNCell([cell] * 2, state_is_tuple...
JoErNanO/brianmodel
brianmodel/neuron/ioniccurrent/ioniccurrenthhwang.py
#!/usr/bin/python # coding: utf-8 # ################################################################################# # Copyright (C) 2015 Francesco Giovannini, Neurosys - INRIA CR Nancy - Grand Est # Authors: Francesco Giovannini # email: francesco.giovannini@inria.fr # website: http://neurosys.loria.fr/ # Permission...
fixbugs/py-fixbugs-tools
test/sc_rep.py
#!/usr/bin/env python #coding=utf-8 from db import DB db = DB(DB_NAME='venus') tables = db.query("show tables;") count = 0 for t in tables: nowTableName = t[0] if nowTableName == 'vs_log': continue db = DB(DB_NAME='venus') getAllSql = "select * from " + nowTableName + ";" print getAllSql ...
ninja-ide/ninja-ide
ninja_ide/gui/dialogs/plugins_manager.py
# -*- coding: utf-8 -*- # # This file is part of NINJA-IDE (http://ninja-ide.org). # # NINJA-IDE 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 # any later version. # # NIN...
nive-cms/nive
nive/tests/test_portal.py
import time import unittest from nive.portal import Portal from nive.definitions import ConfigurationError from nive.helper import Event from nive.definitions import OperationalError from test_nive import testapp, mApp2, mApp class portalTest(unittest.TestCase): def setUp(self): self.portal = ...
icea-dev/atn-sim-ng
configs/core/home/myservices/spoofer.py
# # CORE # Copyright (c)2010-2012 the Boeing Company. # See the LICENSE file included in this distribution. # ''' Sample user-defined service. ''' import os from core.service import CoreService, addservice from core.misc.ipaddr import IPv4Prefix, IPv6Prefix class AdsbSpoofer(CoreService): ''' This is a sample u...
JarbasAI/jarbas-core
mycroft/jarbas-skills/LILACS_knowledge/services/dbpedia/__init__.py
import json from os.path import abspath import spotlight import urlfetch from mycroft.messagebus.message import Message import sys from os.path import dirname sys.path.append(dirname(dirname(dirname(dirname(__file__))))) from LILACS_knowledge.services import KnowledgeBackend from mycroft.util.log import getLogger # ...
ufukdogan92/is-teklif-sistemi
adres/models.py
#! -*- coding:utf-8 -*- from django.db import models from django.contrib.auth.models import User from kullanici.models import IsVeren class Adres(models.Model): kullanici = models.ForeignKey(IsVeren,related_name="adres") adres_basligi = models.CharField(max_length=50) adres = models.CharField(max_length=80...
seismology-RUB/ASP3D
asp3d/gui/layouts/postprocessing_layout.py
# -*- coding: utf-8 -*- # Form implementation generated from reading ui file 'postprocessing_layout.ui' # # Created: Fri Mar 10 10:39:40 2017 # by: pyside-uic 0.2.15 running on PySide 1.2.2 # # WARNING! All changes made in this file will be lost! from PySide import QtCore, QtGui class Ui_postprocessing(object):...
pdautry/py_rest
pyrest/rest_server/firewall/rule.py
#!/usr/bin/python3 # -!- encoding:utf8 -!- """ PyREST Copyright (C) 2016 Paul Dautry 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 ve...
jiemakel/omorfi
src/python/generate-guessers.py
#!/usr/bin/env python3 # -*- coding: utf8 -*- """ This script generates Finnish omorfi morphotactics into a lexc format guesser. It is assumed that the database contains at least following information for each paradigm: * the word lemma pattern as regular expression * the word stub deletion as fixed string matc...
tarikgwa/nfd
newfies/dialer_settings/tests.py
# # Newfies-Dialer License # http://www.newfies-dialer.org # # 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/. # # Copyright (C) 2011-2014 Star2Billing S.L. # # The primar...
garciparedes/python-examples
numerical/math/algebra/matrix_decomposition/qr/givens_rotations.py
#!/usr/bin/env python3 from typing import Tuple import numpy as np def rotator(A: np.ndarray, i: int, j: int, k: int) -> np.ndarray: G = np.eye(A.shape[0]) r = np.sqrt(A[i, k] ** 2 + A[j, k] ** 2) if A[j, k] != 0: G[i, i] = A[i, k] / r G[i, j] = A[j, k] / r G[j, i] = - A[j, k] / ...
Zephor5/img_to_txt
img_to_ascii.py
# coding=utf-8 from __future__ import division """ 好玩的基于PIL的图片转字符画~~ """ import sys import os import re import random from cStringIO import StringIO from PIL import Image, ImageFont, ImageDraw __author__ = 'Eric Wu' __version__ = 0.1 __filename__ = os.path.basename(sys.argv[0]) __dir__ = os.getcwd...
simar7/build-mozharness
configs/single_locale/macosx64.py
config = { # mozconfig file to use, it depends on branch and platform names "platform": "macosx64", "update_platform": "Darwin_x86_64-gcc3", "mozconfig": "%(branch)s/browser/config/mozconfigs/macosx-universal/l10n-mozconfig", "bootstrap_env": { "SHELL": '/bin/bash', "MOZ_OBJDIR": "ob...
csirtgadgets/bearded-avenger-sdk-py
cifsdk/utils/__init__.py
import pkgutil import logging from cifsdk.constants import LOG_FORMAT, RUNTIME_PATH, LOGLEVEL, VERSION from argparse import ArgumentParser import signal import yaml import os def read_config(args): options = {} if os.path.isfile(args.config): with open(args.config) as f: config = yaml.saf...
MJVarghese/is210-week-05-synthesizing
task_01.py
#!/usr/bin/env python # -*- coding: utf-8 -*- """My Task 1 File.""" import datetime CURDATE = None def get_current_date(): """ This is to return the current day as a date object.""" return datetime.date.today() if __name__ == '__main__': CURDATE = get_current_date() print CURDATE
BYK/fb2goog
parsers.py
import time import urllib import posixpath import xml.dom.minidom as dom def extract_path(link, attribute_name='href'): return urllib.unquote(link.getAttribute(attribute_name).encode('utf-8')) def FBdatetime2timestamp(dtime): try: # try to parse using standard US date format return str(int(time.mkt...
cstipkovic/spidermonkey-research
js/src/gdb/mozilla/autoload.py
# mozilla/autoload.py: Autoload SpiderMonkey pretty-printers. print("Loading JavaScript value pretty-printers; see js/src/gdb/README.") print("If they cause trouble, type: disable pretty-printer .* SpiderMonkey") import gdb.printing import mozilla.prettyprinters # Import the pretty-printer modules. As a side effect,...
opentrials/opentrials-airflow
dags/nct.py
import datetime import airflow.hooks.base_hook from airflow.models import DAG from airflow.operators.latest_only_operator import LatestOnlyOperator import utils.helpers as helpers from operators.http_to_s3_transfer import HTTPToS3Transfer args = { 'owner': 'airflow', 'depends_on_past': False, 'start_date':...
lafranceinsoumise/api-django
agir/polls/migrations/0011_auto_20190114_1514.py
# Generated by Django 2.1.5 on 2019-01-14 14:14 from django.db import migrations, models import django.utils.timezone class Migration(migrations.Migration): dependencies = [("polls", "0010_auto_20181128_1616")] operations = [ migrations.AlterField( model_name="poll", name="c...
pictuga/morss
morss/util.py
# This file is part of morss # # Copyright (C) 2013-2020 pictuga <contact@pictuga.com> # # This program is free software: you can redistribute it and/or modify it under # the terms of the GNU Affero General Public License as published by the Free # Software Foundation, either version 3 of the License, or (at your optio...
vnsofthe/odoo-dev
addons/web/controllers/main.py
# -*- coding: utf-8 -*- import ast import base64 import csv import functools import glob import itertools import jinja2 import logging import operator import datetime import hashlib import os import re import simplejson import sys import time import urllib2 import zlib from xml.etree import ElementTree from cStringIO ...
eduNEXT/edx-platform
cms/djangoapps/contentstore/views/tests/test_transcripts.py
"""Tests for items views.""" import copy import json import tempfile import textwrap from codecs import BOM_UTF8 from unittest.mock import Mock, patch from uuid import uuid4 import ddt from django.conf import settings from django.test.utils import override_settings from django.urls import reverse from edxval.api imp...
renzon/wttd
eventex/subscriptions/migrations/0001_initial.py
# -*- coding: utf-8 -*- # Generated by Django 1.11.2 on 2017-06-07 19:23 from __future__ import unicode_literals from django.db import migrations, models class Migration(migrations.Migration): initial = True dependencies = [] operations = [ migrations.CreateModel( name='Subscription...
hasgeek/funnel
funnel/models/sponsor_membership.py
from __future__ import annotations from typing import Set from werkzeug.utils import cached_property from coaster.sqlalchemy import DynamicAssociationProxy, immutable, with_roles from . import db from .helpers import reopen from .membership_mixin import ImmutableProfileMembershipMixin, ReorderMembershipMixin from ....
etalab/udata
udata/core/dataset/views.py
from collections import defaultdict, OrderedDict from flask import abort, request, url_for, redirect from werkzeug.contrib.atom import AtomFeed from udata.core.site.models import current_site from udata.frontend.views import DetailView, SearchView from udata.i18n import I18nBlueprint, lazy_gettext as _ from udata.mod...
jolyonb/edx-platform
lms/djangoapps/lti_provider/tasks.py
""" Asynchronous tasks for the LTI provider app. """ import logging from django.contrib.auth.models import User from opaque_keys.edx.keys import CourseKey import lti_provider.outcomes as outcomes from lms import CELERY_APP from lms.djangoapps.grades.api import CourseGradeFactory from lti_provider.models import Grade...
gam-phon/taiga-back
taiga/webhooks/permissions.py
# Copyright (C) 2014-2016 Andrey Antukh <niwi@niwi.nz> # Copyright (C) 2014-2016 Jesús Espino <jespinog@gmail.com> # Copyright (C) 2014-2016 David Barragán <bameda@dbarragan.com> # Copyright (C) 2014-2016 Alejandro Alonso <alejandro.alonso@kaleidos.net> # This program is free software: you can redistribute it and/or mo...
rbanffy/naziscore
src/naziscore/handlers.py
# -*- coding:utf-8 -*- import csv import datetime import json import logging import webapp2 from collections import Counter from google.appengine.api import ( memcache, urlfetch ) from google.appengine.ext import ndb from naziscore.deplorable_constants import get_constant as c from naziscore.models import S...
medialab/hyphe
bin/create_webentities_from_csv.py
#!/usr/bin/env python # -*- coding: utf-8 -*- import os import re import sys import csv import json from time import sleep from getpass import getpass import click import jsonrpclib from progressbar import ProgressBar @click.command() @click.argument('csv_file') @click.argument('corpus_id') @click.argument('api_url...
gs0510/coala-bears
bears/yaml/YAMLLintBear.py
from coalib.bearlib.abstractions.Linter import linter from dependency_management.requirements.PipRequirement import PipRequirement import yaml @linter(executable='yamllint', output_format='regex', output_regex=r'.+:(?P<line>\d+):(?P<column>\d+): ' r'\[(?P<severity>error|warning)\]...
open-craft/edx-analytics-pipeline
edx/analytics/tasks/event_exports.py
"""Group events by institution and export them for research purposes""" import logging import os import gzip from collections import defaultdict import gnupg import luigi import luigi.date_interval import yaml from edx.analytics.tasks.encrypt import make_encrypted_file from edx.analytics.tasks.mapreduce import Multi...
jgmanzanas/CMNT_004_15
project-addons/importation/approve_purchase_orders.py
#!/usr/bin/env python # -*- coding: utf-8 -*- import sys import xmlrpclib import socket class approve_sale_orders(object): def __init__(self, dbname, user, passwd): """método incial""" try: self.url_template = "http://%s:%s/xmlrpc/%s" self.server = "localhost" ...
Open365/Open365
lib/DomainManagement/MailDomain.py
from warnings import filterwarnings from lib.Settings import Settings from lib.Wrappers.Logger import Logger import MySQLdb filterwarnings('ignore', category=MySQLdb.Warning) class MailDomain: def __init__(self): self.logger = Logger(__name__) self.settings = Settings().getSettings() def crea...
OCA/server-tools
autovacuum_message_attachment/models/ir_attachment.py
# Copyright (C) 2018 Akretion # License LGPL-3.0 or later (http://www.gnu.org/licenses/lgpl.html). from datetime import timedelta from odoo import fields, models class IrAttachment(models.Model): _name = "ir.attachment" _inherit = ["ir.attachment", "autovacuum.mixin"] _autovacuum_relation = "assigned_at...
lorenzogil/yith-library-server
wsgi.py
# Yith Library Server is a password storage server. # Copyright (C) 2015 Lorenzo Gil Sanchez <lorenzo.gil.sanchez@gmail.com> # # This file is part of Yith Library Server. # # Yith Library Server is free software: you can redistribute it and/or modify # it under the terms of the GNU Affero General Public License as publ...
scorphus/politicos
politicos/models/legislator_events_type.py
# -*- coding: utf-8 -*- # # Copyright (c) 2015, Marcelo Jorge Vieira <metal@alucinados.com> # # This program is free software: you can redistribute it and/or modify # it under the terms of the GNU Affero General Public License as # published by the Free Software Foundation, either version 3 of the # License, or (at...
amir-qayyum-khan/lore
importer/api/__init__.py
""" Import OLX data into LORE. """ from __future__ import unicode_literals from bs4 import BeautifulSoup from shutil import rmtree import logging from tempfile import mkdtemp from os.path import join, exists, isdir from os import listdir from archive import Archive, ArchiveException from django.core.files import Fil...
doctormo/django-cats
cats/utils/search.py
# # Copyright (C) 2014, Martin Owens <doctormo@gmail.com> # # This program is free software: you can redistribute it and/or modify # it under the terms of the GNU Affero General Public License as # published by the Free Software Foundation, either version 3 of the # License, or (at your option) any later version. # # T...
morenopc/edx-platform
lms/djangoapps/courseware/models.py
""" WE'RE USING MIGRATIONS! If you make changes to this model, be sure to create an appropriate migration file and check it in at the same time as your model changes. To do that, 1. Go to the edx-platform dir 2. ./manage.py schemamigration courseware --auto description_of_your_change 3. Add the migration file created...
dalf/searx-stats2
searxstats/fetcher/__init__.py
import asyncio import concurrent.futures from searxstats.common.utils import wait_get_results from searxstats.model import SearxStatisticsResult, Fetcher from . import basic from . import external_ressources from . import network from . import selfreport from . import cryptcheck_backend from . import mozillaobs from ...
pligor/predicting-future-product-prices
04_time_series_prediction/relevant_deals.py
# -*- coding: UTF-8 -*- from __future__ import division import numpy as np import pandas as pd import sys import math from sklearn.preprocessing import LabelEncoder, OneHotEncoder import re import os import csv from sklearn.neighbors import NearestNeighbors def printgr(obj): print repr(obj).decode('unicode-escape...
ioanpocol/superdesk-ntb
server/ntb/macros/nb_NO_to_nn_NO_metadata_macro.py
""" nb-NO to nn-NO Metadata Macro will perform the following changes to current content item: - change the language to nn-NO - change the body footer to "(©NPK)" - NB: copyrightsign, not @ - change the service (ANPA category) to "NPKTema" """ def nb_NO_to_nn_NO_metadata_macro(item, **kwargs): ...
indictranstech/reciphergroup-erpnext
erpnext/setup/page/setup_wizard/default_website.py
# Copyright (c) 2015, Frappe Technologies Pvt. Ltd. and Contributors # License: GNU General Public License v3. See license.txt from __future__ import unicode_literals import frappe from frappe import _ from frappe.utils import nowdate class website_maker(object): def __init__(self, company, tagline, user): self.c...
dmacdonaldRobotiq/Robotiq
addons/robotiq_data/models/account_invoice.py
# -*- encoding: utf-8 -*- ############################################################################## # # OpenERP, Open Source Management Solution # This module copyright (C) 2010 - 2014 Savoir-faire Linux # (<http://www.savoirfairelinux.com>). # # This program is free software: you can redistribute it a...
abramhindle/UnnaturalCodeFork
python/testdata/launchpad/lib/lp/services/comments/browser/tests/test_comment.py
# Copyright 2012 Canonical Ltd. This software is licensed under the # GNU Affero General Public License version 3 (see the file LICENSE). __metaclass__ = type from lp.services.comments.browser.comment import CommentBodyDownloadView from lp.services.webapp.servers import LaunchpadTestRequest from lp.testing import ( ...
kmoocdev2/edx-platform
openedx/core/djangoapps/user_api/accounts/utils.py
""" Utility methods for the account settings. """ import random import re import string from urlparse import urlparse from django.conf import settings from django.contrib.auth.models import User from django.utils.translation import ugettext as _ from six import text_type from completion import waffle as completion_wa...
ddurieux/alignak-backend
alignak_backend/models/hostgroup.py
def get_name(): return 'hostgroup' def get_schema(): return { 'schema': { 'members': { 'type': 'list', 'schema': { 'type': 'objectid', 'data_relation': { 'resource': 'host', ...
DemocracyClub/yournextrepresentative
ynr/apps/official_documents/migrations/0019_officialdocument_post_election.py
# Generated by Django 1.9.13 on 2018-04-06 10:22 import django.db.models.deletion from django.db import migrations, models class Migration(migrations.Migration): dependencies = [ ("candidates", "0041_auto_20180323_1400"), ("official_documents", "0018_make_source_url_required"), ] opera...
simgunz/anki
pylib/anki/cards.py
# Copyright: Ankitects Pty Ltd and contributors # License: GNU AGPL, version 3 or later; http://www.gnu.org/licenses/agpl.html from __future__ import annotations import pprint import time from typing import List, Optional import anki # pylint: disable=unused-import import anki._backend.backend_pb2 as _pb from anki ...
sirex/databot
tests/test_commands.py
import re import os import io import json import mock import tempfile import sqlalchemy as sa import freezegun import pytest import textwrap import pandas as pd from textwrap import dedent from databot import Bot, define, task, this from databot.db import migrations from databot.db.models import Models from databot.co...