prompt large_stringlengths 72 9.34k | completion large_stringlengths 0 7.61k |
|---|---|
<|file_name|>F57.py<|end_file_name|><|fim▁begin|>import fechbase
class Records(fechbase.RecordsBase):
def <|fim_middle|>(self):
fechbase.RecordsBase.__init__(self)
self.fields = [
{'name': 'FORM TYPE', 'number': '1'},
{'name': 'FILER FEC CMTE ID', 'number': '2'},
... | __init__ |
<|file_name|>loggingFunctions.py<|end_file_name|><|fim▁begin|>#!/usr/bin/env python
"""
Set up the logging
"""<|fim▁hole|>import logging
import tempfile
import os
def initialize_logging():
"""
Set up the screen and file logging.
:return: The log filename
"""
# set up DEBUG logging to file, ... | |
<|file_name|>loggingFunctions.py<|end_file_name|><|fim▁begin|>#!/usr/bin/env python
"""
Set up the logging
"""
import logging
import tempfile
import os
def initialize_logging():
<|fim_middle|>
<|fim▁end|> | """
Set up the screen and file logging.
:return: The log filename
"""
# set up DEBUG logging to file, INFO logging to STDERR
log_file = os.path.join(tempfile.gettempdir(), 'spfy.log')
formatter = logging.Formatter(
'%(asctime)s %(name)-12s %(levelname)-8s %(message)s')
# set u... |
<|file_name|>loggingFunctions.py<|end_file_name|><|fim▁begin|>#!/usr/bin/env python
"""
Set up the logging
"""
import logging
import tempfile
import os
def <|fim_middle|>():
"""
Set up the screen and file logging.
:return: The log filename
"""
# set up DEBUG logging to file, INFO logging t... | initialize_logging |
<|file_name|>__init__.py<|end_file_name|><|fim▁begin|>from __future__ import absolute_import<|fim▁hole|>
from .base import WhiteNoise
__version__ = '2.0.3'
__all__ = ['WhiteNoise']<|fim▁end|> | |
<|file_name|>simple_modis_algorithms.py<|end_file_name|><|fim▁begin|># -----------------------------------------------------------------------------
# Copyright * 2014, United States Government, as represented by the
# Administrator of the National Aeronautics and Space Administration. All
# rights reserved.
#
# The Cr... | if threshold == None:
threshold = float(domain.algorithm_params['fai_threshold'])
return get_fai(b).lte(threshold) |
<|file_name|>simple_modis_algorithms.py<|end_file_name|><|fim▁begin|># -----------------------------------------------------------------------------
# Copyright * 2014, United States Government, as represented by the
# Administrator of the National Aeronautics and Space Administration. All
# rights reserved.
#
# The Cr... | '''Just use a height threshold on the DEM!'''
heightLevel = float(domain.algorithm_params['dem_threshold'])
dem = domain.get_dem().image
return dem.lt(heightLevel).select(['elevation'], ['b1']) |
<|file_name|>simple_modis_algorithms.py<|end_file_name|><|fim▁begin|># -----------------------------------------------------------------------------
# Copyright * 2014, United States Government, as represented by the
# Administrator of the National Aeronautics and Space Administration. All
# rights reserved.
#
# The Cr... | '''Simple EVI based classifier'''
#no_clouds = b['b3'].lte(2100).select(['sur_refl_b03'], ['b1'])
criteria1 = b['EVI'].lte(0.3).And(b['LSWI'].subtract(b['EVI']).gte(0.05)).select(['sur_refl_b02'], ['b1'])
criteria2 = b['EVI'].lte(0.05).And(b['LSWI'].lte(0.0)).select(['sur_refl_b02'], ['b1'])
#return... |
<|file_name|>simple_modis_algorithms.py<|end_file_name|><|fim▁begin|># -----------------------------------------------------------------------------
# Copyright * 2014, United States Government, as represented by the
# Administrator of the National Aeronautics and Space Administration. All
# rights reserved.
#
# The Cr... | '''Method from paper: Xiao, Boles, Frolking, et. al. Mapping paddy rice agriculture in South and Southeast Asia using
multi-temporal MODIS images, Remote Sensing of Environment, 2006.
This method implements a very simple decision tree from several standar... |
<|file_name|>simple_modis_algorithms.py<|end_file_name|><|fim▁begin|># -----------------------------------------------------------------------------
# Copyright * 2014, United States Government, as represented by the
# Administrator of the National Aeronautics and Space Administration. All
# rights reserved.
#
# The Cr... | '''Just the internals of the difference method'''
return b['b2'].subtract(b['b1']).select(['sur_refl_b02'], ['b1']) |
<|file_name|>simple_modis_algorithms.py<|end_file_name|><|fim▁begin|># -----------------------------------------------------------------------------
# Copyright * 2014, United States Government, as represented by the
# Administrator of the National Aeronautics and Space Administration. All
# rights reserved.
#
# The Cr... | '''modis_diff but with the threshold calculation included (training image required)'''
if domain.unflooded_domain == None:
print('No unflooded training domain provided.')
return None
unflooded_b = modis_utilities.compute_modis_indices(domain.unflooded_domain)
water_mask = modis_utilitie... |
<|file_name|>simple_modis_algorithms.py<|end_file_name|><|fim▁begin|># -----------------------------------------------------------------------------
# Copyright * 2014, United States Government, as represented by the
# Administrator of the National Aeronautics and Space Administration. All
# rights reserved.
#
# The Cr... | '''Compute (b2-b1) < threshold, a simple water detection index.
This method may be all that is needed in cases where the threshold can be hand tuned.
'''
if threshold == None: # If no threshold value passed in, load it based on the data set.
threshold = float(domain.algorithm_params['mod... |
<|file_name|>simple_modis_algorithms.py<|end_file_name|><|fim▁begin|># -----------------------------------------------------------------------------
# Copyright * 2014, United States Government, as represented by the
# Administrator of the National Aeronautics and Space Administration. All
# rights reserved.
#
# The Cr... | A = 500
B = 2500
return b['b2'].add(A).divide(b['b1'].add(B)).select(['sur_refl_b02'], ['b1']) |
<|file_name|>simple_modis_algorithms.py<|end_file_name|><|fim▁begin|># -----------------------------------------------------------------------------
# Copyright * 2014, United States Government, as represented by the
# Administrator of the National Aeronautics and Space Administration. All
# rights reserved.
#
# The Cr... | '''The dartmouth method but with threshold calculation included (training image required)'''
if domain.unflooded_domain == None:
print('No unflooded training domain provided.')
return None
unflooded_b = modis_utilities.compute_modis_indices(domain.unflooded_domain)
water_mask = modis_ut... |
<|file_name|>simple_modis_algorithms.py<|end_file_name|><|fim▁begin|># -----------------------------------------------------------------------------
# Copyright * 2014, United States Government, as represented by the
# Administrator of the National Aeronautics and Space Administration. All
# rights reserved.
#
# The Cr... | '''A flood detection method from the Dartmouth Flood Observatory.
This method is a refinement of the simple b2-b1 detection method.
'''
if threshold == None:
threshold = float(domain.algorithm_params['dartmouth_threshold'])
return get_dartmouth(b).lte(threshold) |
<|file_name|>simple_modis_algorithms.py<|end_file_name|><|fim▁begin|># -----------------------------------------------------------------------------
# Copyright * 2014, United States Government, as represented by the
# Administrator of the National Aeronautics and Space Administration. All
# rights reserved.
#
# The Cr... | return b['b6'].subtract(b['b4']).divide(b['b4'].add(b['b6'])).select(['sur_refl_b06'], ['b1']) |
<|file_name|>simple_modis_algorithms.py<|end_file_name|><|fim▁begin|># -----------------------------------------------------------------------------
# Copyright * 2014, United States Government, as represented by the
# Administrator of the National Aeronautics and Space Administration. All
# rights reserved.
#
# The Cr... | if domain.unflooded_domain == None:
print('No unflooded training domain provided.')
return None
unflooded_b = modis_utilities.compute_modis_indices(domain.unflooded_domain)
water_mask = modis_utilities.get_permanent_water_mask()
threshold = modis_utilities.compute_binary_threshold(get... |
<|file_name|>simple_modis_algorithms.py<|end_file_name|><|fim▁begin|># -----------------------------------------------------------------------------
# Copyright * 2014, United States Government, as represented by the
# Administrator of the National Aeronautics and Space Administration. All
# rights reserved.
#
# The Cr... | if threshold == None:
threshold = float(domain.algorithm_params['mod_ndwi_threshold'])
return get_mod_ndwi(b).lte(threshold) |
<|file_name|>simple_modis_algorithms.py<|end_file_name|><|fim▁begin|># -----------------------------------------------------------------------------
# Copyright * 2014, United States Government, as represented by the
# Administrator of the National Aeronautics and Space Administration. All
# rights reserved.
#
# The Cr... | '''Just the internals of the FAI method'''
return b['b2'].subtract(b['b1'].add(b['b5'].subtract(b['b1']).multiply((859.0 - 645) / (1240 - 645)))).select(['sur_refl_b02'], ['b1']) |
<|file_name|>simple_modis_algorithms.py<|end_file_name|><|fim▁begin|># -----------------------------------------------------------------------------
# Copyright * 2014, United States Government, as represented by the
# Administrator of the National Aeronautics and Space Administration. All
# rights reserved.
#
# The Cr... | if domain.unflooded_domain == None:
print('No unflooded training domain provided.')
return None
unflooded_b = modis_utilities.compute_modis_indices(domain.unflooded_domain)
water_mask = modis_utilities.get_permanent_water_mask()
threshold = modis_utilities.compute_binary_threshold(... |
<|file_name|>simple_modis_algorithms.py<|end_file_name|><|fim▁begin|># -----------------------------------------------------------------------------
# Copyright * 2014, United States Government, as represented by the
# Administrator of the National Aeronautics and Space Administration. All
# rights reserved.
#
# The Cr... | ''' Floating Algae Index. Method from paper: Feng, Hu, Chen, Cai, Tian, Gan,
Assessment of inundation changes of Poyang Lake using MODIS observations
between 2000 and 2010. Remote Sensing of Environment, 2012.
'''
if threshold == None:
threshold = float(domain.algorithm_params['fai_threshold... |
<|file_name|>simple_modis_algorithms.py<|end_file_name|><|fim▁begin|># -----------------------------------------------------------------------------
# Copyright * 2014, United States Government, as represented by the
# Administrator of the National Aeronautics and Space Administration. All
# rights reserved.
#
# The Cr... | print('No unflooded training domain provided.')
return None |
<|file_name|>simple_modis_algorithms.py<|end_file_name|><|fim▁begin|># -----------------------------------------------------------------------------
# Copyright * 2014, United States Government, as represented by the
# Administrator of the National Aeronautics and Space Administration. All
# rights reserved.
#
# The Cr... | threshold = float(domain.algorithm_params['modis_diff_threshold']) |
<|file_name|>simple_modis_algorithms.py<|end_file_name|><|fim▁begin|># -----------------------------------------------------------------------------
# Copyright * 2014, United States Government, as represented by the
# Administrator of the National Aeronautics and Space Administration. All
# rights reserved.
#
# The Cr... | print('No unflooded training domain provided.')
return None |
<|file_name|>simple_modis_algorithms.py<|end_file_name|><|fim▁begin|># -----------------------------------------------------------------------------
# Copyright * 2014, United States Government, as represented by the
# Administrator of the National Aeronautics and Space Administration. All
# rights reserved.
#
# The Cr... | threshold = float(domain.algorithm_params['dartmouth_threshold']) |
<|file_name|>simple_modis_algorithms.py<|end_file_name|><|fim▁begin|># -----------------------------------------------------------------------------
# Copyright * 2014, United States Government, as represented by the
# Administrator of the National Aeronautics and Space Administration. All
# rights reserved.
#
# The Cr... | print('No unflooded training domain provided.')
return None |
<|file_name|>simple_modis_algorithms.py<|end_file_name|><|fim▁begin|># -----------------------------------------------------------------------------
# Copyright * 2014, United States Government, as represented by the
# Administrator of the National Aeronautics and Space Administration. All
# rights reserved.
#
# The Cr... | threshold = float(domain.algorithm_params['mod_ndwi_threshold']) |
<|file_name|>simple_modis_algorithms.py<|end_file_name|><|fim▁begin|># -----------------------------------------------------------------------------
# Copyright * 2014, United States Government, as represented by the
# Administrator of the National Aeronautics and Space Administration. All
# rights reserved.
#
# The Cr... | print('No unflooded training domain provided.')
return None |
<|file_name|>simple_modis_algorithms.py<|end_file_name|><|fim▁begin|># -----------------------------------------------------------------------------
# Copyright * 2014, United States Government, as represented by the
# Administrator of the National Aeronautics and Space Administration. All
# rights reserved.
#
# The Cr... | threshold = float(domain.algorithm_params['fai_threshold']) |
<|file_name|>simple_modis_algorithms.py<|end_file_name|><|fim▁begin|># -----------------------------------------------------------------------------
# Copyright * 2014, United States Government, as represented by the
# Administrator of the National Aeronautics and Space Administration. All
# rights reserved.
#
# The Cr... | dem_threshold |
<|file_name|>simple_modis_algorithms.py<|end_file_name|><|fim▁begin|># -----------------------------------------------------------------------------
# Copyright * 2014, United States Government, as represented by the
# Administrator of the National Aeronautics and Space Administration. All
# rights reserved.
#
# The Cr... | evi |
<|file_name|>simple_modis_algorithms.py<|end_file_name|><|fim▁begin|># -----------------------------------------------------------------------------
# Copyright * 2014, United States Government, as represented by the
# Administrator of the National Aeronautics and Space Administration. All
# rights reserved.
#
# The Cr... | xiao |
<|file_name|>simple_modis_algorithms.py<|end_file_name|><|fim▁begin|># -----------------------------------------------------------------------------
# Copyright * 2014, United States Government, as represented by the
# Administrator of the National Aeronautics and Space Administration. All
# rights reserved.
#
# The Cr... | get_diff |
<|file_name|>simple_modis_algorithms.py<|end_file_name|><|fim▁begin|># -----------------------------------------------------------------------------
# Copyright * 2014, United States Government, as represented by the
# Administrator of the National Aeronautics and Space Administration. All
# rights reserved.
#
# The Cr... | diff_learned |
<|file_name|>simple_modis_algorithms.py<|end_file_name|><|fim▁begin|># -----------------------------------------------------------------------------
# Copyright * 2014, United States Government, as represented by the
# Administrator of the National Aeronautics and Space Administration. All
# rights reserved.
#
# The Cr... | modis_diff |
<|file_name|>simple_modis_algorithms.py<|end_file_name|><|fim▁begin|># -----------------------------------------------------------------------------
# Copyright * 2014, United States Government, as represented by the
# Administrator of the National Aeronautics and Space Administration. All
# rights reserved.
#
# The Cr... | get_dartmouth |
<|file_name|>simple_modis_algorithms.py<|end_file_name|><|fim▁begin|># -----------------------------------------------------------------------------
# Copyright * 2014, United States Government, as represented by the
# Administrator of the National Aeronautics and Space Administration. All
# rights reserved.
#
# The Cr... | dart_learned |
<|file_name|>simple_modis_algorithms.py<|end_file_name|><|fim▁begin|># -----------------------------------------------------------------------------
# Copyright * 2014, United States Government, as represented by the
# Administrator of the National Aeronautics and Space Administration. All
# rights reserved.
#
# The Cr... | dartmouth |
<|file_name|>simple_modis_algorithms.py<|end_file_name|><|fim▁begin|># -----------------------------------------------------------------------------
# Copyright * 2014, United States Government, as represented by the
# Administrator of the National Aeronautics and Space Administration. All
# rights reserved.
#
# The Cr... | get_mod_ndwi |
<|file_name|>simple_modis_algorithms.py<|end_file_name|><|fim▁begin|># -----------------------------------------------------------------------------
# Copyright * 2014, United States Government, as represented by the
# Administrator of the National Aeronautics and Space Administration. All
# rights reserved.
#
# The Cr... | mod_ndwi_learned |
<|file_name|>simple_modis_algorithms.py<|end_file_name|><|fim▁begin|># -----------------------------------------------------------------------------
# Copyright * 2014, United States Government, as represented by the
# Administrator of the National Aeronautics and Space Administration. All
# rights reserved.
#
# The Cr... | mod_ndwi |
<|file_name|>simple_modis_algorithms.py<|end_file_name|><|fim▁begin|># -----------------------------------------------------------------------------
# Copyright * 2014, United States Government, as represented by the
# Administrator of the National Aeronautics and Space Administration. All
# rights reserved.
#
# The Cr... | get_fai |
<|file_name|>simple_modis_algorithms.py<|end_file_name|><|fim▁begin|># -----------------------------------------------------------------------------
# Copyright * 2014, United States Government, as represented by the
# Administrator of the National Aeronautics and Space Administration. All
# rights reserved.
#
# The Cr... | fai_learned |
<|file_name|>simple_modis_algorithms.py<|end_file_name|><|fim▁begin|># -----------------------------------------------------------------------------
# Copyright * 2014, United States Government, as represented by the
# Administrator of the National Aeronautics and Space Administration. All
# rights reserved.
#
# The Cr... | fai |
<|file_name|>__manifest__.py<|end_file_name|><|fim▁begin|>##############################################################################<|fim▁hole|>#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU Affero General Public License as
# published by the Free S... | #
# Copyright (C) 2015 ADHOC SA (http://www.adhoc.com.ar)
# All Rights Reserved. |
<|file_name|>gd.py<|end_file_name|><|fim▁begin|>#!/usr/bin/env python
# -*- coding: utf-8 -*-
# Copyright (C) 2016, Jianfeng Chen <jchen37@ncsu.edu>
# vim: set ts=4 sts=4 sw=4 expandtab smartindent:
#
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated docum... | |
<|file_name|>gd.py<|end_file_name|><|fim▁begin|>#!/usr/bin/env python
# -*- coding: utf-8 -*-
# Copyright (C) 2016, Jianfeng Chen <jchen37@ncsu.edu>
# vim: set ts=4 sts=4 sw=4 expandtab smartindent:
#
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated docum... | return sum((i-j)**2 for i, j in zip(a, b)) |
<|file_name|>gd.py<|end_file_name|><|fim▁begin|>#!/usr/bin/env python
# -*- coding: utf-8 -*-
# Copyright (C) 2016, Jianfeng Chen <jchen37@ncsu.edu>
# vim: set ts=4 sts=4 sw=4 expandtab smartindent:
#
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated docum... | up = 0
for i in PFc:
up += min([dist(i, j) for j in PF0])
return up**0.5 / (len(PFc)) |
<|file_name|>gd.py<|end_file_name|><|fim▁begin|>#!/usr/bin/env python
# -*- coding: utf-8 -*-
# Copyright (C) 2016, Jianfeng Chen <jchen37@ncsu.edu>
# vim: set ts=4 sts=4 sw=4 expandtab smartindent:
#
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated docum... | dist |
<|file_name|>gd.py<|end_file_name|><|fim▁begin|>#!/usr/bin/env python
# -*- coding: utf-8 -*-
# Copyright (C) 2016, Jianfeng Chen <jchen37@ncsu.edu>
# vim: set ts=4 sts=4 sw=4 expandtab smartindent:
#
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated docum... | GD |
<|file_name|>hashivault_approle_role_get.py<|end_file_name|><|fim▁begin|>#!/usr/bin/env python
from ansible.module_utils.hashivault import hashivault_argspec
from ansible.module_utils.hashivault import hashivault_auth_client
from ansible.module_utils.hashivault import hashivault_init
from ansible.module_utils.hashivaul... | argspec['name'] = dict(required=True, type='str') |
<|file_name|>hashivault_approle_role_get.py<|end_file_name|><|fim▁begin|>#!/usr/bin/env python
from ansible.module_utils.hashivault import hashivault_argspec
from ansible.module_utils.hashivault import hashivault_auth_client
from ansible.module_utils.hashivault import hashivault_init
from ansible.module_utils.hashivaul... | argspec = hashivault_argspec()
argspec['name'] = dict(required=True, type='str')
argspec['mount_point'] = dict(required=False, type='str', default='approle')
module = hashivault_init(argspec)
result = hashivault_approle_role_get(module.params)
if result.get('failed'):
module.fail_json(**... |
<|file_name|>hashivault_approle_role_get.py<|end_file_name|><|fim▁begin|>#!/usr/bin/env python
from ansible.module_utils.hashivault import hashivault_argspec
from ansible.module_utils.hashivault import hashivault_auth_client
from ansible.module_utils.hashivault import hashivault_init
from ansible.module_utils.hashivaul... | name = params.get('name')
client = hashivault_auth_client(params)
result = client.get_role(name, mount_point=params.get('mount_point'))
return {'role': result} |
<|file_name|>hashivault_approle_role_get.py<|end_file_name|><|fim▁begin|>#!/usr/bin/env python
from ansible.module_utils.hashivault import hashivault_argspec
from ansible.module_utils.hashivault import hashivault_auth_client
from ansible.module_utils.hashivault import hashivault_init
from ansible.module_utils.hashivaul... | module.fail_json(**result) |
<|file_name|>hashivault_approle_role_get.py<|end_file_name|><|fim▁begin|>#!/usr/bin/env python
from ansible.module_utils.hashivault import hashivault_argspec
from ansible.module_utils.hashivault import hashivault_auth_client
from ansible.module_utils.hashivault import hashivault_init
from ansible.module_utils.hashivaul... | module.exit_json(**result) |
<|file_name|>hashivault_approle_role_get.py<|end_file_name|><|fim▁begin|>#!/usr/bin/env python
from ansible.module_utils.hashivault import hashivault_argspec
from ansible.module_utils.hashivault import hashivault_auth_client
from ansible.module_utils.hashivault import hashivault_init
from ansible.module_utils.hashivaul... | main() |
<|file_name|>hashivault_approle_role_get.py<|end_file_name|><|fim▁begin|>#!/usr/bin/env python
from ansible.module_utils.hashivault import hashivault_argspec
from ansible.module_utils.hashivault import hashivault_auth_client
from ansible.module_utils.hashivault import hashivault_init
from ansible.module_utils.hashivaul... | main |
<|file_name|>hashivault_approle_role_get.py<|end_file_name|><|fim▁begin|>#!/usr/bin/env python
from ansible.module_utils.hashivault import hashivault_argspec
from ansible.module_utils.hashivault import hashivault_auth_client
from ansible.module_utils.hashivault import hashivault_init
from ansible.module_utils.hashivaul... | hashivault_approle_role_get |
<|file_name|>A_evolve_outer_star_to_giant.py<|end_file_name|><|fim▁begin|>import os
import os.path
from amuse.units import units
from amuse.datamodel import Particle
from amuse.ext.star_to_sph import pickle_stellar_model
from amuse.community.mesa.interface import MESA as stellar_evolution_code
from xiTau_parameters ... | |
<|file_name|>A_evolve_outer_star_to_giant.py<|end_file_name|><|fim▁begin|>import os
import os.path
from amuse.units import units
from amuse.datamodel import Particle
from amuse.ext.star_to_sph import pickle_stellar_model
from amuse.community.mesa.interface import MESA as stellar_evolution_code
from xiTau_parameters ... | stellar_evolution = stellar_evolution_code()
giant_in_code = stellar_evolution.particles.add_particle(giant)
while (giant_in_code.radius < 0.7 | units.AU):
giant_in_code.evolve_one_step()
print "Giant starts to ascend the giant branch, now saving model every step..."
print giant_in_cod... |
<|file_name|>A_evolve_outer_star_to_giant.py<|end_file_name|><|fim▁begin|>import os
import os.path
from amuse.units import units
from amuse.datamodel import Particle
from amuse.ext.star_to_sph import pickle_stellar_model
from amuse.community.mesa.interface import MESA as stellar_evolution_code
from xiTau_parameters ... | model_directory = os.path.join("../../../../../BIGDATA/code/amuse-10.0", "giant_models")
if not os.path.exists(model_directory):
os.mkdir(model_directory)
os.chdir(model_directory)
giant = Particle(mass = triple_parameters["mass_out"])
print "\nEvolving with", stellar_evolution_cod... |
<|file_name|>A_evolve_outer_star_to_giant.py<|end_file_name|><|fim▁begin|>import os
import os.path
from amuse.units import units
from amuse.datamodel import Particle
from amuse.ext.star_to_sph import pickle_stellar_model
from amuse.community.mesa.interface import MESA as stellar_evolution_code
from xiTau_parameters ... | os.mkdir(model_directory) |
<|file_name|>A_evolve_outer_star_to_giant.py<|end_file_name|><|fim▁begin|>import os
import os.path
from amuse.units import units
from amuse.datamodel import Particle
from amuse.ext.star_to_sph import pickle_stellar_model
from amuse.community.mesa.interface import MESA as stellar_evolution_code
from xiTau_parameters ... | evolve_giant |
<|file_name|>0063_auto_20210511_2343.py<|end_file_name|><|fim▁begin|># Generated by Django 3.2 on 2021-05-11 13:43
from django.db import migrations<|fim▁hole|>
dependencies = [
('stock', '0062_auto_20210511_2151'),
]
operations = [
migrations.RemoveField(
model_name='stockitemt... |
class Migration(migrations.Migration): |
<|file_name|>0063_auto_20210511_2343.py<|end_file_name|><|fim▁begin|># Generated by Django 3.2 on 2021-05-11 13:43
from django.db import migrations
class Migration(migrations.Migration):
<|fim_middle|>
<|fim▁end|> | dependencies = [
('stock', '0062_auto_20210511_2151'),
]
operations = [
migrations.RemoveField(
model_name='stockitemtracking',
name='link',
),
migrations.RemoveField(
model_name='stockitemtracking',
name='quantity',
),... |
<|file_name|>python_editor.py<|end_file_name|><|fim▁begin|>#------------------------------------------------------------------------------
# Copyright (c) 2007, Riverbank Computing Limited
# All rights reserved.
#
# This software is provided without warranty under the terms of the BSD license.
# However, when used with... | |
<|file_name|>python_editor.py<|end_file_name|><|fim▁begin|>#------------------------------------------------------------------------------
# Copyright (c) 2007, Riverbank Computing Limited
# All rights reserved.
#
# This software is provided without warranty under the terms of the BSD license.
# However, when used with... | """ The toolkit specific implementation of a PythonEditor. See the
IPythonEditor interface for the API documentation.
"""
#### 'IPythonEditor' interface ############################################
dirty = Bool(False)
path = Unicode
show_line_numbers = Bool(True)
#### Events ####
... |
<|file_name|>python_editor.py<|end_file_name|><|fim▁begin|>#------------------------------------------------------------------------------
# Copyright (c) 2007, Riverbank Computing Limited
# All rights reserved.
#
# This software is provided without warranty under the terms of the BSD license.
# However, when used with... | super(PythonEditor, self).__init__(**traits)
self.control = self._create_control(parent) |
<|file_name|>python_editor.py<|end_file_name|><|fim▁begin|>#------------------------------------------------------------------------------
# Copyright (c) 2007, Riverbank Computing Limited
# All rights reserved.
#
# This software is provided without warranty under the terms of the BSD license.
# However, when used with... | """ Loads the contents of the editor.
"""
if path is None:
path = self.path
# We will have no path for a new script.
if len(path) > 0:
f = open(self.path, 'r')
text = f.read()
f.close()
else:
text = ''
... |
<|file_name|>python_editor.py<|end_file_name|><|fim▁begin|>#------------------------------------------------------------------------------
# Copyright (c) 2007, Riverbank Computing Limited
# All rights reserved.
#
# This software is provided without warranty under the terms of the BSD license.
# However, when used with... | """ Saves the contents of the editor.
"""
if path is None:
path = self.path
f = open(path, 'w')
f.write(self.control.code.toPlainText())
f.close()
self.dirty = False |
<|file_name|>python_editor.py<|end_file_name|><|fim▁begin|>#------------------------------------------------------------------------------
# Copyright (c) 2007, Riverbank Computing Limited
# All rights reserved.
#
# This software is provided without warranty under the terms of the BSD license.
# However, when used with... | """ Selects the specified line.
"""
self.control.code.set_line_column(lineno, 0)
self.control.code.moveCursor(QtGui.QTextCursor.EndOfLine,
QtGui.QTextCursor.KeepAnchor) |
<|file_name|>python_editor.py<|end_file_name|><|fim▁begin|>#------------------------------------------------------------------------------
# Copyright (c) 2007, Riverbank Computing Limited
# All rights reserved.
#
# This software is provided without warranty under the terms of the BSD license.
# However, when used with... | self._changed_path() |
<|file_name|>python_editor.py<|end_file_name|><|fim▁begin|>#------------------------------------------------------------------------------
# Copyright (c) 2007, Riverbank Computing Limited
# All rights reserved.
#
# This software is provided without warranty under the terms of the BSD license.
# However, when used with... | if self.control is not None:
self.control.code.line_number_widget.setVisible(
self.show_line_numbers)
self.control.code.update_line_number_width() |
<|file_name|>python_editor.py<|end_file_name|><|fim▁begin|>#------------------------------------------------------------------------------
# Copyright (c) 2007, Riverbank Computing Limited
# All rights reserved.
#
# This software is provided without warranty under the terms of the BSD license.
# However, when used with... | """ Creates the toolkit-specific control for the widget.
"""
self.control = control = AdvancedCodeWidget(parent)
self._show_line_numbers_changed()
# Install event filter to trap key presses.
event_filter = PythonEditorEventFilter(self, self.control)
self.control.... |
<|file_name|>python_editor.py<|end_file_name|><|fim▁begin|>#------------------------------------------------------------------------------
# Copyright (c) 2007, Riverbank Computing Limited
# All rights reserved.
#
# This software is provided without warranty under the terms of the BSD license.
# However, when used with... | """ Called whenever a change is made to the dirty state of the
document.
"""
self.dirty = dirty |
<|file_name|>python_editor.py<|end_file_name|><|fim▁begin|>#------------------------------------------------------------------------------
# Copyright (c) 2007, Riverbank Computing Limited
# All rights reserved.
#
# This software is provided without warranty under the terms of the BSD license.
# However, when used with... | """ Called whenever a change is made to the text of the document.
"""
self.changed = True |
<|file_name|>python_editor.py<|end_file_name|><|fim▁begin|>#------------------------------------------------------------------------------
# Copyright (c) 2007, Riverbank Computing Limited
# All rights reserved.
#
# This software is provided without warranty under the terms of the BSD license.
# However, when used with... | """ A thin wrapper around the advanced code widget to handle the key_pressed
Event.
"""
def __init__(self, editor, parent):
super(PythonEditorEventFilter, self).__init__(parent)
self.__editor = editor
def eventFilter(self, obj, event):
""" Reimplemented to trap key pres... |
<|file_name|>python_editor.py<|end_file_name|><|fim▁begin|>#------------------------------------------------------------------------------
# Copyright (c) 2007, Riverbank Computing Limited
# All rights reserved.
#
# This software is provided without warranty under the terms of the BSD license.
# However, when used with... | super(PythonEditorEventFilter, self).__init__(parent)
self.__editor = editor |
<|file_name|>python_editor.py<|end_file_name|><|fim▁begin|>#------------------------------------------------------------------------------
# Copyright (c) 2007, Riverbank Computing Limited
# All rights reserved.
#
# This software is provided without warranty under the terms of the BSD license.
# However, when used with... | """ Reimplemented to trap key presses.
"""
if self.__editor.control and obj == self.__editor.control and \
event.type() == QtCore.QEvent.FocusOut:
# Hack for Traits UI compatibility.
self.__editor.control.emit(QtCore.SIGNAL('lostFocus'))
elif self.... |
<|file_name|>python_editor.py<|end_file_name|><|fim▁begin|>#------------------------------------------------------------------------------
# Copyright (c) 2007, Riverbank Computing Limited
# All rights reserved.
#
# This software is provided without warranty under the terms of the BSD license.
# However, when used with... | path = self.path |
<|file_name|>python_editor.py<|end_file_name|><|fim▁begin|>#------------------------------------------------------------------------------
# Copyright (c) 2007, Riverbank Computing Limited
# All rights reserved.
#
# This software is provided without warranty under the terms of the BSD license.
# However, when used with... | f = open(self.path, 'r')
text = f.read()
f.close() |
<|file_name|>python_editor.py<|end_file_name|><|fim▁begin|>#------------------------------------------------------------------------------
# Copyright (c) 2007, Riverbank Computing Limited
# All rights reserved.
#
# This software is provided without warranty under the terms of the BSD license.
# However, when used with... | text = '' |
<|file_name|>python_editor.py<|end_file_name|><|fim▁begin|>#------------------------------------------------------------------------------
# Copyright (c) 2007, Riverbank Computing Limited
# All rights reserved.
#
# This software is provided without warranty under the terms of the BSD license.
# However, when used with... | path = self.path |
<|file_name|>python_editor.py<|end_file_name|><|fim▁begin|>#------------------------------------------------------------------------------
# Copyright (c) 2007, Riverbank Computing Limited
# All rights reserved.
#
# This software is provided without warranty under the terms of the BSD license.
# However, when used with... | self.control.code.line_number_widget.setVisible(
self.show_line_numbers)
self.control.code.update_line_number_width() |
<|file_name|>python_editor.py<|end_file_name|><|fim▁begin|>#------------------------------------------------------------------------------
# Copyright (c) 2007, Riverbank Computing Limited
# All rights reserved.
#
# This software is provided without warranty under the terms of the BSD license.
# However, when used with... | self.__editor.control.emit(QtCore.SIGNAL('lostFocus')) |
<|file_name|>python_editor.py<|end_file_name|><|fim▁begin|>#------------------------------------------------------------------------------
# Copyright (c) 2007, Riverbank Computing Limited
# All rights reserved.
#
# This software is provided without warranty under the terms of the BSD license.
# However, when used with... | kstr = event.text()
try:
kcode = ord(str(kstr))
except:
kcode = 0
mods = event.modifiers()
self.key_pressed = KeyPressedEvent(
alt_down = ((mods & QtCore.Qt.AltModifier) ==
Qt... |
<|file_name|>python_editor.py<|end_file_name|><|fim▁begin|>#------------------------------------------------------------------------------
# Copyright (c) 2007, Riverbank Computing Limited
# All rights reserved.
#
# This software is provided without warranty under the terms of the BSD license.
# However, when used with... | __init__ |
<|file_name|>python_editor.py<|end_file_name|><|fim▁begin|>#------------------------------------------------------------------------------
# Copyright (c) 2007, Riverbank Computing Limited
# All rights reserved.
#
# This software is provided without warranty under the terms of the BSD license.
# However, when used with... | load |
<|file_name|>python_editor.py<|end_file_name|><|fim▁begin|>#------------------------------------------------------------------------------
# Copyright (c) 2007, Riverbank Computing Limited
# All rights reserved.
#
# This software is provided without warranty under the terms of the BSD license.
# However, when used with... | save |
<|file_name|>python_editor.py<|end_file_name|><|fim▁begin|>#------------------------------------------------------------------------------
# Copyright (c) 2007, Riverbank Computing Limited
# All rights reserved.
#
# This software is provided without warranty under the terms of the BSD license.
# However, when used with... | select_line |
<|file_name|>python_editor.py<|end_file_name|><|fim▁begin|>#------------------------------------------------------------------------------
# Copyright (c) 2007, Riverbank Computing Limited
# All rights reserved.
#
# This software is provided without warranty under the terms of the BSD license.
# However, when used with... | _path_changed |
<|file_name|>python_editor.py<|end_file_name|><|fim▁begin|>#------------------------------------------------------------------------------
# Copyright (c) 2007, Riverbank Computing Limited
# All rights reserved.
#
# This software is provided without warranty under the terms of the BSD license.
# However, when used with... | _show_line_numbers_changed |
<|file_name|>python_editor.py<|end_file_name|><|fim▁begin|>#------------------------------------------------------------------------------
# Copyright (c) 2007, Riverbank Computing Limited
# All rights reserved.
#
# This software is provided without warranty under the terms of the BSD license.
# However, when used with... | _create_control |
<|file_name|>python_editor.py<|end_file_name|><|fim▁begin|>#------------------------------------------------------------------------------
# Copyright (c) 2007, Riverbank Computing Limited
# All rights reserved.
#
# This software is provided without warranty under the terms of the BSD license.
# However, when used with... | _on_dirty_changed |
<|file_name|>python_editor.py<|end_file_name|><|fim▁begin|>#------------------------------------------------------------------------------
# Copyright (c) 2007, Riverbank Computing Limited
# All rights reserved.
#
# This software is provided without warranty under the terms of the BSD license.
# However, when used with... | _on_text_changed |
<|file_name|>python_editor.py<|end_file_name|><|fim▁begin|>#------------------------------------------------------------------------------
# Copyright (c) 2007, Riverbank Computing Limited
# All rights reserved.
#
# This software is provided without warranty under the terms of the BSD license.
# However, when used with... | __init__ |
<|file_name|>python_editor.py<|end_file_name|><|fim▁begin|>#------------------------------------------------------------------------------
# Copyright (c) 2007, Riverbank Computing Limited
# All rights reserved.
#
# This software is provided without warranty under the terms of the BSD license.
# However, when used with... | eventFilter |
<|file_name|>create_attn.py<|end_file_name|><|fim▁begin|>""" Attention Factory
Hacked together by / Copyright 2021 Ross Wightman
"""
import torch
from functools import partial
from .bottleneck_attn import BottleneckAttn
from .cbam import CbamModule, LightCbamModule
from .eca import EcaModule, CecaModule
from .gather_... | |
<|file_name|>create_attn.py<|end_file_name|><|fim▁begin|>""" Attention Factory
Hacked together by / Copyright 2021 Ross Wightman
"""
import torch
from functools import partial
from .bottleneck_attn import BottleneckAttn
from .cbam import CbamModule, LightCbamModule
from .eca import EcaModule, CecaModule
from .gather_... | if isinstance(attn_type, torch.nn.Module):
return attn_type
module_cls = None
if attn_type is not None:
if isinstance(attn_type, str):
attn_type = attn_type.lower()
# Lightweight attention modules (channel and/or coarse spatial).
# Typically added to exist... |
<|file_name|>create_attn.py<|end_file_name|><|fim▁begin|>""" Attention Factory
Hacked together by / Copyright 2021 Ross Wightman
"""
import torch
from functools import partial
from .bottleneck_attn import BottleneckAttn
from .cbam import CbamModule, LightCbamModule
from .eca import EcaModule, CecaModule
from .gather_... | module_cls = get_attn(attn_type)
if module_cls is not None:
# NOTE: it's expected the first (positional) argument of all attention layers is the # input channels
return module_cls(channels, **kwargs)
return None |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.