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 |
|---|---|---|---|---|---|
from dal import autocomplete
from dashboard.models import PUC, PUCKind
from django.db.models import Q
class PUCAutocomplete(autocomplete.Select2QuerySetView):
def get_queryset(self):
if self.q:
split_q = self.q.split(":")
if len(split_q) > 1:
puckind = Q(kind__name_... | HumanExposure/factotum | dashboard/views/puc_autocomplete.py | Python | gpl-3.0 | 790 |
from unittest import TestCase
from unittest.mock import Mock
from grapher import errors
from grapher.parsers import QueryParser
from grapher.parsers import query
from nose_parameterized import parameterized
class QueryParserTest(TestCase):
def setUp(self):
r = Mock()
r.args = Mock()
r.arg... | lucasdavid/grapher | tests/parsers/query_test.py | Python | mit | 1,148 |
#!flask/bin/python
import os
import sys
if sys.platform == 'win32':
pybabel = 'flask\\Scripts\\pybabel'
else:
pybabel = 'flask/bin/pybabel'
if len(sys.argv) != 2:
print "usage: tr_init <language-code>"
sys.exit(1)
os.system(pybabel +
' extract -F babel.cfg -k lazy_gettext -o messages.pot app')... | wasmith63/bluebird | tr_init.py | Python | bsd-3-clause | 440 |
import sys
sys.path.insert(0, "..")
from mcda.types import Criteria
from xml.etree import ElementTree
from data_ticino_new import *
crit = c.to_xmcda()
ElementTree.dump(crit)
crit2 = Criteria()
crit2.from_xmcda(crit)
print(crit2)
xmcda = a.to_xmcda()
ElementTree.dump(xmcda[0])
ElementTree.dump(xmcda[1])
| oso/qgis-etri | tests/test_mcda.py | Python | gpl-3.0 | 308 |
#!/usr/bin/env python3
import os
import glob
for lang in ("sme", "est", "fin"):
for gender in ("M", "F"):
for tool in ("s", "v"):
r = range(5,10)
if lang == "sme":
r = range(3,14)
for order in r:
for type in ("m", "w"):
... | phsmit/iwclul2016-scripts | 04_recognize/configs/complete_wikipedia/gen_configs.py | Python | bsd-3-clause | 1,519 |
from .zoo import get_model # noqa: F401
from .weights_fetcher import fetch_weights # noqa: F401
from .git_cloner import GitCloneError # noqa: F401
from .model_loader import ModelLoader # noqa: F401
| bethgelab/foolbox | foolbox/zoo/__init__.py | Python | mit | 202 |
#
# SelfTest/Util/test_strxor.py: Self-test for XORing
#
# ===================================================================
#
# Copyright (c) 2014, Legrandin <[email protected]>
# All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided tha... | cloudera/hue | desktop/core/ext-py/pycryptodomex-3.9.7/lib/Cryptodome/SelfTest/Util/test_strxor.py | Python | apache-2.0 | 10,618 |
#!/usr/bin/env python
__author__ = "Justin Kuczynski"
__copyright__ = "Copyright 2011, The QIIME Project"
__credits__ = ["Justin Kuczynski"]
__license__ = "GPL"
__version__ = "1.9.1-dev"
__maintainer__ = "Justin Kuczynski"
__email__ = "[email protected]"
"""runs upgma or nj on a distance matrix file, writes the resu... | adamrp/qiime | qiime/hierarchical_cluster.py | Python | gpl-2.0 | 2,603 |
# -*- coding: utf-8 -*-
# Copyright 2008-2015 Richard Dymond ([email protected])
#
# This file is part of Pyskool.
#
# Pyskool 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,... | skoolkid/pyskool | pyskool/run.py | Python | gpl-3.0 | 10,238 |
# -*- coding: utf-8 -*-
import wikipedia, re
import pagegenerators
import MySQLdb as mysqldb
import config
faSite = wikipedia.getSite('fa')
enSite=wikipedia.getSite('en')
def numbertopersian(a):
a = str(a)
a = a.replace(u'0', u'۰')
a = a.replace(u'1', u'۱')
a = a.replace(u'2', u'۲')
a = a.replace(... | PersianWikipedia/fawikibot | Compat codes/zziwneededpage.py | Python | mit | 4,252 |
# coding: utf-8
"""
Swaggy Jenkins
Jenkins API clients generated from Swagger / Open API specification # noqa: E501
The version of the OpenAPI document: 1.1.2-pre.0
Contact: [email protected]
Generated by: https://openapi-generator.tech
"""
import six
class OpenApiException(Exception):
"... | cliffano/swaggy-jenkins | clients/python-legacy/generated/openapi_client/exceptions.py | Python | mit | 5,136 |
from django.test import TestCase
from community.constants import (CONTENT_CONTRIBUTOR, CONTENT_MANAGER,
USER_CONTENT_MANAGER, COMMUNITY_ADMIN,
DEFAULT_COMMUNITY_ACTIVE_PAGE,
COMMUNITY_PRESENCE_CHOICES, COMMUNITY_TYPES_CH... | payal97/portal | systers_portal/community/tests/test_constants.py | Python | gpl-2.0 | 5,312 |
# -*- coding: utf-8 -*-
#
# Licensed to the Apache Software Foundation (ASF) under one
# or more contributor license agreements. See the NOTICE file
# distributed with this work for additional information
# regarding copyright ownership. The ASF licenses this file
# to you under the Apache License, Version 2.0 (the
#... | danielvdende/incubator-airflow | airflow/migrations/versions/4446e08588_dagrun_start_end.py | Python | apache-2.0 | 1,396 |
# Copyright (C) 2007-2012 University of Dundee & Open Microscopy Environment.
# All Rights Reserved.
import turbogears, cherrypy, re
from turbogears import controllers, expose, validators
from docutils.core import publish_parts
from time import gmtime, strftime
import os
from OmeValidator import *
# from model import... | rleigh-dundee/openmicroscopy | components/validator/WebApp/validator/controllers.py | Python | gpl-2.0 | 5,828 |
#!/usr/bin/python
# -*- coding:utf-8 -*-
#Filename: dict_zip.py
names = ['raymond', 'rachel', 'matthew']
colors = ['red', 'green', 'blue']
# d = dict(izip(names, colors))
d = dict(zip(names, colors))
print (d)
# >>> {'raymond': 'red', 'rachel': 'green', 'matthew': 'blue'}
| klose911/klose911.github.io | src/python/src/pythonic/dict/dict_zip.py | Python | apache-2.0 | 292 |
"""
DataSource is a wrapper for the OGR Data Source object, which provides
an interface for reading vector geometry data from many different file
formats (including ESRI shapefiles).
When instantiating a DataSource object, use the filename of a
GDAL-supported data source. For example, a SHP file or a
TIGER/Line... | edmorley/django | django/contrib/gis/gdal/datasource.py | Python | bsd-3-clause | 4,490 |
#!/usr/bin/python3
# -*- coding: utf-8
import logging
import warnings
from shapely import geometry as geopy
import feedinlib.models as models
import feedinlib.powerplants as plants
from oemof.db import coastdat
import oemof.db as db
try:
from matplotlib import pyplot as plt
except ImportError:
plt = None
... | oemof/oemof_pg | src/oemof/db/examples/feedinlib_example_coastdat.py | Python | gpl-3.0 | 3,962 |
# -*- coding: utf-8 -*-
#
# This file is part of Invenio.
# Copyright (C) 2017 CERN.
#
# Invenio is free software; you can redistribute it
# and/or modify it under the terms of the GNU General Public License as
# published by the Free Software Foundation; either version 2 of the
# License, or (at your option) any later... | omelkonian/cds | cds/modules/records/api.py | Python | gpl-2.0 | 2,845 |
"""Tests for `maas.client.flesh.machines`."""
from functools import partial
from operator import itemgetter
import yaml
from .testing import TestCaseWithProfile
from .. import ArgumentParser, machines, tabular
from ...enum import NodeStatus, PowerState
from ...testing import make_name_without_spaces
from ...viscera.t... | alburnum/alburnum-maas-client | maas/client/flesh/tests/test_machines.py | Python | agpl-3.0 | 6,399 |
#!/usr/bin/env python
# vim:fileencoding=utf-8
from __future__ import (unicode_literals, division, absolute_import,
print_function)
__license__ = 'GPL v3'
__copyright__ = '2013, Kovid Goyal <kovid at kovidgoyal.net>'
from PyQt5.Qt import QToolButton, QAction, pyqtSignal, QIcon
from calibre.gu... | sharad/calibre | src/calibre/gui2/actions/sort.py | Python | gpl-3.0 | 2,866 |
'''EffectWidget
============
(highly experimental)
Experiment to make an EffectWidget, exposing part of the shader
pipeline so users can write and easily apply their own glsl effects.
Basic idea: Take implementation inspiration from shadertree example,
draw children to Fbo and apply custom shader to a RenderContext.... | kpiorno/kivy3dgui | kivy3dgui/effectwidget.py | Python | mit | 24,600 |
import os
import imghdr
from collections import namedtuple
import numpy as np
from .. import io, img_as_ubyte
from ..transform import resize
from ..color import color_dict
from ..io.util import file_or_url_context, is_url
from ..io.collection import ImageCollection
import six
from six.moves.urllib import request
urlo... | pratapvardhan/scikit-image | skimage/novice/_novice.py | Python | bsd-3-clause | 14,924 |
# -*- encoding: utf-8 -*-
##############################################################################
#
# Copyright (c) 2009-2010 Salvatore J. Trimarchi <[email protected]>
# (http://salvatoreweb.co.cc)
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU G... | ksrajkumar/openerp-6.1 | openerp/addons/l10n_hn/__openerp__.py | Python | agpl-3.0 | 2,181 |
import unittest
import selenium.webdriver
from holmium.core import Page, Element, Elements, Locators, ElementMap
class GoogleMain(Page):
search_box = Element(Locators.NAME, "q", timeout=2)
google_buttons = ElementMap(
Locators.CSS_SELECTOR, ".jsb input", timeout=2,
key=lambda e: e.get_attribut... | kejkz/holmium.core | examples/google/test_search_text.py | Python | mit | 1,664 |
# 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 ... | SUSE/azure-sdk-for-python | azure-mgmt-network/azure/mgmt/network/v2016_12_01/models/security_rule.py | Python | mit | 5,400 |
#!/usr/bin/python
# Guillermo Torres MSc,
# [email protected], [email protected]
# Bioinformatic Research Group
# Biotechnology Institute of National University of Colombia
# 17 August 2011
# update November 2013
#* last update September 2014
#* trimming Ambioguosity "N", only the unambiougosity sequence that repr... | guigotoe/HISS | scripts/filedebugger/fileDeb.py | Python | gpl-3.0 | 4,491 |
# coding: utf-8
from django.conf import settings
from django.http import Http404
from .views import website_page
class WebsitePageMiddleware(object):
# noinspection PyMethodMayBeStatic
def process_response(self, request, response):
if response.status_code != 404:
return response
... | georgeyk/quickstartup | quickstartup/website/middleware.py | Python | mit | 586 |
from .core import ImageOptim, NoImagesOptimizedError | derrickorama/image_optim | image_optim/__init__.py | Python | mit | 52 |
# Copyright (C) 2013 Google Inc.
#
# This file is part of ycmd.
#
# ycmd 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.
#
# ycmd is di... | snakeleon/YouCompleteMe-x86 | third_party/ycmd/ycmd/user_options_store.py | Python | gpl-3.0 | 1,516 |
# -*- coding: utf-8 -*-
# Part of Odoo. See LICENSE file for full copyright and licensing details.
from odoo.exceptions import UserError, AccessError
from odoo.tests import tagged
from odoo.addons.sale_purchase.tests.common import TestCommonSalePurchaseNoChart
@tagged('-at_install', 'post_install')
class TestSalePur... | rven/odoo | addons/sale_purchase/tests/test_sale_purchase.py | Python | agpl-3.0 | 16,599 |
import pickle
import numpy
import matplotlib.pyplot as plt
import sys
sys.path.append("../tools/")
from feature_format import featureFormat, targetFeatureSplit
def Draw(pred, features, poi, mark_poi=False, name="image.png", f1_name="feature 1", f2_name="feature 2"):
""" some plotting code designed to help you v... | jordanopensource/data-science-bootcamp | MachineLearning/Session3/k_means_cluster.py | Python | mit | 2,249 |
from __future__ import absolute_import
import six
import warnings
import time
import logging
from sentry import options
from django.core.exceptions import SuspiciousOperation
from collections import namedtuple
from django.conf import settings
from requests.exceptions import RequestException, Timeout, ReadTimeout
from... | mvaled/sentry | src/sentry/http.py | Python | bsd-3-clause | 7,479 |
import parse
from flask import Blueprint, render_template
bpp = Blueprint('old', __name__)
HALL_URLS = [
"http://cms.business-services.upenn.edu/dining/hours-locations-a-menus/residential-dining/hill-house/daily-menu.html",
"http://cms.business-services.upenn.edu/dining/hours-locations-a-menus/residential-din... | adelq/penndining | old.py | Python | gpl-3.0 | 1,376 |
# Copyright (C) 2001,2002 Python Software Foundation
# email package unit tests
# The specific tests now live in Lib/email/test
from email.test.test_email import suite
from email.test.test_email_renamed import suite as suite2
from test import test_support
def test_main():
test_support.run_unittest(suite(... | j5shi/Thruster | pylibs/test/test_email.py | Python | gpl-2.0 | 412 |
#!/usr/bin/env python
"""
Usage: get-addons [-m] path1 [path2 ...]
Given a list of paths, finds and returns a list of valid addons paths.
With -m flag, will return a list of modules names instead.
"""
import ast
import os
import sys
from git_run import GitRun
MANIFEST_FILES = [
'__manifest__.py',
'__odoo__.... | OCA/maintainer-quality-tools | travis/getaddons.py | Python | agpl-3.0 | 7,667 |
# encoding: utf8
from django.template.response import TemplateResponse
from posts.models import Post, Reply
def home(request):
ctx = {
'recent_replies' : Reply.objects.all().order_by('-created_at')[:10],
}
return TemplateResponse(request, 'home.html', ctx)
| libchaos/erya | erya/views.py | Python | gpl-3.0 | 281 |
# 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 ... | AutorestCI/azure-sdk-for-python | azure-servicefabric/azure/servicefabric/models/applications_health_evaluation.py | Python | mit | 2,699 |
#!/usr/bin/env python3
import sys
sys.path.append('..') # fix import directory
from app import app
from app.models import User
from PIL import Image
from app.utils import rand_str
ctx = app.test_request_context()
ctx.push()
users = User.query.all()
for u in users:
if u._avatar:
with Image.open('../uploa... | JING-TIME/ustc-course | tests/resize_avatar.py | Python | agpl-3.0 | 1,146 |
#!/usr/bin/env python
from netmiko import ConnectHandler
from getpass import getpass
def main():
pynet2 = {
'device_type': 'cisco_ios',
'ip': '184.105.247.71',
'username': 'pyclass',
'password': '88newclass',
'port': 22,
}
pyrtr2 = ConnectHandler(**pynet2)
py... | MattBajro/pynet | class4/exercise7.py | Python | apache-2.0 | 546 |
from intercourse.swf.DataTypes import*
from intercourse .swf .loaders.records import*
def load(swf,tag):
r =StructDef().\
add(
'PlaceFlagHasClipActions',
'PlaceFlagHasClipDepth',
'PlaceFlagHasName',
'PlaceFlagHasRatio',
'PlaceFlagHasColorTransform',
'PlaceFlagHasMatrix',
'PlaceFlagHasCharacter',
'PlaceFlagMove... | icefapper/coursedaft | intercourse/swf/loaders/PlaceObject2.py | Python | gpl-2.0 | 828 |
# =========================================================================
# Copyright 2012-present Yunify, Inc.
# -------------------------------------------------------------------------
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this work except in compliance with the Licens... | yunify/qingcloud-cli | qingcloud/cli/iaas_client/actions/collaboration/describe_group_roles.py | Python | apache-2.0 | 3,011 |
# @file Same Tree
# @brief Given 2 BT, do they have same structure and values
# https://leetcode.com/problems/same-tree/
'''
Given two binary trees, write a function to check if they are
equal or not.
Two binary trees are considered equal if they are structurally
identical and the nodes have the same value.
'''
def... | ngovindaraj/Python | leetcode/ds_tree_same_tree.py | Python | mit | 613 |
from errors import *
import sys
sys.path.append("core/include")
sys.path.append("core/include/simplejson")
sys.path.append("include")
import time
import gui
import os
import pygame
pygame.font.init()
import random
import pickle
import re
import textutil
import registry
import zipfile
import simplejson as json
ImgFont =... | crxtrdude/pywright | core/core.py | Python | bsd-3-clause | 165,103 |
from copy import copy
from datetime import datetime
import json
import string
from django.conf import settings
from django.db import models
import commonware.log
import jinja2
from tower import ugettext as _
from uuidfield.fields import UUIDField
import amo
import amo.models
from access.models import Group
from addo... | SuriyaaKudoIsc/olympia | apps/devhub/models.py | Python | bsd-3-clause | 13,462 |
#!/usr/bin/env python
"""Module containing definition of enum class PortDistributionType."""
from enum import Enum
class PortDistributionType(Enum):
"""
Enum for every possible distribution type of port values.
"""
SPAR = 0
"""Source arbitrary port ranges distribution."""
SPEM = 1
"""Sou... | classbench-ng/classbench-ng | lib/tuples_analyzer/calculation_parameters/enums/port_distribution_type.py | Python | gpl-3.0 | 497 |
# -*- coding: utf-8 -*-
# Django
from django.views.generic import View, TemplateView
from django.shortcuts import redirect
from django.core.urlresolvers import reverse
from django.shortcuts import get_object_or_404
# CRMA
from .models import Subscription, EmailScheduler
from .models import cancel_subscription
from .u... | emencia/emencia-crma | crma/views.py | Python | gpl-2.0 | 1,158 |
#-*-coding=utf-8-*-
class SupportEncodings(object):
"""
Given the support encoding of piconv
"""
supports = []
def __init__(self):
self.supports = ['ASCII','UTF-8','UTF-16','UTF-32',\
'BIG5','GBK','GB2312','GB18030','EUC-JP', 'SHIFT_JIS', 'ISO-2022-JP'\
'WINDOWS-1252']
def get_support_encodings(self):
... | coodoing/piconv | support_encodings.py | Python | apache-2.0 | 13,095 |
# Guillaume Valadon <[email protected]>
"""
Scapy *BSD native support
"""
| CodeNameGhost/shiva | thirdparty/scapy/arch/bpf/__init__.py | Python | mit | 79 |
from glob import glob
import os
from os import path
import itertools
import re
from Bio import AlignIO
import pandas
import sys
import copy
import argparse
from slr import *
species_RE = re.compile("([A-Z]+)")
def grouper(iterable, n, fillvalue=None):
args = [iter(iterable)] * n
return itertools.izip_longes... | jergosh/slr_pipeline | bin/scan_slr.py | Python | gpl-2.0 | 1,316 |
# Copyright 2021, Kay Hayen, mailto:[email protected]
#
# Part of "Nuitka", an optimizing Python compiler that is compatible and
# integrates with CPython, but also works on its own.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in complianc... | kayhayen/Nuitka | nuitka/codegen/ConditionalCodes.py | Python | apache-2.0 | 7,335 |
from __future__ import print_function
import os
import warnings
from pytest import mark
from translate.convert import oo2po, po2oo, test_convert
from translate.misc import wStringIO
from translate.storage import po
class TestPO2OO(object):
def setup_method(self, method):
warnings.resetwarnings()
... | diorcety/translate | translate/convert/test_po2oo.py | Python | gpl-2.0 | 10,029 |
# -*- coding: utf-8 -*-
# This file is part of Shuup.
#
# Copyright (c) 2012-2017, Shoop Commerce Ltd. All rights reserved.
#
# This source code is licensed under the OSL-3.0 license found in the
# LICENSE file in the root directory of this source tree.
from __future__ import unicode_literals
from django.contrib impor... | suutari-ai/shoop | shuup/admin/modules/products/views/edit_variation.py | Python | agpl-3.0 | 5,246 |
import os
from unittest import mock
from django.conf import settings
from zerver.lib.test_classes import ZulipTestCase
from zproject.email_backends import get_forward_address
class EmailLogTest(ZulipTestCase):
def test_generate_and_clear_email_log(self) -> None:
with self.settings(EMAIL_BACKEND="zprojec... | rht/zulip | zerver/tests/test_email_log.py | Python | apache-2.0 | 2,144 |
# -*- coding: utf-8 -*-
# Generated by Django 1.9.13 on 2018-09-18 14:52
from __future__ import unicode_literals
from django.db import migrations, models
import django.db.models.deletion
class Migration(migrations.Migration):
dependencies = [
('cerimonial', '0016_auto_20180918_1149'),
]
| interlegis/saap | saap/cerimonial/migrations/0017_auto_20180918_1152.py | Python | gpl-3.0 | 308 |
#!/usr/bin/env python
#
# Copyright 2007 Google 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 o... | ychen820/microblog | y/google-cloud-sdk/platform/google_appengine/google/appengine/tools/devappserver2/http_runtime_constants.py | Python | bsd-3-clause | 2,201 |
# -*- coding: utf-8 -*-
#
# 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
... | gtoonstra/airflow-hovercraft | hovercraft/operators/__init__.py | Python | apache-2.0 | 565 |
# This file is part of remsh
# Copyright 2009, 2010 Dustin J. Mitchell
# See COPYING for license information
import os
from remsh.xport.base import Error, Xport
class FDXport(Xport):
"""
Base class for file-descriptor-based transports. Not for use by users.
"""
def __init__(self, fd):
se... | djmitche/remsh | py/remsh/xport/fd.py | Python | mit | 769 |
# Copyright 2010 Orbitz WorldWide
#
# 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 writ... | caio2k/RIDE | src/robotide/contrib/testrunner/testrunner.py | Python | apache-2.0 | 14,659 |
"""
Illustrates how to attach events to all instrumented attributes
and listen for change events.
"""
from sqlalchemy import event, orm
def configure_listener(class_, key, inst):
def append(instance, value, initiator):
instance.receive_change_event("append", key, value, None)
def remove(instance, va... | ioram7/keystone-federado-pgid2013 | build/sqlalchemy/examples/custom_attributes/listen_for_events.py | Python | apache-2.0 | 2,055 |
from __future__ import absolute_import
import six
import logging
logger = logging.getLogger(__name__)
from .. import py3_errmsg
try:
import enaml
except ImportError:
if six.PY3:
logger.exception(py3_errmsg)
else:
raise
else:
with enaml.imports():
from .view import PlotView, Plot... | NSLS-II/replay | replay/scalar/__init__.py | Python | bsd-3-clause | 370 |
#!/usr/bin/env python
#-*- coding:utf-8 -*-
from miasm2.expression.expression import *
from miasm2.arch.msp430.regs import *
from miasm2.arch.msp430.arch import mn_msp430
from miasm2.ir.ir import ir
# Utils
def hex2bcd(val):
"Return val as BCD"
try:
return int("%x" % val, 10)
except ValueError:
... | kod3r/miasm | miasm2/arch/msp430/sem.py | Python | gpl-2.0 | 10,533 |
# Copyright (c) 2016 Red Hat, 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 require... | igor-toga/local-snat | neutron/tests/functional/agent/ovsdb/test_impl_idl.py | Python | apache-2.0 | 3,064 |
import sublime
import sublime_plugin
import os
import subprocess
# 定义【Subl】命令
class SublCommand(sublime_plugin.WindowCommand):
# 执行【Subl】命令
def run(self, args = []):
# 替换参数中的环境变量
env = self.window.extract_variables()
args = [sublime.expand_variables(x, env) for x in args]
# ... | edonet/package | Erik/subl_command.py | Python | isc | 1,145 |
#!/usr/bin/env python
import os
import sys
if __name__ == "__main__":
os.environ.setdefault("DJANGO_SETTINGS_MODULE", "Proyecto_Merka.settings")
from django.core.management import execute_from_command_line
execute_from_command_line(sys.argv)
| AngelValera/proyectoIV | manage.py | Python | mit | 257 |
from plumbum import local
import benchbuild as bb
from benchbuild.environments.domain.declarative import ContainerImage
from benchbuild.source import HTTP
from benchbuild.utils.cmd import make, tar
class LibreSSL(bb.Project):
""" OpenSSL """
NAME = 'libressl'
DOMAIN = 'encryption'
GROUP = 'benchbuil... | PolyJIT/benchbuild | benchbuild/projects/benchbuild/openssl.py | Python | mit | 2,575 |
# -*- coding: utf-8 -*-
"""
Created on Sat May 7 11:13:26 2016
@author: eman
"""
from __future__ import division
from __future__ import absolute_import
import numpy as np
from scipy import linalg
from scipy.sparse import coo_matrix, csr_matrix, block_diag, vstack
from manifold_learning.se import sim_potential
f... | jejjohnson/manifold_learning | src/python/manifold_alignment/ssma.py | Python | mit | 15,928 |
"""
NAME:
beta_functions.py
Smaller b values means falloff is slower
PURPOSE:
Contruct Membership Beta Functions (MBFs) parameters for each
hydrometeor type and fuzzy set based on scattering simulations (Dolan and
Rutledge, 2009)
# Basic form of a Membership Beta Function is:
#
# ... | jjhelmus/CSU_RadarTools | csu_radartools/beta_functions.py | Python | gpl-2.0 | 8,691 |
def test_noop_one():
pass
| jctanner/issuetests | tests/test_noop.py | Python | mit | 30 |
from django.core.mail import EmailMessage
class SMSMessage(EmailMessage):
"""
https://docs.djangoproject.com/en/1.8/topics/email/#the-emailmessage-class
"""
def __init__(self, body, from_number, to, connection=None):
bcc = None
attachments = None
headers = None
cc = None
reply_to = None
super().__init... | RyanBalfanz/django-smsish | smsish/sms/message.py | Python | mit | 632 |
# coding: utf-8
print "BOM BOOM!"
| MalloyPower/parsing-python | front-end/testsuite-python-lib/Python-2.7/Lib/lib2to3/tests/data/bom.py | Python | mit | 38 |
#!/usr/bin/env python3
import numpy as np
import scipy
from .Exceptions import TriAllelicError,InfoKeyError
from ponytools.Allele import Allele
def Fst(alt_freq_i,alt_freq_j):
'''
Calculates Fst from alternate allele freqs
'''
if alt_freq_i == alt_freq_j == 1:
return 0
if alt_freq_i =... | schae234/PonyTools | ponytools/Variant.py | Python | mit | 12,432 |
import os, pickle
from multiprocessing import Pool # @UnresolvedImport
from pydmrs.core import RealPred
DATA = '/anfs/bigdisc/gete2/wikiwoods/core-5'
VOCAB = '/anfs/bigdisc/gete2/wikiwoods/core-5-vocab.pkl'
OUTPUT = DATA + '-nodes'
PROC = 80
if not os.path.exists(OUTPUT):
os.mkdir(OUTPUT)
with open(VOCAB, 'rb... | guyemerson/sem-func | src/preprocess/wikiwoods_convertcore.py | Python | mit | 1,821 |
# forms.py
from django import forms
from .models import Client
class ClientForm(forms.ModelForm):
startdate = forms.DateField(required=False)
enddate = forms.DateField(required=False)
def clean_duration(self):
data = self.cleaned_data['duration']
if data <= 0:
raise forms.Vali... | dwagon/Scheduler | scheduler/client/forms.py | Python | gpl-2.0 | 1,340 |
# Copyright 2010, 2011 Kalamazoo College Computer Science Club
# <[email protected]>
# This file is part of LitHub.
#
# LitHub 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, ei... | umangv/LitHub | LitHub/bookswap/utils.py | Python | gpl-3.0 | 4,056 |
#!/usr/bin/python
# -*- coding: utf-8 -*-
# This file is part of pydsl.
#
# pydsl 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.
#
# py... | nesaro/pydsl | pydsl/file/parsley.py | Python | gpl-3.0 | 1,017 |
# -*- coding: utf-8 -*-
# flake8: noqa
from input_manager import InputManager
try:
from gpio_inpput_manager import GPIOManager
except ImportError:
pass
| kdbdallas/Mopidy-Touchclient | mopidy_nowplayingtouch/input/__init__.py | Python | apache-2.0 | 162 |
from datapackage_pipelines.wrapper import ingest, spew
def get_votes(resource, data, stats):
data['session_voters'] = {}
stats['num_votes'] = 0
stats['num_vote_mks'] = 0
for vote in resource:
voters = data['session_voters'].setdefault(vote['session_id'], set())
for attr in ['mk_ids_pro... | hasadna/knesset-data-pipelines | people/plenum_session_voters.py | Python | mit | 2,135 |
"""
This code is exclusively for use of testing read_radex. Don't use it in any
production anything until you're sure it works.
"""
bw = 0.01 # "bandwidth": free spectral range around line (used to say which lines get printer)
def read_radex_old(outfile,flow,fupp,bw=bw):
"""
A hack-ey means of reading a... | tectronics/agpy | radex/read_radex.py | Python | mit | 3,545 |
"""Collection of common words"""
COMMON_WORDS_EN = """
I
a
able
about
above
act
add
afraid
after
again
against
age
ago
agree
air
all
allow
also
always
am
among
an
and
anger
animal
answer
any
appear
apple
are
area
arm
arrange
arrive
art
as
ask
at
atom
baby
back
bad
ball
band
bank
bar
base
basic
bat
be
bear
beat
beauty
... | patrickshuff/artofmemory | artofmemory/data/words.py | Python | mit | 5,904 |
# -*- encoding: utf-8 -*-
"""Defines all models to admin for Django Admin UI."""
from django.contrib import admin
from models import *
admin.site.register(Organization)
admin.site.register(Grade)
admin.site.register(Group)
admin.site.register(Time)
admin.site.register(Student)
admin.site.register(Teacher)
admin.site.r... | dairdr/voteapp | voteapp/apps/vote/admin.py | Python | mit | 333 |
__author__ = '[email protected]'
import os
import lxml
import gzip
import zipfile
import json
working_directory = os.getcwd()
root = working_directory
def make_file(before, after, start, end, filenames, location,
other_location, encoding=False):
if encoding:
filenames = [encoding + '_' +... | RoelvandenBerg/nlnieuwscrawler | test/sitemap_testcases.py | Python | gpl-2.0 | 2,047 |
from datagrowth.resources import ShellResource
| fako/datascope | src/core/models/resources/shell.py | Python | gpl-3.0 | 47 |
#!/usr/bin/python
# Copyright 2017 Dhvani Patel
#
# This file is part of UnnaturalCode.
#
# UnnaturalCode 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 Licen... | naturalness/unnaturalcode | unnaturalcode/test_eclipse.py | Python | agpl-3.0 | 1,489 |
import numpy
import subprocess
import math
from math import sqrt, exp
import matplotlib.pyplot as plt
import random
import scipy.signal
from pysrc import reader
from pysrc import caliberation
from pysrc import filters
import sys
import pdb
def FindTimeShiftA(a, b):
na = len(a)
dt = numpy.arange(1-na, na)
maxc... | ap1/PixeeBel | code/pysrc/TimeShiftAnjul.py | Python | mit | 1,374 |
import bisect
import json
import logging
import math
import numpy as np
import random
from learning.rlpower_controller import RLPowerController
from scipy.interpolate import splrep, splev
from hal.inputs.fitness_querier import FitnessQuerier
__author__ = 'matteo'
logger = logging.getLogger(__name__)
logger.setLevel(lo... | ci-group/revolve-brain | brain/learning/rlpower_algorithm.py | Python | lgpl-3.0 | 7,640 |
import sys
import heapq
import uvint
from pathlib import Path
from status import Status
def main():
path = Path(sys.argv[1])
out = Path(sys.argv[2])
bytes = path.read_bytes()
min_length = 4
max_length = 10
compressor = Compressor(bytes, min_length, max_length)
with open(out, 'wb') as f:
... | WojciechMula/toys | fpc-compression/compress.py | Python | bsd-2-clause | 5,796 |
#!/usr/bin/env python
#
# user.py - Autobot for Nikki UP2U World Traveller New 2
#
# Copyright (C) 2014 Haoliang Wang
#
# 09/09/2014
#
from config import *
from base import *
from utils import *
class User(object):
name = ""
gold = 0
jewel = 0
max_p = 0
power = 0
delay = 0
session_id = ""
did = ""
task_dr... | haoliangx/Autobot-Nikki-UP2U | user.py | Python | gpl-2.0 | 3,843 |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
#
# This file is subject to the terms and conditions defined in
# file 'LICENSE.md', which is part of this source code package.
#
import json
import yaml
from kubernetes_py.utils import is_valid_string
class DeleteOptions(object):
"""
http://kubernetes.io/docs/... | mnubo/kubernetes-py | kubernetes_py/models/v1/DeleteOptions.py | Python | apache-2.0 | 3,140 |
from PyQt5 import QtWidgets, QtCore, QtGui
import html, json
from datetime import datetime
class MainWindow(QtWidgets.QMainWindow):
def __init__(self, parent=None):
"""
MainWindow uses a QTextEdit to display chat
"""
# initialize parent class. Req'd for PyQt subclasses
super... | benhoff/chrome-stream-chat | CHATIMUSMAXIMUS/gui/main_window.py | Python | mit | 3,388 |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
# Copyright 2011-2014, Nigel Small
#
# 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... | pombreda/py2neo | py2neo/ext/calendar/__init__.py | Python | apache-2.0 | 9,179 |
#!/usr/bin/python
#
# anaconda: The Red Hat Linux Installation program
#
# Copyright (C) 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007
# Red Hat, Inc. All rights reserved.
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published... | gautamMalu/XenInBox | pyanaconda/anaconda.py | Python | gpl-2.0 | 8,011 |
#!/usr/bin/env python3
import subprocess
import time
def start():
engine = subprocess.Popen(
"chess/stockfish-dd-64-modern.exe",
universal_newlines = True,
stdin = subprocess.PIPE,
stdout = subprocess.PIPE,
)
return engine
def put(engine, command):
engine.stdin.wr... | omegachysis/arche-chess | chess test 2.py | Python | gpl-2.0 | 2,319 |
#!/usr/bin/python
__author__ = 'mlissner'
import argparse
from datetime import datetime
INPUT_FORMATS = [
'%Y-%m-%d', # '2006-10-25'
'%m-%d-%Y', # '10-25-2006'
'%m-%d-%y', # '10-25-06'
'%m/%d/%Y', # '10/25/2006'
'%m/%d/%y', # '10/25/06'
'%Y/%m/%d', # '2006/10/26'
]
def make_date(date_... | Andr3iC/courtlistener | cl/recap/download/__init__.py | Python | agpl-3.0 | 1,168 |
#
# Copyright (C) University College London, 2007-2012, all rights reserved.
#
# This file is part of HemeLB and is provided to you under the terms of
# the GNU LGPL. Please see LICENSE in the top level directory for full
# details.
#
"""Regarding indices, a few conventions:
1) Broadly there are two types of index... | jenshnielsen/hemelb | Tools/hemeTools/parsers/geometry/__init__.py | Python | lgpl-3.0 | 1,408 |
""" Crawl http://abcnotation.com to get dataset of traditional musics. """
import requests
import bs4
import time
import pickle
import os.path
import argparse
import re
root_url = 'http://abcnotation.com'
index_url = root_url + '/searchTunes?q=C:trad&f=c&o=a&s=0'
parser = argparse.ArgumentParser()
parser.add_argumen... | allanino/rnn-composer-helper | get_u_4496965_data.py | Python | mit | 2,996 |
# This file is part of Moksha.
# Copyright (C) 2008-2010 Red Hat, 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 b... | ralphbean/moksha | moksha/api/widgets/flot/flot.py | Python | apache-2.0 | 1,938 |
# This file is part of aoc2016.
#
# aoc2016 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.
#
# aoc2016 is distributed in the hope that... | T-R0D/JustForFun | aoc2016/aoc2016/day18/solution.py | Python | gpl-2.0 | 2,158 |
# -*- coding: utf-8 -*-
#
# Copyright (c) 2015 Red Hat
# Licensed under The MIT License (MIT)
# http://opensource.org/licenses/MIT
#
import django.forms as forms
from django.db.models import Q
from pdc.apps.release.models import Release
class ComposeSearchForm(forms.Form):
search = forms.CharField(required... | release-engineering/product-definition-center | pdc/apps/compose/forms.py | Python | mit | 6,020 |
# -*- coding: utf-8 -*-
# Copyright (c) 2014 Spotify AB
#
# 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... | Magnetic/luigi | luigi/tools/range.py | Python | apache-2.0 | 34,017 |
# Copyright 2015 Huawei Technologies India Pvt Ltd, 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... | wolverineav/neutron | neutron/objects/qos/rule.py | Python | apache-2.0 | 3,646 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.