prompt
large_stringlengths
72
9.34k
completion
large_stringlengths
0
7.61k
<|file_name|>compute_user_popularity.py<|end_file_name|><|fim▁begin|># -*- coding: utf-8 -*- # compute the times of action(rec|click|msg) for each user from math import sqrt def getActionScore(action): <|fim_middle|> def compute_interaction(data): interaction = {} for line in data: (userA,userB,t...
if action == "rec": return 0 elif action == "click" : return 1 else: return 2
<|file_name|>compute_user_popularity.py<|end_file_name|><|fim▁begin|># -*- coding: utf-8 -*- # compute the times of action(rec|click|msg) for each user from math import sqrt def getActionScore(action): if action == "rec": return 0 elif action == "click" : return 1 else: return 2 def co...
interaction = {} for line in data: (userA,userB,times,action) = line.split(' ') action = action[:-1] key = userB + " " + action interaction.setdefault(key, 0) interaction[key] += 1 return interaction
<|file_name|>compute_user_popularity.py<|end_file_name|><|fim▁begin|># -*- coding: utf-8 -*- # compute the times of action(rec|click|msg) for each user from math import sqrt def getActionScore(action): if action == "rec": return 0 elif action == "click" : return 1 else: return 2 def co...
records = [] lineList = [] lineNum = 1 result = [] lineList = [line for line in file(trainFile)] for line in lineList: if lineNum == 1: #ignore the title in first line lineNum += 1 continue records.append(line) lineNum += 1 interaction = compute_interaction(records) out =...
<|file_name|>compute_user_popularity.py<|end_file_name|><|fim▁begin|># -*- coding: utf-8 -*- # compute the times of action(rec|click|msg) for each user from math import sqrt def getActionScore(action): if action == "rec": return 0 elif action == "click" : return 1 else: return 2 def co...
pop = 0; if action == "rec": pop = 1 elif action == "click": pop = 10 elif action == "msg": pop = 100 return pop;
<|file_name|>compute_user_popularity.py<|end_file_name|><|fim▁begin|># -*- coding: utf-8 -*- # compute the times of action(rec|click|msg) for each user from math import sqrt def getActionScore(action): if action == "rec": return 0 elif action == "click" : return 1 else: return 2 def co...
popDict = {} rankedscores = [] result = [] print "-----compute_user_history_interaction ... " interaction = compute_user_history_interaction(trainFile) print "-----compute_user_popularity ... " for (user, action, times) in interaction[0:len(interaction)]: popDict.setdefault(user, 0) po...
<|file_name|>compute_user_popularity.py<|end_file_name|><|fim▁begin|># -*- coding: utf-8 -*- # compute the times of action(rec|click|msg) for each user from math import sqrt def getActionScore(action): if action == "rec": <|fim_middle|> elif action == "click" : return 1 else: return...
return 0
<|file_name|>compute_user_popularity.py<|end_file_name|><|fim▁begin|># -*- coding: utf-8 -*- # compute the times of action(rec|click|msg) for each user from math import sqrt def getActionScore(action): if action == "rec": return 0 elif action == "click" : <|fim_middle|> else: return...
return 1
<|file_name|>compute_user_popularity.py<|end_file_name|><|fim▁begin|># -*- coding: utf-8 -*- # compute the times of action(rec|click|msg) for each user from math import sqrt def getActionScore(action): if action == "rec": return 0 elif action == "click" : return 1 else: <|fim_middle|...
return 2
<|file_name|>compute_user_popularity.py<|end_file_name|><|fim▁begin|># -*- coding: utf-8 -*- # compute the times of action(rec|click|msg) for each user from math import sqrt def getActionScore(action): if action == "rec": return 0 elif action == "click" : return 1 else: return 2 def co...
lineNum += 1 continue
<|file_name|>compute_user_popularity.py<|end_file_name|><|fim▁begin|># -*- coding: utf-8 -*- # compute the times of action(rec|click|msg) for each user from math import sqrt def getActionScore(action): if action == "rec": return 0 elif action == "click" : return 1 else: return 2 def co...
pop = 1
<|file_name|>compute_user_popularity.py<|end_file_name|><|fim▁begin|># -*- coding: utf-8 -*- # compute the times of action(rec|click|msg) for each user from math import sqrt def getActionScore(action): if action == "rec": return 0 elif action == "click" : return 1 else: return 2 def co...
pop = 10
<|file_name|>compute_user_popularity.py<|end_file_name|><|fim▁begin|># -*- coding: utf-8 -*- # compute the times of action(rec|click|msg) for each user from math import sqrt def getActionScore(action): if action == "rec": return 0 elif action == "click" : return 1 else: return 2 def co...
pop = 100
<|file_name|>compute_user_popularity.py<|end_file_name|><|fim▁begin|># -*- coding: utf-8 -*- # compute the times of action(rec|click|msg) for each user from math import sqrt def <|fim_middle|>(action): if action == "rec": return 0 elif action == "click" : return 1 else: return 2 def co...
getActionScore
<|file_name|>compute_user_popularity.py<|end_file_name|><|fim▁begin|># -*- coding: utf-8 -*- # compute the times of action(rec|click|msg) for each user from math import sqrt def getActionScore(action): if action == "rec": return 0 elif action == "click" : return 1 else: return 2 def <|...
compute_interaction
<|file_name|>compute_user_popularity.py<|end_file_name|><|fim▁begin|># -*- coding: utf-8 -*- # compute the times of action(rec|click|msg) for each user from math import sqrt def getActionScore(action): if action == "rec": return 0 elif action == "click" : return 1 else: return 2 def co...
compute_user_history_interaction
<|file_name|>compute_user_popularity.py<|end_file_name|><|fim▁begin|># -*- coding: utf-8 -*- # compute the times of action(rec|click|msg) for each user from math import sqrt def getActionScore(action): if action == "rec": return 0 elif action == "click" : return 1 else: return 2 def co...
get_action_weight
<|file_name|>compute_user_popularity.py<|end_file_name|><|fim▁begin|># -*- coding: utf-8 -*- # compute the times of action(rec|click|msg) for each user from math import sqrt def getActionScore(action): if action == "rec": return 0 elif action == "click" : return 1 else: return 2 def co...
compute_user_popularity
<|file_name|>test_sgpr_regression.py<|end_file_name|><|fim▁begin|>#!/usr/bin/env python3 import os import random import unittest import warnings from math import exp, pi import gpytorch import torch from gpytorch.distributions import MultivariateNormal from gpytorch.kernels import InducingPointKernel, RBFKernel, Scal...
mll = gpytorch.mlls.ExactMarginalLogLikelihood(likelihood, gp_model) # Optimize the model
<|file_name|>test_sgpr_regression.py<|end_file_name|><|fim▁begin|>#!/usr/bin/env python3 import os import random import unittest import warnings from math import exp, pi import gpytorch import torch from gpytorch.distributions import MultivariateNormal from gpytorch.kernels import InducingPointKernel, RBFKernel, Scal...
train_x = torch.linspace(0, 1, 100) train_y = torch.sin(train_x * (2 * pi)) train_y.add_(torch.randn_like(train_y), alpha=1e-2) test_x = torch.rand(51) test_y = torch.sin(test_x * (2 * pi)) if cuda: train_x = train_x.cuda() train_y = train_y.cuda() test_x = test_x.cuda() ...
<|file_name|>test_sgpr_regression.py<|end_file_name|><|fim▁begin|>#!/usr/bin/env python3 import os import random import unittest import warnings from math import exp, pi import gpytorch import torch from gpytorch.distributions import MultivariateNormal from gpytorch.kernels import InducingPointKernel, RBFKernel, Scal...
def __init__(self, train_x, train_y, likelihood): super(GPRegressionModel, self).__init__(train_x, train_y, likelihood) self.mean_module = ConstantMean(prior=SmoothedBoxPrior(-1e-5, 1e-5)) self.base_covar_module = ScaleKernel(RBFKernel(lengthscale_prior=SmoothedBoxPrior(exp(-5), exp(6), sigm...
<|file_name|>test_sgpr_regression.py<|end_file_name|><|fim▁begin|>#!/usr/bin/env python3 import os import random import unittest import warnings from math import exp, pi import gpytorch import torch from gpytorch.distributions import MultivariateNormal from gpytorch.kernels import InducingPointKernel, RBFKernel, Scal...
super(GPRegressionModel, self).__init__(train_x, train_y, likelihood) self.mean_module = ConstantMean(prior=SmoothedBoxPrior(-1e-5, 1e-5)) self.base_covar_module = ScaleKernel(RBFKernel(lengthscale_prior=SmoothedBoxPrior(exp(-5), exp(6), sigma=0.1))) self.covar_module = InducingPointKern...
<|file_name|>test_sgpr_regression.py<|end_file_name|><|fim▁begin|>#!/usr/bin/env python3 import os import random import unittest import warnings from math import exp, pi import gpytorch import torch from gpytorch.distributions import MultivariateNormal from gpytorch.kernels import InducingPointKernel, RBFKernel, Scal...
mean_x = self.mean_module(x) covar_x = self.covar_module(x) return MultivariateNormal(mean_x, covar_x)
<|file_name|>test_sgpr_regression.py<|end_file_name|><|fim▁begin|>#!/usr/bin/env python3 import os import random import unittest import warnings from math import exp, pi import gpytorch import torch from gpytorch.distributions import MultivariateNormal from gpytorch.kernels import InducingPointKernel, RBFKernel, Scal...
def setUp(self): if os.getenv("UNLOCK_SEED") is None or os.getenv("UNLOCK_SEED").lower() == "false": self.rng_state = torch.get_rng_state() torch.manual_seed(0) if torch.cuda.is_available(): torch.cuda.manual_seed_all(0) random.seed(0) def...
<|file_name|>test_sgpr_regression.py<|end_file_name|><|fim▁begin|>#!/usr/bin/env python3 import os import random import unittest import warnings from math import exp, pi import gpytorch import torch from gpytorch.distributions import MultivariateNormal from gpytorch.kernels import InducingPointKernel, RBFKernel, Scal...
if os.getenv("UNLOCK_SEED") is None or os.getenv("UNLOCK_SEED").lower() == "false": self.rng_state = torch.get_rng_state() torch.manual_seed(0) if torch.cuda.is_available(): torch.cuda.manual_seed_all(0) random.seed(0)
<|file_name|>test_sgpr_regression.py<|end_file_name|><|fim▁begin|>#!/usr/bin/env python3 import os import random import unittest import warnings from math import exp, pi import gpytorch import torch from gpytorch.distributions import MultivariateNormal from gpytorch.kernels import InducingPointKernel, RBFKernel, Scal...
if hasattr(self, "rng_state"): torch.set_rng_state(self.rng_state)
<|file_name|>test_sgpr_regression.py<|end_file_name|><|fim▁begin|>#!/usr/bin/env python3 import os import random import unittest import warnings from math import exp, pi import gpytorch import torch from gpytorch.distributions import MultivariateNormal from gpytorch.kernels import InducingPointKernel, RBFKernel, Scal...
warnings.simplefilter("ignore", NumericalWarning) train_x, train_y, test_x, test_y = make_data() likelihood = GaussianLikelihood() gp_model = GPRegressionModel(train_x, train_y, likelihood) mll = gpytorch.mlls.ExactMarginalLogLikelihood(likelihood, gp_model) # Optimize ...
<|file_name|>test_sgpr_regression.py<|end_file_name|><|fim▁begin|>#!/usr/bin/env python3 import os import random import unittest import warnings from math import exp, pi import gpytorch import torch from gpytorch.distributions import MultivariateNormal from gpytorch.kernels import InducingPointKernel, RBFKernel, Scal...
warnings.simplefilter("ignore", NumericalWarning) train_x, train_y, test_x, test_y = make_data() likelihood = GaussianLikelihood() gp_model = GPRegressionModel(train_x, train_y, likelihood) mll = gpytorch.mlls.ExactMarginalLogLikelihood(likelihood, gp_model) # Optimize ...
<|file_name|>test_sgpr_regression.py<|end_file_name|><|fim▁begin|>#!/usr/bin/env python3 import os import random import unittest import warnings from math import exp, pi import gpytorch import torch from gpytorch.distributions import MultivariateNormal from gpytorch.kernels import InducingPointKernel, RBFKernel, Scal...
warnings.simplefilter("ignore", NumericalWarning) if not torch.cuda.is_available(): return with least_used_cuda_device(): train_x, train_y, test_x, test_y = make_data(cuda=True) likelihood = GaussianLikelihood().cuda() gp_model = GPRegressionModel...
<|file_name|>test_sgpr_regression.py<|end_file_name|><|fim▁begin|>#!/usr/bin/env python3 import os import random import unittest import warnings from math import exp, pi import gpytorch import torch from gpytorch.distributions import MultivariateNormal from gpytorch.kernels import InducingPointKernel, RBFKernel, Scal...
train_x = train_x.cuda() train_y = train_y.cuda() test_x = test_x.cuda() test_y = test_y.cuda()
<|file_name|>test_sgpr_regression.py<|end_file_name|><|fim▁begin|>#!/usr/bin/env python3 import os import random import unittest import warnings from math import exp, pi import gpytorch import torch from gpytorch.distributions import MultivariateNormal from gpytorch.kernels import InducingPointKernel, RBFKernel, Scal...
self.rng_state = torch.get_rng_state() torch.manual_seed(0) if torch.cuda.is_available(): torch.cuda.manual_seed_all(0) random.seed(0)
<|file_name|>test_sgpr_regression.py<|end_file_name|><|fim▁begin|>#!/usr/bin/env python3 import os import random import unittest import warnings from math import exp, pi import gpytorch import torch from gpytorch.distributions import MultivariateNormal from gpytorch.kernels import InducingPointKernel, RBFKernel, Scal...
torch.cuda.manual_seed_all(0)
<|file_name|>test_sgpr_regression.py<|end_file_name|><|fim▁begin|>#!/usr/bin/env python3 import os import random import unittest import warnings from math import exp, pi import gpytorch import torch from gpytorch.distributions import MultivariateNormal from gpytorch.kernels import InducingPointKernel, RBFKernel, Scal...
torch.set_rng_state(self.rng_state)
<|file_name|>test_sgpr_regression.py<|end_file_name|><|fim▁begin|>#!/usr/bin/env python3 import os import random import unittest import warnings from math import exp, pi import gpytorch import torch from gpytorch.distributions import MultivariateNormal from gpytorch.kernels import InducingPointKernel, RBFKernel, Scal...
return
<|file_name|>test_sgpr_regression.py<|end_file_name|><|fim▁begin|>#!/usr/bin/env python3 import os import random import unittest import warnings from math import exp, pi import gpytorch import torch from gpytorch.distributions import MultivariateNormal from gpytorch.kernels import InducingPointKernel, RBFKernel, Scal...
unittest.main()
<|file_name|>test_sgpr_regression.py<|end_file_name|><|fim▁begin|>#!/usr/bin/env python3 import os import random import unittest import warnings from math import exp, pi import gpytorch import torch from gpytorch.distributions import MultivariateNormal from gpytorch.kernels import InducingPointKernel, RBFKernel, Scal...
make_data
<|file_name|>test_sgpr_regression.py<|end_file_name|><|fim▁begin|>#!/usr/bin/env python3 import os import random import unittest import warnings from math import exp, pi import gpytorch import torch from gpytorch.distributions import MultivariateNormal from gpytorch.kernels import InducingPointKernel, RBFKernel, Scal...
__init__
<|file_name|>test_sgpr_regression.py<|end_file_name|><|fim▁begin|>#!/usr/bin/env python3 import os import random import unittest import warnings from math import exp, pi import gpytorch import torch from gpytorch.distributions import MultivariateNormal from gpytorch.kernels import InducingPointKernel, RBFKernel, Scal...
forward
<|file_name|>test_sgpr_regression.py<|end_file_name|><|fim▁begin|>#!/usr/bin/env python3 import os import random import unittest import warnings from math import exp, pi import gpytorch import torch from gpytorch.distributions import MultivariateNormal from gpytorch.kernels import InducingPointKernel, RBFKernel, Scal...
setUp
<|file_name|>test_sgpr_regression.py<|end_file_name|><|fim▁begin|>#!/usr/bin/env python3 import os import random import unittest import warnings from math import exp, pi import gpytorch import torch from gpytorch.distributions import MultivariateNormal from gpytorch.kernels import InducingPointKernel, RBFKernel, Scal...
tearDown
<|file_name|>test_sgpr_regression.py<|end_file_name|><|fim▁begin|>#!/usr/bin/env python3 import os import random import unittest import warnings from math import exp, pi import gpytorch import torch from gpytorch.distributions import MultivariateNormal from gpytorch.kernels import InducingPointKernel, RBFKernel, Scal...
test_sgpr_mean_abs_error
<|file_name|>test_sgpr_regression.py<|end_file_name|><|fim▁begin|>#!/usr/bin/env python3 import os import random import unittest import warnings from math import exp, pi import gpytorch import torch from gpytorch.distributions import MultivariateNormal from gpytorch.kernels import InducingPointKernel, RBFKernel, Scal...
test_sgpr_fast_pred_var
<|file_name|>test_sgpr_regression.py<|end_file_name|><|fim▁begin|>#!/usr/bin/env python3 import os import random import unittest import warnings from math import exp, pi import gpytorch import torch from gpytorch.distributions import MultivariateNormal from gpytorch.kernels import InducingPointKernel, RBFKernel, Scal...
test_sgpr_mean_abs_error_cuda
<|file_name|>fabfile.py<|end_file_name|><|fim▁begin|>from fabric.api import * import fabric.contrib.project as project<|fim▁hole|> from pelican.server import ComplexHTTPRequestHandler # Local path configuration (can be absolute or relative to fabfile) env.deploy_path = 'output' DEPLOY_PATH = env.deploy_path # Remote ...
import os import shutil import sys import SocketServer
<|file_name|>fabfile.py<|end_file_name|><|fim▁begin|>from fabric.api import * import fabric.contrib.project as project import os import shutil import sys import SocketServer from pelican.server import ComplexHTTPRequestHandler # Local path configuration (can be absolute or relative to fabfile) env.deploy_path = 'outp...
"""Remove generated files""" if os.path.isdir(DEPLOY_PATH): shutil.rmtree(DEPLOY_PATH) os.makedirs(DEPLOY_PATH)
<|file_name|>fabfile.py<|end_file_name|><|fim▁begin|>from fabric.api import * import fabric.contrib.project as project import os import shutil import sys import SocketServer from pelican.server import ComplexHTTPRequestHandler # Local path configuration (can be absolute or relative to fabfile) env.deploy_path = 'outp...
"""Build local version of site""" local('pelican -s pelicanconf.py')
<|file_name|>fabfile.py<|end_file_name|><|fim▁begin|>from fabric.api import * import fabric.contrib.project as project import os import shutil import sys import SocketServer from pelican.server import ComplexHTTPRequestHandler # Local path configuration (can be absolute or relative to fabfile) env.deploy_path = 'outp...
"""`build` with the delete switch""" local('pelican -d -s pelicanconf.py')
<|file_name|>fabfile.py<|end_file_name|><|fim▁begin|>from fabric.api import * import fabric.contrib.project as project import os import shutil import sys import SocketServer from pelican.server import ComplexHTTPRequestHandler # Local path configuration (can be absolute or relative to fabfile) env.deploy_path = 'outp...
"""Automatically regenerate site upon file modification""" local('pelican -r -s pelicanconf.py')
<|file_name|>fabfile.py<|end_file_name|><|fim▁begin|>from fabric.api import * import fabric.contrib.project as project import os import shutil import sys import SocketServer from pelican.server import ComplexHTTPRequestHandler # Local path configuration (can be absolute or relative to fabfile) env.deploy_path = 'outp...
"""Serve site at http://localhost:8000/""" os.chdir(env.deploy_path) class AddressReuseTCPServer(SocketServer.TCPServer): allow_reuse_address = True server = AddressReuseTCPServer(('', PORT), ComplexHTTPRequestHandler) sys.stderr.write('Serving on port {0} ...\n'.format(PORT)) server....
<|file_name|>fabfile.py<|end_file_name|><|fim▁begin|>from fabric.api import * import fabric.contrib.project as project import os import shutil import sys import SocketServer from pelican.server import ComplexHTTPRequestHandler # Local path configuration (can be absolute or relative to fabfile) env.deploy_path = 'outp...
allow_reuse_address = True
<|file_name|>fabfile.py<|end_file_name|><|fim▁begin|>from fabric.api import * import fabric.contrib.project as project import os import shutil import sys import SocketServer from pelican.server import ComplexHTTPRequestHandler # Local path configuration (can be absolute or relative to fabfile) env.deploy_path = 'outp...
"""`build`, then `serve`""" build() serve()
<|file_name|>fabfile.py<|end_file_name|><|fim▁begin|>from fabric.api import * import fabric.contrib.project as project import os import shutil import sys import SocketServer from pelican.server import ComplexHTTPRequestHandler # Local path configuration (can be absolute or relative to fabfile) env.deploy_path = 'outp...
"""Build production version of site""" local('pelican -s publishconf.py')
<|file_name|>fabfile.py<|end_file_name|><|fim▁begin|>from fabric.api import * import fabric.contrib.project as project import os import shutil import sys import SocketServer from pelican.server import ComplexHTTPRequestHandler # Local path configuration (can be absolute or relative to fabfile) env.deploy_path = 'outp...
"""Publish to Rackspace Cloud Files""" rebuild() with lcd(DEPLOY_PATH): local('swift -v -A https://auth.api.rackspacecloud.com/v1.0 ' '-U {cloudfiles_username} ' '-K {cloudfiles_api_key} ' 'upload -c {cloudfiles_container} .'.format(**env))
<|file_name|>fabfile.py<|end_file_name|><|fim▁begin|>from fabric.api import * import fabric.contrib.project as project import os import shutil import sys import SocketServer from pelican.server import ComplexHTTPRequestHandler # Local path configuration (can be absolute or relative to fabfile) env.deploy_path = 'outp...
"""Publish to production via rsync""" local('pelican -s publishconf.py') project.rsync_project( remote_dir=dest_path, exclude=".DS_Store", local_dir=DEPLOY_PATH.rstrip('/') + '/', delete=True, extra_opts='-c', )
<|file_name|>fabfile.py<|end_file_name|><|fim▁begin|>from fabric.api import * import fabric.contrib.project as project import os import shutil import sys import SocketServer from pelican.server import ComplexHTTPRequestHandler # Local path configuration (can be absolute or relative to fabfile) env.deploy_path = 'outp...
"""Publish to GitHub Pages""" rebuild() local("ghp-import -b {github_pages_branch} {deploy_path} -p".format(**env))
<|file_name|>fabfile.py<|end_file_name|><|fim▁begin|>from fabric.api import * import fabric.contrib.project as project import os import shutil import sys import SocketServer from pelican.server import ComplexHTTPRequestHandler # Local path configuration (can be absolute or relative to fabfile) env.deploy_path = 'outp...
shutil.rmtree(DEPLOY_PATH) os.makedirs(DEPLOY_PATH)
<|file_name|>fabfile.py<|end_file_name|><|fim▁begin|>from fabric.api import * import fabric.contrib.project as project import os import shutil import sys import SocketServer from pelican.server import ComplexHTTPRequestHandler # Local path configuration (can be absolute or relative to fabfile) env.deploy_path = 'outp...
clean
<|file_name|>fabfile.py<|end_file_name|><|fim▁begin|>from fabric.api import * import fabric.contrib.project as project import os import shutil import sys import SocketServer from pelican.server import ComplexHTTPRequestHandler # Local path configuration (can be absolute or relative to fabfile) env.deploy_path = 'outp...
build
<|file_name|>fabfile.py<|end_file_name|><|fim▁begin|>from fabric.api import * import fabric.contrib.project as project import os import shutil import sys import SocketServer from pelican.server import ComplexHTTPRequestHandler # Local path configuration (can be absolute or relative to fabfile) env.deploy_path = 'outp...
rebuild
<|file_name|>fabfile.py<|end_file_name|><|fim▁begin|>from fabric.api import * import fabric.contrib.project as project import os import shutil import sys import SocketServer from pelican.server import ComplexHTTPRequestHandler # Local path configuration (can be absolute or relative to fabfile) env.deploy_path = 'outp...
regenerate
<|file_name|>fabfile.py<|end_file_name|><|fim▁begin|>from fabric.api import * import fabric.contrib.project as project import os import shutil import sys import SocketServer from pelican.server import ComplexHTTPRequestHandler # Local path configuration (can be absolute or relative to fabfile) env.deploy_path = 'outp...
serve
<|file_name|>fabfile.py<|end_file_name|><|fim▁begin|>from fabric.api import * import fabric.contrib.project as project import os import shutil import sys import SocketServer from pelican.server import ComplexHTTPRequestHandler # Local path configuration (can be absolute or relative to fabfile) env.deploy_path = 'outp...
reserve
<|file_name|>fabfile.py<|end_file_name|><|fim▁begin|>from fabric.api import * import fabric.contrib.project as project import os import shutil import sys import SocketServer from pelican.server import ComplexHTTPRequestHandler # Local path configuration (can be absolute or relative to fabfile) env.deploy_path = 'outp...
preview
<|file_name|>fabfile.py<|end_file_name|><|fim▁begin|>from fabric.api import * import fabric.contrib.project as project import os import shutil import sys import SocketServer from pelican.server import ComplexHTTPRequestHandler # Local path configuration (can be absolute or relative to fabfile) env.deploy_path = 'outp...
cf_upload
<|file_name|>fabfile.py<|end_file_name|><|fim▁begin|>from fabric.api import * import fabric.contrib.project as project import os import shutil import sys import SocketServer from pelican.server import ComplexHTTPRequestHandler # Local path configuration (can be absolute or relative to fabfile) env.deploy_path = 'outp...
publish
<|file_name|>fabfile.py<|end_file_name|><|fim▁begin|>from fabric.api import * import fabric.contrib.project as project import os import shutil import sys import SocketServer from pelican.server import ComplexHTTPRequestHandler # Local path configuration (can be absolute or relative to fabfile) env.deploy_path = 'outp...
gh_pages
<|file_name|>parts_descriptor_test.py<|end_file_name|><|fim▁begin|>import amitgroup as ag import numpy as np <|fim▁hole|> pd = ag.features.PartsDescriptor((5, 5), 20, patch_frame=1, edges_threshold=5, samples_per_image=10) # Use only 100 of the digits pd.train_from_images(data) # Save the model to a file. #pd.save('...
ag.set_verbose(True) # This requires you to have the MNIST data set. data, digits = ag.io.load_mnist('training', selection=slice(0, 100))
<|file_name|>util.py<|end_file_name|><|fim▁begin|># proxy module<|fim▁hole|><|fim▁end|>
from apptools.logger.util import *
<|file_name|>environmental_probe.py<|end_file_name|><|fim▁begin|># =============================================================================== # Copyright 2014 Jake Ross # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may o...
tested with iTHX-W """
<|file_name|>environmental_probe.py<|end_file_name|><|fim▁begin|># =============================================================================== # Copyright 2014 Jake Ross # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may o...
""" http://www.omega.com/Manuals/manualpdf/M3861.pdf iServer MicroServer tested with iTHX-W """ scan_func = 'read_temperature' def read_temperature(self, **kw): v = self.ask('*SRTF', timeout=1.0, **kw) return self._parse_response(v) def read_humidity(self, **kw): ...
<|file_name|>environmental_probe.py<|end_file_name|><|fim▁begin|># =============================================================================== # Copyright 2014 Jake Ross # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may o...
v = self.ask('*SRTF', timeout=1.0, **kw) return self._parse_response(v)
<|file_name|>environmental_probe.py<|end_file_name|><|fim▁begin|># =============================================================================== # Copyright 2014 Jake Ross # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may o...
v = self.ask('*SRH', timeout=1.0, **kw) return self._parse_response(v)
<|file_name|>environmental_probe.py<|end_file_name|><|fim▁begin|># =============================================================================== # Copyright 2014 Jake Ross # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may o...
try: return float(v) except (AttributeError, ValueError, TypeError): return self.get_random_value()
<|file_name|>environmental_probe.py<|end_file_name|><|fim▁begin|># =============================================================================== # Copyright 2014 Jake Ross # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may o...
read_temperature
<|file_name|>environmental_probe.py<|end_file_name|><|fim▁begin|># =============================================================================== # Copyright 2014 Jake Ross # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may o...
read_humidity
<|file_name|>environmental_probe.py<|end_file_name|><|fim▁begin|># =============================================================================== # Copyright 2014 Jake Ross # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may o...
_parse_response
<|file_name|>testroute.py<|end_file_name|><|fim▁begin|># -*- coding: utf-8 -*- from .base import BaseHandler<|fim▁hole|>class TestRoute(BaseHandler): def get(self, file): return self.render(str(file) + '.jade', show_h1=1)<|fim▁end|>
<|file_name|>testroute.py<|end_file_name|><|fim▁begin|># -*- coding: utf-8 -*- from .base import BaseHandler class TestRoute(BaseHandler): <|fim_middle|> <|fim▁end|>
def get(self, file): return self.render(str(file) + '.jade', show_h1=1)
<|file_name|>testroute.py<|end_file_name|><|fim▁begin|># -*- coding: utf-8 -*- from .base import BaseHandler class TestRoute(BaseHandler): def get(self, file): <|fim_middle|> <|fim▁end|>
return self.render(str(file) + '.jade', show_h1=1)
<|file_name|>testroute.py<|end_file_name|><|fim▁begin|># -*- coding: utf-8 -*- from .base import BaseHandler class TestRoute(BaseHandler): def <|fim_middle|>(self, file): return self.render(str(file) + '.jade', show_h1=1) <|fim▁end|>
get
<|file_name|>ContentDbDict.py<|end_file_name|><|fim▁begin|>import time import os import ContentDb from Debug import Debug from Config import config class ContentDbDict(dict): def __init__(self, site, *args, **kwargs): s = time.time() self.site = site self.cached_keys = [] self.log...
print "Mem: +", process.memory_info()[0] / float(2 ** 20) - s_mem
<|file_name|>ContentDbDict.py<|end_file_name|><|fim▁begin|>import time import os import ContentDb from Debug import Debug from Config import config class ContentDbDict(dict): <|fim_middle|> if __name__ == "__main__": import psutil process = psutil.Process(os.getpid()) s_mem = process.memory_info()[...
def __init__(self, site, *args, **kwargs): s = time.time() self.site = site self.cached_keys = [] self.log = self.site.log self.db = ContentDb.getContentDb() self.db_id = self.db.needSite(site) self.num_loaded = 0 super(ContentDbDict, self).__init__(se...
<|file_name|>ContentDbDict.py<|end_file_name|><|fim▁begin|>import time import os import ContentDb from Debug import Debug from Config import config class ContentDbDict(dict): def __init__(self, site, *args, **kwargs): <|fim_middle|> def loadItem(self, key): try: self.num_loaded ...
s = time.time() self.site = site self.cached_keys = [] self.log = self.site.log self.db = ContentDb.getContentDb() self.db_id = self.db.needSite(site) self.num_loaded = 0 super(ContentDbDict, self).__init__(self.db.loadDbDict(site)) # Load keys from datab...
<|file_name|>ContentDbDict.py<|end_file_name|><|fim▁begin|>import time import os import ContentDb from Debug import Debug from Config import config class ContentDbDict(dict): def __init__(self, site, *args, **kwargs): s = time.time() self.site = site self.cached_keys = [] self.log...
try: self.num_loaded += 1 if self.num_loaded % 100 == 0: if config.verbose: self.log.debug("Loaded json: %s (latest: %s) called by: %s" % (self.num_loaded, key, Debug.formatStack())) else: self.log.debug("Loaded json...
<|file_name|>ContentDbDict.py<|end_file_name|><|fim▁begin|>import time import os import ContentDb from Debug import Debug from Config import config class ContentDbDict(dict): def __init__(self, site, *args, **kwargs): s = time.time() self.site = site self.cached_keys = [] self.log...
return self.site.storage.getSize(key)
<|file_name|>ContentDbDict.py<|end_file_name|><|fim▁begin|>import time import os import ContentDb from Debug import Debug from Config import config class ContentDbDict(dict): def __init__(self, site, *args, **kwargs): s = time.time() self.site = site self.cached_keys = [] self.log...
if len(self.cached_keys) > 10: key_deleted = self.cached_keys.pop(0) dict.__setitem__(self, key_deleted, False)
<|file_name|>ContentDbDict.py<|end_file_name|><|fim▁begin|>import time import os import ContentDb from Debug import Debug from Config import config class ContentDbDict(dict): def __init__(self, site, *args, **kwargs): s = time.time() self.site = site self.cached_keys = [] self.log...
if key not in self.cached_keys and key != "content.json" and len(key) > 40: # Always keep keys smaller than 40 char self.cached_keys.append(key)
<|file_name|>ContentDbDict.py<|end_file_name|><|fim▁begin|>import time import os import ContentDb from Debug import Debug from Config import config class ContentDbDict(dict): def __init__(self, site, *args, **kwargs): s = time.time() self.site = site self.cached_keys = [] self.log...
val = dict.get(self, key) if val: # Already loaded return val elif val is None: # Unknown key raise KeyError(key) elif val is False: # Loaded before, but purged from cache return self.loadItem(key)
<|file_name|>ContentDbDict.py<|end_file_name|><|fim▁begin|>import time import os import ContentDb from Debug import Debug from Config import config class ContentDbDict(dict): def __init__(self, site, *args, **kwargs): s = time.time() self.site = site self.cached_keys = [] self.log...
self.addCachedKey(key) self.checkLimit() size = self.getItemSize(key) self.db.setContent(self.site, key, val, size) dict.__setitem__(self, key, val)
<|file_name|>ContentDbDict.py<|end_file_name|><|fim▁begin|>import time import os import ContentDb from Debug import Debug from Config import config class ContentDbDict(dict): def __init__(self, site, *args, **kwargs): s = time.time() self.site = site self.cached_keys = [] self.log...
self.db.deleteContent(self.site, key) dict.__delitem__(self, key) try: self.cached_keys.remove(key) except ValueError: pass
<|file_name|>ContentDbDict.py<|end_file_name|><|fim▁begin|>import time import os import ContentDb from Debug import Debug from Config import config class ContentDbDict(dict): def __init__(self, site, *args, **kwargs): s = time.time() self.site = site self.cached_keys = [] self.log...
for key in dict.keys(self): try: val = self[key] except Exception as err: self.log.warning("Error loading %s: %s" % (key, err)) continue yield key, val
<|file_name|>ContentDbDict.py<|end_file_name|><|fim▁begin|>import time import os import ContentDb from Debug import Debug from Config import config class ContentDbDict(dict): def __init__(self, site, *args, **kwargs): s = time.time() self.site = site self.cached_keys = [] self.log...
back = [] for key in dict.keys(self): try: val = self[key] except Exception as err: self.log.warning("Error loading %s: %s" % (key, err)) continue back.append((key, val)) return back
<|file_name|>ContentDbDict.py<|end_file_name|><|fim▁begin|>import time import os import ContentDb from Debug import Debug from Config import config class ContentDbDict(dict): def __init__(self, site, *args, **kwargs): s = time.time() self.site = site self.cached_keys = [] self.log...
back = [] for key, val in dict.iteritems(self): if not val: try: val = self.loadItem(key) except Exception: continue back.append(val) return back
<|file_name|>ContentDbDict.py<|end_file_name|><|fim▁begin|>import time import os import ContentDb from Debug import Debug from Config import config class ContentDbDict(dict): def __init__(self, site, *args, **kwargs): s = time.time() self.site = site self.cached_keys = [] self.log...
try: return self.__getitem__(key) except KeyError: return default except Exception as err: self.site.bad_files[key] = self.site.bad_files.get(key, 1) dict.__delitem__(self, key) self.log.warning("Error loading %s: %s" % (key, err)) ...
<|file_name|>ContentDbDict.py<|end_file_name|><|fim▁begin|>import time import os import ContentDb from Debug import Debug from Config import config class ContentDbDict(dict): def __init__(self, site, *args, **kwargs): s = time.time() self.site = site self.cached_keys = [] self.log...
params["site_id"] = self.db_id return self.db.execute(query, params)
<|file_name|>ContentDbDict.py<|end_file_name|><|fim▁begin|>import time import os import ContentDb from Debug import Debug from Config import config class ContentDbDict(dict): def __init__(self, site, *args, **kwargs): s = time.time() self.site = site self.cached_keys = [] self.log...
if config.verbose: self.log.debug("Loaded json: %s (latest: %s) called by: %s" % (self.num_loaded, key, Debug.formatStack())) else: self.log.debug("Loaded json: %s (latest: %s)" % (self.num_loaded, key))
<|file_name|>ContentDbDict.py<|end_file_name|><|fim▁begin|>import time import os import ContentDb from Debug import Debug from Config import config class ContentDbDict(dict): def __init__(self, site, *args, **kwargs): s = time.time() self.site = site self.cached_keys = [] self.log...
self.log.debug("Loaded json: %s (latest: %s) called by: %s" % (self.num_loaded, key, Debug.formatStack()))
<|file_name|>ContentDbDict.py<|end_file_name|><|fim▁begin|>import time import os import ContentDb from Debug import Debug from Config import config class ContentDbDict(dict): def __init__(self, site, *args, **kwargs): s = time.time() self.site = site self.cached_keys = [] self.log...
self.log.debug("Loaded json: %s (latest: %s)" % (self.num_loaded, key))
<|file_name|>ContentDbDict.py<|end_file_name|><|fim▁begin|>import time import os import ContentDb from Debug import Debug from Config import config class ContentDbDict(dict): def __init__(self, site, *args, **kwargs): s = time.time() self.site = site self.cached_keys = [] self.log...
self.__delitem__(key) # File not exists anymore
<|file_name|>ContentDbDict.py<|end_file_name|><|fim▁begin|>import time import os import ContentDb from Debug import Debug from Config import config class ContentDbDict(dict): def __init__(self, site, *args, **kwargs): s = time.time() self.site = site self.cached_keys = [] self.log...
key_deleted = self.cached_keys.pop(0) dict.__setitem__(self, key_deleted, False)
<|file_name|>ContentDbDict.py<|end_file_name|><|fim▁begin|>import time import os import ContentDb from Debug import Debug from Config import config class ContentDbDict(dict): def __init__(self, site, *args, **kwargs): s = time.time() self.site = site self.cached_keys = [] self.log...
self.cached_keys.append(key)