prompt large_stringlengths 72 9.34k | completion large_stringlengths 0 7.61k |
|---|---|
<|file_name|>twist.py<|end_file_name|><|fim▁begin|>__author__ = "Harish Narayanan"
__copyright__ = "Copyright (C) 2009 Simula Research Laboratory and %s" % __author__
__license__ = "GNU GPL Version 3 or any later version"
from cbc.twist import *
from sys import argv
""" DEMO - Twisting of a hyperelastic cube """
cla... | mu = 3.8461
lmbda = Expression("x[0]*5.8 + (1 - x[0])*5.7")
C10 = 0.171; C01 = 4.89e-3; C20 = -2.4e-4; C30 = 5.e-4
delka = 1.0/sqrt(2.0)
M = Constant((0.0,1.0,0.0))
k1 = 1e2; k2 = 1e1
materials = []
materials.append(MooneyRivlin({'C1':mu/2, 'C2'... |
<|file_name|>twist.py<|end_file_name|><|fim▁begin|>__author__ = "Harish Narayanan"
__copyright__ = "Copyright (C) 2009 Simula Research Laboratory and %s" % __author__
__license__ = "GNU GPL Version 3 or any later version"
from cbc.twist import *
from sys import argv
""" DEMO - Twisting of a hyperelastic cube """
cla... | self.method = method |
<|file_name|>twist.py<|end_file_name|><|fim▁begin|>__author__ = "Harish Narayanan"
__copyright__ = "Copyright (C) 2009 Simula Research Laboratory and %s" % __author__
__license__ = "GNU GPL Version 3 or any later version"
from cbc.twist import *
from sys import argv
""" DEMO - Twisting of a hyperelastic cube """
cla... | return "A hyperelastic cube twisted by 30 degrees solved by " + self.method |
<|file_name|>twist.py<|end_file_name|><|fim▁begin|>__author__ = "Harish Narayanan"
__copyright__ = "Copyright (C) 2009 Simula Research Laboratory and %s" % __author__
__license__ = "GNU GPL Version 3 or any later version"
from cbc.twist import *
from sys import argv
""" DEMO - Twisting of a hyperelastic cube """
cla... | mesh |
<|file_name|>twist.py<|end_file_name|><|fim▁begin|>__author__ = "Harish Narayanan"
__copyright__ = "Copyright (C) 2009 Simula Research Laboratory and %s" % __author__
__license__ = "GNU GPL Version 3 or any later version"
from cbc.twist import *
from sys import argv
""" DEMO - Twisting of a hyperelastic cube """
cla... | dirichlet_values |
<|file_name|>twist.py<|end_file_name|><|fim▁begin|>__author__ = "Harish Narayanan"
__copyright__ = "Copyright (C) 2009 Simula Research Laboratory and %s" % __author__
__license__ = "GNU GPL Version 3 or any later version"
from cbc.twist import *
from sys import argv
""" DEMO - Twisting of a hyperelastic cube """
cla... | dirichlet_boundaries |
<|file_name|>twist.py<|end_file_name|><|fim▁begin|>__author__ = "Harish Narayanan"
__copyright__ = "Copyright (C) 2009 Simula Research Laboratory and %s" % __author__
__license__ = "GNU GPL Version 3 or any later version"
from cbc.twist import *
from sys import argv
""" DEMO - Twisting of a hyperelastic cube """
cla... | material_model |
<|file_name|>twist.py<|end_file_name|><|fim▁begin|>__author__ = "Harish Narayanan"
__copyright__ = "Copyright (C) 2009 Simula Research Laboratory and %s" % __author__
__license__ = "GNU GPL Version 3 or any later version"
from cbc.twist import *
from sys import argv
""" DEMO - Twisting of a hyperelastic cube """
cla... | name_method |
<|file_name|>twist.py<|end_file_name|><|fim▁begin|>__author__ = "Harish Narayanan"
__copyright__ = "Copyright (C) 2009 Simula Research Laboratory and %s" % __author__
__license__ = "GNU GPL Version 3 or any later version"
from cbc.twist import *
from sys import argv
""" DEMO - Twisting of a hyperelastic cube """
cla... | __str__ |
<|file_name|>73_Set_Matrix_Zeroes.py<|end_file_name|><|fim▁begin|>class Solution(object):
def setZeroes(self, matrix):
"""
:type matrix: List[List[int]]
:rtype: void Do not return anything, modify matrix in-place instead.
"""
width,height = len(matrix[0]),len(matrix)
... | matrix[i][j] = 0
for i in xrange(width):
foundtarget = False |
<|file_name|>73_Set_Matrix_Zeroes.py<|end_file_name|><|fim▁begin|>class Solution(object):
<|fim_middle|>
<|fim▁end|> | def setZeroes(self, matrix):
"""
:type matrix: List[List[int]]
:rtype: void Do not return anything, modify matrix in-place instead.
"""
width,height = len(matrix[0]),len(matrix)
for i in xrange(height):
foundzero = False
for j in xrange(width):... |
<|file_name|>73_Set_Matrix_Zeroes.py<|end_file_name|><|fim▁begin|>class Solution(object):
def setZeroes(self, matrix):
<|fim_middle|>
<|fim▁end|> | """
:type matrix: List[List[int]]
:rtype: void Do not return anything, modify matrix in-place instead.
"""
width,height = len(matrix[0]),len(matrix)
for i in xrange(height):
foundzero = False
for j in xrange(width):
if matrix[i][j] ... |
<|file_name|>73_Set_Matrix_Zeroes.py<|end_file_name|><|fim▁begin|>class Solution(object):
def setZeroes(self, matrix):
"""
:type matrix: List[List[int]]
:rtype: void Do not return anything, modify matrix in-place instead.
"""
width,height = len(matrix[0]),len(matrix)
... | foundzero = True
matrix[i][j] = float("inf") |
<|file_name|>73_Set_Matrix_Zeroes.py<|end_file_name|><|fim▁begin|>class Solution(object):
def setZeroes(self, matrix):
"""
:type matrix: List[List[int]]
:rtype: void Do not return anything, modify matrix in-place instead.
"""
width,height = len(matrix[0]),len(matrix)
... | continue |
<|file_name|>73_Set_Matrix_Zeroes.py<|end_file_name|><|fim▁begin|>class Solution(object):
def setZeroes(self, matrix):
"""
:type matrix: List[List[int]]
:rtype: void Do not return anything, modify matrix in-place instead.
"""
width,height = len(matrix[0]),len(matrix)
... | matrix[i][j] = 0 |
<|file_name|>73_Set_Matrix_Zeroes.py<|end_file_name|><|fim▁begin|>class Solution(object):
def setZeroes(self, matrix):
"""
:type matrix: List[List[int]]
:rtype: void Do not return anything, modify matrix in-place instead.
"""
width,height = len(matrix[0]),len(matrix)
... | foundtarget = True
break |
<|file_name|>73_Set_Matrix_Zeroes.py<|end_file_name|><|fim▁begin|>class Solution(object):
def setZeroes(self, matrix):
"""
:type matrix: List[List[int]]
:rtype: void Do not return anything, modify matrix in-place instead.
"""
width,height = len(matrix[0]),len(matrix)
... | continue |
<|file_name|>73_Set_Matrix_Zeroes.py<|end_file_name|><|fim▁begin|>class Solution(object):
def <|fim_middle|>(self, matrix):
"""
:type matrix: List[List[int]]
:rtype: void Do not return anything, modify matrix in-place instead.
"""
width,height = len(matrix[0]),len(matrix)
... | setZeroes |
<|file_name|>collector_dmidecode.py<|end_file_name|><|fim▁begin|>import os
import re
from opsbro.collector import Collector<|fim▁hole|>
# DMI have lot of useful information that detectors can use to know lot about the platform/hardware
class Dmidecode(Collector):
def launch(self):
logger = self.logger
... | |
<|file_name|>collector_dmidecode.py<|end_file_name|><|fim▁begin|>import os
import re
from opsbro.collector import Collector
# DMI have lot of useful information that detectors can use to know lot about the platform/hardware
class Dmidecode(Collector):
<|fim_middle|>
<|fim▁end|> | def launch(self):
logger = self.logger
logger.debug('getDmidecode: start')
res = {}
# Maybe we are in linux and we can directly read the
linux_dmi_path = '/sys/class/dmi/id/'
if os.path.exists(linux_dmi_path):
file_names = os.listdir(linux_dmi_pat... |
<|file_name|>collector_dmidecode.py<|end_file_name|><|fim▁begin|>import os
import re
from opsbro.collector import Collector
# DMI have lot of useful information that detectors can use to know lot about the platform/hardware
class Dmidecode(Collector):
def launch(self):
<|fim_middle|>
<|fim▁end|> | logger = self.logger
logger.debug('getDmidecode: start')
res = {}
# Maybe we are in linux and we can directly read the
linux_dmi_path = '/sys/class/dmi/id/'
if os.path.exists(linux_dmi_path):
file_names = os.listdir(linux_dmi_path)
for fna... |
<|file_name|>collector_dmidecode.py<|end_file_name|><|fim▁begin|>import os
import re
from opsbro.collector import Collector
# DMI have lot of useful information that detectors can use to know lot about the platform/hardware
class Dmidecode(Collector):
def launch(self):
logger = self.logger
logger... | file_names = os.listdir(linux_dmi_path)
for fname in file_names:
p = os.path.join(linux_dmi_path, fname)
# There can be a link there, skip them
if os.path.isfile(p):
f = open(p, 'r')
buf = f.read()
... |
<|file_name|>collector_dmidecode.py<|end_file_name|><|fim▁begin|>import os
import re
from opsbro.collector import Collector
# DMI have lot of useful information that detectors can use to know lot about the platform/hardware
class Dmidecode(Collector):
def launch(self):
logger = self.logger
logger... | f = open(p, 'r')
buf = f.read()
f.close()
res[fname] = buf.strip() |
<|file_name|>collector_dmidecode.py<|end_file_name|><|fim▁begin|>import os
import re
from opsbro.collector import Collector
# DMI have lot of useful information that detectors can use to know lot about the platform/hardware
class Dmidecode(Collector):
def launch(self):
logger = self.logger
logger... | self.set_not_eligible('Windows is currently not managed for DMI informations')
return False |
<|file_name|>collector_dmidecode.py<|end_file_name|><|fim▁begin|>import os
import re
from opsbro.collector import Collector
# DMI have lot of useful information that detectors can use to know lot about the platform/hardware
class Dmidecode(Collector):
def launch(self):
logger = self.logger
logger... | res = self.execute_shell('LANG=C dmidecode -s')
if res is False:
self.set_not_eligible('Cannot read dmi information')
return False
for p in res.split('\n'):
if re.search('^ ', p):
buf = self.execute_shell('LANG=C dmi... |
<|file_name|>collector_dmidecode.py<|end_file_name|><|fim▁begin|>import os
import re
from opsbro.collector import Collector
# DMI have lot of useful information that detectors can use to know lot about the platform/hardware
class Dmidecode(Collector):
def launch(self):
logger = self.logger
logger... | self.set_not_eligible('Cannot read dmi information')
return False |
<|file_name|>collector_dmidecode.py<|end_file_name|><|fim▁begin|>import os
import re
from opsbro.collector import Collector
# DMI have lot of useful information that detectors can use to know lot about the platform/hardware
class Dmidecode(Collector):
def launch(self):
logger = self.logger
logger... | buf = self.execute_shell('LANG=C dmidecode -s %s' % p).strip()
if 'No such file or directory' in buf:
logger.warning('Cannot access to dmi information with dmidecode command, exiting this collector.')
self.set_not_eligible('Cannot g... |
<|file_name|>collector_dmidecode.py<|end_file_name|><|fim▁begin|>import os
import re
from opsbro.collector import Collector
# DMI have lot of useful information that detectors can use to know lot about the platform/hardware
class Dmidecode(Collector):
def launch(self):
logger = self.logger
logger... | logger.warning('Cannot access to dmi information with dmidecode command, exiting this collector.')
self.set_not_eligible('Cannot get DMI informations because the dmidecode command is missing.')
return res |
<|file_name|>collector_dmidecode.py<|end_file_name|><|fim▁begin|>import os
import re
from opsbro.collector import Collector
# DMI have lot of useful information that detectors can use to know lot about the platform/hardware
class Dmidecode(Collector):
def <|fim_middle|>(self):
logger = self.logger
... | launch |
<|file_name|>retorno.py<|end_file_name|><|fim▁begin|># -*- coding: utf-8 -*-
from django.db import models
from Corretor.base import CorretorException
from Corretor.base import ExecutorException
from Corretor.base import CompiladorException
from Corretor.base import ComparadorException
from Corretor.base import LockExc... | return "%s: %s" %(self.TIPOS[self.tipo][1],self.msg)
def altera_dados(self,sucesso=True,erroException=None): |
<|file_name|>retorno.py<|end_file_name|><|fim▁begin|># -*- coding: utf-8 -*-
from django.db import models
from Corretor.base import CorretorException
from Corretor.base import ExecutorException
from Corretor.base import CompiladorException
from Corretor.base import ComparadorException
from Corretor.base import LockExc... | """Um modelo que possui informacoes sobre o retorno da correcao de uma questao(ou questao de avaliacao).
"""
TIPOS = Choices(
(0,'loading',u'Loading'),
(1,'compilacao',u'Compilação'),
(2,'execucao',u'Execução'),
(3,'... |
<|file_name|>retorno.py<|end_file_name|><|fim▁begin|># -*- coding: utf-8 -*-
from django.db import models
from Corretor.base import CorretorException
from Corretor.base import ExecutorException
from Corretor.base import CompiladorException
from Corretor.base import ComparadorException
from Corretor.base import LockExc... | e_name = u'Retorno Correção'
app_label = 'Corretor'
d |
<|file_name|>retorno.py<|end_file_name|><|fim▁begin|># -*- coding: utf-8 -*-
from django.db import models
from Corretor.base import CorretorException
from Corretor.base import ExecutorException
from Corretor.base import CompiladorException
from Corretor.base import ComparadorException
from Corretor.base import LockExc... | %s: %s" %(self.TIPOS[self.tipo][1],self.msg)
de |
<|file_name|>retorno.py<|end_file_name|><|fim▁begin|># -*- coding: utf-8 -*-
from django.db import models
from Corretor.base import CorretorException
from Corretor.base import ExecutorException
from Corretor.base import CompiladorException
from Corretor.base import ComparadorException
from Corretor.base import LockExc... | Altera os dados do retorno atual para pegar os dados de erro ou para por a mensagem
que foi com sucesso.
"""
tipo = RetornoCorrecao.TIPOS.correto
correcao_msg = "Correto!"
# print ">>altera_dados"
# print ">>isinstance(erroException,CorretorException)",isinst... |
<|file_name|>retorno.py<|end_file_name|><|fim▁begin|># -*- coding: utf-8 -*-
from django.db import models
from Corretor.base import CorretorException
from Corretor.base import ExecutorException
from Corretor.base import CompiladorException
from Corretor.base import ComparadorException
from Corretor.base import LockExc... | etornoCorrecao.TIPOS.correto
correcao_msg = "Correto!"
|
<|file_name|>retorno.py<|end_file_name|><|fim▁begin|># -*- coding: utf-8 -*-
from django.db import models
from Corretor.base import CorretorException
from Corretor.base import ExecutorException
from Corretor.base import CompiladorException
from Corretor.base import ComparadorException
from Corretor.base import LockExc... | tance(erroException,ExecutorException):
correcao_msg = erroException.message
tipo = RetornoCorrecao.TIPOS.execucao
if isinstance(erroException,CompiladorException):
correcao_msg = erroException.message
tipo = RetornoCorrecao.TIPOS.c... |
<|file_name|>retorno.py<|end_file_name|><|fim▁begin|># -*- coding: utf-8 -*-
from django.db import models
from Corretor.base import CorretorException
from Corretor.base import ExecutorException
from Corretor.base import CompiladorException
from Corretor.base import ComparadorException
from Corretor.base import LockExc... | _msg = erroException.message
tipo = RetornoCorrecao.TIPOS.execucao
|
<|file_name|>retorno.py<|end_file_name|><|fim▁begin|># -*- coding: utf-8 -*-
from django.db import models
from Corretor.base import CorretorException
from Corretor.base import ExecutorException
from Corretor.base import CompiladorException
from Corretor.base import ComparadorException
from Corretor.base import LockExc... | _msg = erroException.message
tipo = RetornoCorrecao.TIPOS.compilacao
|
<|file_name|>retorno.py<|end_file_name|><|fim▁begin|># -*- coding: utf-8 -*-
from django.db import models
from Corretor.base import CorretorException
from Corretor.base import ExecutorException
from Corretor.base import CompiladorException
from Corretor.base import ComparadorException
from Corretor.base import LockExc... | _msg = erroException.message
tipo = RetornoCorrecao.TIPOS.comparacao
|
<|file_name|>retorno.py<|end_file_name|><|fim▁begin|># -*- coding: utf-8 -*-
from django.db import models
from Corretor.base import CorretorException
from Corretor.base import ExecutorException
from Corretor.base import CompiladorException
from Corretor.base import ComparadorException
from Corretor.base import LockExc... | _msg = erroException.message
tipo = RetornoCorrecao.TIPOS.lock
|
<|file_name|>retorno.py<|end_file_name|><|fim▁begin|># -*- coding: utf-8 -*-
from django.db import models
from Corretor.base import CorretorException
from Corretor.base import ExecutorException
from Corretor.base import CompiladorException
from Corretor.base import ComparadorException
from Corretor.base import LockExc... | e__(self):
|
<|file_name|>retorno.py<|end_file_name|><|fim▁begin|># -*- coding: utf-8 -*-
from django.db import models
from Corretor.base import CorretorException
from Corretor.base import ExecutorException
from Corretor.base import CompiladorException
from Corretor.base import ComparadorException
from Corretor.base import LockExc... | ados(self,su |
<|file_name|>views.py<|end_file_name|><|fim▁begin|>"""
Views for contract feature
"""
import logging
from edxmako.shortcuts import render_to_response
from django.contrib.auth.models import User
from django.contrib.auth import authenticate, login
from django.shortcuts import redirect
from django.core.urlresolvers import... | return render_to_response('gx_login/login.html', {'account_check': account_check, 'next_url': next_url, 'email': post_email})
|
<|file_name|>views.py<|end_file_name|><|fim▁begin|>"""
Views for contract feature
"""
import logging
from edxmako.shortcuts import render_to_response
from django.contrib.auth.models import User
from django.contrib.auth import authenticate, login
from django.shortcuts import redirect
from django.core.urlresolvers import... | """
lists content of Login
"""
next_url = request.GET.get('next', '')
if request.user.is_active:
if request.user.is_authenticated():
if next_url == '':
return redirect(reverse('biz:index'))
else:
return redirect(next_url)
account_... |
<|file_name|>views.py<|end_file_name|><|fim▁begin|>"""
Views for contract feature
"""
import logging
from edxmako.shortcuts import render_to_response
from django.contrib.auth.models import User
from django.contrib.auth import authenticate, login
from django.shortcuts import redirect
from django.core.urlresolvers import... | if request.user.is_authenticated():
if next_url == '':
return redirect(reverse('biz:index'))
else:
return redirect(next_url) |
<|file_name|>views.py<|end_file_name|><|fim▁begin|>"""
Views for contract feature
"""
import logging
from edxmako.shortcuts import render_to_response
from django.contrib.auth.models import User
from django.contrib.auth import authenticate, login
from django.shortcuts import redirect
from django.core.urlresolvers import... | if next_url == '':
return redirect(reverse('biz:index'))
else:
return redirect(next_url) |
<|file_name|>views.py<|end_file_name|><|fim▁begin|>"""
Views for contract feature
"""
import logging
from edxmako.shortcuts import render_to_response
from django.contrib.auth.models import User
from django.contrib.auth import authenticate, login
from django.shortcuts import redirect
from django.core.urlresolvers import... | return redirect(reverse('biz:index')) |
<|file_name|>views.py<|end_file_name|><|fim▁begin|>"""
Views for contract feature
"""
import logging
from edxmako.shortcuts import render_to_response
from django.contrib.auth.models import User
from django.contrib.auth import authenticate, login
from django.shortcuts import redirect
from django.core.urlresolvers import... | return redirect(next_url) |
<|file_name|>views.py<|end_file_name|><|fim▁begin|>"""
Views for contract feature
"""
import logging
from edxmako.shortcuts import render_to_response
from django.contrib.auth.models import User
from django.contrib.auth import authenticate, login
from django.shortcuts import redirect
from django.core.urlresolvers import... | next_url = request.POST.get("next", '')
if "remember" in request.POST:
post_remember = True
if not 0 < len(post_email) <= 255:
log.info('Login failed - email length over')
account_check = LOGIN_ERROR
if not 0 < len(post_password) <= 255:
lo... |
<|file_name|>views.py<|end_file_name|><|fim▁begin|>"""
Views for contract feature
"""
import logging
from edxmako.shortcuts import render_to_response
from django.contrib.auth.models import User
from django.contrib.auth import authenticate, login
from django.shortcuts import redirect
from django.core.urlresolvers import... | post_remember = True |
<|file_name|>views.py<|end_file_name|><|fim▁begin|>"""
Views for contract feature
"""
import logging
from edxmako.shortcuts import render_to_response
from django.contrib.auth.models import User
from django.contrib.auth import authenticate, login
from django.shortcuts import redirect
from django.core.urlresolvers import... | log.info('Login failed - email length over')
account_check = LOGIN_ERROR |
<|file_name|>views.py<|end_file_name|><|fim▁begin|>"""
Views for contract feature
"""
import logging
from edxmako.shortcuts import render_to_response
from django.contrib.auth.models import User
from django.contrib.auth import authenticate, login
from django.shortcuts import redirect
from django.core.urlresolvers import... | log.info('Login failed - password length over')
account_check = LOGIN_ERROR |
<|file_name|>views.py<|end_file_name|><|fim▁begin|>"""
Views for contract feature
"""
import logging
from edxmako.shortcuts import render_to_response
from django.contrib.auth.models import User
from django.contrib.auth import authenticate, login
from django.shortcuts import redirect
from django.core.urlresolvers import... | user = User.objects.get(email=post_email, is_active=True) |
<|file_name|>views.py<|end_file_name|><|fim▁begin|>"""
Views for contract feature
"""
import logging
from edxmako.shortcuts import render_to_response
from django.contrib.auth.models import User
from django.contrib.auth import authenticate, login
from django.shortcuts import redirect
from django.core.urlresolvers import... | log.info("Login failed - password for {0} is invalid".format(post_email))
account_check = LOGIN_ERROR |
<|file_name|>views.py<|end_file_name|><|fim▁begin|>"""
Views for contract feature
"""
import logging
from edxmako.shortcuts import render_to_response
from django.contrib.auth.models import User
from django.contrib.auth import authenticate, login
from django.shortcuts import redirect
from django.core.urlresolvers import... | return render_to_response('gx_login/login.html', {'account_check': account_check, 'next_url': next_url, 'email': post_email}) |
<|file_name|>views.py<|end_file_name|><|fim▁begin|>"""
Views for contract feature
"""
import logging
from edxmako.shortcuts import render_to_response
from django.contrib.auth.models import User
from django.contrib.auth import authenticate, login
from django.shortcuts import redirect
from django.core.urlresolvers import... | mgs = Manager.get_managers(user)
if any([mg.is_aggregator() for mg in mgs]):
account_check = LOGIN_ADMIN
if any([mg.is_director() for mg in mgs]):
account_check = LOGIN_ADMIN
if any([mg.is_manager() for mg in mgs]):
account_... |
<|file_name|>views.py<|end_file_name|><|fim▁begin|>"""
Views for contract feature
"""
import logging
from edxmako.shortcuts import render_to_response
from django.contrib.auth.models import User
from django.contrib.auth import authenticate, login
from django.shortcuts import redirect
from django.core.urlresolvers import... | account_check = LOGIN_ADMIN |
<|file_name|>views.py<|end_file_name|><|fim▁begin|>"""
Views for contract feature
"""
import logging
from edxmako.shortcuts import render_to_response
from django.contrib.auth.models import User
from django.contrib.auth import authenticate, login
from django.shortcuts import redirect
from django.core.urlresolvers import... | account_check = LOGIN_ADMIN |
<|file_name|>views.py<|end_file_name|><|fim▁begin|>"""
Views for contract feature
"""
import logging
from edxmako.shortcuts import render_to_response
from django.contrib.auth.models import User
from django.contrib.auth import authenticate, login
from django.shortcuts import redirect
from django.core.urlresolvers import... | account_check = LOGIN_ADMIN |
<|file_name|>views.py<|end_file_name|><|fim▁begin|>"""
Views for contract feature
"""
import logging
from edxmako.shortcuts import render_to_response
from django.contrib.auth.models import User
from django.contrib.auth import authenticate, login
from django.shortcuts import redirect
from django.core.urlresolvers import... | account_check = LOGIN_ADMIN |
<|file_name|>views.py<|end_file_name|><|fim▁begin|>"""
Views for contract feature
"""
import logging
from edxmako.shortcuts import render_to_response
from django.contrib.auth.models import User
from django.contrib.auth import authenticate, login
from django.shortcuts import redirect
from django.core.urlresolvers import... | user = authenticate(username=user.username, password=post_password)
login(request, user)
if post_remember:
# Session Retention 7 days
request.session.set_expiry(604800)
else:
request.session.set_e... |
<|file_name|>views.py<|end_file_name|><|fim▁begin|>"""
Views for contract feature
"""
import logging
from edxmako.shortcuts import render_to_response
from django.contrib.auth.models import User
from django.contrib.auth import authenticate, login
from django.shortcuts import redirect
from django.core.urlresolvers import... | request.session.set_expiry(604800) |
<|file_name|>views.py<|end_file_name|><|fim▁begin|>"""
Views for contract feature
"""
import logging
from edxmako.shortcuts import render_to_response
from django.contrib.auth.models import User
from django.contrib.auth import authenticate, login
from django.shortcuts import redirect
from django.core.urlresolvers import... | request.session.set_expiry(0) |
<|file_name|>views.py<|end_file_name|><|fim▁begin|>"""
Views for contract feature
"""
import logging
from edxmako.shortcuts import render_to_response
from django.contrib.auth.models import User
from django.contrib.auth import authenticate, login
from django.shortcuts import redirect
from django.core.urlresolvers import... | return redirect(reverse('biz:index')) |
<|file_name|>views.py<|end_file_name|><|fim▁begin|>"""
Views for contract feature
"""
import logging
from edxmako.shortcuts import render_to_response
from django.contrib.auth.models import User
from django.contrib.auth import authenticate, login
from django.shortcuts import redirect
from django.core.urlresolvers import... | return redirect(next_url) |
<|file_name|>views.py<|end_file_name|><|fim▁begin|>"""
Views for contract feature
"""
import logging
from edxmako.shortcuts import render_to_response
from django.contrib.auth.models import User
from django.contrib.auth import authenticate, login
from django.shortcuts import redirect
from django.core.urlresolvers import... | account_check = LOGIN_ERROR_AUTH |
<|file_name|>views.py<|end_file_name|><|fim▁begin|>"""
Views for contract feature
"""
import logging
from edxmako.shortcuts import render_to_response
from django.contrib.auth.models import User
from django.contrib.auth import authenticate, login
from django.shortcuts import redirect
from django.core.urlresolvers import... | log.info('Login failed - password mismatch')
account_check = LOGIN_ERROR |
<|file_name|>views.py<|end_file_name|><|fim▁begin|>"""
Views for contract feature
"""
import logging
from edxmako.shortcuts import render_to_response
from django.contrib.auth.models import User
from django.contrib.auth import authenticate, login
from django.shortcuts import redirect
from django.core.urlresolvers import... | index |
<|file_name|>chatroomServer.py<|end_file_name|><|fim▁begin|>import socket
import threading
import time
def tcplink(sock, addr):
print 'Accept new connection from %s:%s...' % addr
sock.send('Welcome!')
while True:
data = sock.recv(1024)
time.sleep(1)
if data == 'exit' or no... | |
<|file_name|>chatroomServer.py<|end_file_name|><|fim▁begin|>import socket
import threading
import time
def tcplink(sock, addr):
<|fim_middle|>
s = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
s.bind(('127.0.0.1', 8888))
s.listen(5)
print 'Waiting for connection...'
while True:
sock, addr =... | print 'Accept new connection from %s:%s...' % addr
sock.send('Welcome!')
while True:
data = sock.recv(1024)
time.sleep(1)
if data == 'exit' or not data:
break
sock.send('Hello, %s!' % data)
sock.close()
print 'Connection from %s:%s closed.' % addr |
<|file_name|>chatroomServer.py<|end_file_name|><|fim▁begin|>import socket
import threading
import time
def tcplink(sock, addr):
print 'Accept new connection from %s:%s...' % addr
sock.send('Welcome!')
while True:
data = sock.recv(1024)
time.sleep(1)
if data == 'exit' or no... | break |
<|file_name|>chatroomServer.py<|end_file_name|><|fim▁begin|>import socket
import threading
import time
def <|fim_middle|>(sock, addr):
print 'Accept new connection from %s:%s...' % addr
sock.send('Welcome!')
while True:
data = sock.recv(1024)
time.sleep(1)
if data == 'exit... | tcplink |
<|file_name|>utils.py<|end_file_name|><|fim▁begin|>#!/usr/bin/env python
##############################################
#
# This module contains some utilities
#
##############################################
class argpasser(object):
"""
ComEst use the arguments that are almost repeatedly. Therefore, it wil... | self.ncpu = int(ncpu)
|
<|file_name|>utils.py<|end_file_name|><|fim▁begin|>#!/usr/bin/env python
##############################################
#
# This module contains some utilities
#
##############################################
class argpasser(object):
<|fim_middle|>
<|fim▁end|> | """
ComEst use the arguments that are almost repeatedly. Therefore, it will be useful to create a customized arguemnt passer like this.
"""
def __init__(self,
stamp_size_arcsec = 20.0,
mag_dict = {"lo":20.0, "hi":25.0 },
hlr_dict =... |
<|file_name|>utils.py<|end_file_name|><|fim▁begin|>#!/usr/bin/env python
##############################################
#
# This module contains some utilities
#
##############################################
class argpasser(object):
"""
ComEst use the arguments that are almost repeatedly. Therefore, it wil... | """
:param stamp_size_arcsec: The size of the stamp of each simulated source by **GalSim**. The stamp is with the size of ``stamp_size_arcsec`` x ``stamp_size_arcsec`` (``stamp_size_arcsec`` in arcsec) where the **GalSim** will simulate one single source on. By default, it is ``stamp_size_arcsec = 15.0`... |
<|file_name|>utils.py<|end_file_name|><|fim▁begin|>#!/usr/bin/env python
##############################################
#
# This module contains some utilities
#
##############################################
class argpasser(object):
"""
ComEst use the arguments that are almost repeatedly. Therefore, it wil... | """
"""
print "#", "stamp_size_arcsec:", self.stamp_size_arcsec
print "#", "mag_dict:", self.mag_dict
print "#", "hlr_dict:", self.hlr_dict
print "#", "fbulge_dict:", self.fbulge_dict
print "#", "q_dict:", self.q_dict
print "#", "pos_ang_dict:", self.pos_a... |
<|file_name|>utils.py<|end_file_name|><|fim▁begin|>#!/usr/bin/env python
##############################################
#
# This module contains some utilities
#
##############################################
class argpasser(object):
"""
ComEst use the arguments that are almost repeatedly. Therefore, it wil... | __init__ |
<|file_name|>utils.py<|end_file_name|><|fim▁begin|>#!/usr/bin/env python
##############################################
#
# This module contains some utilities
#
##############################################
class argpasser(object):
"""
ComEst use the arguments that are almost repeatedly. Therefore, it wil... | i_am |
<|file_name|>generate_bnmf.py<|end_file_name|><|fim▁begin|>"""
Generate a toy dataset for the matrix factorisation case, and store it.
We use dimensions 100 by 50 for the dataset, and 10 latent factors.
As the prior for U and V we take value 1 for all entries (so exp 1).
As a result, each value in R has a value of a... | # Store all matrices in text files
numpy.savetxt(open(output_folder+"U.txt",'w'),U) |
<|file_name|>generate_bnmf.py<|end_file_name|><|fim▁begin|>"""
Generate a toy dataset for the matrix factorisation case, and store it.
We use dimensions 100 by 50 for the dataset, and 10 latent factors.
As the prior for U and V we take value 1 for all entries (so exp 1).
As a result, each value in R has a value of a... | U = numpy.zeros((I,K))
for i,k in itertools.product(xrange(0,I),xrange(0,K)):
U[i,k] = exponential_draw(lambdaU[i,k])
V = numpy.zeros((J,K))
for j,k in itertools.product(xrange(0,J),xrange(0,K)):
V[j,k] = exponential_draw(lambdaV[j,k])
# Generate R
true_R = numpy.dot(U,V.T)
... |
<|file_name|>generate_bnmf.py<|end_file_name|><|fim▁begin|>"""
Generate a toy dataset for the matrix factorisation case, and store it.
We use dimensions 100 by 50 for the dataset, and 10 latent factors.
As the prior for U and V we take value 1 for all entries (so exp 1).
As a result, each value in R has a value of a... | if numpy.isinf(tau):
return numpy.copy(true_R)
(I,J) = true_R.shape
R = numpy.zeros((I,J))
for i,j in itertools.product(xrange(0,I),xrange(0,J)):
R[i,j] = normal_draw(true_R[i,j],tau)
return R |
<|file_name|>generate_bnmf.py<|end_file_name|><|fim▁begin|>"""
Generate a toy dataset for the matrix factorisation case, and store it.
We use dimensions 100 by 50 for the dataset, and 10 latent factors.
As the prior for U and V we take value 1 for all entries (so exp 1).
As a result, each value in R has a value of a... | for attempt in range(1,attempts+1):
try:
M = generate_M(I,J,fraction_unknown)
sums_columns = M.sum(axis=0)
sums_rows = M.sum(axis=1)
for i,c in enumerate(sums_rows):
assert c != 0, "Fully unobserved row in M, row %s. Fraction %s." % (i,fraction... |
<|file_name|>generate_bnmf.py<|end_file_name|><|fim▁begin|>"""
Generate a toy dataset for the matrix factorisation case, and store it.
We use dimensions 100 by 50 for the dataset, and 10 latent factors.
As the prior for U and V we take value 1 for all entries (so exp 1).
As a result, each value in R has a value of a... | return numpy.copy(true_R) |
<|file_name|>generate_bnmf.py<|end_file_name|><|fim▁begin|>"""
Generate a toy dataset for the matrix factorisation case, and store it.
We use dimensions 100 by 50 for the dataset, and 10 latent factors.
As the prior for U and V we take value 1 for all entries (so exp 1).
As a result, each value in R has a value of a... | output_folder = project_location+"BNMTF/data_toy/bnmf/"
I,J,K = 100, 80, 10 #20, 10, 5 #
fraction_unknown = 0.1
alpha, beta = 1., 1.
lambdaU = numpy.ones((I,K))
lambdaV = numpy.ones((I,K))
tau = alpha / beta
(U,V,tau,true_R,R) = generate_dataset(I,J,K,lambdaU,lambdaV,tau)
... |
<|file_name|>generate_bnmf.py<|end_file_name|><|fim▁begin|>"""
Generate a toy dataset for the matrix factorisation case, and store it.
We use dimensions 100 by 50 for the dataset, and 10 latent factors.
As the prior for U and V we take value 1 for all entries (so exp 1).
As a result, each value in R has a value of a... | generate_dataset |
<|file_name|>generate_bnmf.py<|end_file_name|><|fim▁begin|>"""
Generate a toy dataset for the matrix factorisation case, and store it.
We use dimensions 100 by 50 for the dataset, and 10 latent factors.
As the prior for U and V we take value 1 for all entries (so exp 1).
As a result, each value in R has a value of a... | add_noise |
<|file_name|>generate_bnmf.py<|end_file_name|><|fim▁begin|>"""
Generate a toy dataset for the matrix factorisation case, and store it.
We use dimensions 100 by 50 for the dataset, and 10 latent factors.
As the prior for U and V we take value 1 for all entries (so exp 1).
As a result, each value in R has a value of a... | try_generate_M |
<|file_name|>test_bea.py<|end_file_name|><|fim▁begin|># -*- coding: utf-8 -*-
import io
import os
from dlstats.fetchers.bea import BEA as Fetcher
import httpretty
from dlstats.tests.base import RESOURCES_DIR as BASE_RESOURCES_DIR
from dlstats.tests.fetchers.base import BaseFetcherTestCase
import unittest
from unit... | |
<|file_name|>test_bea.py<|end_file_name|><|fim▁begin|># -*- coding: utf-8 -*-
import io
import os
from dlstats.fetchers.bea import BEA as Fetcher
import httpretty
from dlstats.tests.base import RESOURCES_DIR as BASE_RESOURCES_DIR
from dlstats.tests.fetchers.base import BaseFetcherTestCase
import unittest
from unit... | return {
"nipa-section1-10101-a": {
'dataset_code': 'nipa-section1-10101-a',
'name': 'Table 1.1.1. Percent Change From Preceding Period in Real Gross Domestic Product - Annually',
'last_update': None,
'metadata': {
'filename': 'nipa-section1.x... |
<|file_name|>test_bea.py<|end_file_name|><|fim▁begin|># -*- coding: utf-8 -*-
import io
import os
from dlstats.fetchers.bea import BEA as Fetcher
import httpretty
from dlstats.tests.base import RESOURCES_DIR as BASE_RESOURCES_DIR
from dlstats.tests.fetchers.base import BaseFetcherTestCase
import unittest
from unit... | FETCHER_KLASS = Fetcher
DATASETS = {
'nipa-section1-10101-a': DATA_BEA_10101_An
}
DATASET_FIRST = "nipa-fa2004-section1-101-a"
DATASET_LAST = "nipa-underlying-section9-90500U-a"
DEBUG_MODE = False
def _load_files(self, dataset_code):
url = "http://www.bea.gov/natio... |
<|file_name|>test_bea.py<|end_file_name|><|fim▁begin|># -*- coding: utf-8 -*-
import io
import os
from dlstats.fetchers.bea import BEA as Fetcher
import httpretty
from dlstats.tests.base import RESOURCES_DIR as BASE_RESOURCES_DIR
from dlstats.tests.fetchers.base import BaseFetcherTestCase
import unittest
from unit... | url = "http://www.bea.gov/national/nipaweb/GetCSV.asp?GetWhat=SS_Data/Section1All_xls.zip&Section=2"
self.register_url(url,
self.DATASETS[dataset_code]["filepath"]) |
<|file_name|>test_bea.py<|end_file_name|><|fim▁begin|># -*- coding: utf-8 -*-
import io
import os
from dlstats.fetchers.bea import BEA as Fetcher
import httpretty
from dlstats.tests.base import RESOURCES_DIR as BASE_RESOURCES_DIR
from dlstats.tests.fetchers.base import BaseFetcherTestCase
import unittest
from unit... | dataset_code = "nipa-section1-10101-a"
self._load_files(dataset_code)
self.assertLoadDatasetsFirst([dataset_code]) |
<|file_name|>test_bea.py<|end_file_name|><|fim▁begin|># -*- coding: utf-8 -*-
import io
import os
from dlstats.fetchers.bea import BEA as Fetcher
import httpretty
from dlstats.tests.base import RESOURCES_DIR as BASE_RESOURCES_DIR
from dlstats.tests.fetchers.base import BaseFetcherTestCase
import unittest
from unit... | dataset_code = "nipa-section1-10101-a"
self._load_files(dataset_code)
self.assertLoadDatasetsUpdate([dataset_code]) |
<|file_name|>test_bea.py<|end_file_name|><|fim▁begin|># -*- coding: utf-8 -*-
import io
import os
from dlstats.fetchers.bea import BEA as Fetcher
import httpretty
from dlstats.tests.base import RESOURCES_DIR as BASE_RESOURCES_DIR
from dlstats.tests.fetchers.base import BaseFetcherTestCase
import unittest
from unit... | dataset_code = "nipa-section1-10101-a"
self.assertDataTree(dataset_code) |
<|file_name|>test_bea.py<|end_file_name|><|fim▁begin|># -*- coding: utf-8 -*-
import io
import os
from dlstats.fetchers.bea import BEA as Fetcher
import httpretty
from dlstats.tests.base import RESOURCES_DIR as BASE_RESOURCES_DIR
from dlstats.tests.fetchers.base import BaseFetcherTestCase
import unittest
from unit... | dataset_code = "nipa-section1-10101-a"
self._load_files(dataset_code)
self.assertProvider()
dataset = self.assertDataset(dataset_code)
names = {
'a191rl1': 'Gross domestic product',
'dpcerl1': 'Personal consumption expenditures',
'dgdsrl1... |
<|file_name|>test_bea.py<|end_file_name|><|fim▁begin|># -*- coding: utf-8 -*-
import io
import os
from dlstats.fetchers.bea import BEA as Fetcher
import httpretty
from dlstats.tests.base import RESOURCES_DIR as BASE_RESOURCES_DIR
from dlstats.tests.fetchers.base import BaseFetcherTestCase
import unittest
from unit... | _get_datasets_settings |
<|file_name|>test_bea.py<|end_file_name|><|fim▁begin|># -*- coding: utf-8 -*-
import io
import os
from dlstats.fetchers.bea import BEA as Fetcher
import httpretty
from dlstats.tests.base import RESOURCES_DIR as BASE_RESOURCES_DIR
from dlstats.tests.fetchers.base import BaseFetcherTestCase
import unittest
from unit... | _load_files |
<|file_name|>test_bea.py<|end_file_name|><|fim▁begin|># -*- coding: utf-8 -*-
import io
import os
from dlstats.fetchers.bea import BEA as Fetcher
import httpretty
from dlstats.tests.base import RESOURCES_DIR as BASE_RESOURCES_DIR
from dlstats.tests.fetchers.base import BaseFetcherTestCase
import unittest
from unit... | test_load_datasets_first |
<|file_name|>test_bea.py<|end_file_name|><|fim▁begin|># -*- coding: utf-8 -*-
import io
import os
from dlstats.fetchers.bea import BEA as Fetcher
import httpretty
from dlstats.tests.base import RESOURCES_DIR as BASE_RESOURCES_DIR
from dlstats.tests.fetchers.base import BaseFetcherTestCase
import unittest
from unit... | test_load_datasets_update |
<|file_name|>test_bea.py<|end_file_name|><|fim▁begin|># -*- coding: utf-8 -*-
import io
import os
from dlstats.fetchers.bea import BEA as Fetcher
import httpretty
from dlstats.tests.base import RESOURCES_DIR as BASE_RESOURCES_DIR
from dlstats.tests.fetchers.base import BaseFetcherTestCase
import unittest
from unit... | test_build_data_tree |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.