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 asyncio
import base64
import binascii
import json
import re
import uuid
import warnings
import zlib
from collections import Mapping, Sequence, deque
from urllib.parse import parse_qsl, unquote, urlencode
from multidict import CIMultiDict
from .hdrs import (CONTENT_DISPOSITION, CONTENT_ENCODING, CONTENT_LENGTH,... | arju88nair/projectCulminate | venv/lib/python3.5/site-packages/aiohttp/multipart.py | Python | apache-2.0 | 30,252 |
"""A setuptools based setup module.
See:
https://packaging.python.org/en/latest/distributing.html
https://github.com/pypa/sampleproject
"""
# Always prefer setuptools over distutils
from setuptools import setup, find_packages
# To use a consistent encoding
from codecs import open
from setuptools.command.test import t... | ghostsquad/swarmci | setup.py | Python | apache-2.0 | 3,378 |
import re
from livestreamer.plugin import Plugin
from livestreamer.plugin.api import http
from livestreamer.stream import HLSStream
HLS_URL_FORMAT = "http://hls.goodgame.ru/hls/{0}{1}.m3u8"
QUALITIES = {
"1080p": "",
"720p": "_720",
"480p": "_480",
"240p": "_240"
}
_url_re = re.compile("http://(?:www... | chrippa/livestreamer | src/livestreamer/plugins/goodgame.py | Python | bsd-2-clause | 1,558 |
# find a peer
def generate():
"""find a socket, which is connected to the specified port in thumb mode
Leaves socket in r0 reg.
argument:
port (int/str): specific port
backup:
r6: indicates found socket/file descriptor
"""
sc = """
findpeer_1:
sub r5, r5, r5
add r5, r... | sigma-random/ARMSCGen | shellcodes/thumb/findpeer.py | Python | gpl-2.0 | 660 |
import h5py
import numpy as np
from os.path import expanduser
def load_data(filename=expanduser("~/data/CK/dataset_10708.h5")):
with h5py.File(filename,'r') as hf:
data = hf.get('dataset')
np_data = np.array(data)
return np_data
| dfdx/Faceless.jl | py/data.py | Python | mit | 260 |
"""
VCS Link
########
Copyright (c) 2021 Nordic Semiconductor ASA
SPDX-License-Identifier: Apache-2.0
Introduction
============
This Sphinx extension can be used to obtain the VCS URL for a given Sphinx page.
This is useful, for example, when adding features like "Open on GitHub" on top
of pages. The extension insta... | zephyrproject-rtos/zephyr | doc/_extensions/zephyr/vcs_link.py | Python | apache-2.0 | 2,232 |
# -*- coding: utf-8 -*-
#
# flask-mail documentation build configuration file, created by
# sphinx-quickstart on Fri May 28 11:39:14 2010.
#
# 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
# autogenerated file.
#
# ... | Junnplus/flask-mail | docs/conf.py | Python | bsd-3-clause | 6,521 |
#! /usr/bin/env python
'''
this file will flatten a directory with as many (and as complicated) a directory structure as there is.
It links everything into a single dir, except the things you don't want it to, in this case .fits,.cat,.pkl files i don't really need.
'''
#adam-example# ./adam_flattened_linkable_dir.py /u... | deapplegate/wtgpipeline | adam_flattened_linkable_dir.py | Python | mit | 2,616 |
# Generated by Django 2.0.8 on 2018-08-18 18:09
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('events', '0029_auto_20180818_1505'),
]
operations = [
migrations.AddField(
model_name='brandingperiod',
name='overri... | sussexstudent/falmer | falmer/events/migrations/0030_brandingperiod_override_listings_root.py | Python | mit | 432 |
"""
storlever.lib.secucrity
~~~~~~~~~~~~~~~~
This module implements some security configuration for storlever.
:copyright: (c) 2014 by OpenSight (www.opensight.cn).
:license: AGPLv3, see LICENSE for more details.
"""
from pyramid.security import Allow, Everyone, Authenticated, DENY_ALL
class AclRootFactory(objec... | OpenSight/StorLever | storlever/lib/security.py | Python | agpl-3.0 | 484 |
# ----------------------------------------------------------------------
# Numenta Platform for Intelligent Computing (NuPIC)
# Copyright (C) 2016, Numenta, Inc. Unless you have an agreement
# with Numenta, Inc., for a separate license for this software code, the
# following terms and conditions apply:
#
# This progra... | ywcui1990/nupic.research | projects/energy_based_pooling/energy_based_models/energy_functions.py | Python | agpl-3.0 | 4,211 |
#!/usr/bin/python
# -*- coding: utf-8 -*-
#
# Copyright (c) 2019, René Moser <mail@renemoser.net>
# 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':... | pgmillon/ansible | lib/ansible/modules/cloud/vultr/vultr_account_info.py | Python | gpl-3.0 | 3,185 |
"""
Just run the Material command with a bunch of inputs to make sure
it works as expected
"""
import pyroomacoustics as pra
scat_test = {
"coeffs": [0.1, 0.1, 0.1, 0.2, 0.2, 0.2, 0.3],
"center_freqs": [125, 250, 500, 1000, 2000, 4000, 8000],
}
abs_test = {
"coeffs": [0.3, 0.4, 0.25, 0.11, 0.05, 0.03, 0.3... | LCAV/pyroomacoustics | pyroomacoustics/tests/test_materials.py | Python | mit | 2,742 |
import os
import logger
from cluster_helper import cluster as ipc
config_default = {"sample": [4, 2, None],
"group": [45, 4, 1],
"qc": [8, 1, None],
"pirna": [8, 1, None],
"report": [8, 1, 1]}
def get_cluster_view(args, num_jobs=None):
if n... | lpantano/seqcluster-helper | sqhelper/cluster.py | Python | mit | 2,131 |
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
# Ref:
# - http://doc.qt.io/qt-5/modelview.html#3-4-delegates
# - http://doc.qt.io/qt-5/model-view-programming.html#delegate-classes
# - http://doc.qt.io/qt-5/qabstractitemdelegate.html#details
# - http://doc.qt.io/qt-5/qitemdelegate.html#details
# - http://doc.qt.io/qt-5... | jeremiedecock/snippets | python/pyqt/pyqt5/widget_QTableView_delegate_on_edit_using_dial_widget.py | Python | mit | 3,962 |
"""
Support for Xiaomi Mi Flora BLE plant sensor.
For more details about this platform, please refer to the documentation at
https://home-assistant.io/components/sensor.miflora/
"""
import logging
import voluptuous as vol
from homeassistant.components.sensor import PLATFORM_SCHEMA
from homeassistant.helpers.entity i... | Duoxilian/home-assistant | homeassistant/components/sensor/miflora.py | Python | mit | 5,190 |
# Copyright (c) 2017 VMware, 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... | j-griffith/cinder | cinder/volume/drivers/vmware/fcd.py | Python | apache-2.0 | 12,601 |
"""WSGI interface (see PEP 333 and 3333).
Note that WSGI environ keys and values are 'native strings'; that is,
whatever the type of "" is. For Python 2, that's a byte string; for Python 3,
it's a unicode string. But PEP 3333 says: "even if Python's str type is
actually Unicode "under the hood", the content of native ... | xpavlus/parabaramba | venv/lib/python2.7/site-packages/cherrypy/_cpwsgi.py | Python | gpl-3.0 | 16,891 |
# ERPNext - web based ERP (http://erpnext.com)
# Copyright (C) 2012 Web Notes Technologies Pvt Ltd
#
# 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 yo... | gangadhar-kadam/church-erpnext | selling/doctype/lead/lead.py | Python | agpl-3.0 | 3,535 |
#Module amara
__version__ = '1.0'
| rsachetto/harpia | harpia/amara/__init__.py | Python | gpl-2.0 | 34 |
"""
models of catalog are..
"""
from django.db import models
from django.forms import ModelForm
import useraccounts
from django.contrib.auth.models import User
from django.http import HttpResponse
from mptt.models import MPTTModel, TreeForeignKey
import mptt.fields
from django.core.exceptions import ValidationEr... | s-monisha/LibreHatti | src/librehatti/catalog/models.py | Python | gpl-2.0 | 9,306 |
# Copyright 2013 Rackspace Hosting.
#
# 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... | orbitfp7/horizon | openstack_dashboard/api/trove.py | Python | apache-2.0 | 4,577 |
"""Code for parsing with bulk tagging forms."""
import hashlib
import logging
import re
import sys
VERIFIED = "verified"
QUESTION = "???"
DUPLICATE = "duplicate"
DELETE = "delete"
TALB_MISMATCH = "TALB mismatch"
# Example:
# a7314af4 [ 1 ] 192 12 Mer de Noms
LINE_RE = re.compile(r"([0-9a-f]{8})\s+\[([^\]]*)\]\s+(\d... | chirpradio/chirpradio-machine | chirp/library/bulk_tagging_form.py | Python | apache-2.0 | 3,136 |
import contextlib
import unittest
import fin.patch
import sentiment.feed
import sentiment.models
import sentiment.testutil
class FeedTest(unittest.TestCase):
def basic_tweet(self):
return {
"id": 1,
"user_handle": "@one",
"followers": 2,
"message": "Test"... | stestagg/al-sentiment | sentiment/feed_test.py | Python | mit | 2,206 |
from cmd import foo
print(foo)
| github/codeql | python/ql/test/library-tests/PointsTo/regressions/wrong/module-imports/conflict-stdlib/code-invalid-package-name/test_ok.py | Python | mit | 31 |
#!/usr/bin/python2.7
# -*- coding: utf-8 -*-
"""
**Project Name:** MakeHuman
**Product Home Page:** http://www.makehuman.org/
**Code Home Page:** https://bitbucket.org/MakeHuman/makehuman/
**Authors:** Thomas Larsson, Jonas Hauquier
**Copyright(c):** MakeHuman Team 2001-2014
**Licensing:** ... | naturalness/unnaturalcode | unnaturalcode/testdata/makehuman/makehuman/plugins/9_export_collada/dae_geometry.py | Python | agpl-3.0 | 9,944 |
from django.utils.datastructures import SortedDict
from xml.etree import ElementTree
import datetime
def response_dict(tree):
if isinstance(tree, basestring):
tree = ElementTree.fromstring(tree)
d = SortedDict()
for child in list(tree):
if len(list(child)):
d[child.tag] = respon... | gdoermann/django-twilio | twil/util.py | Python | gpl-2.0 | 730 |
import unittest
from data_structures.stack import Stack
class testPop(unittest.TestCase):
def setUp(self):
self.stack = Stack()
def testEmptyList(self):
self.assertRaises(IndexError, self.stack.pop)
def testListOfOne(self):
self.stack = Stack(1)
self.assertEqual(self.stac... | markcharyk/data-structures | tests/stack_tests.py | Python | mit | 1,215 |
# -*- 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 'Plan'
db.create_table(u'membership_plan', (
(... | hellhound/dentexchange | dentexchange/apps/membership/migrations/0001_initial.py | Python | bsd-3-clause | 11,269 |
#-------------------------------------------------------------------------------
# Name: Circle and Sphere Generator
# Purpose: Generates a file with circles and spheres for an assignment
#
# Author: Mr. Seidel
#
# Created: 08/10/2015
# Copyright: (c) Mr. Andrew Seidel 2015
# Licence: GPL 3.0
... | mrseidel-classes/ICS4U-Code | files/generateInputText.py | Python | gpl-3.0 | 1,072 |
import zstackwoodpecker.test_state as ts_header
TestAction = ts_header.TestAction
def path():
return dict(initial_formation="template2",
path_list=[[TestAction.create_volume, "volume1","=scsi"], \
[TestAction.delete_volume, "volume1"], \
[TestAction.create_volume, "volume2","=s... | zstackorg/zstack-woodpecker | integrationtest/vm/multihosts/volumes/paths/path112.py | Python | apache-2.0 | 1,747 |
# -*- coding: utf-8 -*-
# This file is part of Shuup.
#
# Copyright (c) 2012-2021, Shuup Commerce Inc. 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.
#: Whether the price expiration should be calculated per product... | shoopio/shoop | shuup/discounts/settings.py | Python | agpl-3.0 | 397 |
"""URLs to run the tests."""
from django.conf.urls import patterns, include, url
from django.contrib import admin
from django.views.generic import ListView
from ..models import Review
admin.autodiscover()
urlpatterns = patterns(
'',
url(r'^review-listing/', ListView.as_view(model=Review),
name='revi... | un33k/django-review | review/tests/urls.py | Python | mit | 476 |
from flask import render_template, flash, redirect, request, url_for, abort
from flask_login import login_user, logout_user, login_required, current_user
from . import loans
from forms import LoanApplicationForm, ApproveLoan, RepayLoan
from ..models import db
from ..models import Loan, User
from datetime import date
... | Kimanicodes/wananchi | app/loans/views.py | Python | mit | 4,187 |
from __future__ import division
import numpy as np
import matplotlib
#matplotlib.use("Agg")
import matplotlib.pyplot as plt
import sys
import pylab
import re
import file_loader as load
import matplotlib.patheffects
from matplotlib.font_manager import FontProperties
from mpl_toolkits.axes_grid.anchored_artists import An... | droundy/protein | pyplots/box_plot.py | Python | mit | 18,421 |
# -*- coding: utf-8 -*-
'''
Specto Add-on
Copyright (C) 2015 lambda
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 l... | azumimuo/family-xbmc-addon | plugin.video.specto/resources/lib/libraries/player.py | Python | gpl-2.0 | 12,057 |
#
# Copyright 2015 Free Software Foundation, Inc.
#
# This file is part of PyBOMBS
#
# PyBOMBS 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, or (at your option)
# any later version.
#
# PyB... | namccart/pybombs | pybombs/package_manager.py | Python | gpl-3.0 | 12,528 |
#!/usr/bin/env python
"""Batch Load Claims Messages associated with Classification plus Automod Parameters.
Synopsis
========
:samp:`load.py {description.csv}...`
Description
===========
Reads the CSV-format descriptions, either from stdin or files supplied as command-line
arguments. Each file contains... | sbuss/TigerShark | web/claims_837/load.py | Python | bsd-3-clause | 6,553 |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
"""
test_atws
----------------------------------
Tests for `atws` module.
"""
import sys
import unittest
from contextlib import contextmanager
import atws
query_test_output=u'<?xml version="1.0" ?>\n<queryxml>\n\t<entity>Ticket</entity>\n\t<query>\n\t\t<field>\n\t\t\tS... | MattParr/python-atws | tests/test_atws.py | Python | mit | 1,407 |
#!/usr/bin/env python
# Copyright (c) 2015, Palo Alto Networks
#
# Permission to use, copy, modify, and/or distribute this software for any
# purpose with or without fee is hereby granted, provided that the above
# copyright notice and this permission notice appear in all copies.
#
# THE SOFTWARE IS PROVIDED "AS IS" A... | PaloAltoNetworks/terraform-templates | pan_guard_duty/lambda_code/pandevice/ha.py | Python | apache-2.0 | 11,239 |
#!/usr/bin/env python3
# -*- encoding: 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 Apach... | twitter/heron | integration_test/src/python/integration_test/topology/fields_grouping/fields_grouping.py | Python | apache-2.0 | 1,757 |
# Copyright 2010 United States Government as represented by the
# Administrator of the National Aeronautics and Space Administration.
# 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 ... | theanalyst/cinder | cinder/quota.py | Python | apache-2.0 | 36,564 |
from django.core.urlresolvers import reverse, reverse_lazy
from django.contrib.sites.models import Site
from django.http import (HttpResponseRedirect, Http404,
HttpResponsePermanentRedirect)
from django.views.generic.base import TemplateResponseMixin, View, TemplateView
from django.views.generi... | ldgarcia/django-allauth | allauth/account/views.py | Python | mit | 26,390 |
# -*- coding: utf-8 -*-
#
# Copyright (C) 2015 Matt Martz <matt@sivel.net>
# Copyright (C) 2015 Rackspace US, Inc.
#
# 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 ... | mheap/ansible | test/sanity/validate-modules/utils.py | Python | gpl-3.0 | 4,467 |
# -*- coding: utf-8 -*-
# Copyright 2022 Google LLC
#
# 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... | googleapis/python-analytics-admin | samples/generated_samples/analyticsadmin_v1alpha_generated_analytics_admin_service_approve_display_video360_advertiser_link_proposal_sync.py | Python | apache-2.0 | 1,697 |
from sqlalchemy import *
from sqlalchemy.orm import relationship, backref,create_session,Session
from sqlalchemy.ext.declarative import declarative_base
from sqlalchemy.ext.automap import automap_base
from sqlalchemy.orm import sessionmaker
import json
from datetime import datetime, date
##table declaration
from opene... | openedoo/openedoo | openedoo/core/db/__init__.py | Python | mit | 3,656 |
# -*- coding: utf-8 -*-
"""
pafy.py.
Python library to download YouTube content and retrieve metadata
https://github.com/np1/pafy
Copyright (C) 2013-2014 np1
This program 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
So... | girish946/pafy | pafy/pafy.py | Python | lgpl-3.0 | 33,300 |
# -*- coding: utf-8 -*-
# Parallel Processing Teaching Toolkit
# PyOpenCL - Example 07
# Multiple Kernels Execution
# https://github.com/javierip/parallel-processing-teaching-toolkit
import pyopencl as cl
import numpy as np
import time # For measure the running times
VECTOR_SIZE = 50000 # Elements of vector
# C... | javierip/parallel-processing-teaching-toolkit | 04-GPU-accelerators/04-PyOpenCL/07-multi_kernel/multi_kernel.py | Python | apache-2.0 | 3,109 |
# Copyright 2012 Nebula, 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... | Brocade-OpenSource/OpenStack-DNRM-Nova | nova/api/openstack/compute/plugins/v3/flavor_disabled.py | Python | apache-2.0 | 3,157 |
data['2012'].mean().plot(kind='bar') | jorisvandenbossche/2015-EuroScipy-pandas-tutorial | snippets/07 - Case study - air quality data54.py | Python | bsd-2-clause | 36 |
# -*- coding: utf-8 -*-
"""
/***************************************************************************
Name : Versioning plugin for DB Manager
Description : Set up versioning support for a table
Date : Mar 12, 2012
copyright : (C) 2012 by Giuseppe Sucameli
email ... | jef-n/QGIS | python/plugins/db_manager/db_plugins/postgis/plugins/versioning/__init__.py | Python | gpl-2.0 | 2,260 |
# -*- coding: utf-8 -*-
from thefuck.rules.grep_recursive import match, get_new_command
from thefuck.types import Command
def test_match():
assert match(Command('grep blah .', 'grep: .: Is a directory'))
assert match(Command(u'grep café .', 'grep: .: Is a directory'))
assert not match(Command('', ''))
... | SimenB/thefuck | tests/rules/test_grep_recursive.py | Python | mit | 503 |
# coding: utf-8
# (c) 2015-09-26 Teruhisa Okada
import netCDF4
import matplotlib.pyplot as plt
import datetime
import numpy as np
from scipy.interpolate import Rbf
import romspy
class Dataset():
def __init__(self, ncfile, mapfile=None, grdfile=None):
self.ncfile = ncfile
if mapfile is not None:
... | okadate/romspy | romspy/hview/obsolate/his.py | Python | mit | 10,872 |
def can_build(env, platform):
return True
def configure(env):
pass
def get_doc_classes():
return [
"AudioStreamOGGVorbis",
]
def get_doc_path():
return "doc_classes"
| Paulloz/godot | modules/stb_vorbis/config.py | Python | mit | 200 |
from inspect import currentframe
from inspect import getouterframes
from calmjs import runtime
class BadSimpleRuntime(runtime.DriverRuntime, runtime.Runtime):
def entry_point_load_validated(self, entry_point):
# skip the rest of the checks.
return entry_point.load()
def init_argparser(self,... | calmjs/calmjs | src/calmjs/testing/module3/runtime.py | Python | gpl-2.0 | 878 |
# Lint as: python3
# Copyright 2018 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 ... | tensorflow/lingvo | lingvo/tasks/punctuator/model.py | Python | apache-2.0 | 2,347 |
# -*- coding: utf-8 -*-
from openerp import models, fields, api
class ReferenciasSolicitantes(models.Model):
_name = 'propuestas.referencias_solicitantes'
propuesta_id = fields.One2many('propuestas.propuestas', "referencias_sol_id", string="Propuesta")
codigo_referencias = fields.Char(string='Código de ... | sani-coop/tinjaca | addons/propuestas_old/models/referencias_solicitante.py | Python | gpl-2.0 | 894 |
""" Tests for commerce views. """
import json
import ddt
import mock
from django.urls import reverse
from nose.plugins.attrib import attr
from course_modes.models import CourseMode
from openedx.core.djangoapps.theming.tests.test_util import with_comprehensive_theme
from student.models import CourseEnrollment
from st... | Stanford-Online/edx-platform | lms/djangoapps/commerce/tests/test_views.py | Python | agpl-3.0 | 6,121 |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
#
# Copyright 2010 British Broadcasting Corporation and Kamaelia Contributors(1)
#
# (1) Kamaelia Contributors are listed in the AUTHORS file and at
# http://www.kamaelia.org/AUTHORS - please extend this file,
# not this notice.
#
# Licensed under the Apache License... | bbc/kamaelia | Code/Python/Kamaelia/Kamaelia/Util/Comparator.py | Python | apache-2.0 | 4,528 |
##############################################################################
# Copyright (c) 2013-2017, Lawrence Livermore National Security, LLC.
# Produced at the Lawrence Livermore National Laboratory.
#
# This file is part of Spack.
# Created by Todd Gamblin, tgamblin@llnl.gov, All rights reserved.
# LLNL-CODE-64... | TheTimmy/spack | var/spack/repos/builtin/packages/voropp/package.py | Python | lgpl-2.1 | 1,943 |
from __future__ import print_function
import inspect
from pdb import pm
from miasm.core.sembuilder import SemBuilder
from miasm.core.locationdb import LocationDB
import miasm.expression.expression as m2_expr
# Test classes
class IR(object):
def __init__(self, loc_db):
self.loc_db = loc_db
IRDst = m... | serpilliere/miasm | test/core/sembuilder.py | Python | gpl-2.0 | 1,414 |
import sublime
import sublime_plugin
import re
from Expression import expression
class Base(sublime_plugin.EventListener):
def _check_value(self, value, operator, operand):
try:
if operator == sublime.OP_EQUAL:
return value == operand
elif operator == sublime.OP_NOT_EQUAL:
return val... | shagabutdinov/sublime-context | base.py | Python | mit | 1,570 |
#!/usr/bin/python
#
# Copyright (C) 2011 Google Inc.
# All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions are
# met:
#
# 1. Redistributions of source code must retain the above copyright notice,
# this list of... | apyrgio/snf-ganeti | test/py/ganeti.hypervisor.hv_lxc_unittest.py | Python | bsd-2-clause | 2,126 |
"""empty message
Revision ID: 56f7e11642a6
Revises: None
Create Date: 2015-12-27 14:22:10.457236
"""
# revision identifiers, used by Alembic.
revision = '56f7e11642a6'
down_revision = None
from alembic import op
import sqlalchemy as sa
def upgrade():
### commands auto generated by Alembic - please adjust! ###... | jasonseminara/Cattr | migrations/versions/56f7e11642a6_.py | Python | mit | 4,408 |
# Gnome15 - Suite of tools for the Logitech G series keyboards and headsets
# Copyright (C) 2011 Brett Smith <tanktarta@blueyonder.co.uk>
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, e... | madscientist42/gnome15 | src/gnome15/g15macroeditor.py | Python | gpl-3.0 | 48,542 |
from time import time
import numpy as np
import matplotlib.pyplot as plt
from sklearn import metrics
from sklearn.cluster import KMeans
from sklearn.datasets import load_digits
from sklearn.decomposition import PCA
from sklearn.preprocessing import scale
from sklearn.datasets.samples_generator import make_blobs
np.ra... | CS6780/approx-clustering | src/kmeans-demo.py | Python | mit | 3,803 |
import os
import platform
import shutil
import stat
import unittest
import unittest.mock
from queue import Queue
from tempfile import mkdtemp
from tests.BearTestHelper import generate_skip_decorator
from bears.vcs.git.GitCommitBear import GitCommitBear
from coala_utils.string_processing.Core import escape
from coalib.... | chriscoyfish/coala-bears | tests/vcs/git/GitCommitBearTest.py | Python | agpl-3.0 | 10,610 |
from .core import *
from .fancy import *
from .recurrent import *
from .tensor import *
| csxeba/ReSkiv | brainforge/layers/__init__.py | Python | gpl-3.0 | 88 |
exec(open('../../../src/scope_manager.py', 'r').read())
t = [0] * 10
output = [0] * 10
def t_map(t):
def λ(x):
return x
t_ta = [0] * 10
s_context()
t_ti = 0
while (t_ti < len(t)):
t_ta[t_ti] = λ(t[t_ti])
t_ti = (t_ti + 1)
r_context()
return t_ta
output = t_... | zambonin/UFSC-INE5426 | test/valid/functional/10.py | Python | gpl-3.0 | 329 |
# -*- coding: utf-8 -*-
from pyramid.view import view_config
from pyramid.response import Response
import json
from pyramid.renderers import render_to_response
class APIError(Exception):
def __init__(self, code, status, message):
self.code = code
self.status = status
self.message = message
... | ActiDoo/gamification-engine | gengine/base/errors.py | Python | mit | 1,065 |
import glob
import os
import subprocess
from distutils.core import Command
from setuptools import setup, find_packages
class CheckVersion(Command):
description = 'Confirm that the stored package version is correct'
user_options = []
def initialize_options(self):
pass
def finalize_options(se... | davidpng/FCS_Database | setup.py | Python | gpl-3.0 | 1,597 |
#!/usr/bin/env python
import matplotlib.pyplot as plt
def params():
plotpar = {'axes.labelsize': 18,
'font.size': 18,
'legend.fontsize': 18,
'xtick.labelsize': 18,
'ytick.labelsize': 18,
'text.usetex': True}
plt.rcParams.update(plotpar... | RuthAngus/K2rotation | code/params.py | Python | mit | 777 |
# encoding = utf-8
# ConcreteImplementor 1/2
class DrawingAPI1(object):
def draw_circle(self, x, y, radius):
print('API1.circle at {}:{} radius {}'.format(x, y, radius))
# ConcreteImplementor 2/2
class DrawingAPI2(object):
def draw_circle(self, x, y, radius):
print('API2.circle at {}:{} radiu... | JiangKlijna/design-pattern | BridgePattern/Bridge.py | Python | apache-2.0 | 1,031 |
from datetime import datetime as dt
import numpy as np
import pytest
from arctic.date import DateRange, CLOSED_OPEN, mktz
from arctic.exceptions import NoDataFoundException
def test_delete(tickstore_lib):
DUMMY_DATA = [
{'a': 1.,
'b': 2.,
'index': dt(2013, 1, 1, tzinf... | manahl/arctic | tests/integration/tickstore/test_ts_delete.py | Python | lgpl-2.1 | 2,042 |
#!/usr/bin/env python
import re
import os
import sys
from translate import Translator
from tempfile import NamedTemporaryFile
try:
import urllib2 as request
from urllib import quote
except:
from urllib import request
from urllib.parse import quote
from tk import calc_tk
text = os.environ.get('POPCLIP_T... | scturtle/GoodTranslate | goodtranslate.py | Python | unlicense | 1,981 |
"""Base module for the DLI Reports app.
Author: Logan Gore
This module creates the app and initializes all startup code.
"""
# System imports
import os
import sys
# Flask imports
from flask import Flask
from flask import flash
from flask import redirect
from flask import render_template
from flask import url_for
fro... | gorel/dli-reports | dli_app/__init__.py | Python | mit | 4,361 |
from datetime import datetime, timedelta
from typing import Any, Dict, List, Optional, Tuple
from unittest import mock
from django.conf import settings
from django.utils.timezone import now as timezone_now
from zerver.lib.actions import do_add_submessage, do_delete_messages, internal_send_private_message
from zerver.... | shubhamdhama/zulip | zerver/tests/test_retention.py | Python | apache-2.0 | 40,723 |
"""KitnIRC - A Python IRC Bot Framework."""
import logging
from kitnirc import client
from kitnirc import events
from kitnirc import modular
from kitnirc import user
__version__ = "0.3.1"
# Prevents output of "no handler found" if no other log handlers are added
_log = logging.getLogger("kitnirc")
_log.addHandler(l... | ayust/kitnirc | kitnirc/__init__.py | Python | mit | 444 |
# -*- coding: utf-8 -*-
# Originally written by Kevin Breen (@KevTheHermit):
# https://github.com/kevthehermit/RATDecoders/blob/master/BlueBanana.py
import string
from zipfile import ZipFile
from io import StringIO
from Crypto.Cipher import AES
def decrypt_aes(key, data):
cipher = AES.new(key)
return cipher... | kevthehermit/viper | viper/modules/rats/bluebanana.py | Python | bsd-3-clause | 1,334 |
from openerp.tests.common import TransactionCase
class TestPropagateDocuments(TransactionCase):
def setUp(self):
super(TestPropagateDocuments, self).setUp()
self.Requisition = self.env['purchase.requisition']
self.requisition = self.Requisition.new({})
self.supplier = self.browse... | SerpentCS/purchase-workflow | purchase_requisition_transport_document/tests/test_generate_po.py | Python | agpl-3.0 | 1,592 |
# Copyright (c) 2015, Frappe Technologies Pvt. Ltd. and Contributors
# MIT License. See license.txt
from __future__ import unicode_literals
import frappe
import os, base64, re
import hashlib
import mimetypes
from frappe.utils import get_site_path, get_hook_method, get_files_path, random_string, encode, cstr, call_hook... | indautgrp/frappe | frappe/utils/file_manager.py | Python | mit | 11,027 |
#!/usr/bin/python
# Copyright (c) 2015 IBM
#
# This module 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 software is distri... | ritzk/ansible-modules-extras | cloud/openstack/os_flavor_facts.py | Python | gpl-3.0 | 6,598 |
import zlib as _zlib
from .abc import Codec
from .compat import ndarray_copy, ensure_contiguous_ndarray
class Zlib(Codec):
"""Codec providing compression using zlib via the Python standard library.
Parameters
----------
level : int
Compression level.
"""
codec_id = 'zlib'
def... | zarr-developers/numcodecs | numcodecs/zlib.py | Python | mit | 1,052 |
__version__ = '0.1.0'
default_app_config = 'quill.apps.QuillConfig'
| gsmke/django-quill | quill/__init__.py | Python | bsd-3-clause | 68 |
from .distances import *
from .staticmaps import *
| ercas/route_distances | route_distances/__init__.py | Python | mit | 51 |
# -*- coding: utf-8 -*-
# Copyright (c) 2007 The PIDA Project
#Permission is hereby granted, free of charge, to any person obtaining a copy
#of this software and associated documentation files (the "Software"), to deal
#in the Software without restriction, including without limitation the rights
#to use, copy, modif... | fermat618/pida | pida-plugins/python/test_python.py | Python | gpl-2.0 | 1,271 |
from django.db import models
class Municipality(models.Model):
''' Gemeinde '''
key = models.CharField(max_length=8) # Gemeindeschluessel
name = models.CharField(max_length=200) # Anschrift
city = models.CharField(max_length=200) # Ort
zipcode = models.CharField(max_length=5) # PLZ
street ... | jbspeakr/datensparsam | dtnsprsm/apps/api/models.py | Python | mit | 1,599 |
from django.apps import AppConfig
from watson import search as watson
class ItemsAppConfig(AppConfig):
name = "items"
def ready(self):
ItemModel = self.get_model("ItemPost")
watson.register(ItemModel, fields=["title", "booklist_set__bookname", ])
| deadlylaid/book_connect | wef/items/apps.py | Python | mit | 275 |
"""
WSGI config for pjlong_home 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/1.7/howto/deployment/wsgi/
"""
import os
os.environ.setdefault("DJANGO_SETTINGS_MODULE", "pjlong_home.settings")
from djang... | pjlong/pjlong-home | pjlong_home/wsgi.py | Python | mit | 397 |
class Solution:
def countAndSay(self, n):
arr = ["1"]
for i in range(2, n):
prev = arr[i-2]
res = ""
for x in prev:
arr.append(res)
return arr[n-1]
| zuun77/givemegoogletshirts | leetcode/python/38_count-and-say.py | Python | apache-2.0 | 226 |
""""
Module with an abstract factory class.
"""
from abc import ABCMeta, abstractmethod
from abs_data import AbsData
class AbsFileParserFactory(metaclass=ABCMeta):
""""
Factory class.
"""
@abstractmethod
def create_data(self, identifier: str, content: str) -> AbsData:
"""
Instan... | fpbfabio/dblp_data_processing | abs_file_parser_factory.py | Python | apache-2.0 | 394 |
#!/usr/bin/env python
from __future__ import division
__author__ = "Giorgio Casaburi and Greg Caporaso"
__copyright__ = "Copyright 2013, The miMAP project"
__credits__ = "Giorgio Casaburi", "Greg Caporaso"
__license__ = "GPL"
__version__ = "0.0.0-dev"
__maintainer__ = "Giorgio Casaburi"
__email__ = "casaburi@ceinge.un... | gregcaporaso/miMAP | biom_to_core_diversity_analyses.py | Python | bsd-3-clause | 4,207 |
##########################################################################
# Ganga Project. http://cern.ch/ganga
#
# $Id$
##########################################################################
from GangaCore.Core.exceptions import ApplicationConfigurationError
from GangaCore.GPIDev.Base.Proxy import isType
from Ga... | ganga-devs/ganga | ganga/GangaCore/Lib/Splitters/GangaDatasetSplitter.py | Python | gpl-3.0 | 2,451 |
#! -*- coding: utf-8 -*-
from __future__ import unicode_literals
import base64
import errno
import hashlib
import json
import os
import shutil
import tempfile as sys_tempfile
import unittest
from django.core.files import temp as tempfile
from django.core.files.uploadedfile import SimpleUploadedFile
from django.http.m... | iambibhas/django | tests/file_uploads/tests.py | Python | bsd-3-clause | 22,802 |
import sys
from ctypes import create_string_buffer
from ._libsoc import (
BITS_8, BITS_16, BPW_ERROR,
MODE_0, MODE_1, MODE_2, MODE_3, MODE_ERROR, api
)
PY3 = sys.version_info >= (3, 0)
class SPI(object):
def __init__(self, spidev_device, chip_select, mode, speed, bpw):
if not isin... | janick/libsoc | bindings/python/spi.py | Python | lgpl-2.1 | 4,256 |
import hashlib
import num.elip as elip
import num.enc as enc
def clockbase():
"""
256 bit hex: 4 x 16 byte long from float using clock (process time) + time (UTC epoch time)
Note: not enough clock precision on Linuxes to be unique between two immediate calls
"""
from struct import pack
from time import time, cl... | inuitwallet/bippy | num/rand.py | Python | mit | 2,418 |
#!/usr/bin/env python3
import json
import fileinput
import argparse
import os
import time
from batman import batman
from alfred import alfred
from rrddb import rrd
from nodedb import NodeDB
from d3mapbuilder import D3MapBuilder
# Force encoding to UTF-8
import locale # Ensures that s... | ff-kbu/ffmap-backend | bat2nodes.py | Python | bsd-3-clause | 2,385 |
# vim: tabstop=4 shiftwidth=4 softtabstop=4
# Copyright 2010 United States Government as represented by the
# Administrator of the National Aeronautics and Space Administration.
# All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compli... | canarie/openstack-dashboard | django-openstack/src/django_openstack/templatetags/templatetags/django_openstack_tags.py | Python | apache-2.0 | 1,694 |
data = [
{
"name": "post_problem",
"url": "/api/problems/",
"method": "post",
"payload": {
"token": "ADMIN@TOKEN",
"title": "problem A",
"score_type": 0
},
"files": {
"pdf": "./api/problem/problem.pdf"
},
... | Tocknicsu/nctuoj_contest | test/api/clarification/clarification.py | Python | apache-2.0 | 3,334 |
# from datasets.digit.svm import SVM as model
from datasets.digit.dataset import load_data
from datasets.digit.model import SimpleClassifier as model
| hoxmark/TDT4501-Specialization-Project | reinforcement/datasets/digit/__init__.py | Python | mit | 151 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.