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 |
|---|---|---|---|---|---|
"""
If you know what an abstract syntax tree (AST) is, you'll see that this module
is pretty much that. The classes represent syntax elements like functions and
imports.
This is the "business logic" part of the parser. There's a lot of logic here
that makes it easier for Jedi (and other libraries to deal with a Python... | tequa/ammisoft | ammimain/WinPython-64bit-2.7.13.1Zero/python-2.7.13.amd64/Lib/site-packages/jedi/parser/tree.py | Python | bsd-3-clause | 51,159 |
#!/usr/bin/env python
import os
import sys
import re
import copy
filename = sys.argv[1]
with open(filename, 'r') as infile:
lines = infile.read().splitlines()
match = re.search(r'contours_(\w+)_(\d)(\d)\.', filename)
organtech = match.group(1)
N = int(match.group(2))
M = int(match.group(3))
class Contour(object... | Particle-Therapy-Group-Bergen/PTPB | runs/relativeRiskAnalysis/makeContourLabels.py | Python | gpl-3.0 | 9,462 |
class Solution:
# @return a list of lists of length 3, [[val1,val2,val3]]
def threeSumClosest(self, num, target):
sorted_num = sorted(num)
distance = float('inf')
sum = 0
for i in range(len(num)-2):
a = sorted_num[i]
if a-target > distance:
... | lutianming/leetcode | 3sum_closest.py | Python | mit | 1,566 |
# -*- coding: utf-8 -*-
###############################################################################
#
# Person
# Returns members of Congress and U.S. Presidents since the founding of the nation.
#
# Python versions 2.6, 2.7, 3.x
#
# Copyright 2014, Temboo Inc.
#
# Licensed under the Apache License, Version 2.0 (th... | jordanemedlock/psychtruths | temboo/core/Library/GovTrack/Person.py | Python | apache-2.0 | 5,414 |
import difflib
from googkit.lib.i18n import _
class Help(object):
"""A class that prints a help message."""
"""A threshold of a similarity ratio for command candidates"""
CANDIDATE_RATIO_THRSHOLD = 0.5
def __init__(self, tree, argument):
"""Creates a help message builder with the command tre... | googkit/googkit | googkit/lib/help.py | Python | mit | 3,492 |
# Licensed to the Apache Software Foundation (ASF) under one
# or more contributor license agreements. See the NOTICE file
# distributed with this work for additional information
# regarding copyright ownership. The ASF licenses this file
# to you under the Apache License, Version 2.0 (the
# "License"); you may not u... | luoyetx/mxnet | python/mxnet/rnn/io.py | Python | apache-2.0 | 7,353 |
"""
Views related to content libraries.
A content library is a structure containing XBlocks which can be re-used in the
multiple courses.
"""
from __future__ import absolute_import
import logging
from django.conf import settings
from django.contrib.auth.decorators import login_required
from django.core.exceptions imp... | miptliot/edx-platform | cms/djangoapps/contentstore/views/library.py | Python | agpl-3.0 | 10,006 |
# Licensed to the Apache Software Foundation (ASF) under one
# or more contributor license agreements. See the NOTICE file
# distributed with this work for additional information
# regarding copyright ownership. The ASF licenses this file
# to you under the Apache License, Version 2.0 (the
# "License"); you may not u... | dmlc/tvm | vta/python/vta/libinfo.py | Python | apache-2.0 | 2,410 |
# Copyright (c) 2007, Enthought, Inc.
# All rights reserved.
#
# This software is provided without warranty under the terms of the BSD
# license included in /LICENSE.txt and may be redistributed only
# under the conditions described in the aforementioned license. The license
# is also available online at http://... | burnpanck/traits | traits/tests/test_range.py | Python | bsd-3-clause | 2,646 |
#!/usr/bin/python3
# Sir helps you to do automated TLS certificate rollovers, including TLSA updates.
# Copyright (C) 2015 Skruppy <[email protected]>
#
# This file is part of Sir.
#
# Sir is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
#... | Skrupellos/sir | sir.py | Python | gpl-3.0 | 862 |
"""
Start the function name with a lower case letter.
It's rule for only Unix / Linux C/C++ code.
== Violation ==
bool CheckSth() { <== Violation. The function name starts with uppercase C.
return false;
}
bool _CheckSth() { <== Violation. The function name starts with uppercase C.
... | kunaltyagi/nsiqcppstyle | rules/RULE_3_3_A_start_function_name_with_lowercase_unix.py | Python | gpl-2.0 | 3,754 |
#!/usr/bin/python
#
# Build Duktape website. Must be run with cwd in the website/ directory.
#
import os
import sys
import time
import datetime
import shutil
import re
import tempfile
import atexit
import md5
from bs4 import BeautifulSoup, Tag
colorize = True
fancy_stack = True
remove_fixme = True
testcase_refs = F... | andoma/duktape | website/buildsite.py | Python | mit | 27,306 |
import time
import sys
def log_called_times_decorator(func):
def wrapper(*args):
wrapper.count += 1
# print "The function I modify has been called {0} times(s).".format(wrapper.count)
now = time.time()
if now - wrapper.last_log > wrapper.dt:
print '[DEBUG] In last %ds %s... | michaellas/streaming-vid-to-gifs | src/utils.py | Python | mit | 1,054 |
# -*- coding: utf-8 -*-
#
# Copyright 2016 Mirantis, 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 requ... | tivaliy/git-repo | gitrepo/tests/unit/cli/test_sync.py | Python | apache-2.0 | 1,800 |
# Lint as: python3
# Copyright 2021 The Chromium Authors. All rights reserved.
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
"""Helper module for retrieving git repository metadata."""
import datetime as dt
import functools
import pathlib
from typing import Optio... | nwjs/chromium.src | tools/android/python_utils/git_metadata_utils.py | Python | bsd-3-clause | 4,240 |
from flask import Flask
from flask.ext.restful import Api, Resource
from peewee import SqliteDatabase
database = SqliteDatabase('/tmp/fangorn.db', threadlocals=True)
from models import User, Token, Folder, File
database.create_tables([User, Token, Folder, File], True)
app = Flask(__name__)
api = Api(app)
from user... | citruspi/Fangorn | api/__init__.py | Python | unlicense | 659 |
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.db import migrations, models
import django.db.models.deletion
class Migration(migrations.Migration):
dependencies = [
('cms_pages', '0017_auto_20160417_1450'),
]
operations = [
migrations.AlterField(
... | dchaplinsky/declarations.com.ua | declarations_site/cms_pages/migrations/0018_auto_20170211_1550.py | Python | mit | 1,036 |
# -*- coding: utf-8 -*-
#!/usr/bin/env python
#
# Copyright 2015 BigML
#
# 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... | brokendata/bigmler | bigmler/tests/test_01_predictions.py | Python | apache-2.0 | 40,518 |
# MIT licensed
# Copyright (c) 2020 Chih-Hsuan Yen <yan12125 at gmail dot com>
import pytest
pytestmark = [pytest.mark.asyncio, pytest.mark.needs_net]
async def test_container(get_version):
assert await get_version("hello-world", {
"source": "container",
"container": "library/hello-world",
"include_rege... | lilydjwg/nvchecker | tests/test_container.py | Python | mit | 570 |
# -*- coding: utf-8 -*-
#
# PySPED - Python libraries to deal with Brazil's SPED Project
#
# Copyright (C) 2010-2012
# Copyright (C) Aristides Caldeira <aristides.caldeira at tauga.com.br>
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU Library General Public Lic... | rodrigoasmacedo/PySPED | pysped/xml_sped/base.py | Python | lgpl-2.1 | 35,708 |
import Tkinter
import ttk
import ttkstyles
import periodic
class QuitButton(ttk.Button):
"""docstring for QuitButton"""
def __init__(self, parent):
ttk.Button.__init__(
self,
parent,
text="Quit",
style="Quit.TButton"
)
class ElementLabel(tt... | ktbartolotta/periodic | main.py | Python | mit | 2,480 |
from celery.task import task
@task(name="c.unittest.SomeAppTask")
def SomeAppTask(**kwargs):
return 42
| mzdaniel/oh-mainline | vendor/packages/django-celery/tests/someapp/tasks.py | Python | agpl-3.0 | 109 |
class Solution(object):
def findLengthOfLCIS(self, nums):
"""
:type nums: List[int]
:rtype: int
"""
if not nums:
return 0
n = len(nums)
start = pre = theMax = 0
for i in range(1, n):
if nums[i] > nums[pre]:
if ... | wufangjie/leetcode | 674. Longest Continuous Increasing Subsequence.py | Python | gpl-3.0 | 529 |
# Copyright 2013 - Mirantis, 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 ag... | StackStorm/mistral | mistral/services/periodic.py | Python | apache-2.0 | 5,546 |
import xmlrpclib
import urllib2
import json
import datetime
import functools
from django.shortcuts import render_to_response
from django.http import HttpResponse
from django.conf import settings
from django.core.context_processors import csrf
from django.views.decorators.csrf import csrf_exempt
from powwow.apps.model... | pbs/powwow | powwow/apps/views.py | Python | bsd-3-clause | 5,246 |
#!/usr/bin/env python3
# Copyright (c) 2014-2016 The nealcoin Core developers
# Distributed under the MIT software license, see the accompanying
# file COPYING or http://www.opensource.org/licenses/mit-license.php.
"""Test behavior of headers messages to announce blocks.
Setup:
- Two nodes, two p2p connections to no... | appop/bitcoin | qa/rpc-tests/sendheaders.py | Python | mit | 25,711 |
import sqlite3
class Point:
def __init__(self, x, y):
self.x, self.y = x, y
def adapt_point(point):
return "%f;%f" % (point.x, point.y)
sqlite3.register_adapter(Point, adapt_point)
con = sqlite3.connect(":memory:")
cur = con.cursor()
p = Point(4.0, -3.2)
cur.execute("select ?", (p,))
print(cur.fetc... | 837468220/python-for-android | python3-alpha/python3-src/Doc/includes/sqlite3/adapter_point_2.py | Python | apache-2.0 | 331 |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
# vim: set ts=4 sw=4 tw=0 noet :
#
# Document: dims-training-manual
# This documentation build configuration file was created from
# a cookiecutter template. It is based on output derived from
# the output of sphinx-quickstart.
#
# This file is execfile()d with the current ... | uw-dims/dims-training-manual | docs/source/conf.py | Python | bsd-3-clause | 11,416 |
# util/_collections.py
# Copyright (C) 2005-2012 the SQLAlchemy authors and contributors <see AUTHORS file>
#
# This module is part of SQLAlchemy and is released under
# the MIT License: http://www.opensource.org/licenses/mit-license.php
"""Collection classes and helpers."""
import sys
import itertools
import weakref... | SohKai/ChronoLogger | web/flask/lib/python2.7/site-packages/sqlalchemy/util/_collections.py | Python | mit | 25,079 |
import mimetypes
import os
import logging
import urlparse
from django.conf.urls import url
import json
from django.http import Http404, HttpResponse, HttpResponseForbidden, HttpResponseNotFound, HttpResponseRedirect
from django.core.servers.basehttp import FileWrapper
from django.shortcuts import redirect
from django.... | fergalmoran/dss | spa/audio.py | Python | bsd-2-clause | 2,586 |
from weblab.core.new_server import WebLabAPI
weblab_api = WebLabAPI(['login_web', 'web', 'webclient'])
import webclient.web.view_index
import webclient.web.view_labs
import webclient.web.view_lab
@weblab_api.route_webclient("/test/", methods=["GET", "POST"])
def test():
weblab_api.ctx.reservation_id = "TEST"
... | zstars/weblabdeusto | server/src/weblab/core/wl.py | Python | bsd-2-clause | 338 |
"""
Functions for querying the Solr server.
results = query_solr( db, { 'q': 'obama' } )
sentences = results['response']['docs']
for sentence in sentences:
print(f"Found sentence ID: {sentence['story_sentences_id']}")
More information about Solr integration at docs/solr.markdown.
"""
import abc
... | berkmancenter/mediacloud | apps/common/src/python/mediawords/solr/__init__.py | Python | agpl-3.0 | 16,005 |
from django import forms
from django.contrib.auth.models import User
from django.core.paginator import Paginator
from django.shortcuts import render
from django.utils.translation import ugettext as _
from wagtail.admin import messages
from wagtail.admin.forms.search import SearchForm
from wagtail.admin.rich_text impor... | mikedingjan/wagtail | wagtail/contrib/styleguide/views.py | Python | bsd-3-clause | 3,140 |
import os, sys
import datetime
import iris
import iris.unit as unit
import iris.analysis.cartography
import numpy as np
import iris.analysis.geometry
from shapely.geometry import Polygon
from iris.coord_categorisation import add_categorised_coord
import imp
imp.load_source('UnrotateUpdateCube', '/nfs/see-fs-01_use... | peterwilletts24/Python-Scripts | EMBRACE/Time_Variability_Divergence.py | Python | mit | 4,042 |
"""Main classes to add caching features to ``requests.Session``
.. autosummary::
:nosignatures:
CachedSession
CacheMixin
.. Explicitly show inherited method docs on CachedSession instead of CachedMixin
.. autoclass:: requests_cache.session.CachedSession
:show-inheritance:
:inherited-members:
.. aut... | reclosedev/requests-cache | requests_cache/session.py | Python | bsd-2-clause | 14,100 |
# -*- coding: utf-8 -*-
##############################################################################
#
# 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 Pu... | jobiols/odoo-web | website_doc/__openerp__.py | Python | agpl-3.0 | 1,690 |
"""Tests for Order-transaction reconciliation and reporting."""
from ddt import ddt, data, unpack
from edx.analytics.tasks.tests import unittest
from edx.analytics.tasks.tests.map_reduce_mixins import MapperTestMixin, ReducerTestMixin
from edx.analytics.tasks.reports.reconcile import (
ReconcileOrdersAndTransacti... | sssllliang/edx-analytics-pipeline | edx/analytics/tasks/reports/tests/test_reconcile.py | Python | agpl-3.0 | 36,792 |
import time
import random
from random import randint
# from library import Trigger, Axis
# from library import PS4
from library import Joystick
import RPi.GPIO as GPIO # remove!!!
from emotions import angry, happy, confused
# from pysabertooth import Sabertooth
# from smc import SMC
from library import LEDDisplay
from... | DFEC-R2D2/r2d2 | pygecko/states/remote.py | Python | mit | 11,721 |
from unittest import TestCase
from svnfiltereddump import InterestingPaths
class InterestingPathsTests(TestCase):
def test_empty_string(self):
interesting_path = InterestingPaths()
interesting_path.mark_path_as_interesting('')
self.assertTrue(interesting_path.is_interesting('a'))
... | TNG/svnfiltereddump | tests/TestInterestingPaths.py | Python | gpl-3.0 | 2,455 |
#!/usr/bin/env python
# pylint: disable=missing-docstring
# flake8: noqa: T001
# ___ ___ _ _ ___ ___ _ _____ ___ ___
# / __| __| \| | __| _ \ /_\_ _| __| \
# | (_ | _|| .` | _|| / / _ \| | | _|| |) |
# \___|___|_|\_|___|_|_\/_/_\_\_|_|___|___/_ _____
# | \ / _ \ | \| |/ _ \_ _| | __| \_ ... | wbrefvem/openshift-ansible | roles/lib_openshift/library/oc_edit.py | Python | apache-2.0 | 55,673 |
from typing import Optional, Dict, Union, List
from .singleton import Singleton
class Arguments(metaclass=Singleton):
"""
Arguments singleton
"""
class Name:
SETTINGS_FILE: str = 'settings_file'
SETTINGS: str = 'settings'
INIT: str = 'init'
VERBOSE: str = 'verbose'
... | PetterKraabol/Twitch-Chat-Downloader | tcd/arguments.py | Python | mit | 3,199 |
from south.db import db
from django.db import models
from ietf.ietfworkflows.models import *
class Migration:
def forwards(self, orm):
# Adding model 'StateDescription'
db.create_table('ietfworkflows_statedescription', (
('id', orm['ietfworkflows.statedescription:id']),
... | mcr/ietfdb | ietf/ietfworkflows/migrations/0010_add_state_definitions.py | Python | bsd-3-clause | 16,914 |
import subprocess
from six import iteritems
def run_nastran(fname, keywords=None):
"""
Call a nastran subprocess with the given filename
Parameters
-----------
fname : string
Filename of the Nastran .bdf file
keywords : dict/list of strings, optional
Default keywords are `'scr=... | saullocastro/pyNastran | pyNastran/utils/nastran_utils.py | Python | lgpl-3.0 | 896 |
EMAIL_HOST='smtp.gmail.com'
EMAIL_HOST_USER='[email protected]'#insert email
EMAIL_HOST_PASSWORD='Web!tec#2017'#insert password
EMAIL_PORT=587 | emanuelcovaci/pythonic | pythonic/local.py | Python | gpl-3.0 | 146 |
# Copyright 2012 OpenStack Foundation
# 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 requ... | citrix-openstack-build/trove | trove/extensions/routes/account.py | Python | apache-2.0 | 1,693 |
import unittest
from streamlink.plugins.rtvs import Rtvs
class TestPluginRtvs(unittest.TestCase):
def test_can_handle_url(self):
should_match = [
'http://www.rtvs.sk/televizia/live-1',
'http://www.rtvs.sk/televizia/live-2',
'http://www.rtvs.sk/televizia/live-o',
... | back-to/streamlink | tests/plugins/test_rtvs.py | Python | bsd-2-clause | 622 |
from runtime import *
'''
inspect locals of a function at runtime for debugging
'''
@locals
def myfunc(value='bar'):
x = 1
y = {foo:value}
@locals
def nested():
z = 'FOO'
return value + 'NESTED'
return nested()
def main():
print myfunc.locals
print myfunc()
print myfunc.locals
assert myfunc.locals.x == ... | pombredanne/Rusthon | regtests/lang/func_locals.py | Python | bsd-3-clause | 521 |
import re
from django import template
from django.template.loader import get_template
from django.template import RequestContext
register = template.Library()
INSTALLED_ARTIFACTS = dict()
def install(artifact_class):
INSTALLED_ARTIFACTS[artifact_class.key] = artifact_class
def find(data):
from fir_artifa... | gcrahay/FIR | fir_artifacts/artifacts.py | Python | gpl-3.0 | 3,764 |
# coding: utf-8
from __future__ import unicode_literals
import unittest
import os
import numpy as np
import shutil
from pymatgen.io.vaspio_set import MITVaspInputSet, MITHSEVaspInputSet, \
MPVaspInputSet, MITGGAVaspInputSet, MITNEBVaspInputSet,\
MPStaticVaspInputSet, MPNonSCFVaspInputSet, MITMDVaspInputSet,\... | Dioptas/pymatgen | pymatgen/io/tests/test_vaspio_set.py | Python | mit | 16,493 |
# -*- coding: utf-8 -*-
"""
Parse and stream Bitcoin blocks as either Block or BlockHeader structures.
The MIT License (MIT)
Copyright (c) 2013 by Richard Kiss
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
i... | moocowmoo/pycoin | pycoin/block.py | Python | mit | 7,399 |
from nose.tools import * # flake8: noqa
import functools
from tests.base import ApiTestCase
from website.project.licenses import NodeLicense
from website.project.licenses import ensure_licenses
from api.base.settings.defaults import API_BASE
ensure_licenses = functools.partial(ensure_licenses, warn=False)
class Te... | monikagrabowska/osf.io | api_tests/licenses/views/test_license_list.py | Python | apache-2.0 | 1,621 |
#
# Licensed to the Apache Software Foundation (ASF) under one or more
# contributor license agreements. See the NOTICE file distributed with
# this work for additional information regarding copyright ownership.
# The ASF licenses this file to You under the Apache License, Version 2.0
# (the "License"); you may not us... | robertwb/incubator-beam | sdks/python/apache_beam/runners/direct/direct_runner.py | Python | apache-2.0 | 24,082 |
import demistomock as demisto # noqa: F401
from CommonServerPython import * # noqa: F401
import copy
"""
This Script is a duplicate of Packs/Campaign/Scripts/GetCampaignIncidentsInfo with the only change of the context field
the data is taken from. The reason is that dynamic section in layout cannot use arguments i... | VirusTotal/content | Packs/Campaign/Scripts/GetCampaignLowSimilarityIncidentsInfo/GetCampaignLowSimilarityIncidentsInfo.py | Python | mit | 5,766 |
# -*- coding: utf-8 -*-
#
# This file is part of Karesansui.
#
# Copyright (C) 2009-2012 HDE, Inc.
#
# 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 lim... | karesansui/karesansui | karesansui/gadget/guestby1device.py | Python | mit | 11,405 |
# -*- coding: utf-8 -*-
"""
@copyright Copyright (c) 2013 Submit Consulting
@author Angel Sullon (@asullom)
@package utils
Descripcion: Clases para controlar la seguridad de la información en la nube
"""
from apps.utils.messages import Message
import datetime
import random
import hashlib
f... | submitconsulting/backenddj | apps/utils/security.py | Python | bsd-3-clause | 5,806 |
#!/usr/bin/env python
# Copyright (c) 2012 The Chromium Authors. All rights reserved.
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
"""Audio tools for recording and analyzing audio.
The audio tools provided here are mainly to:
- record playing audio.
- remove si... | loopCM/chromium | chrome/test/functional/media/audio_tools.py | Python | bsd-3-clause | 6,222 |
#!/usr/bin/env python
"""
Copyright 2010-2019 University Of Southern California
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 appli... | SCECcode/BBP | bbp/comps/irikura_gen_srf.py | Python | apache-2.0 | 10,817 |
__author__ = 'Calle Svensson <[email protected]>'
# Constants
BYTE_MAX = 256
INF = 1 << 63
__all__ = ['cryptanalysis', 'ciphers', 'conversions', 'mathtools', 'utility', 'BYTE_MAX', 'INF']
| ZetaTwo/zetacrypto | zetacrypt/__init__.py | Python | mit | 200 |
from alarm.models import UserProfile, Log, Alert, AlarmStateConfiguration
from rest_framework import viewsets
from serializers import UserSerializer, LogSerializer, AlertSerializer, AlarmStateConfigurationSerializer
""" ViewSets define the view behavior. """
class UserProfileViewSet(viewsets.ModelViewSet):
qu... | Silvian/alarm-service | api/views.py | Python | gpl-3.0 | 797 |
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.db import models, migrations
class Migration(migrations.Migration):
dependencies = [
('deals', '0006_auto_20150901_1541'),
]
operations = [
migrations.AddField(
model_name='deal',
name='c... | HelloLily/hellolily | lily/deals/migrations/0007_auto_20150902_1543.py | Python | agpl-3.0 | 972 |
import IMP
import IMP.test
import IMP.atom
def get_all_atoms(pdb):
atoms = {}
residues = IMP.atom.get_by_type(pdb, IMP.atom.RESIDUE_TYPE)
for ni, res in enumerate(residues):
resatoms = IMP.atom.get_by_type(res, IMP.atom.ATOM_TYPE)
for a in resatoms:
aid = '%d:' % (ni + 1) \
... | shanot/imp | modules/atom/test/test_charmm_stereochemistry.py | Python | gpl-3.0 | 3,890 |
##########################################################################
#
# Copyright (c) 2009-2010, Image Engine Design 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:
#
# * Redis... | AlanZatarain/cortex-vfx | test/IECoreMaya/SplineParameterHandlerTest.py | Python | bsd-3-clause | 12,548 |
import sys
import json
import csv
if __name__ == "__main__":
try:
if len(sys.argv) < 2:
print "Usage: %s <JSON settings file>" % sys.argv[0]
print " <settings file>: access settings (IP/user/password)"
sys.exit(0)
f = open(sys.argv[1], 'r')
settings... | jocook/s3260-python | ucsc_destroy_DomainGroups.py | Python | apache-2.0 | 1,216 |
import bson
from eduid_userdb.exceptions import UserDoesNotExist
from eduid_userdb.testing import MongoTestCase
from eduid_api_amp import attribute_fetcher
from eduid_am.celery import celery, get_attribute_manager
TEST_DB_NAME = 'eduid_api_test'
class AttributeFetcherTests(MongoTestCase):
def setUp(self, sett... | SUNET/eduid-api-amp | eduid_api_amp/tests.py | Python | bsd-3-clause | 1,517 |
#!/usr/bin/env python
""" motion_history_demo.py - Version 1.0 2013-06-26
Based on the OpenCV motempl.py sample code
Extends the ros2opencv2.py script which takes care of user input and image display
Created for the Pi Robot Project: http://www.pirobot.org
Copyright (c) 2013 Patrick Goebel. ... | fujy/ROS-Project | src/rbx2/rbx2_vision/nodes/unused/motion_history_demo.py | Python | mit | 6,836 |
import datetime
from pprint import pprint
from django.core.management.base import BaseCommand, CommandError
from django.utils import timezone
from fo2.connections import db_cursor_so
import logistica.models as models
from utils.functions.models import rows_to_dict_list
from utils.functions.queries import debug_curso... | anselmobd/fo2 | src/lotes/management/commands/celula_21_para_33.py | Python | mit | 2,964 |
from __future__ import print_function
import logging
import random
import re
from streamlink.compat import urljoin
from streamlink.plugin import Plugin, PluginArguments, PluginArgument
from streamlink.plugin.api import http
from streamlink.plugin.api import useragents
from streamlink.plugin.api import validate
from s... | javiercantero/streamlink | src/streamlink/plugins/funimationnow.py | Python | bsd-2-clause | 11,232 |
"""
Tests for resize functionality.
"""
from itertools import permutations
from helper import unittest, PillowTestCase, hopper
from PIL import Image
class TestImagingCoreResize(PillowTestCase):
def resize(self, im, size, f):
# Image class independent version of resize.
im.load()
return ... | 1upon0/rfid-auth-system | GUI/printer/Pillow-2.7.0/Tests/test_image_resize.py | Python | apache-2.0 | 3,963 |
import bpy
from bpy.utils import register_class, unregister_class
import nodeitems_utils
from .random_property import RandomPropertyNode
from .ramp_property import RampPropertyNode
classes = [RandomPropertyNode, RampPropertyNode]
def register():
for cls in classes:
register_class(cls)
def unregister():
... | MaximeHerpin/modular_tree | python_classes/nodes/properties/__init__.py | Python | gpl-3.0 | 374 |
# -*- encoding: utf-8 -*-
#
# This file is part of jottafs.
#
# jottafs 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.
#
# jottafs is ... | thusoy/jottalib | src/jottalib/JFS.py | Python | gpl-3.0 | 38,435 |
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('beekeepers', '0002_add_beekeepers_survey_model'),
]
operations = [
migrations.AddField(
model_name='apiary',
... | project-icp/bee-pollinator-app | src/icp/apps/beekeepers/migrations/0003_apiary_deleted.py | Python | apache-2.0 | 457 |
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the... | openstack/sahara | sahara/common/policies/job_type.py | Python | apache-2.0 | 944 |
from dataccess import psget
| hoidn/LCLS | dataccess/tests/test_psget.py | Python | gpl-3.0 | 30 |
from __future__ import with_statement
import importlib
from fabric.api import *
from fabric.contrib.console import confirm
from .load_config import load_config
from .machine import install_machine
from .geoserver import deploy_geoserver
from .api import deploy_api
@task
def deploy():
load_config()
install_mac... | openmaraude/fab_taxi | fabfile.py | Python | mit | 368 |
import json
import os
from django.core.urlresolvers import reverse
from django.db import connections
from django.test import TestCase
from django.test.client import RequestFactory
from django.test.utils import override_settings
from healthcheck.contrib.django.status_endpoint import views
class StatusEndpointViewsT... | yola/healthcheck | healthcheck/contrib/django/status_endpoint/tests/test_views.py | Python | mit | 2,769 |
#
# Copyright 2012 Red Hat, 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 2 of the License, or
# (at your option) any later version.
#
# This program is distributed in th... | edwardbadboy/vdsm-ubuntu | tests/netinfoTests.py | Python | gpl-2.0 | 7,176 |
# coding=utf-8
from abc import ABCMeta, abstractmethod
from typing import Optional
from weakref import ref
from logging import getLogger
from ultros.core.networks.base.connectors import base as base_connector
from ultros.core.networks.base.networks import base as base_network
__author__ = "Gareth Coles"
class Base... | UltrosBot/Ultros3K | src/ultros/core/networks/base/servers/base.py | Python | artistic-2.0 | 942 |
from .list_item import SimpleItem
| d2emon/generator-pack | src/factory/__init__.py | Python | gpl-3.0 | 34 |
# -*- coding: utf-8 -*-
"""
Integration tests for submitting problem responses and getting grades.
"""
import json
import os
from textwrap import dedent
from django.conf import settings
from django.contrib.auth.models import User
from django.core.urlresolvers import reverse
from django.test.client import RequestFactor... | martynovp/edx-platform | lms/djangoapps/courseware/tests/test_submitting_problems.py | Python | agpl-3.0 | 51,827 |
# This file is part of RinohType, the Python document preparation system.
#
# Copyright (c) Brecht Machiels.
#
# Use of this source code is subject to the terms of the GNU Affero General
# Public License v3. See the LICENSE file or http://www.gnu.org/licenses/.
"""
Functions for formatting numbers:
* :func:`format_nu... | beni55/rinohtype | rinoh/number.py | Python | agpl-3.0 | 4,052 |
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html).
{
"name": "Product Variant Inactive",
"author": "Akretion,Odoo Community Association (OCA)",
"website": "https://github.com/OCA/product-variant",
"license": "AGPL-3",
"category": "Product",
"version": "14.0.1.0.0",
"depend... | OCA/product-variant | product_variant_inactive/__manifest__.py | Python | agpl-3.0 | 485 |
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
import datetime
import os
import re
import unittest
from django.contrib.admin import ModelAdmin
from django.contrib.admin.helpers import ACTION_CHECKBOX_NAME
from django.contrib.admin.models import ADDITION, DELETION, LogEntry
from django.contrib.admin.o... | zanderle/django | tests/admin_views/tests.py | Python | bsd-3-clause | 300,461 |
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
#
"""
Data Analysis RPC server over Tango:
Factory for the loading of plugins
"""
__authors__ = ["Jérôme Kieffer"]
__contact__ = "[email protected]"
__license__ = "MIT"
__copyright__ = "European Synchrotron Radiation Facility, Grenoble, France"
__date__ = "17/03/2... | kif/dahu | dahu/factory.py | Python | gpl-2.0 | 5,151 |
class Solution(object):
def containsDuplicate(self, nums):
"""
:type nums: List[int]
:rtype: bool
"""
return len(set(nums)) != len(nums) | tedye/leetcode | Python/leetcode.217.contains-duplicate.py | Python | mit | 180 |
#!/usr/bin/env python
import re
import players
from player import Player
re_coordinates = re.compile(r"^\(?(\d+)\w*,\w*(\d+)\)?$")
def clientThread(c, addr):
player = createCharacter(c, addr)
c.send(str(len(players.onlinePlayers))+" player(s) currently online...\n")
loop(c, addr, player)
def loop(c, addr, p... | icedvariables/QuickMUD | src/clientthread.py | Python | gpl-3.0 | 1,154 |
from OpenGL.GL import (GL_TRUE,GL_FRAGMENT_SHADER,GL_LINK_STATUS,
GL_VERTEX_SHADER, glAttachShader,glCompileShader,GL_COMPILE_STATUS,
glCreateProgram,glCreateShader, glDeleteProgram,glGetAttribLocation,
glDeleteShader,glGetProgramInfoLog, glGetProgramiv, glGetShaderInfoLog,
glGetShaderiv,glGetUn... | fboers/jumegX | tsvgl/old/jumeg_tsv_glsl.py | Python | bsd-3-clause | 3,586 |
input = """
c num blocks = 1
c num vars = 250
c minblockids[0] = 1
c maxblockids[0] = 250
p cnf 250 1082
230 -158 -213 0
-139 -140 -202 0
-191 -160 20 0
195 -137 -183 0
176 -64 34 0
61 30 247 0
30 -236 -247 0
207 193 -21 0
50 63 23 0
-217 -180 163 0
97 -13 89 0
111 218 171 0
-28 -89 41 0
29 180 -94 0
-51 35 -53 0
126 -... | Yarrick13/hwasp | tests/sat/Intensive/c1082.250.SAT.dimacs.test.py | Python | apache-2.0 | 15,546 |
# Make sure you name your file with className.py
from hint_class_helpers.find_matches import find_matches
class Prob6_Part3:
"""
Author: Shen Ting Ang
Date: 11/7/2016
"""
def check_attempt(self, params):
self.attempt = params['attempt'] #student's attempt
self.answer = params['answe... | zhenzhai/edx-platform | common/lib/sandbox-packages/hint/hint_class/Week7/Prob6_Part3.py | Python | agpl-3.0 | 911 |
# Copyright 2008-2014 Nokia Solutions and Networks
#
# 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 l... | eric-stanley/robotframework | src/robot/parsing/htmlreader.py | Python | apache-2.0 | 6,458 |
# -*- coding: utf-8 -*-
# @Author: ZwEin
# @Date: 2016-06-09 11:10:02
# @Last Modified by: ZwEin
# @Last Modified time: 2016-06-16 09:10:04
| ZwEin27/phone-number-matcher | pnmatcher/core/__init__.py | Python | apache-2.0 | 144 |
from apiclient import APIClient, RateLimiter
class FreebaseAPI(APIClient):
API_FILE = '.freebase_api_key'
API_KEY = open(API_FILE).read()
BASE_URL = 'https://www.googleapis.com/freebase/v1/'
def search(self,params):
params['apikey'] = self.API_KEY
path = 'search'
print params
return self.call(... | andynu/RottenTomatoesActorQuality | src/freebase.py | Python | gpl-2.0 | 1,013 |
import numpy as np
import scipy.sparse
from scipy.spatial.distance import cdist
from .common import Benchmark, safe_import
with safe_import():
from scipy.sparse.csgraph import maximum_bipartite_matching,\
min_weight_full_bipartite_matching
class MaximumBipartiteMatching(Benchmark):
params = [[5000,... | WarrenWeckesser/scipy | benchmarks/benchmarks/sparse_csgraph_matching.py | Python | bsd-3-clause | 3,000 |
from core.vectors import PhpCode, ShellCmd, ModuleExec, Os
from core.module import Module
from core import modules
from core import messages
from core.loggers import log
import urllib.parse
import os
class Upload2web(Module):
"""Upload file automatically to a web folder and get corresponding URL."""
def init... | epinna/weevely3 | modules/file/upload2web.py | Python | gpl-3.0 | 4,967 |
"""
Demo platform that has two fake remotes.
For more details about this platform, please refer to the documentation
https://home-assistant.io/components/demo/
"""
from homeassistant.components.remote import RemoteDevice
from homeassistant.const import DEVICE_DEFAULT_NAME
# pylint: disable=unused-argument
def setup_... | xifle/home-assistant | homeassistant/components/remote/demo.py | Python | mit | 1,545 |
from __future__ import print_function
from BinPy import *
print ('Usage of IC 7425:\n')
ic = IC_7425()
print ('\nThe Pin configuration is:\n')
p = {
1: 0,
2: 0,
3: 0,
4: 0,
5: 0,
7: 0,
9: 1,
10: 1,
11: 1,
12: 1,
13: 1,
14: 1}
print (p)
print ('\nPin initialization -using ... | coder006/BinPy | BinPy/examples/ic/Series_7400/IC7425.py | Python | bsd-3-clause | 1,189 |
# OCR requires parameter tuning based on its image pattern.
# This project demonstrates how to use image pre-processing and then
# utilize tesseract package to recognize captcha.
# The accuracy of the proposed method can achieve up to 80%, which is acceptable for many web applications.
# Feel free to give ... | allan920693/Captcha-Solver-using-Pytesseract | Main.py | Python | mit | 27,466 |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
"""Imports values from task 13 to test equality.
.. hint::
You can access task_12 data in the following example type:
.. code:: python
print task_12.FLOATVAL
"""
import task_12
FRAC_DEC_EQUAL = task_12.DECVAL == task_12.FRACVAL
DEC_FLOAT_INEQUAL = task_12.DEC... | johnnymango/is210-week-03-warmup | task_13.py | Python | mpl-2.0 | 343 |
# Copyright (c) 2013, 2014
# Jose Luis Cercos-Pita <[email protected]>
#
# 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 opt... | sanguinariojoe/sonsilentsea | resources/Campaigns/aTraining/aHurtWhale/__init__.py | Python | gpl-3.0 | 3,446 |
# 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/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2020_09_01/operations/_users_operations.py | Python | mit | 21,208 |
from application import app
#~ # Application Config
app.config.update(dict(
DEBUG = True,
SECRET_KEY = 'development key',
))
| japeto/Tahoe-Motores | application/config.py | Python | gpl-3.0 | 134 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.