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 |
|---|---|---|---|---|---|
#!/usr/bin/env python
#
# Copyright 2015 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 requir... | googleads/googleads-python-lib | examples/ad_manager/v202108/contact_service/update_contacts.py | Python | apache-2.0 | 2,413 |
#!/usr/bin/env python3
from USB import *
from USBDevice import *
from USBConfiguration import *
from USBInterface import *
from USBEndpoint import *
class PwnUSBDevice(USBDevice):
name = "USB device"
def handle_buffer_available(self, lll):
return
def __init__(self, maxusb_app, verbose=0):
... | sga001/cinch | exploits/CVE-2015-7566.py | Python | cc0-1.0 | 3,390 |
"""
Helper functions for CP apps
"""
import six
from cherrypy._cpcompat import urljoin as _urljoin, urlencode as _urlencode
from cherrypy._cpcompat import basestring
import cherrypy
def expose(func=None, alias=None):
"""
Expose the function or class, optionally providing an alias or set of aliases.
"""... | jealousrobot/PlexArt | lib/cherrypy/_helper.py | Python | gpl-3.0 | 10,332 |
# Copyright 2008-2016 Free Software Foundation, Inc.
# This file is part of GNU Radio
#
# GNU Radio Companion 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 opti... | bastibl/gnuradio | grc/core/ports/_virtual_connections.py | Python | gpl-3.0 | 4,742 |
# Copyright (c) 2015, Frappe Technologies Pvt. Ltd. and Contributors
# License: GNU General Public License v3. See license.txt
# For license information, please see license.txt
from __future__ import unicode_literals
import frappe
from erpnext.accounts.utils import validate_fiscal_year
from frappe import _
from frapp... | treejames/erpnext | erpnext/hr/doctype/leave_block_list/leave_block_list.py | Python | agpl-3.0 | 2,242 |
from __future__ import print_function
from mechanize import Browser
from bs4 import BeautifulSoup
from time import sleep
import os
import re
import getpass
# will stop searching after encountering this many years of no results
no_results_max = 15
oxam_main_url = 'https://weblearn.ox.ac.uk/portal/hierarchy/oxam/page/se... | frigaardj/oxam-fetcher | oxam-fetcher.py | Python | gpl-2.0 | 2,933 |
import numpy as np
import os
try:
import netCDF4 as netCDF
except:
import netCDF3 as netCDF
import matplotlib.pyplot as plt
import time
import datetime as dt
from matplotlib.dates import date2num, num2date
import pyroms
import pyroms_toolbox
import _remapping
class nctime(object):
pass
def remap(src_varname,... | kshedstrom/pyroms | examples/CCS1_SODA3.3.1/Initial/remap.py | Python | bsd-3-clause | 4,853 |
# -*- coding: utf-8 -*-
"""
Copyright (C) 2012-2018 Twitch-on-Kodi
This file is part of Twitch-on-Kodi (plugin.video.twitch)
SPDX-License-Identifier: GPL-3.0-only
See LICENSES/GPL-3.0-only for more information.
"""
from ..addon import utils
from ..addon.common import kodi
from ..addon.constants impor... | StateOfTheArt89/Twitch.tv-on-XBMC | resources/lib/twitch_addon/routes/remove_search_history.py | Python | gpl-3.0 | 870 |
from cStringIO import StringIO
from email.utils import parsedate
import gzip
import logging
import re
import time
from urlparse import urljoin
from django.conf import settings
from django.http import HttpResponse
from django.middleware.gzip import GZipMiddleware
from django.utils.cache import cc_delim_re
from django.u... | armstrong/armstrong.esi | armstrong/esi/utils.py | Python | bsd-3-clause | 5,702 |
from datetime import timedelta
import numpy as np
import pandas as pd
import pytest
import xarray as xr
from xarray.coding.cftimeindex import (
CFTimeIndex, _parse_array_of_cftime_strings, _parse_iso8601_with_reso,
_parsed_string_to_bounds, assert_all_valid_date_type, parse_iso8601)
from xarray.tests import a... | chunweiyuan/xarray | xarray/tests/test_cftimeindex.py | Python | apache-2.0 | 29,119 |
#This file creates the string for the index.html file using python
from cgi import escape
import settings
from urllib import unquote
from tweepy.streaming import StreamListener
from tweepy import Stream
import json
import tweepy
from urllib2 import Request, urlopen, URLError
# The Publisher passes the R... | j0sh77/TSP | index.py | Python | mit | 3,701 |
##############################################################################
#
# Copyright (C) 2015 ADHOC SA (http://www.adhoc.com.ar)
# All Rights Reserved.
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU Affero General Public License as
# pub... | ingadhoc/reporting-engine | report_extended_payment_group/__manifest__.py | Python | agpl-3.0 | 1,494 |
# 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 https://mozilla.org/MPL/2.0/.
from typing import List, Tuple
from unittest import mock
from django.conf import settings
from django.test import over... | mozilla/bedrock | bedrock/contentful/tests/test_contentful_commands.py | Python | mpl-2.0 | 25,021 |
#!/usr/bin/python
"""
This is a wrapper to run the 'lacheck(1)' tool from the 'lacheck' package.
Why do we need this wrapper?
- lacheck does NOT report in its exit status whether it had warnings or not.
- it is too verbose when there are no warnings.
"""
import sys # for argv, exit, stderr
import subprocess # for ... | veltzer/riddling | scripts/wrapper_lacheck.py | Python | gpl-3.0 | 939 |
from os import path
from vexbot.util.get_vexdir_filepath import get_vexdir_filepath
def get_certificate_filepath():
vexdir = get_vexdir_filepath()
certs = path.join(vexdir, 'certificates')
return certs
def get_certificate_directories() -> (str, str):
root = get_certificate_filepath()
public_dir ... | benhoff/vex | vexbot/util/get_certificate_filepath.py | Python | gpl-3.0 | 1,724 |
from odbAccess import openOdb
from abapy.postproc import GetVectorFieldOutput_byRpt
odb_name = 'indentation.odb'
odb = openOdb(odb_name)
U = GetVectorFieldOutput_byRpt(
odb = odb,
instance = 'I_SAMPLE',
step = 0,
frame = -1,
original_position = 'NODAL',
new_position = 'NODAL',
position = 'node',
fie... | lcharleux/abapy | doc/example_code/postproc/GetVectorFieldOutput_byRpt.py | Python | gpl-2.0 | 406 |
from . import get_main_movies_base_data
from . import get_main_movies_full_data
from . import get_celebrities_full_data
from . import down_video_images
from . import down_celebrity_images
| billvsme/videoSpider | webs/douban/tasks/__init__.py | Python | mit | 188 |
import re
import itertools
def is_nice(s):
for pair in ["ab","cd","pq", "xy"]:
if pair in s:
# It does not contain the strings ab, cd, pq, or xy
return False
v = 0
vowels = [x for x in "aeiou"]
for letter in s:
if letter in vowels:
v += 1
if v < 3... | jrabbit/advent-code | day5/main.py | Python | gpl-3.0 | 1,351 |
"""
Use lldb Python SBFrame API to get the argument values of the call stacks.
And other SBFrame API tests.
"""
from __future__ import print_function
import lldb
from lldbsuite.test.decorators import *
from lldbsuite.test.lldbtest import *
from lldbsuite.test import lldbutil
class FrameAPITestCase(TestBase):
... | google/llvm-propeller | lldb/test/API/python_api/frame/TestFrames.py | Python | apache-2.0 | 8,667 |
import numpy as np
from numpy.testing import (run_module_suite,
assert_,
assert_equal,
assert_array_almost_equal,
assert_raises)
from dipy.denoise.non_local_means import non_local_means
def test_nlmeans_static(... | nilgoyyou/dipy | dipy/denoise/tests/test_non_local_means.py | Python | bsd-3-clause | 2,902 |
from PHPUnitKit.tests import unittest
from PHPUnitKit.plugin import is_valid_php_version_file_version
class TestIsValidPhpVersionFileVersion(unittest.TestCase):
def test_invalid_values(self):
self.assertFalse(is_valid_php_version_file_version(''))
self.assertFalse(is_valid_php_version_file_versi... | gerardroche/sublime-phpunit | tests/test_is_valid_php_version_file_version.py | Python | bsd-3-clause | 3,218 |
#!/usr/bin/env python
import os
import sys
if __name__ == "__main__":
os.environ.setdefault("DJANGO_SETTINGS_MODULE", "forum.settings")
from django.core.management import execute_from_command_line
execute_from_command_line(sys.argv) | zhangvs1988/zhangyl-Djangodemo | manage.py | Python | gpl-3.0 | 247 |
from magichour.api.local.util.log import get_logger, log_time
from magichour.api.local.modeleval.apply import apply_events
logger = get_logger(__name__)
@log_time
def evalapply_step(gen_events, timed_templates, **kwargs):
logger.info("Applying events to timed templates...")
timed_events = apply_events(gen_ev... | d-grossman/magichour | magichour/api/local/sample/steps/evalapply.py | Python | apache-2.0 | 377 |
import pytest
class TestCivserver:
@pytest.mark.complete("civserver -", require_cmd=True)
def test_1(self, completion):
assert completion
| algorythmic/bash-completion | test/t/test_civserver.py | Python | gpl-2.0 | 156 |
from channels.routing import route
from workflows.consumers import *
channel_routing = [
route("websocket.connect", ws_add),
#route("websocket.receive", ws_message),
route("websocket.disconnect", ws_disconnect),
] | xflows/clowdflows-backend | mothra/routing.py | Python | mit | 226 |
import contextlib
import pymongo
import redis
from redongo import redongo_server
import sys
import signal
REDIS_HOST = 'localhost'
REDIS_DB = 0
REDIS_QUEUE = 'REDONGO_TEST_QUEUE'
REDIS_QUEUE_FAILED = 'REDONGO_TEST_QUEUE_FAILED'
import os
env = os.getenv('TRAVIS')
if env == 'true':
REDIS_HOST = 'local... | stoneworksolutions/redongo | tests/server/test_server.py | Python | mit | 2,136 |
import os
import pylirc
import select
from events import UIEvent
class Commands(object):
def __init__(self, poll):
thisdir = os.path.dirname(__file__)
config = os.path.join(thisdir, "lirc.rc")
self._fd = pylirc.init("headless-home-music", config, False)
if self._fd == 0:
... | bsmedberg/headless-home-music | audio-client/ircommands.py | Python | apache-2.0 | 897 |
"""
Room Typeclasses for the TutorialWorld.
This defines special types of Rooms available in the tutorial. To keep
everything in one place we define them together with the custom
commands needed to control them. Those commands could also have been
in a separate module (e.g. if they could have been re-used elsewhere.)... | feend78/evennia | evennia/contrib/tutorial_world/rooms.py | Python | bsd-3-clause | 40,655 |
#!/usr/bin/env python
# Copyright 2015-2016 Samsung Electronics Co., Ltd.
#
# 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 requir... | iamblue/ml-mt7687-config | js2c.py | Python | apache-2.0 | 3,997 |
# Copyright 2020 Pants project contributors (see CONTRIBUTORS.md).
# Licensed under the Apache License, Version 2.0 (see LICENSE).
import textwrap
from textwrap import dedent
from pants.engine.internals.native_engine import FileDigest
from pants.jvm.resolve.common import ArtifactRequirement, Coordinate, Coordinates
fr... | pantsbuild/pants | src/python/pants/jvm/run_deploy_jar_intergration_test.py | Python | apache-2.0 | 4,405 |
#!/usr/bin/env python
#
# A library that provides a Python interface to the Telegram Bot API
# Copyright (C) 2015-2018
# Leandro Toledo de Souza <devs@python-telegram-bot.org>
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU Lesser Public License as published by
#... | Eldinnie/python-telegram-bot | tests/test_shippingquery.py | Python | gpl-3.0 | 3,416 |
# -*- coding: utf-8 -*-
from django.http import HttpResponse
from django.utils.encoding import iri_to_uri
class HttpResponseNoContent(HttpResponse):
status_code = 204
def __init__(self):
HttpResponse.__init__(self)
class HttpResponseGetAfterPost(HttpResponse):
status_code = 303
def __init__... | decadecity/ct | caffeine_tracker/lib/utils.py | Python | unlicense | 629 |
#!/usr/bin/env python
# Copyright 2020 The StackStorm Authors.
# Copyright 2019 Extreme Networks, Inc.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/... | StackStorm/st2 | contrib/packs/tests/test_action_download.py | Python | apache-2.0 | 25,944 |
# -*- coding: utf-8 -*-
##############################################################################
#
# Copyright (c) 2010 Elepe Servicios (http://www.elepeservicios.com.ar)
# All Rights Reserved
#
# Author : Dario Kevin De Giacomo (Elepe Servicios)
#
# This program is free software: you can redistribute it and/or m... | pronexo-odoo/odoo-argentina | l10n_ar_wsafip_fex/__init__.py | Python | agpl-3.0 | 1,180 |
#!/usr/bin/python
# -*- coding: utf-8 -*-
# (c) 2015, Joseph Callen <jcallen () csc.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',
... | e-gob/plataforma-kioscos-autoatencion | scripts/ansible-play/.venv/lib/python2.7/site-packages/ansible/modules/cloud/vmware/vmware_dvs_host.py | Python | bsd-3-clause | 8,384 |
from django.contrib.contenttypes.models import ContentType
from django.core.exceptions import ObjectDoesNotExist
from django.http import HttpResponseRedirect, HttpResponseBadRequest
from django.views.generic import FormView
from django.utils.decorators import method_decorator
from django.contrib.auth.decorators import... | openpolis/open_municipio | open_municipio/monitoring/views.py | Python | agpl-3.0 | 3,908 |
import re
from pprint import pprint
from itertools import dropwhile, takewhile
def get_cdp_neighbor(sh_cdp_neighbor_detail):
with open(sh_cdp_neighbor_detail) as f:
while True:
f = dropwhile(lambda x: not 'Device ID' in x, f)
lines = takewhile(lambda y: not '-----' in y, f)
... | emilgaripov/emilgaripov.github.io | code_examples/python_generator/parse_cdp_file_ver2.py | Python | mit | 1,136 |
# -*- coding: utf-8 -*-
##############################################################################
#
# Copyright (C) 2013-2014 Didotech Inc. (<http://www.didotech.com>)
# All Rights Reserved
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU Affero G... | odoousers2014/LibrERP | l10n_it_account_report/invoice.py | Python | agpl-3.0 | 15,287 |
#!/usr/bin/python3
import secrets
import sys
from collections import Counter
d3 = [1, 2, 3]
d6 = [1, 2, 3, 4, 5, 6]
'''
You can change this value if it takes too long to do a calculation. A larger number takes longer
but will give a more 'average' list of outcomes, while a smaller number will be faster b... | daed/mathhammer | mathhammer.py | Python | gpl-3.0 | 5,431 |
import time
import datetime
from datetime import timedelta
from unittest import mock
from django.conf import settings
from django.core.signals import request_finished, request_started
from django.test.testcases import TransactionTestCase
from post_request_task.task import _discard_tasks, _stop_queuing_tasks
from ol... | psiinon/addons-server | src/olympia/amo/tests/test_celery.py | Python | bsd-3-clause | 4,239 |
import ROOT
from mock import MagicMock, Mock
def clone_and_rename(name='Clone'):
h = ROOT.TH1F(name, '', 2, 0., 1.)
return h
hist = Mock()
hist.GetName = MagicMock(return_value='foo')
hist.GetNbinsX = MagicMock(return_value=2)
hist.Clone = MagicMock(side_effect=clone_and_rename)
| morgenst/PyAnalysisTools | tests/unit/Mocks.py | Python | mit | 291 |
# vim: tabstop=8 expandtab shiftwidth=4 softtabstop=4
import time
import re
from tenyksservice import TenyksService, run_service, FilterChain
from tenyksservice.config import settings
class HahaMeter(TenyksService):
irc_message_filters = {
'haha': FilterChain(
[re.compile(r'\b(haha)\b', flag... | cblgh/tenyks-contrib | src/tenykshahameter/main.py | Python | mit | 849 |
#! /usr/bin/env python3
'''
Downloads a plot obtained through CCMC visualization web interface.
Copyright 2015, 2016 Ilja Honkonen
All rights reserved.
Redistribution and use in source and binary forms, with or without modification,
are permitted provided that the following conditions are met:
* Redistributions of s... | nasailja/pamhd | miscellaneous/ccmc/get_plot.py | Python | gpl-3.0 | 10,321 |
# This file is part of Py6S.
#
# Copyright 2012 Robin Wilson and contributors listed in the CONTRIBUTORS file.
#
# Py6S is free software: you can redistribute it and/or modify
# it under the terms of the GNU Lesser General Public License as published by
# the Free Software Foundation, either version 3 of the License, o... | robintw/Py6S | Py6S/Params/__init__.py | Python | lgpl-3.0 | 1,284 |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
#
# vmware.py
#
# Copyright © 2013-2016 Antergos
#
# This file is part of Cnchi.
#
# Cnchi 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 o... | Wyn10/Cnchi | cnchi/hardware/vmware.py | Python | gpl-3.0 | 1,720 |
#!/usr/bin/env python
"""Test play() function withmock Midi object."""
import time
NOTES = {
'c': 0,
'd': 2,
'e': 4,
'f': 5,
'g': 7,
'a': 9,
'b': 11,
}
def sleep(s):
print("... sleeping %s ms" % s)
time.sleep(s / 1000.)
class MockMidi:
def note_on(self, *args, **kw):
... | SpotlightKid/microbit-worldtour-monifa | test_midiplay.py | Python | mit | 1,686 |
#Schedule-generator for LHL use written by Acebulf (acebulf at gmail.com)
#Current version 1.0 -- Jan 16 2014
#Copyrighted under the MIT License (see License included in the github repo)
import random
import time
while 1:
print "Starting random-schedule generation process..."
starttime = time.time()
kill ... | Acebulf/HockeyPythonScripts | schedule.py | Python | mit | 3,298 |
from distutils.core import setup,Extension
src = ['pyMPTK.cpp', 'pyMPTK_book.cpp', 'pyMPTK_decompose.cpp', 'pyMPTK_atom.cpp']
py_modules = ['mptkplot']
inc_dir = ['/usr/include', '@MPTK_SOURCE_DIR@','@MPTK_SOURCE_DIR@/src/utils/libtinyxml', '@MPTK_SOURCE_DIR@/src/libmptk/', '@MPTK_BINARY_DIR@' , '@MPTK_BINARY_DIR@/s... | danstowell/mptk | src/python/setup.py | Python | gpl-2.0 | 930 |
# -*- coding: utf-8 -*-
##############################################################################
#
# Copyright (C) 2014 Otra localización argentina de Odoo.
# http://odoo-l10n-ar.github.io/
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public Lice... | odoo-argentina/partner | l10n_ar_states/models/__init__.py | Python | agpl-3.0 | 995 |
# encoding: utf-8
import datetime
from south.db import db
from south.v2 import SchemaMigration
from django.db import models
class Migration(SchemaMigration):
def forwards(self, orm):
db.rename_table('galleries_gallery', 'ella_galleries_gallery')
db.rename_table('galleries_galleryitem', 'ella_galle... | MichalMaM/ella-galleries | ella_galleries/south_migrations/0005_rename_tables_to_ella_galleries_prefix.py | Python | bsd-3-clause | 11,856 |
""" Various kinds of input widgets and form controls.
"""
from __future__ import absolute_import
import six
from ...properties import abstract
from ...properties import Bool, Int, Float, String, Date, RelativeDelta, Enum, List, Dict, Tuple, Either, Instance
from ..callbacks import Callback
from ..widget import Widge... | muku42/bokeh | bokeh/models/widgets/inputs.py | Python | bsd-3-clause | 4,898 |
from icalendar import Calendar, Event
from datetime import datetime
from pytz import UTC
from DBManager import initDB,insertSingleRecord,printTable,insertMultipleRecords
import time
def parseCalendar (calName, begintimeframe = 0, endtimeframe = int(time.time())) :
listOfEvents = []
calFile = open(calName, 'r... | LeanVel/TakeoutsTimelining | CalendarParser.py | Python | gpl-3.0 | 3,816 |
#!/usr/bin/env python
#
# Generates a netcdf file.
#
#
# agomez (at) tacc.utexas.edu
# 30 Oct 2014
#
# ---------------------------------------------------------------------
import numpy as np
from scipy.io import netcdf
#Create a new netCDF file
f = netcdf.netcdf_file('simple.nc', 'w')
f.history = 'Created for a test... | antoniogi/HPC | Python/TACC_HPC/3_scipy/netcdf.py | Python | apache-2.0 | 676 |
"""Code complexity checking."""
from mccabe import McCabeChecker
from pylama.lint import Linter as Abstract
import ast
class Linter(Abstract):
"""Run complexity checking."""
@staticmethod
def run(path, code=None, params=None, **meta):
"""MCCabe code checking.
:return list: List of erro... | JetChars/vim | vim/bundle/python-mode/pymode/libs/pylama/lint/pylama_mccabe.py | Python | apache-2.0 | 831 |
## -*- coding: utf-8 -*-
import bs4
def BeautifulSoup(markup):
return bs4.BeautifulSoup(markup, "html.parser")
from . import temporary_settings
def test_queue_track_list_print_all(app, queue, tracks):
"""
Track list displays all tracks in one giant document
Used for printing
"""
#response = ... | calaldees/KaraKara | website/tests/integration/test_queue_track_list.py | Python | gpl-3.0 | 2,773 |
# 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/storage/azure-mgmt-storage/azure/mgmt/storage/v2021_04_01/models/__init__.py | Python | mit | 12,959 |
# -*- coding: utf-8 -*-
# © 2014 Numérigraphe SARL
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html).
from collections import Counter
from openerp import models, api, fields
import openerp.addons.decimal_precision as dp
class ProductProduct(models.Model):
"""Add the computation for the stock a... | avoinsystems/stock-logistics-warehouse | stock_available_sale/models/product_product.py | Python | agpl-3.0 | 4,972 |
import numpy as np
import matplotlib.pyplot as plt
import pandas as pd
import random as ran
BATCH=600
TEST=100
ERROR=25
learning_rate = 0.001
training_iters = 3000
batch_size = BATCH-TEST
display_step = 100
n_input = 7
n_steps = 20
n_hidden = 20
n_classes = 7
import tensorflow as tf
from sklearn.utils import shuf... | chengchingwen/moth_prediction | predict.py | Python | artistic-2.0 | 2,471 |
"""
A BBCode target.
http://www.bbcode.org
"""
from targets import _
NAME = _('BBCode document')
TYPE = 'wiki'
HEADER = """\
%(HEADER1)s
%(HEADER2)s
%(HEADER3)s
"""
# http://www.phpbb.com/community/faq.php?mode=bbcode
# http://www.bbcode.org/reference.php (but seldom implemented)
TAGS = {
'title1' ... | farvardin/txt2tags-test | targets/bbcode.py | Python | gpl-2.0 | 2,787 |
import unittest
import time
from xml.etree import ElementTree
from pymal import account
from pymal import manga
from pymal import consts
from tests.constants_for_testing import ACCOUNT_TEST_USERNAME, ACCOUNT_TEST_PASSWORD
class ReloadTestCase(unittest.TestCase):
@classmethod
def setUpClass(cls):
cl... | pymal-developers/pymal | tests/account_objects/test_my_manga.py | Python | bsd-3-clause | 4,463 |
import atexit
import tempfile
from mkt.settings import * # noqa
_tmpdirs = set()
def _cleanup():
try:
import sys
import shutil
except ImportError:
return
tmp = None
try:
for tmp in _tmpdirs:
shutil.rmtree(tmp)
except Exception, exc:
sys.stder... | Hitechverma/zamboni | settings_test.py | Python | bsd-3-clause | 1,934 |
from __future__ import print_function
from __future__ import absolute_import
import pandas as pds
class Custom(object):
"""
Applies a queue of functions when instrument.load called.
Nano-kernel functionality enables instrument objects that are
'set and forget'. The functions are always run whene... | aburrell/pysat | pysat/_custom.py | Python | bsd-3-clause | 9,814 |
# -*- encoding: utf-8 -*-
# This file is distributed under the same license as the Django package.
#
from __future__ import unicode_literals
# The *_FORMAT strings use the Django date format syntax,
# see http://docs.djangoproject.com/en/dev/ref/templates/builtins/#date
DATE_FORMAT = 'j F Y'
TIME_FORMAT = 'H:i'
# DATE... | BitWriters/Zenith_project | zango/lib/python3.5/site-packages/django/conf/locale/ga/formats.py | Python | mit | 747 |
#!/usr/bin/python3.4
import pymysql
def dbTable():
# Open database connection
db = pymysql.connect("localhost", "root", "aspirinc12", "music")
# prepear a cursor object
c = db.cursor()
# drop table if it already exist using execute() method
c.execute("DROP TABLE IF EXISTS LANWE")
# Crea... | MrLanwe/Laplayer | database_creation.py | Python | mit | 873 |
# Copyright (C) 2003 CAMP
# Please see the accompanying LICENSE file for further information.
"""
Python wrapper functions for the ``C`` package:
Basic Linear Algebra Subroutines (BLAS)
See also:
http://en.wikipedia.org/wiki/Basic_Linear_Algebra_Subprograms
and
http://www.netlib.org/lapack/lug/node145.html
"""
impo... | robwarm/gpaw-symm | gpaw/utilities/blas.py | Python | gpl-3.0 | 11,661 |
# 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
# d... | openstack/python-troveclient | troveclient/osc/v1/database_root.py | Python | apache-2.0 | 4,945 |
# tests.test_simulation.test_workload.test_base
# Tests for the base workload interface in CloudScope
#
# Author: Benjamin Bengfort <bengfort@cs.umd.edu>
# Created: Mon Aug 01 18:32:13 2016 -0400
#
# Copyright (C) 2016 University of Maryland
# For license information, see LICENSE.txt
#
# ID: test_base.py [] benjamin... | bbengfort/cloudscope | tests/test_simulation/test_workload/test_base.py | Python | mit | 4,598 |
def convert(string, number):
string_len = len(string)
if number == 0 or number >= string_len or number == 1:
return string
row = 0
temp_list = []
while row < number:
if row == 0 or row == number - 1:
steps = 2*(number - 2) + 1
for x in xrange(row, string_len, ... | purushothamc/myibitsolutions | strings/zig_zag_string.py | Python | gpl-3.0 | 1,555 |
import random, string
from datetime import datetime
from django.db import models
from django.utils.translation import ugettext_lazy as _
from django.contrib.auth.models import User
from filer.fields.image import FilerImageField
from import_export import resources
class Category(models.Model):
''' Category in wh... | bevenky/dev-cms | posts/models.py | Python | mit | 3,278 |
# Copyright 2014: Mirantis 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 b... | eonpatapon/rally | rally/plugins/openstack/scenarios/heat/utils.py | Python | apache-2.0 | 16,396 |
# -*- coding: utf-8 -*-
# Generated by Django 1.11.6 on 2017-10-18 19:57
from __future__ import unicode_literals
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('server', '0001_initial'),
]
operations = [
migrations.AlterField(
... | ITCoders/MobileCloudIR | src/server/server/migrations/0002_auto_20171018_1957.py | Python | mit | 495 |
import inspect
import os
import shutil
import luigi
projdir_struct = {
'bin':None,
'conf':None,
'doc' :
{ 'paper': None },
'experiments' :
{ '2000-01-01-example' :
{ 'audit':None,
'bin':None,
'conf':None,
'data':None,
... | samuell/sciluigi | tools/init_projdir.py | Python | mit | 1,717 |
#!/usr/bin/env python
# coding=utf-8
import commands
import sys
from docopt import docopt
#from handler import LogFileClient
from sdutil.log_util import getLogger
from sdutil.date_util import *
reload(sys)
sys.setdefaultencoding('utf-8')
from elasticsearch import Elasticsearch
from pdb import *
import requests
import ... | zhaochl/python-utils | es/elasticsearch_util.py | Python | apache-2.0 | 4,771 |
#!/usr/bin/env python
import sys
import os
from collections import defaultdict
# Solution with no hard coded path would be welcome
sys.path.append(os.path.dirname(os.path.abspath(sys.argv[0])) + "/../")
# from crf.data.dataset import DataSet, divide_in_two
from ner.data import NerDataSet
from ner.nerecognizer import... | lpawluczuk/summar.pl | Summarizer/nlp_tools/nerf/scripts/error_analisys.py | Python | mit | 5,260 |
"""A python script to manage minecraft servers
Designed for use with MineOS: http://minecraft.codeemo.com
"""
__author__ = "William Dizon"
__license__ = "GNU GPL v3.0"
__version__ = "0.6.0"
__email__ = "wdchromium@gmail.com"
STOCK_PROFILES = [
{
'name': 'vanilla111',
'type': 'standard_jar',
... | hexparrot/mineos | stock_profiles.py | Python | gpl-3.0 | 3,192 |
print 1 + 2
print 2 - 1
print 2 * 2
print -1
print -(-1)
print ~1
| jplevyak/pyc | tests/t5.py | Python | bsd-3-clause | 66 |
'''
Best Effort Callback.
For instructions on how to test in a simulated environment please see:
tests/interactive/best_effort_cb.py
'''
from cycler import cycler
from datetime import datetime
from io import StringIO
import itertools
import numpy as np
import matplotlib.pyplot as plt
from pprint import ... | ericdill/bluesky | bluesky/callbacks/best_effort.py | Python | bsd-3-clause | 24,341 |
"""
Copyright 2010 IO Rodeo Inc.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software... | acrobotic/py2scad | py2scad/transforms.py | Python | apache-2.0 | 7,754 |
"""
Courseware views functions
"""
import logging
import urllib
import json
from datetime import datetime
from django.utils.translation import ugettext as _
from django.conf import settings
from django.core.context_processors import csrf
from django.core.exceptions import PermissionDenied
from django.core.urlresolve... | iivic/BoiseStateX | lms/djangoapps/courseware/views.py | Python | agpl-3.0 | 56,765 |
import hashlib
import json
import re
import io
import ssl
from datetime import timedelta, datetime
import dateparser
import pytz
import requests
import splunklib.client as client
import splunklib.results as results
import urllib2
import urllib3
from StringIO import StringIO
from splunklib.binding import HTTPError, nam... | demisto/content | Packs/SplunkPyPreRelease/Integrations/SplunkPyPreRelease/SplunkPyPreRelease.py | Python | mit | 111,308 |
#!/usr/bin/env python
"""Tests the FileParser API
"""
from tvnamer.files import FileParser
from tvnamer.data import EpisodeInfo, DatedEpisodeInfo, NoSeasonEpisodeInfo
from helpers import assertType, assertEquals
def test_episodeinfo():
"""Parsing a s01e01 episode should return EpisodeInfo class
"""
p = ... | dbr/tvnamer | tests/test_fileparse_api.py | Python | unlicense | 1,577 |
# This file is part of Shoop.
#
# Copyright (c) 2012-2015, Shoop Ltd. All rights reserved.
#
# This source code is licensed under the AGPLv3 license found in the
# LICENSE file in the root directory of this source tree.
from .commands import COMMANDS
from .excludes import set_exclude_patters, get_exclude_patterns
from ... | lawzou/shoop | shoop_setup_utils/__init__.py | Python | agpl-3.0 | 780 |
# -*- encoding: utf-8 -*-
from .comportamiento import Comportamiento
class Rey(Comportamiento):
def _puedeMoverA(self, columna, fila):
if abs(self.fila - fila) == 1 and abs(self.columna - columna) == 1:
# se mueve en diagonal:
return True
elif self.columna == columna and a... | barrazamiguel/pydrez | fichas/rey.py | Python | gpl-3.0 | 630 |
import json
from Buffer import Buffer
class Stream_Buffer(Buffer):
def __init__(self, settings=None):
"""
Initialize the stream buffer object.
"""
super(Stream_Buffer, self).__init__(settings)
self._origin = settings.get("stream_network_origin")
self._size = settin... | timvandermeij/mobile-radio-tomography | reconstruction/Stream_Buffer.py | Python | gpl-3.0 | 2,590 |
import rest_framework.serializers
def strip_empty_values(data):
return dict((k, v) for k, v in data.iteritems() if v not in [None, '', []])
def match_and_update_by_uuid(unsaved_models, field, saved_models):
for unsaved_model in unsaved_models:
if not getattr(unsaved_model, field):
continu... | StanfordBioinformatics/loom | server/loomengine_server/api/serializers/__init__.py | Python | agpl-3.0 | 2,338 |
#!/usr/bin/env python
"""Django's command-line utility for administrative tasks."""
import os
import sys
def main():
os.environ.setdefault('DJANGO_SETTINGS_MODULE', 'helloworld.settings')
try:
from django.core.management import execute_from_command_line
except ImportError as exc:
raise Imp... | fangxinmiao/projects | Architeture/Backend/Framework/WebBenchmarker/frameworks/Python/django/helloworld/manage.py | Python | gpl-3.0 | 630 |
# -*- coding: cp1252 -*-
import Tkinter
class ItemInfo:
"""Ein kleiner Infobereich für einen Planeten, der neben der Sidebar angezeigt wird"""
def __init__(self, Parent, Item, X):
self.Parent = Parent
self.Planet = Item.Planet
self.Planet.Register(self)
Height = 110
Wi... | simonkrogmann/planets | gui/item_info.py | Python | mit | 1,529 |
# simple Rational number class
# assumes both gcd and lcm are already imported
#import sys
#sys.path.append( "/home/mark/Dropbox-Work/Projects-Geany/" )
#from frac import gcd, lcm
def gcd(a,b):
# Ensure that a > b, if it is not reverse a & b
if not a>b:
a,b=b,a
print("Initial fraction is {}/{}".format(a,b))
... | mcgettin/ditOldProgramming | yr2/sem1/sample-programs/rationalTest.py | Python | mit | 3,074 |
# -*- coding: utf-8 -*-
# project imports
from .tools import GuiTools
from .protocol import Protocol
from .screen import Screen
from ..helpers.master_server import authenticate_spectator
class GUI:
def __init__(self):
GuiTools.initialize()
self._protocol = Protocol(authenticate_spectator, Screen... | koala-team/Chillin-PyServer | chillin_server/gui/__init__.py | Python | agpl-3.0 | 496 |
# Six
import six
# Django
from django.contrib import admin
from django.db.models import Count
from django.utils.html import format_html, format_html_join
from django.utils.translation import ugettext_lazy as _
try:
from django.urls import reverse
except ImportError: # pragma: no cover
from django.core.urlreso... | ninemoreminutes/django-fortunecookie | fortunecookie/admin.py | Python | bsd-3-clause | 5,254 |
from Products.DataCollector.plugins.CollectorPlugin import (
SnmpPlugin, GetTableMap,
)
class EMCIsilonPowerSensors(SnmpPlugin):
relname = 'emcisilon_powersensors'
modname = 'ZenPacks.community.EMCIsilon.EMCIsilonPowerSensor'
snmpGetTableMaps = (
GetTableMap(
'powerSensorTable... | linkslice/ZenPacks.community.EMCIsilon | ZenPacks/community/EMCIsilon/modeler/plugins/community/snmp/EMCIsilonPowerSensors.py | Python | mit | 1,370 |
import requests
api_key = 'aaca14463ad73872670c933a647bdf62c249d378ef8fc3b713129f08e38c3f33'
def encrypt(msg):
content = requests.get('http://iem.eatpwnnosleep.com/encrypt/' + api_key + '-%d' % msg).text
return int(content)
check = {}
candidates = []
for i in range(2**24):
if i & 0xff == 0:
pri... | Qwaz/solved-hacking-problem | SCTF/2017 Finals/iem/solver.py | Python | gpl-2.0 | 496 |
#!/usr/bin/env python
from __future__ import division, print_function
# cloudberryCam v0 copyright (c) 2013-2015 Lars Rosengreen
# 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... | lrosengreen/cloudberry | video.py | Python | gpl-3.0 | 3,719 |
# Copyright 2011 James McCauley
#
# This file is part of POX.
#
# POX 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.
#
# POX is distri... | PrincetonUniversity/AdvNet-OF_Scripts | evaluation/switch/flowmod_test/pox/pox/samples/l2_bell_burst.py | Python | apache-2.0 | 6,408 |
# -*- encoding: utf-8 -*-
#
# The Qubes OS Project, http://www.qubes-os.org
#
# Copyright (C) 2017 Marek Marczykowski-Górecki
# <marmarek@invisiblethingslab.com>
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU Lesser General Public L... | marmarek/qubes-core-mgmt-client | qubesadmin/tests/tools/qvm_volume.py | Python | lgpl-2.1 | 28,442 |
import re
from io import BytesIO
from .annotation import Annotation
from .data import Reader, Writer, ENC
from .utils import log, normalise_link
class Prepare(object):
"""Map entity IDs to a different KB, normalises entity IDs, and select documents by doc-ID
"""
def __init__(self, fname, keep=None, mappin... | andychisholm/neleval | neleval/prepare.py | Python | apache-2.0 | 1,886 |
from distribute_setup import use_setuptools
use_setuptools()
from setuptools import *
setup(
name='SysadminToolkit',
version='0.1.0',
author='Louis-Philippe Theriault',
author_email='lpther@gmail.com',
packages=find_packages('./sysadmintoolkit'),
package_dir={'sysadmintoolkit':'./sysadmintool... | lpther/SysadminToolkit | setup.py | Python | mit | 557 |
#!/usr/bin/env python
import argparse
import logging
import sys
from ciphers.rsa import keygen, cipher
def _translate(cipher_func, key_file, infile, outfile, mode='encrypt'):
logging.debug('%s: %s %s %s', mode, key_file.name, infile.name,
outfile.name)
cipher_func(key_file, infile, outfile... | shakirjames/crypto | rsa.py | Python | bsd-2-clause | 2,767 |
# This file is part of Indico.
# Copyright (C) 2002 - 2019 CERN
#
# Indico is free software; you can redistribute it and/or
# modify it under the terms of the MIT License; see the
# LICENSE file for more details.
from __future__ import unicode_literals
import os
import uuid
from io import BytesIO
from flask import f... | mvidalgarcia/indico | indico/modules/events/registration/controllers/management/reglists.py | Python | mit | 30,197 |
# -*- coding: utf-8 -*-
"""
Master Plugin
Copyright (C) 2010-2012 Olaf Lüke <olaf@tinkerforge.com>
Copyright (C) 2012-2014 Matthias Bolte <matthias@tinkerforge.com>
extension_type.py: ExtensionType for Master Plugin implementation
This program is free software; you can redistribute it and/or
modify it under the terms... | D4wN/brickv | src/brickv/plugin_system/plugins/master/extension_type.py | Python | gpl-2.0 | 2,684 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.