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 collections import defaultdict
from django_bulk_update.helper import bulk_update
from django.conf import settings as django_settings
from django.db import transaction
from django.http import JsonResponse
from rest_framework import generics
from rest_framework import permissions as drf_permissions
from rest_framew... | icereval/osf.io | api/base/views.py | Python | apache-2.0 | 26,351 |
#!/usr/bin/env python3
import re
import hashlib
import sys
pattern = re.compile(r"\*\n(Builtin protocol feature: (.*)(?:\*[^/]|[^\*])*)\*/")
def main():
with open(sys.argv[1], "r") as f:
contents = f.read()
print('#include <eosio/chain/protocol_feature_manager.hpp>')
print('#include <map>... | EOSIO/eos | unittests/gen_protocol_feature_digest_tests.py | Python | mit | 1,030 |
import keyedcache
import random
from django.test import TestCase
from django.contrib.auth.models import User
from django.core.urlresolvers import reverse
from keyedcache.views import stats_page, view_page, delete_page
import time
CACHE_HIT=0
def cachetest(a,b,c):
global CACHE_HIT
CACHE_HIT += 1
r = [rand... | aronysidoro/django-keyedcache | keyedcache/tests.py | Python | bsd-3-clause | 5,800 |
# @license
# Copyright 2016 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 or agreed to in... | janelia-flyem/neuroglancer | python/neuroglancer/random_token.py | Python | apache-2.0 | 753 |
import markdown
from qtk.common import TemplateBase, NameBase, Category as C
from qtk.fields import Field as F
class GenericTemplate(NameBase, TemplateBase):
_id_map = {}
def __init__(self, name, category, sub_category=C.MAIN, convention_keys=(F.CURRENCY,)):
name_id = "%s.%s" % (sub_category.id, sel... | gouthambs/qtk-python | qtk/templates.py | Python | mit | 5,066 |
# Copyright 2017 Google Inc. All Rights Reserved.
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or ag... | google/ssl_logger | ssl_logger.py | Python | apache-2.0 | 13,453 |
"""Common file operations."""
import io
import os
import sys
from gam import controlflow
from gam import display
from gam.var import GM_Globals
from gam.var import GM_SYS_ENCODING
from gam.var import UTF8_SIG
def _open_file(filename, mode, encoding=None, newline=None):
"""Opens a file with no error handling."""... | GAM-team/GAM | src/gam/fileutils.py | Python | apache-2.0 | 5,834 |
import os
import sys
import json
from urllib.parse import urlparse
from gruve import io
class WebServiceCache():
"""
Implements a local file system cache to prevent overusing a web service
"""
def __init__(self, webServiceProxy):
self.webServiceProxy = webServiceProxy
# ------------------... | STSILABS/fda-sandbox | gruve/gruve/web_service_cache.py | Python | mit | 1,562 |
#!/usr/bin/python
# -*- coding: utf-8 -*-
"""Tests for the PE file parser."""
import unittest
from plaso.formatters import pe # pylint: disable=unused-import
from plaso.lib import timelib
from plaso.parsers import pe
from tests import test_lib as shared_test_lib
from tests.parsers import test_lib
class PECOFFTest... | dc3-plaso/plaso | tests/parsers/pe.py | Python | apache-2.0 | 2,247 |
import json
import logging
import os
import random
import shutil
from uuid import uuid4
from django.contrib.postgres.fields import JSONField
from django.core.exceptions import ValidationError
from django.db import models
from foresite import utils, Aggregation, URIRef, AggregatedResource, RdfLibSerializer
from rdflib ... | hydroshare/hydroshare | hs_file_types/models/base_model_program_instance.py | Python | bsd-3-clause | 24,351 |
# Copyright (c) 2015-2017. Mount Sinai School of Medicine
#
# 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 ... | hammerlab/topiary | test/test_mutant_epitope_predictions_class1.py | Python | apache-2.0 | 2,550 |
"""
Custom manager for HelpEntry objects.
"""
from django.db import models
from evennia.utils import logger, utils
from evennia.typeclasses.managers import TypedObjectManager
__all__ = ("HelpEntryManager",)
class HelpEntryManager(TypedObjectManager):
"""
This HelpEntryManager implements methods for searching
... | titeuf87/evennia | evennia/help/manager.py | Python | bsd-3-clause | 4,222 |
#!/usr/bin/env vpython3
# Copyright 2020 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.
from __future__ import print_function
import json
import os
import sys
import unittest
if sys.version_info[0] == 2:
import mock
e... | chromium/chromium | testing/unexpected_passes_common/builders_unittest.py | Python | bsd-3-clause | 11,096 |
# ===============================================================================
# Copyright 2013 Jake Ross
#
# 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... | UManPychron/pychron | pychron/spectrometer/tasks/spectrometer_task.py | Python | apache-2.0 | 11,184 |
#
# THIS IS WORK IN PROGRESS.
#
# The Python Imaging Library.
# $Id: //modules/pil/PIL/WmfImagePlugin.py#4 $
#
# WMF support for PIL
#
# history:
# 96-12-14 fl Created
#
# notes:
# This code currently supports placable metafiles only, and
# just a few graphics operations are implemented.
#
# Copyr... | fxia22/ASM_xf | PythonD/lib/python2.4/site-packages/display/PIL/WmfImagePlugin.py | Python | gpl-2.0 | 7,556 |
# Copyright (c) 2013, Intel Corporation.
#
# SPDX-License-Identifier: GPL-2.0-only
#
# DESCRIPTION
# This module implements some basic help invocation functions along
# with the bulk of the help topic text for the OE Core Image Tools.
#
# AUTHORS
# Tom Zanussi <tom.zanussi (at] linux.intel.com>
#
import subprocess
imp... | schleichdi2/OPENNFR-6.3-CORE | opennfr-openembedded-core/scripts/lib/wic/help.py | Python | gpl-2.0 | 40,562 |
__author__ = 'Giacomo Tanganelli'
| kuggenhoffen/CoAPthon | httpcoapforwardproxy.py | Python | mit | 34 |
# coding: utf8
{
'"update" is an optional expression like "field1=\'newvalue\'". You cannot update or delete the results of a JOIN': '"Uaktualnij" jest dodatkowym wyra\xc5\xbceniem postaci "pole1=\'nowawarto\xc5\x9b\xc4\x87\'". Nie mo\xc5\xbcesz uaktualni\xc4\x87 lub usun\xc4\x85\xc4\x87 wynik\xc3\xb3w z JOIN:',
'%Y-%m... | montaggroup/montag-token-redeemer | web2py/applications/token_redeemer/languages/pl-pl.py | Python | gpl-3.0 | 3,788 |
"""
Simple wrapper around elasticsearch-py to index/search a django Model.
"""
| leotsem/django-elasticsearch | django_elasticsearch/__init__.py | Python | mit | 79 |
# oracle.py
# Copyright (C) 2005, 2006, 2007 Michael Bayer mike_mp@zzzcomputing.com
#
# This module is part of SQLAlchemy and is released under
# the MIT License: http://www.opensource.org/licenses/mit-license.php
import re, warnings, random
from sqlalchemy import util, sql, schema, exceptions, logging
from sqlalche... | santisiri/popego | envs/ALPHA-POPEGO/lib/python2.5/site-packages/SQLAlchemy-0.4.0-py2.5.egg/sqlalchemy/databases/oracle.py | Python | bsd-3-clause | 28,221 |
# -*- coding:utf-8 -*-
# Created by Hans-Thomas on 2011-05-29.
#=============================================================================
# extra_matchers.py --- Should-DSL extra matchers
#=============================================================================
from six.moves import zip_longest
from should_... | htmue/python-wishes | vows/extra_matchers.py | Python | unlicense | 1,246 |
#Given an integer n, return the number of trailing zeroes in n!.
class Solution(object):
def trailingZeroes(self, n):
fives = 0
while n > 0:
fives += n / 5
n = n / 5
return fives | SakiFu/leetcode | python/factorial_trailing_zeroes.py | Python | mit | 232 |
# -*- encoding: utf-8 -*-
###########################################################################
# Module Writen to OpenERP, Open Source Management Solution
#
# Copyright (c) 2012 Vauxoo - http://www.vauxoo.com/
# All Rights Reserved.
# info Vauxoo (info@vauxoo.com)
####################################... | lertech/extra-addons | purchase_supplier/__openerp__.py | Python | gpl-3.0 | 1,813 |
# This will contain all items that are obtainable by players in the game
# Armor Types, Skill to use, and armor class
armortypes = {'Padded Cloth': ('light armor', 10),
'Leather Armor': ('light armor', 12),
'Chain Mail': ('medium armor', 13),
'Half Plate Armor': ('medium armor... | ebeaber/RPG-The-Game | game_files/items.py | Python | gpl-3.0 | 824 |
#!/usr/bin/env python
'''
tables for STM32L476RG
'''
# additional build information for ChibiOS
build = {
"CHIBIOS_STARTUP_MK" : "os/common/startup/ARMCMx/compilers/GCC/mk/startup_stm32l4xx.mk",
"CHIBIOS_PLATFORM_MK" : "os/hal/ports/STM32/STM32L4xx/platform.mk"
}
pincount = {
'A': 16,
'B': 16,
... | diydrones/ardupilot | libraries/AP_HAL_ChibiOS/hwdef/scripts/STM32L476xx.py | Python | gpl-3.0 | 13,731 |
# -*- encoding: utf-8 -*-
from abjad import *
def test_selectiontools_LogicalTie_leaves_01():
staff = Staff("c' ~ c'16")
assert inspect_(staff[0]).get_logical_tie().leaves == tuple(staff[:])
def test_selectiontools_LogicalTie_leaves_02():
staff = Staff("c'")
assert inspect_(staff[0]).get_logical... | mscuthbert/abjad | abjad/tools/selectiontools/test/test_selectiontools_LogicalTie_leaves.py | Python | gpl-3.0 | 349 |
list1 = ["Jan", "I am the best", "Mar", "Apr", "May", "June", "July", "August", "Sep", "Oct", "Nov", "Dec"]
months = ["Jan", "Feb", "Mar", "Apr", "May", "June", "July", "August", "Sep", "Oct", "Nov", "Dec"]
a = int(input("Enter the year: "))
if a % 4 == 0:
for x in list1:
print(x)
else:
for y in months:... | samas-tech/Python-calculator | question6.py | Python | gpl-3.0 | 351 |
import os.path as op
import scipy.optimize as so
import numpy as np
import h5py
from nipype.utils.filemanip import split_filename
from scipy.spatial.distance import cdist
def write_search_points(locations, geo_file):
print('Writing search point .geo file to {f}'.format(f=geo_file))
f = open(geo_file, "w")
... | CyclotronResearchCentre/forward | forward/search.py | Python | gpl-2.0 | 3,531 |
"""Tests that our control algorithms find same policy on test problems."""
import itertools
from typing import Callable
import numpy as np
from absl.testing import absltest
from absl.testing import parameterized
from differential_value_iteration.algorithms import dvi
from differential_value_iteration.algorithms import... | abhisheknaik96/differential-value-iteration | src/differential_value_iteration/algorithms/policy_test.py | Python | mit | 7,233 |
########################################################################
#
# (C) 2015, Brian Coca <bcoca@ansible.com>
#
# This file is part of Ansible
#
# Ansible 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... | jnerin/ansible | lib/ansible/galaxy/role.py | Python | gpl-3.0 | 15,222 |
#!/usr/bin/env python
WEBSERVER_PORT = 8001
WEBSERVER_ROOT = './fixtures/legacy-benchmarks/'
WEBSERVER_URL = 'http://localhost:%s' % WEBSERVER_PORT
import unittest
from harness.environment import WebServer
from harness.artemis import execute_artemis
def events_configuration_report(uuid, url, exclude):
report =... | cs-au-dk/Artemis | artemis-code/tests/system/benchmarks.py | Python | gpl-3.0 | 12,831 |
# Copyright 2015 The TensorFlow Authors. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applica... | jwlawson/tensorflow | tensorflow/python/layers/base.py | Python | apache-2.0 | 59,631 |
# coding=utf-8
"""Request handler for series and episodes."""
from __future__ import unicode_literals
import logging
from medusa.helper.exceptions import EpisodeDeletedException
from medusa.logger.adapters.style import BraceAdapter
from medusa.server.api.v2.base import (
BaseRequestHandler,
BooleanField,
... | pymedusa/SickRage | medusa/server/api/v2/episodes.py | Python | gpl-3.0 | 6,368 |
"""
hill_cipher.py
@author Elliot and Erica
"""
import random
import numpy as np
from cryptography_utilities import (gcd, extended_gcd)
ALPHABET = 'abcdefghijklmnopqrstuvwxyz'
ALPHABET_SIZE = len(ALPHABET)
N = 3
TOTIENT_26 = 12
def random_matrix(size=N):
"""Generate a NxN matrix filled with random integers"""
... | ElliotPenson/cryptography | hill_cipher.py | Python | mit | 3,152 |
# coding: utf-8
from __future__ import unicode_literals
import datetime
import re
import time
import base64
from .common import InfoExtractor
from ..compat import (
compat_urllib_parse,
compat_ord,
)
from ..utils import (
determine_ext,
ExtractorError,
parse_iso8601,
sanitized_Request,
int... | dyn888/youtube-dl | youtube_dl/extractor/letv.py | Python | unlicense | 11,107 |
#!/usr/bin/env python
# Copyright (c) PLUMgrid, Inc.
# Licensed under the Apache License, Version 2.0 (the "License")
# run in project examples directory with:
# sudo ./total_clone_per_second.py"
from bcc import BPF
from time import sleep
# bpf program in restricted C language.
prog = """
BPF_TABLE("array", u32, u32... | zaafar/ebpf_turtle | bpf_demo/total_clone_per_second.py | Python | apache-2.0 | 841 |
# coding=utf-8
# Copyright 2015 Pants project contributors (see CONTRIBUTORS.md).
# Licensed under the Apache License, Version 2.0 (see LICENSE).
from __future__ import absolute_import, division, print_function, unicode_literals
import sys
import tokenize
from builtins import range
from collections import defaultdict... | foursquare/pants | contrib/python/src/python/pants/contrib/python/checks/tasks/checkstyle/trailing_whitespace.py | Python | apache-2.0 | 2,252 |
from django.db import models
class DeveloperInfo(models.Model):
name = models.CharField(max_length=100, blank=True)
city = models.CharField(max_length=50, blank=True)
| teamjomigi/django-backend | src/api/v1/hackatrain/models.py | Python | gpl-3.0 | 177 |
import sys
from html import unescape
from pathlib import Path
import pytest
@pytest.fixture
def compile_template(scratch_env):
def compile_template(source, name="tmpl.html"):
Path(scratch_env.root_path, "templates", name).write_text(
source, encoding="utf-8"
)
return scratch_e... | lektor/lektor | tests/test_environment.py | Python | bsd-3-clause | 1,211 |
"""
set some general constants in CGI units
"""
import numpy as np
import scipy.constants as sc
pi = np.pi; # noqa - PI
k_b = sc.k*1e7; # noqa - Boltzmann constant in erg/K
m_p = sc.proton_mass*1e3; # noqa - proton mass in g
Grav = sc.G*1e3; ... | birnstiel/two-pop-py | twopoppy/const.py | Python | gpl-3.0 | 819 |
# -*- coding: utf-8 -*-
"""Public section, including homepage and signup."""
from flask import Blueprint, flash, redirect, render_template, request, url_for
from flask_login import login_required, login_user, logout_user
from haha.extensions import login_manager
from haha.public.forms import LoginForm
from haha.user.f... | starduliang/haha | haha/public/views.py | Python | bsd-3-clause | 1,978 |
#!/usr/bin/python
# -*- coding: utf-8 -*-
"""
=========================================================
Logistic Regression 3-class Classifier
=========================================================
Show below is a logistic-regression classifiers decision boundaries on the
`iris <http://en.wikipedia.org/wiki/Iris_fl... | jmargeta/scikit-learn | examples/linear_model/plot_iris_logistic.py | Python | bsd-3-clause | 1,647 |
# -*- coding: utf-8 -*-
# ***************************************************************************
# * Copyright (c) 2014 Yorik van Havre <yorik@uncreated.net> *
# * *
# * This program is free software; you can redistribute it a... | sanguinariojoe/FreeCAD | src/Mod/Path/PathScripts/PathHop.py | Python | lgpl-2.1 | 5,422 |
# -*- coding: utf-8 -*-
#
# This file is part of Invenio.
# Copyright (C) 2015-2018 CERN.
# Copyright (C) 2022 RERO.
#
# Invenio is free software; you can redistribute it and/or modify it
# under the terms of the MIT License; see LICENSE file for more details.
"""Invenio-Admin Flask extension."""
from __future__ impo... | inveniosoftware/invenio-admin | invenio_admin/ext.py | Python | mit | 6,287 |
#!/usr/bin/python
#
# Copyright (C) 2016 sssd-qe contributors.
#
from setuptools import setup
REQUIRES = [
'paramiko',
'PyYAML',
'python-ldap',
'pytest_multihost',
'pytest']
with open('README.rst', 'r') as f:
README = f.read()
setup_args = dict(
name='sssd.testlib',
version='0.1-11',
... | npmccallum/sssd | src/tests/python/setup.py | Python | gpl-3.0 | 871 |
# This file is part of EventGhost.
# Copyright (C) 2005 Lars-Peter Voss <bitmonster@eventghost.org>
#
# EventGhost 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
# (a... | garbear/EventGhost | eg/Classes/PluginItem.py | Python | gpl-2.0 | 6,747 |
from django.test import TestCase
from django.conf import settings
from restclients.dao import *
import re
class SWSTestFileDAO(TestCase):
def test_dao_response(self):
with self.settings(RESTCLIENTS_SWS_DAO_CLASS='restclients.dao_implementation.sws.File'):
dao = SWS_DAO()
response = ... | UWIT-IAM/uw-restclients | restclients/test/sws/file_implementation/dao.py | Python | apache-2.0 | 845 |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
# Script to search vcf files for mutations within specific coordinates
# Input:
# -A vcf file
#
# Output:
# -A Roary-like file with mutations sorted in rows, strains as columns and presence/absence in cells
# -Columns: Chromosome, Position, variant (eg C->T), type (eg mis... | AdmiralenOla/Scoary | scoary/vcf2scoary.py | Python | gpl-3.0 | 8,390 |
# Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance with the License. You may obtain
# a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under t... | ging/python-keystoneclient | keystoneclient/tests/unit/auth/test_password.py | Python | apache-2.0 | 2,262 |
from __future__ import print_function
from nltk import pos_tag, word_tokenize
import textblob, json
text = []
usda = {}
with open('USDA-food-db/usda-reduced.json') as f:
for line in f:
ingredient = json.loads(line)
usda[ingredient["name"]["long"]] = ingredient
translation = {}
print("Getting text")
for ingredient... | moiri-gamboni/diet | recipe-parser/usda_nouns.py | Python | gpl-3.0 | 1,840 |
# Copyright (c) 2014 OpenStack Foundation.
#
# Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance with the License. You may obtain
# a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed ... | eayunstack/neutron | neutron/hacking/checks.py | Python | apache-2.0 | 9,976 |
import pytest
import os
import numpy as np
from threeML.plugins.XYLike import XYLike
from threeML import Model, DataList, JointLikelihood, PointSource
from threeML import BayesianAnalysis, Uniform_prior, Log_uniform_prior
from threeML.analysis_results import MLEResults, load_analysis_results, AnalysisResultsSet
from a... | volodymyrss/3ML | threeML/test/test_analysis_results.py | Python | bsd-3-clause | 6,185 |
"""
Gaussian quadrature utilities for use with the Python Active-subspaces Utility
Library.
"""
import numpy as np
import misc as mi
def r_hermite(N):
"""Recurrence coefficients for the Hermite orthogonal polynomials.
Parameters
----------
N : int
the number of recurrence coefficients
R... | paulcon/active_subspaces | active_subspaces/utils/quadrature.py | Python | mit | 7,875 |
# encoding: utf-8
# module PyKDE4.kdeui
# from /usr/lib/python3/dist-packages/PyKDE4/kdeui.cpython-34m-x86_64-linux-gnu.so
# by generator 1.135
# no doc
# imports
import PyKDE4.kdecore as __PyKDE4_kdecore
import PyQt4.QtCore as __PyQt4_QtCore
import PyQt4.QtGui as __PyQt4_QtGui
import PyQt4.QtSvg as __PyQt4_QtSvg
cl... | ProfessorX/Config | .PyCharm30/system/python_stubs/-1247971765/PyKDE4/kdeui/KSeparator.py | Python | gpl-2.0 | 621 |
import datetime
from flask import request
from flask.ext.restful import reqparse, fields, marshal
import cred.config
from cred.exceptions import ClientNotFound
from cred.common import util
from cred.models.client import Client as ClientModel
full_client_fields = {
'id': fields.Integer,
'device': fields.String... | Tehnix/cred-server | cred/resources/clients.py | Python | bsd-3-clause | 2,387 |
import logging
import redis
from django.conf import settings
from django.contrib.auth import authenticate, login, logout
from django.contrib.auth.decorators import login_required
from django.contrib.auth.mixins import LoginRequiredMixin
from django.contrib.auth.views import PasswordChangeView
from django.http import H... | hoelsner/product-database | django_project/views.py | Python | mit | 7,479 |
# -*- coding: utf-8 -*-
# Part of Odoo. See LICENSE file for full copyright and licensing details.
{
'name': 'IBAN Bank Accounts',
'version': '1.0',
'category': 'Hidden/Dependency',
'description': """
This module installs the base for IBAN (International Bank Account Number) bank accounts and checks for... | minhphung171093/GreenERP | openerp/addons/base_iban/__openerp__.py | Python | gpl-3.0 | 702 |
# -*- coding: utf-8 -*-
import argparse
import io
import datetime
import logging
import os
import manage
import mock
import time
os.environ['SECUREDROP_ENV'] = 'test' # noqa
from models import Journalist, db
from .utils import db_helper
YUBIKEY_HOTP = ['cb a0 5f ad 41 a2 ff 4e eb 53 56 3a 1b f7 23 2e ce fc dc',
... | ehartsuyker/securedrop | securedrop/tests/test_manage.py | Python | agpl-3.0 | 8,503 |
# -*- coding: utf-8 -*-
#
# codimension - graphics python two-way code editor and analyzer
# Copyright (C) 2010-2017 Sergey Satskiy <sergey.satskiy@gmail.com>
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Softw... | SergeySatskiy/codimension | codimension/ui/mainstatusbar.py | Python | gpl-3.0 | 7,924 |
# -*- coding: utf-8 -*-
# Authors: Natalia B Bidart <natalia.bidart@canonical.com>
#
# Copyright 2010 Canonical Ltd.
#
# This program is free software: you can redistribute it and/or modify it
# under the terms of the GNU General Public License version 3, as published
# by the Free Software Foundation.
#
# This progra... | Alberto-Beralix/Beralix | i386-squashfs-root/usr/share/pyshared/ubuntuone-control-panel/ubuntuone/controlpanel/gui/gtk/__init__.py | Python | gpl-3.0 | 1,007 |
#!/usr/bin/python
# -*- coding: utf-8 -*-
"""
Role
====
Defines the basic interfaces for a plugin. These interfaces are
inherited by the *core* class of a plugin. The *core* class of a
plugin is then the one that will be notified the
activation/deactivation of a plugin via the ``activate/deactivate``
methods.
For ... | cgroza/gEcrit | yapsy/IPlugin.py | Python | gpl-3.0 | 1,190 |
#!/usr/bin/env python
# -*- coding: UTF-8 -*-
"""
Copyright © 2011: Lattyware <gareth@lattyware.co.uk>
This file is part of unrest.
unrest 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... | Lattyware/unrest | entities.py | Python | gpl-3.0 | 15,667 |
'''
test adapted from https://wiki.fysik.dtu.dk/ase/tutorials/neb/idpp.html#example-1-ethane
'''
from __future__ import print_function
from espresso import iEspresso, NEBEspresso
from ase.build import molecule
from ase.neb import NEBTools
from ase.optimize.fire import FIRE as QuasiNewton
from asetools import smart_c... | lmmentel/ase-espresso | tests/test_nebespresso.py | Python | gpl-3.0 | 1,396 |
#! /usr/bin/env python
# -*- coding: utf-8 -*-
#
# FollowMe Butia - FollowMe
# Copyright (C) 2010-2013
# This program was created to use with the robot Butia.
# Butia is a project from Facultad de Ingenieria - Uruguay
# Facultad de Ingenieria web site: <http://www.fing.edu.uy/>
# Butia project web site: <http://www.fin... | AlanJAS/followme | followme.py | Python | gpl-3.0 | 7,788 |
# Copyright 2011-2019 Camptocamp SA
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl).
from odoo import fields, models
# make pytest happy
# in pytest context module dependencies are not loaded
# thus geo fields are unknown
from odoo.addons import base_geoengine # noqa
class DummyAbstractModel(models.... | OCA/geospatial | test_base_geoengine/models.py | Python | agpl-3.0 | 1,137 |
#
# @BEGIN LICENSE
#
# Psi4: an open-source quantum chemistry software package
#
# Copyright (c) 2007-2021 The Psi4 Developers.
#
# The copyrights for code used from other parties are included in
# the corresponding files.
#
# This file is part of Psi4.
#
# Psi4 is free software; you can redistribute it and/or modify
#... | jturney/psi4 | psi4/extras.py | Python | lgpl-3.0 | 6,830 |
# -*- coding: utf-8 -*-
#
# Copyright 2018 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
#
# https://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law... | dhermes/google-cloud-python | vision/google/cloud/vision_v1p1beta1/gapic/image_annotator_client.py | Python | apache-2.0 | 9,918 |
import sys
import argparse
from twilight.lib import tweets
import logging
logger = logging.getLogger(__name__)
def main(parser):
'''
Search TTV2 lines for matches within a certain bounding box
'''
parser.add_argument('north', type=float)
parser.add_argument('east', type=float)
parser.add_argu... | chbrown/tweetjobs | tweetjobs/cli/bbox.py | Python | mit | 1,095 |
# -*- coding: UTF-8 -*-
"""Hash-related checking functions and argument types.
"""
import re
__all__ = __features__ = []
# hash check functions
__all__ += ["is_hash", "is_md5", "is_sha1", "is_sha224", "is_sha256",
"is_sha384", "is_sha512"]
is_hash = lambda h: any(__check_hash(h, a, False) is not None... | dhondta/tinyscript | tinyscript/helpers/data/types/hash.py | Python | agpl-3.0 | 1,678 |
#takes in an eQTL file and outputs allele freq and deviation from HWE
#0 1 2 3 4 5 6 7 8 9 10 11 12 13 14
#scaf pac locus freq fold effect dom d_over_a f p hom1 het hom2 Rsquared f(hom1/het/hom2)
#scaf8 20911662 9414108 0.80... | emjosephs/eQTL | calc_HW_deviations.py | Python | mit | 1,527 |
import random
class Customer:
wallet = 1000
bought = False
def see(self,prev_customer):
if prev_customer is not None:
return prev_customer.bought
else:
return False
def decide(self,price,prev_customer):
if self.see(prev_customer):
self.wtp ... | omsktransmash/ScientificPythonTutorial | jamaica/purchase_oop.py | Python | apache-2.0 | 841 |
__author__ = 'alexei'
from util import *
import gensim
import datagen
import math
from gensim import corpora, models, similarities
import operator
# from sent2vec.word2vec import Sent2Vec
def train_paragraph_vectors():
p = Parser()
set = build_dataset(p, "labeled", inject=True)
print set[:2]
ex... | johnthebrave/sentiment-mining | src/old_scrips/main.py | Python | gpl-2.0 | 15,630 |
import unittest
from test.support import (verbose, refcount_test, run_unittest,
strip_python_stderr)
import sys
import time
import gc
import weakref
try:
import threading
except ImportError:
threading = None
### Support code
#########################################################... | firmlyjin/brython | www/tests/unittests/test/test_gc.py | Python | bsd-3-clause | 29,494 |
## pygame - Python Game Library
## Copyright (C) 2000-2003 Pete Shinners
##
## This library is free software; you can redistribute it and/or
## modify it under the terms of the GNU Library General Public
## License as published by the Free Software Foundation; either
## version 2 of the License, or (... | Daksh/Colors | pygame/sysfont.py | Python | gpl-3.0 | 9,569 |
# coding=utf-8
"""
InaSAFE Disaster risk assessment tool by AusAid -**InaSAFE Wizard**
This module provides: Function Centric Wizard Step: Exposure Layer From Canvas
Contact : ole.moller.nielsen@gmail.com
.. note:: This program is free software; you can redistribute it and/or modify
it under the terms of the GN... | Samweli/inasafe | safe/gui/tools/wizard/step_fc35_explayer_from_canvas.py | Python | gpl-3.0 | 5,476 |
# -*- coding: utf-8 -*-
from __future__ import absolute_import, print_function
import os
from webassets.filter import Filter
import dukpy
__all__ = ('BabelJSX', )
class BabelJSX(Filter):
name = 'babeljsx'
max_debug_level = None
options = {
'loader': 'BABEL_MODULES_LOADER'
}
def input... | amol-/dukpy | dukpy/webassets/jsxfilter.py | Python | mit | 700 |
from jobrunner.cli.show import show
from tests.testcase import TestCase
class TestShow(TestCase):
def setUp(self):
self.parse_show_arguments = self.set_up_patch(
'jobrunner.cli.show.parse_show_arguments'
)
self.show_logbook = self.set_up_patch(
'jobrunner.cli.show.s... | vdloo/jobrunner | tests/unit/jobrunner/cli/show/test_show.py | Python | apache-2.0 | 576 |
# -*- coding: utf-8 -*-
# Generated by Django 1.10.2 on 2016-10-26 00:05
from __future__ import unicode_literals
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('registration', '0002_auto_20161025_0712'),
]
operations = [
migrations.Alte... | hamasho/endojo | apps/registration/migrations/0003_auto_20161026_0005.py | Python | gpl-3.0 | 671 |
from sys import argv
import os
from glob import glob
from ppci.api import asm, cc, link, objcopy, get_arch
from ppci.binutils.objectfile import merge_memories
from ppci.lang.c import COptions
from ppci.utils.reporting import HtmlReportGenerator
def get_sources(folder, extension):
resfiles = []
resdirs = []
... | windelbouwman/ppci-mirror | examples/riscvpicorv32/mkfwdbgc.py | Python | bsd-2-clause | 1,833 |
from ethereum import abi
import time
import os
import json
from ethereum.utils import encode_hex, str_to_bytes
FILL = 1
VERIFY = 2
TIME = 3
fixture_path = os.path.join(os.path.dirname(__file__), '../..', 'fixtures')
fill_abi_test = lambda params: run_abi_test(params, FILL)
check_abi_test = lambda params: run_abi_tes... | nirenzang/Serpent-Pyethereum-Tutorial | pyethereum/ethereum/tools/testutils.py | Python | gpl-3.0 | 2,645 |
#*-* coding:UTF-8*-*
"""
Este trasto actúa como relé, reenvía los datos de los sensores al servdiro de test.
"""
"""
El tema que recibe los datos (ya sea serie o cualquier otra cosa)
- Este se puede quedar dormido o algo leyendo de un fichero o algo así
El tema que procesa esos datos y los envia al server
... | OpenComunCas/PWS | arduino/testserver/relay/relay.py | Python | gpl-3.0 | 3,299 |
"""
Utilities for Caltech BE/Bi 103.
Author: Justin Bois
"""
import collections
import random
import warnings
import numbers
import matplotlib.path as path
import numpy as np
import pandas as pd
import scipy.odr
import scipy.stats as st
import statsmodels.tools.numdiff as smnd
import skimage.io
import skimage.measu... | justinbois/bebi103_utils | legacy/bebi103.py | Python | mit | 61,231 |
import numpy, numpy, os, csv, logging
from math import log
from sklearn.metrics import f1_score
from sklearn.metrics import precision_score
path = os.path.dirname(__file__)
def precision(expected, found):
tp = 0 # true positives
fp = 0 # false positives
for doc in found:
if doc in expecte... | leniel/InformationSearchRetrieval | Exercise 2/modules/results_comparer.py | Python | mit | 7,121 |
#!/usr/bin/env python
import os
import sys
if __name__ == "__main__":
os.environ.setdefault("DJANGO_SETTINGS_MODULE", "pk15.settings")
from django.core.management import execute_from_command_line
execute_from_command_line(sys.argv)
| rolandgeider/pk15-orakel | manage.py | Python | agpl-3.0 | 247 |
import amo
import amo.tests
import waffle
from users.models import UserProfile
from mkt.purchase.utils import payments_enabled
from mkt.site.fixtures import fixture
from test_utils import RequestFactory
class TestUtils(amo.tests.TestCase):
fixtures = fixture('user_2519')
def setUp(self):
self.req... | Joergen/zamboni | mkt/purchase/tests/test_utils_.py | Python | bsd-3-clause | 983 |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
"This is some interesting educational program"
# wxRays (C) 2012 Serhii Lysovenko
#
# 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... | Lysovenko/wxRays | settings.py | Python | gpl-3.0 | 3,701 |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
"""
**ui_constants.py**
**Platform:**
Windows, Linux, Mac Os X.
**Description:**
Defines **sIBL_GUI** package ui constants through the :class:`UiConstants` class.
**Others:**
"""
from __future__ import unicode_literals
__author__ = "Thomas Mansencal"
__copyri... | KelSolaar/sIBL_GUI | sibl_gui/globals/ui_constants.py | Python | gpl-3.0 | 9,825 |
from DIRAC import S_OK, S_ERROR, gConfig
from DIRAC.ConfigurationSystem.Client.PathFinder import getAgentSection
from DIRAC.Core.Utilities.CFG import CFG
from DIRAC.Core.Utilities import List
from DIRAC.ConfigurationSystem.Client.Helpers.Operations import Operations
from DIRAC.Core.Utilities.JDL import loadJDLAsCFG, d... | miloszz/DIRAC | WorkloadManagementSystem/Client/JobState/JobManifest.py | Python | gpl-3.0 | 9,078 |
# -*- coding: utf-8 -*-
"""
The rrule module offers a small, complete, and very fast, implementation of
the recurrence rules documented in the
`iCalendar RFC <https://tools.ietf.org/html/rfc5545>`_,
including support for caching of results.
"""
import itertools
import datetime
import calendar
import re
import sys
try:... | ledtvavs/repository.ledtv | script.tvguide.Vader/resources/lib/dateutil/rrule.py | Python | gpl-3.0 | 64,642 |
#!/usr/bin/env python
'''@package docstring
Just a giant list of processes and properties
'''
processes = {
'TTbarDMJets_pseudoscalar_Mchi-1_Mphi-100_TuneCUETP8M1_13TeV-madgraphMLM-pythia8':('TTbarDM','MC',1),
'thq':('thq','MC',0.7927),
'thw':('thw','MC',0.147),
'GluGlu_HToInvisible_M125_13TeV_powheg... | sidnarayanan/PandaCore | Tools/python/processes/BSM.py | Python | mit | 27,294 |
#!/usr/bin/env blender
import sys
import os
import bpy
import addon_utils
def _main(args):
default, state = addon_utils.check("io_EDM")
if not state:
import io_EDM
io_EDM.register()
try:
myArgumentIndex = next(i for i, v in enumerate(sys.argv) if v == "--")
args = args[myArgumentIndex+1:]
... | ndevenish/Blender_ioEDM | utils/write.py | Python | mit | 564 |
#!/usr/bin/env python3
import collections
import pathlib
root = pathlib.Path('../SWMH-BETA/SWMH')
globs = [
'common/**/*.*',
'events/*.*',
'history/**/*.*',
'interface/*.gui',
'localisation/*.*',
'map/*.csv',
'map/*.map',
'map/*.txt'
]
charlocs = collections.defaultdict(list)
for glo... | zijistark/ck2utils | esc/old/cp1252test.py | Python | gpl-2.0 | 743 |
'''
<Run reachability test on Internet2>
Copyright 2012, Stanford University. This file is licensed under GPL v2 plus
a special exception, as described in included LICENSE_EXCEPTION.txt.
Created on Mar 11, 2012
@author: James Hongyi Zeng
'''
from examples.load_internet2_backbone import *
from config_pars... | Br1an6/ACS_Netplumber_Implementation | hsa-python/net_plumbing/examples/i2/run_reachability_internet2_bb.py | Python | gpl-2.0 | 4,737 |
# Copyright (c) 2013 Intel, Inc.
# Copyright (c) 2013 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/li... | HybridF5/jacket | jacket/compute/pci/manager.py | Python | apache-2.0 | 12,313 |
from collections import Counter
from micall.utils.translation import translate, ambig_dict
AMINO_ALPHABET = 'ACDEFGHIKLMNPQRSTVWY*'
MAX_CUTOFF = 'MAX'
FIRST_CUTOFF = 'FIRST'
class SeedAmino(object):
"""
Records the frequencies of amino acids at a given position of the
aligned reads as determined by the ... | cfe-lab/MiCall | micall/utils/report_amino.py | Python | agpl-3.0 | 10,418 |
#!/usr/bin/python -tt
# An incredibly simple agent. All we do is find the closest enemy tank, drive
# towards it, and shoot. Note that if friendly fire is allowed, you will very
# often kill your own tanks with this code.
#################################################################
# NOTE TO STUDENTS
# This is... | adamjchristiansen/CS470 | bzagents/other_pigeons/wild_pigeon.py | Python | gpl-3.0 | 2,746 |
from functools import reduce as ft_reduce
from .errors import CraftAiError
from .formatters import format_decision_rules
from .operators import OPERATORS
def _is_is_reducer(rule_1, rule_2):
if rule_1["operand"] and (rule_1["operand"] != rule_2["operand"]):
raise CraftAiError(
"Operator '{}' c... | craft-ai/craft-ai-client-python | craft_ai/reducer.py | Python | bsd-3-clause | 8,085 |
#coding: utf-8
from scapy.all import *
class WILDCARD:
""" Used to indicate that some fields in a scapy packet should be ignored when comparing """
pass
class NO_PKT:
""" Indicate that a sent packet should have no reply """
pass
def pkt_match(expected, actual):
""" Check if all fields described i... | Zashas/segway | structs.py | Python | gpl-3.0 | 5,933 |
"""
This script allows to plot two curves, using data stored in an SQLite
database. Each curve is percentage correct as function of time since last change point.
"""
import dataset
import matplotlib.pyplot as plt
def plot_clicks_perfs(low_rate, high_rate, data, fignum):
"""
Generate two curves (one per parame... | aernesto/change-rate-inference | ClickTask/Python/Performances/plot_2perfs_clicks.py | Python | mit | 3,716 |
"""This module provides datastructures and algorithms for scaling."""
from __future__ import annotations
| dials/dials | algorithms/scaling/__init__.py | Python | bsd-3-clause | 106 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.