text stringlengths 6 947k | repo_name stringlengths 5 100 | path stringlengths 4 231 | language stringclasses 1
value | license stringclasses 15
values | size int64 6 947k | score float64 0 0.34 |
|---|---|---|---|---|---|---|
from kubeflow.kubeflow.crud_backend import api, status
def pvc_status(pvc):
"""
Set the status of the pvc
"""
if pvc.metadata.deletion_timestamp is not None:
return status.create_status(status.STATUS_PHASE.TERMINATING,
"Deleting Volume...")
if pvc.statu... | kubeflow/kubeflow | components/crud-web-apps/volumes/backend/apps/common/status.py | Python | apache-2.0 | 2,168 | 0 |
"""
"""
################################################################################
##### Command Line Interface ###################################################
################################################################################
from argparse import ArgumentParser, ArgumentDefaultsHelpFormatter... | SwankSwashbucklers/bottle-builder | bottle-builder.py | Python | mit | 18,381 | 0.013111 |
"""Model. We are modeling Person objects with a collection
of Address objects. Each Address has a PostalCode, which
in turn references a City and then a Country:
Person --(1..n)--> Address
Address --(has a)--> PostalCode
PostalCode --(has a)--> City
City --(has a)--> Country
"""
from sqlalchemy import Column, Int... | simplegeo/sqlalchemy | examples/beaker_caching/model.py | Python | mit | 3,110 | 0.006752 |
from __future__ import print_function, division
import decimal
import math
import re as regex
import sys
from collections import defaultdict
from .core import C
from .sympify import converter, sympify, _sympify, SympifyError
from .singleton import S, Singleton
from .expr import Expr, AtomicExpr
from .decorators impor... | kmacinnis/sympy | sympy/core/numbers.py | Python | bsd-3-clause | 81,489 | 0.000577 |
from django.core import serializers
from rest_framework.response import Response
from django.http import JsonResponse
try:
from urllib import quote_plus # python 2
except:
pass
try:
from urllib.parse import quote_plus # python 3
except:
pass
from django.contrib import messages
from django.contrib.co... | our-iot-project-org/pingow-web-service | src/posts/views.py | Python | mit | 5,217 | 0.000767 |
import eventlet
import gettext
import sys
from staccato.common import config
import staccato.openstack.common.wsgi as os_wsgi
import staccato.openstack.common.pastedeploy as os_pastedeploy
# Monkey patch socket and time
eventlet.patcher.monkey_patch(all=False, socket=True, time=True)
gettext.install('staccato', unic... | buzztroll/staccato | staccato/cmd/api.py | Python | apache-2.0 | 899 | 0.001112 |
"""Utility methods for handling Entities.
These methods can be shared between entity generation (invoked through
the Entities class) at the start of prod data generation, and between
post processing methods (such as adding edges between family members
and neighbours).
"""
import codecs
import collections
import re
... | verejnedigital/verejne.digital | data/prod_generation/entity_tools.py | Python | apache-2.0 | 3,557 | 0.000562 |
"""PyDbLite.py adapted for MySQL backend
Differences with PyDbLite:
- pass the connection to the MySQL db as argument to Base()
- in create(), field definitions must specify a type
- no index
- the Base() instance has a cursor attribute, so that SQL requests
can be executed :
db.cursor.execute(an_sql_req... | leleobhz/scripts | python/chat_back_machine/engine/PyDbLite/MySQL.py | Python | gpl-2.0 | 11,904 | 0.015793 |
# Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance with the License. You may obtain
# a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# d... | Accelerite/cinder | cinder/tests/targets/test_tgt_driver.py | Python | apache-2.0 | 11,627 | 0.000172 |
# 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 a... | michellemorales/OpenMM | models/lfads/utils.py | Python | gpl-2.0 | 12,183 | 0.010671 |
import pyaf.Bench.TS_datasets as tsds
import tests.artificial.process_artificial_dataset as art
art.process_dataset(N = 1024 , FREQ = 'D', seed = 0, trendtype = "PolyTrend", cycle_length = 0, transform = "Anscombe", sigma = 0.0, exog_count = 20, ar_order = 12); | antoinecarme/pyaf | tests/artificial/transf_Anscombe/trend_PolyTrend/cycle_0/ar_12/test_artificial_1024_Anscombe_PolyTrend_0_12_20.py | Python | bsd-3-clause | 265 | 0.086792 |
from sympy.external import import_module
from sympy.utilities.pytest import warns
# fixes issue that arose in addressing issue 6533
def test_no_stdlib_collections():
'''
make sure we get the right collections when it is not part of a
larger list
'''
import collections
matplotlib = import_module... | kaushik94/sympy | sympy/external/tests/test_importtools.py | Python | bsd-3-clause | 1,405 | 0.004982 |
# coding: utf-8
"""
Server API
Reference for Server API (REST/Json)
OpenAPI spec version: 2.0.6
Generated by: https://github.com/swagger-api/swagger-codegen.git
"""
from pprint import pformat
from six import iteritems
import re
class PrepaymentBonusResponse(object):
"""
NOTE: This cl... | kinow-io/kinow-python-sdk | kinow_client/models/prepayment_bonus_response.py | Python | apache-2.0 | 7,163 | 0.000419 |
import pygame
from pygame.locals import *
import random
import itertools
import state
import block
import tetros
import states
from text import Text
from colors import Colors
from engine import Engine
from playfield import Playfield
from countdown import Countdown
class GameState(state.State):
tetro_classes = ... | viswimmer1/PythonGenerator | data/python_files/31890725/gamestate.py | Python | gpl-2.0 | 5,483 | 0.001094 |
# -*- coding: utf-8 -*-
from __future__ import absolute_import
import unittest
from .estestcase import ESTestCase
from pyes.facets import DateHistogramFacet
from pyes.filters import TermFilter, RangeFilter
from pyes.query import FilteredQuery, MatchAllQuery, Search
from pyes.utils import ESRange
import datetime
class ... | Yelp/pyes | tests/test_facets.py | Python | bsd-3-clause | 6,193 | 0.004198 |
# -*- coding: utf-8 -*-
# Part of Odoo. See LICENSE file for full copyright and licensing details.
from datetime import datetime, date
from lxml import etree
import time
from openerp import api
from openerp import SUPERUSER_ID
from openerp import tools
from openerp.osv import fields, osv
from openerp.tools.translate ... | be-cloud-be/horizon-addons | server/addons/project/project.py | Python | agpl-3.0 | 53,981 | 0.005131 |
from django.contrib.auth.models import User
from django.db import models
from django.utils import timezone
from oauth2client.django_orm import FlowField, CredentialsField
from crowdsourcing.utils import get_delimiter
import pandas as pd
import os
class RegistrationModel(models.Model):
user = models.OneToOneField(... | psykohack/crowdsource-platform | crowdsourcing/models.py | Python | mit | 21,348 | 0.001499 |
from __future__ import (absolute_import, division, print_function, unicode_literals)
from builtins import *
import wizzat.testutil
import wizzat.pghelper
class DBTestCase(wizzat.testutil.TestCase):
db_info = {
'host' : 'localhost',
'port' : 5432,
'user' : 'wizzat',
... | wizzat/wizzat.py | tests/testcase.py | Python | mit | 630 | 0.022222 |
"""A block Davidson solver for finding a fixed number of eigenvalues.
Adapted from https://joshuagoings.com/2013/08/23/davidsons-method/
"""
import time
from typing import Tuple
import numpy as np
from tqdm import tqdm
def davidson(A: np.ndarray, k: int, eig: int) -> Tuple[np.ndarray, np.ndarray]:
assert len(A.... | berquist/programming_party | eric/project12/davidson.py | Python | mpl-2.0 | 2,084 | 0.00144 |
import tests.units.tournaments
import lib.datalayer
import games
import games.settlers
import tournaments
import hruntime
from tests import *
from tests.units.tournaments import create_and_populate_tournament
class Tests(TestCase):
@classmethod
def setup_class(cls):
super(Tests, cls).setup_class()
hrun... | happz/settlers | tests/units/tournaments/randomized.py | Python | mit | 746 | 0.009383 |
# Copyright (c) 2014 by Ecreall under licence AGPL terms
# available on http://www.gnu.org/licenses/agpl.html
# licence: AGPL
# author: Amen Souissi
import deform
from pyramid.view import view_config
from dace.processinstance.core import DEFAULTMAPPING_ACTIONS_VIEWS
from pontus.default_behavior import Cancel
from p... | ecreall/nova-ideo | novaideo/views/smart_folder_management/remove_smart_folder.py | Python | agpl-3.0 | 2,248 | 0.00089 |
from .variables import *
def Cell(node):
# cells must stand on own line
if node.parent.cls not in ("Assign", "Assigns"):
node.auxiliary("cell")
return "{", ",", "}"
def Assign(node):
if node.name == 'varargin':
out = "%(0)s = va_arg(varargin, " + node[0].type + ") ;"
else:
... | jonathf/matlab2cpp | src/matlab2cpp/rules/_cell.py | Python | bsd-3-clause | 495 | 0.00404 |
# -*- coding: utf-8 -*-
# Generated by Django 1.11.4 on 2017-08-26 09:42
from __future__ import unicode_literals
from django.conf import settings
from django.db import migrations, models
import django.db.models.deletion
class Migration(migrations.Migration):
dependencies = [
('exercises', '0004_exercise... | FlowFX/unkenmathe.de | src/um/exercises/migrations/0005_auto_20170826_0942.py | Python | agpl-3.0 | 578 | 0.00173 |
# Copyright (c) 2017 Cedric Bellegarde <cedric.bellegarde@adishatz.org>
# 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 later version.
... | gnumdk/eolie | eolie/helper_dbus.py | Python | gpl-3.0 | 3,499 | 0 |
from __future__ import print_function, unicode_literals, division, absolute_import
import datetime
import time
import ntplib
from pyotp import utils
from pyotp.otp import OTP
class TOTP(OTP):
systime_offset = None
def __init__(self, *args, **kwargs):
"""
@option options [Integer] interval ... | projectarkc/arkc-server | arkcserver/pyotp/totp.py | Python | gpl-2.0 | 2,787 | 0.001435 |
import csv
from . import WorksheetBase, WorkbookBase, CellMode
class CSVWorksheet(WorksheetBase):
def __init__(self, raw_sheet, ordinal):
super().__init__(raw_sheet, ordinal)
self.name = "Sheet 1"
self.nrows = len(self.raw_sheet)
self.ncols = max([len(r) for r in self.raw_sheet])
def parse_cell(s... | treycucco/py-utils | idb/spreadsheet/csv.py | Python | bsd-3-clause | 862 | 0.012761 |
"""The tests for the Graphite component."""
import socket
import unittest
from unittest import mock
import blumate.core as ha
import blumate.components.graphite as graphite
from blumate.const import (
EVENT_STATE_CHANGED,
EVENT_BLUMATE_START, EVENT_BLUMATE_STOP,
STATE_ON, STATE_OFF)
from tests.common impo... | bdfoster/blumate | tests/components/test_graphite.py | Python | mit | 8,152 | 0 |
# Licensed to the StackStorm, Inc ('StackStorm') 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 use th... | punalpatel/st2 | st2reactor/st2reactor/container/manager.py | Python | apache-2.0 | 6,484 | 0.002159 |
"""Runs fast tests."""
import unittest
from tests.kernel_tests import SwiftKernelTests, OwnKernelTests
from tests.simple_notebook_tests import *
if __name__ == '__main__':
unittest.main()
| google/swift-jupyter | test/fast_test.py | Python | apache-2.0 | 196 | 0 |
# Copyright (C) 2014 Robby Zeitfuchs (@robbyFux)
#
# 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 later version.
#
# This program is d... | lixiangning888/whole_project | modules/signatures_orignal/banker_cridex.py | Python | lgpl-3.0 | 2,206 | 0.00544 |
from django.contrib.gis.db.models import GeometryField
from django.contrib.gis.db.models.functions import Distance
from django.contrib.gis.measure import (
Area as AreaMeasure, Distance as DistanceMeasure,
)
from django.db.utils import NotSupportedError
from django.utils.functional import cached_property
class Ba... | georgemarshall/django | django/contrib/gis/db/backends/base/operations.py | Python | bsd-3-clause | 6,371 | 0.002197 |
# -*- coding: utf-8 -*-
# Generated by Django 1.10.3 on 2016-11-26 22:42
from __future__ import unicode_literals
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('parliament', '0002_auto_20161123_1157'),
]
operations = [
migrations.AlterF... | openkamer/openkamer | parliament/migrations/0003_auto_20161126_2342.py | Python | mit | 467 | 0 |
import re
import logging
import urllib
import csv
import os
import shutil
from datetime import datetime
import StringIO
from scrapy.spider import BaseSpider
from scrapy import signals
from scrapy.selector import HtmlXPathSelector
from scrapy.http import Request, HtmlResponse
from scrapy.utils.response import get_base_... | 0--key/lib | portfolio/Python/scrapy/axemusic/tomleemusic_ca.py | Python | apache-2.0 | 5,954 | 0.003359 |
import matplotlib.pyplot as plt
#stores information about laser structure
#saves refraction and electric field profiles in text and graphic form to HDD
class Laser:
refraction = []
field = []
gridX = []
gridN = []
field = []
def __init__(self, (wavelength, concentration, thickness... | DQE-Polytech-University/Beamplex | src/laserstructure.py | Python | mit | 3,771 | 0.008221 |
"""
The main script
"""
import argparse
import summaryrank.features
import summaryrank.importers
import summaryrank.tools
DESCRIPTION = '''
SummaryRank is a set of tools that help producing machine-learned
summary/sentence rankers. It supports a wide range of functions such
as generating judgments in trec_eval forma... | rmit-ir/SummaryRank | summaryrank/__main__.py | Python | mit | 2,623 | 0.000381 |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
# Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance with the License. You may obtain
# a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or ... | pmverdugo/fiware-validator | validator/tests/api/middleware/test_ssl.py | Python | apache-2.0 | 1,568 | 0.000638 |
# Copyright (c) 2017 Nick Gashkov
#
# Distributed under MIT License. See LICENSE file for details.
class ValidationError(Exception):
def __init__(self, *args, **kwargs):
self.error_dict = kwargs.pop('error_dict')
super(ValidationError, self).__init__(*args, **kwargs)
| nickgashkov/virtualspace | virtualspace/utils/exceptions.py | Python | mit | 290 | 0 |
# -*- coding: utf-8 -*-
#
# Copyright (C) 2005-2010 TUBITAK/UEKAE
#
# 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.
#
# ... | forYali/yali | yali/gui/ScrBootloader.py | Python | gpl-2.0 | 4,461 | 0.003362 |
#!/usr/bin/python
#
# to run an example
# python RunMakeFigures.py -p Demo -i 0 -j 1 -f 3FITC_4PE_004.fcs -h ./projects/Demo
#
import getopt,sys,os
import numpy as np
## important line to fix popup error in mac osx
import matplotlib
matplotlib.use('Agg')
from cytostream import Model
import matplotlib.pyplot as plt
#... | ajrichards/GenesDI | genesdi/RunMakeFigures.py | Python | gpl-3.0 | 5,628 | 0.022388 |
import json
import os
import socket
import sys
import uuid
import etcd
from tendrl.commons import objects
from tendrl.commons.utils import etcd_utils
from tendrl.commons.utils import event_utils
from tendrl.commons.utils import log_utils as logger
NODE_ID = None
class NodeContext(objects.BaseObject):
def __i... | r0h4n/commons | tendrl/commons/objects/node_context/__init__.py | Python | lgpl-2.1 | 7,441 | 0 |
# -*- cpy-indent-level: 4; indent-tabs-mode: nil -*-
# ex: set expandtab softtabstop=4 shiftwidth=4:
#
# Copyright (C) 2011,2013 Contributor
#
# 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
#... | jrha/aquilon | build/bootstrap_ms/ms/version/__init__.py | Python | apache-2.0 | 726 | 0 |
#coding=utf8
'''
Created on 2012-9-19
@author: senon
'''
from django.conf.urls.defaults import patterns, url
urlpatterns = patterns('friendships.views',
url(r'^concerned_about_friends/', 'concerned_about_friends')
) | xlk521/cloudguantou | friendships/urls.py | Python | bsd-3-clause | 252 | 0.019841 |
import ply.yacc as yacc
from bsi_lexer import tokens
from bsi_object import BsiObject
from bsi_array import BsiArray
def p_object_pairs(p):
'obj : pairs'
p[0] = BsiObject()
for pair in p[1]:
p[0].set(pair[0], pair[1])
def p_pairs_pair(p):
'pairs : pair'
p[0] = [p[1]]
def p_pairs_pair_pair... | jshou/bsi | bsi/bsi_parser.py | Python | mit | 930 | 0.012903 |
# -*- coding: utf-8 -*-
#
# Licensed to the Apache Software Foundation (ASF) under one
# or more contributor license agreements. See the NOTICE file
# distributed with this work for additional information
# regarding copyright ownership. The ASF licenses this file
# to you under the Apache License, Version 2.0 (the
#... | Fokko/incubator-airflow | airflow/task/task_runner/__init__.py | Python | apache-2.0 | 1,828 | 0.001094 |
##################################################################################################
# $HeadURL$
##################################################################################################
"""Collection of DIRAC useful statistics related modules.
.. warning::
By default on Error they return N... | avedaee/DIRAC | Core/Utilities/Statistics.py | Python | gpl-3.0 | 2,281 | 0.021043 |
#!/home/jojoriveraa/Dropbox/Capacitación/Platzi/Python-Django/NFCow/venv/bin/python3
from django.core import management
if __name__ == "__main__":
management.execute_from_command_line()
| jojoriveraa/titulacion-NFCOW | venv/bin/django-admin.py | Python | apache-2.0 | 192 | 0 |
"""
The Plaid API
The Plaid REST API. Please see https://plaid.com/docs/api for more details. # noqa: E501
Generated by: https://openapi-generator.tech
"""
import re # noqa: F401
import sys # noqa: F401
from plaid.model_utils import ( # noqa: F401
ApiTypeError,
ModelComposed,
ModelNormal... | plaid/plaid-python | plaid/model/transactions_rule_field.py | Python | mit | 6,963 | 0.000718 |
'''Example script to generate text from Nietzsche's writings.
At least 20 epochs are required before the generated text
starts sounding coherent.
It is recommended to run this script on GPU, as recurrent
networks are quite computationally intensive.
If you try this script on new data, make sure your corpus
has at le... | sysid/nbs | lstm/lstm_text_generation.py | Python | mit | 3,355 | 0.000596 |
#!/usr/bin/env python3
# Copyright (c) 2020-2021 The Bitcoin Core developers
# Distributed under the MIT software license, see the accompanying
# file COPYING or http://www.opensource.org/licenses/mit-license.php.
"""Test block-relay-only anchors functionality"""
import os
from test_framework.p2p import P2PInterface
... | ajtowns/bitcoin | test/functional/feature_anchors.py | Python | mit | 2,924 | 0.000684 |
import ray
from ray._private.test_utils import run_string_as_driver
# This tests the queue transitions for infeasible tasks. This has been an issue
# in the past, e.g., https://github.com/ray-project/ray/issues/3275.
def test_infeasible_tasks(ray_start_cluster):
cluster = ray_start_cluster
@ray.remote
de... | ray-project/ray | python/ray/tests/test_node_manager.py | Python | apache-2.0 | 1,376 | 0.000727 |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
"""
Finds revisions from the Thunderbird migration that don't have based_on
set correctly, and are still relavent, and fixes that.
Run this script like `./manage.py runscript fix_tb_basedon`.
"""
import sys
from traceback import print_exc
from django.db.models import Q
... | feer56/Kitsune1 | scripts/fix_tb_basedon.py | Python | bsd-3-clause | 1,520 | 0 |
from pidWX import *
| adalke/rdkit | rdkit/sping/WX/__init__.py | Python | bsd-3-clause | 20 | 0 |
# -*- coding: utf-8 -*-
import os
from future.moves.urllib.parse import quote
import uuid
import ssl
from pymongo import MongoClient
import requests
from django.apps import apps
from addons.wiki import settings as wiki_settings
from addons.wiki.exceptions import InvalidVersionError
from osf.utils.permissions import A... | mfraezz/osf.io | addons/wiki/utils.py | Python | apache-2.0 | 7,955 | 0.001383 |
# -*- coding: utf-8 -*-
from django.db import models, migrations
from django.conf import settings
class Migration(migrations.Migration):
dependencies = [
('cfp', '0004_paperapplication_duration'),
]
operations = [
migrations.AlterField(
model_name='applicant',
n... | WebCampZg/conference-web | cfp/migrations/0005_auto_20150319_0019.py | Python | bsd-3-clause | 767 | 0.002608 |
# BEGIN_COPYRIGHT
#
# Copyright 2009-2021 CRS4.
#
# 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 agree... | simleo/pydoop | examples/self_contained/vowelcount/__init__.py | Python | apache-2.0 | 850 | 0 |
#
# This file is part of pyasn1 software.
#
# Copyright (c) 2005-2017, Ilya Etingof <etingof@gmail.com>
# License: http://snmplabs.com/pyasn1/license.html
#
import logging
from pyasn1 import __version__
from pyasn1 import error
from pyasn1.compat.octets import octs2ints
__all__ = ['Debug', 'setLogger', 'hexdump']
fl... | catapult-project/catapult | third_party/gsutil/third_party/pyasn1/pyasn1/debug.py | Python | bsd-3-clause | 3,361 | 0.000595 |
# This file is part of BurnMan - a thermoelastic and thermodynamic toolkit for
# the Earth and Planetary Sciences
# Copyright (C) 2012 - 2015 by the BurnMan team, released under the GNU
# GPL v2 or later.
"""
example_perplex
---------------
This minimal example demonstrates how burnman can be used
to read and interro... | bobmyhill/burnman | examples/example_perplex.py | Python | gpl-2.0 | 2,092 | 0.000478 |
"""
Testing the Intravoxel incoherent motion module
The values of the various parameters used in the tests are inspired by
the study of the IVIM model applied to MR images of the brain by
Federau, Christian, et al. [1].
References
----------
.. [1] Federau, Christian, et al. "Quantitative measurement
of brain ... | FrancoisRheaultUS/dipy | dipy/reconst/tests/test_ivim.py | Python | bsd-3-clause | 19,029 | 0 |
import os
import shutil
from cumulusci.core.exceptions import DependencyResolutionError
from cumulusci.core.github import get_github_api_for_repo
from cumulusci.core.github import find_latest_release
from cumulusci.core.github import find_previous_release
from cumulusci.utils import download_extract_github
class Git... | SalesforceFoundation/CumulusCI | cumulusci/core/source/github.py | Python | bsd-3-clause | 4,708 | 0.000637 |
# assign epitope fitness to each node in the phylogeny
import time
from io_util import *
from tree_util import *
from date_util import *
from seq_util import *
import numpy as np
from itertools import izip
from collections import defaultdict
def append_nonepitope_sites(viruses):
for virus in viruses:
sites_ne = no... | doerlbh/Indie-nextflu | augur/scratch/fitness_nonepitope.py | Python | agpl-3.0 | 2,409 | 0.027397 |
from ctypes import c_void_p
from django.contrib.gis.geos.error import GEOSException
# Trying to import GDAL libraries, if available. Have to place in
# try/except since this package may be used outside GeoDjango.
try:
from django.contrib.gis import gdal
except ImportError:
# A 'dummy' gdal module.
... | diego-d5000/MisValesMd | env/lib/python2.7/site-packages/django/contrib/gis/geos/base.py | Python | mit | 1,714 | 0.000583 |
from tensorboardX import SummaryWriter
import unittest
from tensorboardX.record_writer import S3RecordWriter, make_valid_tf_name, GCSRecordWriter
import os
import boto3
from moto import mock_s3
os.environ.setdefault("AWS_ACCESS_KEY_ID", "foobar_key")
os.environ.setdefault("AWS_SECRET_ACCESS_KEY", "foobar_secret")
cl... | lanpa/tensorboardX | tests/test_record_writer.py | Python | mit | 1,257 | 0.000796 |
# -*- coding: utf-8 -*-
"""
Created on Wed Dec 3 14:25:06 2014
@author: Matti Ropo
@author: Henrik Levämäki
"""
from __future__ import print_function
import time
import os
import sys
import numpy as np
import pyemto.common.common as common
class System:
"""The main class which provides the basis for the pyEMTO... | hpleva/pyemto | pyemto/system.py | Python | mit | 148,431 | 0.003099 |
from Module import AbstractModule
class Module(AbstractModule):
def __init__(self):
AbstractModule.__init__(self)
def run(
self, network, antecedents, out_attributes, user_options, num_cores,
outfile):
from genomicode import mplgraph
from genomicode import filelib
... | jefftc/changlab | Betsy/Betsy/modules/plot_prediction.py | Python | mit | 2,613 | 0.003827 |
# Copyright 2013-2020 Lawrence Livermore National Security, LLC and other
# Spack Project Developers. See the top-level COPYRIGHT file for details.
#
# SPDX-License-Identifier: (Apache-2.0 OR MIT)
from spack import *
class PerlConfigGeneral(PerlPackage):
"""Config::General - Generic Config Module"""
homepag... | iulian787/spack | var/spack/repos/builtin/packages/perl-config-general/package.py | Python | lgpl-2.1 | 557 | 0.005386 |
# -*- coding: utf-8 -*-
# Form implementation generated from reading ui file 'openPathTool.ui'
#
# Created by: PyQt4 UI code generator 4.11.4
#
# WARNING! All changes made in this file will be lost!
from PyQt4 import QtCore, QtGui
try:
_fromUtf8 = QtCore.QString.fromUtf8
except AttributeError:
def _fromUtf8(... | david2777/DavidsTools | Standalone/openPathTool/UI_openPathTool.py | Python | gpl-2.0 | 3,656 | 0.003282 |
# Copyright 2018 The TensorFlow Probability Authors.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law o... | tensorflow/probability | tensorflow_probability/python/sts/components/autoregressive_test.py | Python | apache-2.0 | 6,809 | 0.004112 |
# Removing stop words
# What to do with the Retweets (RT)?
# Make adjust so that the # and @ are attached to their associated word (i.e. #GOP, @twitter)
from nltk.corpus import stopwords
from nltk.tokenize import word_tokenize
import sys
def remove_stopwords(tweets):
with open(tweets, 'r', buffering=1028) as re... | aseciwa/independent-study | scripts/stopWords.py | Python | mit | 971 | 0.008239 |
"""
WSGI config for Texas LAN Web project.
This module contains the WSGI application used by Django's development server
and any production WSGI deployments. It should expose a module-level variable
named ``application``. Django's ``runserver`` and ``runfcgi`` commands discover
this application via the ``WSGI_APPLICAT... | TexasLAN/texaslan.org | config/wsgi.py | Python | mit | 1,450 | 0 |
"""
PySAR
Polarimetric SAR decomposition
Contents
--------
decomp_fd(hhhh,vvvv,hvhv,hhvv,numthrd=None) : Freeman-Durden 3-component decomposition
"""
from __future__ import print_function, division
import sys,os
import numpy as np
###===============================================================================... | bminchew/PySAR | pysar/polsar/decomp.py | Python | gpl-3.0 | 6,649 | 0.025417 |
# sAsync:
# An enhancement to the SQLAlchemy package that provides persistent
# item-value stores, arrays, and dictionaries, and an access broker for
# conveniently managing database access, table setup, and
# transactions. Everything can be run in an asynchronous fashion using
# the Twisted framework and its deferred ... | edsuom/sAsync | sasync/test/test_items.py | Python | apache-2.0 | 12,595 | 0.006431 |
import json
import time
from _md5 import md5
import requests
import RolevPlayer as r
def now_playing_last_fm(artist, track):
update_now_playing_sig = md5(("api_key" + r.API_KEY +
"artist" + artist +
"method" + "track.updateNowPlaying" +
... | SimeonRolev/RolevPlayerQT | RolevPlayer/Scrobbler.py | Python | gpl-3.0 | 1,642 | 0.003654 |
#!/usr/bin/env python
data = {
"default_prefix": "OSVC_COMP_REMOVE_FILES_",
"example_value": """
[
"/tmp/foo",
"/bar/to/delete"
]
""",
"description": """* Verify files and file trees are uninstalled
""",
"form_definition": """
Desc: |
A rule defining a set of files to remove, fed to the 'remove_files' co... | tanji/replication-manager | share/opensvc/compliance/com.replication-manager/remove_files.py | Python | gpl-3.0 | 2,367 | 0.005492 |
conanfile = """from conans import ConanFile, CMake, tools
import os
class {package_name}Conan(ConanFile):
name = "{name}"
version = "{version}"
license = "<Put the package license here>"
url = "<Package recipe repository url here, for issues about the package>"
settings = "os", "compiler", "build_... | AversivePlusPlus/AversivePlusPlus | tools/conan/conans/client/new.py | Python | bsd-3-clause | 3,503 | 0.001427 |
"""Tests for the Linky config flow."""
from pylinky.exceptions import (
PyLinkyAccessException,
PyLinkyEnedisException,
PyLinkyException,
PyLinkyWrongLoginException,
)
import pytest
from homeassistant import data_entry_flow
from homeassistant.components.linky.const import DEFAULT_TIMEOUT, DOMAIN
from h... | nkgilley/home-assistant | tests/components/linky/test_config_flow.py | Python | apache-2.0 | 6,904 | 0.000145 |
"""Helps build config packages for installer-specific templates.
Takes in a bunch of configuration files, as well as functions to calculate the values/strings which
need to be put into the configuration.
Operates strictly:
- All paramaters are strings. All things calculated / derived are strings.
- Every given pa... | branden/dcos | gen/__init__.py | Python | apache-2.0 | 29,065 | 0.002408 |
# disk.py
#
# Copyright (C) 2014-2016 Kano Computing Ltd.
# License: http://www.gnu.org/licenses/gpl-2.0.txt GNU GPL v2
#
# Utilities relating to disk manangement
from kano.utils.shell import run_cmd
def get_free_space(path="/"):
"""
Returns the amount of free space in certain location in MB
:p... | KanoComputing/kano-toolset | kano/utils/disk.py | Python | gpl-2.0 | 1,133 | 0 |
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.db import models, migrations
class Migration(migrations.Migration):
dependencies = [
('core', '0008_auto_20150819_0050'),
]
operations = [
migrations.AlterUniqueTogether(
name='test',
uni... | swarmer/tester | core/migrations/0009_auto_20150821_0243.py | Python | mit | 376 | 0 |
# Copyright (c) 2007 The Hewlett-Packard Development Company
# All rights reserved.
#
# The license below extends only to copyright in the software and shall
# not be construed as granting a license to any other intellectual
# property including but not limited to intellectual property relating
# to a hardware implemen... | koparasy/faultinjection-gem5 | src/arch/x86/isa/insts/general_purpose/data_transfer/xchg.py | Python | bsd-3-clause | 3,156 | 0 |
import EightPuzzleWithHeuristics as Problem
# puzzle0:
CREATE_INITIAL_STATE = lambda: Problem.State([0, 1, 2, 3, 4, 5, 6, 7, 8]) | vaibhavi-r/CSE-415 | Assignment3/puzzle0.py | Python | mit | 129 | 0.015504 |
import datetime
import feedparser
import json
import logging
import random
import re
import string # pylint: disable=W0402
import urllib
import uuid
import time
from django.conf import settings
from django.contrib.auth import logout, authenticate, login
from django.contrib.auth.models import User
from django.con... | wwj718/edx-video | common/djangoapps/student/views.py | Python | agpl-3.0 | 50,206 | 0.002769 |
#!/usr/bin/env python3
from os import environ, system
from subprocess import Popen
print('\nUltimate Doom (Classic)')
print('Link: https://store.steampowered.com/app/2280/Ultimate_Doom/\n')
home = environ['HOME']
core = home + '/bin/games/steam-connect/steam-connect-core.py'
logo = home + '/bin/games/steam-connect/do... | noirhat/bin | games/doom/doom-1.py | Python | gpl-2.0 | 755 | 0.003974 |
import csv
from django.db import transaction
from django import forms
from django.forms.forms import NON_FIELD_ERRORS
from django.utils import six
from django.utils.translation import ugettext_lazy as _
class CSVImportError(Exception):
pass
class ImportCSVForm(forms.Form):
csv_file = forms.FileField(requir... | fusionbox/django-importcsvadmin | importcsvadmin/forms.py | Python | bsd-2-clause | 3,694 | 0.000812 |
# This file is part of Indico.
# Copyright (C) 2002 - 2015 European Organization for Nuclear Research (CERN).
#
# Indico 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 (a... | XeCycle/indico | indico/MaKaC/services/interface/rpc/offline.py | Python | gpl-3.0 | 3,627 | 0.001103 |
#
# Here is a more complicated example that loads a .csv file and
# then creates a plot from the x,y data in it.
# The data file is the saved curve from partsim.com of the low pass filter.
# It was saved as xls file and then opened in Excel and exported to csv
#
# First import the csv parser, the numeric tools and plot... | mholtrop/Phys605 | Python/Getting_Started/CSV_Plot.py | Python | gpl-3.0 | 1,762 | 0.009081 |
import numpy as np
import logging
import glob
import bandwise_features as BF
import time
import mir3.modules.features.stats as feat_stats
import mir3.modules.tool.to_texture_window as texture_window
import remove_random_noise as rrn
from multiprocessing import Pool
logger = logging.getLogger("birdclef_tza_bands")
logg... | pymir3/pymir3 | scripts/ismir2016/birdclef_tza_bands.py | Python | mit | 13,712 | 0.004959 |
# -*- coding=utf-8 -*-
# Licensed to the Apache Software Foundation (ASF) under one or more
# contributor license agreements. See the NOTICE file distributed with
# this work for additional information regarding copyright ownership.
# The ASF licenses this file to You under the Apache License, Version 2.0
# (the "Lice... | Kami/libcloud | libcloud/test/storage/test_oss.py | Python | apache-2.0 | 31,715 | 0.000126 |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
u"""
Задание 1: классный Человек.
УСЛОВИЕ:
Реализовать класс Person, который отображает запись в книге контактов.
Класс имеет 4 атрибута:
- surname - строка - фамилия контакта (обязательный)
- first_name - строка - имя контакта (обязательный)
- nickname - строк... | pybursa/homeworks | s_shybkoy/hw5/hw5_task1.py | Python | gpl-2.0 | 2,975 | 0.00041 |
# -*- coding:utf-8 -*-
'''
x11perf测试工具执行脚本
'''
import os, shutil, re
from test import BaseTest
from lpt.lib.error import *
from lpt.lib import lptxml
from lpt.lib import lptlog
from lpt.lib.share import utils
from lpt.lib import lptreport
import glob
glxgears_keys = ["gears"]
class TestControl(BaseTest):
... | ShaolongHu/lpts | tests/glxgears.py | Python | gpl-2.0 | 3,938 | 0.01248 |
"""The tests for hls streams."""
from datetime import timedelta
from io import BytesIO
from unittest.mock import patch
from homeassistant.setup import async_setup_component
from homeassistant.components.stream.core import Segment
from homeassistant.components.stream.recorder import recorder_save_worker
import homeassi... | auduny/home-assistant | tests/components/stream/test_recorder.py | Python | apache-2.0 | 2,235 | 0 |
#!/usr/bin/env python3
"""hello with args"""
import sys
import os
args = sys.argv
if len(args) != 2:
script = os.path.basename(args[0])
print('Usage: {} NAME'.format(script))
sys.exit(1)
name = args[1]
print('Hello, {}!'.format(name))
| kyclark/metagenomics-book | python/hello/hello_arg3.py | Python | gpl-3.0 | 251 | 0 |
import os
import platform
import subprocess
import cat_service
from apps.general import headers
def main():
headers.print_header('LOLCAT FACTORY')
# look for a directory if not there create it
dir_path = get_or_create_output_folder()
n_cats = get_number_cats()
# contact the lol cat api, get binar... | egancatriona1/python-jumpstart | apps/06_lolcat_factory/you_try/program.py | Python | mit | 1,553 | 0.000644 |
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('twit', '0006_auto_20160419_0248'),
]
operations = [
migrations.CreateModel(
name='Retweet',
fields=[... | arunchaganty/presidential-debates | django/twit/migrations/0007_retweet.py | Python | mit | 697 | 0.002869 |
# -*- coding: utf-8 -*-
import socket
import struct
import signal
signal.signal(signal.SIGPIPE, signal.SIG_IGN)
class Connection(object):
"""
サーバとの通信用クラス
"""
BINARY_INT = '!1I'
BINARY_TABLE = '!120I'
def __init__(self, addr='127.0.0.1', port=42485):
self.sock = socket.socket(socket.A... | Hironsan/uecda-pyclient | src/connection.py | Python | mit | 1,996 | 0 |
from share.transform.chain.exceptions import * # noqa
from share.transform.chain.links import * # noqa
from share.transform.chain.parsers import * # noqa
from share.transform.chain.transformer import ChainTransformer # noqa
from share.transform.chain.links import Context
# Context singleton to be used for parser ... | CenterForOpenScience/SHARE | share/transform/chain/__init__.py | Python | apache-2.0 | 484 | 0 |
# encoding: utf-8
import datetime
from south.db import db
from south.v2 import SchemaMigration
from django.db import models
class Migration(SchemaMigration):
def forwards(self, orm):
# Removing unique constraint on 'GroupedMessage', fields ['checksum', 'logger', 'view']
db.delete_unique('... | beni55/sentry | src/sentry/migrations/0015_auto__add_field_message_project__add_field_messagecountbyminute_projec.py | Python | bsd-3-clause | 15,392 | 0.007926 |
# -*- coding: utf-8 -*-
#------------------------------------------------------------
# seriesly - XBMC Plugin
# Conector para Wupload
# http://blog.tvalacarta.info/plugin-xbmc/seriesly/
#------------------------------------------------------------
import urlparse,urllib2,urllib,re
import os
from core import scrapert... | conejoninja/xbmc-seriesly | servers/wupload.py | Python | gpl-3.0 | 11,622 | 0.015835 |
import urllib
import urllib2
import cookielib
import logging
class GISTokenGenerator:
def __init__(self, email, password):
self.cj = cookielib.CookieJar()
self.opener = urllib2.build_opener(urllib2.HTTPCookieProcessor(self.cj))
self.email = email
self.login_data = urllib.urlencode(... | AIESECGermany/gis-hubspot-sync | gis_token_generator.py | Python | gpl-2.0 | 825 | 0.004848 |
import sys, os
from pythonparser import diagnostic
from ...language.environment import ProcessArgumentManager
from ...master.databases import DeviceDB, DatasetDB
from ...master.worker_db import DeviceManager, DatasetManager
from ..module import Module
from ..embedding import Stitcher
from ..targets import OR1KTarget
fr... | JQIamo/artiq | artiq/compiler/testbench/perf_embedding.py | Python | lgpl-3.0 | 2,231 | 0.001793 |
import json
import os
import urllib
from ..storage import WatchLaterList, FunctionCache, SearchHistory, FavoriteList, AccessManager
from .abstract_settings import AbstractSettings
from .. import utils
class AbstractContext(object):
CACHE_ONE_MINUTE = 60
CACHE_ONE_HOUR = 60 * CACHE_ONE_MINUTE
CACHE_ONE_DA... | listamilton/supermilton.repository | plugin.audio.soundcloud/resources/lib/nightcrawler/core/abstract_context.py | Python | gpl-2.0 | 10,518 | 0.001236 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.