code stringlengths 3 1.05M | repo_name stringlengths 5 104 | path stringlengths 4 251 | language stringclasses 1
value | license stringclasses 15
values | size int64 3 1.05M |
|---|---|---|---|---|---|
import calendar
import glob
import gzip
import math
import os.path
import re
import pandas as pd
def _parse_raw(fp, start_tstamp, end_tstamp):
import progressbar
widgets = [
os.path.basename(fp.name), ': ',
progressbar.Bar(marker='-', left='[', right=']'), ' ',
progressbar.Percentage()... | biocyberman/bcbio-nextgen | bcbio/graph/collectl.py | Python | mit | 11,878 |
# -*- coding: utf-8 -*-
"""
Spork
-----
A "little language" designed to facilitate the extraction and processing of
data held in XML or HTML files.
copyright © 2015 Grapeshot Ltd
"""
from distutils.core import setup
setup(name='spork',
version='0.2.1',
description='The Spork little language',
autho... | sarrowsmith/spork | setup.py | Python | mit | 631 |
# -*- coding: utf-8 -*-
# Copyright 2021 Google LLC. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless require... | GoogleCloudPlatform/gsutil | gslib/tests/test_rpo.py | Python | apache-2.0 | 8,007 |
# Copyright 2013 Google 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 applicable law or ... | esacosta/u-mooc | tests/suite.py | Python | apache-2.0 | 10,225 |
# -*- coding: utf-8 -*-
from xml.etree import ElementTree
from xml.dom import minidom
def prettify(elem):
"""Return a pretty-printed XML string for the Element.
"""
rough_string = ElementTree.tostring(elem, 'utf-8')
reparsed = minidom.parseString(rough_string)
return reparsed.toprettyxml(indent=" ... | kiistala/lar2xml | ElementTree_pretty.py | Python | mit | 324 |
# 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, os, json
from frappe.custom.doctype.custom_field.custom_field import create_custom_fields
from frappe.permissions import add_permission,... | ESS-LLP/erpnext-healthcare | erpnext/regional/india/setup.py | Python | gpl-3.0 | 23,809 |
from wtforms import Form, ValidationError
class Exists(object):
"""
Provides a validator that will query the database to make sure
whatever doesn't exist.
To use this you must set an instance variable
called "form.exists_data" which is a list or tuple
containing the items t... | CapstoneGrader/codeta | codeta/forms/validators.py | Python | mit | 1,189 |
# coding=utf-8
# --------------------------------------------------------------------------
# Copyright (c) Microsoft Corporation. All rights reserved.
# Licensed under the MIT License. See License.txt in the project root for license information.
# Code generated by Microsoft (R) AutoRest Code Generator.
# Changes may ... | Azure/azure-sdk-for-python | sdk/network/azure-mgmt-network/azure/mgmt/network/v2018_07_01/operations/_virtual_wans_operations.py | Python | mit | 30,657 |
"""Copyright 2014 Google 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 applicable law or agreed to in ... | google/py-ast-utils | source_match.py | Python | apache-2.0 | 59,128 |
"""Unit tests for glue-supported APIs."""
from random import randint
from uuid import uuid4
import boto3
import pytest
import sure # noqa # pylint: disable=unused-import
from botocore.exceptions import ParamValidationError
from moto import mock_glue
@mock_glue
def test_create_job():
client = create_glue_client... | spulec/moto | tests/test_glue/test_glue.py | Python | apache-2.0 | 2,993 |
from . import xmlrpc_test
class XmlAutoDetectTests(xmlrpc_test.XmlTests):
def _servertype(self):
return "streamrpc.Server" | evolvIQ/streamrpc | tests/autoxmlrpc_test.py | Python | apache-2.0 | 135 |
"""
Functions for reading and writing Agilent/Varian binary (fid) files and
parameter (procpar) files.
"""
from __future__ import print_function, division
__developer_doc__ = """
Agilent/Varian file format information
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
Both the Agilent/Varian binary and parameter formats are docu... | atomman/nmrglue | nmrglue/fileio/varian.py | Python | bsd-3-clause | 62,503 |
from setuptools import setup
from setuptools import find_packages
setup(name='gym_square',
version='0.0.1',
author='Guillaume de Chambrier',
author_email='chambrierg@gmail.com',
description='A simple square world environment for openai/gym',
packages=find_packages(),
url='https://gi... | gpldecha/gym-square | setup.py | Python | mit | 407 |
#
# Created as part of the StratusLab project (http://stratuslab.eu),
# co-funded by the European Commission under the Grant Agreement
# INFSO-RI-261552."
#
# Copyright (c) 2011, SixSq Sarl
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the Lice... | StratusLab/client | api/code/src/main/python/stratuslab/system/SystemFactory.py | Python | apache-2.0 | 1,164 |
# Python stubs generated by omniidl from /home/alex/calvino/work/omni.d/local/share/idl/omniORB/COS/CosEventComm.idl
import omniORB, _omnipy
from omniORB import CORBA, PortableServer
_0_CORBA = CORBA
_omnipy.checkVersion(2,0, __file__)
#
# Start of module "CosEventComm"
#
__name__ = "CosEventComm"
_0_CosEventComm =... | RedhawkSDR/omniEvents | test/CosEventComm_idl.py | Python | lgpl-2.1 | 9,962 |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
"""
This script extract channel instrument type from obspy.inventory
:copyright:
Wenjie Lei (lei@princeton.edu), 2016
:license:
GNU Lesser General Public License, version 3 (LGPLv3)
(http://www.gnu.org/licenses/lgpl-3.0.en.html)
"""
from __future__ import prin... | wjlei1990/pytomo3d | pytomo3d/station/extract_staxml_info.py | Python | lgpl-3.0 | 2,048 |
#! /usr/bin/python
import bottle
import settings
from controller import admin as admin_controller
from controller import email as email_controller
app = application = bottle.Bottle()
# Base url for regular users
app.route(settings.BASEPATH, 'GET', admin_controller.index)
app.route(settings.BASEPATH + '/', 'GET', adm... | TeachBoost/ansible | ansible.py | Python | mit | 1,499 |
# vim: tabstop=4 shiftwidth=4 softtabstop=4
#
# Copyright 2013 OpenStack Foundation
#
# Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance with the License. You may obtain
# a copy of the License at
#
# http://www.apache.org/licenses/LICENSE... | nash-x/hws | neutron/services/qos/drivers/sriov_qos.py | Python | apache-2.0 | 3,687 |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
"""
test_FbBase.py - Integration test for FbBase
"""
import sys, os.path
# Hack for import module in grandparent folder
sys.path.append(os.path.abspath(os.path.join(os.path.dirname(__file__), os.path.pardir)))
import unittest
from SnsManager.facebook.FbBase import FbBas... | waveface/SnsManager | tests/it_FbBase.py | Python | bsd-3-clause | 1,406 |
import logging, time, os
from autotest.client.shared import error
from autotest.client import utils
@error.context_aware
def run_floppy(test, params, env):
"""
Test virtual floppy of guest:
1) Create a floppy disk image on host
2) Start the guest with this floppy image.
3) Make a file system on g... | nacc/autotest | client/tests/kvm/tests/floppy.py | Python | gpl-2.0 | 2,413 |
#!/usr/bin/env python
"""Master program for the Organ Donor "Organelle"
This program is mainly responsible for monitoring the physical rotary switch
that allows users to select a major mode of operation for the Organelle.
When it detects that the switch has been moved, it asks the current program
to clean up and exit ... | OrganDonor/Organelle | gui-supervisor.py | Python | cc0-1.0 | 4,595 |
# -*- coding: utf-8 -*-
"""
This class controls all the GUI for the player
menu screen.
"""
import sys
import pygame as pg
from . import setup, observer
from . import constants as c
from . import tools
#Python 2/3 compatibility.
if sys.version_info[0] == 2:
range = xrange
class SmallArrow(pg.sprite.Sprite):
... | 2Guys1Python/Project-Cacophonum | data/menugui.py | Python | mit | 51,529 |
#!/usr/bin/env python
"""
refguide_check.py [OPTIONS] [-- ARGS]
Check for a Scipy submodule whether the objects in its __all__ dict
correspond to the objects included in the reference guide.
Example of usage::
$ python refguide_check.py optimize
Note that this is a helper script to be able to check if things ar... | e-q/scipy | tools/refguide_check.py | Python | bsd-3-clause | 32,497 |
#!/usr/bin/env python
import numpy as np
import matplotlib.pyplot as plt
import scipy.optimize as optimize
from scipy.interpolate import interp1d
import collections
from eos_mod import MGD_PowerLaw,debye_fun,Ptot_powerlaw,press_vinet
def set_dic(a):
param_d['V0'] = a[0]
param_d['K0'] = a[1]
param_d['K0p'] ... | rongzh/unbiased-pscale | code/Jamieson1982Analysis/eval_Au_eos.py | Python | mit | 9,454 |
from datetime import datetime, timedelta
from django.contrib.auth import get_user_model
from django.core.paginator import Paginator
from django.core.urlresolvers import reverse
from django.http import HttpResponse
from django.template.defaultfilters import filesizeformat
from django.test import TestCase
import json
fro... | emory-libraries/readux | readux/books/tests/views.py | Python | apache-2.0 | 42,006 |
# styledtextbox1.py
from wax import *
class MainFrame(Frame):
def Body(self):
b = Button(self, "dummy")
self.AddComponent(b, expand='h')
stb = StyledTextBox(self, size=(400,300))
self.AddComponent(stb, expand='both')
self.Pack()
#)
app = Application(MainFrame, title="Styl... | MSMBA/msmba-workflow | msmba-workflow/srclib/wax/examples/styledtextbox2.py | Python | gpl-2.0 | 362 |
from single_particle_state import SingleParticleState
class SingleParticleBasis(object):
def __init__(this, states):
this.states = states
def __str__(this):
s = ""
for state in this.states:
s += str(state) + "\n"
return s[:-1]
| NuclearTalent/NuclearStructure | doc/Programs/PythonCodesVeff/single_particle_basis.py | Python | cc0-1.0 | 280 |
from flask import session
from flask_login import current_user
from backend.controller.auth.login import user_logged_in
from backend.model import User, OAuth
def test_login_controller_create_user(flask_app, db_perm_session, auth_blueprint):
assert len(db_perm_session.query(User).all()) == 0
assert len(db_per... | willrp/willbuyer | backend/tests/integration/controller/auth/test_login_controller.py | Python | mit | 1,665 |
'''
Classes for loading a QWidget designed in QT Designer as MainWindow, Dialog or Widget
Examples of how to use can be found in UseQtGuiLoader.py
@Created on 13/3/2013
@modified
@version:1.9 (18/2-2014)
@change: 1.8 Compile code changed again
Autogeneration of missing action handlers
1.8 os.envi... | madsmpedersen/MMPE | QtGuiLoader/QtGuiLoader.py | Python | gpl-3.0 | 12,012 |
# -*- coding: utf-8 -*-
"""
Created on Fri May 22 11:16:18 2020
@author: Mack Pro
"""
import numpy as npy
import volmdlr as volmdlr
import volmdlr.primitives3D as primitives3D
import volmdlr.primitives2D as primitives2D
import matplotlib.pyplot as plt
import random
######## SWEEP TEST RANDOM
nb_point1, nb_point2 = ... | masfaraud/volmdlr | scripts/distance/sweep_sweep.py | Python | gpl-3.0 | 3,190 |
"""A suite of unit tests that verifies the correct behaviour of various
functions/methods in the pyzord code.
Note these tests the source of pyzor, not the version currently installed.
"""
import unittest
def suite():
"""Gather all the tests from this package in a test suite."""
import test_gdbm
import ... | lazy404/pyzor | tests/unit/test_engines/__init__.py | Python | gpl-2.0 | 682 |
# -*- coding: utf-8 -*-
from __future__ import print_function
import pytest
# pylint: disable-msg=W0612,E1101
from copy import deepcopy
import sys
from distutils.version import LooseVersion
from pandas.compat import range, lrange, long
from pandas import compat
from numpy.random import randn
import numpy as np
fr... | NixaSoftware/CVis | venv/lib/python2.7/site-packages/pandas/tests/frame/test_api.py | Python | apache-2.0 | 14,876 |
# 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 version.
#
# This program is distributed in the hope that it will be useful, but
... | slabanja/dynsf | dsf/trajectory_reader/xtc_trajectory_reader.py | Python | gpl-2.0 | 5,858 |
# coding=utf-8
"""Authors: Michal Wrona
Copyright (C) 2016 ACK CYFRONET AGH
This software is released under the MIT license cited in 'LICENSE.txt'
Contains methods used to bring up storages.
"""
import sys
from . import common, s3, ceph, nfs, glusterfs, amazon_iam, luma, swift
def start_luma(config, storages_docker... | kliput/onezone-gui | bamboos/docker/environment/storages.py | Python | mit | 6,520 |
"""
Test the Hold API.
"""
from gabbletest import make_result_iq, sync_stream
from servicetest import (
assertEquals, wrap_channel,
make_channel_proxy, call_async, EventPattern, sync_dbus)
import constants as cs
from jingletest2 import JingleTest2, test_all_dialects
def mutable_stream_tests(jp, jt, q, bus, ... | community-ssu/telepathy-gabble | tests/twisted/jingle/hold-av.py | Python | lgpl-2.1 | 17,286 |
from django.conf.urls import url
from django.views.generic import TemplateView
from django.contrib.auth.decorators import login_required
from views import *
urlpatterns = [
#url(r"^confirmar/(?P<reference>[-\.\w]+)/$", confirm_payment, name="pago_confirmar"),
url(r"^lista$", login_required(pagos_lista.as_vie... | jonlatorre/MatriculaEIDE | pagosonline/urls.py | Python | mit | 1,145 |
from rollbar.lib import (
python_major_version, binary_type, string_types, integer_types,
number_types, traverse)
_ALLOWED_CIRCULAR_REFERENCE_TYPES = [binary_type, bool, type(None)]
if isinstance(string_types, tuple):
_ALLOWED_CIRCULAR_REFERENCE_TYPES.extend(string_types)
else:
_ALLOWED_CIRCULAR_REFER... | rollbar/pyrollbar | rollbar/lib/transforms/__init__.py | Python | mit | 4,130 |
"""
给定一个数组arr,该数组无序,但每个值均为正数,再给定一个正数k。求arr的
所有子数组中所有元素相加和为k的最长子数组长度。
例如,arr=[1, 2, 1, 1, 1], k=3
累加和为3的最长子数组长度为[1, 1, 1],所以结果返回3
"""
from array import array
class MaxLength:
@classmethod
def get_max_length_for_unsigned_arr(cls, arr, num):
length = len(arr)
if length == 0:
return 0
... | ResolveWang/algrithm_qa | arrandmatrix/q10.py | Python | mit | 1,304 |
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.db import models, migrations
class Migration(migrations.Migration):
dependencies = [
]
operations = [
migrations.CreateModel(
name='Country',
fields=[
('id', models.AutoField(verb... | edoburu/django-parler-rest | testproj/migrations/0001_initial.py | Python | apache-2.0 | 1,819 |
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
#
# pynigma documentation build configuration file, created by
# sphinx-quickstart on Sat Nov 25 14:42:06 2017.
#
# This file is execfile()d with the current directory set to its
# containing dir.
#
# Note that not all possible configuration values are present in this
# au... | thejunglejane/pynigma | docs/conf.py | Python | mit | 5,549 |
# coding: utf-8
# ### Amazon Sentiment Data
# In[ ]:
import numpy as np
import lxmls.readers.sentiment_reader as srs
from lxmls.deep_learning.utils import AmazonData
corpus = srs.SentimentCorpus("books")
data = AmazonData(corpus=corpus)
# ### Exercise 2.2 Implement Backpropagation for an MLP in Numpy and train i... | LxMLS/lxmls-toolkit | labs/scripts/non_linear_classifiers/exercise_2.py | Python | mit | 3,897 |
#
# Gramps - a GTK+/GNOME based genealogy program
#
# Copyright (C) 2000-2006 Donald N. Allingham
#
# 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 you... | arunkgupta/gramps | gramps/gui/editors/displaytabs/locationembedlist.py | Python | gpl-2.0 | 3,376 |
from mamba import description, before, it, context
from expects import expect, be_true, be_above, be_none
from doublex_expects import have_been_called_with
from doublex import Spy
from spec.object_mother import *
from mamba import reporter, infrastructure, runnable
with description(Example) as self:
with befor... | nestorsalceda/mamba | spec/example_spec.py | Python | mit | 1,754 |
import OOMP
newPart = OOMP.oompItem(8863)
newPart.addTag("oompType", "CAPE")
newPart.addTag("oompSize", "05")
newPart.addTag("oompColor", "X")
newPart.addTag("oompDesc", "UF47")
newPart.addTag("oompIndex", "VF")
OOMP.parts.append(newPart)
| oomlout/oomlout-OOMP | old/OOMPpart_CAPE_05_X_UF47_VF.py | Python | cc0-1.0 | 241 |
from rest_framework import serializers
from Clientes.serializers import ClienteSerializer
from Facturacion.serializers import FacturaSerializers
from Servicios.models import Servicio, DetalleServicio
class ServicioSerializer(serializers.ModelSerializer):
cliente = ClienteSerializer(many=False,read_only=True)
... | rauleb/ModulosGenerales | Servicios/serializers.py | Python | gpl-2.0 | 672 |
"""Tests for ``devhub.views.ownership`` and ``devhub.views.invitation``."""
from django.conf import settings
from django.core import mail
from pyquery import PyQuery as pq
from olympia import amo
from olympia.activity.models import ActivityLog
from olympia.addons.models import (
Addon, AddonUser, AddonUserPending... | eviljeff/olympia | src/olympia/devhub/tests/test_views_ownership.py | Python | bsd-3-clause | 33,784 |
# -*- encoding: utf-8 -*-
import gevent
def foo():
print('Running in foo')
gevent.sleep(0)
print('Explicit context switch to foo again')
def bar():
print('Explicit context to bar')
gevent.sleep(0)
print('Implicit context switch back to bar')
gevent.joinall([
gevent.spawn(foo),
geven... | WarmongeR1/gevent_examples | src/example1.py | Python | mit | 336 |
# This will create a dist directory containing the executable file, all the data
# directories. All Libraries will be bundled in executable file.
#
# Run the build process by entering 'pygame2exe.py' or
# 'python pygame2exe.py' in a console prompt.
#
# To build exe, python, pygame, and py2exe have to be installed. Afte... | Joeization/pyGaen | setup.py | Python | mit | 6,376 |
#!/usr/bin/env python
"""
This script creates or updates en-US repositories from Mozilla source
code to use for Mozilla product localization.
The author of the original script is Ognyan Kulev (ogi):
https://twitter.com/OgnyanKulev
This is his code:
https://bitbucket.org/ogi/mozilla-l10n-po/
"""
import datetime
impor... | jotes/pontoon | bin/mozilla-en-US.py | Python | bsd-3-clause | 3,685 |
# -*- coding: utf8 -*-
import os
import tempfile
import uuid
import nose
import shutil
import shcmd.cmd
TMPDIR = os.path.realpath(tempfile.gettempdir())
def test_cd():
oridir = os.getcwd()
nose.tools.ok_(oridir != TMPDIR)
with shcmd.cmd.cd(TMPDIR):
nose.tools.eq_(os.path.realpath(os.getcwd())... | SkyLothar/shcmd | tests/test-cmd.py | Python | apache-2.0 | 1,752 |
from CommonServerPython import *
from CommonServerUserPython import *
import json
import os
import sys
from cStringIO import StringIO
handle_proxy(demisto.params().get('proxy'))
response = ''
# disable python from generating a .pyc file
sys.dont_write_bytecode = True
# change me to the path of pytan
pytan_loc = "/... | demisto/content | Packs/Tanium/Integrations/Tanium/Tanium.py | Python | mit | 27,407 |
#!/usr/bin/python
"""
Simple control scheme for controlling a process with a given transfer
function G(s), that is discretized with Implicit Euler and Ts = 0.1,
with a controller R(s), that is discretized with Implicit Euler and
Ts = 0.1. This simulator is related to the controller design exercise
of Exercise 4 availa... | apapadopoulos/src-esercitazioni | controlDesign/pythonSimulator/closedLoopSimulation.py | Python | gpl-3.0 | 3,715 |
from __future__ import absolute_import, print_function, unicode_literals
from contextlib import contextmanager
import mock
import pytest
from tests.js_helper import TestCase
from ..traverser import Location, Traverser
class BaseTestTraverser(TestCase):
"""Tests the functionality of the base-level JS Value typ... | kmaglione/amo-validator | validator/testcases/javascript/tests/test_traverser.py | Python | bsd-3-clause | 10,217 |
# -*- Mode: Python; coding: utf-8; indent-tabs-mode: nil; tab-width: 4 -*-
### BEGIN LICENSE
# This file is in the public domain
### END LICENSE
"""Provides a shared preferences dictionary"""
from desktopcouch.records.server import CouchDatabase
from desktopcouch.records.record import Record
import gtk
import gobject... | nickpascucci/Robot-Arm | software/desktop/brazo/brazo_lib/preferences.py | Python | mit | 3,116 |
# -*- coding: utf-8 -*-
#
# test_connect_array_fixed_indegree.py
#
# This file is part of NEST.
#
# Copyright (C) 2004 The NEST Initiative
#
# NEST 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 versio... | mdjurfeldt/nest-simulator | pynest/nest/tests/test_connect_array_fixed_indegree.py | Python | gpl-2.0 | 3,309 |
#!/usr/bin/env python
# encoding: utf-8
"""Copyright (C) 2013 COLDWELL AG
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... | MoroGasper/client | client/plugins/ui/systray/common.py | Python | gpl-3.0 | 1,533 |
import numpy as np
import cv2
cap = cv2.VideoCapture(0)
while(True):
#Capture frame-by-frame
ret, frame = cap.read()
#Our operation on the frame come here
cerah = cv2.addWeighted(frame, 1.5, np.zeros(frame.shape, frame.dtype), 0, 90)
#Display the resulting frame
cv2.imshow('frame', cerah)
if cv2.waitKey(1)... | antosupri/Tugas_OpenCV_PCD | gambar_brightness.py | Python | gpl-3.0 | 433 |
# Declare all the constants here
THRESHOLD = 230
MAX_VALUE = 255
MIN_VALUE = 0
Directions = [1, 2, 3, 4, 5, 6, 7, 8]
WIDTH = 300
HEIGHT = 400
input_source = '../input/'
test_source = '../../test_images/'
MAX_LENGTH_DIRECTION_ = "Max_Length_Direction_"
NUMBER_PIXEL_DIRECTION_ = "Number_Pixel_Direction_"
SLOPE_ANGLE... | mohitreddy1996/Gender-Detection-from-Signature | src/constants/constants.py | Python | mit | 336 |
# -*- coding: utf-8 -*-
__author__ = 'eso'
import sys
sys.path.append('../../')
import re
import pywikibot
from pywikibot import proofreadpage
def convert_RE_siehe(hit):
print("1.{}".format(hit.group(1)))
print("2.{}".format(hit.group(2)))
if hit.group(1):
temp = "[[re:" + hit.group(1) + "|" + hit... | the-it/WS_THEbotIT | archive/online/2016/160527_replace_RE_siehe.py | Python | mit | 903 |
def greeting(msg):
print(msg)
def main():
greeting("Hello")
if __name__ == "__main__": main() | emacthecav/cs3240-labdemo | hello.py | Python | mit | 97 |
#Importing dynamic parameters from the main fault loading to the branch fault
# Loading branch fault parameters qdyn_branch
#P. Galvez, AECOM, Oct. 2016
#Input (QDYN to SEM).
import numpy as np
import math
import sys
import os
sys.path.append('/Users/percy.galvez/Dropbox/qdyn_developer/utils/kernel_calc')
sys.path.... | clavodeolor/qdyn_collaboration | QSB_python/dynamic_par_branch.py | Python | gpl-3.0 | 3,515 |
#!/usr/bin/env python
"""
Pastebin-Crawler scans recent uploads and collects entries matching a
search_list. To easily browse the results, they will be written to
HTML-files: store.html, with index.html containing an index with links.
Copyright (C) 2014 Steffen Sauler
This program is free software: you can redistribu... | SHSauler/pastebin_crawler | pastebin.py | Python | gpl-3.0 | 5,128 |
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
import unittest
from django.contrib.gis.gdal import (
CoordTransform, GDALException, SpatialReference, SRSException,
)
class TestSRS:
def __init__(self, wkt, **kwargs):
self.wkt = wkt
for key, value in kwargs.items():
... | kawamon/hue | desktop/core/ext-py/Django-1.11.29/tests/gis_tests/gdal_tests/test_srs.py | Python | apache-2.0 | 12,911 |
# coding: utf-8
"""
Kubernetes
No description provided (generated by Swagger Codegen https://github.com/swagger-api/swagger-codegen)
OpenAPI spec version: v1.7.4
Generated by: https://github.com/swagger-api/swagger-codegen.git
"""
from __future__ import absolute_import
import os
import sys
im... | djkonro/client-python | kubernetes/test/test_v1beta1_third_party_resource_list.py | Python | apache-2.0 | 975 |
from math import ceil
from string import ascii_lowercase as low, ascii_uppercase as up
def shifty(string, shift=None, encode=True):
if not encode:
string = ''.join(string)
shift = ord(string[0]) - ord(string[1])
string = string[2:]
shifted_chars = []
length = 0
else:
... | the-zebulan/CodeWars | katas/kyu_5/second_variation_on_caesar_cipher.py | Python | mit | 1,024 |
# !/usr/bin/python
# -*- coding: utf-8 -*-
"""
< O código abaixo é para gravar os dados em um arquivo.csv. >
author: Cassiano Kunsch das Neves
last edited: <10/12/2015>
"""
import xlsxwriter
from PyQt4 import QtCore
class GravaArquivo(object):
@staticmethod
def startGravacao(diretorioArqDestino, dados, ref... | LEDS/Lifebox | Codigo/Util/Gravador.py | Python | gpl-3.0 | 974 |
# -*- coding: utf-8 -*-
import unittest
"""
Tests that ElementMaker works properly.
"""
import sys, os.path
from lxml import etree
from lxml.builder import E
this_dir = os.path.dirname(__file__)
if this_dir not in sys.path:
sys.path.insert(0, this_dir) # needed for Py3
from common_imports import HelperTestCase,... | cloudera/hue | desktop/core/ext-py/lxml-3.3.6/src/lxml/tests/test_builder.py | Python | apache-2.0 | 954 |
# -*- coding: utf-8 -*-
##############################################################################
#
# OpenERP, Open Source Management Solution
# Copyright (C) 2004-2010 Tiny SPRL (<http://tiny.be>).
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU... | odoousers2014/odoo | addons/account/account.py | Python | agpl-3.0 | 190,066 |
# -*- coding: utf-8 -*-
# Copyright (C) 2015 Accuvant, Inc. (bspengler@accuvant.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
# (at your option) any ... | lixiangning888/whole_project | modules/signatures_merge_tmp/antiav_avast_libs.py | Python | lgpl-3.0 | 1,242 |
def urbanDict(query):
"""
Searches urbandictionary.com for a definition to the query given
@return response dictionary
"""
import requests
import json
# send the request and get the data
r = requests.get('http://api.urbandictionary.com/v0/define?term=%s' % (query))
data = json.load... | sambev/ircbot | apis/urbandic.py | Python | mit | 715 |
#!/usr/bin/env python
'''
searx 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.
searx is distributed in the hope that it will be use... | potato/searx | searx/webapp.py | Python | agpl-3.0 | 30,984 |
"""Test kddcup99 loader, if the data is available,
or if specifically requested via environment variable
(e.g. for travis cron job).
Only 'percent10' mode is tested, as the full data
is too big to use in unit-testing.
"""
from functools import partial
import pytest
from sklearn.datasets.tests.test_common import che... | manhhomienbienthuy/scikit-learn | sklearn/datasets/tests/test_kddcup99.py | Python | bsd-3-clause | 2,688 |
# generate a empty graph with k nodes
# get position from pygraphviz module
# link all (0,k) edges to get a star graph
# import packages
import networkx as nx
import numpy as np
import math
class GetInit:
def __init__(self):
pass
# initialize a graph that all the other nodes
# connect to node 0 and... | tautomer/mcmc | mcmc/graph_init.py | Python | mit | 1,063 |
import threading
from flask.ext.socketio import emit
import time
import random
import RPi.GPIO as GPIO
#
global temp_for_sensor
temp_for_sensor = 20.0
class Sensor:
"Class implementing temperature sensor"
def read_temperature(self):
return round(random.uniform(temp_for_sensor - 0.5, temp_for_sensor + 0... | guma44/PiBrew | PiBrew/Controller.py | Python | gpl-3.0 | 10,838 |
"""
WSGI config for graveyard project.
It exposes the WSGI callable as a module-level variable named ``application``.
For more information on this file, see
https://docs.djangoproject.com/en/2.0/howto/deployment/wsgi/
"""
import os
from django.core.wsgi import get_wsgi_application
os.environ.setdefault("DJANGO_SET... | dracidoupe/graveyard | graveyard/wsgi.py | Python | mit | 395 |
"""Tests for the retire_order command"""
from tempfile import NamedTemporaryFile
from django.core.management import call_command
from course_modes.models import CourseMode
from xmodule.modulestore.tests.django_utils import ModuleStoreTestCase
from xmodule.modulestore.tests.factories import CourseFactory
from shopping... | Learningtribes/edx-platform | lms/djangoapps/shoppingcart/management/tests/test_retire_order.py | Python | agpl-3.0 | 2,852 |
# 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 writing, software
# distributed under t... | naototty/vagrant-lxc-ironic | ironic/drivers/modules/ilo/inspect.py | Python | apache-2.0 | 12,256 |
import copy
import pytest
from peek.line import InvalidIpAddressException, Line, InvalidStatusException
# 127.0.0.1 - - [01/Jan/1970:00:00:01 +0000] "GET / HTTP/1.1" 200 193 "-" "Python"
test_line_contents = {
'ip_address': '127.0.0.1',
'timestamp': '[01/Jan/1970:00:00:01 +0000]',
'verb': 'GET',
... | purrcat259/peek | tests/unit/test_line.py | Python | mit | 1,585 |
#!/usr/bin/python
# -*- coding: utf-8 -*-
# ... #
| overxfl0w/MLSteganalysis | setup.py | Python | gpl-2.0 | 50 |
# -*- coding: utf-8 -*-
#########################################################################
#
# Copyright (C) 2017 OSGeo
#
# 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... | kartoza/geonode | geonode/base/management/commands/fixgeofencerules.py | Python | gpl-3.0 | 3,043 |
#aacodonPsicov.py
# PSICOVcodon - Protein Sparse Inverse COVariance analysis program for nucleotide and amino acid sequences
# By Etai Jacob, September 2015 - Copyright (C) 2015 Etai Jacob, etai.jacob@gmail.com
# This code is licensed under the terms of GNU General Public License v2 or later
# This code was using in t... | etaijacob/ACPSICOV | src/aacodonPsicov.py | Python | gpl-3.0 | 5,711 |
# -*- coding: utf-8 -*-
from south.utils import datetime_utils as datetime
from south.db import db
from south.v2 import SchemaMigration
from django.db import models
class Migration(SchemaMigration):
def forwards(self, orm):
# Adding model 'Conference'
db.create_table(u'conference', (
... | jmosky12/huxley | huxley/core/migrations/0001_initial.py | Python | bsd-3-clause | 18,966 |
import os
import locale
import unittest
import mock
from datetime import datetime
import cfg
from cfg import parse_cfg_date, _fix_locale, pretty_date, config
class TestDateHandling(unittest.TestCase):
def test_date_parsing(self):
test_date = "2015-01-02 18:06"
parsed = parse_cfg_date(test_date)
... | janLo/meet-and-eat-registration-system | test/test_cfg.py | Python | bsd-3-clause | 2,108 |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
"""Identifies and removes duplicate (backups) from one or multiple directories
Usage: %(prog)s [-v...] [options] <path> [<path>...]
%(prog)s --help
%(prog)s --version
Arguments:
<path> Directory that should be considered when searching for duplicates
... | anjos/popster | popster/deduplicate.py | Python | gpl-3.0 | 2,716 |
import datetime
from django.contrib.auth.models import User
from django.db import models
from django.utils import timezone
from django.utils.translation import ugettext_lazy as _
from django_extensions.db.fields import CreationDateTimeField, ModificationDateTimeField
from django.utils import timezone
class TimeStampe... | webclub/CFI | Django/food/models.py | Python | apache-2.0 | 2,760 |
# 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... | karllessard/tensorflow | tensorflow/python/tools/api/generator/create_python_api_test.py | Python | apache-2.0 | 5,804 |
# FMSPy - Copyright (c) 2009 Andrey Smirnov.
#
# See COPYRIGHT for details.
"""
Tests for L{fmspy.application}.
"""
| smira/fmspy | fmspy/application/tests/__init__.py | Python | mit | 118 |
# ---------------------------------------------------------------------
#
# Copyright (C) 2016 by the deal.II authors
#
# This file is part of the deal.II library.
#
# The deal.II library is free software; you can use it, redistribute
# it, and/or modify it under the terms of the GNU Lesser General
# Public License as ... | pesser/dealii | contrib/python-bindings/tests/point_wrapper.py | Python | lgpl-2.1 | 1,378 |
"""rename documentpage
Revision ID: e34d28e9a167
Revises: a5ccf5eaa73f
Create Date: 2016-03-08 10:22:16.063105
"""
from alembic import op
# revision identifiers, used by Alembic.
revision = 'e34d28e9a167'
down_revision = 'a5ccf5eaa73f'
def upgrade():
op.rename_table('page', 'document_page')
def downgrade():
... | gazeti/aleph | aleph/migrate/versions/e34d28e9a167_rename_documentpage.py | Python | mit | 365 |
# 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 "License"); you may not use ... | marcinzaremba/libcloud | libcloud/dns/types.py | Python | apache-2.0 | 3,043 |
#!/usr/bin/env python
"""Tests the queue manager."""
import time
# pylint: disable=unused-import,g-bad-import-order
from grr.lib import server_plugins
# pylint: enable=unused-import,g-bad-import-order
from grr.lib import config_lib
from grr.lib import data_store
from grr.lib import flags
from grr.lib import queue_... | wandec/grr | lib/queue_manager_test.py | Python | apache-2.0 | 23,126 |
# Licensed to Elasticsearch under one or more contributor
# license agreements. See the NOTICE file distributed with
# this work for additional information regarding copyright
# ownership. Elasticsearch licenses this file to you under
# the Apache License, Version 2.0 (the "License"); you may
# not use this file except... | coding0011/elasticsearch | dev-tools/smoke_test_rc.py | Python | apache-2.0 | 11,742 |
# -*- coding: utf-8 -*-
from . import views
from django.shortcuts import render, get_object_or_404
from django.contrib.auth.hashers import make_password , check_password
from .models import *
from .forms import *
from django.http import JsonResponse , HttpResponseRedirect , HttpResponse
from json import JSONEncoder
fro... | DarjaGFX/GroupWeb | blog/AppView.py | Python | gpl-3.0 | 28,183 |
from seamless.highlevel import Context
import json
ctx = Context()
ctx.a = 12
def triple_it(a, b):
print("3 * a + b, a = %s, b = %s" % (a, b))
return 3 * a + b
ctx.transform = triple_it
ctx.transform.debug.direct_print = True
ctx.transform.a = ctx.a
ctx.transform.b = 6
ctx.myresult = ctx.transform
ctx.compu... | sjdv1982/seamless | tests/highlevel/context2.py | Python | mit | 823 |
import fractions
import re
class ParseError(Exception):
def __init__(self, message):
# Call the base class constructor with the parameters it needs
super(ParseError, self).__init__(message)
class PolynomialExpression(object):
def __init__(self, coefficients):
self.coefficients = tupl... | mikeyrichardson/kyburz | app/teacher/parse.py | Python | mit | 10,267 |
import asyncio
class FutureLike:
def __await__(self):
yield from asyncio.sleep(2)
async def foo():
<warning descr="Coroutine 'FutureLike' is not awaited">FutureLike()</warning> | siosio/intellij-community | python/testData/inspections/PyAsyncCallInspection/futureLikeFromAsyncCall.py | Python | apache-2.0 | 196 |
#!/usr/bin/env python
# Copyright (c) 2015 - present Facebook, Inc.
# All rights reserved.
#
# This source code is licensed under the BSD style license found in the
# LICENSE file in the root directory of this source tree. An additional grant
# of patent rights can be found in the PATENTS file in the same directory.
... | jayhorn/DynSlicer | do_like_javac/capture/util.py | Python | apache-2.0 | 1,142 |
# coding: utf-8
import re
import logging
import uuid
import time
from linebot import LineBotApi, WebhookParser
from linebot.models import MessageEvent, PostbackEvent, BeaconEvent, FollowEvent, UnfollowEvent, JoinEvent, LeaveEvent, MemberJoinedEvent, MemberLeftEvent, TextMessage, LocationMessage, StickerMessage, TextS... | alt-core/sheetbot | plugin/line/interface.py | Python | mit | 8,577 |
import os
import sys
import codecs
import glob
base_path = os.path.split(__file__)[0]
test_dir = os.path.join(base_path, 'testdata')
def get_data_files(subdirectory, files='*.dat'):
return glob.glob(os.path.join(test_dir, subdirectory, files))
class DefaultDict(dict):
def __init__(self, default, *args, **k... | gsnedders/html.parser-html5lib-test | support.py | Python | mit | 2,058 |
# encoding=utf-8
import jieba
import sys
reload(sys)
sys.setdefaultencoding('UTF-8')
def analyse(sentence):
words = list(jieba.cut(sentence=sentence, cut_all=True))
if "天气" in words:
serv = 'qa'
t = 'weather'
city = 'shanghai'
day = 0
slots = {'city': city, 'day': day}
... | ilab-tongji/raas | nlp/interpreter.py | Python | mit | 483 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.