hexsha string | size int64 | ext string | lang string | max_stars_repo_path string | max_stars_repo_name string | max_stars_repo_head_hexsha string | max_stars_repo_licenses list | max_stars_count int64 | max_stars_repo_stars_event_min_datetime string | max_stars_repo_stars_event_max_datetime string | max_issues_repo_path string | max_issues_repo_name string | max_issues_repo_head_hexsha string | max_issues_repo_licenses list | max_issues_count int64 | max_issues_repo_issues_event_min_datetime string | max_issues_repo_issues_event_max_datetime string | max_forks_repo_path string | max_forks_repo_name string | max_forks_repo_head_hexsha string | max_forks_repo_licenses list | max_forks_count int64 | max_forks_repo_forks_event_min_datetime string | max_forks_repo_forks_event_max_datetime string | content string | avg_line_length float64 | max_line_length int64 | alphanum_fraction float64 | qsc_code_num_words_quality_signal int64 | qsc_code_num_chars_quality_signal float64 | qsc_code_mean_word_length_quality_signal float64 | qsc_code_frac_words_unique_quality_signal float64 | qsc_code_frac_chars_top_2grams_quality_signal float64 | qsc_code_frac_chars_top_3grams_quality_signal float64 | qsc_code_frac_chars_top_4grams_quality_signal float64 | qsc_code_frac_chars_dupe_5grams_quality_signal float64 | qsc_code_frac_chars_dupe_6grams_quality_signal float64 | qsc_code_frac_chars_dupe_7grams_quality_signal float64 | qsc_code_frac_chars_dupe_8grams_quality_signal float64 | qsc_code_frac_chars_dupe_9grams_quality_signal float64 | qsc_code_frac_chars_dupe_10grams_quality_signal float64 | qsc_code_frac_chars_replacement_symbols_quality_signal float64 | qsc_code_frac_chars_digital_quality_signal float64 | qsc_code_frac_chars_whitespace_quality_signal float64 | qsc_code_size_file_byte_quality_signal float64 | qsc_code_num_lines_quality_signal float64 | qsc_code_num_chars_line_max_quality_signal float64 | qsc_code_num_chars_line_mean_quality_signal float64 | qsc_code_frac_chars_alphabet_quality_signal float64 | qsc_code_frac_chars_comments_quality_signal float64 | qsc_code_cate_xml_start_quality_signal float64 | qsc_code_frac_lines_dupe_lines_quality_signal float64 | qsc_code_cate_autogen_quality_signal float64 | qsc_code_frac_lines_long_string_quality_signal float64 | qsc_code_frac_chars_string_length_quality_signal float64 | qsc_code_frac_chars_long_word_length_quality_signal float64 | qsc_code_frac_lines_string_concat_quality_signal float64 | qsc_code_cate_encoded_data_quality_signal float64 | qsc_code_frac_chars_hex_words_quality_signal float64 | qsc_code_frac_lines_prompt_comments_quality_signal float64 | qsc_code_frac_lines_assert_quality_signal float64 | qsc_codepython_cate_ast_quality_signal float64 | qsc_codepython_frac_lines_func_ratio_quality_signal float64 | qsc_codepython_cate_var_zero_quality_signal bool | qsc_codepython_frac_lines_pass_quality_signal float64 | qsc_codepython_frac_lines_import_quality_signal float64 | qsc_codepython_frac_lines_simplefunc_quality_signal float64 | qsc_codepython_score_lines_no_logic_quality_signal float64 | qsc_codepython_frac_lines_print_quality_signal float64 | qsc_code_num_words int64 | qsc_code_num_chars int64 | qsc_code_mean_word_length int64 | qsc_code_frac_words_unique null | qsc_code_frac_chars_top_2grams int64 | qsc_code_frac_chars_top_3grams int64 | qsc_code_frac_chars_top_4grams int64 | qsc_code_frac_chars_dupe_5grams int64 | qsc_code_frac_chars_dupe_6grams int64 | qsc_code_frac_chars_dupe_7grams int64 | qsc_code_frac_chars_dupe_8grams int64 | qsc_code_frac_chars_dupe_9grams int64 | qsc_code_frac_chars_dupe_10grams int64 | qsc_code_frac_chars_replacement_symbols int64 | qsc_code_frac_chars_digital int64 | qsc_code_frac_chars_whitespace int64 | qsc_code_size_file_byte int64 | qsc_code_num_lines int64 | qsc_code_num_chars_line_max int64 | qsc_code_num_chars_line_mean int64 | qsc_code_frac_chars_alphabet int64 | qsc_code_frac_chars_comments int64 | qsc_code_cate_xml_start int64 | qsc_code_frac_lines_dupe_lines int64 | qsc_code_cate_autogen int64 | qsc_code_frac_lines_long_string int64 | qsc_code_frac_chars_string_length int64 | qsc_code_frac_chars_long_word_length int64 | qsc_code_frac_lines_string_concat null | qsc_code_cate_encoded_data int64 | qsc_code_frac_chars_hex_words int64 | qsc_code_frac_lines_prompt_comments int64 | qsc_code_frac_lines_assert int64 | qsc_codepython_cate_ast int64 | qsc_codepython_frac_lines_func_ratio int64 | qsc_codepython_cate_var_zero int64 | qsc_codepython_frac_lines_pass int64 | qsc_codepython_frac_lines_import int64 | qsc_codepython_frac_lines_simplefunc int64 | qsc_codepython_score_lines_no_logic int64 | qsc_codepython_frac_lines_print int64 | effective string | hits int64 |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
7121ce4998abb18217044423d33d7b2faf271642 | 492 | py | Python | curso_em_video/0075.py | marinaoliveira96/python-exercises | 13fc0ec30dec9bb6531cdeb41c80726971975835 | [
"MIT"
] | null | null | null | curso_em_video/0075.py | marinaoliveira96/python-exercises | 13fc0ec30dec9bb6531cdeb41c80726971975835 | [
"MIT"
] | null | null | null | curso_em_video/0075.py | marinaoliveira96/python-exercises | 13fc0ec30dec9bb6531cdeb41c80726971975835 | [
"MIT"
] | null | null | null | num = (int(input('digite um numero: ')),
int(input('digite um numero: ')),
int(input('digite um numero: ')),
int(input('digite um numero: ')))
print(f'vc digitou {num}')
print(f'o valor 9 apareceu {num.count(9)} vezes')
if 3 in num:
print(f'o valor 3 apareceu na {num.index(3)+1} posição')
else:
print('o valor 3 não foi digitado em nenhuma posição')
print('os valores pares listados foram:', end='')
for n in num:
if n % 2 == 0:
print(n, end=' ')
| 32.8 | 60 | 0.601626 | 81 | 492 | 3.654321 | 0.481481 | 0.108108 | 0.189189 | 0.216216 | 0.398649 | 0.297297 | 0.297297 | 0.297297 | 0.297297 | 0.297297 | 0 | 0.023622 | 0.22561 | 492 | 14 | 61 | 35.142857 | 0.753281 | 0 | 0 | 0.142857 | 0 | 0 | 0.510163 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | false | 0 | 0 | 0 | 0 | 0.428571 | 0 | 0 | 0 | null | 0 | 1 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 3 |
712ef1de86e8f7154403eb8d66165d74a60b9c44 | 1,558 | py | Python | afew/FilterRegistry.py | matclab/afew | fe80a69df74378c36b5695322e411f15e4f13118 | [
"ISC"
] | null | null | null | afew/FilterRegistry.py | matclab/afew | fe80a69df74378c36b5695322e411f15e4f13118 | [
"ISC"
] | null | null | null | afew/FilterRegistry.py | matclab/afew | fe80a69df74378c36b5695322e411f15e4f13118 | [
"ISC"
] | null | null | null | # -*- coding: utf-8 -*-
# SPDX-License-Identifier: ISC
# Copyright (c) Justus Winter <4winter@informatik.uni-hamburg.de>
from __future__ import print_function, absolute_import, unicode_literals
import pkg_resources
RAISEIT = object()
class FilterRegistry(object):
"""
The FilterRegistry is responsible for returning
filters by key.
Filters get registered via entry points.
To avoid any circular dependencies, the registry loads
the Filters lazily
"""
def __init__(self, filters):
self._filteriterator = filters
@property
def filter(self):
if not hasattr(self, '_filter'):
self._filter = {}
for f in self._filteriterator:
self._filter[f.name] = f.load()
return self._filter
def get(self, key, default=RAISEIT):
if default == RAISEIT:
return self.filter[key]
else:
return self.filter.get(key, default)
def __getitem__(self, key):
return self.get(key)
def __setitem__(self, key, value):
self.filter[key] = value
def __delitem__(self, key):
del self.filter[key]
def keys(self):
return self.filter.keys()
def values(self):
return self.filter.values()
def items(self):
return self.filter.items()
all_filters = FilterRegistry(pkg_resources.iter_entry_points('afew.filter'))
def register_filter (klass):
'''Decorator function for registering a class as a filter.'''
all_filters[klass.__name__] = klass
return klass
| 23.969231 | 76 | 0.647625 | 187 | 1,558 | 5.181818 | 0.449198 | 0.113519 | 0.099071 | 0.06192 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.001718 | 0.252888 | 1,558 | 64 | 77 | 24.34375 | 0.830756 | 0.224647 | 0 | 0 | 0 | 0 | 0.015411 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0.294118 | false | 0 | 0.058824 | 0.117647 | 0.617647 | 0.029412 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 1 | 1 | 0 | 0 | 3 |
8531c3f882fd85200eb06cfa874e12b0eb85ad5e | 152 | py | Python | tintz/newsletter/urls.py | dcfranca/tintz-backend | 9f29e17cafc31ab7dc568d1e2c984e6f1b1fc3fc | [
"MIT"
] | null | null | null | tintz/newsletter/urls.py | dcfranca/tintz-backend | 9f29e17cafc31ab7dc568d1e2c984e6f1b1fc3fc | [
"MIT"
] | 2 | 2021-03-19T21:51:51.000Z | 2021-06-10T18:22:50.000Z | tintz/newsletter/urls.py | danielfranca/tintz-backend | 9f29e17cafc31ab7dc568d1e2c984e6f1b1fc3fc | [
"MIT"
] | null | null | null | from django.conf.urls import url
from . import views
urlpatterns = [
url(r'^subscribers/$', views.SubscriberApi.as_view(), name='subscribers'),
]
| 19 | 78 | 0.710526 | 19 | 152 | 5.631579 | 0.736842 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.138158 | 152 | 7 | 79 | 21.714286 | 0.816794 | 0 | 0 | 0 | 0 | 0 | 0.164474 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | false | 0 | 0.4 | 0 | 0.4 | 0 | 1 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 3 |
855323580345794a26a97cb49784f0a84d4e4f98 | 67 | py | Python | test.py | aieater/gpueater_python | b279a4193ba530c14431c2b31acc20fa62f423f4 | [
"MIT"
] | null | null | null | test.py | aieater/gpueater_python | b279a4193ba530c14431c2b31acc20fa62f423f4 | [
"MIT"
] | null | null | null | test.py | aieater/gpueater_python | b279a4193ba530c14431c2b31acc20fa62f423f4 | [
"MIT"
] | null | null | null | import gpueater
res = gpueater.registered_image_list()
print(res)
| 13.4 | 38 | 0.80597 | 9 | 67 | 5.777778 | 0.777778 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.104478 | 67 | 4 | 39 | 16.75 | 0.866667 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | false | 0 | 0.333333 | 0 | 0.333333 | 0.333333 | 1 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 3 |
858d8d1b3cdfe9b28d2d29221b2ef49dfd518194 | 183 | py | Python | test_app/models/ApiTypes.py | Grusinator/django-generic-serializer | 5a44651c64a0d036a532701d90e79aca243152e5 | [
"MIT"
] | null | null | null | test_app/models/ApiTypes.py | Grusinator/django-generic-serializer | 5a44651c64a0d036a532701d90e79aca243152e5 | [
"MIT"
] | 1 | 2020-06-05T20:15:25.000Z | 2020-06-05T20:15:25.000Z | test_app/models/ApiTypes.py | Grusinator/django-generic-serializer | 5a44651c64a0d036a532701d90e79aca243152e5 | [
"MIT"
] | null | null | null | from test_app.django_model_enum import DjangoModelEnum
class ApiTypes(DjangoModelEnum):
OAUTH_REST = "OauthRest"
OAUTH_GRAPHQL = "OauthGraphql"
TOKEN_REST = "TokenRest"
| 22.875 | 54 | 0.770492 | 20 | 183 | 6.75 | 0.85 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.15847 | 183 | 7 | 55 | 26.142857 | 0.876623 | 0 | 0 | 0 | 0 | 0 | 0.163934 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | false | 0 | 0.2 | 0 | 1 | 0 | 1 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 3 |
8594833fff2ca02b71f0830a0fe4284803d93d93 | 6,457 | py | Python | tests/functional/provisioner/provisioner.py | earlren1014/RedHat-Software-Factory | dd50eba4e353945886ebceb5dd608179d608b956 | [
"Apache-2.0"
] | null | null | null | tests/functional/provisioner/provisioner.py | earlren1014/RedHat-Software-Factory | dd50eba4e353945886ebceb5dd608179d608b956 | [
"Apache-2.0"
] | null | null | null | tests/functional/provisioner/provisioner.py | earlren1014/RedHat-Software-Factory | dd50eba4e353945886ebceb5dd608179d608b956 | [
"Apache-2.0"
] | null | null | null | #!/bin/env python
#
# Copyright (C) 2014 eNovance SAS <licensing@enovance.com>
#
# Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance with the License. You may obtain
# a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
# License for the specific language governing permissions and limitations
# under the License.
import os
import shlex
import random
import sys
import yaml
pwd = os.path.dirname(os.path.abspath(__file__)) # flake8: noqa
sys.path.append(os.path.dirname(pwd)) # flake8: noqa
import config
from utils import ManageSfUtils
from utils import GerritGitUtils
from pysflib.sfredmine import RedmineUtils
from utils import JenkinsUtils
from utils import get_cookie
from utils import is_present
from utils import ssh_run_cmd
# TODO: Create pads and pasties.
class SFProvisioner(object):
""" This provider is only intended for testing
SF backup/restore and update. It provisions some
user datas in a SF installation based on a resourses.yaml
file. Later those data can be checked by its friend
the SFChecker.
Provisioned data should remain really simple.
"""
def __init__(self):
with open("%s/resources.yaml" % pwd, 'r') as rsc:
self.resources = yaml.load(rsc)
config.USERS[config.ADMIN_USER]['auth_cookie'] = get_cookie(
config.ADMIN_USER, config.USERS[config.ADMIN_USER]['password'])
self.msu = ManageSfUtils(config.GATEWAY_URL)
self.ggu = GerritGitUtils(config.ADMIN_USER,
config.ADMIN_PRIV_KEY_PATH,
config.USERS[config.ADMIN_USER]['email'])
self.ju = JenkinsUtils()
self.rm = RedmineUtils(
config.GATEWAY_URL + "/redmine/",
auth_cookie=config.USERS[config.ADMIN_USER]['auth_cookie'])
def create_project(self, name):
print " Creating project %s ..." % name
self.msu.createProject(name, config.ADMIN_USER)
def push_files_in_project(self, name, files):
print " Add files(%s) in a commit ..." % ",".join(files)
# TODO(fbo); use gateway host instead of gerrit host
self.url = "ssh://%s@%s:29418/%s" % (config.ADMIN_USER,
config.GATEWAY_HOST, name)
clone_dir = self.ggu.clone(self.url, name, config_review=False)
self.clone_dir = clone_dir
for f in files:
file(os.path.join(clone_dir, f), 'w').write('data')
self.ggu.git_add(clone_dir, (f,))
self.ggu.add_commit_for_all_new_additions(clone_dir)
self.ggu.direct_push_branch(clone_dir, 'master')
def create_issues_on_project(self, name, issues):
print " Create %s issue(s) for that project ..." % len(issues)
for i in issues:
if is_present('SFRedmine'):
issue = self.rm.create_issue(name, i['name'])
else:
issue = random.randint(1,100)
yield issue, i['review']
def create_jenkins_jobs(self, name, jobnames):
print " Create Jenkins jobs(%s) ..." % ",".join(jobnames)
for jobname in jobnames:
self.ju.create_job("%s_%s" % (name, jobname))
def create_pads(self, amount):
# TODO
pass
def create_pasties(self, amount):
# TODO
pass
def simple_login(self, user):
"""log as user to make the user listable"""
get_cookie(user, config.USERS[user]['password'])
def create_review(self, project, issue):
"""Very basic review creator for statistics and restore tests
purposes."""
self.ggu.config_review(self.clone_dir)
self.ggu.add_commit_in_branch(self.clone_dir,
'branch_' + issue,
commit='test\n\nBug: %s' % issue)
self.ggu.review_push_branch(self.clone_dir, 'branch_' + issue)
def create_local_user(self, username, password, email):
self.msu.create_user(username, password, email)
def command(self, cmd):
return ssh_run_cmd(os.path.expanduser("~/.ssh/id_rsa"),
"root",
config.GATEWAY_HOST, shlex.split(cmd))
def compute_checksum(self, f):
out = self.command("md5sum %s" % f)[0]
if out:
return out.split()[0]
def provision(self):
for cmd in self.resources['commands']:
print "Execute command %s" % cmd['cmd']
print self.command(cmd['cmd'])
checksum_list = {}
for checksum in self.resources['checksum'] :
print "Compute checksum for file %s" % checksum['file']
checksum_list[checksum['file']] = self.compute_checksum(
checksum['file'])
yaml.dump(checksum_list, file('/tmp/pc_checksums.yaml', 'w'))
for user in self.resources['local_users']:
print "Create local user %s" % user['username']
self.create_local_user(user['username'],
user['password'],
user['email'])
for u in self.resources['users']:
print "log in as %s" % u['name']
self.simple_login(u['name'])
for project in self.resources['projects']:
print "Create user datas for %s" % project['name']
self.create_project(project['name'])
self.push_files_in_project(project['name'],
[f['name'] for f in project['files']])
for i, review in self.create_issues_on_project(project['name'],
project['issues']):
if review:
print "Create review for bug %i in %s" % (i,
project['name'])
self.create_review(project['name'], str(i))
self.create_jenkins_jobs(project['name'],
[j['name'] for j in project['jobnames']])
self.create_pads(2)
self.create_pasties(2)
p = SFProvisioner()
p.provision()
| 39.371951 | 78 | 0.591451 | 798 | 6,457 | 4.655388 | 0.305764 | 0.021534 | 0.032301 | 0.023688 | 0.060296 | 0.034993 | 0.019381 | 0 | 0 | 0 | 0 | 0.005293 | 0.297816 | 6,457 | 163 | 79 | 39.613497 | 0.814071 | 0.110578 | 0 | 0.017857 | 0 | 0 | 0.115051 | 0.004149 | 0 | 0 | 0 | 0.01227 | 0 | 0 | null | null | 0.0625 | 0.116071 | null | null | 0.098214 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 1 | 0 | 1 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 3 |
859f98e4a2573ba0bd10c46fd59cba4ad96676f2 | 458 | py | Python | IntroToCS_ex1/additional_file.py | nadavWeisler/IntroToCS | 725fc8822eeb34f6917692846689dee29b24af55 | [
"MIT"
] | null | null | null | IntroToCS_ex1/additional_file.py | nadavWeisler/IntroToCS | 725fc8822eeb34f6917692846689dee29b24af55 | [
"MIT"
] | null | null | null | IntroToCS_ex1/additional_file.py | nadavWeisler/IntroToCS | 725fc8822eeb34f6917692846689dee29b24af55 | [
"MIT"
] | null | null | null | #############################################################
# FILE : additional_file.py
# WRITER : Nadav Weisler , Weisler , 316493758
# EXERCISE : intro2cs ex1 2019
# DESCRIPTION: include function called "secret_function"
# that print "My username is weisler and I read the submission response."
#############################################################
def secret_function():
print("My username is weisler and I read the submission response.") | 45.8 | 75 | 0.552402 | 45 | 458 | 5.555556 | 0.622222 | 0.112 | 0.12 | 0.136 | 0.424 | 0.424 | 0.424 | 0.424 | 0.424 | 0.424 | 0 | 0.0375 | 0.126638 | 458 | 10 | 76 | 45.8 | 0.5875 | 0.497817 | 0 | 0 | 0 | 0 | 0.563107 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0.5 | true | 0 | 0 | 0 | 0.5 | 0.5 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 1 | 1 | 0 | 0 | 0 | 0 | 1 | 0 | 3 |
85c49fd4c3e695589de399a92b65d5ba442a02d9 | 707 | py | Python | IPython-parallel-tutorial/check_env.py | sunny2309/scipy_conf_notebooks | 30a85d5137db95e01461ad21519bc1bdf294044b | [
"MIT"
] | 2 | 2021-01-09T15:57:26.000Z | 2021-11-29T01:44:21.000Z | IPython-parallel-tutorial/check_env.py | sunny2309/scipy_conf_notebooks | 30a85d5137db95e01461ad21519bc1bdf294044b | [
"MIT"
] | 5 | 2019-11-15T02:00:26.000Z | 2021-01-06T04:26:40.000Z | IPython-parallel-tutorial/check_env.py | sunny2309/scipy_conf_notebooks | 30a85d5137db95e01461ad21519bc1bdf294044b | [
"MIT"
] | null | null | null | """check_env.py for IPython.parallel tutorial at SciPy 2014"""
import sys
import numpy
import scipy
import requests
import matplotlib.pyplot
import skimage
import matplotlib
try:
from bs4 import BeautifulSoup
except ImportError:
print("BeautifulSoup will be used for an example.")
try:
import networkx
except ImportError:
print("networkx will be used for an example.")
try:
import cv
except ImportError:
print("opencv will be used for an example.")
from distutils.version import LooseVersion as V
import IPython
if V(IPython.__version__) < V('2.0'):
print("Need IPython >= 2.0, have %s" % IPython.__version__)
sys.exit(1)
from IPython import parallel
print("OK")
| 17.675 | 63 | 0.734088 | 100 | 707 | 5.1 | 0.46 | 0.1 | 0.129412 | 0.076471 | 0.164706 | 0.164706 | 0.121569 | 0.121569 | 0 | 0 | 0 | 0.017301 | 0.182461 | 707 | 39 | 64 | 18.128205 | 0.865052 | 0.079208 | 0 | 0.230769 | 0 | 0 | 0.227907 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | true | 0 | 0.615385 | 0 | 0.615385 | 0.192308 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 1 | 0 | 1 | 0 | 0 | 3 |
a440537a6b6544309b49c8cefc6b9ab628443895 | 354 | py | Python | memoize.py | manoharp/algo | 6f60440143da77543a78bc017cb7fa2f3aeac5d7 | [
"Apache-2.0"
] | null | null | null | memoize.py | manoharp/algo | 6f60440143da77543a78bc017cb7fa2f3aeac5d7 | [
"Apache-2.0"
] | null | null | null | memoize.py | manoharp/algo | 6f60440143da77543a78bc017cb7fa2f3aeac5d7 | [
"Apache-2.0"
] | null | null | null | class memoize(object):
"""
Memoize wrapper for python
Usage:
@memoize
def fib(n):
pass
"""
def __init__(self, function):
self.function = function
self.memoized = {}
def __call__(self, *args):
try:
return self.memoized[args]
except KeyError:
self.memoized[args] = self.function(*args)
return self.memoized[args]
| 16.090909 | 45 | 0.652542 | 43 | 354 | 5.186047 | 0.488372 | 0.215247 | 0.215247 | 0.197309 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.220339 | 354 | 21 | 46 | 16.857143 | 0.807971 | 0.172316 | 0 | 0.2 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0.2 | false | 0 | 0 | 0 | 0.5 | 0 | 0 | 0 | 0 | null | 1 | 1 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 3 |
a4768ac9870413eea165ad30bc2f26d4092b5cda | 915 | py | Python | planetmint/__init__.py | liviu-lesan/planetmint | 54cf8e45108947aa8282ddaaf127d08e06ce842e | [
"Apache-2.0"
] | null | null | null | planetmint/__init__.py | liviu-lesan/planetmint | 54cf8e45108947aa8282ddaaf127d08e06ce842e | [
"Apache-2.0"
] | null | null | null | planetmint/__init__.py | liviu-lesan/planetmint | 54cf8e45108947aa8282ddaaf127d08e06ce842e | [
"Apache-2.0"
] | null | null | null | # Copyright © 2020 Interplanetary Database Association e.V.,
# Planetmint and IPDB software contributors.
# SPDX-License-Identifier: (Apache-2.0 AND CC-BY-4.0)
# Code is Apache-2.0 and docs are CC-BY-4.0
from planetmint.common.transaction import Transaction # noqa
from planetmint import models # noqa
from planetmint.upsert_validator import ValidatorElection # noqa
from planetmint.elections.vote import Vote # noqa
from planetmint.migrations.chain_migration_election import ChainMigrationElection
from planetmint.lib import Planetmint
from planetmint.core import App
Transaction.register_type(Transaction.CREATE, models.Transaction)
Transaction.register_type(Transaction.TRANSFER, models.Transaction)
Transaction.register_type(ValidatorElection.OPERATION, ValidatorElection)
Transaction.register_type(ChainMigrationElection.OPERATION, ChainMigrationElection)
Transaction.register_type(Vote.OPERATION, Vote)
| 48.157895 | 83 | 0.843716 | 112 | 915 | 6.830357 | 0.446429 | 0.128105 | 0.150327 | 0.028758 | 0.104575 | 0 | 0 | 0 | 0 | 0 | 0 | 0.014354 | 0.086339 | 915 | 18 | 84 | 50.833333 | 0.899522 | 0.234973 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | true | 0 | 0.583333 | 0 | 0.583333 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 1 | 0 | 1 | 0 | 0 | 3 |
a47f14ef05540515a4f9042e89d8b910b90095ce | 145 | py | Python | individual_code/eric/c_wrap/main.py | Sahmwell/G15_Capstone | 6d2944a6d472e82fe01b1a9bf28a8ae153abcb77 | [
"MIT"
] | 4 | 2020-11-13T02:35:56.000Z | 2021-03-29T20:15:54.000Z | individual_code/eric/c_wrap/main.py | Sahmwell/G15_Capstone | 6d2944a6d472e82fe01b1a9bf28a8ae153abcb77 | [
"MIT"
] | 9 | 2020-12-09T02:12:39.000Z | 2021-02-18T00:15:28.000Z | individual_code/eric/c_wrap/main.py | Sahmwell/G15_Capstone | 6d2944a6d472e82fe01b1a9bf28a8ae153abcb77 | [
"MIT"
] | 1 | 2020-11-20T19:31:26.000Z | 2020-11-20T19:31:26.000Z | from env.SumoEnv import SumoEnv
import time
def main():
test = SumoEnv(1000, False)
test.reset()
if __name__ == '__main__':
main()
| 14.5 | 31 | 0.655172 | 19 | 145 | 4.578947 | 0.684211 | 0.298851 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.035398 | 0.22069 | 145 | 9 | 32 | 16.111111 | 0.734513 | 0 | 0 | 0 | 0 | 0 | 0.055172 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0.142857 | false | 0 | 0.285714 | 0 | 0.428571 | 0 | 1 | 0 | 0 | null | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 3 |
a490668f9b604569ced8ec71f2ac396f85e44572 | 275 | py | Python | notebooks/solutions/01-ex02-solutions.py | 0Architectus0/ml-workshop-intermediate-1-of-2 | e74fbfdc98355b8d5f8bc4829ff162d92515d053 | [
"MIT"
] | 10 | 2020-10-27T23:08:44.000Z | 2021-11-17T18:22:01.000Z | notebooks/solutions/01-ex02-solutions.py | 0Architectus0/ml-workshop-intermediate-1-of-2 | e74fbfdc98355b8d5f8bc4829ff162d92515d053 | [
"MIT"
] | null | null | null | notebooks/solutions/01-ex02-solutions.py | 0Architectus0/ml-workshop-intermediate-1-of-2 | e74fbfdc98355b8d5f8bc4829ff162d92515d053 | [
"MIT"
] | 20 | 2020-10-27T16:54:58.000Z | 2021-11-20T03:48:55.000Z | from sklearn.model_selection import cross_validate
import pandas as pd
results = cross_validate(log_reg, X_train, y_train, cv=4)
pd.DataFrame(results)
multi_results = cross_validate(log_reg, X_train, y_train, cv=4, scoring=["f1", "accuracy"])
pd.DataFrame(multi_results)
| 25 | 91 | 0.789091 | 44 | 275 | 4.659091 | 0.522727 | 0.190244 | 0.195122 | 0.22439 | 0.4 | 0.4 | 0.4 | 0.4 | 0.4 | 0.4 | 0 | 0.012146 | 0.101818 | 275 | 10 | 92 | 27.5 | 0.817814 | 0 | 0 | 0 | 0 | 0 | 0.036364 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | false | 0 | 0.333333 | 0 | 0.333333 | 0 | 0 | 0 | 0 | null | 0 | 1 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 3 |
a4924d8493a561596ee53d4e7141d9c2c6002e25 | 3,531 | py | Python | tinderbox/services/__init__.py | ramonmoraes8080/py-tinder-cli | 2a8b2b0c8ef1ff782024f4b82ddbb85dd0d2ceb3 | [
"MIT"
] | null | null | null | tinderbox/services/__init__.py | ramonmoraes8080/py-tinder-cli | 2a8b2b0c8ef1ff782024f4b82ddbb85dd0d2ceb3 | [
"MIT"
] | null | null | null | tinderbox/services/__init__.py | ramonmoraes8080/py-tinder-cli | 2a8b2b0c8ef1ff782024f4b82ddbb85dd0d2ceb3 | [
"MIT"
] | null | null | null | import time
import yaml
from tinderbox.api import *
class BaseEntity(object):
def __init__(self, data):
self.data = data
class Recomendation(BaseEntity):
def get_number(self):
return self.data['s_number']
def get_id(self):
return self.data['user']['_id']
class Message(object):
def __init__(self, data):
self.data = data
def get_id(self):
return self.data['_id']
def get_content(self):
return self.data['message']
def get_sent_date(self):
return self.data['sent_date']
def get_sender_id(self):
return self.data['from']
def get_destinatary_id(self):
return self.data['to']
class Match(object):
def __init__(self, data, credential):
self.data = data
self.credential = credential
def get_name(self):
return self.data['person']['name']
def get_id(self):
return self.data["_id"]
def get_number(self):
print(self.data)
return self.data["person"]["s_number"]
def send_msg(self, text):
payload = {
"userId": self.data["_id"][:24],
"otherId": self.data["_id"][-24:],
"tempMessageId": "0.7496613406628272", # TODO Do we really need this one?
"matchId": self.data["_id"],
# "match": self.data, # TODO Do we really need this one?
"sessionId": "a78c13fe-1342-4d06-aaab-d91d6e704128",
"message": text
}
return MessageEndpoint(
credential=self.credential,
match_id=self.data["_id"],
).post(json_data=payload)
def unmatch(self):
resp = MessageEndpoint(credential=self.credential, match_id=self.get_id()).delete()
class Tinder(object):
def __init__(self, cfg_path):
self.cfg = yaml.safe_load(open(cfg_path, 'r'))
self.credential = XAuthTokenCredential(token=self.cfg['auth']['token'])
def like(self, recs):
for rec in recs:
uid = rec.get_id()
s_number = rec.get_number()
time.sleep(self.cfg['like']['delay'])
yield uid, LikeEndpoint(credential=self.credential, uid=uid)\
.post(json_data={"s_number": s_number})
def get_recommendations(self):
resp = RecommendationsEndpoint(credential=self.credential).get()
return [Recomendation(rec) for rec in resp.json().get('data', {}).get('results', [])]
def all_matches(self):
ret = self.all_matches_no_messages_yet()
resp = AllMatchesIceBreaked(credential=self.credential, page_token='').get()
ret += [Match(match, self.credential) for match in resp.json()['data']['matches']]
return ret
def all_engaged_matches(self):
resp = AllMatchesIceBreaked(credential=self.credential, page_token='').get()
ret = [Match(match, self.credential) for match in resp.json()['data']['matches']]
return ret
def all_matches_no_messages_yet(self):
resp = AllMatches(credential=self.credential, page_token='').get()
return [Match(match, self.credential) for match in resp.json()['data']['matches']]
def get_last_msg(self, match_id):
resp = MatchMessages(credential=self.credential, match_id=match_id).get()
return [Message(msg) for msg in resp.json()['data']['messages']]
def change_location(self, lat, lon):
resp = TravelEndpoint(credential=self.credential).post(json_data={'lat': lat, 'lon': lon})
return resp
| 30.704348 | 98 | 0.615406 | 432 | 3,531 | 4.856481 | 0.236111 | 0.083889 | 0.06673 | 0.077216 | 0.379409 | 0.315062 | 0.297903 | 0.214013 | 0.182555 | 0.182555 | 0 | 0.015367 | 0.244407 | 3,531 | 114 | 99 | 30.973684 | 0.77099 | 0.024639 | 0 | 0.170732 | 0 | 0 | 0.078779 | 0.010465 | 0 | 0 | 0 | 0.008772 | 0 | 1 | 0.280488 | false | 0 | 0.036585 | 0.109756 | 0.585366 | 0.012195 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 1 | 1 | 0 | 0 | 3 |
f10d23d9a96919a2fe82d70f756fc0e32589bcaf | 746 | py | Python | src/lib/hxPy/py/hxpy/hxpy/haystack/ref.py | jamesdgessel/hxpy_adjustments | 25010dd023bdc36cc08e1afc08ac16159aba5646 | [
"AFL-3.0"
] | 35 | 2021-05-04T18:50:16.000Z | 2022-02-27T05:15:35.000Z | src/lib/hxPy/py/hxpy/hxpy/haystack/ref.py | jamesdgessel/hxpy_adjustments | 25010dd023bdc36cc08e1afc08ac16159aba5646 | [
"AFL-3.0"
] | 7 | 2021-07-12T08:06:14.000Z | 2022-03-19T08:46:08.000Z | src/lib/hxPy/py/hxpy/hxpy/haystack/ref.py | jamesdgessel/hxpy_adjustments | 25010dd023bdc36cc08e1afc08ac16159aba5646 | [
"AFL-3.0"
] | 4 | 2021-05-11T18:53:16.000Z | 2022-03-17T04:15:48.000Z | # -*- coding: utf-8 -*-
#
# Copyright (c) 2021, SkyFoundry LLC
# Licensed under the Academic Free License version 3.0
#
# History:
# 07 Dec 2021 Matthew Giannini Creation
#
class Ref:
@staticmethod
def make_handle(handle):
time = (handle >> 32) & 0xffff_ffff
rand = handle & 0xffff_ffff
return Ref(f"{format(time, '08x')}-{format(rand, '08x')}")
def __init__(self, id, dis=None):
self._id = id
self._dis = dis
def id(self):
return self._id
def dis(self):
return self._dis
def __str__(self):
return f'{self.id()}'
def __eq__(self, other):
if isinstance(other, Ref):
return self.id() == other.id()
return False
# Ref
| 20.722222 | 66 | 0.573727 | 96 | 746 | 4.260417 | 0.510417 | 0.07335 | 0.06846 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.039924 | 0.294906 | 746 | 35 | 67 | 21.314286 | 0.737643 | 0.219839 | 0 | 0 | 0 | 0 | 0.094406 | 0.036713 | 0 | 0 | 0 | 0 | 0 | 1 | 0.315789 | false | 0 | 0 | 0.157895 | 0.684211 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 1 | 1 | 0 | 0 | 3 |
f136374432a6f4d37758da73ecd9b79c4eee943b | 24 | py | Python | tests/test_data_default.py | aivisol/py-usaepay | 31f64aa387075bb78503fe1ed5c70fd2afebceb2 | [
"BSD-3-Clause"
] | null | null | null | tests/test_data_default.py | aivisol/py-usaepay | 31f64aa387075bb78503fe1ed5c70fd2afebceb2 | [
"BSD-3-Clause"
] | null | null | null | tests/test_data_default.py | aivisol/py-usaepay | 31f64aa387075bb78503fe1ed5c70fd2afebceb2 | [
"BSD-3-Clause"
] | null | null | null | txn_key = "YOUR_API_KEY" | 24 | 24 | 0.791667 | 5 | 24 | 3.2 | 0.8 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.083333 | 24 | 1 | 24 | 24 | 0.727273 | 0 | 0 | 0 | 0 | 0 | 0.48 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | false | 0 | 0 | 0 | 0 | 0 | 1 | 1 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 3 |
f145cf6a456b5f14e5964d84a68608d68da742c9 | 1,557 | py | Python | details.py | ezekielkibiego/Password-Locker | 151f23db59f704da7a215bb5f27152ba5f34b647 | [
"MIT"
] | null | null | null | details.py | ezekielkibiego/Password-Locker | 151f23db59f704da7a215bb5f27152ba5f34b647 | [
"MIT"
] | null | null | null | details.py | ezekielkibiego/Password-Locker | 151f23db59f704da7a215bb5f27152ba5f34b647 | [
"MIT"
] | null | null | null | import random
import string
class Details():
user_details = []
def __init__(self, account_media, user_account_username, user_account_password):
'''
Function to initialize user details.
'''
self.account_media = account_media
self.user_account_username = user_account_username
self.user_account_password = user_account_password
def save_details(self):
'''
Function to save details into user_details.
'''
Details.user_details.append(self)
def delete_details(self):
'''
Function to delete saved detail from the user_details.
'''
Details.user_details.remove(self)
@classmethod
def find_by_account_media(cls, account_media):
'''
Method to take and return details that match the account_name.
'''
for details in cls.user_details:
if details.account_media == account_media:
return details
return False
@classmethod
def display_details(cls):
'''
Method to return and display the all details.
'''
return cls.user_details
@classmethod
def generate_password(cls, password_length):
'''
Method to generate random password for a user creating a new account in the the user_details.
'''
password = string.ascii_uppercase + string.ascii_lowercase + string.digits + "~!@#$%^&*<?>"
return ''.join(random.choice(password) for i in range(password_length)) | 30.529412 | 104 | 0.626204 | 174 | 1,557 | 5.362069 | 0.316092 | 0.106109 | 0.057878 | 0.049303 | 0.126474 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.292871 | 1,557 | 51 | 105 | 30.529412 | 0.847411 | 0.217084 | 0 | 0.12 | 0 | 0 | 0.011342 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0.24 | false | 0.2 | 0.08 | 0 | 0.56 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 1 | 0 | 0 | 1 | 0 | 0 | 3 |
74b8a4e88f2d5dc250d51c734f67871140267ca1 | 489 | py | Python | src/main/anonymization/base_anonymization.py | BMW-InnovationLab/BMW-Anonymization-API | 6acc59fa18f1e668e6e80a7990aebbf2ab4ade5e | [
"Apache-2.0"
] | 108 | 2021-04-08T13:23:03.000Z | 2022-03-30T14:22:13.000Z | src/main/anonymization/base_anonymization.py | Elio-hanna/BMW-Anonymization-API | c8707bb8cae6524a8c46a6aaadac24fef051c1db | [
"Apache-2.0"
] | 1 | 2021-10-06T08:25:51.000Z | 2021-10-11T08:07:08.000Z | src/main/anonymization/base_anonymization.py | Elio-hanna/BMW-Anonymization-API | c8707bb8cae6524a8c46a6aaadac24fef051c1db | [
"Apache-2.0"
] | 12 | 2021-04-10T07:17:56.000Z | 2022-03-26T17:48:12.000Z | from abc import ABC, abstractmethod
class BaseAnonymization(ABC):
"""
Base anonymization class for the detection and the semantic anonymization
"""
@abstractmethod
def blurring(self, image, response, degree=None, id=None, mask=None):
pass
@abstractmethod
def pixelating(self, image, response, degree=None, id=None, mask=None):
pass
@abstractmethod
def blackening(self, image, response, degree=None, id=None, mask=None):
pass
| 25.736842 | 77 | 0.680982 | 57 | 489 | 5.842105 | 0.438596 | 0.153153 | 0.153153 | 0.207207 | 0.507508 | 0.507508 | 0.507508 | 0.507508 | 0.507508 | 0.507508 | 0 | 0 | 0.224949 | 489 | 18 | 78 | 27.166667 | 0.878628 | 0.149284 | 0 | 0.545455 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0.272727 | false | 0.272727 | 0.090909 | 0 | 0.454545 | 0 | 0 | 0 | 0 | null | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 3 |
74ccde711a13971f91441ea1032bba57a15065b8 | 3,758 | py | Python | quotesbot/pipelines.py | magasea/scrapy-example | 7d363169518f8931668aa6ef3f0b3bb3a22eedeb | [
"MIT"
] | null | null | null | quotesbot/pipelines.py | magasea/scrapy-example | 7d363169518f8931668aa6ef3f0b3bb3a22eedeb | [
"MIT"
] | null | null | null | quotesbot/pipelines.py | magasea/scrapy-example | 7d363169518f8931668aa6ef3f0b3bb3a22eedeb | [
"MIT"
] | null | null | null | # -*- coding: utf-8 -*-
# Define your item pipelines here
#
# Don't forget to add your pipeline to the ITEM_PIPELINES setting
# See: http://doc.scrapy.org/en/latest/topics/item-pipeline.html
from scrapy.exporters import JsonItemExporter
from quotesbot.service.mysqlservice import MysqlHandler
class QuotesbotPipeline(object):
def process_item(self, item, spider):
return item
sqlHandler = MysqlHandler()
class JsonPipeline(object):
def __init__(self):
self.file = open("gov.json", 'wb')
self.exporter = JsonItemExporter(self.file, encoding='utf-8', ensure_ascii=False)
self.exporter.start_exporting()
def close_spider(self, spider):
self.exporter.finish_exporting()
self.file.close()
def process_item(self, item, spider):
self.exporter.export_item(item)
for key_str in item:
if "second" in key_str:
print("begin to handle %s"%key_str)
else:
continue
keys = key_str.split(":")
province_code = keys[1].replace(".html", "0000")
province_name = keys[2]
parent_id = 0
sqlHandler.putdata_regin_gov(province_code, province_name, parent_id)
city_code = keys[4] if keys[4].isdigit() else keys[5]
city_name = keys[5] if keys[4].isdigit() else keys[4]
city_code = city_code[:6]
city_parent_id = province_code
sqlHandler.putdata_regin_gov(city_code, city_name, city_parent_id)
subItem = item[key_str]
for sub_key_str in subItem:
county = subItem[sub_key_str]
county_code = county[0] if county[0].isdigit() else county[1]
county_name = county[1] if county[0].isdigit() else county[0]
county_code = county_code[:6]
county_parent_id = city_code
sqlHandler.putdata_regin_gov(county_code, county_name, county_parent_id)
return item
class DetailPipeline(object):
def __init__(self):
self.file = open("gov.json", 'wb')
self.exporter = JsonItemExporter(self.file, encoding='utf-8', ensure_ascii=False)
self.exporter.start_exporting()
def close_spider(self, spider):
self.exporter.finish_exporting()
self.file.close()
def process_item(self, item, spider):
self.exporter.export_item(item)
for key_str in item:
if "third" in key_str:
print("begin to handle %s"%key_str)
else:
continue
keys = key_str.split(":")
province_code = keys[1].replace(".html", "0000000000")
province_name = keys[2]
parent_id = 0
sqlHandler.putdata_regin_gov(province_code, province_name, parent_id)
city_code = keys[4] if keys[4].isdigit() else keys[5]
city_name = keys[5] if keys[4].isdigit() else keys[4]
city_parent_id = province_code
sqlHandler.putdata_regin_gov(city_code, city_name, city_parent_id)
county_code = keys[7] if keys[7].isdigit() else keys[8]
county_name = keys[8] if keys[7].isdigit() else keys[7]
county_parent_id = city_code
sqlHandler.putdata_regin_gov(county_code, county_name, county_parent_id)
subItem = item[key_str]
for sub_key_str in subItem:
town = subItem[sub_key_str]
town_code = town[0] if town[0].isdigit() else town[1]
town_name = town[1] if town[0].isdigit() else town[0]
town_parent_id = county_code
sqlHandler.putdata_regin_gov(town_code, town_name, town_parent_id)
return item | 38.742268 | 89 | 0.614156 | 483 | 3,758 | 4.540373 | 0.202899 | 0.038304 | 0.070223 | 0.079799 | 0.731874 | 0.71865 | 0.642043 | 0.642043 | 0.642043 | 0.642043 | 0 | 0.020492 | 0.28579 | 3,758 | 97 | 90 | 38.742268 | 0.796572 | 0.047898 | 0 | 0.710526 | 0 | 0 | 0.028827 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0.092105 | false | 0 | 0.026316 | 0.013158 | 0.197368 | 0.026316 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 3 |
2d1907a50aad051fb2ebe051e2ad3b083a8007b1 | 2,726 | py | Python | day08/test.py | mpirnat/aoc2016 | 1aec59aca01541d0d1c30f85d4668959c82fa35c | [
"MIT"
] | null | null | null | day08/test.py | mpirnat/aoc2016 | 1aec59aca01541d0d1c30f85d4668959c82fa35c | [
"MIT"
] | null | null | null | day08/test.py | mpirnat/aoc2016 | 1aec59aca01541d0d1c30f85d4668959c82fa35c | [
"MIT"
] | null | null | null | #!/usr/bin/env python
import unittest
from day08 import Screen
class TestInitializingScreen(unittest.TestCase):
def test_inits_screen(self):
screen = Screen(3, 5)
self.assertEqual(len(screen.data), 3)
self.assertEqual(len(screen.data[0]), 5)
class TestParsingCommands(unittest.TestCase):
cases = (
('rect 3x2', ('rect', (3, 2))),
('rotate column x=1 by 1', ('rotate_column', (1, 1))),
('rotate row y=1 by 2', ('rotate_row', (1, 2))),
)
def test_parses_commands(self):
screen = Screen(3, 5)
for command, expected in self.cases:
parsed = screen.parse_command(command)
self.assertEqual(parsed[0].__name__, expected[0])
self.assertEqual(parsed[1], expected[1])
class TestManipulatingScreen(unittest.TestCase):
def test_rect(self):
screen = Screen(3, 7)
screen.rect(3, 2)
self.assertEqual(screen.data,
[[True, True, True, False, False, False, False],
[True, True, True, False, False, False, False],
[False]*7])
def test_rotate_column(self):
screen = Screen(3, 7)
screen.rect(3, 2)
screen.rotate_column(1, 2)
self.assertEqual(screen.data,
[[True, True, True, False, False, False, False],
[True, False, True, False, False, False, False],
[False, True, False, False, False, False, False]])
def test_rotate_row(self):
screen = Screen(3, 7)
screen.rect(3, 2)
screen.rotate_row(1, 1)
self.assertEqual(screen.data,
[[True, True, True, False, False, False, False],
[False, True, True, True, False, False, False],
[False]*7])
def test_example_input(self):
screen = Screen(3, 7)
screen.rect(3, 2)
screen.rotate_column(1, 1)
screen.rotate_row(0, 4)
screen.rotate_column(1, 1)
self.assertEqual(screen.data,
[[False, True, False, False, True, False, True],
[True, False, True, False, False, False, False],
[False, True, False, False, False, False, False]])
class TestCountingLitPixels(unittest.TestCase):
cases = (
([[False, False, False], [False, False, False]], 0),
([[True, False, False], [False, False, True]], 2),
([[True, True, True], [True, True, True]], 6),
)
def test_counts_lit_pixels(self):
for data, expected in self.cases:
screen = Screen(3,2)
screen.data = data
self.assertEqual(screen.count_lit_pixels(), expected)
if __name__ == '__main__':
unittest.main()
| 31.333333 | 67 | 0.56493 | 326 | 2,726 | 4.613497 | 0.177914 | 0.279255 | 0.299202 | 0.25266 | 0.539229 | 0.414229 | 0.37633 | 0.365691 | 0.362367 | 0.343085 | 0 | 0.030161 | 0.294571 | 2,726 | 86 | 68 | 31.697674 | 0.75195 | 0.007337 | 0 | 0.409091 | 0 | 0 | 0.031054 | 0 | 0 | 0 | 0 | 0 | 0.136364 | 1 | 0.106061 | false | 0 | 0.030303 | 0 | 0.227273 | 0 | 0 | 0 | 0 | null | 1 | 1 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 3 |
2d32f773ad931f827cbbe8e797dc647b66f1ce1b | 92 | py | Python | codeswiftr/app_stats/apps.py | bogdan-veliscu/dev-portfolio-website | 43eb323c67f3fd691388e79039e32479c1bc0974 | [
"Apache-2.0"
] | null | null | null | codeswiftr/app_stats/apps.py | bogdan-veliscu/dev-portfolio-website | 43eb323c67f3fd691388e79039e32479c1bc0974 | [
"Apache-2.0"
] | 4 | 2021-03-30T13:40:00.000Z | 2021-09-22T19:12:56.000Z | codeswiftr/app_stats/apps.py | bogdan-veliscu/dev-portfolio-website | 43eb323c67f3fd691388e79039e32479c1bc0974 | [
"Apache-2.0"
] | null | null | null | from django.apps import AppConfig
class AppStatsConfig(AppConfig):
name = 'app_stats'
| 15.333333 | 33 | 0.76087 | 11 | 92 | 6.272727 | 0.909091 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.163043 | 92 | 5 | 34 | 18.4 | 0.896104 | 0 | 0 | 0 | 0 | 0 | 0.097826 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | false | 0 | 0.333333 | 0 | 1 | 0 | 1 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 3 |
74140ea1e1777683484762dc73d69c978a952ba4 | 122 | py | Python | example/wallets/fetch_payment_address_by_id.py | oyeolamilekan/quidax-python | fa329bc21f03f28ddc26bd2bf25bad85ff37acc2 | [
"MIT"
] | 1 | 2021-09-07T17:52:27.000Z | 2021-09-07T17:52:27.000Z | example/wallets/fetch_payment_address_by_id.py | oyeolamilekan/quidax-python | fa329bc21f03f28ddc26bd2bf25bad85ff37acc2 | [
"MIT"
] | null | null | null | example/wallets/fetch_payment_address_by_id.py | oyeolamilekan/quidax-python | fa329bc21f03f28ddc26bd2bf25bad85ff37acc2 | [
"MIT"
] | null | null | null | from ..base import quidax
response = quidax.wallets.fetch_payment_address("<address_id>", "<currency>")
print(response)
| 20.333333 | 77 | 0.762295 | 15 | 122 | 6 | 0.8 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.090164 | 122 | 5 | 78 | 24.4 | 0.810811 | 0 | 0 | 0 | 0 | 0 | 0.180328 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | false | 0 | 0.333333 | 0 | 0.333333 | 0.333333 | 1 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 3 |
742dbd9437197e242dccff12a97531c3173faba1 | 730 | py | Python | mysite/blog/migrations/0003_auto_20200509_0956.py | mourice-oduor/Blog-Project-Django | 11706afe8a0bc23e6b5f79e4defc357450e72c83 | [
"MIT"
] | null | null | null | mysite/blog/migrations/0003_auto_20200509_0956.py | mourice-oduor/Blog-Project-Django | 11706afe8a0bc23e6b5f79e4defc357450e72c83 | [
"MIT"
] | null | null | null | mysite/blog/migrations/0003_auto_20200509_0956.py | mourice-oduor/Blog-Project-Django | 11706afe8a0bc23e6b5f79e4defc357450e72c83 | [
"MIT"
] | null | null | null | # Generated by Django 3.0.4 on 2020-05-09 09:56
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('blog', '0002_auto_20200509_0450'),
]
operations = [
migrations.AlterField(
model_name='comment',
name='approved_comment',
field=models.BooleanField(default=False),
),
migrations.AlterField(
model_name='comment',
name='created_date',
field=models.DateTimeField(auto_now_add=True),
),
migrations.AlterField(
model_name='post',
name='created_date',
field=models.DateTimeField(auto_now_add=True),
),
]
| 25.172414 | 58 | 0.582192 | 72 | 730 | 5.722222 | 0.569444 | 0.145631 | 0.182039 | 0.211165 | 0.441748 | 0.441748 | 0.257282 | 0.257282 | 0.257282 | 0.257282 | 0 | 0.061386 | 0.308219 | 730 | 28 | 59 | 26.071429 | 0.754455 | 0.061644 | 0 | 0.545455 | 1 | 0 | 0.124451 | 0.033675 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | false | 0 | 0.045455 | 0 | 0.181818 | 0 | 0 | 0 | 0 | null | 0 | 1 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 3 |
7433150e7302505b3c1ea5a7e8d11c5e8fce945c | 154 | py | Python | tests/test.py | techtimeflies/vulncat_scrapper | 81fe9297310c30e29ebfb539f95aaea48eefa1c4 | [
"MIT"
] | 1 | 2021-01-12T14:45:49.000Z | 2021-01-12T14:45:49.000Z | tests/test.py | techtimeflies/vulncat_scrapper | 81fe9297310c30e29ebfb539f95aaea48eefa1c4 | [
"MIT"
] | 1 | 2021-06-01T21:42:41.000Z | 2021-06-01T21:42:41.000Z | tests/test.py | techtimeflies/vulncat_scrapper | 81fe9297310c30e29ebfb539f95aaea48eefa1c4 | [
"MIT"
] | null | null | null | import pytest
from vulncat import vulncat
url="http://www.google.com"
def test_order_soup():
soup = app.order_soup(url)
assert soup is not None | 17.111111 | 30 | 0.727273 | 25 | 154 | 4.36 | 0.72 | 0.165138 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.175325 | 154 | 9 | 31 | 17.111111 | 0.858268 | 0 | 0 | 0 | 0 | 0 | 0.135484 | 0 | 0 | 0 | 0 | 0 | 0.166667 | 1 | 0.166667 | false | 0 | 0.333333 | 0 | 0.5 | 0 | 1 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 3 |
744973122745917879439eb4c52022e51ed01919 | 6,115 | py | Python | tests/environments/test_env_info.py | sony/nnabla-rl | 6a9a91ac5363b8611e0c9f736590729952a8d460 | [
"Apache-2.0"
] | 75 | 2021-06-14T02:35:19.000Z | 2022-03-23T04:30:24.000Z | tests/environments/test_env_info.py | sony/nnabla-rl | 6a9a91ac5363b8611e0c9f736590729952a8d460 | [
"Apache-2.0"
] | 2 | 2021-12-17T08:46:54.000Z | 2022-03-15T02:04:53.000Z | tests/environments/test_env_info.py | sony/nnabla-rl | 6a9a91ac5363b8611e0c9f736590729952a8d460 | [
"Apache-2.0"
] | 3 | 2021-06-15T13:32:57.000Z | 2022-03-25T16:53:14.000Z | # Copyright 2020,2021 Sony Corporation.
# Copyright 2021 Sony Group Corporation.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
import numpy as np
import pytest
import nnabla_rl.environments as E
from nnabla_rl.environments.environment_info import EnvironmentInfo
class TestEnvInfo(object):
@pytest.mark.parametrize("max_episode_steps", [None, 100, 10000, float('inf')])
def test_spec_max_episode_steps(self, max_episode_steps):
dummy_env = E.DummyContinuous(max_episode_steps=max_episode_steps)
env_info = EnvironmentInfo.from_env(dummy_env)
if max_episode_steps is None:
assert env_info.max_episode_steps == float('inf')
else:
assert env_info.max_episode_steps == max_episode_steps
def test_is_discrete_action_env(self):
dummy_env = E.DummyDiscrete()
env_info = EnvironmentInfo.from_env(dummy_env)
assert env_info.is_discrete_action_env()
assert not env_info.is_continuous_action_env()
def test_is_continuous_action_env(self):
dummy_env = E.DummyContinuous()
env_info = EnvironmentInfo.from_env(dummy_env)
assert not env_info.is_discrete_action_env()
assert env_info.is_continuous_action_env()
def test_is_discrete_state_env(self):
dummy_env = E.DummyDiscrete()
env_info = EnvironmentInfo.from_env(dummy_env)
assert env_info.is_discrete_state_env()
assert not env_info.is_continuous_state_env()
assert not env_info.is_tuple_state_env()
def test_is_continuous_state_env(self):
dummy_env = E.DummyContinuous()
env_info = EnvironmentInfo.from_env(dummy_env)
assert not env_info.is_discrete_state_env()
assert env_info.is_continuous_state_env()
assert not env_info.is_tuple_state_env()
def test_is_tuple_and_discrete_state_env(self):
dummy_env = E.DummyTupleDiscrete()
env_info = EnvironmentInfo.from_env(dummy_env)
assert env_info.is_discrete_state_env()
assert not env_info.is_continuous_state_env()
assert env_info.is_tuple_state_env()
def test_is_tuple_and_continuous_state_env(self):
dummy_env = E.DummyTupleContinuous()
env_info = EnvironmentInfo.from_env(dummy_env)
assert not env_info.is_discrete_state_env()
assert env_info.is_continuous_state_env()
assert env_info.is_tuple_state_env()
def test_action_shape_continuous(self):
dummy_env = E.DummyContinuous()
env_info = EnvironmentInfo.from_env(dummy_env)
assert env_info.action_shape == dummy_env.action_space.shape
def test_action_shape_discrete(self):
dummy_env = E.DummyDiscreteImg()
env_info = EnvironmentInfo.from_env(dummy_env)
assert env_info.action_shape == (1, )
def test_action_dim_continuous(self):
dummy_env = E.DummyContinuous()
env_info = EnvironmentInfo.from_env(dummy_env)
assert env_info.action_dim == dummy_env.action_space.shape[0]
def test_action_dim_discrete(self):
dummy_env = E.DummyDiscrete()
env_info = EnvironmentInfo.from_env(dummy_env)
assert env_info.action_dim == dummy_env.action_space.n
def test_state_shape_discrete(self):
dummy_env = E.DummyDiscrete()
env_info = EnvironmentInfo.from_env(dummy_env)
assert env_info.state_shape == (1, )
def test_state_shape_continuous(self):
dummy_env = E.DummyContinuous()
env_info = EnvironmentInfo.from_env(dummy_env)
assert env_info.state_shape == dummy_env.observation_space.shape
def test_state_shape_image(self):
dummy_env = E.DummyDiscreteImg()
env_info = EnvironmentInfo.from_env(dummy_env)
assert env_info.state_shape == dummy_env.observation_space.shape
def test_state_shape_tuple_discrete(self):
dummy_env = E.DummyTupleDiscrete()
env_info = EnvironmentInfo.from_env(dummy_env)
assert env_info.state_shape == ((1, ), (1, ))
def test_state_shape_tuple_continuous(self):
dummy_env = E.DummyTupleContinuous()
env_info = EnvironmentInfo.from_env(dummy_env)
assert env_info.state_shape == tuple(space.shape for space in dummy_env.observation_space)
def test_state_dim_discrete(self):
dummy_env = E.DummyDiscrete()
env_info = EnvironmentInfo.from_env(dummy_env)
assert env_info.state_dim == dummy_env.observation_space.n
def test_state_dim_continuous(self):
dummy_env = E.DummyContinuous()
env_info = EnvironmentInfo.from_env(dummy_env)
assert env_info.state_dim == dummy_env.observation_space.shape[0]
def test_state_dim_image(self):
dummy_env = E.DummyDiscreteImg()
env_info = EnvironmentInfo.from_env(dummy_env)
assert env_info.state_dim == np.prod(dummy_env.observation_space.shape)
def test_state_dim_tuple_discrete(self):
dummy_env = E.DummyTupleDiscrete()
env_info = EnvironmentInfo.from_env(dummy_env)
assert env_info.state_dim == tuple(space.n for space in env_info.observation_space)
def test_state_dim_tuple_continuous(self):
dummy_env = E.DummyTupleContinuous()
env_info = EnvironmentInfo.from_env(dummy_env)
assert env_info.state_dim == tuple(np.prod(space.shape) for space in env_info.observation_space)
def test_error_tuple_mixed_env(self):
dummy_env = E.DummyTupleMixed()
with pytest.raises(ValueError):
EnvironmentInfo.from_env(dummy_env)
if __name__ == "__main__":
pytest.main()
| 35.552326 | 104 | 0.722649 | 830 | 6,115 | 4.948193 | 0.149398 | 0.093742 | 0.075968 | 0.144631 | 0.769662 | 0.729486 | 0.680545 | 0.648405 | 0.638422 | 0.600925 | 0 | 0.006131 | 0.199836 | 6,115 | 171 | 105 | 35.760234 | 0.833231 | 0.097792 | 0 | 0.504587 | 0 | 0 | 0.005634 | 0 | 0 | 0 | 0 | 0 | 0.293578 | 1 | 0.201835 | false | 0 | 0.036697 | 0 | 0.247706 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 3 |
7465ca65150856f0dc94e2ce9979e494d60242ed | 110 | py | Python | users/urls.py | cromartie1020/dev | d005b2f3e1263907927c922a0d2318fc3c3043d4 | [
"MIT"
] | null | null | null | users/urls.py | cromartie1020/dev | d005b2f3e1263907927c922a0d2318fc3c3043d4 | [
"MIT"
] | null | null | null | users/urls.py | cromartie1020/dev | d005b2f3e1263907927c922a0d2318fc3c3043d4 | [
"MIT"
] | null | null | null | from django.urls import path
from . import views
urlpatterns = [
path('',views.UserForm, name='person')
] | 18.333333 | 42 | 0.7 | 14 | 110 | 5.5 | 0.714286 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.163636 | 110 | 6 | 43 | 18.333333 | 0.836957 | 0 | 0 | 0 | 0 | 0 | 0.054054 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | false | 0 | 0.4 | 0 | 0.4 | 0 | 1 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 3 |
746dc86b95e63240d6bc566494607e4d965f5044 | 535 | py | Python | windflow/services/templating.py | hartym/windflow | 69a2aeb3ab9d5bdfcd1d2ce8d5c9af14876cba23 | [
"Apache-2.0"
] | 2 | 2016-09-22T17:17:59.000Z | 2017-08-27T15:40:16.000Z | windflow/services/templating.py | hartym/windflow | 69a2aeb3ab9d5bdfcd1d2ce8d5c9af14876cba23 | [
"Apache-2.0"
] | 1 | 2019-10-21T14:58:12.000Z | 2019-10-21T14:58:13.000Z | windflow/services/templating.py | hartym/windflow | 69a2aeb3ab9d5bdfcd1d2ce8d5c9af14876cba23 | [
"Apache-2.0"
] | null | null | null | import simplejson
from jinja2 import Environment, FileSystemLoader
from windflow.services.base import Service
class Templating(Service):
"""
Jinja2 templating service.
"""
name = 'templating'
@property
def loader(self):
return FileSystemLoader('templates')
def __init__(self):
self.env = Environment(loader=self.loader)
self.env.filters['json'] = simplejson.dumps
def render(self, name, *args, **kwargs):
return self.env.get_template(name).render(*args, **kwargs)
| 22.291667 | 66 | 0.674766 | 58 | 535 | 6.137931 | 0.5 | 0.08427 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.004739 | 0.211215 | 535 | 23 | 67 | 23.26087 | 0.838863 | 0.048598 | 0 | 0 | 0 | 0 | 0.046748 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0.230769 | false | 0 | 0.230769 | 0.153846 | 0.769231 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 1 | 1 | 0 | 0 | 3 |
74722a26dee823def07601072aa1283775830e0d | 122 | py | Python | examples/HelloWorld-Functions.py | JStearsman/hello-worlds | 314ce36b4e7f38c357b87a6957afd1773b5f4ec5 | [
"Unlicense"
] | 81 | 2017-10-01T14:07:28.000Z | 2021-12-20T15:47:33.000Z | examples/HelloWorld-Functions.py | JStearsman/hello-worlds | 314ce36b4e7f38c357b87a6957afd1773b5f4ec5 | [
"Unlicense"
] | 333 | 2017-10-01T13:37:50.000Z | 2021-05-27T21:48:55.000Z | examples/HelloWorld-Functions.py | JStearsman/hello-worlds | 314ce36b4e7f38c357b87a6957afd1773b5f4ec5 | [
"Unlicense"
] | 739 | 2017-10-01T13:42:46.000Z | 2021-12-24T11:39:49.000Z | def Func2() :
if 1==1:
print "Hello World"
def Func1() :
if 1==1:
Func2 ()
if 1 > 0:
Func1() | 12.2 | 27 | 0.434426 | 18 | 122 | 2.944444 | 0.5 | 0.169811 | 0.301887 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.136986 | 0.401639 | 122 | 10 | 28 | 12.2 | 0.589041 | 0 | 0 | 0.25 | 0 | 0 | 0.089431 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | null | 0 | 0 | null | null | 0.125 | 1 | 0 | 0 | null | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 3 |
7771054fa17aaaeae96c9b31c0199614e2db9975 | 165 | py | Python | cryptacular-feedstock/recipe/run_test.py | aovasylenko/aggregate | c9d31519e801bee7e06dcfb2094712b349ae87ba | [
"BSD-3-Clause"
] | 26 | 2017-08-29T21:03:46.000Z | 2022-03-30T22:57:27.000Z | cryptacular-feedstock/recipe/run_test.py | aovasylenko/aggregate | c9d31519e801bee7e06dcfb2094712b349ae87ba | [
"BSD-3-Clause"
] | 147 | 2017-08-13T04:31:27.000Z | 2022-03-07T11:22:23.000Z | cryptacular-feedstock/recipe/run_test.py | aovasylenko/aggregate | c9d31519e801bee7e06dcfb2094712b349ae87ba | [
"BSD-3-Clause"
] | 49 | 2017-08-09T13:28:57.000Z | 2021-03-09T12:45:20.000Z | from cryptacular.bcrypt import BCRYPTPasswordManager
manager = BCRYPTPasswordManager()
hashed = manager.encode('password')
assert manager.check(hashed, 'password')
| 27.5 | 52 | 0.818182 | 16 | 165 | 8.4375 | 0.6875 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.084848 | 165 | 5 | 53 | 33 | 0.89404 | 0 | 0 | 0 | 0 | 0 | 0.09697 | 0 | 0 | 0 | 0 | 0 | 0.25 | 1 | 0 | false | 1 | 0.25 | 0 | 0.25 | 0 | 1 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 3 |
777ee8c0f8aa9aced8c79bc99b8c8dc7530482ab | 371 | py | Python | py2app_tests/argv_app/main.py | flupke/py2app | 8eb6c618f9c63d6ac970fb145a7f7782b71bcb4d | [
"MIT"
] | 193 | 2020-01-15T09:34:20.000Z | 2022-03-18T19:14:16.000Z | py2app_tests/argv_app/main.py | flupke/py2app | 8eb6c618f9c63d6ac970fb145a7f7782b71bcb4d | [
"MIT"
] | 185 | 2020-01-15T08:38:27.000Z | 2022-03-27T17:29:29.000Z | py2app_tests/argv_app/main.py | flupke/py2app | 8eb6c618f9c63d6ac970fb145a7f7782b71bcb4d | [
"MIT"
] | 23 | 2020-01-24T14:47:18.000Z | 2022-02-22T17:19:47.000Z | import sys
import os
root = os.path.dirname(
os.path.dirname(
os.path.dirname(
os.path.dirname(
os.path.abspath(__file__)
)
)
)
)
sys.argv[0] = os.path.realpath(sys.argv[0])
fp = open(os.path.join(root, "argv.txt"), "w")
fp.write(repr(sys.argv))
fp.write('\n')
fp.close()
| 18.55 | 46 | 0.498652 | 49 | 371 | 3.693878 | 0.408163 | 0.232044 | 0.287293 | 0.331492 | 0.320442 | 0.320442 | 0.320442 | 0.320442 | 0.320442 | 0.320442 | 0 | 0.00813 | 0.336927 | 371 | 19 | 47 | 19.526316 | 0.727642 | 0 | 0 | 0.1875 | 0 | 0 | 0.02965 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | false | 0 | 0.125 | 0 | 0.125 | 0 | 0 | 0 | 0 | null | 1 | 1 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 3 |
7790b0189df0e688462d089c1a3cb1acd80c807a | 1,456 | py | Python | src/kids/sh/tests/test_cmd.py | 0k/kids.sh | d7ee6063754f442f22b1365a2e322264efe7a722 | [
"BSD-2-Clause"
] | null | null | null | src/kids/sh/tests/test_cmd.py | 0k/kids.sh | d7ee6063754f442f22b1365a2e322264efe7a722 | [
"BSD-2-Clause"
] | null | null | null | src/kids/sh/tests/test_cmd.py | 0k/kids.sh | d7ee6063754f442f22b1365a2e322264efe7a722 | [
"BSD-2-Clause"
] | null | null | null | # -*- encoding: utf-8 -*-
"""Testing Unittest facilities offered.
This doesn't test ``cmd`` command, but the ``self.cmd`` provided to
tests inheriting ``BaseShTest``.
"""
from .. import ShellError, BaseShTest
class CmdSimpleTest(BaseShTest):
def test_shell_call(self):
res = self.cmd("true")
self.assertEquals(res.out, "")
self.assertEquals(res.err, "")
self.assertEquals(res.errlvl, 0)
def test_full_bash_construct(self):
res = self.cmd("(false || true) && test -z "" > /dev/null")
self.assertEquals(res.out, "")
self.assertEquals(res.err, "")
self.assertEquals(res.errlvl, 0)
def test_fail(self):
res = self.cmd("false")
self.assertEquals(res.out, "")
self.assertEquals(res.err, "")
self.assertEquals(res.errlvl, 1)
def test_fail_and_out_err_catching(self):
res = self.cmd("echo -n 1 >&1 ; echo -n 2 >&2 ; exit 12")
self.assertEquals(res.out, "1")
self.assertEquals(res.err, "2")
self.assertEquals(res.errlvl, 12)
class CmdEnvTest(BaseShTest):
DEFAULT_ENV = {"MYVALUE": "XYXY"}
def test_shell_env(self):
res = self.cmd("echo -n $MYVALUE")
self.assertEquals(res.out, "XYXY")
def test_shell_inherit_main_process_env(self):
import os
os.environ["MYVALUE2"] = "ABAB"
res = self.cmd("echo -n $MYVALUE2")
self.assertEquals(res.out, "ABAB")
| 26.962963 | 67 | 0.610577 | 184 | 1,456 | 4.728261 | 0.347826 | 0.257471 | 0.305747 | 0.151724 | 0.36092 | 0.3 | 0.256322 | 0.256322 | 0.256322 | 0.256322 | 0 | 0.014363 | 0.23489 | 1,456 | 53 | 68 | 27.471698 | 0.766607 | 0.112637 | 0 | 0.25 | 0 | 0 | 0.119159 | 0 | 0 | 0 | 0 | 0 | 0.4375 | 1 | 0.1875 | false | 0 | 0.0625 | 0 | 0.34375 | 0 | 0 | 0 | 0 | null | 1 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 3 |
77a80824be5781261347cc583ac59cef590cd2e2 | 835 | py | Python | utilities/utilities.py | heshan007/HEPDrone | ec5f68da9648ac0a3d35f372295acbd628dede07 | [
"BSD-3-Clause"
] | 1 | 2018-08-29T18:07:30.000Z | 2018-08-29T18:07:30.000Z | utilities/utilities.py | konqr/HEPDrone | c1de4ad475d2e91ffcc75c846e46754299bd768b | [
"BSD-3-Clause"
] | null | null | null | utilities/utilities.py | konqr/HEPDrone | c1de4ad475d2e91ffcc75c846e46754299bd768b | [
"BSD-3-Clause"
] | null | null | null | import numpy as np
from math import log
# sigmoid activation as per example
def sigmoid_activation(x):
return 1.0 / (1.0+np.exp(-x))
# inverted sigmoid activation
def inv_sigmoid_activation(x):
return -1.0 * np.log((1.0-x)/x) if x > 0.0 else 0.0
# corresponding derivative
def sigmoid_prime(x):
return np.multiply(sigmoid_activation(x), (1-sigmoid_activation(x)))
# loss function
def dot_loss(p, b):
e = p - b
esq = e.dot(e.T)
return np.sum(np.array(esq)), e
# vector of partial derivatives for the output activations
def cost_derivative(out_act, y):
return out_act-y
# softmax
def softmax(x):
return np.exp(x) / np.sum(np.exp(x))
# Sample generator
def next_batch(x, y, batchsize):
for i in np.arange(0, x.shape[0], batchsize):
yield (x[i:i + batchsize], y[i:i + batchsize])
| 19.880952 | 72 | 0.671856 | 145 | 835 | 3.793103 | 0.4 | 0.185455 | 0.130909 | 0.087273 | 0.094545 | 0.094545 | 0 | 0 | 0 | 0 | 0 | 0.022288 | 0.194012 | 835 | 41 | 73 | 20.365854 | 0.794948 | 0.217964 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0.368421 | false | 0 | 0.105263 | 0.263158 | 0.789474 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 1 | 1 | 0 | 0 | 3 |
77b60b4ebe2ac5bf3088b1a7de31a457526833a4 | 317 | py | Python | Whatsapp.py | smssmit/whatsapp-auto-messager | 978cd89ad0c489f74e8557c878283657c3b3f8a8 | [
"MIT"
] | null | null | null | Whatsapp.py | smssmit/whatsapp-auto-messager | 978cd89ad0c489f74e8557c878283657c3b3f8a8 | [
"MIT"
] | null | null | null | Whatsapp.py | smssmit/whatsapp-auto-messager | 978cd89ad0c489f74e8557c878283657c3b3f8a8 | [
"MIT"
] | null | null | null | import pywhatkit as kit #installpywhatkit
import os
kit.sendwhatmsg("Enter your friends phone no. and add country code","Enter Your Message",24,00) #at the end enter time in 24 hours format
os.system("taskkill /im chrome.exe /f") #it will close the browser
os.system("shutdown /s /t 1") #it will shutdown the pc
| 52.833333 | 138 | 0.747634 | 55 | 317 | 4.309091 | 0.745455 | 0.075949 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.026217 | 0.157729 | 317 | 5 | 139 | 63.4 | 0.861423 | 0.328076 | 0 | 0 | 0 | 0 | 0.534314 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | true | 0 | 0.4 | 0 | 0.4 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 1 | 0 | 0 | 0 | 0 | 3 |
77bc64edc8471c0e5f5b9e30047f88af16d03ec5 | 221 | py | Python | warm-up/__init__.py | NibiruResearchCenter/discord-slash-command-hub | a7605bb6467ff4afbb17293579aaddbb0a12b977 | [
"MIT"
] | null | null | null | warm-up/__init__.py | NibiruResearchCenter/discord-slash-command-hub | a7605bb6467ff4afbb17293579aaddbb0a12b977 | [
"MIT"
] | null | null | null | warm-up/__init__.py | NibiruResearchCenter/discord-slash-command-hub | a7605bb6467ff4afbb17293579aaddbb0a12b977 | [
"MIT"
] | null | null | null | import datetime
import logging
import azure.functions as func
def main(mytimer: func.TimerRequest) -> None:
if mytimer.past_due:
logging.info('The timer is past due!')
logging.info('function warm up')
| 18.416667 | 46 | 0.710407 | 31 | 221 | 5.032258 | 0.709677 | 0.089744 | 0.179487 | 0.230769 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.19457 | 221 | 11 | 47 | 20.090909 | 0.876404 | 0 | 0 | 0 | 0 | 0 | 0.171946 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0.142857 | false | 0 | 0.428571 | 0 | 0.571429 | 0 | 0 | 0 | 0 | null | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 1 | 0 | 0 | 3 |
77be35f9ebfc4da8a7cbe5229976684f501ed1f6 | 758 | py | Python | ds_toolkit/bplist.py | davidsilva2841/ds-toolkit | d1f39a204db03eda87aa4f464ca0b044ece02357 | [
"MIT"
] | null | null | null | ds_toolkit/bplist.py | davidsilva2841/ds-toolkit | d1f39a204db03eda87aa4f464ca0b044ece02357 | [
"MIT"
] | null | null | null | ds_toolkit/bplist.py | davidsilva2841/ds-toolkit | d1f39a204db03eda87aa4f464ca0b044ece02357 | [
"MIT"
] | null | null | null | import plistlib
import json
from datetime import datetime
from ds_toolkit.files import write_to_file
def bplist_read_file(file_path):
"""
Reads a bplist file.
Args:
file_path (sttr):
Returns:
dict:
"""
with open(file_path, 'rb') as file:
return plistlib.load(file)
def bplist_write_bplist_to_json(bplist_file_path, to_file_path):
"""
Reads a bplist file and writes it to a json file.
Args:
bplist_file_path (str):
to_file_path (str):
"""
def _convert_datetime(o):
if isinstance(o, datetime):
return o.__str__()
data = bplist_read_file(bplist_file_path)
write_to_file(to_file_path, json.dumps(data, indent=2, default=_convert_datetime))
| 20.486486 | 86 | 0.662269 | 107 | 758 | 4.35514 | 0.373832 | 0.154506 | 0.090129 | 0.060086 | 0.103004 | 0.103004 | 0 | 0 | 0 | 0 | 0 | 0.001757 | 0.24934 | 758 | 36 | 87 | 21.055556 | 0.817223 | 0.234829 | 0 | 0 | 0 | 0 | 0.003839 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0.230769 | false | 0 | 0.307692 | 0 | 0.692308 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 1 | 0 | 1 | 0 | 0 | 3 |
77c032b36742db2c4bb6acabde7f06942af1064c | 1,322 | py | Python | gc_apps/gis_tabular/example_wm_response.py | IQSS/geoconnect | 09c91be7ffbc04fbfa9850f6b740277d971ac8a7 | [
"Apache-2.0"
] | 6 | 2015-10-28T15:35:04.000Z | 2020-08-20T10:18:33.000Z | gc_apps/gis_tabular/example_wm_response.py | IQSS/geoconnect | 09c91be7ffbc04fbfa9850f6b740277d971ac8a7 | [
"Apache-2.0"
] | 50 | 2015-01-05T15:09:00.000Z | 2021-06-30T04:11:36.000Z | gc_apps/gis_tabular/example_wm_response.py | IQSS/geoconnect | 09c91be7ffbc04fbfa9850f6b740277d971ac8a7 | [
"Apache-2.0"
] | 2 | 2017-02-28T02:18:49.000Z | 2017-07-14T02:40:43.000Z | {"tablejoin_id": 204,
"matched_record_count": 156,
"layer_join_attribute": "TRACT",
"join_layer_id": "641",
"worldmap_username": "rp",
"unmatched_records_list": "",
"layer_typename": "geonode:join_boston_census_blocks_0zm_boston_income_01tab_1_1",
"join_layer_url": "/data/geonode:join_boston_census_blocks_0zm_boston_income_01tab_1_1",
"join_layer_typename": "geonode:join_boston_census_blocks_0zm_boston_income_01tab_1_1",
"table_name": "boston_income_01tab_1_1",
"tablejoin_view_name": "join_boston_census_blocks_0zm_boston_income_01tab_1_1",
"unmatched_record_count": 0,
"layer_link": "http://localhost:8000/data/geonode:join_boston_census_blocks_0zm_boston_income_01tab_1_1",
"table_id": 330,
"table_join_attribute": "tract",
"llbbox": "[-71.1908629979881,42.2278900020655,-70.9862559993925,42.3987970008647]",
"map_image_link": "http://localhost:8000/download/wms/641/png?layers=geonode%3Ajoin_boston_census_blocks_0zm_boston_income_01tab_1_1&width=658&bbox=-71.190862998%2C42.2278900021%2C-70.9862559994%2C42.3987970009&service=WMS&format=image%2Fpng&srs=EPSG%3A4326&request=GetMap&height=550",
"layer_name": "geonode:join_boston_census_blocks_0zm_boston_income_01tab_1_1",
"embed_map_link": "http://localhost:8000/maps/embed/?layer=geonode:join_boston_census_blocks_0zm_boston_income_01tab_1_1"}
| 66.1 | 286 | 0.823752 | 199 | 1,322 | 4.944724 | 0.371859 | 0.109756 | 0.155488 | 0.164634 | 0.473577 | 0.454268 | 0.454268 | 0.454268 | 0.454268 | 0.413618 | 0 | 0.154028 | 0.04236 | 1,322 | 19 | 287 | 69.578947 | 0.623223 | 0 | 0 | 0 | 0 | 0.052632 | 0.869138 | 0.333585 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | true | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 3 |
77c44061babc0e0675773f2f6e9a46c0876bc169 | 117 | py | Python | __init__.py | aengelke/remx | 5ceb10239815a94a1560d6dba20d96ed26f50965 | [
"MIT"
] | null | null | null | __init__.py | aengelke/remx | 5ceb10239815a94a1560d6dba20d96ed26f50965 | [
"MIT"
] | null | null | null | __init__.py | aengelke/remx | 5ceb10239815a94a1560d6dba20d96ed26f50965 | [
"MIT"
] | null | null | null | import remx
__all__ = ["parse", "match", "extract"]
parse = remx.compile
match = remx.match
extract = remx.extract
| 14.625 | 39 | 0.700855 | 15 | 117 | 5.2 | 0.466667 | 0.307692 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.153846 | 117 | 7 | 40 | 16.714286 | 0.787879 | 0 | 0 | 0 | 0 | 0 | 0.145299 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | false | 0 | 0.2 | 0 | 0.2 | 0 | 1 | 0 | 0 | null | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 3 |
77db0e2d58df07387372e03a0d7cbe1b6c821e7b | 394 | py | Python | explib/explib/model/resnet.py | jacqueschen1/adam_sgd_heavy_tails | d4ecab6d460fb44ac3fd2b865641b8e47f3848ee | [
"Apache-2.0"
] | 1 | 2021-12-02T21:47:46.000Z | 2021-12-02T21:47:46.000Z | explib/explib/model/resnet.py | jacqueschen1/adam_sgd_heavy_tails | d4ecab6d460fb44ac3fd2b865641b8e47f3848ee | [
"Apache-2.0"
] | null | null | null | explib/explib/model/resnet.py | jacqueschen1/adam_sgd_heavy_tails | d4ecab6d460fb44ac3fd2b865641b8e47f3848ee | [
"Apache-2.0"
] | null | null | null | import torchvision.models as models
def getResNet(size, pretrained=False, model_args=None):
if size == 50:
return models.resnet50(pretrained=pretrained)
elif size == 34:
return models.resnet34(pretrained=pretrained)
elif size == 101:
return models.resnet101(pretrained=pretrained)
elif size == 18:
return models.resnet18(pretrained=pretrained)
| 30.307692 | 55 | 0.700508 | 45 | 394 | 6.111111 | 0.511111 | 0.174545 | 0.261818 | 0.305455 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.057692 | 0.208122 | 394 | 12 | 56 | 32.833333 | 0.823718 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0.1 | false | 0 | 0.1 | 0 | 0.6 | 0 | 0 | 0 | 0 | null | 0 | 1 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 3 |
7ac70fefdbe32181cc9dae47df13648d46544435 | 90 | py | Python | examples/server.py | jsbain/gittle | 557077d488cf1699ad4ee022cb9f4d09252ab95c | [
"Apache-2.0"
] | 4 | 2020-01-30T03:25:43.000Z | 2021-02-24T02:36:18.000Z | examples/server.py | justecorruptio/gittle | e046fe4731ebe4168884e51ac5baa26c79f0567d | [
"Apache-2.0"
] | 1 | 2019-01-24T05:04:07.000Z | 2019-01-24T05:04:07.000Z | examples/server.py | justecorruptio/gittle | e046fe4731ebe4168884e51ac5baa26c79f0567d | [
"Apache-2.0"
] | 7 | 2016-01-29T23:52:54.000Z | 2020-07-27T02:29:43.000Z | from gittle import GitServer
server = GitServer('/', 'localhost')
server.serve_forever()
| 18 | 36 | 0.755556 | 10 | 90 | 6.7 | 0.8 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.111111 | 90 | 4 | 37 | 22.5 | 0.8375 | 0 | 0 | 0 | 0 | 0 | 0.111111 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | false | 0 | 0.333333 | 0 | 0.333333 | 0 | 1 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 3 |
7ad2591efc8af835aacab099839ed3d17a97e9ef | 213 | py | Python | oarepo_model_builder/invenio/invenio_views.py | Alzpeta/oarepo-model-builder | 0684b505f3e6f41e964747190fe78b938d53182f | [
"MIT"
] | null | null | null | oarepo_model_builder/invenio/invenio_views.py | Alzpeta/oarepo-model-builder | 0684b505f3e6f41e964747190fe78b938d53182f | [
"MIT"
] | 21 | 2022-01-09T19:09:15.000Z | 2022-03-08T08:06:02.000Z | oarepo_model_builder/invenio/invenio_views.py | Alzpeta/oarepo-model-builder | 0684b505f3e6f41e964747190fe78b938d53182f | [
"MIT"
] | 2 | 2021-07-29T07:20:31.000Z | 2021-11-30T13:53:13.000Z | from .invenio_base import InvenioBaseClassPythonBuilder
class InvenioViewsBuilder(InvenioBaseClassPythonBuilder):
TYPE = 'invenio_views'
class_config = 'create_blueprint_from_app'
template = 'views'
| 26.625 | 57 | 0.802817 | 19 | 213 | 8.684211 | 0.736842 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.13615 | 213 | 7 | 58 | 30.428571 | 0.896739 | 0 | 0 | 0 | 0 | 0 | 0.201878 | 0.117371 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | false | 0 | 0.2 | 0 | 1 | 0.2 | 1 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 3 |
7ad72372b25aaa703bdb56b21f78ee702bd67d8e | 383 | py | Python | pymatgen/core/__init__.py | miaoliu/pymatgen | fe3c48ce3334924e6693f857aebc64b9714d1af2 | [
"MIT"
] | null | null | null | pymatgen/core/__init__.py | miaoliu/pymatgen | fe3c48ce3334924e6693f857aebc64b9714d1af2 | [
"MIT"
] | null | null | null | pymatgen/core/__init__.py | miaoliu/pymatgen | fe3c48ce3334924e6693f857aebc64b9714d1af2 | [
"MIT"
] | null | null | null | """
This package contains core modules and classes for representing structures and
operations on them.
"""
__author__ = "Shyue Ping Ong"
__date__ = "Dec 15, 2010 7:21:29 PM"
from .periodic_table import *
from .composition import *
from .structure import *
from .structure_modifier import *
from .bonds import *
from .lattice import *
from .sites import *
from .operations import *
| 22.529412 | 78 | 0.754569 | 52 | 383 | 5.365385 | 0.673077 | 0.250896 | 0.136201 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.034268 | 0.16188 | 383 | 16 | 79 | 23.9375 | 0.834891 | 0.255875 | 0 | 0 | 0 | 0 | 0.133574 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | false | 0 | 0.8 | 0 | 0.8 | 0 | 0 | 0 | 0 | null | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 1 | 0 | 0 | 3 |
7ade024c325db73539e0fbc0494d7899d59177da | 255 | py | Python | scripts/standard_logging.py | ange-yaghi/delta-studio | 8466623bdced4706c66643e2b790591517e56821 | [
"MIT"
] | 34 | 2020-07-10T14:23:49.000Z | 2022-03-31T23:38:36.000Z | scripts/standard_logging.py | ange-yaghi/delta-studio | 8466623bdced4706c66643e2b790591517e56821 | [
"MIT"
] | 7 | 2020-12-20T17:32:08.000Z | 2021-05-19T03:42:08.000Z | scripts/standard_logging.py | ange-yaghi/delta-studio | 8466623bdced4706c66643e2b790591517e56821 | [
"MIT"
] | 2 | 2021-02-09T20:04:04.000Z | 2022-01-26T08:46:20.000Z | def print_line():
print("-" * 60)
def print_full_header(build_step_name):
print_line()
print(" Build Step /// {}".format(build_step_name))
def print_footer():
print_line()
def log(level, data):
print("{0}: {1}".format(level, data))
| 19.615385 | 55 | 0.635294 | 36 | 255 | 4.222222 | 0.444444 | 0.157895 | 0.184211 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.019048 | 0.176471 | 255 | 12 | 56 | 21.25 | 0.704762 | 0 | 0 | 0.222222 | 0 | 0 | 0.105882 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0.444444 | false | 0 | 0 | 0 | 0.444444 | 0.888889 | 0 | 0 | 0 | null | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 3 |
bb0cd830accfcdb2875bbbceeb55c5fc5d271f9f | 182 | py | Python | networking/socket/main.py | kaka-lin/Notes | c22e1d5ba14b94653c644448edb1d775913b05ec | [
"MIT"
] | null | null | null | networking/socket/main.py | kaka-lin/Notes | c22e1d5ba14b94653c644448edb1d775913b05ec | [
"MIT"
] | 6 | 2020-06-10T02:56:37.000Z | 2022-02-27T10:13:12.000Z | networking/socket/main.py | kaka-lin/Notes | c22e1d5ba14b94653c644448edb1d775913b05ec | [
"MIT"
] | null | null | null | import socket
if __name__ == "__main__":
hostname = "example.org"
ip_address = socket.gethostbyname(hostname)
print(f"IP Address of the `{hostname}` is: {ip_address}")
| 22.75 | 61 | 0.686813 | 23 | 182 | 5 | 0.695652 | 0.234783 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.181319 | 182 | 7 | 62 | 26 | 0.771812 | 0 | 0 | 0 | 0 | 0 | 0.362637 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | false | 0 | 0.2 | 0 | 0.2 | 0.2 | 1 | 0 | 0 | null | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 3 |
bb15484f90cdae698567932415b4ae0f8322e219 | 304 | py | Python | malib/utils/exp_tools/tune_type.py | zbzhu99/malib | 5be07ac00761a34fb095adb2b3018a798ceea256 | [
"MIT"
] | 258 | 2021-05-10T11:17:45.000Z | 2022-03-30T13:41:09.000Z | malib/utils/exp_tools/tune_type.py | zbzhu99/malib | 5be07ac00761a34fb095adb2b3018a798ceea256 | [
"MIT"
] | 28 | 2021-05-13T06:50:04.000Z | 2022-03-30T14:19:15.000Z | malib/utils/exp_tools/tune_type.py | zbzhu99/malib | 5be07ac00761a34fb095adb2b3018a798ceea256 | [
"MIT"
] | 34 | 2021-05-31T16:17:49.000Z | 2022-03-26T06:59:59.000Z | from abc import ABCMeta
from typing import Sequence
class TuneUnit(metaclass=ABCMeta):
def __init__(self):
pass
class Grid(TuneUnit):
def __init__(self, data: Sequence):
super().__init__()
self._data = data
@property
def data(self):
return self._data
| 16.888889 | 39 | 0.644737 | 36 | 304 | 5.055556 | 0.5 | 0.131868 | 0.120879 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.266447 | 304 | 17 | 40 | 17.882353 | 0.816144 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0.25 | false | 0.083333 | 0.166667 | 0.083333 | 0.666667 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 1 | 0 | 0 | 1 | 0 | 0 | 3 |
bb19df6f8ea6654aa252e97b0de90d9f5f480787 | 414 | py | Python | lib/utils.py | ansonb/NeuralNetwork | 398c89db47f3007decfcafdf48cf0c5d9de3285e | [
"MIT"
] | null | null | null | lib/utils.py | ansonb/NeuralNetwork | 398c89db47f3007decfcafdf48cf0c5d9de3285e | [
"MIT"
] | null | null | null | lib/utils.py | ansonb/NeuralNetwork | 398c89db47f3007decfcafdf48cf0c5d9de3285e | [
"MIT"
] | null | null | null | import json
import numpy as np
class CustomEncoder(json.JSONEncoder):
def default(self, obj):
if isinstance(obj, np.int32):
return int(obj)
if isinstance(obj, np.int32):
return int(obj)
if isinstance(obj, np.int32):
return int(obj)
if isinstance(obj, np.int32):
return int(obj)
return json.JSONEncoder.default(self, obj) | 27.6 | 50 | 0.594203 | 52 | 414 | 4.730769 | 0.326923 | 0.081301 | 0.243902 | 0.292683 | 0.565041 | 0.565041 | 0.565041 | 0.565041 | 0.565041 | 0.565041 | 0 | 0.027875 | 0.306763 | 414 | 15 | 50 | 27.6 | 0.829268 | 0 | 0 | 0.615385 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0.076923 | false | 0 | 0.153846 | 0 | 0.692308 | 0 | 0 | 0 | 0 | null | 0 | 1 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 3 |
bb24ae1e3ac29d7cf55ec190e925f8a38c1122dd | 485 | py | Python | python/homework-2-s21-tema014/homework2.py | tema014/My-projects | 456987c53ffc70c91a289d3a3c020a9e9fd8132a | [
"Apache-2.0"
] | null | null | null | python/homework-2-s21-tema014/homework2.py | tema014/My-projects | 456987c53ffc70c91a289d3a3c020a9e9fd8132a | [
"Apache-2.0"
] | null | null | null | python/homework-2-s21-tema014/homework2.py | tema014/My-projects | 456987c53ffc70c91a289d3a3c020a9e9fd8132a | [
"Apache-2.0"
] | null | null | null | def histogram(data, n, b, h):
# data is a list
# n is an integer
# b and h are floats
# Write your code here
# return the variable storing the histogram
# Output should be a list
pass
def addressbook(name_to_phone, name_to_address):
#name_to_phone and name_to_address are both dictionaries
# Write your code here
# return the variable storing address_to_all
# Output should be a dictionary
pass
| 21.086957 | 61 | 0.635052 | 70 | 485 | 4.257143 | 0.5 | 0.080537 | 0.087248 | 0.114094 | 0.275168 | 0.275168 | 0.275168 | 0.275168 | 0 | 0 | 0 | 0 | 0.323711 | 485 | 22 | 62 | 22.045455 | 0.908537 | 0.587629 | 0 | 0.5 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.045455 | 0 | 1 | 0.5 | false | 0.5 | 0 | 0 | 0.5 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 1 | 0 | 0 | 1 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 3 |
bb3dfb9672224eee1c70237df0d0bc60cb9e83b2 | 40 | py | Python | src/poetry_hooks/utils/defaults.py | jvrana/poetry-hooks | a3f967ea4353c5466516b33a9c4576762f47350f | [
"MIT"
] | null | null | null | src/poetry_hooks/utils/defaults.py | jvrana/poetry-hooks | a3f967ea4353c5466516b33a9c4576762f47350f | [
"MIT"
] | null | null | null | src/poetry_hooks/utils/defaults.py | jvrana/poetry-hooks | a3f967ea4353c5466516b33a9c4576762f47350f | [
"MIT"
] | null | null | null | DEFAULT_VERSION_UP_NAME = "_version.py"
| 20 | 39 | 0.825 | 6 | 40 | 4.833333 | 0.833333 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.075 | 40 | 1 | 40 | 40 | 0.783784 | 0 | 0 | 0 | 0 | 0 | 0.275 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | false | 0 | 0 | 0 | 0 | 0 | 1 | 1 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 3 |
248cfa992c3f4de3c403cfb74dca95d9bd071208 | 355 | py | Python | otp/distributed/CentralLoggerAI.py | SuperM0use24/TT-CL-Edition | fdad8394f0656ae122b687d603f72afafd220c65 | [
"MIT"
] | 1 | 2021-02-25T06:02:04.000Z | 2021-02-25T06:02:04.000Z | otp/distributed/CentralLoggerAI.py | AnythingTechPro/Project-Altis | 7ead614abdb5072ca06323982de461f4e775d1b3 | [
"Apache-2.0"
] | 1 | 2021-06-08T17:16:48.000Z | 2021-06-08T17:16:48.000Z | otp/distributed/CentralLoggerAI.py | AnythingTechPro/Project-Altis | 7ead614abdb5072ca06323982de461f4e775d1b3 | [
"Apache-2.0"
] | 3 | 2021-06-03T05:36:36.000Z | 2021-06-22T15:07:31.000Z | from direct.directnotify import DirectNotifyGlobal
from direct.distributed.DistributedObjectAI import DistributedObjectAI
class CentralLoggerAI(DistributedObjectAI):
notify = DirectNotifyGlobal.directNotify.newCategory("CentralLoggerAI")
def sendMessage(self, todo0, todo1, todo2, todo3):
pass
def logAIGarbage(self):
pass
| 27.307692 | 75 | 0.780282 | 31 | 355 | 8.935484 | 0.645161 | 0.072202 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.013333 | 0.15493 | 355 | 12 | 76 | 29.583333 | 0.91 | 0 | 0 | 0.25 | 0 | 0 | 0.042373 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0.25 | false | 0.25 | 0.25 | 0 | 0.75 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 1 | 0 | 0 | 1 | 0 | 0 | 3 |
249b078fcf3e613fe7a4269e746027c1201c2f23 | 717 | py | Python | src/gsf/core/entity/properties/expression_property.py | RolandoAndrade/general-simulation-framework | 2fe2a981d365a7f482f6a7d4797a5f711b2dd502 | [
"MIT"
] | 1 | 2021-06-02T12:37:56.000Z | 2021-06-02T12:37:56.000Z | src/gsf/core/entity/properties/expression_property.py | RolandoAndrade/general-simulation-framework | 2fe2a981d365a7f482f6a7d4797a5f711b2dd502 | [
"MIT"
] | null | null | null | src/gsf/core/entity/properties/expression_property.py | RolandoAndrade/general-simulation-framework | 2fe2a981d365a7f482f6a7d4797a5f711b2dd502 | [
"MIT"
] | null | null | null | """Expression Property
=============================
Concrete property with expression type.
Example:
Creating the property::
property = ExpressionProperty(Value(1))
"""
from gsf.core.expressions.expression import Expression
from gsf.core.entity.core.entity_property import EntityProperty
from gsf.core.entity.core.property_type import PropertyType
class ExpressionProperty(EntityProperty):
"""Expression property
Defines a property with the expression type.
"""
def __init__(self, value: Expression):
super().__init__(value, PropertyType.EXPRESSION)
def get_value(self) -> Expression:
"""Returns the value of the property"""
return super().get_value()
| 25.607143 | 63 | 0.700139 | 77 | 717 | 6.363636 | 0.38961 | 0.042857 | 0.067347 | 0.069388 | 0.085714 | 0 | 0 | 0 | 0 | 0 | 0 | 0.001681 | 0.170153 | 717 | 27 | 64 | 26.555556 | 0.821849 | 0.384937 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0.25 | false | 0 | 0.375 | 0 | 0.875 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 1 | 0 | 1 | 0 | 0 | 3 |
24c073084fe8fd2e8e6be24fca14763b8117b4c5 | 681 | py | Python | catkin_ws/build/baxter_kinect_calibration/catkin_generated/pkg.installspace.context.pc.py | roop-pal/robotic-folding | a0e062ac6d23cd07fe10e3f45abc4ba50e533141 | [
"RSA-MD"
] | null | null | null | catkin_ws/build/baxter_kinect_calibration/catkin_generated/pkg.installspace.context.pc.py | roop-pal/robotic-folding | a0e062ac6d23cd07fe10e3f45abc4ba50e533141 | [
"RSA-MD"
] | null | null | null | catkin_ws/build/baxter_kinect_calibration/catkin_generated/pkg.installspace.context.pc.py | roop-pal/robotic-folding | a0e062ac6d23cd07fe10e3f45abc4ba50e533141 | [
"RSA-MD"
] | null | null | null | # generated from catkin/cmake/template/pkg.context.pc.in
CATKIN_PACKAGE_PREFIX = ""
PROJECT_PKG_CONFIG_INCLUDE_DIRS = "/home/parallels/catkin_ws/install/include".split(';') if "/home/parallels/catkin_ws/install/include" != "" else []
PROJECT_CATKIN_DEPENDS = "cv_bridge;image_geometry;image_transport;camera_info_manager;pcl_ros;roscpp;tf;visualization_msgs;std_msgs;tf2;message_runtime;sensor_msgs;geometry_msgs;resource_retriever;pcl_conversions;dynamic_reconfigure".replace(';', ' ')
PKG_CONFIG_LIBRARIES_WITH_PREFIX = "".split(';') if "" != "" else []
PROJECT_NAME = "baxter_kinect_calibration"
PROJECT_SPACE_DIR = "/home/parallels/catkin_ws/install"
PROJECT_VERSION = "0.2.0"
| 75.666667 | 252 | 0.801762 | 92 | 681 | 5.554348 | 0.641304 | 0.076321 | 0.111546 | 0.123288 | 0.191781 | 0.136986 | 0 | 0 | 0 | 0 | 0 | 0.006231 | 0.057269 | 681 | 8 | 253 | 85.125 | 0.78972 | 0.079295 | 0 | 0 | 1 | 0.142857 | 0.5696 | 0.5552 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | false | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 1 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 3 |
24c55bc3cd1172c5ec69c5968d77d4d3b0744ca4 | 1,005 | py | Python | model/group.py | IKeiran/FPT-Sinyakov | 08c5121d84c394bcee91d087ac2d14581179d2fd | [
"Apache-2.0"
] | null | null | null | model/group.py | IKeiran/FPT-Sinyakov | 08c5121d84c394bcee91d087ac2d14581179d2fd | [
"Apache-2.0"
] | null | null | null | model/group.py | IKeiran/FPT-Sinyakov | 08c5121d84c394bcee91d087ac2d14581179d2fd | [
"Apache-2.0"
] | null | null | null | __author__ = 'Keiran'
from sys import maxsize
def randomize_str(attr, max_len=5):
import random, string
symbols = string.ascii_letters + string.digits + " " * 10
return attr + "".join(random.choice(symbols) for i in range(max_len)).rstrip()
class Group:
def __init__(self, name=None, header=None, footer=None, id=None):
self.name = name
self.header = header
self.footer = footer
self.id = id
@classmethod
def random(cls):
return cls(name=randomize_str("Group_name"),
header=randomize_str("Group_header"),
footer=randomize_str("Group_footer"))
def __repr__(self):
return "%s:%s;%s;%s" % (self.id, self.name, self.header, self.footer)
def __eq__(self, other):
return (self.id is None or other.id is None or self.id == other.id) and self.name == other.name
def id_or_max(self):
if self.id:
return int(self.id)
else:
return maxsize | 29.558824 | 103 | 0.608955 | 137 | 1,005 | 4.262774 | 0.357664 | 0.061644 | 0.087329 | 0.034247 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.004093 | 0.270647 | 1,005 | 34 | 104 | 29.558824 | 0.792633 | 0 | 0 | 0 | 0 | 0 | 0.05169 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0.230769 | false | 0 | 0.076923 | 0.115385 | 0.576923 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 1 | 1 | 0 | 0 | 3 |
24cb5bc77ab0159d3fb3ff4b3c38eefb9ed167c0 | 530 | py | Python | a2e/model/_abstract_model.py | maechler/a2e | c28f546ca5fc3fdb9c740ea5f0f85d2aca044a00 | [
"MIT"
] | 1 | 2021-03-19T09:09:41.000Z | 2021-03-19T09:09:41.000Z | a2e/model/_abstract_model.py | maechler/a2e | c28f546ca5fc3fdb9c740ea5f0f85d2aca044a00 | [
"MIT"
] | null | null | null | a2e/model/_abstract_model.py | maechler/a2e | c28f546ca5fc3fdb9c740ea5f0f85d2aca044a00 | [
"MIT"
] | null | null | null | from abc import ABC, abstractmethod
from a2e.evaluation import EvaluationResult
class AbstractModel(ABC):
@abstractmethod
def evaluate(self, x_train, y_train, x_valid, y_valid, budget=None, **kwargs) -> EvaluationResult:
pass
@abstractmethod
def load_config(self, config: dict = None, **kwargs):
pass
def fit(self, x_train, y_train, x_valid=None, y_valid=None, budget=None, **kwargs):
raise NotImplementedError
def predict(self, x, **kwargs):
raise NotImplementedError
| 27.894737 | 102 | 0.698113 | 65 | 530 | 5.553846 | 0.415385 | 0.041551 | 0.055402 | 0.060942 | 0.121884 | 0.121884 | 0.121884 | 0 | 0 | 0 | 0 | 0.002375 | 0.20566 | 530 | 18 | 103 | 29.444444 | 0.855107 | 0 | 0 | 0.461538 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0.307692 | false | 0.153846 | 0.153846 | 0 | 0.538462 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 1 | 0 | 0 | 1 | 0 | 0 | 3 |
24fd0b579f239e862d9a317d015b4ff5876a77f0 | 94 | py | Python | fab.py | sander76/fab-dep | df0ee1c9fb7dab2af69f125a3764b9730b5b4866 | [
"MIT"
] | null | null | null | fab.py | sander76/fab-dep | df0ee1c9fb7dab2af69f125a3764b9730b5b4866 | [
"MIT"
] | 2 | 2021-04-23T08:23:58.000Z | 2021-04-23T08:31:43.000Z | fab.py | sander76/fab-dep | df0ee1c9fb7dab2af69f125a3764b9730b5b4866 | [
"MIT"
] | null | null | null | import logging
from fab_deploy import cli
_LOGGER = logging.getLogger(__name__)
cli.main()
| 11.75 | 37 | 0.787234 | 13 | 94 | 5.230769 | 0.769231 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.138298 | 94 | 7 | 38 | 13.428571 | 0.839506 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | false | 0 | 0.5 | 0 | 0.5 | 0 | 1 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 3 |
70053603da01df11723c7aa7ffd9225bc48fe29e | 288 | py | Python | lib/JumpScale/data/serializers/SerializerLZMA.py | Jumpscale/jumpscale_core8 | f80ac9b1ab99b833ee7adb17700dcf4ef35f3734 | [
"Apache-2.0"
] | 8 | 2016-04-14T14:04:57.000Z | 2020-06-09T00:24:34.000Z | lib/JumpScale/data/serializers/SerializerLZMA.py | Jumpscale/jumpscale_core8 | f80ac9b1ab99b833ee7adb17700dcf4ef35f3734 | [
"Apache-2.0"
] | 418 | 2016-01-25T10:30:00.000Z | 2021-09-08T12:29:13.000Z | lib/JumpScale/data/serializers/SerializerLZMA.py | Jumpscale/jumpscale_core8 | f80ac9b1ab99b833ee7adb17700dcf4ef35f3734 | [
"Apache-2.0"
] | 9 | 2016-04-21T07:21:17.000Z | 2022-01-24T10:35:54.000Z |
import pylzma
from SerializerBase import *
class SerializerLZMA(SerializerBase):
def __init__(self):
self.__jslocation__ = "j.data.serializer.lzma"
def dumps(self, obj):
return pylzma.compress(obj)
def loads(self, s):
return pylzma.decompress(s)
| 18 | 54 | 0.677083 | 33 | 288 | 5.666667 | 0.636364 | 0.128342 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.225694 | 288 | 15 | 55 | 19.2 | 0.838565 | 0 | 0 | 0 | 0 | 0 | 0.076655 | 0.076655 | 0 | 0 | 0 | 0 | 0 | 1 | 0.333333 | false | 0 | 0.222222 | 0.222222 | 0.888889 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 1 | 1 | 0 | 0 | 3 |
701caa91b18e77fe3edd041d8d46bfc7cfccf9c0 | 451 | py | Python | test/_example/color/full_text.py | jakob-bagterp/colorist-for-python | 6e9f9cc3a345cac7459cdc494f5fd635aecf19f7 | [
"MIT"
] | null | null | null | test/_example/color/full_text.py | jakob-bagterp/colorist-for-python | 6e9f9cc3a345cac7459cdc494f5fd635aecf19f7 | [
"MIT"
] | null | null | null | test/_example/color/full_text.py | jakob-bagterp/colorist-for-python | 6e9f9cc3a345cac7459cdc494f5fd635aecf19f7 | [
"MIT"
] | null | null | null | from colorist import black, blue, cyan, green, magenta, red, white, yellow
if __name__ == "__main__":
print("")
green("This is GREEN!")
print("")
yellow("This is YELLOW!")
print("")
red("This is RED!")
print("")
magenta("This is MAGENTA!")
print("")
blue("This is BLUE!")
print("")
cyan("This is CYAN!")
print("")
white("This is WHITE!")
print("")
black("This is BLACK!")
print("")
| 21.47619 | 74 | 0.545455 | 55 | 451 | 4.327273 | 0.309091 | 0.201681 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.259424 | 451 | 20 | 75 | 22.55 | 0.712575 | 0 | 0 | 0.473684 | 0 | 0 | 0.263858 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | true | 0 | 0.052632 | 0 | 0.052632 | 0.473684 | 0 | 0 | 0 | null | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 1 | 0 | 3 |
701e433dff8b0778f64f79f9148d66faf5946e2a | 82 | py | Python | package/modA/d.py | BekoBou/PEP328Import | 1f295e1ee5087403966d00e61d43939e69df7dfe | [
"MIT"
] | null | null | null | package/modA/d.py | BekoBou/PEP328Import | 1f295e1ee5087403966d00e61d43939e69df7dfe | [
"MIT"
] | null | null | null | package/modA/d.py | BekoBou/PEP328Import | 1f295e1ee5087403966d00e61d43939e69df7dfe | [
"MIT"
] | null | null | null | QUESTION = 'Answer to the Ultimate Question of Life, the Universe, and Everything' | 82 | 82 | 0.792683 | 12 | 82 | 5.416667 | 0.833333 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.146341 | 82 | 1 | 82 | 82 | 0.928571 | 0 | 0 | 0 | 0 | 0 | 0.831325 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | false | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 3 |
702102c9ea0858379c59ca45c21926e6f5b4aa0a | 414 | py | Python | dependency_checker/_nbdev.py | manisnesan/dependency_checker | 5e89071e6d61e00c88d1832590f001847c5228cd | [
"Apache-2.0"
] | null | null | null | dependency_checker/_nbdev.py | manisnesan/dependency_checker | 5e89071e6d61e00c88d1832590f001847c5228cd | [
"Apache-2.0"
] | null | null | null | dependency_checker/_nbdev.py | manisnesan/dependency_checker | 5e89071e6d61e00c88d1832590f001847c5228cd | [
"Apache-2.0"
] | null | null | null | # AUTOGENERATED BY NBDEV! DO NOT EDIT!
__all__ = ["index", "modules", "custom_doc_links", "git_url"]
index = {"get_installed_dependencies": "00_checker.ipynb",
"check_new_version": "00_checker.ipynb"}
modules = ["checker.py"]
doc_url = "https://muellerzr.github.io/dependency_checker/"
git_url = "https://github.com/muellerzr/dependency_checker/tree/master/"
def custom_doc_links(name): return None
| 27.6 | 72 | 0.731884 | 55 | 414 | 5.163636 | 0.654545 | 0.06338 | 0.098592 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.010899 | 0.113527 | 414 | 14 | 73 | 29.571429 | 0.762943 | 0.086957 | 0 | 0 | 1 | 0 | 0.603723 | 0.069149 | 0 | 0 | 0 | 0 | 0 | 1 | 0.142857 | false | 0 | 0 | 0.142857 | 0.142857 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 1 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 3 |
7047910513771762b409262925eb689ef84068d9 | 151 | py | Python | Chapter 03/ch3_2_4.py | bpbpublications/TEST-YOUR-SKILLS-IN-PYTHON-LANGUAGE | f6a4194684515495d00aa38347a725dd08f39a0c | [
"MIT"
] | null | null | null | Chapter 03/ch3_2_4.py | bpbpublications/TEST-YOUR-SKILLS-IN-PYTHON-LANGUAGE | f6a4194684515495d00aa38347a725dd08f39a0c | [
"MIT"
] | null | null | null | Chapter 03/ch3_2_4.py | bpbpublications/TEST-YOUR-SKILLS-IN-PYTHON-LANGUAGE | f6a4194684515495d00aa38347a725dd08f39a0c | [
"MIT"
] | null | null | null | import re
patterns = 'xy+?'
if re.search(patterns, "xz"):
print('Starts with x and has one y')
else:
print('No matching')
#No matching | 18.875 | 41 | 0.615894 | 23 | 151 | 4.043478 | 0.782609 | 0.215054 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.238411 | 151 | 8 | 42 | 18.875 | 0.808696 | 0.072848 | 0 | 0 | 0 | 0 | 0.330827 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | false | 0 | 0.166667 | 0 | 0.166667 | 0.333333 | 1 | 0 | 0 | null | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 3 |
70485dbc9eef73fbf365452d6bceaeff3f8218d4 | 894 | py | Python | src/ImageLibrary/screenshot_operations.py | Simakvokka/ImageLibrary | 487099843de02b40a44aa0376cbb6747bf8794d3 | [
"Apache-2.0"
] | 18 | 2019-12-02T07:34:20.000Z | 2021-11-03T15:49:04.000Z | src/ImageLibrary/screenshot_operations.py | Simakvokka/ImageLibrary | 487099843de02b40a44aa0376cbb6747bf8794d3 | [
"Apache-2.0"
] | 16 | 2020-01-21T15:11:55.000Z | 2021-11-22T17:39:06.000Z | src/ImageLibrary/screenshot_operations.py | Simakvokka/ImageLibrary | 487099843de02b40a44aa0376cbb6747bf8794d3 | [
"Apache-2.0"
] | 8 | 2020-01-17T12:43:07.000Z | 2021-04-29T16:10:17.000Z | from PIL import Image, ImageChops, ImageOps, ImageEnhance
class ScreenshotOperations:
"""Transform screenshot:
- changes contours
- changes contrast: pass float/int values
- changes brightness: pass float/int values
- invert image: invert image colors
"""
def __init__(self):
pass
def change_contour(self, image):
result = ImageOps.grayscale(image)
return result
def change_contrast(self, image, contrast):
enhancer = ImageEnhance.Contrast(image)
result = enhancer.enhance(float(contrast))
return result
def change_brightness(self, image, brightness):
enhancer = ImageEnhance.Brightness(image)
result = enhancer.enhance(float(brightness))
return result
def invert_image(self, image):
im = ImageOps.invert(image)
return im
| 27.090909 | 57 | 0.645414 | 90 | 894 | 6.322222 | 0.355556 | 0.077329 | 0.079086 | 0.063269 | 0.108963 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.277405 | 894 | 32 | 58 | 27.9375 | 0.880805 | 0.181208 | 0 | 0.166667 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0.277778 | false | 0.055556 | 0.055556 | 0 | 0.611111 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 1 | 0 | 0 | 1 | 0 | 0 | 3 |
7059dca23163bb2b1347a120ffb8381728354698 | 208 | py | Python | test/test_tetras.py | LucBerge/wallme | 3c76a08cb4d8ae916b2b12708a78263573f6b06a | [
"MIT"
] | 1 | 2019-08-29T17:27:36.000Z | 2019-08-29T17:27:36.000Z | test/test_tetras.py | LucBerge/wallme | 3c76a08cb4d8ae916b2b12708a78263573f6b06a | [
"MIT"
] | 2 | 2020-07-08T20:54:05.000Z | 2020-10-14T20:44:28.000Z | test/test_tetras.py | LucBerge/wallme | 3c76a08cb4d8ae916b2b12708a78263573f6b06a | [
"MIT"
] | 1 | 2020-10-01T05:58:11.000Z | 2020-10-01T05:58:11.000Z | # coding: utf8
from .test_website import TestWebsite
from wallme.websites import tetras
class TestTetras(TestWebsite):
def test_tetras(self):
self.simple_test("tetras", "tetras", None, tetras)
| 20.8 | 58 | 0.740385 | 26 | 208 | 5.807692 | 0.615385 | 0.13245 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.005747 | 0.163462 | 208 | 9 | 59 | 23.111111 | 0.862069 | 0.057692 | 0 | 0 | 0 | 0 | 0.061856 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0.2 | false | 0 | 0.4 | 0 | 0.8 | 0 | 1 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 3 |
708274bdb8ac8a841677a710ba9ad8f1dab01fd4 | 732 | py | Python | pathfinder/charsheet/migrations/0021_auto_20180820_1648.py | Tenebrar/codebase | 59c9a35289fb29afedad0e3edd0519b67372ef9f | [
"Unlicense"
] | 1 | 2020-04-21T11:39:25.000Z | 2020-04-21T11:39:25.000Z | pathfinder/charsheet/migrations/0021_auto_20180820_1648.py | Tenebrar/codebase | 59c9a35289fb29afedad0e3edd0519b67372ef9f | [
"Unlicense"
] | 7 | 2020-02-12T01:08:01.000Z | 2022-02-10T11:56:56.000Z | pathfinder/charsheet/migrations/0021_auto_20180820_1648.py | Tenebrar/codebase | 59c9a35289fb29afedad0e3edd0519b67372ef9f | [
"Unlicense"
] | null | null | null | # Generated by Django 2.0.6 on 2018-08-20 14:48
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('charsheet', '0020_auto_20180820_1639'),
]
operations = [
migrations.AlterField(
model_name='characterclass',
name='name',
field=models.CharField(max_length=32, unique=True),
),
migrations.AlterField(
model_name='race',
name='name',
field=models.CharField(max_length=32, unique=True),
),
migrations.AlterField(
model_name='skill',
name='name',
field=models.CharField(max_length=32, unique=True),
),
]
| 25.241379 | 63 | 0.571038 | 74 | 732 | 5.527027 | 0.527027 | 0.146699 | 0.183374 | 0.212714 | 0.501222 | 0.501222 | 0.501222 | 0.501222 | 0.501222 | 0.501222 | 0 | 0.073413 | 0.311475 | 732 | 28 | 64 | 26.142857 | 0.738095 | 0.061475 | 0 | 0.545455 | 1 | 0 | 0.09781 | 0.033577 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | false | 0 | 0.045455 | 0 | 0.181818 | 0 | 0 | 0 | 0 | null | 0 | 1 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 3 |
70a5cfaf5cf70850a416032cb5174a989229d7f0 | 844 | py | Python | objects/CSCG/_3d/exact_solutions/status/Stokes/sin_cos_1.py | mathischeap/mifem | 3242e253fb01ca205a76568eaac7bbdb99e3f059 | [
"MIT"
] | 1 | 2020-10-14T12:48:35.000Z | 2020-10-14T12:48:35.000Z | objects/CSCG/_3d/exact_solutions/status/Stokes/sin_cos_1.py | mathischeap/mifem | 3242e253fb01ca205a76568eaac7bbdb99e3f059 | [
"MIT"
] | null | null | null | objects/CSCG/_3d/exact_solutions/status/Stokes/sin_cos_1.py | mathischeap/mifem | 3242e253fb01ca205a76568eaac7bbdb99e3f059 | [
"MIT"
] | null | null | null |
from numpy import sin, pi, cos
from objects.CSCG._3d.exact_solutions.status.Stokes.base import Stokes_Base
# noinspection PyAbstractClass
class Stokes_SinCos1(Stokes_Base):
"""
The sin cos test case 1.
"""
def __init__(self, es):
super(Stokes_SinCos1, self).__init__(es)
self._es_.standard_properties.name = 'Stokes-sin-cos-1'
@property
def valid_time(self):
"""Return None because this exact solution is valid at any time."""
return None
def p(self, t, x, y, z):
return sin(2*pi*x) * sin(2*pi*y) * sin(2*pi*z)
def u(self, t, x, y, z):
return cos(2*pi*x) * sin(2*pi*y) * sin(2*pi*z)
def v(self, t, x, y, z):
return sin(2*pi*x) * cos(2*pi*y) * sin(2*pi*z)
def w(self, t, x, y, z):
return - 2 * sin(2*pi*x) * sin(2*pi*y) * cos(2*pi*z) | 28.133333 | 75 | 0.592417 | 149 | 844 | 3.234899 | 0.33557 | 0.074689 | 0.112033 | 0.058091 | 0.282158 | 0.282158 | 0.224066 | 0.224066 | 0.165975 | 0.165975 | 0 | 0.028346 | 0.24763 | 844 | 30 | 76 | 28.133333 | 0.730709 | 0.137441 | 0 | 0 | 0 | 0 | 0.022631 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0.352941 | false | 0 | 0.117647 | 0.235294 | 0.823529 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 1 | 1 | 0 | 0 | 3 |
56137e6f09dc13e4ebdb9cfd4bb7bc8bc4cd9611 | 188 | py | Python | tests/exploratory/custom_types/example/model.py | temoctzin/radish | 1d904b9a7bf9eb5b263c86e3fc3a996956747ecc | [
"MIT"
] | null | null | null | tests/exploratory/custom_types/example/model.py | temoctzin/radish | 1d904b9a7bf9eb5b263c86e3fc3a996956747ecc | [
"MIT"
] | null | null | null | tests/exploratory/custom_types/example/model.py | temoctzin/radish | 1d904b9a7bf9eb5b263c86e3fc3a996956747ecc | [
"MIT"
] | null | null | null | # -*- coding: utf-8 -*-
class Hero(object):
def __init__(self, forename, surname, hero):
self.forename = forename
self.surname = surname
self.heroname = hero
| 20.888889 | 48 | 0.601064 | 21 | 188 | 5.190476 | 0.571429 | 0.220183 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.007299 | 0.271277 | 188 | 8 | 49 | 23.5 | 0.788321 | 0.111702 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0.2 | false | 0 | 0 | 0 | 0.4 | 0 | 1 | 0 | 0 | null | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 3 |
5615b7de60c0135a159b025419517010b7181e65 | 2,265 | py | Python | individual_work/justin/sandbox/postman.py | marquettecomputationalsocialscience/clusteredcrimemaps | 4fb4ad1ad2474f854dabc1a72fbefcbb700d601a | [
"MIT"
] | 2 | 2017-11-16T23:22:53.000Z | 2018-02-05T21:04:03.000Z | individual_work/justin/sandbox/postman.py | marquettecomputationalsocialscience/clusteredcrimemaps | 4fb4ad1ad2474f854dabc1a72fbefcbb700d601a | [
"MIT"
] | null | null | null | individual_work/justin/sandbox/postman.py | marquettecomputationalsocialscience/clusteredcrimemaps | 4fb4ad1ad2474f854dabc1a72fbefcbb700d601a | [
"MIT"
] | 3 | 2017-08-06T22:44:45.000Z | 2018-10-28T02:11:56.000Z | import requests
import os
tract_array=[
14100,
14300,
14400,
14600,
14700,
14800,
14900,
15700,
15800,
15900,
16000,
16100,
16200,
16300,
16400,
16500,
16600,
16700,
16800,
16900,
17000,
17100,
17200,
17300,
17400,
17500,
17600,
17900,
18000,
18100,
18200,
18300,
18400,
18500,
18600,
18700,
18800,
18900,
19000,
19100,
19200,
19300,
19400,
19500,
19600,
19700,
19800,
19900,
20000,
20100,
20200,
20300,
20400,
20500,
20600,
20700,
20800,
20900,
21000,
21100,
21200,
21300,
21400,
21500,
21600,
21700,
21800,
160100,
185400,
185500,
185600,
185700,
185800,
185900,
186000,
186100,
186200,
186300,
186400,
186500,
186600,
186800,
186900,
187000,
187400,
200400,
470201,
980000,
]
for t in tract_array:
os.system('curl \'http://itmdapps.milwaukee.gov/publicApplication_QD/queryDownload/censusTractfm.faces\' -H \'Pragma: no-cache\' -H \'Origin: http://itmdapps.milwaukee.gov\' -H \'Accept-Encoding: gzip, deflate\' -H \'Accept-Language: en-US,en;q=0.8\' -H \'Upgrade-Insecure-Requests: 1\' -H \'User-Agent: Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/59.0.3071.115 Safari/537.36\' -H \'Content-Type: application/x-www-form-urlencoded\' -H \'Accept: text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,image/apng,*/*;q=0.8\' -H \'Cache-Control: no-cache\' -H \'Referer: http://itmdapps.milwaukee.gov/publicApplication_QD/queryDownload/censusTractfm.faces\' -H \'Cookie: __utma=116865050.1315341332.1498764272.1498764272.1498764272.1; __utmc=116865050; __utmz=116865050.1498764272.1.1.utmccn=(referral)|utmcsr=county.milwaukee.gov|utmcct=/mclio/geodata.html|utmcmd=referral; JSESSIONID=0001E9E1zKUwU6azGpK8curFv0_:166pun843; _ga=GA1.2.26612496.1498693947; _gid=GA1.2.1164893376.1498693947; _gat_gacity=1; _gat_gaitmd=1\' -H \'Connection: keep-alive\' -H \'DNT: 1\' --data \'formQuery%3AmenuCenId=' + str(t) + '&formQuery%3AselectRad=pop&dateFromCrime=MM%2FDD%2FYYYY&dateToCrime=MM%2FDD%2FYYYY&dateFromAcci=MM%2FDD%2FYYYY&dateToAcci=MM%2FDD%2FYYYY&formQuery%3AradioFormat=excel&formQuery%3AbuttonQueryId=Submit&formQuery_SUBMIT=1&javax.faces.ViewState=j_id17%3Aj_id18\' --compressed > ../maps/milwaukee_tracts/' + str(t) + '.xls') | 23.59375 | 1,475 | 0.724062 | 308 | 2,265 | 5.253247 | 0.714286 | 0.029666 | 0.029666 | 0.044499 | 0.092707 | 0.092707 | 0.092707 | 0.092707 | 0.092707 | 0.092707 | 0 | 0.326347 | 0.115232 | 2,265 | 96 | 1,475 | 23.59375 | 0.481038 | 0 | 0 | 0 | 0 | 0 | 0.060459 | 0.011033 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | false | 0 | 0.021277 | 0 | 0.021277 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 1 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 3 |
561c6bb72028108c591052c4a3ce301887e811c5 | 23 | py | Python | pyvi/__init__.py | minhpqn/pyvi | a31e8cf0d9c9c25f525e8b7e0f6af15e6c8d41b8 | [
"MIT"
] | 161 | 2016-11-01T08:35:02.000Z | 2022-03-16T10:03:51.000Z | pyvi/__init__.py | minhpqn/pyvi | a31e8cf0d9c9c25f525e8b7e0f6af15e6c8d41b8 | [
"MIT"
] | 11 | 2018-10-02T09:47:52.000Z | 2021-11-21T16:38:16.000Z | pyvi/__init__.py | minhpqn/pyvi | a31e8cf0d9c9c25f525e8b7e0f6af15e6c8d41b8 | [
"MIT"
] | 49 | 2016-11-02T02:13:10.000Z | 2022-02-14T15:09:46.000Z | __author__ = 'trungtv'
| 11.5 | 22 | 0.73913 | 2 | 23 | 6.5 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.130435 | 23 | 1 | 23 | 23 | 0.65 | 0 | 0 | 0 | 0 | 0 | 0.304348 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | false | 0 | 0 | 0 | 0 | 0 | 1 | 1 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 3 |
56387226ba6e8fab8a9c8c2b0a4d5b47f67aedee | 71 | py | Python | hello_world.py | Scyphiform123/Coding | c9e1192c76ea635be4a5aedfe1fe2534457b3dfd | [
"MIT"
] | null | null | null | hello_world.py | Scyphiform123/Coding | c9e1192c76ea635be4a5aedfe1fe2534457b3dfd | [
"MIT"
] | null | null | null | hello_world.py | Scyphiform123/Coding | c9e1192c76ea635be4a5aedfe1fe2534457b3dfd | [
"MIT"
] | null | null | null |
print("hello, what is your name?")
name = input()
print("hi " + name)
| 14.2 | 34 | 0.619718 | 11 | 71 | 4 | 0.727273 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.183099 | 71 | 4 | 35 | 17.75 | 0.758621 | 0 | 0 | 0 | 0 | 0 | 0.4 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | false | 0 | 0 | 0 | 0 | 0.666667 | 1 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 3 |
5676b1111442e232ccc89523ce68bb87671629af | 80 | py | Python | spider/homepro/homepro/spiders/test.py | yangtianzeng/Buddha-house-renting | adf89a1d34297b7ff049ecf31fa03caeb86f34fc | [
"Apache-2.0"
] | 2 | 2018-12-05T02:17:10.000Z | 2018-12-05T02:17:13.000Z | spider/homepro/homepro/spiders/test.py | yangtianzeng/Buddha-house-renting | adf89a1d34297b7ff049ecf31fa03caeb86f34fc | [
"Apache-2.0"
] | null | null | null | spider/homepro/homepro/spiders/test.py | yangtianzeng/Buddha-house-renting | adf89a1d34297b7ff049ecf31fa03caeb86f34fc | [
"Apache-2.0"
] | null | null | null | str = "http://zu.fang.com/house/i33/"
print(str.split('/house')[0].rstrip('/'))
| 26.666667 | 41 | 0.6125 | 13 | 80 | 3.769231 | 0.846154 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.039474 | 0.05 | 80 | 2 | 42 | 40 | 0.605263 | 0 | 0 | 0 | 0 | 0 | 0.45 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | false | 0 | 0 | 0 | 0 | 0.5 | 1 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 3 |
5676cb5aacbb52a19ce1e3559fbbcdadd9416f9f | 611 | py | Python | system/admin.py | ugractf/terminal-board | c08c9c2c54034aa91a8ce657c5c519acb245d0b0 | [
"MIT"
] | null | null | null | system/admin.py | ugractf/terminal-board | c08c9c2c54034aa91a8ce657c5c519acb245d0b0 | [
"MIT"
] | null | null | null | system/admin.py | ugractf/terminal-board | c08c9c2c54034aa91a8ce657c5c519acb245d0b0 | [
"MIT"
] | null | null | null | from django.contrib import admin
from .models import *
@admin.register(TeamParticipant)
class TeamParticipantAdmin(admin.ModelAdmin):
pass
@admin.register(Team)
class TeamAdmin(admin.ModelAdmin):
list_display = ("name", "invite")
@admin.register(Service)
class ServiceAdmin(admin.ModelAdmin):
pass
@admin.register(TaskCategory)
class TaskCategoryAdmin(admin.ModelAdmin):
pass
@admin.register(Task)
class TaskAdmin(admin.ModelAdmin):
pass
@admin.register(TaskSolution)
class TaskSolutionAdmin(admin.ModelAdmin):
pass
@admin.register(ScoreEvent)
class ScoreEventAdmin(admin.ModelAdmin):
pass
| 19.709677 | 45 | 0.792144 | 67 | 611 | 7.208955 | 0.41791 | 0.188406 | 0.236025 | 0.248447 | 0.331263 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.0982 | 611 | 30 | 46 | 20.366667 | 0.876588 | 0 | 0 | 0.26087 | 0 | 0 | 0.016367 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | false | 0.26087 | 0.086957 | 0 | 0.434783 | 0 | 0 | 0 | 0 | null | 0 | 1 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 3 |
567fd093d9a21c14ce275b3f1200dada652794bb | 299 | py | Python | oeeBackend/plants/models.py | yamenmarquez/oee_django | b192ecab930aac0922599b6a8fadf7e92350e5a7 | [
"MIT"
] | null | null | null | oeeBackend/plants/models.py | yamenmarquez/oee_django | b192ecab930aac0922599b6a8fadf7e92350e5a7 | [
"MIT"
] | null | null | null | oeeBackend/plants/models.py | yamenmarquez/oee_django | b192ecab930aac0922599b6a8fadf7e92350e5a7 | [
"MIT"
] | 1 | 2018-09-13T22:36:55.000Z | 2018-09-13T22:36:55.000Z | from django.db import models
# Create your models here.
class Plant(models.Model):
plant_name = models.CharField(max_length=256)
created_at = models.DateTimeField(auto_now_add=True)
update_at = models.DateTimeField(auto_now=True)
def __str__(self):
return self.plant_name | 24.916667 | 56 | 0.742475 | 42 | 299 | 5 | 0.666667 | 0.085714 | 0.2 | 0.238095 | 0.266667 | 0 | 0 | 0 | 0 | 0 | 0 | 0.012097 | 0.170569 | 299 | 12 | 57 | 24.916667 | 0.834677 | 0.080268 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0.142857 | false | 0 | 0.142857 | 0.142857 | 1 | 0 | 0 | 0 | 0 | null | 0 | 1 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 3 |
5681cfb8ec6dd001496997ce3784cde9db1d0e6a | 4,108 | py | Python | app/api/v2/utils/validators.py | ssiva13/Questioner | e56ec5c72630f837385b019f10af129038dbb2bd | [
"zlib-acknowledgement"
] | 1 | 2019-01-19T23:39:18.000Z | 2019-01-19T23:39:18.000Z | app/api/v2/utils/validators.py | ssiva13/Questioner | e56ec5c72630f837385b019f10af129038dbb2bd | [
"zlib-acknowledgement"
] | 11 | 2019-01-05T19:10:46.000Z | 2021-06-01T23:13:58.000Z | app/api/v2/utils/validators.py | ssiva13/Questioner | e56ec5c72630f837385b019f10af129038dbb2bd | [
"zlib-acknowledgement"
] | 2 | 2019-01-10T12:22:34.000Z | 2019-01-20T14:00:03.000Z | from werkzeug.security import check_password_hash
from ..models.user_models import USERS
from instance.config import Config
from functools import wraps
from ..models import user_models
from flask import request, json, jsonify, make_response
import re, jwt
users = user_models.UserModels()
SECRET_KEY = Config.JWT_SECRET_KEY
class Validations():
def __init__(self):
self.users = USERS
def validate_password(self, password):
exp = "^[a-zA-Z0-9@_+-.]{3,}$"
return re.match(exp, password)
def validate_email(self, email):
exp = "(^[a-zA-Z0-9_.+-]+@[a-zA-Z0-9-]+\.[a-zA-Z0-9-.]+$)"
return re.match(exp, email)
#Check login creds...
def email_correct(self, email):
usr = [user for user in self.users if user['email'] == email]
if usr:
return True
else:
return False
def same_password(self, email, password):
usr = [user for user in self.users if user['email'] == email]
if usr:
validate = check_password_hash(usr['password'], password)
if validate:
return True
else:
return False
def email_exists(self, email):
usr = [user for user in self.users if user['email'] == email]
if usr:
return True
else:
return False
def auth_required(func):
""" validation decorator. Validates if user is logged in before performing a task """
@wraps(func)
def decorator_func(*args, **kwargs):
auth_token = None
auth_header = request.headers.get('Authorization')
if auth_header:
auth_token = auth_header.split("Bearer ")[1]
if not auth_token:
return make_response(jsonify({
"status": 401,
"data": "Unauthorized! Token required"
})), 401
try:
response = users.verify_auth_token(auth_token)
if isinstance(response, str):
user = users.login(username=response)
if not user:
return make_response(jsonify({
"status": 400,
"message": "Authentication failed: Wrong username"
})), 400
except:
return make_response(jsonify({
"status": 400,
"message": "Authentication failed: Invalid token"
})), 400
return func(user, *args, *kwargs)
return decorator_func
def requires_admin(func):
""" validation decorator. Validates if user is logged in before performing a task """
@wraps(func)
def decorator_func(*args, **kwargs):
auth_token = None
auth_header = request.headers.get('Authorization')
if auth_header:
auth_token = auth_header.split("Bearer ")[1]
# else:
# return make_response(jsonify({
# "status": 401,
# "message": "Authentication header missing"
# }))
if not auth_token:
return make_response(jsonify({
"status": 401,
"data": "Unauthorized! Token required"
})), 401
try:
response = users.verify_auth_token(auth_token)
if isinstance(response, str):
user = users.login(username=response)
if not user:
return make_response(jsonify({
"status": 400,
"message": "Authentication failed: Wrong username"
})), 400
is_admin = user[7]
if is_admin != "True":
return make_response(jsonify({
"status": 400,
"message": "Authentication failed: Not Admin"
})), 400
except:
return make_response(jsonify({
"status": 400,
"message": "Authentication failed: Invalid token"
})), 400
return func(user, *args, *kwargs)
return decorator_func
| 34.521008 | 89 | 0.540409 | 428 | 4,108 | 5.056075 | 0.221963 | 0.04159 | 0.066543 | 0.092421 | 0.709797 | 0.704251 | 0.675601 | 0.675601 | 0.667283 | 0.639094 | 0 | 0.021575 | 0.356865 | 4,108 | 118 | 90 | 34.813559 | 0.797502 | 0.073272 | 0 | 0.72 | 0 | 0.01 | 0.120876 | 0.019002 | 0 | 0 | 0 | 0 | 0 | 1 | 0.1 | false | 0.05 | 0.07 | 0 | 0.37 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 3 |
3b22bebb303a386d2db31130a050043cff7bfdcb | 411 | py | Python | review4d/ui.py | nybrandnewschool/review4d | b97422eab2db0a3f0a979b42c1d6cafe1282f436 | [
"MIT"
] | null | null | null | review4d/ui.py | nybrandnewschool/review4d | b97422eab2db0a3f0a979b42c1d6cafe1282f436 | [
"MIT"
] | null | null | null | review4d/ui.py | nybrandnewschool/review4d | b97422eab2db0a3f0a979b42c1d6cafe1282f436 | [
"MIT"
] | 1 | 2021-11-01T20:42:20.000Z | 2021-11-01T20:42:20.000Z | import contextlib
__all__ = [
'suppress_messages',
'messages_suppressed',
]
@contextlib.contextmanager
def suppress_messages(ui):
previous_value = getattr(ui, 'messages_suppressed', False)
try:
ui.messages_suppressed = True
yield
finally:
ui.messages_suppressed = previous_value
def messages_suppressed(ui):
return getattr(ui, 'messages_suppressed', False)
| 18.681818 | 62 | 0.705596 | 42 | 411 | 6.571429 | 0.428571 | 0.391304 | 0.289855 | 0.195652 | 0.231884 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.206813 | 411 | 21 | 63 | 19.571429 | 0.846626 | 0 | 0 | 0 | 0 | 0 | 0.180049 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0.133333 | false | 0 | 0.066667 | 0.066667 | 0.266667 | 0 | 0 | 0 | 0 | null | 1 | 1 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 3 |
3b2697c751d96c6fc714222c314943d6ce8cceb7 | 114,890 | py | Python | database/compiled_templates/webapps/tool_shed/repository/common.mako.py | psnehal/MethylSig | 5efad71e71ff2515feff2e49579c856ef9a1bbd8 | [
"CC-BY-3.0"
] | null | null | null | database/compiled_templates/webapps/tool_shed/repository/common.mako.py | psnehal/MethylSig | 5efad71e71ff2515feff2e49579c856ef9a1bbd8 | [
"CC-BY-3.0"
] | null | null | null | database/compiled_templates/webapps/tool_shed/repository/common.mako.py | psnehal/MethylSig | 5efad71e71ff2515feff2e49579c856ef9a1bbd8 | [
"CC-BY-3.0"
] | null | null | null | # -*- encoding:ascii -*-
from mako import runtime, filters, cache
UNDEFINED = runtime.UNDEFINED
__M_dict_builtin = dict
__M_locals_builtin = locals
_magic_number = 6
_modified_time = 1433361600.3771391
_template_filename=u'templates/webapps/tool_shed/repository/common.mako'
_template_uri=u'/webapps/tool_shed/repository/common.mako'
_template_cache=cache.Cache(__name__, _modified_time)
_source_encoding='ascii'
_exports = ['render_tool_dependency_successful_installation', 'render_tool_dependency', 'render_not_tested', 'render_missing_test_component', 'render_folder', 'render_tool', 'render_clone_str', 'render_test_environment', 'container_javascripts', 'render_readme', 'render_tool_dependency_installation_error', 'render_repository_dependency', 'render_repository_successful_installation', 'render_datatype', 'render_failed_test', 'common_javascripts', 'render_valid_data_manager', 'render_repository_installation_error', 'render_invalid_repository_dependency', 'render_invalid_tool', 'render_workflow', 'render_repository_type_select_field', 'render_passed_test', 'render_repository_items', 'render_invalid_data_manager', 'render_sharable_str', 'render_table_wrap_style', 'render_invalid_tool_dependency']
def render_body(context,**pageargs):
context.caller_stack._push_frame()
try:
__M_locals = __M_dict_builtin(pageargs=pageargs)
__M_writer = context.writer()
# SOURCE LINE 76
__M_writer(u'\n\n')
# SOURCE LINE 163
__M_writer(u'\n\n')
# SOURCE LINE 206
__M_writer(u' \n \n')
# SOURCE LINE 214
__M_writer(u'\n\n')
# SOURCE LINE 222
__M_writer(u'\n\n')
# SOURCE LINE 421
__M_writer(u'\n\n')
# SOURCE LINE 445
__M_writer(u'\n\n')
# SOURCE LINE 471
__M_writer(u'\n\n')
# SOURCE LINE 493
__M_writer(u'\n\n')
# SOURCE LINE 512
__M_writer(u'\n\n')
# SOURCE LINE 535
__M_writer(u'\n\n')
# SOURCE LINE 566
__M_writer(u'\n\n')
# SOURCE LINE 590
__M_writer(u'\n\n')
# SOURCE LINE 609
__M_writer(u'\n\n')
# SOURCE LINE 681
__M_writer(u'\n\n')
# SOURCE LINE 696
__M_writer(u'\n\n')
# SOURCE LINE 727
__M_writer(u'\n\n')
# SOURCE LINE 757
__M_writer(u'\n\n')
# SOURCE LINE 791
__M_writer(u'\n\n')
# SOURCE LINE 822
__M_writer(u'\n\n')
# SOURCE LINE 843
__M_writer(u'\n\n')
# SOURCE LINE 866
__M_writer(u'\n\n')
# SOURCE LINE 915
__M_writer(u'\n\n')
# SOURCE LINE 971
__M_writer(u'\n\n')
# SOURCE LINE 998
__M_writer(u'\n\n')
# SOURCE LINE 1021
__M_writer(u'\n\n')
# SOURCE LINE 1063
__M_writer(u'\n\n')
# SOURCE LINE 1233
__M_writer(u'\n')
return ''
finally:
context.caller_stack._pop_frame()
def render_render_tool_dependency_successful_installation(context,successful_installation,pad,parent,row_counter,row_is_header=False,render_repository_actions_for='tool_shed'):
context.caller_stack._push_frame()
try:
trans = context.get('trans', UNDEFINED)
__M_writer = context.writer()
# SOURCE LINE 729
__M_writer(u'\n ')
# SOURCE LINE 730
encoded_id = trans.security.encode_id( successful_installation.id )
# SOURCE LINE 732
__M_writer(u'\n <tr class="datasetRow"\n')
# SOURCE LINE 734
if parent is not None:
# SOURCE LINE 735
__M_writer(u' parent="')
__M_writer(unicode(parent))
__M_writer(u'"\n')
pass
# SOURCE LINE 737
__M_writer(u' id="libraryItem-rtdsi-')
__M_writer(unicode(encoded_id))
__M_writer(u'">\n <td style="padding-left: ')
# SOURCE LINE 738
__M_writer(unicode(pad+20))
__M_writer(u'px;">\n <table id="test_environment">\n <tr bgcolor="#FFFFCC">\n <th>Type</th><th>Name</th><th>Version</th>\n </tr>\n <tr>\n <td>')
# SOURCE LINE 744
__M_writer(filters.html_escape(unicode(successful_installation.name )))
__M_writer(u'</td>\n <td>')
# SOURCE LINE 745
__M_writer(filters.html_escape(unicode(successful_installation.type )))
__M_writer(u'</td>\n <td>')
# SOURCE LINE 746
__M_writer(filters.html_escape(unicode(successful_installation.version )))
__M_writer(u'</td>\n </tr>\n <tr><th>Installation directory</th></tr>\n <tr><td colspan="3">')
# SOURCE LINE 749
__M_writer(filters.html_escape(unicode(successful_installation.installation_directory )))
__M_writer(u'</td></tr>\n </table>\n </td>\n </tr>\n ')
# SOURCE LINE 753
my_row = row_counter.count
row_counter.increment()
# SOURCE LINE 756
__M_writer(u'\n')
return ''
finally:
context.caller_stack._pop_frame()
def render_render_tool_dependency(context,tool_dependency,pad,parent,row_counter,row_is_header,render_repository_actions_for='tool_shed'):
context.caller_stack._push_frame()
try:
h = context.get('h', UNDEFINED)
trans = context.get('trans', UNDEFINED)
__M_writer = context.writer()
# SOURCE LINE 917
__M_writer(u'\n ')
# SOURCE LINE 918
from galaxy.util import string_as_bool
encoded_id = trans.security.encode_id( tool_dependency.id )
is_missing = tool_dependency.installation_status not in [ 'Installed' ]
if row_is_header:
cell_type = 'th'
else:
cell_type = 'td'
# SOURCE LINE 926
__M_writer(u'\n <tr class="datasetRow"\n')
# SOURCE LINE 928
if parent is not None:
# SOURCE LINE 929
__M_writer(u' parent="')
__M_writer(unicode(parent))
__M_writer(u'"\n')
pass
# SOURCE LINE 931
__M_writer(u' id="libraryItem-rtd-')
__M_writer(unicode(encoded_id))
__M_writer(u'">\n <')
# SOURCE LINE 932
__M_writer(unicode(cell_type))
__M_writer(u' style="padding-left: ')
__M_writer(unicode(pad+20))
__M_writer(u'px;">\n')
# SOURCE LINE 933
if row_is_header:
# SOURCE LINE 934
__M_writer(u' ')
__M_writer(filters.html_escape(unicode(tool_dependency.name )))
__M_writer(u'\n')
# SOURCE LINE 935
elif trans.webapp.name == 'galaxy' and tool_dependency.tool_dependency_id:
# SOURCE LINE 936
if tool_dependency.repository_id and tool_dependency.installation_status in [ trans.install_model.ToolDependency.installation_status.INSTALLED ]:
# SOURCE LINE 937
__M_writer(u' <a class="action-button" href="')
__M_writer(unicode(h.url_for( controller='admin_toolshed', action='browse_tool_dependency', id=trans.security.encode_id( tool_dependency.tool_dependency_id ) )))
__M_writer(u'">\n ')
# SOURCE LINE 938
__M_writer(filters.html_escape(unicode(tool_dependency.name )))
__M_writer(u'\n </a>\n')
# SOURCE LINE 940
elif tool_dependency.installation_status not in [ trans.install_model.ToolDependency.installation_status.UNINSTALLED ]:
# SOURCE LINE 941
__M_writer(u' <a class="action-button" href="')
__M_writer(unicode(h.url_for( controller='admin_toolshed', action='manage_repository_tool_dependencies', tool_dependency_ids=trans.security.encode_id( tool_dependency.tool_dependency_id ) )))
__M_writer(u'">\n ')
# SOURCE LINE 942
__M_writer(unicode(tool_dependency.name))
__M_writer(u'\n </a>\n')
# SOURCE LINE 944
else:
# SOURCE LINE 945
__M_writer(u' ')
__M_writer(filters.html_escape(unicode(tool_dependency.name )))
__M_writer(u'\n')
pass
# SOURCE LINE 947
else:
# SOURCE LINE 948
__M_writer(u' ')
__M_writer(filters.html_escape(unicode(tool_dependency.name )))
__M_writer(u'\n')
pass
# SOURCE LINE 950
__M_writer(u' </')
__M_writer(unicode(cell_type))
__M_writer(u'>\n <')
# SOURCE LINE 951
__M_writer(unicode(cell_type))
__M_writer(u'>\n ')
# SOURCE LINE 952
if tool_dependency.version:
version_str = tool_dependency.version
else:
version_str = ''
# SOURCE LINE 957
__M_writer(u'\n ')
# SOURCE LINE 958
__M_writer(filters.html_escape(unicode(version_str )))
__M_writer(u'\n </')
# SOURCE LINE 959
__M_writer(unicode(cell_type))
__M_writer(u'>\n <')
# SOURCE LINE 960
__M_writer(unicode(cell_type))
__M_writer(u'>')
__M_writer(filters.html_escape(unicode(tool_dependency.type )))
__M_writer(u'</')
__M_writer(unicode(cell_type))
__M_writer(u'>\n <')
# SOURCE LINE 961
__M_writer(unicode(cell_type))
__M_writer(u'>\n')
# SOURCE LINE 962
if trans.webapp.name == 'galaxy':
# SOURCE LINE 963
__M_writer(u' ')
__M_writer(filters.html_escape(unicode(tool_dependency.installation_status )))
__M_writer(u'\n')
pass
# SOURCE LINE 965
__M_writer(u' </')
__M_writer(unicode(cell_type))
__M_writer(u'>\n </tr>\n ')
# SOURCE LINE 967
my_row = row_counter.count
row_counter.increment()
# SOURCE LINE 970
__M_writer(u'\n')
return ''
finally:
context.caller_stack._pop_frame()
def render_render_not_tested(context,not_tested,pad,parent,row_counter,row_is_header=False,render_repository_actions_for='tool_shed'):
context.caller_stack._push_frame()
try:
trans = context.get('trans', UNDEFINED)
__M_writer = context.writer()
# SOURCE LINE 824
__M_writer(u'\n ')
# SOURCE LINE 825
encoded_id = trans.security.encode_id( not_tested.id )
# SOURCE LINE 827
__M_writer(u'\n <tr class="datasetRow"\n')
# SOURCE LINE 829
if parent is not None:
# SOURCE LINE 830
__M_writer(u' parent="')
__M_writer(unicode(parent))
__M_writer(u'"\n')
pass
# SOURCE LINE 832
__M_writer(u' id="libraryItem-rnt-')
__M_writer(unicode(encoded_id))
__M_writer(u'">\n <td style="padding-left: ')
# SOURCE LINE 833
__M_writer(unicode(pad+20))
__M_writer(u'px;">\n <table id="test_environment">\n <tr><td>')
# SOURCE LINE 835
__M_writer(filters.html_escape(unicode(not_tested.reason )))
__M_writer(u'</td></tr>\n </table>\n </td>\n </tr>\n ')
# SOURCE LINE 839
my_row = row_counter.count
row_counter.increment()
# SOURCE LINE 842
__M_writer(u'\n')
return ''
finally:
context.caller_stack._pop_frame()
def render_render_missing_test_component(context,missing_test_component,pad,parent,row_counter,row_is_header=False,render_repository_actions_for='tool_shed'):
context.caller_stack._push_frame()
try:
trans = context.get('trans', UNDEFINED)
__M_writer = context.writer()
# SOURCE LINE 568
__M_writer(u'\n ')
# SOURCE LINE 569
encoded_id = trans.security.encode_id( missing_test_component.id )
# SOURCE LINE 571
__M_writer(u'\n <tr class="datasetRow"\n')
# SOURCE LINE 573
if parent is not None:
# SOURCE LINE 574
__M_writer(u' parent="')
__M_writer(unicode(parent))
__M_writer(u'"\n')
pass
# SOURCE LINE 576
__M_writer(u' id="libraryItem-rmtc-')
__M_writer(unicode(encoded_id))
__M_writer(u'">\n <td style="padding-left: ')
# SOURCE LINE 577
__M_writer(unicode(pad+20))
__M_writer(u'px;">\n <table id="test_environment">\n <tr><td bgcolor="#FFFFCC"><b>Tool id:</b> ')
# SOURCE LINE 579
__M_writer(filters.html_escape(unicode(missing_test_component.tool_id )))
__M_writer(u'</td></tr>\n <tr><td><b>Tool version:</b> ')
# SOURCE LINE 580
__M_writer(filters.html_escape(unicode(missing_test_component.tool_version )))
__M_writer(u'</td></tr>\n <tr><td><b>Tool guid:</b> ')
# SOURCE LINE 581
__M_writer(filters.html_escape(unicode(missing_test_component.tool_guid )))
__M_writer(u'</td></tr>\n <tr><td><b>Missing components:</b> <br/>')
# SOURCE LINE 582
__M_writer(filters.html_escape(unicode(missing_test_component.missing_components )))
__M_writer(u'</td></tr>\n </table>\n </td>\n </tr>\n ')
# SOURCE LINE 586
my_row = row_counter.count
row_counter.increment()
# SOURCE LINE 589
__M_writer(u'\n')
return ''
finally:
context.caller_stack._pop_frame()
def render_render_folder(context,folder,folder_pad,parent=None,row_counter=None,is_root_folder=False,render_repository_actions_for='tool_shed'):
context.caller_stack._push_frame()
try:
def render_tool_dependency_successful_installation(successful_installation,pad,parent,row_counter,row_is_header=False,render_repository_actions_for='tool_shed'):
return render_render_tool_dependency_successful_installation(context,successful_installation,pad,parent,row_counter,row_is_header,render_repository_actions_for)
enumerate = context.get('enumerate', UNDEFINED)
def render_tool_dependency(tool_dependency,pad,parent,row_counter,row_is_header,render_repository_actions_for='tool_shed'):
return render_render_tool_dependency(context,tool_dependency,pad,parent,row_counter,row_is_header,render_repository_actions_for)
def render_not_tested(not_tested,pad,parent,row_counter,row_is_header=False,render_repository_actions_for='tool_shed'):
return render_render_not_tested(context,not_tested,pad,parent,row_counter,row_is_header,render_repository_actions_for)
def render_missing_test_component(missing_test_component,pad,parent,row_counter,row_is_header=False,render_repository_actions_for='tool_shed'):
return render_render_missing_test_component(context,missing_test_component,pad,parent,row_counter,row_is_header,render_repository_actions_for)
def render_folder(folder,folder_pad,parent=None,row_counter=None,is_root_folder=False,render_repository_actions_for='tool_shed'):
return render_render_folder(context,folder,folder_pad,parent,row_counter,is_root_folder,render_repository_actions_for)
def render_tool(tool,pad,parent,row_counter,row_is_header,render_repository_actions_for='tool_shed'):
return render_render_tool(context,tool,pad,parent,row_counter,row_is_header,render_repository_actions_for)
def render_test_environment(test_environment,pad,parent,row_counter,row_is_header=False,render_repository_actions_for='tool_shed'):
return render_render_test_environment(context,test_environment,pad,parent,row_counter,row_is_header,render_repository_actions_for)
def render_datatype(datatype,pad,parent,row_counter,row_is_header=False,render_repository_actions_for='tool_shed'):
return render_render_datatype(context,datatype,pad,parent,row_counter,row_is_header,render_repository_actions_for)
def render_tool_dependency_installation_error(installation_error,pad,parent,row_counter,row_is_header=False,render_repository_actions_for='tool_shed'):
return render_render_tool_dependency_installation_error(context,installation_error,pad,parent,row_counter,row_is_header,render_repository_actions_for)
def render_repository_dependency(repository_dependency,pad,parent,row_counter,row_is_header=False,render_repository_actions_for='tool_shed'):
return render_render_repository_dependency(context,repository_dependency,pad,parent,row_counter,row_is_header,render_repository_actions_for)
def render_repository_successful_installation(successful_installation,pad,parent,row_counter,row_is_header=False,is_current_repository=False,render_repository_actions_for='tool_shed'):
return render_render_repository_successful_installation(context,successful_installation,pad,parent,row_counter,row_is_header,is_current_repository,render_repository_actions_for)
def render_readme(readme,pad,parent,row_counter,render_repository_actions_for='tool_shed'):
return render_render_readme(context,readme,pad,parent,row_counter,render_repository_actions_for)
def render_failed_test(failed_test,pad,parent,row_counter,row_is_header=False,render_repository_actions_for='tool_shed'):
return render_render_failed_test(context,failed_test,pad,parent,row_counter,row_is_header,render_repository_actions_for)
def render_valid_data_manager(data_manager,pad,parent,row_counter,row_is_header=False,render_repository_actions_for='tool_shed'):
return render_render_valid_data_manager(context,data_manager,pad,parent,row_counter,row_is_header,render_repository_actions_for)
def render_repository_installation_error(installation_error,pad,parent,row_counter,row_is_header=False,is_current_repository=False,render_repository_actions_for='tool_shed'):
return render_render_repository_installation_error(context,installation_error,pad,parent,row_counter,row_is_header,is_current_repository,render_repository_actions_for)
def render_invalid_repository_dependency(invalid_repository_dependency,pad,parent,row_counter,render_repository_actions_for='tool_shed'):
return render_render_invalid_repository_dependency(context,invalid_repository_dependency,pad,parent,row_counter,render_repository_actions_for)
def render_invalid_tool(invalid_tool,pad,parent,row_counter,valid=True,render_repository_actions_for='tool_shed'):
return render_render_invalid_tool(context,invalid_tool,pad,parent,row_counter,valid,render_repository_actions_for)
def render_workflow(workflow,pad,parent,row_counter,row_is_header=False,render_repository_actions_for='tool_shed'):
return render_render_workflow(context,workflow,pad,parent,row_counter,row_is_header,render_repository_actions_for)
h = context.get('h', UNDEFINED)
def render_passed_test(passed_test,pad,parent,row_counter,row_is_header=False,render_repository_actions_for='tool_shed'):
return render_render_passed_test(context,passed_test,pad,parent,row_counter,row_is_header,render_repository_actions_for)
def render_invalid_data_manager(data_manager,pad,parent,row_counter,row_is_header=False,render_repository_actions_for='tool_shed'):
return render_render_invalid_data_manager(context,data_manager,pad,parent,row_counter,row_is_header,render_repository_actions_for)
str = context.get('str', UNDEFINED)
trans = context.get('trans', UNDEFINED)
def render_invalid_tool_dependency(invalid_tool_dependency,pad,parent,row_counter,render_repository_actions_for='tool_shed'):
return render_render_invalid_tool_dependency(context,invalid_tool_dependency,pad,parent,row_counter,render_repository_actions_for)
__M_writer = context.writer()
# SOURCE LINE 224
__M_writer(u'\n ')
# SOURCE LINE 225
encoded_id = trans.security.encode_id( folder.id )
if is_root_folder:
pad = folder_pad
expander = h.url_for("/static/images/silk/resultset_bottom.png")
folder_img = h.url_for("/static/images/silk/folder_page.png")
else:
pad = folder_pad + 20
expander = h.url_for("/static/images/silk/resultset_next.png")
folder_img = h.url_for("/static/images/silk/folder.png")
my_row = None
# SOURCE LINE 237
__M_writer(u'\n')
# SOURCE LINE 238
if not is_root_folder:
# SOURCE LINE 239
__M_writer(u' ')
if parent is None:
bg_str = 'bgcolor="#D8D8D8"'
else:
bg_str = ''
# SOURCE LINE 244
__M_writer(u'\n <tr id="folder-')
# SOURCE LINE 245
__M_writer(unicode(encoded_id))
__M_writer(u'" ')
__M_writer(unicode(bg_str))
__M_writer(u' class="folderRow libraryOrFolderRow"\n')
# SOURCE LINE 246
if parent is not None:
# SOURCE LINE 247
__M_writer(u' parent="')
__M_writer(unicode(parent))
__M_writer(u'"\n style="display: none;"\n')
pass
# SOURCE LINE 250
__M_writer(u' >\n ')
# SOURCE LINE 251
col_span_str = ''
folder_label = str( folder.label )
if folder.datatypes:
col_span_str = 'colspan="4"'
elif folder.label == 'Missing tool dependencies':
if folder.description:
folder_label = "%s<i> - %s</i>" % ( folder_label, folder.description )
else:
folder_label = "%s<i> - repository tools require handling of these missing dependencies</i>" % folder_label
col_span_str = 'colspan="5"'
elif folder.label in [ 'Installed repository dependencies', 'Repository dependencies', 'Missing repository dependencies' ]:
if folder.description:
folder_label = "%s<i> - %s</i>" % ( folder_label, folder.description )
elif folder.label not in [ 'Installed repository dependencies' ] and folder.parent.label not in [ 'Installation errors' ]:
folder_label = "%s<i> - installation of these additional repositories is required</i>" % folder_label
if trans.webapp.name == 'galaxy':
col_span_str = 'colspan="4"'
elif folder.label == 'Invalid repository dependencies':
folder_label = "%s<i> - click the repository dependency to see why it is invalid</i>" % folder_label
elif folder.label == 'Invalid tool dependencies':
folder_label = "%s<i> - click the tool dependency to see why it is invalid</i>" % folder_label
elif folder.label == 'Valid tools':
col_span_str = 'colspan="3"'
if folder.description:
folder_label = "%s<i> - %s</i>" % ( folder_label, folder.description )
else:
folder_label = "%s<i> - click the name to preview the tool and use the pop-up menu to inspect all metadata</i>" % folder_label
elif folder.invalid_tools:
if trans.webapp.name == 'tool_shed':
folder_label = "%s<i> - click the tool config file name to see why the tool is invalid</i>" % folder_label
elif folder.tool_dependencies:
if folder.description:
folder_label = "%s<i> - %s</i>" % ( folder_label, folder.description )
else:
folder_label = "%s<i> - repository tools require handling of these dependencies</i>" % folder_label
col_span_str = 'colspan="4"'
elif folder.workflows:
if folder.description:
folder_label = "%s<i> - %s</i>" % ( folder_label, folder.description )
else:
folder_label = "%s<i> - click the name to view an SVG image of the workflow</i>" % folder_label
col_span_str = 'colspan="4"'
elif folder.valid_data_managers:
if folder.description:
folder_label = "%s<i> - %s</i>" % ( folder_label, folder.description )
col_span_str = 'colspan="3"'
elif folder.invalid_data_managers:
if folder.description:
folder_label = "%s<i> - %s</i>" % ( folder_label, folder.description )
col_span_str = 'colspan="2"'
# SOURCE LINE 302
__M_writer(u'\n <td ')
# SOURCE LINE 303
__M_writer(unicode(col_span_str))
__M_writer(u' style="padding-left: ')
__M_writer(unicode(folder_pad))
__M_writer(u'px;">\n <span class="expandLink folder-')
# SOURCE LINE 304
__M_writer(unicode(encoded_id))
__M_writer(u'-click">\n <div style="float: left; margin-left: 2px;" class="expandLink folder-')
# SOURCE LINE 305
__M_writer(unicode(encoded_id))
__M_writer(u'-click">\n <a class="folder-')
# SOURCE LINE 306
__M_writer(unicode(encoded_id))
__M_writer(u'-click" href="javascript:void(0);">\n ')
# SOURCE LINE 307
__M_writer(unicode(folder_label))
__M_writer(u'\n </a>\n </div>\n </span>\n </td>\n </tr>\n ')
# SOURCE LINE 313
my_row = row_counter.count
row_counter.increment()
# SOURCE LINE 316
__M_writer(u'\n')
pass
# SOURCE LINE 318
for sub_folder in folder.folders:
# SOURCE LINE 319
__M_writer(u' ')
__M_writer(unicode(render_folder( sub_folder, pad, parent=my_row, row_counter=row_counter, is_root_folder=False, render_repository_actions_for=render_repository_actions_for )))
__M_writer(u'\n')
pass
# SOURCE LINE 321
for readme in folder.readme_files:
# SOURCE LINE 322
__M_writer(u' ')
__M_writer(unicode(render_readme( readme, pad, my_row, row_counter, render_repository_actions_for=render_repository_actions_for )))
__M_writer(u'\n')
pass
# SOURCE LINE 324
for invalid_repository_dependency in folder.invalid_repository_dependencies:
# SOURCE LINE 325
__M_writer(u' ')
__M_writer(unicode(render_invalid_repository_dependency( invalid_repository_dependency, pad, my_row, row_counter, render_repository_actions_for=render_repository_actions_for )))
__M_writer(u'\n')
pass
# SOURCE LINE 327
for index, repository_dependency in enumerate( folder.repository_dependencies ):
# SOURCE LINE 328
__M_writer(u' ')
row_is_header = index == 0
__M_writer(u'\n ')
# SOURCE LINE 329
__M_writer(unicode(render_repository_dependency( repository_dependency, pad, my_row, row_counter, row_is_header, render_repository_actions_for=render_repository_actions_for )))
__M_writer(u'\n')
pass
# SOURCE LINE 331
for invalid_tool_dependency in folder.invalid_tool_dependencies:
# SOURCE LINE 332
__M_writer(u' ')
__M_writer(unicode(render_invalid_tool_dependency( invalid_tool_dependency, pad, my_row, row_counter, render_repository_actions_for=render_repository_actions_for )))
__M_writer(u'\n')
pass
# SOURCE LINE 334
for index, tool_dependency in enumerate( folder.tool_dependencies ):
# SOURCE LINE 335
__M_writer(u' ')
row_is_header = index == 0
__M_writer(u'\n ')
# SOURCE LINE 336
__M_writer(unicode(render_tool_dependency( tool_dependency, pad, my_row, row_counter, row_is_header, render_repository_actions_for=render_repository_actions_for )))
__M_writer(u'\n')
pass
# SOURCE LINE 338
if folder.valid_tools:
# SOURCE LINE 339
for index, tool in enumerate( folder.valid_tools ):
# SOURCE LINE 340
__M_writer(u' ')
row_is_header = index == 0
__M_writer(u'\n ')
# SOURCE LINE 341
__M_writer(unicode(render_tool( tool, pad, my_row, row_counter, row_is_header, render_repository_actions_for=render_repository_actions_for )))
__M_writer(u'\n')
pass
pass
# SOURCE LINE 344
for invalid_tool in folder.invalid_tools:
# SOURCE LINE 345
__M_writer(u' ')
__M_writer(unicode(render_invalid_tool( invalid_tool, pad, my_row, row_counter, render_repository_actions_for=render_repository_actions_for )))
__M_writer(u'\n')
pass
# SOURCE LINE 347
if folder.workflows:
# SOURCE LINE 348
for index, workflow in enumerate( folder.workflows ):
# SOURCE LINE 349
__M_writer(u' ')
row_is_header = index == 0
__M_writer(u'\n ')
# SOURCE LINE 350
__M_writer(unicode(render_workflow( workflow, pad, my_row, row_counter, row_is_header, render_repository_actions_for=render_repository_actions_for )))
__M_writer(u'\n')
pass
pass
# SOURCE LINE 353
if folder.datatypes:
# SOURCE LINE 354
for index, datatype in enumerate( folder.datatypes ):
# SOURCE LINE 355
__M_writer(u' ')
row_is_header = index == 0
__M_writer(u'\n ')
# SOURCE LINE 356
__M_writer(unicode(render_datatype( datatype, pad, my_row, row_counter, row_is_header, render_repository_actions_for=render_repository_actions_for )))
__M_writer(u'\n')
pass
pass
# SOURCE LINE 359
if folder.valid_data_managers:
# SOURCE LINE 360
for index, data_manager in enumerate( folder.valid_data_managers ):
# SOURCE LINE 361
__M_writer(u' ')
row_is_header = index == 0
__M_writer(u'\n ')
# SOURCE LINE 362
__M_writer(unicode(render_valid_data_manager( data_manager, pad, my_row, row_counter, row_is_header, render_repository_actions_for=render_repository_actions_for )))
__M_writer(u'\n')
pass
pass
# SOURCE LINE 365
if folder.invalid_data_managers:
# SOURCE LINE 366
for index, data_manager in enumerate( folder.invalid_data_managers ):
# SOURCE LINE 367
__M_writer(u' ')
row_is_header = index == 0
__M_writer(u'\n ')
# SOURCE LINE 368
__M_writer(unicode(render_invalid_data_manager( data_manager, pad, my_row, row_counter, row_is_header, render_repository_actions_for=render_repository_actions_for )))
__M_writer(u'\n')
pass
pass
# SOURCE LINE 371
if folder.test_environments:
# SOURCE LINE 372
for test_environment in folder.test_environments:
# SOURCE LINE 373
__M_writer(u' ')
__M_writer(unicode(render_test_environment( test_environment, pad, my_row, row_counter, render_repository_actions_for=render_repository_actions_for )))
__M_writer(u'\n')
pass
pass
# SOURCE LINE 376
if folder.failed_tests:
# SOURCE LINE 377
for failed_test in folder.failed_tests:
# SOURCE LINE 378
__M_writer(u' ')
__M_writer(unicode(render_failed_test( failed_test, pad, my_row, row_counter, render_repository_actions_for=render_repository_actions_for )))
__M_writer(u'\n')
pass
pass
# SOURCE LINE 381
if folder.not_tested:
# SOURCE LINE 382
for not_tested in folder.not_tested:
# SOURCE LINE 383
__M_writer(u' ')
__M_writer(unicode(render_not_tested( not_tested, pad, my_row, row_counter, render_repository_actions_for=render_repository_actions_for )))
__M_writer(u'\n')
pass
pass
# SOURCE LINE 386
if folder.passed_tests:
# SOURCE LINE 387
for passed_test in folder.passed_tests:
# SOURCE LINE 388
__M_writer(u' ')
__M_writer(unicode(render_passed_test( passed_test, pad, my_row, row_counter, render_repository_actions_for=render_repository_actions_for )))
__M_writer(u'\n')
pass
pass
# SOURCE LINE 391
if folder.missing_test_components:
# SOURCE LINE 392
for missing_test_component in folder.missing_test_components:
# SOURCE LINE 393
__M_writer(u' ')
__M_writer(unicode(render_missing_test_component( missing_test_component, pad, my_row, row_counter, render_repository_actions_for=render_repository_actions_for )))
__M_writer(u'\n')
pass
pass
# SOURCE LINE 396
if folder.tool_dependency_installation_errors:
# SOURCE LINE 397
for tool_dependency_installation_error in folder.tool_dependency_installation_errors:
# SOURCE LINE 398
__M_writer(u' ')
__M_writer(unicode(render_tool_dependency_installation_error( tool_dependency_installation_error, pad, my_row, row_counter, render_repository_actions_for=render_repository_actions_for )))
__M_writer(u'\n')
pass
pass
# SOURCE LINE 401
if folder.tool_dependency_successful_installations:
# SOURCE LINE 402
for tool_dependency_successful_installation in folder.tool_dependency_successful_installations:
# SOURCE LINE 403
__M_writer(u' ')
__M_writer(unicode(render_tool_dependency_successful_installation( tool_dependency_successful_installation, pad, my_row, row_counter, render_repository_actions_for=render_repository_actions_for )))
__M_writer(u'\n')
pass
pass
# SOURCE LINE 406
if folder.repository_installation_errors:
# SOURCE LINE 407
for repository_installation_error in folder.repository_installation_errors:
# SOURCE LINE 408
__M_writer(u' ')
__M_writer(unicode(render_repository_installation_error( repository_installation_error, pad, my_row, row_counter, is_current_repository=False, render_repository_actions_for=render_repository_actions_for )))
__M_writer(u'\n')
pass
pass
# SOURCE LINE 411
if folder.current_repository_installation_errors:
# SOURCE LINE 412
for repository_installation_error in folder.current_repository_installation_errors:
# SOURCE LINE 413
__M_writer(u' ')
__M_writer(unicode(render_repository_installation_error( repository_installation_error, pad, my_row, row_counter, is_current_repository=True, render_repository_actions_for=render_repository_actions_for )))
__M_writer(u'\n')
pass
pass
# SOURCE LINE 416
if folder.repository_successful_installations:
# SOURCE LINE 417
for repository_successful_installation in folder.repository_successful_installations:
# SOURCE LINE 418
__M_writer(u' ')
__M_writer(unicode(render_repository_successful_installation( repository_successful_installation, pad, my_row, row_counter, render_repository_actions_for=render_repository_actions_for )))
__M_writer(u'\n')
pass
pass
return ''
finally:
context.caller_stack._pop_frame()
def render_render_tool(context,tool,pad,parent,row_counter,row_is_header,render_repository_actions_for='tool_shed'):
context.caller_stack._push_frame()
try:
h = context.get('h', UNDEFINED)
trans = context.get('trans', UNDEFINED)
__M_writer = context.writer()
# SOURCE LINE 868
__M_writer(u'\n ')
# SOURCE LINE 869
encoded_id = trans.security.encode_id( tool.id )
if row_is_header:
cell_type = 'th'
else:
cell_type = 'td'
# SOURCE LINE 875
__M_writer(u'\n <tr class="datasetRow"\n')
# SOURCE LINE 877
if parent is not None:
# SOURCE LINE 878
__M_writer(u' parent="')
__M_writer(unicode(parent))
__M_writer(u'"\n')
pass
# SOURCE LINE 880
__M_writer(u' id="libraryItem-rt-')
__M_writer(unicode(encoded_id))
__M_writer(u'">\n')
# SOURCE LINE 881
if row_is_header:
# SOURCE LINE 882
__M_writer(u' <th style="padding-left: ')
__M_writer(unicode(pad+20))
__M_writer(u'px;">')
__M_writer(filters.html_escape(unicode(tool.name )))
__M_writer(u'</th>\n')
# SOURCE LINE 883
else:
# SOURCE LINE 884
__M_writer(u' <td style="padding-left: ')
__M_writer(unicode(pad+20))
__M_writer(u'px;">\n')
# SOURCE LINE 885
if tool.repository_id:
# SOURCE LINE 886
if trans.webapp.name == 'tool_shed':
# SOURCE LINE 887
__M_writer(u' <div style="float:left;" class="menubutton split popup" id="tool-')
__M_writer(unicode(encoded_id))
__M_writer(u'-popup">\n <a class="view-info" href="')
# SOURCE LINE 888
__M_writer(unicode(h.url_for( controller='repository', action='display_tool', repository_id=trans.security.encode_id( tool.repository_id ), tool_config=tool.tool_config, changeset_revision=tool.changeset_revision, render_repository_actions_for=render_repository_actions_for )))
__M_writer(u'">')
__M_writer(filters.html_escape(unicode(tool.name )))
__M_writer(u'</a>\n </div>\n <div popupmenu="tool-')
# SOURCE LINE 890
__M_writer(unicode(encoded_id))
__M_writer(u'-popup">\n <a class="action-button" href="')
# SOURCE LINE 891
__M_writer(unicode(h.url_for( controller='repository', action='view_tool_metadata', repository_id=trans.security.encode_id( tool.repository_id ), changeset_revision=tool.changeset_revision, tool_id=tool.tool_id, render_repository_actions_for=render_repository_actions_for )))
__M_writer(u'">View tool metadata</a>\n </div>\n')
# SOURCE LINE 893
elif trans.webapp.name == 'galaxy':
# SOURCE LINE 894
if tool.repository_installation_status == trans.install_model.ToolShedRepository.installation_status.INSTALLED:
# SOURCE LINE 895
__M_writer(u' <a class="action-button" href="')
__M_writer(unicode(h.url_for( controller='admin_toolshed', action='view_tool_metadata', repository_id=trans.security.encode_id( tool.repository_id ), changeset_revision=tool.changeset_revision, tool_id=tool.tool_id )))
__M_writer(u'">')
__M_writer(filters.html_escape(unicode(tool.name )))
__M_writer(u'</a>\n')
# SOURCE LINE 896
else:
# SOURCE LINE 897
__M_writer(u' ')
__M_writer(filters.html_escape(unicode(tool.name )))
__M_writer(u'\n')
pass
# SOURCE LINE 899
else:
# SOURCE LINE 900
__M_writer(u' ')
__M_writer(filters.html_escape(unicode(tool.name )))
__M_writer(u'\n')
pass
# SOURCE LINE 902
else:
# SOURCE LINE 903
__M_writer(u' ')
__M_writer(filters.html_escape(unicode(tool.name )))
__M_writer(u'\n')
pass
# SOURCE LINE 905
__M_writer(u' </td>\n')
pass
# SOURCE LINE 907
__M_writer(u' <')
__M_writer(unicode(cell_type))
__M_writer(u'>')
__M_writer(filters.html_escape(unicode(tool.description )))
__M_writer(u'</')
__M_writer(unicode(cell_type))
__M_writer(u'>\n <')
# SOURCE LINE 908
__M_writer(unicode(cell_type))
__M_writer(u'>')
__M_writer(filters.html_escape(unicode(tool.version )))
__M_writer(u'</')
__M_writer(unicode(cell_type))
__M_writer(u'>\n')
# SOURCE LINE 910
__M_writer(u' </tr>\n ')
# SOURCE LINE 911
my_row = row_counter.count
row_counter.increment()
# SOURCE LINE 914
__M_writer(u'\n')
return ''
finally:
context.caller_stack._pop_frame()
def render_render_clone_str(context,repository):
context.caller_stack._push_frame()
try:
trans = context.get('trans', UNDEFINED)
__M_writer = context.writer()
# SOURCE LINE 216
__M_writer(u'\n ')
# SOURCE LINE 217
from tool_shed.util.common_util import generate_clone_url_for_repository_in_tool_shed
clone_str = generate_clone_url_for_repository_in_tool_shed( trans.user, repository )
# SOURCE LINE 220
__M_writer(u'\n hg clone <a href="')
# SOURCE LINE 221
__M_writer(unicode(clone_str))
__M_writer(u'">')
__M_writer(unicode(clone_str))
__M_writer(u'</a>\n')
return ''
finally:
context.caller_stack._pop_frame()
def render_render_test_environment(context,test_environment,pad,parent,row_counter,row_is_header=False,render_repository_actions_for='tool_shed'):
context.caller_stack._push_frame()
try:
trans = context.get('trans', UNDEFINED)
__M_writer = context.writer()
# SOURCE LINE 973
__M_writer(u'\n ')
# SOURCE LINE 974
encoded_id = trans.security.encode_id( test_environment.id )
__M_writer(u'\n <tr class="datasetRow"\n')
# SOURCE LINE 976
if parent is not None:
# SOURCE LINE 977
__M_writer(u' parent="')
__M_writer(unicode(parent))
__M_writer(u'"\n')
pass
# SOURCE LINE 979
__M_writer(u' id="libraryItem-rte-')
__M_writer(unicode(encoded_id))
__M_writer(u'">\n <td style="padding-left: ')
# SOURCE LINE 980
__M_writer(unicode(pad+20))
__M_writer(u'px;">\n <table class="grid" id="test_environment">\n <tr><td><b>Time tested:</b> ')
# SOURCE LINE 982
__M_writer(filters.html_escape(unicode(test_environment.time_tested )))
__M_writer(u'</td></tr>\n <tr><td><b>System:</b> ')
# SOURCE LINE 983
__M_writer(filters.html_escape(unicode(test_environment.system )))
__M_writer(u'</td></tr>\n <tr><td><b>Architecture:</b> ')
# SOURCE LINE 984
__M_writer(filters.html_escape(unicode(test_environment.architecture )))
__M_writer(u'</td></tr>\n <tr><td><b>Python version:</b> ')
# SOURCE LINE 985
__M_writer(filters.html_escape(unicode(test_environment.python_version )))
__M_writer(u'</td></tr>\n <tr><td><b>Galaxy revision:</b> ')
# SOURCE LINE 986
__M_writer(filters.html_escape(unicode(test_environment.galaxy_revision )))
__M_writer(u'</td></tr>\n <tr><td><b>Galaxy database version:</b> ')
# SOURCE LINE 987
__M_writer(filters.html_escape(unicode(test_environment.galaxy_database_version )))
__M_writer(u'</td></tr>\n <tr><td><b>Tool shed revision:</b> ')
# SOURCE LINE 988
__M_writer(filters.html_escape(unicode(test_environment.tool_shed_revision )))
__M_writer(u'</td></tr>\n <tr><td><b>Tool shed database version:</b> ')
# SOURCE LINE 989
__M_writer(filters.html_escape(unicode(test_environment.tool_shed_database_version )))
__M_writer(u'</td></tr>\n <tr><td><b>Tool shed mercurial version:</b> ')
# SOURCE LINE 990
__M_writer(filters.html_escape(unicode(test_environment.tool_shed_mercurial_version )))
__M_writer(u'</td></tr>\n </table>\n </td>\n </tr>\n ')
# SOURCE LINE 994
my_row = row_counter.count
row_counter.increment()
# SOURCE LINE 997
__M_writer(u'\n')
return ''
finally:
context.caller_stack._pop_frame()
def render_container_javascripts(context):
context.caller_stack._push_frame()
try:
trans = context.get('trans', UNDEFINED)
__M_writer = context.writer()
# SOURCE LINE 78
__M_writer(u'\n <script type="text/javascript">\n var init_dependencies = function() {\n var storage_id = "library-expand-state-')
# SOURCE LINE 81
__M_writer(unicode(trans.security.encode_id(10000)))
__M_writer(u'";\n var restore_folder_state = function() {\n var state = $.jStorage.get(storage_id);\n if (state) {\n for (var id in state) {\n if (state[id] === true) {\n var row = $("#" + id),\n index = row.parent().children().index(row);\n row.addClass("expanded").show();\n row.siblings().filter("tr[parent=\'" + index + "\']").show();\n }\n }\n }\n };\n var save_folder_state = function() {\n var state = {};\n $("tr.folderRow").each( function() {\n var folder = $(this);\n state[folder.attr("id")] = folder.hasClass("expanded");\n });\n $.jStorage.set(storage_id, state);\n };\n $(".container-table").each(function() {\n //var container_id = this.id.split( "-" )[0];\n //alert( container_id );\n var child_of_parent_cache = {};\n // Recursively fill in children and descendants of each row\n var process_row = function(q, parents) {\n // Find my index\n var parent = q.parent(),\n this_level = child_of_parent_cache[parent] || (child_of_parent_cache[parent] = parent.children());\n var index = this_level.index(q);\n // Find my immediate children\n var children = $(par_child_dict[index]);\n // Recursively handle them\n var descendants = children;\n children.each( function() {\n child_descendants = process_row( $(this), parents.add(q) );\n descendants = descendants.add(child_descendants);\n });\n // Set up expand / hide link\n var expand_fn = function() {\n if ( q.hasClass("expanded") ) {\n descendants.hide();\n descendants.removeClass("expanded");\n q.removeClass("expanded");\n } else {\n children.show();\n q.addClass("expanded");\n }\n save_folder_state();\n };\n $("." + q.attr("id") + "-click").click(expand_fn);\n // return descendants for use by parent\n return descendants;\n }\n // Initialize dict[parent_id] = rows_which_have_that_parent_id_as_parent_attr\n var par_child_dict = {},\n no_parent = [];\n $(this).find("tbody tr").each( function() {\n if ( $(this).attr("parent")) {\n var parent = $(this).attr("parent");\n if (par_child_dict[parent] !== undefined) {\n par_child_dict[parent].push(this);\n } else {\n par_child_dict[parent] = [this];\n }\n } else {\n no_parent.push(this);\n } \n });\n $(no_parent).each( function() {\n descendants = process_row( $(this), $([]) );\n descendants.hide();\n });\n });\n restore_folder_state();\n };\n $(function() {\n init_dependencies();\n });\n </script>\n')
return ''
finally:
context.caller_stack._pop_frame()
def render_render_readme(context,readme,pad,parent,row_counter,render_repository_actions_for='tool_shed'):
context.caller_stack._push_frame()
try:
trans = context.get('trans', UNDEFINED)
__M_writer = context.writer()
# SOURCE LINE 592
__M_writer(u'\n ')
# SOURCE LINE 593
encoded_id = trans.security.encode_id( readme.id )
__M_writer(u'\n <tr class="datasetRow"\n')
# SOURCE LINE 595
if parent is not None:
# SOURCE LINE 596
__M_writer(u' parent="')
__M_writer(unicode(parent))
__M_writer(u'" \n')
pass
# SOURCE LINE 598
__M_writer(u' id="libraryItem-rr-')
__M_writer(unicode(encoded_id))
__M_writer(u'">\n <td style="padding-left: ')
# SOURCE LINE 599
__M_writer(unicode(pad+20))
__M_writer(u'px;">\n <table id="readme_files">\n <tr><td>')
# SOURCE LINE 601
__M_writer(unicode( readme.text ))
__M_writer(u'</td></tr>\n </table>\n </td>\n </tr>\n ')
# SOURCE LINE 605
my_row = row_counter.count
row_counter.increment()
# SOURCE LINE 608
__M_writer(u'\n')
return ''
finally:
context.caller_stack._pop_frame()
def render_render_tool_dependency_installation_error(context,installation_error,pad,parent,row_counter,row_is_header=False,render_repository_actions_for='tool_shed'):
context.caller_stack._push_frame()
try:
trans = context.get('trans', UNDEFINED)
__M_writer = context.writer()
# SOURCE LINE 698
__M_writer(u'\n ')
# SOURCE LINE 699
from galaxy.util import unicodify
encoded_id = trans.security.encode_id( installation_error.id )
# SOURCE LINE 702
__M_writer(u'\n <tr class="datasetRow"\n')
# SOURCE LINE 704
if parent is not None:
# SOURCE LINE 705
__M_writer(u' parent="')
__M_writer(unicode(parent))
__M_writer(u'"\n')
pass
# SOURCE LINE 707
__M_writer(u' id="libraryItem-rtdie-')
__M_writer(unicode(encoded_id))
__M_writer(u'">\n <td style="padding-left: ')
# SOURCE LINE 708
__M_writer(unicode(pad+20))
__M_writer(u'px;">\n <table id="test_environment">\n <tr bgcolor="#FFFFCC">\n <th>Type</th><th>Name</th><th>Version</th>\n </tr>\n <tr>\n <td>')
# SOURCE LINE 714
__M_writer(filters.html_escape(unicode(installation_error.name )))
__M_writer(u'</td>\n <td>')
# SOURCE LINE 715
__M_writer(filters.html_escape(unicode(installation_error.type )))
__M_writer(u'</td>\n <td>')
# SOURCE LINE 716
__M_writer(filters.html_escape(unicode(installation_error.version )))
__M_writer(u'</td>\n </tr>\n <tr><th>Error</th></tr>\n <tr><td colspan="3">')
# SOURCE LINE 719
__M_writer(filters.html_escape(unicode(unicodify( installation_error.error_message ) )))
__M_writer(u'</td></tr>\n </table>\n </td>\n </tr>\n ')
# SOURCE LINE 723
my_row = row_counter.count
row_counter.increment()
# SOURCE LINE 726
__M_writer(u'\n')
return ''
finally:
context.caller_stack._pop_frame()
def render_render_repository_dependency(context,repository_dependency,pad,parent,row_counter,row_is_header=False,render_repository_actions_for='tool_shed'):
context.caller_stack._push_frame()
try:
h = context.get('h', UNDEFINED)
trans = context.get('trans', UNDEFINED)
str = context.get('str', UNDEFINED)
__M_writer = context.writer()
# SOURCE LINE 611
__M_writer(u'\n ')
# SOURCE LINE 612
from galaxy.util import asbool
from tool_shed.util.shed_util_common import get_repository_by_name_and_owner
encoded_id = trans.security.encode_id( repository_dependency.id )
if trans.webapp.name == 'galaxy':
if repository_dependency.tool_shed_repository_id:
encoded_required_repository_id = trans.security.encode_id( repository_dependency.tool_shed_repository_id )
else:
encoded_required_repository_id = None
if repository_dependency.installation_status:
installation_status = str( repository_dependency.installation_status )
else:
installation_status = None
repository_name = str( repository_dependency.repository_name )
repository_owner = str( repository_dependency.repository_owner )
changeset_revision = str( repository_dependency.changeset_revision )
if asbool( str( repository_dependency.prior_installation_required ) ):
prior_installation_required_str = " <i>(prior install required)</i>"
else:
prior_installation_required_str = ""
if trans.webapp.name == 'galaxy':
if row_is_header:
cell_type = 'th'
else:
cell_type = 'td'
rd = None
else:
# We're in the tool shed.
cell_type = 'td'
rd = get_repository_by_name_and_owner( trans.app, repository_name, repository_owner )
# SOURCE LINE 642
__M_writer(u'\n <tr class="datasetRow"\n')
# SOURCE LINE 644
if parent is not None:
# SOURCE LINE 645
__M_writer(u' parent="')
__M_writer(unicode(parent))
__M_writer(u'"\n')
pass
# SOURCE LINE 647
__M_writer(u' id="libraryItem-rrd-')
__M_writer(unicode(encoded_id))
__M_writer(u'">\n')
# SOURCE LINE 648
if trans.webapp.name == 'galaxy':
# SOURCE LINE 649
__M_writer(u' <')
__M_writer(unicode(cell_type))
__M_writer(u' style="padding-left: ')
__M_writer(unicode(pad+20))
__M_writer(u'px;">\n')
# SOURCE LINE 650
if row_is_header:
# SOURCE LINE 651
__M_writer(u' ')
__M_writer(filters.html_escape(unicode(repository_name )))
__M_writer(u'\n')
# SOURCE LINE 652
elif encoded_required_repository_id:
# SOURCE LINE 653
__M_writer(u' <a class="action-button" href="')
__M_writer(unicode(h.url_for( controller='admin_toolshed', action='manage_repository', id=encoded_required_repository_id )))
__M_writer(u'">')
__M_writer(filters.html_escape(unicode(repository_name )))
__M_writer(u'</a>\n')
# SOURCE LINE 654
else:
# SOURCE LINE 655
__M_writer(u' ')
__M_writer(filters.html_escape(unicode(repository_name )))
__M_writer(u' \n')
pass
# SOURCE LINE 657
__M_writer(u' </')
__M_writer(unicode(cell_type))
__M_writer(u'>\n <')
# SOURCE LINE 658
__M_writer(unicode(cell_type))
__M_writer(u'>\n ')
# SOURCE LINE 659
__M_writer(filters.html_escape(unicode(changeset_revision )))
__M_writer(u'\n </')
# SOURCE LINE 660
__M_writer(unicode(cell_type))
__M_writer(u'>\n <')
# SOURCE LINE 661
__M_writer(unicode(cell_type))
__M_writer(u'>\n ')
# SOURCE LINE 662
__M_writer(filters.html_escape(unicode(repository_owner )))
__M_writer(u'\n </')
# SOURCE LINE 663
__M_writer(unicode(cell_type))
__M_writer(u'>\n <')
# SOURCE LINE 664
__M_writer(unicode(cell_type))
__M_writer(u'>\n ')
# SOURCE LINE 665
__M_writer(unicode(installation_status))
__M_writer(u'\n </')
# SOURCE LINE 666
__M_writer(unicode(cell_type))
__M_writer(u'>\n')
# SOURCE LINE 667
else:
# SOURCE LINE 668
__M_writer(u' <td style="padding-left: ')
__M_writer(unicode(pad+20))
__M_writer(u'px;">\n')
# SOURCE LINE 669
if render_repository_actions_for == 'tool_shed' and rd:
# SOURCE LINE 670
__M_writer(u' <a class="view-info" href="')
__M_writer(unicode(h.url_for( controller='repository', action='view_or_manage_repository', id=trans.security.encode_id( rd.id ), changeset_revision=changeset_revision )))
__M_writer(u'">Repository <b>')
__M_writer(filters.html_escape(unicode(repository_name )))
__M_writer(u'</b> revision <b>')
__M_writer(filters.html_escape(unicode(changeset_revision )))
__M_writer(u'</b> owned by <b>')
__M_writer(filters.html_escape(unicode(repository_owner )))
__M_writer(u'</b></a>')
__M_writer(unicode(prior_installation_required_str))
__M_writer(u'\n')
# SOURCE LINE 671
else:
# SOURCE LINE 672
__M_writer(u' Repository <b>')
__M_writer(filters.html_escape(unicode(repository_name )))
__M_writer(u'</b> revision <b>')
__M_writer(filters.html_escape(unicode(changeset_revision )))
__M_writer(u'</b> owned by <b>')
__M_writer(filters.html_escape(unicode(repository_owner )))
__M_writer(u'</b>')
__M_writer(unicode(prior_installation_required_str))
__M_writer(u'\n')
pass
# SOURCE LINE 674
__M_writer(u' </td>\n')
pass
# SOURCE LINE 676
__M_writer(u' </tr>\n ')
# SOURCE LINE 677
my_row = row_counter.count
row_counter.increment()
# SOURCE LINE 680
__M_writer(u'\n')
return ''
finally:
context.caller_stack._pop_frame()
def render_render_repository_successful_installation(context,successful_installation,pad,parent,row_counter,row_is_header=False,is_current_repository=False,render_repository_actions_for='tool_shed'):
context.caller_stack._push_frame()
try:
trans = context.get('trans', UNDEFINED)
__M_writer = context.writer()
# SOURCE LINE 793
__M_writer(u'\n ')
# SOURCE LINE 794
encoded_id = trans.security.encode_id( successful_installation.id )
# SOURCE LINE 796
__M_writer(u'\n <tr class="datasetRow"\n')
# SOURCE LINE 798
if parent is not None:
# SOURCE LINE 799
__M_writer(u' parent="')
__M_writer(unicode(parent))
__M_writer(u'"\n')
pass
# SOURCE LINE 801
__M_writer(u' id="libraryItem-rrsi-')
__M_writer(unicode(encoded_id))
__M_writer(u'">\n <td style="padding-left: ')
# SOURCE LINE 802
__M_writer(unicode(pad+20))
__M_writer(u'px;">\n <table id="test_environment">\n')
# SOURCE LINE 804
if not is_current_repository:
# SOURCE LINE 805
__M_writer(u' <tr bgcolor="#FFFFCC">\n <th>Tool shed</th><th>Name</th><th>Owner</th><th>Changeset revision</th>\n </tr>\n <tr>\n <td>')
# SOURCE LINE 809
__M_writer(filters.html_escape(unicode(successful_installation.tool_shed )))
__M_writer(u'</td>\n <td>')
# SOURCE LINE 810
__M_writer(filters.html_escape(unicode(successful_installation.name )))
__M_writer(u'</td>\n <td>')
# SOURCE LINE 811
__M_writer(filters.html_escape(unicode(successful_installation.owner )))
__M_writer(u'</td>\n <td>')
# SOURCE LINE 812
__M_writer(filters.html_escape(unicode(successful_installation.changeset_revision )))
__M_writer(u'</td>\n </tr>\n')
pass
# SOURCE LINE 815
__M_writer(u' </table>\n </td>\n </tr>\n ')
# SOURCE LINE 818
my_row = row_counter.count
row_counter.increment()
# SOURCE LINE 821
__M_writer(u'\n')
return ''
finally:
context.caller_stack._pop_frame()
def render_render_datatype(context,datatype,pad,parent,row_counter,row_is_header=False,render_repository_actions_for='tool_shed'):
context.caller_stack._push_frame()
try:
trans = context.get('trans', UNDEFINED)
__M_writer = context.writer()
# SOURCE LINE 423
__M_writer(u'\n ')
# SOURCE LINE 424
encoded_id = trans.security.encode_id( datatype.id )
if row_is_header:
cell_type = 'th'
else:
cell_type = 'td'
# SOURCE LINE 430
__M_writer(u'\n <tr class="datasetRow"\n')
# SOURCE LINE 432
if parent is not None:
# SOURCE LINE 433
__M_writer(u' parent="')
__M_writer(unicode(parent))
__M_writer(u'"\n')
pass
# SOURCE LINE 435
__M_writer(u' id="libraryItem-rd-')
__M_writer(unicode(encoded_id))
__M_writer(u'">\n <')
# SOURCE LINE 436
__M_writer(unicode(cell_type))
__M_writer(u' style="padding-left: ')
__M_writer(unicode(pad+20))
__M_writer(u'px;">')
__M_writer(filters.html_escape(unicode(datatype.extension )))
__M_writer(u'</')
__M_writer(unicode(cell_type))
__M_writer(u'>\n <')
# SOURCE LINE 437
__M_writer(unicode(cell_type))
__M_writer(u'>')
__M_writer(filters.html_escape(unicode(datatype.type )))
__M_writer(u'</')
__M_writer(unicode(cell_type))
__M_writer(u'>\n <')
# SOURCE LINE 438
__M_writer(unicode(cell_type))
__M_writer(u'>')
__M_writer(filters.html_escape(unicode(datatype.mimetype )))
__M_writer(u'</')
__M_writer(unicode(cell_type))
__M_writer(u'>\n <')
# SOURCE LINE 439
__M_writer(unicode(cell_type))
__M_writer(u'>')
__M_writer(filters.html_escape(unicode(datatype.subclass )))
__M_writer(u'</')
__M_writer(unicode(cell_type))
__M_writer(u'>\n </tr>\n ')
# SOURCE LINE 441
my_row = row_counter.count
row_counter.increment()
# SOURCE LINE 444
__M_writer(u'\n')
return ''
finally:
context.caller_stack._pop_frame()
def render_render_failed_test(context,failed_test,pad,parent,row_counter,row_is_header=False,render_repository_actions_for='tool_shed'):
context.caller_stack._push_frame()
try:
trans = context.get('trans', UNDEFINED)
__M_writer = context.writer()
# SOURCE LINE 447
__M_writer(u'\n ')
# SOURCE LINE 448
from tool_shed.util.basic_util import to_html_string
encoded_id = trans.security.encode_id( failed_test.id )
# SOURCE LINE 451
__M_writer(u'\n <tr class="datasetRow"\n')
# SOURCE LINE 453
if parent is not None:
# SOURCE LINE 454
__M_writer(u' parent="')
__M_writer(unicode(parent))
__M_writer(u'"\n')
pass
# SOURCE LINE 456
__M_writer(u' id="libraryItem-rft-')
__M_writer(unicode(encoded_id))
__M_writer(u'">\n <td style="padding-left: ')
# SOURCE LINE 457
__M_writer(unicode(pad+20))
__M_writer(u'px;">\n <table id="test_environment">\n <tr><td bgcolor="#FFFFCC"><b>Tool id:</b> ')
# SOURCE LINE 459
__M_writer(filters.html_escape(unicode(failed_test.tool_id )))
__M_writer(u'</td></tr>\n <tr><td><b>Tool version:</b> ')
# SOURCE LINE 460
__M_writer(filters.html_escape(unicode(failed_test.tool_id )))
__M_writer(u'</td></tr>\n <tr><td><b>Test:</b> ')
# SOURCE LINE 461
__M_writer(filters.html_escape(unicode(failed_test.test_id )))
__M_writer(u'</td></tr>\n <tr><td><b>Stderr:</b> <br/>')
# SOURCE LINE 462
__M_writer(unicode( to_html_string( failed_test.stderr ) ))
__M_writer(u'</td></tr>\n <tr><td><b>Traceback:</b> <br/>')
# SOURCE LINE 463
__M_writer(unicode( to_html_string( failed_test.traceback ) ))
__M_writer(u'</td></tr>\n </table>\n </td>\n </tr>\n ')
# SOURCE LINE 467
my_row = row_counter.count
row_counter.increment()
# SOURCE LINE 470
__M_writer(u'\n')
return ''
finally:
context.caller_stack._pop_frame()
def render_common_javascripts(context,repository):
context.caller_stack._push_frame()
try:
h = context.get('h', UNDEFINED)
trans = context.get('trans', UNDEFINED)
__M_writer = context.writer()
# SOURCE LINE 1
__M_writer(u'\n <script type="text/javascript">\n $(function(){\n $("#tree").ajaxComplete(function(event, XMLHttpRequest, ajaxOptions) {\n _log("debug", "ajaxComplete: %o", this); // dom element listening\n });\n // --- Initialize sample trees\n $("#tree").dynatree({\n title: "')
# SOURCE LINE 9
__M_writer(unicode(repository.name))
__M_writer(u'",\n rootVisible: true,\n minExpandLevel: 0, // 1: root node is not collapsible\n persist: false,\n checkbox: true,\n selectMode: 3,\n onPostInit: function(isReloading, isError) {\n //alert("reloading: "+isReloading+", error:"+isError);\n logMsg("onPostInit(%o, %o) - %o", isReloading, isError, this);\n // Re-fire onActivate, so the text is updated\n this.reactivate();\n }, \n fx: { height: "toggle", duration: 200 },\n // initAjax is hard to fake, so we pass the children as object array:\n initAjax: {url: "')
# SOURCE LINE 23
__M_writer(unicode(h.url_for( controller='repository', action='open_folder' )))
__M_writer(u'",\n dataType: "json", \n data: { folder_path: "')
# SOURCE LINE 25
__M_writer(unicode(repository.repo_path( trans.app )))
__M_writer(u'" },\n },\n onLazyRead: function(dtnode){\n dtnode.appendAjax({\n url: "')
# SOURCE LINE 29
__M_writer(unicode(h.url_for( controller='repository', action='open_folder' )))
__M_writer(u'", \n dataType: "json",\n data: { folder_path: dtnode.data.key },\n });\n },\n onSelect: function(select, dtnode) {\n // Display list of selected nodes\n var selNodes = dtnode.tree.getSelectedNodes();\n // convert to title/key array\n var selKeys = $.map(selNodes, function(node) {\n return node.data.key;\n });\n if (document.forms["select_files_to_delete"]) {\n // The following is used only ~/templates/webapps/tool_shed/repository/browse_repository.mako.\n document.select_files_to_delete.selected_files_to_delete.value = selKeys.join(",");\n }\n // The following is used only in ~/templates/webapps/tool_shed/repository/upload.mako.\n if (document.forms["upload_form"]) {\n document.upload_form.upload_point.value = selKeys.slice(-1);\n }\n },\n onActivate: function(dtnode) {\n var cell = $("#file_contents");\n var selected_value;\n if (dtnode.data.key == \'root\') {\n selected_value = "')
# SOURCE LINE 54
__M_writer(unicode(repository.repo_path( trans.app )))
__M_writer(u'/";\n } else {\n selected_value = dtnode.data.key;\n };\n if (selected_value.charAt(selected_value.length-1) != \'/\') {\n // Make ajax call\n $.ajax( {\n type: "POST",\n url: "')
# SOURCE LINE 62
__M_writer(unicode(h.url_for( controller='repository', action='get_file_contents' )))
__M_writer(u'",\n dataType: "json",\n data: { file_path: selected_value },\n success : function ( data ) {\n cell.html( \'<label>\'+data+\'</label>\' )\n }\n });\n } else {\n cell.html( \'\' );\n };\n },\n });\n });\n </script>\n')
return ''
finally:
context.caller_stack._pop_frame()
def render_render_valid_data_manager(context,data_manager,pad,parent,row_counter,row_is_header=False,render_repository_actions_for='tool_shed'):
context.caller_stack._push_frame()
try:
trans = context.get('trans', UNDEFINED)
__M_writer = context.writer()
# SOURCE LINE 1000
__M_writer(u'\n ')
# SOURCE LINE 1001
encoded_id = trans.security.encode_id( data_manager.id )
if row_is_header:
cell_type = 'th'
else:
cell_type = 'td'
# SOURCE LINE 1007
__M_writer(u'\n <tr class="datasetRow"\n')
# SOURCE LINE 1009
if parent is not None:
# SOURCE LINE 1010
__M_writer(u' parent="')
__M_writer(unicode(parent))
__M_writer(u'"\n')
pass
# SOURCE LINE 1012
__M_writer(u' id="libraryItem-rvdm-')
__M_writer(unicode(encoded_id))
__M_writer(u'">\n <')
# SOURCE LINE 1013
__M_writer(unicode(cell_type))
__M_writer(u' style="padding-left: ')
__M_writer(unicode(pad+20))
__M_writer(u'px;">')
__M_writer(filters.html_escape(unicode(data_manager.name )))
__M_writer(u'</')
__M_writer(unicode(cell_type))
__M_writer(u'>\n <')
# SOURCE LINE 1014
__M_writer(unicode(cell_type))
__M_writer(u'>')
__M_writer(filters.html_escape(unicode(data_manager.version )))
__M_writer(u'</')
__M_writer(unicode(cell_type))
__M_writer(u'>\n <')
# SOURCE LINE 1015
__M_writer(unicode(cell_type))
__M_writer(u'>')
__M_writer(filters.html_escape(unicode(data_manager.data_tables )))
__M_writer(u'</')
__M_writer(unicode(cell_type))
__M_writer(u'>\n </tr>\n ')
# SOURCE LINE 1017
my_row = row_counter.count
row_counter.increment()
# SOURCE LINE 1020
__M_writer(u'\n')
return ''
finally:
context.caller_stack._pop_frame()
def render_render_repository_installation_error(context,installation_error,pad,parent,row_counter,row_is_header=False,is_current_repository=False,render_repository_actions_for='tool_shed'):
context.caller_stack._push_frame()
try:
trans = context.get('trans', UNDEFINED)
__M_writer = context.writer()
# SOURCE LINE 759
__M_writer(u'\n ')
# SOURCE LINE 760
from galaxy.util import unicodify
encoded_id = trans.security.encode_id( installation_error.id )
# SOURCE LINE 763
__M_writer(u'\n <tr class="datasetRow"\n')
# SOURCE LINE 765
if parent is not None:
# SOURCE LINE 766
__M_writer(u' parent="')
__M_writer(unicode(parent))
__M_writer(u'"\n')
pass
# SOURCE LINE 768
__M_writer(u' id="libraryItem-rrie-')
__M_writer(unicode(encoded_id))
__M_writer(u'">\n <td style="padding-left: ')
# SOURCE LINE 769
__M_writer(unicode(pad+20))
__M_writer(u'px;">\n <table id="test_environment">\n')
# SOURCE LINE 771
if not is_current_repository:
# SOURCE LINE 772
__M_writer(u' <tr bgcolor="#FFFFCC">\n <th>Tool shed</th><th>Name</th><th>Owner</th><th>Changeset revision</th>\n </tr>\n <tr>\n <td>')
# SOURCE LINE 776
__M_writer(filters.html_escape(unicode(installation_error.tool_shed )))
__M_writer(u'</td>\n <td>')
# SOURCE LINE 777
__M_writer(filters.html_escape(unicode(installation_error.name )))
__M_writer(u'</td>\n <td>')
# SOURCE LINE 778
__M_writer(filters.html_escape(unicode(installation_error.owner )))
__M_writer(u'</td>\n <td>')
# SOURCE LINE 779
__M_writer(filters.html_escape(unicode(installation_error.changeset_revision )))
__M_writer(u'</td>\n </tr>\n')
pass
# SOURCE LINE 782
__M_writer(u' <tr><th>Error</th></tr>\n <tr><td colspan="4">')
# SOURCE LINE 783
__M_writer(filters.html_escape(unicode(unicodify( installation_error.error_message ) )))
__M_writer(u'</td></tr>\n </table>\n </td>\n </tr>\n ')
# SOURCE LINE 787
my_row = row_counter.count
row_counter.increment()
# SOURCE LINE 790
__M_writer(u'\n')
return ''
finally:
context.caller_stack._pop_frame()
def render_render_invalid_repository_dependency(context,invalid_repository_dependency,pad,parent,row_counter,render_repository_actions_for='tool_shed'):
context.caller_stack._push_frame()
try:
trans = context.get('trans', UNDEFINED)
__M_writer = context.writer()
# SOURCE LINE 495
__M_writer(u'\n ')
# SOURCE LINE 496
encoded_id = trans.security.encode_id( invalid_repository_dependency.id )
# SOURCE LINE 498
__M_writer(u'\n <tr class="datasetRow"\n')
# SOURCE LINE 500
if parent is not None:
# SOURCE LINE 501
__M_writer(u' parent="')
__M_writer(unicode(parent))
__M_writer(u'"\n')
pass
# SOURCE LINE 503
__M_writer(u' id="libraryItem-rird-')
__M_writer(unicode(encoded_id))
__M_writer(u'">\n <td style="padding-left: ')
# SOURCE LINE 504
__M_writer(unicode(pad+20))
__M_writer(u'px;">\n ')
# SOURCE LINE 505
__M_writer(filters.html_escape(unicode( invalid_repository_dependency.error )))
__M_writer(u'\n </td>\n </tr>\n ')
# SOURCE LINE 508
my_row = row_counter.count
row_counter.increment()
# SOURCE LINE 511
__M_writer(u'\n')
return ''
finally:
context.caller_stack._pop_frame()
def render_render_invalid_tool(context,invalid_tool,pad,parent,row_counter,valid=True,render_repository_actions_for='tool_shed'):
context.caller_stack._push_frame()
try:
h = context.get('h', UNDEFINED)
trans = context.get('trans', UNDEFINED)
__M_writer = context.writer()
# SOURCE LINE 514
__M_writer(u'\n ')
# SOURCE LINE 515
encoded_id = trans.security.encode_id( invalid_tool.id )
__M_writer(u'\n <tr class="datasetRow"\n')
# SOURCE LINE 517
if parent is not None:
# SOURCE LINE 518
__M_writer(u' parent="')
__M_writer(unicode(parent))
__M_writer(u'"\n')
pass
# SOURCE LINE 520
__M_writer(u' id="libraryItem-rit-')
__M_writer(unicode(encoded_id))
__M_writer(u'">\n <td style="padding-left: ')
# SOURCE LINE 521
__M_writer(unicode(pad+20))
__M_writer(u'px;">\n')
# SOURCE LINE 522
if trans.webapp.name == 'tool_shed' and invalid_tool.repository_id and invalid_tool.tool_config and invalid_tool.changeset_revision:
# SOURCE LINE 523
__M_writer(u' <a class="view-info" href="')
__M_writer(unicode(h.url_for( controller='repository', action='load_invalid_tool', repository_id=trans.security.encode_id( invalid_tool.repository_id ), tool_config=invalid_tool.tool_config, changeset_revision=invalid_tool.changeset_revision, render_repository_actions_for=render_repository_actions_for )))
__M_writer(u'">\n ')
# SOURCE LINE 524
__M_writer(filters.html_escape(unicode(invalid_tool.tool_config )))
__M_writer(u'\n </a>\n')
# SOURCE LINE 526
else:
# SOURCE LINE 527
__M_writer(u' ')
__M_writer(filters.html_escape(unicode(invalid_tool.tool_config )))
__M_writer(u'\n')
pass
# SOURCE LINE 529
__M_writer(u' </td>\n </tr>\n ')
# SOURCE LINE 531
my_row = row_counter.count
row_counter.increment()
# SOURCE LINE 534
__M_writer(u'\n')
return ''
finally:
context.caller_stack._pop_frame()
def render_render_workflow(context,workflow,pad,parent,row_counter,row_is_header=False,render_repository_actions_for='tool_shed'):
context.caller_stack._push_frame()
try:
h = context.get('h', UNDEFINED)
trans = context.get('trans', UNDEFINED)
__M_writer = context.writer()
# SOURCE LINE 1023
__M_writer(u'\n ')
# SOURCE LINE 1024
from tool_shed.util.encoding_util import tool_shed_encode
encoded_id = trans.security.encode_id( workflow.id )
encoded_workflow_name = tool_shed_encode( workflow.workflow_name )
if trans.webapp.name == 'tool_shed':
encoded_repository_metadata_id = trans.security.encode_id( workflow.repository_metadata_id )
encoded_repository_id = None
else:
encoded_repository_metadata_id = None
encoded_repository_id = trans.security.encode_id( workflow.repository_id )
if row_is_header:
cell_type = 'th'
else:
cell_type = 'td'
# SOURCE LINE 1038
__M_writer(u'\n <tr class="datasetRow"\n')
# SOURCE LINE 1040
if parent is not None:
# SOURCE LINE 1041
__M_writer(u' parent="')
__M_writer(unicode(parent))
__M_writer(u'"\n')
pass
# SOURCE LINE 1043
__M_writer(u' id="libraryItem-rw-')
__M_writer(unicode(encoded_id))
__M_writer(u'">\n <')
# SOURCE LINE 1044
__M_writer(unicode(cell_type))
__M_writer(u' style="padding-left: ')
__M_writer(unicode(pad+20))
__M_writer(u'px;">\n')
# SOURCE LINE 1045
if row_is_header:
# SOURCE LINE 1046
__M_writer(u' ')
__M_writer(filters.html_escape(unicode(workflow.workflow_name )))
__M_writer(u'\n')
# SOURCE LINE 1047
elif trans.webapp.name == 'tool_shed' and encoded_repository_metadata_id:
# SOURCE LINE 1048
__M_writer(u' <a href="')
__M_writer(unicode(h.url_for( controller='repository', action='view_workflow', workflow_name=encoded_workflow_name, repository_metadata_id=encoded_repository_metadata_id, render_repository_actions_for=render_repository_actions_for )))
__M_writer(u'">')
__M_writer(filters.html_escape(unicode(workflow.workflow_name )))
__M_writer(u'</a>\n')
# SOURCE LINE 1049
elif trans.webapp.name == 'galaxy' and encoded_repository_id:
# SOURCE LINE 1050
__M_writer(u' <a href="')
__M_writer(unicode(h.url_for( controller='admin_toolshed', action='view_workflow', workflow_name=encoded_workflow_name, repository_id=encoded_repository_id )))
__M_writer(u'">')
__M_writer(filters.html_escape(unicode(workflow.workflow_name )))
__M_writer(u'</a>\n')
# SOURCE LINE 1051
else:
# SOURCE LINE 1052
__M_writer(u' ')
__M_writer(filters.html_escape(unicode(workflow.workflow_name )))
__M_writer(u'\n')
pass
# SOURCE LINE 1054
__M_writer(u' </')
__M_writer(unicode(cell_type))
__M_writer(u'>\n <')
# SOURCE LINE 1055
__M_writer(unicode(cell_type))
__M_writer(u'>')
__M_writer(filters.html_escape(unicode(workflow.steps )))
__M_writer(u'</')
__M_writer(unicode(cell_type))
__M_writer(u'>\n <')
# SOURCE LINE 1056
__M_writer(unicode(cell_type))
__M_writer(u'>')
__M_writer(filters.html_escape(unicode(workflow.format_version )))
__M_writer(u'</')
__M_writer(unicode(cell_type))
__M_writer(u'>\n <')
# SOURCE LINE 1057
__M_writer(unicode(cell_type))
__M_writer(u'>')
__M_writer(filters.html_escape(unicode(workflow.annotation )))
__M_writer(u'</')
__M_writer(unicode(cell_type))
__M_writer(u'>\n </tr>\n ')
# SOURCE LINE 1059
my_row = row_counter.count
row_counter.increment()
# SOURCE LINE 1062
__M_writer(u'\n')
return ''
finally:
context.caller_stack._pop_frame()
def render_render_repository_type_select_field(context,repository_type_select_field,render_help=True):
context.caller_stack._push_frame()
try:
len = context.get('len', UNDEFINED)
__M_writer = context.writer()
# SOURCE LINE 165
__M_writer(u'\n <div class="form-row">\n <label>Repository type:</label>\n ')
# SOURCE LINE 168
from tool_shed.repository_types import util
options = repository_type_select_field.options
repository_types = []
for option_tup in options:
repository_types.append( option_tup[ 1 ] )
render_as_text = len( options ) == 1
if render_as_text:
repository_type = options[ 0 ][ 0 ]
# SOURCE LINE 177
__M_writer(u'\n')
# SOURCE LINE 178
if render_as_text:
# SOURCE LINE 179
__M_writer(u' ')
__M_writer(filters.html_escape(unicode(repository_type )))
__M_writer(u'\n')
# SOURCE LINE 180
if render_help:
# SOURCE LINE 181
__M_writer(u' <div class="toolParamHelp" style="clear: both;">\n This repository\'s type cannot be changed because its contents are valid only for its current type or it has been cloned.\n </div>\n')
pass
# SOURCE LINE 185
else:
# SOURCE LINE 186
__M_writer(u' ')
__M_writer(unicode(repository_type_select_field.get_html()))
__M_writer(u'\n')
# SOURCE LINE 187
if render_help:
# SOURCE LINE 188
__M_writer(u' <div class="toolParamHelp" style="clear: both;">\n Select the repository type based on the following criteria.\n <ul>\n')
# SOURCE LINE 191
if util.UNRESTRICTED in repository_types:
# SOURCE LINE 192
__M_writer(u' <li><b>Unrestricted</b> - contents can be any set of valid Galaxy utilities or files\n')
pass
# SOURCE LINE 194
if util.REPOSITORY_SUITE_DEFINITION in repository_types:
# SOURCE LINE 195
__M_writer(u' <li><b>Repository suite definition</b> - contents will always be restricted to one file named repository_dependencies.xml\n')
pass
# SOURCE LINE 197
if util.TOOL_DEPENDENCY_DEFINITION in repository_types:
# SOURCE LINE 198
__M_writer(u' <li><b>Tool dependency definition</b> - contents will always be restricted to one file named tool_dependencies.xml\n')
pass
# SOURCE LINE 200
__M_writer(u' </ul>\n </div>\n')
pass
pass
# SOURCE LINE 204
__M_writer(u' <div style="clear: both"></div>\n </div>\n')
return ''
finally:
context.caller_stack._pop_frame()
def render_render_passed_test(context,passed_test,pad,parent,row_counter,row_is_header=False,render_repository_actions_for='tool_shed'):
context.caller_stack._push_frame()
try:
trans = context.get('trans', UNDEFINED)
__M_writer = context.writer()
# SOURCE LINE 845
__M_writer(u'\n ')
# SOURCE LINE 846
encoded_id = trans.security.encode_id( passed_test.id )
# SOURCE LINE 848
__M_writer(u'\n <tr class="datasetRow"\n')
# SOURCE LINE 850
if parent is not None:
# SOURCE LINE 851
__M_writer(u' parent="')
__M_writer(unicode(parent))
__M_writer(u'"\n')
pass
# SOURCE LINE 853
__M_writer(u' id="libraryItem-rpt-')
__M_writer(unicode(encoded_id))
__M_writer(u'">\n <td style="padding-left: ')
# SOURCE LINE 854
__M_writer(unicode(pad+20))
__M_writer(u'px;">\n <table id="test_environment">\n <tr><td bgcolor="#FFFFCC"><b>Tool id:</b> ')
# SOURCE LINE 856
__M_writer(filters.html_escape(unicode(passed_test.tool_id )))
__M_writer(u'</td></tr>\n <tr><td><b>Tool version:</b> ')
# SOURCE LINE 857
__M_writer(filters.html_escape(unicode(passed_test.tool_id )))
__M_writer(u'</td></tr>\n <tr><td><b>Test:</b> ')
# SOURCE LINE 858
__M_writer(filters.html_escape(unicode(passed_test.test_id )))
__M_writer(u'</td></tr>\n </table>\n </td>\n </tr>\n ')
# SOURCE LINE 862
my_row = row_counter.count
row_counter.increment()
# SOURCE LINE 865
__M_writer(u'\n')
return ''
finally:
context.caller_stack._pop_frame()
def render_render_repository_items(context,metadata,containers_dict,can_set_metadata=False,render_repository_actions_for='tool_shed'):
context.caller_stack._push_frame()
try:
def render_table_wrap_style(table_id):
return render_render_table_wrap_style(context,table_id)
def render_folder(folder,folder_pad,parent=None,row_counter=None,is_root_folder=False,render_repository_actions_for='tool_shed'):
return render_render_folder(context,folder,folder_pad,parent,row_counter,is_root_folder,render_repository_actions_for)
__M_writer = context.writer()
# SOURCE LINE 1065
__M_writer(u'\n ')
# SOURCE LINE 1066
from tool_shed.util.encoding_util import tool_shed_encode
has_datatypes = metadata and 'datatypes' in metadata
has_readme_files = metadata and 'readme_files' in metadata
has_workflows = metadata and 'workflows' in metadata
datatypes_root_folder = containers_dict.get( 'datatypes', None )
invalid_data_managers_root_folder = containers_dict.get( 'invalid_data_managers', None )
invalid_repository_dependencies_root_folder = containers_dict.get( 'invalid_repository_dependencies', None )
invalid_tool_dependencies_root_folder = containers_dict.get( 'invalid_tool_dependencies', None )
invalid_tools_root_folder = containers_dict.get( 'invalid_tools', None )
missing_repository_dependencies_root_folder = containers_dict.get( 'missing_repository_dependencies', None )
missing_tool_dependencies_root_folder = containers_dict.get( 'missing_tool_dependencies', None )
readme_files_root_folder = containers_dict.get( 'readme_files', None )
repository_dependencies_root_folder = containers_dict.get( 'repository_dependencies', None )
test_environment_root_folder = containers_dict.get( 'test_environment', None )
tool_dependencies_root_folder = containers_dict.get( 'tool_dependencies', None )
tool_test_results_root_folder = containers_dict.get( 'tool_test_results', None )
valid_data_managers_root_folder = containers_dict.get( 'valid_data_managers', None )
valid_tools_root_folder = containers_dict.get( 'valid_tools', None )
workflows_root_folder = containers_dict.get( 'workflows', None )
has_contents = datatypes_root_folder or invalid_tools_root_folder or valid_tools_root_folder or workflows_root_folder
has_dependencies = \
invalid_repository_dependencies_root_folder or \
invalid_tool_dependencies_root_folder or \
missing_repository_dependencies_root_folder or \
repository_dependencies_root_folder or \
tool_dependencies_root_folder or \
missing_tool_dependencies_root_folder
class RowCounter( object ):
def __init__( self ):
self.count = 0
def increment( self ):
self.count += 1
def __str__( self ):
return str( self.count )
# SOURCE LINE 1105
__M_writer(u'\n')
# SOURCE LINE 1106
if readme_files_root_folder:
# SOURCE LINE 1107
__M_writer(u' ')
__M_writer(unicode(render_table_wrap_style( "readme_files" )))
__M_writer(u'\n <p/>\n <div class="toolForm">\n <div class="toolFormTitle">Repository README files - may contain important installation or license information</div>\n <div class="toolFormBody">\n <p/>\n ')
# SOURCE LINE 1113
row_counter = RowCounter()
__M_writer(u'\n <table cellspacing="2" cellpadding="2" border="0" width="100%" class="tables container-table" id="readme_files">\n ')
# SOURCE LINE 1115
__M_writer(unicode(render_folder( readme_files_root_folder, 0, parent=None, row_counter=row_counter, is_root_folder=True, render_repository_actions_for=render_repository_actions_for )))
__M_writer(u'\n </table>\n </div>\n </div>\n')
pass
# SOURCE LINE 1120
if has_dependencies:
# SOURCE LINE 1121
__M_writer(u' <div class="toolForm">\n <div class="toolFormTitle">Dependencies of this repository</div>\n <div class="toolFormBody">\n')
# SOURCE LINE 1124
if invalid_repository_dependencies_root_folder:
# SOURCE LINE 1125
__M_writer(u' <p/>\n ')
# SOURCE LINE 1126
row_counter = RowCounter()
__M_writer(u'\n <table cellspacing="2" cellpadding="2" border="0" width="100%" class="tables container-table" id="invalid_repository_dependencies">\n ')
# SOURCE LINE 1128
__M_writer(unicode(render_folder( invalid_repository_dependencies_root_folder, 0, parent=None, row_counter=row_counter, is_root_folder=True, render_repository_actions_for=render_repository_actions_for )))
__M_writer(u'\n </table>\n')
pass
# SOURCE LINE 1131
if missing_repository_dependencies_root_folder:
# SOURCE LINE 1132
__M_writer(u' <p/>\n ')
# SOURCE LINE 1133
row_counter = RowCounter()
__M_writer(u'\n <table cellspacing="2" cellpadding="2" border="0" width="100%" class="tables container-table" id="missing_repository_dependencies">\n ')
# SOURCE LINE 1135
__M_writer(unicode(render_folder( missing_repository_dependencies_root_folder, 0, parent=None, row_counter=row_counter, is_root_folder=True, render_repository_actions_for=render_repository_actions_for )))
__M_writer(u'\n </table>\n')
pass
# SOURCE LINE 1138
if repository_dependencies_root_folder:
# SOURCE LINE 1139
__M_writer(u' <p/>\n ')
# SOURCE LINE 1140
row_counter = RowCounter()
__M_writer(u'\n <table cellspacing="2" cellpadding="2" border="0" width="100%" class="tables container-table" id="repository_dependencies">\n ')
# SOURCE LINE 1142
__M_writer(unicode(render_folder( repository_dependencies_root_folder, 0, parent=None, row_counter=row_counter, is_root_folder=True, render_repository_actions_for=render_repository_actions_for )))
__M_writer(u'\n </table>\n')
pass
# SOURCE LINE 1145
if invalid_tool_dependencies_root_folder:
# SOURCE LINE 1146
__M_writer(u' <p/>\n ')
# SOURCE LINE 1147
row_counter = RowCounter()
__M_writer(u'\n <table cellspacing="2" cellpadding="2" border="0" width="100%" class="tables container-table" id="invalid_tool_dependencies">\n ')
# SOURCE LINE 1149
__M_writer(unicode(render_folder( invalid_tool_dependencies_root_folder, 0, parent=None, row_counter=row_counter, is_root_folder=True, render_repository_actions_for=render_repository_actions_for )))
__M_writer(u'\n </table>\n')
pass
# SOURCE LINE 1152
if tool_dependencies_root_folder:
# SOURCE LINE 1153
__M_writer(u' <p/>\n ')
# SOURCE LINE 1154
row_counter = RowCounter()
__M_writer(u'\n <table cellspacing="2" cellpadding="2" border="0" width="100%" class="tables container-table" id="tool_dependencies">\n ')
# SOURCE LINE 1156
__M_writer(unicode(render_folder( tool_dependencies_root_folder, 0, parent=None, row_counter=row_counter, is_root_folder=True, render_repository_actions_for=render_repository_actions_for )))
__M_writer(u'\n </table>\n')
pass
# SOURCE LINE 1159
if missing_tool_dependencies_root_folder:
# SOURCE LINE 1160
__M_writer(u' <p/>\n ')
# SOURCE LINE 1161
row_counter = RowCounter()
__M_writer(u'\n <table cellspacing="2" cellpadding="2" border="0" width="100%" class="tables container-table" id="missing_tool_dependencies">\n ')
# SOURCE LINE 1163
__M_writer(unicode(render_folder( missing_tool_dependencies_root_folder, 0, parent=None, row_counter=row_counter, is_root_folder=True, render_repository_actions_for=render_repository_actions_for )))
__M_writer(u'\n </table>\n')
pass
# SOURCE LINE 1166
__M_writer(u' </div>\n </div>\n')
pass
# SOURCE LINE 1169
if has_contents:
# SOURCE LINE 1170
__M_writer(u' <p/>\n <div class="toolForm">\n <div class="toolFormTitle">Contents of this repository</div>\n <div class="toolFormBody">\n')
# SOURCE LINE 1174
if valid_tools_root_folder:
# SOURCE LINE 1175
__M_writer(u' <p/>\n ')
# SOURCE LINE 1176
row_counter = RowCounter()
__M_writer(u'\n <table cellspacing="2" cellpadding="2" border="0" width="100%" class="tables container-table" id="valid_tools">\n ')
# SOURCE LINE 1178
__M_writer(unicode(render_folder( valid_tools_root_folder, 0, parent=None, row_counter=row_counter, is_root_folder=True, render_repository_actions_for=render_repository_actions_for )))
__M_writer(u'\n </table>\n')
pass
# SOURCE LINE 1181
if invalid_tools_root_folder:
# SOURCE LINE 1182
__M_writer(u' <p/>\n ')
# SOURCE LINE 1183
row_counter = RowCounter()
__M_writer(u'\n <table cellspacing="2" cellpadding="2" border="0" width="100%" class="tables container-table" id="invalid_tools">\n ')
# SOURCE LINE 1185
__M_writer(unicode(render_folder( invalid_tools_root_folder, 0, parent=None, row_counter=row_counter, is_root_folder=True, render_repository_actions_for=render_repository_actions_for )))
__M_writer(u'\n </table>\n')
pass
# SOURCE LINE 1188
if valid_data_managers_root_folder:
# SOURCE LINE 1189
__M_writer(u' <p/>\n ')
# SOURCE LINE 1190
row_counter = RowCounter()
__M_writer(u'\n <table cellspacing="2" cellpadding="2" border="0" width="100%" class="tables container-table" id="valid_data_managers">\n ')
# SOURCE LINE 1192
__M_writer(unicode(render_folder( valid_data_managers_root_folder, 0, parent=None, row_counter=row_counter, is_root_folder=True, render_repository_actions_for=render_repository_actions_for )))
__M_writer(u'\n </table>\n')
pass
# SOURCE LINE 1195
if invalid_data_managers_root_folder:
# SOURCE LINE 1196
__M_writer(u' <p/>\n ')
# SOURCE LINE 1197
row_counter = RowCounter()
__M_writer(u'\n <table cellspacing="2" cellpadding="2" border="0" width="100%" class="tables container-table" id="invalid_data_managers">\n ')
# SOURCE LINE 1199
__M_writer(unicode(render_folder( invalid_data_managers_root_folder, 0, parent=None, row_counter=row_counter, is_root_folder=True, render_repository_actions_for=render_repository_actions_for )))
__M_writer(u'\n </table>\n')
pass
# SOURCE LINE 1202
if workflows_root_folder:
# SOURCE LINE 1203
__M_writer(u' <p/>\n ')
# SOURCE LINE 1204
row_counter = RowCounter()
__M_writer(u'\n <table cellspacing="2" cellpadding="2" border="0" width="100%" class="tables container-table" id="workflows">\n ')
# SOURCE LINE 1206
__M_writer(unicode(render_folder( workflows_root_folder, 0, parent=None, row_counter=row_counter, is_root_folder=True, render_repository_actions_for=render_repository_actions_for )))
__M_writer(u'\n </table>\n')
pass
# SOURCE LINE 1209
if datatypes_root_folder:
# SOURCE LINE 1210
__M_writer(u' <p/>\n ')
# SOURCE LINE 1211
row_counter = RowCounter()
__M_writer(u'\n <table cellspacing="2" cellpadding="2" border="0" width="100%" class="tables container-table" id="datatypes">\n ')
# SOURCE LINE 1213
__M_writer(unicode(render_folder( datatypes_root_folder, 0, parent=None, row_counter=row_counter, is_root_folder=True, render_repository_actions_for=render_repository_actions_for )))
__M_writer(u'\n </table>\n')
pass
# SOURCE LINE 1216
__M_writer(u' </div>\n </div>\n')
pass
# SOURCE LINE 1219
if tool_test_results_root_folder:
# SOURCE LINE 1220
__M_writer(u' ')
__M_writer(unicode(render_table_wrap_style( "test_environment" )))
__M_writer(u'\n <p/>\n <div class="toolForm">\n <div class="toolFormTitle">Automated tool test results</div>\n <div class="toolFormBody">\n <p/>\n ')
# SOURCE LINE 1226
row_counter = RowCounter()
__M_writer(u'\n <table cellspacing="2" cellpadding="2" border="0" width="100%" class="tables container-table" id="test_environment">\n ')
# SOURCE LINE 1228
__M_writer(unicode(render_folder( tool_test_results_root_folder, 0, parent=None, row_counter=row_counter, is_root_folder=True, render_repository_actions_for=render_repository_actions_for )))
__M_writer(u'\n </table>\n </div>\n </div>\n')
pass
return ''
finally:
context.caller_stack._pop_frame()
def render_render_invalid_data_manager(context,data_manager,pad,parent,row_counter,row_is_header=False,render_repository_actions_for='tool_shed'):
context.caller_stack._push_frame()
try:
trans = context.get('trans', UNDEFINED)
__M_writer = context.writer()
# SOURCE LINE 473
__M_writer(u'\n ')
# SOURCE LINE 474
encoded_id = trans.security.encode_id( data_manager.id )
if row_is_header:
cell_type = 'th'
else:
cell_type = 'td'
# SOURCE LINE 480
__M_writer(u'\n <tr class="datasetRow"\n')
# SOURCE LINE 482
if parent is not None:
# SOURCE LINE 483
__M_writer(u' parent="')
__M_writer(unicode(parent))
__M_writer(u'"\n')
pass
# SOURCE LINE 485
__M_writer(u' id="libraryItem-ridm-')
__M_writer(unicode(encoded_id))
__M_writer(u'">\n <')
# SOURCE LINE 486
__M_writer(unicode(cell_type))
__M_writer(u' style="padding-left: ')
__M_writer(unicode(pad+20))
__M_writer(u'px;">')
__M_writer(filters.html_escape(unicode(data_manager.index )))
__M_writer(u'</')
__M_writer(unicode(cell_type))
__M_writer(u'>\n <')
# SOURCE LINE 487
__M_writer(unicode(cell_type))
__M_writer(u'>')
__M_writer(filters.html_escape(unicode(data_manager.error )))
__M_writer(u'</')
__M_writer(unicode(cell_type))
__M_writer(u'>\n </tr>\n ')
# SOURCE LINE 489
my_row = row_counter.count
row_counter.increment()
# SOURCE LINE 492
__M_writer(u'\n')
return ''
finally:
context.caller_stack._pop_frame()
def render_render_sharable_str(context,repository,changeset_revision=None):
context.caller_stack._push_frame()
try:
__M_writer = context.writer()
# SOURCE LINE 208
__M_writer(u'\n ')
# SOURCE LINE 209
from tool_shed.util.shed_util_common import generate_sharable_link_for_repository_in_tool_shed
sharable_link = generate_sharable_link_for_repository_in_tool_shed( repository, changeset_revision=changeset_revision )
# SOURCE LINE 212
__M_writer(u'\n ')
# SOURCE LINE 213
__M_writer(unicode(sharable_link))
__M_writer(u'\n')
return ''
finally:
context.caller_stack._pop_frame()
def render_render_table_wrap_style(context,table_id):
context.caller_stack._push_frame()
try:
__M_writer = context.writer()
# SOURCE LINE 683
__M_writer(u'\n <style type="text/css">\n table.')
# SOURCE LINE 685
__M_writer(unicode(table_id))
__M_writer(u'{ table-layout:fixed;\n width:100%;\n overflow-wrap:normal;\n overflow:hidden;\n border:0px; \n word-break:keep-all;\n word-wrap:break-word;\n line-break:strict; }\n ul{ list-style-type: disc;\n padding-left: 20px; }\n </style>\n')
return ''
finally:
context.caller_stack._pop_frame()
def render_render_invalid_tool_dependency(context,invalid_tool_dependency,pad,parent,row_counter,render_repository_actions_for='tool_shed'):
context.caller_stack._push_frame()
try:
trans = context.get('trans', UNDEFINED)
__M_writer = context.writer()
# SOURCE LINE 537
__M_writer(u'\n ')
# SOURCE LINE 538
encoded_id = trans.security.encode_id( invalid_tool_dependency.id )
# SOURCE LINE 540
__M_writer(u'\n <style type="text/css">\n #invalid_td_table{ table-layout:fixed;\n width:100%;\n overflow-wrap:normal;\n overflow:hidden;\n border:0px; \n word-break:keep-all;\n word-wrap:break-word;\n line-break:strict; }\n </style>\n <tr class="datasetRow"\n')
# SOURCE LINE 552
if parent is not None:
# SOURCE LINE 553
__M_writer(u' parent="')
__M_writer(unicode(parent))
__M_writer(u'"\n')
pass
# SOURCE LINE 555
__M_writer(u' id="libraryItem-ritd-')
__M_writer(unicode(encoded_id))
__M_writer(u'">\n <td style="padding-left: ')
# SOURCE LINE 556
__M_writer(unicode(pad+20))
__M_writer(u'px;">\n <table id="invalid_td_table">\n <tr><td>')
# SOURCE LINE 558
__M_writer(filters.html_escape(unicode( invalid_tool_dependency.error )))
__M_writer(u'</td></tr>\n </table>\n </td>\n </tr>\n ')
# SOURCE LINE 562
my_row = row_counter.count
row_counter.increment()
# SOURCE LINE 565
__M_writer(u'\n')
return ''
finally:
context.caller_stack._pop_frame()
| 49.330185 | 3,853 | 0.560345 | 13,024 | 114,890 | 4.542153 | 0.078394 | 0.097858 | 0.071403 | 0.041077 | 0.796322 | 0.748736 | 0.687121 | 0.623984 | 0.588891 | 0.570262 | 0 | 0.025197 | 0.339864 | 114,890 | 2,328 | 3,854 | 49.351375 | 0.754796 | 0.075812 | 0 | 0.690979 | 0 | 0.024312 | 0.253032 | 0.040667 | 0 | 0 | 0 | 0 | 0 | 1 | 0.035189 | false | 0.068458 | 0.008317 | 0.015355 | 0.078055 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 3 |
3b3c8eb9823e9c4feb6d9c975d074c5bce3e48a2 | 350 | py | Python | owasp-top10-2021-apps/a6/golden-hat/app/block.py | InesCardinot/secDevLabs | 7dfd99002c83eb0379d98b9538ef3e558dac7e82 | [
"BSD-3-Clause"
] | null | null | null | owasp-top10-2021-apps/a6/golden-hat/app/block.py | InesCardinot/secDevLabs | 7dfd99002c83eb0379d98b9538ef3e558dac7e82 | [
"BSD-3-Clause"
] | null | null | null | owasp-top10-2021-apps/a6/golden-hat/app/block.py | InesCardinot/secDevLabs | 7dfd99002c83eb0379d98b9538ef3e558dac7e82 | [
"BSD-3-Clause"
] | null | null | null | from mitmproxy import http
import re
def request(flow):
if 'golden.secret' in flow.request.url or re.match(r'^http://127.0.0.1:8000/[a-z._/]*$', flow.request.url) is None:
flow.response = http.HTTPResponse.make(401, b"Haha! Only allowed hats can see this page!")
def response(flow):
flow.response.headers["Via"] = "mitmproxy/5.3.0"
| 35 | 119 | 0.685714 | 59 | 350 | 4.050847 | 0.694915 | 0.09205 | 0.117155 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.053512 | 0.145714 | 350 | 9 | 120 | 38.888889 | 0.745819 | 0 | 0 | 0 | 0 | 0 | 0.302857 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0.285714 | false | 0 | 0.285714 | 0 | 0.571429 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 3 |
3b4b97111c5b82e67d5b9bb9a67430a7220f191e | 1,308 | py | Python | test/data/ModelInvalidLoadParams.py | dcslin/rafiki | b617ac2536ac13095c4930d6d3f1f9b3c231b5e7 | [
"Apache-2.0"
] | 35 | 2018-10-07T09:51:42.000Z | 2021-09-08T14:13:38.000Z | test/data/ModelInvalidLoadParams.py | dcslin/rafiki | b617ac2536ac13095c4930d6d3f1f9b3c231b5e7 | [
"Apache-2.0"
] | 119 | 2018-10-05T14:49:39.000Z | 2022-03-11T23:49:51.000Z | test/data/ModelInvalidLoadParams.py | dcslin/rafiki | b617ac2536ac13095c4930d6d3f1f9b3c231b5e7 | [
"Apache-2.0"
] | 32 | 2018-10-18T12:02:55.000Z | 2020-03-01T10:27:06.000Z | #
# Licensed to the Apache Software Foundation (ASF) under one
# or more contributor license agreements. See the NOTICE file
# distributed with this work for additional information
# regarding copyright ownership. The ASF licenses this file
# to you under the Apache License, Version 2.0 (the
# "License"); you may not use this file except in compliance
# with the License. You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing,
# software distributed under the License is distributed on an
# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
# KIND, either express or implied. See the License for the
# specific language governing permissions and limitations
# under the License.
#
import random
from rafiki.model import BaseModel
class Model(BaseModel):
'''
Model that errors while loading params
'''
@staticmethod
def get_knob_config():
return {}
def train(self, dataset_path, **kwargs):
pass
def evaluate(self, dataset_path):
return random.random()
def predict(self, queries):
return [1 for x in queries]
def dump_parameters(self):
return {}
def load_parameters(self, params):
raise Exception()
| 28.434783 | 62 | 0.708716 | 179 | 1,308 | 5.145251 | 0.592179 | 0.065147 | 0.02823 | 0.034745 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.004902 | 0.220183 | 1,308 | 45 | 63 | 29.066667 | 0.898039 | 0.605505 | 0 | 0.125 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0.375 | false | 0.0625 | 0.125 | 0.25 | 0.8125 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 1 | 0 | 1 | 0 | 0 | 0 | 3 |
3b52b677c8044930f2d71547e88909dc05b079b5 | 145 | py | Python | extract_results.py | goodman1204/birank | 87db456a304882ca4e4f1ac4759740989ef49af7 | [
"MIT"
] | null | null | null | extract_results.py | goodman1204/birank | 87db456a304882ca4e4f1ac4759740989ef49af7 | [
"MIT"
] | null | null | null | extract_results.py | goodman1204/birank | 87db456a304882ca4e4f1ac4759740989ef49af7 | [
"MIT"
] | null | null | null | dataset=["gossipcop_fake" "gossipcop_real" "politifact_fake" "politifact_real" "Aminer"]
methods=["proposed" "HITS" "CoHITS" "BGRM" "BiRank"]
| 24.166667 | 88 | 0.731034 | 16 | 145 | 6.375 | 0.75 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.089655 | 145 | 5 | 89 | 29 | 0.772727 | 0 | 0 | 0 | 0 | 0 | 0.647887 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | false | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 3 |
3b661588ada15f9e87f8fae2db52eecd96742998 | 143 | py | Python | backend/dryorm/routing.py | omaraboumrad/djanground | f153aabf68f8d500317d357ceaa558da61380b2a | [
"MIT"
] | 1 | 2017-11-25T20:22:14.000Z | 2017-11-25T20:22:14.000Z | backend/dryorm/routing.py | omaraboumrad/dryorm | f153aabf68f8d500317d357ceaa558da61380b2a | [
"MIT"
] | 8 | 2017-11-26T21:57:16.000Z | 2017-12-26T08:53:17.000Z | backend/dryorm/routing.py | omaraboumrad/djanground | f153aabf68f8d500317d357ceaa558da61380b2a | [
"MIT"
] | null | null | null | from channels.routing import route
from dryorm.consumers import ws_message
channel_routing = [
route('websocket.receive', ws_message),
]
| 17.875 | 43 | 0.776224 | 18 | 143 | 6 | 0.666667 | 0.166667 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.13986 | 143 | 7 | 44 | 20.428571 | 0.878049 | 0 | 0 | 0 | 0 | 0 | 0.118881 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | false | 0 | 0.4 | 0 | 0.4 | 0 | 1 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 3 |
3b9723dd4fae60561e07d5bb6e84bc296c8b4b28 | 4,812 | py | Python | euclidean/R2/cartesian.py | keystonetowersystems/euclidean | 72965b5ea1b0d70438376024d0c9a14457bdfb13 | [
"MIT"
] | 1 | 2021-05-26T19:18:38.000Z | 2021-05-26T19:18:38.000Z | euclidean/R2/cartesian.py | keystonetowersystems/euclidean | 72965b5ea1b0d70438376024d0c9a14457bdfb13 | [
"MIT"
] | 1 | 2021-06-30T14:13:13.000Z | 2021-06-30T15:34:33.000Z | euclidean/R2/cartesian.py | keystonetowersystems/euclidean | 72965b5ea1b0d70438376024d0c9a14457bdfb13 | [
"MIT"
] | null | null | null | import numbers
import math
from functools import total_ordering
from euclidean.exceptions import unexpected_type_error
def cross2(v1, v2):
return v1.x * v2.y - v1.y * v2.x
def dot2(v1, v2):
return v1.x * v2.x + v1.y * v2.y
class Cartesian2:
__slots__ = ("_coords",)
coords = property(lambda self: self._coords)
x = property(lambda self: self._coords[0])
y = property(lambda self: self._coords[1])
@classmethod
def Polar(cls, r, theta):
return cls(r * math.cos(theta), r * math.sin(theta))
def __init__(self, x, y):
self._coords = (x, y)
def __iter__(self):
return iter(self._coords)
def __eq__(self, other):
if isinstance(other, type(self)):
return self._coords == other._coords
return NotImplemented
def __hash__(self):
return hash((self.__class__.__name__, self._coords))
def __repr__(self):
return "%s(%r, %r)" % (self.__class__.__name__, self.x, self.y)
class V2(Cartesian2):
__slots__ = ()
def unit(self):
return self / self.magnitude()
def dot(self, other):
if not isinstance(other, V2):
raise unexpected_type_error("other", V2, other)
return dot2(self, other)
def cross(self, other):
if not isinstance(other, V2):
raise unexpected_type_error("other", V2, other)
return cross2(self, other)
def is_parallel(self, other, atol=1e-6):
return abs(self.cross(other)) <= atol
def is_orthogonal(self, other, atol=1e-6):
return abs(self.dot(other)) <= atol
def magnitude(self):
return self.dot(self) ** 0.5
def manhattan_distance(self):
return self.x + self.y
__abs__ = magnitude
def angle(self, other):
return math.acos(self.dot(other) / self.magnitude() / other.magnitude())
def rotate(self, radians):
cos = math.cos(radians)
sin = math.sin(radians)
return V2(self.x * cos - self.y * sin, self.x * sin + self.y * cos)
def approx(self, other, atol=1e-6):
if not isinstance(other, V2):
raise unexpected_type_error("other", V2, other)
return abs(self - other) < atol
def __add__(self, other):
if isinstance(other, V2):
return V2(self.x + other.x, self.y + other.y)
return NotImplemented
__iadd__ = __add__
def __sub__(self, other):
if isinstance(other, V2):
return V2(self.x - other.x, self.y - other.y)
return NotImplemented
__isub__ = __sub__
def __mul__(self, other):
if not isinstance(other, numbers.Real):
return NotImplemented
return V2(self.x * other, self.y * other)
__imul__ = __rmul__ = __mul__
def __truediv__(self, other):
if not isinstance(other, numbers.Real):
return NotImplemented
return V2(self.x / other, self.y / other)
__itruediv__ = __truediv__
def __floordiv__(self, other):
if not isinstance(other, numbers.Real):
return NotImplemented
return V2(self.x // other, self.y // other)
__ifloordiv__ = __floordiv__
def __neg__(self):
return V2(-self.x, -self.y)
@total_ordering
class P2(Cartesian2):
__slots__ = ()
@staticmethod
def CCW(p1, p2, p3):
return (p2.x - p1.x) * (p3.y - p1.y) - (p3.x - p1.x) * (p2.y - p1.y)
@staticmethod
def AcuteAngle(p1, p2, p3):
v1 = p1 - p2
v2 = p3 - p2
return v1.angle(v2)
def vector(self):
return V2(self.x, self.y)
def rotate(self, radians, center_point=None):
center_point = center_point if center_point else P2(0, 0)
vector = self - center_point
return center_point + vector.rotate(radians)
def quadrant(self):
if self.x >= 0 and self.y >= 0:
return 1
if self.x <= 0 and self.y >= 0:
return 2
if self.x <= 0 and self.y <= 0:
return 3
return 4
def approx(self, other, atol=1e-6):
if not isinstance(other, P2):
raise unexpected_type_error("other", P2, other)
return (self - other).magnitude() < atol
def __lt__(self, other):
if not isinstance(other, P2):
return NotImplemented
return self._coords < other._coords
def __add__(self, other):
if isinstance(other, V2):
return P2(self.x + other.x, self.y + other.y)
return NotImplemented
__radd__ = __iadd__ = __add__
def __sub__(self, other):
if isinstance(other, V2):
return P2(self.x - other.x, self.y - other.y)
if isinstance(other, P2):
return V2(self.x - other.x, self.y - other.y)
return NotImplemented
__isub__ = __sub__
| 26.010811 | 80 | 0.592477 | 637 | 4,812 | 4.186813 | 0.155416 | 0.067492 | 0.045369 | 0.04387 | 0.511811 | 0.437945 | 0.415823 | 0.399325 | 0.377578 | 0.347207 | 0 | 0.027233 | 0.290316 | 4,812 | 184 | 81 | 26.152174 | 0.753734 | 0 | 0 | 0.290076 | 0 | 0 | 0.007689 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0.251908 | false | 0 | 0.030534 | 0.114504 | 0.770992 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 1 | 1 | 0 | 0 | 3 |
3b98ccc424aa40dd95c4b29f678da5f3c7cc5c6b | 195 | py | Python | sopel.py | Gizmokid2005/sopel | 249a05ab7c6ccb3fb0388e3194514b19897e6990 | [
"EFL-2.0"
] | 555 | 2015-07-25T21:21:43.000Z | 2022-03-28T02:22:38.000Z | sopel.py | Gizmokid2005/sopel | 249a05ab7c6ccb3fb0388e3194514b19897e6990 | [
"EFL-2.0"
] | 1,177 | 2015-07-31T09:52:31.000Z | 2022-03-26T05:10:34.000Z | sopel.py | MirahezeBots/sopel | 72aa4fa5bc0bda3cd309ae9c15e86088b29de903 | [
"EFL-2.0"
] | 406 | 2015-07-28T20:34:02.000Z | 2022-03-18T00:37:01.000Z | #!/usr/bin/env python3
from __future__ import generator_stop
import sys
# Different from setuptools script, because we want the one in this dir.
from sopel.cli import run
sys.exit(run.main())
| 19.5 | 72 | 0.774359 | 32 | 195 | 4.5625 | 0.8125 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.006024 | 0.148718 | 195 | 9 | 73 | 21.666667 | 0.873494 | 0.471795 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | true | 0 | 0.75 | 0 | 0.75 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 1 | 0 | 0 | 0 | 0 | 3 |
3b9ae09e8015dea9712d5899f405b03577b11b04 | 252 | py | Python | src/utils/database.py | peterHoburg/fastapi_example | 09353b2a1a2a9d80f8d7d197cfa21736de53a293 | [
"MIT"
] | null | null | null | src/utils/database.py | peterHoburg/fastapi_example | 09353b2a1a2a9d80f8d7d197cfa21736de53a293 | [
"MIT"
] | null | null | null | src/utils/database.py | peterHoburg/fastapi_example | 09353b2a1a2a9d80f8d7d197cfa21736de53a293 | [
"MIT"
] | null | null | null | from sqlalchemy.orm import Session
from src.models import sql
from src.models.api import UserInDB
def get_user(db: Session, username: str) -> UserInDB:
return UserInDB.from_orm(db.query(sql.User).filter(sql.User.username == username).first())
| 22.909091 | 94 | 0.757937 | 38 | 252 | 4.973684 | 0.526316 | 0.074074 | 0.137566 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.126984 | 252 | 10 | 95 | 25.2 | 0.859091 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0.2 | false | 0 | 0.6 | 0.2 | 1 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 1 | 1 | 0 | 0 | 3 |
3ba175ae7b8ec33da35a90246b2f03264b1495f9 | 110 | py | Python | pacote-download/Python3CursoEmVideo/utilidadesCeV/aula22.py | JoaoP-Rodrigues/CursoPython3-Aulas | 24d884eaa67485a12c8c3629c7f0fa5b8606a798 | [
"MIT"
] | null | null | null | pacote-download/Python3CursoEmVideo/utilidadesCeV/aula22.py | JoaoP-Rodrigues/CursoPython3-Aulas | 24d884eaa67485a12c8c3629c7f0fa5b8606a798 | [
"MIT"
] | null | null | null | pacote-download/Python3CursoEmVideo/utilidadesCeV/aula22.py | JoaoP-Rodrigues/CursoPython3-Aulas | 24d884eaa67485a12c8c3629c7f0fa5b8606a798 | [
"MIT"
] | null | null | null | from utilidadesCeV import moeda, dado
num = dado.validacao('Digite o preço: R$ ')
moeda.resumo(num, 10, 15)
| 18.333333 | 43 | 0.718182 | 17 | 110 | 4.647059 | 0.823529 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.043011 | 0.154545 | 110 | 5 | 44 | 22 | 0.806452 | 0 | 0 | 0 | 0 | 0 | 0.172727 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | false | 0 | 0.333333 | 0 | 0.333333 | 0 | 1 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 3 |
8e6974098c65f1327be2474290b5d1c531518ad5 | 590 | py | Python | challenges/insertion-sort/tests/test_insertion_sort.py | ebrahimayyad11/data-structures-and-algorithms | c85b0de90f887478456faf1fafae78bd80fbfd2e | [
"MIT"
] | null | null | null | challenges/insertion-sort/tests/test_insertion_sort.py | ebrahimayyad11/data-structures-and-algorithms | c85b0de90f887478456faf1fafae78bd80fbfd2e | [
"MIT"
] | 5 | 2021-06-13T19:42:42.000Z | 2021-07-12T18:00:54.000Z | challenges/insertion-sort/tests/test_insertion_sort.py | ebrahimayyad11/data-structures-and-algorithms | c85b0de90f887478456faf1fafae78bd80fbfd2e | [
"MIT"
] | null | null | null | from insertion_sort import __version__
from insertion_sort.insertion_sort import InsertionSort
def test_version():
assert __version__ == '0.1.0'
def test_1():
arr = [9,8,5,2,20,18,16]
actual = InsertionSort(arr)
excepted = [2,5,8,9,16,18,20]
assert actual == excepted
def test_2():
arr = [9,8,5,2,20,18,16,35,80,1,3]
actual = InsertionSort(arr)
excepted = [1,2,3,5,8,9,16,18,20,35,80]
assert actual == excepted
def test_3():
arr = [5,1,3,20,78,50]
actual = InsertionSort(arr)
excepted = [1,3,5,20,50,78]
assert actual == excepted | 21.071429 | 55 | 0.638983 | 101 | 590 | 3.584158 | 0.257426 | 0.077348 | 0.18232 | 0.248619 | 0.441989 | 0.121547 | 0.071823 | 0.071823 | 0 | 0 | 0 | 0.161359 | 0.201695 | 590 | 28 | 56 | 21.071429 | 0.607219 | 0 | 0 | 0.315789 | 0 | 0 | 0.00846 | 0 | 0 | 0 | 0 | 0 | 0.210526 | 1 | 0.210526 | false | 0 | 0.105263 | 0 | 0.315789 | 0 | 0 | 0 | 0 | null | 0 | 1 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 3 |
8e6a4a3465983c74e3e8520e2d9e6fac4376e886 | 516 | py | Python | Ex74.py | ErickTeixeira777/Python-3 | 5bd886d13e8118bba556d499ecd6841e9cdb5e9f | [
"MIT"
] | null | null | null | Ex74.py | ErickTeixeira777/Python-3 | 5bd886d13e8118bba556d499ecd6841e9cdb5e9f | [
"MIT"
] | null | null | null | Ex74.py | ErickTeixeira777/Python-3 | 5bd886d13e8118bba556d499ecd6841e9cdb5e9f | [
"MIT"
] | null | null | null | ''' Crie um programa que vai gerar 5 números aleatórios e colocar em um tupla, depois disso mostre a listagem de números gerados e também indique o menor e o maior valor que estão na tupla. '''
from random import randint
numeros = (randint (1,10), randint (1,10), randint (1,10), randint (1,10), randint (1,10))
print('Os números sorteados foram: ')
for n in numeros:
print(f'{n} ', end='')
print(f'\nO maior número sorteado foi o: {max(numeros)}! ')
print(f'O Menor número sorteado foi o: {min(numeros)}! ') | 64.5 | 193 | 0.699612 | 88 | 516 | 4.102273 | 0.568182 | 0.110803 | 0.138504 | 0.188366 | 0.138504 | 0.138504 | 0.138504 | 0.138504 | 0.138504 | 0.138504 | 0 | 0.037383 | 0.170543 | 516 | 8 | 194 | 64.5 | 0.806075 | 0.358527 | 0 | 0 | 0 | 0 | 0.395062 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | false | 0 | 0.142857 | 0 | 0.142857 | 0.571429 | 0 | 0 | 0 | null | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 3 |
8e87b57c7bf1f26a6201309754b266aa49df077c | 331 | py | Python | tests/sentry/nodestore/test_base.py | AlexWayfer/sentry | ef935cda2b2e960bd602fda590540882d1b0712d | [
"BSD-3-Clause"
] | 20 | 2016-10-01T04:29:24.000Z | 2020-10-09T07:23:34.000Z | tests/sentry/nodestore/test_base.py | AlexWayfer/sentry | ef935cda2b2e960bd602fda590540882d1b0712d | [
"BSD-3-Clause"
] | 196 | 2019-06-10T08:34:10.000Z | 2022-02-22T01:26:13.000Z | tests/sentry/nodestore/test_base.py | AlexWayfer/sentry | ef935cda2b2e960bd602fda590540882d1b0712d | [
"BSD-3-Clause"
] | 7 | 2016-10-27T05:12:45.000Z | 2021-05-01T14:29:53.000Z | # -*- coding: utf-8 -*-
from __future__ import absolute_import
from sentry.nodestore.base import NodeStorage
from sentry.testutils import TestCase
class NodeStorageTest(TestCase):
def setUp(self):
self.ns = NodeStorage()
def test_generate_id(self):
result = self.ns.generate_id()
assert result
| 20.6875 | 45 | 0.703927 | 40 | 331 | 5.625 | 0.6 | 0.088889 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.003802 | 0.205438 | 331 | 15 | 46 | 22.066667 | 0.851711 | 0.063444 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.111111 | 1 | 0.222222 | false | 0 | 0.333333 | 0 | 0.666667 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 1 | 0 | 1 | 0 | 0 | 3 |
8eafaf36df94ea9f22be67a0614097dec7336d2e | 575 | py | Python | plusseg/modeling/postprocessor/postprocessor.py | tonysy/SegmentationToolbox.PyTorch | 4d487dd81d0101bc5cdb7b2337776fdf1b5546ff | [
"MIT"
] | 13 | 2019-07-26T11:33:15.000Z | 2021-09-22T06:48:52.000Z | plusseg/modeling/postprocessor/postprocessor.py | tonysy/SegmentationToolbox.PyTorch | 4d487dd81d0101bc5cdb7b2337776fdf1b5546ff | [
"MIT"
] | 1 | 2018-11-05T14:07:07.000Z | 2018-11-05T14:07:07.000Z | plusseg/modeling/postprocessor/postprocessor.py | tonysy/SegmentationToolbox.PyTorch | 4d487dd81d0101bc5cdb7b2337776fdf1b5546ff | [
"MIT"
] | 2 | 2019-07-26T11:33:32.000Z | 2020-03-04T13:47:50.000Z | from collections import OrderedDict
from torch import nn
from plusseg.modeling import registry
from plusseg.modeling.make_layers import conv_with_kaiming_uniform
def build_post_processor(cfg):
if cfg.MODEL.POSTPROCESSOR.NAME is '':
return None
assert cfg.MODEL.POSTPROCESSOR.NAME in registry.POSTPROCESSORS, \
"cfg.MODEL.POSTPROCESSOR.NAME: {} are not registered in registry".format(
cfg.MODEL.POSTPROCESSOR.NAME
)
# import pdb; pdb.set_trace()
return registry.POSTPROCESSORS[cfg.MODEL.POSTPROCESSOR.NAME](cfg) | 31.944444 | 81 | 0.733913 | 71 | 575 | 5.84507 | 0.521127 | 0.096386 | 0.253012 | 0.301205 | 0.226506 | 0.226506 | 0 | 0 | 0 | 0 | 0 | 0 | 0.187826 | 575 | 18 | 82 | 31.944444 | 0.888651 | 0.046957 | 0 | 0 | 0 | 0 | 0.115174 | 0.053016 | 0 | 0 | 0 | 0 | 0.083333 | 1 | 0.083333 | false | 0 | 0.333333 | 0 | 0.583333 | 0 | 0 | 0 | 0 | null | 0 | 1 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 3 |
8edade303953057a47476a91a34e104019eb0a08 | 6,288 | py | Python | ovs/extensions/hypervisor/hypervisors/kvm.py | mflu/openvstorage_centos | 280a98d3e5d212d58297e0ffcecd325dfecef0f8 | [
"Apache-2.0"
] | 1 | 2015-08-29T16:36:40.000Z | 2015-08-29T16:36:40.000Z | ovs/extensions/hypervisor/hypervisors/kvm.py | rootfs-analytics/openvstorage | 6184822340faea1d2927643330a7aaa781d92d36 | [
"Apache-2.0"
] | null | null | null | ovs/extensions/hypervisor/hypervisors/kvm.py | rootfs-analytics/openvstorage | 6184822340faea1d2927643330a7aaa781d92d36 | [
"Apache-2.0"
] | null | null | null | # Copyright 2014 CloudFounders NV
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
"""
Module for the KVM hypervisor client
"""
from ovs.extensions.hypervisor.apis.kvm.sdk import Sdk
class KVM(object):
"""
Represents the hypervisor client for KVM
"""
def __init__(self, ip, username, password):
"""
Initializes the object with credentials and connection information
"""
_ = password
self.sdk = Sdk(ip, username)
def get_state(self, vmid):
"""
Dummy method
"""
return self.sdk.get_power_state(vmid)
def create_vm_from_template(self, name, source_vm, disks, storage_ip, mountpoint, wait=True):
"""
create vm from template
TODO:
storage_ip and mountpoint refer to target Storage Driver
but on kvm storagedriver.storage_ip is 127.0.0.1
"""
_ = storage_ip, wait # For compatibility purposes only
return self.sdk.create_vm_from_template(name, source_vm, disks, mountpoint)
def delete_vm(self, vmid, storagedriver_mountpoint=None, storagedriver_storage_ip=None, devicename=None, disks_info=None, wait=True):
"""
Deletes a given VM and its disks
"""
_ = wait # For compatibility purposes only
_ = storagedriver_mountpoint # No vpool mountpoint on kvm, use different logic
_ = storagedriver_storage_ip # 127.0.0.1 always
if disks_info is None:
disks_info = []
return self.sdk.delete_vm(vmid, devicename, disks_info)
def get_vm_agnostic_object(self, vmid):
"""
Loads a VM and returns a hypervisor agnostic representation
"""
return self.sdk.make_agnostic_config(self.sdk.get_vm_object(vmid))
def get_vms_by_nfs_mountinfo(self, ip, mountpoint):
"""
Gets a list of agnostic vm objects for a given ip and mountpoint
"""
_ = ip
vms = []
for vm in self.sdk.get_vms():
config = self.sdk.make_agnostic_config(vm)
if mountpoint in config['datastores']:
vms.append(config)
return vms
def test_connection(self):
"""
Tests the connection
"""
return self.sdk.test_connection()
def is_datastore_available(self, ip, mountpoint):
"""
Check whether a given datastore is in use on the hypervisor
"""
_ = ip
return self.sdk.ssh_run("[ -d {0} ] && echo 'yes' || echo 'no'".format(mountpoint)) == 'yes'
def clone_vm(self, vmid, name, disks, wait=False):
"""
create a clone at vmachine level
#disks are cloned by VDiskController
"""
_ = wait # For compatibility purposes only
return self.sdk.clone_vm(vmid, name, disks)
def set_as_template(self, vmid, disks, wait=False):
"""
Dummy method
TODO: Not yet implemented, setting an existing kvm guest as template
"""
_ = vmid, disks, wait # For compatibility purposes only
raise NotImplementedError()
def get_vm_object(self, vmid):
"""
Dummy method
"""
return self.sdk.get_vm_object(vmid)
def get_vm_object_by_devicename(self, devicename, ip, mountpoint):
"""
devicename = vmachines/template/template.xml # relative to mountpoint
"""
_ = ip, mountpoint
return self.sdk.make_agnostic_config(self.sdk.get_vm_object_by_filename(devicename))
def mount_nfs_datastore(self, name, remote_host, remote_path):
"""
Dummy method
"""
raise NotImplementedError()
def clean_backing_disk_filename(self, path):
"""
Cleans a backing disk filename to the corresponding disk filename
"""
_ = self
return path.strip('/')
def get_backing_disk_path(self, machinename, devicename):
"""
Builds the path for the file backing a given device/disk
"""
return self.get_disk_path(machinename.replace(' ', '_'), devicename)
def get_disk_path(self, machinename, devicename):
"""
Builds the path for the file backing a given device/disk
"""
_ = self
if machinename:
return '/{}_{}.raw'.format(machinename.replace(' ', '_'), devicename)
return '/{}.raw'.format(devicename)
def clean_vmachine_filename(self, path):
"""
Cleans a VM filename
"""
_ = self
return path.strip('/')
def get_vmachine_path(self, machinename, storagerouter_machineid):
"""
Builds the path for the file representing a given vmachine
"""
_ = self
machinename = machinename.replace(' ', '_')
return '/{}/{}.xml'.format(storagerouter_machineid, machinename)
def get_rename_scenario(self, old_name, new_name):
"""
Gets the rename scenario based on the old and new name
"""
_ = self
if old_name.endswith('.xml') and new_name.endswith('.xml'):
return 'RENAME'
return 'UNSUPPORTED'
def should_process(self, devicename, machine_ids=None):
"""
Checks whether a given device should be processed
"""
_ = self
valid = devicename.strip('/') not in ['vmcasts/rss.xml']
if not valid:
return False
if machine_ids is not None:
return any(machine_id for machine_id in machine_ids if devicename.strip('/').startswith(machine_id))
return True
def file_exists(self, vpool, devicename):
"""
Check if devicename exists
"""
_ = vpool
matches = self.sdk.find_devicename(devicename)
return matches is not None
| 32.75 | 137 | 0.620388 | 752 | 6,288 | 5.022606 | 0.281915 | 0.0278 | 0.030977 | 0.029653 | 0.179508 | 0.16071 | 0.135028 | 0.117554 | 0.067779 | 0.067779 | 0 | 0.004685 | 0.287214 | 6,288 | 191 | 138 | 32.921466 | 0.838019 | 0.305344 | 0 | 0.177215 | 0 | 0 | 0.033386 | 0 | 0 | 0 | 0 | 0.010471 | 0 | 1 | 0.265823 | false | 0.025316 | 0.012658 | 0 | 0.56962 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 1 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 3 |
8edd5f54df2b01fc48c1595758a6c7502d2f5a8c | 100 | py | Python | Codewars/8kyu/duck-duck-goose/Python/solution1.py | RevansChen/online-judge | ad1b07fee7bd3c49418becccda904e17505f3018 | [
"MIT"
] | 7 | 2017-09-20T16:40:39.000Z | 2021-08-31T18:15:08.000Z | Codewars/8kyu/duck-duck-goose/Python/solution1.py | RevansChen/online-judge | ad1b07fee7bd3c49418becccda904e17505f3018 | [
"MIT"
] | null | null | null | Codewars/8kyu/duck-duck-goose/Python/solution1.py | RevansChen/online-judge | ad1b07fee7bd3c49418becccda904e17505f3018 | [
"MIT"
] | null | null | null | # Python - 3.6.0
duck_duck_goose = lambda players, goose: players[(goose - 1) % len(players)].name
| 25 | 81 | 0.69 | 16 | 100 | 4.1875 | 0.6875 | 0.358209 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.047059 | 0.15 | 100 | 3 | 82 | 33.333333 | 0.741176 | 0.14 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | false | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | null | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 3 |
8edf817a12d76ceddc038d0600f08927cd1701fd | 307 | py | Python | .config/xmobar/getdate_fr.py | mdupuis13/dotfilez-dasboss-pc | 30e4a53aa274f0fe85a64d1507ac572b3669a462 | [
"MIT"
] | null | null | null | .config/xmobar/getdate_fr.py | mdupuis13/dotfilez-dasboss-pc | 30e4a53aa274f0fe85a64d1507ac572b3669a462 | [
"MIT"
] | null | null | null | .config/xmobar/getdate_fr.py | mdupuis13/dotfilez-dasboss-pc | 30e4a53aa274f0fe85a64d1507ac572b3669a462 | [
"MIT"
] | null | null | null | #! /usr/bin/python3
import locale
from datetime import datetime
import sys
import getopt
import string
locale.setlocale(locale.LC_ALL, '')
loc = locale.getlocale()
locale.setlocale(locale.LC_ALL, 'fr_CA.UTF-8')
print('%s' % (string.capwords(datetime.now().strftime('%A, %d %B - %k:%M:%S'))))
sys.exit(0)
| 20.466667 | 80 | 0.710098 | 48 | 307 | 4.479167 | 0.645833 | 0.130233 | 0.195349 | 0.213953 | 0.24186 | 0 | 0 | 0 | 0 | 0 | 0 | 0.010909 | 0.104235 | 307 | 14 | 81 | 21.928571 | 0.770909 | 0.058632 | 0 | 0 | 0 | 0 | 0.114583 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | false | 0 | 0.5 | 0 | 0.5 | 0.1 | 0 | 0 | 0 | null | 0 | 1 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 3 |
8ee347722b7d61cf38bad3f5e4a02ee176741166 | 5,505 | py | Python | obp/ope/__init__.py | Tanvikapoor14/zr-obp | 51eba00f0dda5c26c1fa6826f544c60de485da52 | [
"Apache-2.0"
] | null | null | null | obp/ope/__init__.py | Tanvikapoor14/zr-obp | 51eba00f0dda5c26c1fa6826f544c60de485da52 | [
"Apache-2.0"
] | null | null | null | obp/ope/__init__.py | Tanvikapoor14/zr-obp | 51eba00f0dda5c26c1fa6826f544c60de485da52 | [
"Apache-2.0"
] | null | null | null | from obp.ope.classification_model import ImportanceWeightEstimator
from obp.ope.classification_model import PropensityScoreEstimator
from obp.ope.estimators import BalancedInverseProbabilityWeighting
from obp.ope.estimators import BaseOffPolicyEstimator
from obp.ope.estimators import DirectMethod
from obp.ope.estimators import DoublyRobust
from obp.ope.estimators import DoublyRobustWithShrinkage
from obp.ope.estimators import InverseProbabilityWeighting
from obp.ope.estimators import ReplayMethod
from obp.ope.estimators import SelfNormalizedDoublyRobust
from obp.ope.estimators import SelfNormalizedInverseProbabilityWeighting
from obp.ope.estimators import SubGaussianDoublyRobust
from obp.ope.estimators import SubGaussianInverseProbabilityWeighting
from obp.ope.estimators import SwitchDoublyRobust
from obp.ope.estimators_continuous import (
KernelizedSelfNormalizedInverseProbabilityWeighting,
)
from obp.ope.estimators_continuous import BaseContinuousOffPolicyEstimator
from obp.ope.estimators_continuous import cosine_kernel
from obp.ope.estimators_continuous import epanechnikov_kernel
from obp.ope.estimators_continuous import gaussian_kernel
from obp.ope.estimators_continuous import KernelizedDoublyRobust
from obp.ope.estimators_continuous import KernelizedInverseProbabilityWeighting
from obp.ope.estimators_continuous import triangular_kernel
from obp.ope.estimators_multi import BaseMultiLoggersOffPolicyEstimator
from obp.ope.estimators_multi import MultiLoggersBalancedDoublyRobust
from obp.ope.estimators_multi import MultiLoggersBalancedInverseProbabilityWeighting
from obp.ope.estimators_multi import MultiLoggersNaiveDoublyRobust
from obp.ope.estimators_multi import MultiLoggersNaiveInverseProbabilityWeighting
from obp.ope.estimators_multi import MultiLoggersWeightedDoublyRobust
from obp.ope.estimators_multi import MultiLoggersWeightedInverseProbabilityWeighting
from obp.ope.estimators_slate import SelfNormalizedSlateIndependentIPS
from obp.ope.estimators_slate import SelfNormalizedSlateRewardInteractionIPS
from obp.ope.estimators_slate import SelfNormalizedSlateStandardIPS
from obp.ope.estimators_slate import SlateCascadeDoublyRobust
from obp.ope.estimators_slate import SlateIndependentIPS
from obp.ope.estimators_slate import SlateRewardInteractionIPS
from obp.ope.estimators_slate import SlateStandardIPS
from obp.ope.estimators_tuning import DoublyRobustTuning
from obp.ope.estimators_tuning import DoublyRobustWithShrinkageTuning
from obp.ope.estimators_tuning import InverseProbabilityWeightingTuning
from obp.ope.estimators_tuning import SubGaussianDoublyRobustTuning
from obp.ope.estimators_tuning import SubGaussianInverseProbabilityWeightingTuning
from obp.ope.estimators_tuning import SwitchDoublyRobustTuning
from obp.ope.meta import OffPolicyEvaluation
from obp.ope.meta_continuous import ContinuousOffPolicyEvaluation
from obp.ope.meta_multi import MultiLoggersOffPolicyEvaluation
from obp.ope.meta_slate import SlateOffPolicyEvaluation
from obp.ope.regression_model import RegressionModel
from obp.ope.regression_model_slate import SlateRegressionModel
__all__ = [
"BaseOffPolicyEstimator",
"ReplayMethod",
"InverseProbabilityWeighting",
"SelfNormalizedInverseProbabilityWeighting",
"DirectMethod",
"DoublyRobust",
"SelfNormalizedDoublyRobust",
"SwitchDoublyRobust",
"DoublyRobustWithShrinkage",
"SubGaussianInverseProbabilityWeighting",
"SubGaussianDoublyRobust",
"InverseProbabilityWeightingTuning",
"DoublyRobustTuning",
"SwitchDoublyRobustTuning",
"DoublyRobustWithShrinkageTuning",
"SubGaussianInverseProbabilityWeightingTuning",
"SubGaussianDoublyRobustTuning",
"BaseMultiLoggersOffPolicyEstimator",
"MultiLoggersNaiveInverseProbabilityWeighting",
"MultiLoggersWeightedInverseProbabilityWeighting",
"MultiLoggersBalancedInverseProbabilityWeighting",
"MultiLoggersNaiveDoublyRobust",
"MultiLoggersBalancedDoublyRobust",
"MultiLoggersWeightedDoublyRobust",
"OffPolicyEvaluation",
"SlateOffPolicyEvaluation",
"ContinuousOffPolicyEvaluation",
"MultiLoggersOffPolicyEvaluation",
"RegressionModel",
"SlateRegressionModel",
"SlateStandardIPS",
"SlateIndependentIPS",
"SlateRewardInteractionIPS",
"SlateCascadeDoublyRobust",
"SelfNormalizedSlateRewardInteractionIPS",
"SelfNormalizedSlateIndependentIPS",
"SelfNormalizedSlateStandardIPS",
"BalancedInverseProbabilityWeighting",
"ImportanceWeightEstimator",
"PropensityScoreEstimator",
"BaseContinuousOffPolicyEstimator",
"KernelizedInverseProbabilityWeighting",
"KernelizedSelfNormalizedInverseProbabilityWeighting",
"KernelizedDoublyRobust",
"triangular_kernel",
"gaussian_kernel",
"epanechnikov_kernel",
"cosine_kernel",
]
__all_estimators__ = [
"ReplayMethod",
"InverseProbabilityWeighting",
"SelfNormalizedInverseProbabilityWeighting",
"DirectMethod",
"DoublyRobust",
"DoublyRobustWithShrinkage",
"SwitchDoublyRobust",
"SelfNormalizedDoublyRobust",
"SubGaussianInverseProbabilityWeighting",
"SubGaussianDoublyRobust",
"BalancedInverseProbabilityWeighting",
]
__all_estimators_tuning__ = [
"InverseProbabilityWeightingTuning",
"DoublyRobustTuning",
"SwitchDoublyRobustTuning",
"DoublyRobustWithShrinkageTuning",
]
__all_estimators_tuning_sg__ = [
"SubGaussianInverseProbabilityWeightingTuning",
"SubGaussianDoublyRobustTuning",
]
| 42.022901 | 84 | 0.845232 | 407 | 5,505 | 11.27027 | 0.157248 | 0.07325 | 0.104644 | 0.174406 | 0.344016 | 0.218443 | 0.027469 | 0 | 0 | 0 | 0 | 0 | 0.099183 | 5,505 | 130 | 85 | 42.346154 | 0.924985 | 0 | 0 | 0.276423 | 0 | 0 | 0.320073 | 0.266122 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | false | 0 | 0.398374 | 0 | 0.398374 | 0 | 0 | 0 | 1 | null | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 3 |
8ee56c1a5aecdd051c832b4e464da4fe1611fd41 | 132 | py | Python | driverlib/a.py | vinodstanur/stellaris-launchpad | b77778ccb9e6d56b81b92eca3acafb8bfe357097 | [
"BSD-3-Clause"
] | 3 | 2015-07-21T10:10:14.000Z | 2020-08-01T00:03:04.000Z | driverlib/a.py | vinodstanur/stellaris-launchpad | b77778ccb9e6d56b81b92eca3acafb8bfe357097 | [
"BSD-3-Clause"
] | null | null | null | driverlib/a.py | vinodstanur/stellaris-launchpad | b77778ccb9e6d56b81b92eca3acafb8bfe357097 | [
"BSD-3-Clause"
] | 6 | 2015-07-21T10:10:22.000Z | 2021-03-06T16:13:39.000Z | import sys,re,os
d = os.listdir('.')
for i in d:
f=open(i)
a=f.read()
if("SysCtlDelay" in a):
print i
f.close()
del a
| 13.2 | 25 | 0.560606 | 27 | 132 | 2.740741 | 0.666667 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.25 | 132 | 9 | 26 | 14.666667 | 0.747475 | 0 | 0 | 0 | 0 | 0 | 0.090909 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | null | 0 | 0.111111 | null | null | 0.111111 | 1 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 3 |
d907fbd0650025501415d4d4e91deb6b11e5dc7d | 872 | py | Python | androidlib/errors.py | aerogear/androidctl | f057117a893b2e24f47218b98ebf2e4552502eae | [
"Apache-2.0"
] | null | null | null | androidlib/errors.py | aerogear/androidctl | f057117a893b2e24f47218b98ebf2e4552502eae | [
"Apache-2.0"
] | 3 | 2017-08-11T08:27:34.000Z | 2021-06-01T22:46:14.000Z | androidlib/errors.py | aerogear/androidctl | f057117a893b2e24f47218b98ebf2e4552502eae | [
"Apache-2.0"
] | 1 | 2017-08-10T13:42:05.000Z | 2017-08-10T13:42:05.000Z | import errno
import os
import sys
import json
def errmsg(code):
return os.strerror(code)
class BaseError(Exception):
def __init__(self, message=None):
self.code = errno.EPERM
self.message = message
def __repr__(self):
return '%s(%s)' % (self.__class__, self.__dict__)
def __str__(self):
return '[%s] %s' % (self.code, self.message)
def as_dict(self):
return {'code': self.code, 'message': self.message}
def as_json(self):
return json.dumps(self.as_dict())
class RuntimeError(BaseError):
def __init__(self, code, message):
super(RuntimeError, self).__init__(self)
self.code = code
self.message = message
class ConnectionError(BaseError):
def __init__(self, message):
super(ConnectionError, self).__init__(self)
self.code = errno.ECONNREFUSED
self.message = '%s: %s' % (errmsg(self.code), message)
| 21.268293 | 58 | 0.683486 | 114 | 872 | 4.885965 | 0.245614 | 0.138241 | 0.059246 | 0.064632 | 0.129264 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.178899 | 872 | 40 | 59 | 21.8 | 0.777933 | 0 | 0 | 0.071429 | 0 | 0 | 0.034404 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0.285714 | false | 0 | 0.142857 | 0.178571 | 0.714286 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 1 | 1 | 0 | 0 | 3 |
d93747105cd667ff05debd28de951bad776a930c | 515 | py | Python | PythonDerivate/mapper.py | Smurf-maker/WordShop | ac0095ee28207f23744337d4cb35c5ca764d7e26 | [
"MIT"
] | null | null | null | PythonDerivate/mapper.py | Smurf-maker/WordShop | ac0095ee28207f23744337d4cb35c5ca764d7e26 | [
"MIT"
] | null | null | null | PythonDerivate/mapper.py | Smurf-maker/WordShop | ac0095ee28207f23744337d4cb35c5ca764d7e26 | [
"MIT"
] | null | null | null | class Mapper:
"""This module takes a user-input string and chunks it into formatted tuples which
contains relevant data for all essential pieces of string."""
def maptolist(self, arg, langbound):
"""Returns formatted-tuple containing relevant processing data for each token.""" #update
return self._internalmap(arg, langbound)
def _internalmap(self, arg, langbound):
# Internally seperates the string into relevant tokens. # update
return langbound.split(arg) | 46.818182 | 98 | 0.708738 | 63 | 515 | 5.761905 | 0.68254 | 0.099174 | 0.088154 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.217476 | 515 | 11 | 99 | 46.818182 | 0.900744 | 0.549515 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0.4 | false | 0 | 0 | 0.2 | 1 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 1 | 1 | 0 | 0 | 3 |
d93a19b4db8df1d69fdb72025fa09c74f86a0c71 | 100 | py | Python | configs/benchmarks/classification/imagenet/imagenet_10percent/resnet50_head1_4xb64-steplr1e-2-20e_in1k-10pct.py | mitming/mmselfsup | 5b5cb474776291cfcb9a1140afd11b696e11fcab | [
"Apache-2.0"
] | 355 | 2021-12-16T04:32:49.000Z | 2022-03-31T22:15:23.000Z | configs/benchmarks/classification/imagenet/imagenet_10percent/resnet50_head1_4xb64-steplr1e-2-20e_in1k-10pct.py | mitming/mmselfsup | 5b5cb474776291cfcb9a1140afd11b696e11fcab | [
"Apache-2.0"
] | 89 | 2021-12-16T05:15:42.000Z | 2022-03-31T10:57:39.000Z | configs/benchmarks/classification/imagenet/imagenet_10percent/resnet50_head1_4xb64-steplr1e-2-20e_in1k-10pct.py | mitming/mmselfsup | 5b5cb474776291cfcb9a1140afd11b696e11fcab | [
"Apache-2.0"
] | 74 | 2021-12-16T04:40:02.000Z | 2022-03-31T08:40:32.000Z | _base_ = 'resnet50_head1_4xb64-steplr1e-1-20e_in1k-10pct.py'
# optimizer
optimizer = dict(lr=0.01)
| 20 | 60 | 0.77 | 16 | 100 | 4.5 | 0.9375 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.175824 | 0.09 | 100 | 4 | 61 | 25 | 0.615385 | 0.09 | 0 | 0 | 0 | 0 | 0.550562 | 0.550562 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | false | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 3 |
d93af54f4e8a0a6c6e04b97b1971ab15c12a5d38 | 333 | py | Python | rofm/experimental/text.py | PurelyApplied/roll_one_for_me | 1130d6bb29db4795f3ef84ea0540e94290b6e58d | [
"Apache-2.0"
] | 13 | 2016-05-10T22:11:46.000Z | 2019-02-15T03:44:01.000Z | rofm/experimental/text.py | PurelyApplied/roll_one_for_me | 1130d6bb29db4795f3ef84ea0540e94290b6e58d | [
"Apache-2.0"
] | 6 | 2017-07-06T22:13:18.000Z | 2017-07-07T18:18:12.000Z | rofm/experimental/text.py | PurelyApplied/roll_one_for_me | 1130d6bb29db4795f3ef84ea0540e94290b6e58d | [
"Apache-2.0"
] | 10 | 2016-02-10T20:23:51.000Z | 2022-03-25T14:06:05.000Z | #!/usr/bin/env python3
class Text:
"""A probably unnecessary wrapper for a \\n-delimited block of text."""
def __init__(self, raw_text:str):
self.raw_text = raw_text
self.lines = [l.strip() for l in raw_text.split("\n")]
def get_block(self, start, length):
return self.lines[start: length + 1]
| 27.75 | 75 | 0.636637 | 51 | 333 | 3.980392 | 0.588235 | 0.137931 | 0.108374 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.007752 | 0.225225 | 333 | 11 | 76 | 30.272727 | 0.77907 | 0.258258 | 0 | 0 | 0 | 0 | 0.008333 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0.333333 | false | 0 | 0 | 0.166667 | 0.666667 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 1 | 1 | 0 | 0 | 3 |
d96e37ea7489d59e862113dded7ef489c1964574 | 337 | py | Python | helpers/helper.py | borko81/hotel_spr_using_flask | 8e5dbb247f9f9c67547ca3c2e9a95728125d3ed9 | [
"MIT"
] | null | null | null | helpers/helper.py | borko81/hotel_spr_using_flask | 8e5dbb247f9f9c67547ca3c2e9a95728125d3ed9 | [
"MIT"
] | null | null | null | helpers/helper.py | borko81/hotel_spr_using_flask | 8e5dbb247f9f9c67547ca3c2e9a95728125d3ed9 | [
"MIT"
] | null | null | null | from flask import request
from datetime import datetime
def get_user_dates_or_return_today():
"""
If user enter valid date get it else return currect date
"""
f_data = request.form["fdata"] or str(datetime.today().date())
l_data = request.form["ldata"] or str(datetime.today().date())
return f_data, l_data
| 28.083333 | 66 | 0.691395 | 51 | 337 | 4.392157 | 0.509804 | 0.044643 | 0.133929 | 0.160714 | 0.196429 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.195846 | 337 | 11 | 67 | 30.636364 | 0.826568 | 0.166172 | 0 | 0 | 0 | 0 | 0.038314 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0.166667 | false | 0 | 0.333333 | 0 | 0.666667 | 0 | 0 | 0 | 0 | null | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 1 | 0 | 0 | 3 |
7960a39726e5e18f3a6fce765202ec4fd4e7a784 | 2,709 | py | Python | editregions/views.py | kezabelle/django-editregions | 961ddeffb37d30d40fb4e3e9224bc3f956b7a5b5 | [
"BSD-2-Clause-FreeBSD"
] | 1 | 2015-01-11T18:21:27.000Z | 2015-01-11T18:21:27.000Z | editregions/views.py | kezabelle/django-editregions | 961ddeffb37d30d40fb4e3e9224bc3f956b7a5b5 | [
"BSD-2-Clause-FreeBSD"
] | null | null | null | editregions/views.py | kezabelle/django-editregions | 961ddeffb37d30d40fb4e3e9224bc3f956b7a5b5 | [
"BSD-2-Clause-FreeBSD"
] | null | null | null | # -*- coding: utf-8 -*-
import logging
from django.contrib import messages
from django.shortcuts import redirect
logger = logging.getLogger(__name__)
class FormSuccess(Exception):
__slots__ = ['location', 'msg', 'message', 'permanent']
def __init__(self, location, msg=None, permanent=False):
self.location = location
self.msg = msg
self.message = msg
self.permanent = permanent
def has_message(self):
return self.msg is not None
def get_message(self):
return self.msg
def get_redirect(self):
return redirect(self.location, permanent=self.permanent)
def __eq__(self, other):
return isinstance(other, FormSuccess) and all([
self.location == other.location,
self.permanent == other.permanent,
])
def __ne__(self, other):
return not self.__eq__(other)
def __lt__(self, other):
# 301 < 302
return self.permanent and not other.permanent
def __gt__(self, other):
# 302 > 301
return not self.permanent and other.permanent
def __le__(self, other):
# 301 == 301 OR 302 == 302 OR 301 < 302
return any([self.permanent == other.permanent, self.__lt__(other)])
def __ge__(self, other):
# 301 == 301 OR 302 == 302 OR 302 > 301
return any([self.permanent == other.permanent, self.__gt__(other)])
def __contains__(self, item):
return item == self.location
class EditRegionResponseMixin(object):
"""
A mixin which allows for any view (or template, or template tag) which
raises a :exc:`~editregions.views.FormSuccess` exception to avoid showing
an error, and will instead redirect to a given ``location``, also
setting a flash message.
"""
def render_to_response(self, context, **response_kwargs):
"""
Returns a response with a template rendered with the given context,
or alternatively returns an HTTP redirect if it encountered a
:exc:`~editregions.views.FormSuccess` error (what a misnomer!)
"""
try:
return super(EditRegionResponseMixin, self).render_to_response(
context, **response_kwargs)
except FormSuccess as e:
if e.has_message():
messages.success(self.request, e.get_message(),
fail_silently=True)
logger.debug('%(path)s raised `FormSuccess`, redirecting to '
'new endpoint %(new_path)s' % {
'path': self.request.path,
'new_path': e.location,
})
return e.get_redirect()
| 33.036585 | 77 | 0.605759 | 310 | 2,709 | 5.077419 | 0.33871 | 0.057814 | 0.034308 | 0.051461 | 0.152478 | 0.082592 | 0.082592 | 0.031766 | 0 | 0 | 0 | 0.025668 | 0.295312 | 2,709 | 81 | 78 | 33.444444 | 0.798848 | 0.20192 | 0 | 0 | 0 | 0 | 0.052606 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0.244898 | false | 0 | 0.061224 | 0.204082 | 0.612245 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 1 | 1 | 0 | 0 | 3 |
79946eb8b4b1b018fc2061fce63bd233ed309c5e | 63 | py | Python | tudatpy/util/__init__.py | gitter-badger/tudatpy | f5faef4ecfe8667cb9c989dd839185eeed5f9662 | [
"BSD-3-Clause"
] | null | null | null | tudatpy/util/__init__.py | gitter-badger/tudatpy | f5faef4ecfe8667cb9c989dd839185eeed5f9662 | [
"BSD-3-Clause"
] | null | null | null | tudatpy/util/__init__.py | gitter-badger/tudatpy | f5faef4ecfe8667cb9c989dd839185eeed5f9662 | [
"BSD-3-Clause"
] | null | null | null | from ._support import result2array
__all__ = ["result2array"]
| 15.75 | 34 | 0.777778 | 6 | 63 | 7.333333 | 0.833333 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.036364 | 0.126984 | 63 | 3 | 35 | 21 | 0.763636 | 0 | 0 | 0 | 0 | 0 | 0.190476 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | false | 0 | 0.5 | 0 | 0.5 | 0 | 1 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 3 |
79c871d4504b03441658964cc01bad2fdd604c02 | 94 | py | Python | subtraction/subtraction.py | FathimaMahabub/git-exercise-3 | 8445b1978396fbe1341b75129fc9f666a006709f | [
"MIT"
] | null | null | null | subtraction/subtraction.py | FathimaMahabub/git-exercise-3 | 8445b1978396fbe1341b75129fc9f666a006709f | [
"MIT"
] | 1 | 2021-04-19T14:34:29.000Z | 2021-04-19T14:34:29.000Z | subtraction/subtraction.py | FathimaMahabub/git-exercise-3 | 8445b1978396fbe1341b75129fc9f666a006709f | [
"MIT"
] | 2 | 2021-04-19T10:10:55.000Z | 2021-04-19T11:43:59.000Z | def doSubtraction:
a=10
b=5
print(a-b)
doSubtraction()#subtraction of two numbers
| 15.666667 | 42 | 0.680851 | 14 | 94 | 4.571429 | 0.785714 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.041096 | 0.223404 | 94 | 5 | 43 | 18.8 | 0.835616 | 0.276596 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | null | 0 | 0 | null | null | 0.2 | 1 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 3 |
79d111ad7232235c11bc444e78f1cb2e5b2e03ed | 1,117 | py | Python | ems_admin/services.py | Atwinenickson/lendsuphumanresourcemanagement | b46df164d59a4e94300376d679e07bd9a60d6343 | [
"MIT",
"Unlicense"
] | 36 | 2019-11-26T11:46:32.000Z | 2022-02-17T13:18:18.000Z | ems_admin/services.py | Atwinenickson/lendsuphumanresourcemanagement | b46df164d59a4e94300376d679e07bd9a60d6343 | [
"MIT",
"Unlicense"
] | 13 | 2020-02-14T09:30:16.000Z | 2022-03-12T00:58:09.000Z | ems_admin/services.py | Atwinenickson/lendsuphumanresourcemanagement | b46df164d59a4e94300376d679e07bd9a60d6343 | [
"MIT",
"Unlicense"
] | 16 | 2019-06-14T12:11:29.000Z | 2022-02-14T15:16:07.000Z | from ems_admin.models import EMSPermission
def create_default_permissions(user):
EMSPermission.objects.create(
user=user,
name="Employees",
)
EMSPermission.objects.create(
user=user,
name="Organisation",
)
EMSPermission.objects.create(
user=user,
name="Leave",
)
EMSPermission.objects.create(
user=user,
name="Payroll",
)
EMSPermission.objects.create(
user=user,
name="Overtime",
)
EMSPermission.objects.create(
user=user,
name="Holidays",
)
EMSPermission.objects.create(
user=user,
name="Recruitment",
)
EMSPermission.objects.create(
user=user,
name="Contracts",
)
EMSPermission.objects.create(
user=user,
name="Training",
)
EMSPermission.objects.create(
user=user,
name="Learning and Development",
)
EMSPermission.objects.create(
user=user,
name="Leave",
)
permissions = EMSPermission.objects.filter(user=user)
return permissions
| 18.016129 | 57 | 0.586392 | 98 | 1,117 | 6.653061 | 0.27551 | 0.368098 | 0.43865 | 0.506135 | 0.656442 | 0.656442 | 0.131902 | 0 | 0 | 0 | 0 | 0 | 0.306177 | 1,117 | 61 | 58 | 18.311475 | 0.84129 | 0 | 0 | 0.5 | 0 | 0 | 0.094897 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0.020833 | false | 0 | 0.020833 | 0 | 0.0625 | 0 | 0 | 0 | 0 | null | 1 | 1 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 3 |
8dab892e06cdec29552f86c36d71f58b48cfca75 | 455 | py | Python | leetcode/editor/cn/MaximumNumberOfBalloons.py | huangge1199/leet-code-python | 5d01bbb6f12a495ea7ea0a90b5b3b4aa92bcc2f7 | [
"Apache-2.0"
] | 1 | 2022-02-12T13:55:41.000Z | 2022-02-12T13:55:41.000Z | leetcode/editor/cn/MaximumNumberOfBalloons.py | huangge1199/leet-code-python | 5d01bbb6f12a495ea7ea0a90b5b3b4aa92bcc2f7 | [
"Apache-2.0"
] | null | null | null | leetcode/editor/cn/MaximumNumberOfBalloons.py | huangge1199/leet-code-python | 5d01bbb6f12a495ea7ea0a90b5b3b4aa92bcc2f7 | [
"Apache-2.0"
] | null | null | null | # 1189:“气球” 的最大数量
# leetcode submit region begin(Prohibit modification and deletion)
from collections import Counter
class Solution:
def maxNumberOfBalloons(self, text: str) -> int:
return min(cnts[ch] // 2 if ch in "lo" else cnts[ch] for ch in "balon") if (cnts := Counter(text)) else 0
if __name__ == "__main__":
print(Solution.maxNumberOfBalloons(Solution, "balon"))
# leetcode submit region end(Prohibit modification and deletion)
| 32.5 | 113 | 0.723077 | 61 | 455 | 5.262295 | 0.639344 | 0.087227 | 0.124611 | 0.193146 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.015873 | 0.169231 | 455 | 13 | 114 | 35 | 0.833333 | 0.314286 | 0 | 0 | 0 | 0 | 0.064935 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0.166667 | false | 0 | 0.166667 | 0.166667 | 0.666667 | 0.166667 | 0 | 0 | 0 | null | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 1 | 0 | 0 | 3 |
8db7d89127dfca2d3a07e8ab3ea8dc19d65eb770 | 161 | py | Python | sample/create_user.py | austingarrigus/rubrik-sdk-for-python | 4a9c7f2239282681af951d918d8e9530c65ec1dd | [
"MIT"
] | 4 | 2018-09-06T23:34:32.000Z | 2018-10-08T15:04:22.000Z | sample/create_user.py | austingarrigus/rubrik-sdk-for-python | 4a9c7f2239282681af951d918d8e9530c65ec1dd | [
"MIT"
] | 1 | 2018-09-05T22:20:12.000Z | 2018-09-06T04:57:23.000Z | sample/create_user.py | austingarrigus/rubrik-sdk-for-python | 4a9c7f2239282681af951d918d8e9530c65ec1dd | [
"MIT"
] | 3 | 2018-10-01T14:49:47.000Z | 2018-10-03T15:41:12.000Z | import rubrik_cdm
rubrik = rubrik_cdm.Connect()
username = "python-sdk-user"
password = "RubrikPythonSDK"
create_user = rubrik.create_user(username, password)
| 20.125 | 52 | 0.78882 | 20 | 161 | 6.15 | 0.55 | 0.146341 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.10559 | 161 | 7 | 53 | 23 | 0.854167 | 0 | 0 | 0 | 0 | 0 | 0.186335 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | false | 0.4 | 0.2 | 0 | 0.2 | 0 | 1 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 3 |
8dc7f2791967b956cf059b04dc5ec27f2b4a47a8 | 5,171 | py | Python | model/metric.py | Neronjust2017/pytorch-regression-project | 28ff39b829837b68a42f0e6dd5324a40eac05343 | [
"MIT"
] | 1 | 2020-07-07T12:28:59.000Z | 2020-07-07T12:28:59.000Z | model/metric.py | Neronjust2017/pytorch-regression-project | 28ff39b829837b68a42f0e6dd5324a40eac05343 | [
"MIT"
] | null | null | null | model/metric.py | Neronjust2017/pytorch-regression-project | 28ff39b829837b68a42f0e6dd5324a40eac05343 | [
"MIT"
] | null | null | null | import torch
import torch.nn.functional as F
import numpy as np
def accuracy(output, target):
with torch.no_grad():
pred = torch.argmax(output, dim=1)
assert pred.shape[0] == len(target)
correct = 0
correct += torch.sum(pred == target).item()
return correct / len(target)
def top_k_acc(output, target, k=3):
with torch.no_grad():
pred = torch.topk(output, k, dim=1)[1]
assert pred.shape[0] == len(target)
correct = 0
for i in range(k):
correct += torch.sum(pred[:, i] == target).item()
return correct / len(target)
# Normal\MC_dropout\BBB(BBB_LR)\QD\DE\DE_ensemble
def mse(output, target, type=None, reduction = "mean"):
if type in ['MC_dropout','BBB', 'VD']:
mean = torch.mean(output, dim=2)
return F.mse_loss(mean, target, reduction=reduction)
elif type in ['QD']:
mean = torch.mean(output, dim=1)
mean = mean.view(len(output), 1)
return F.mse_loss(mean, target, reduction=reduction)
elif type in ['DE', 'DE_ensemble']:
return F.mse_loss(output[:, :1], target, reduction=reduction)
else:
return F.mse_loss(output, target, reduction=reduction)
# Normal\MC_dropout\BBB(BBB_LR)\QD\DE\DE_ensemble
def rmse(output, target, type=None):
return mse(output, target, type, reduction="mean") **0.5
# MC_dropout\BBB(BBB_LR)\QD\DE\DE_ensemble
def picp(output, target, type=None):
return picp_mpiw(output, target, type)[0]
def mpiw(output, target, type=None):
return picp_mpiw(output, target, type)[1]
def picp_mpiw(output, target, type=None):
if type in ['MC_dropout', 'BBB', 'VD']:
mean = torch.mean(output, dim=2)
std = torch.std(output, dim=2)
y_U = mean + 2 * std
y_L = mean - 2 * std
elif type in ['QD']:
y_U = output[:, :1]
y_L = output[:, 1:]
elif type in ['DE']:
mu = output[:, :1]
sig = output[:, 1:]
sig_pos = torch.log(1 + torch.exp(sig)) + 1e-06
std = torch.sqrt(sig_pos)
y_U = mu + 2 * std
y_L = mu - 2 * std
elif type in ['DE_ensemble']:
mu = output[:, :1]
sig_pos = output[:, 1:]
std = torch.sqrt(sig_pos)
y_U = mu + 2 * std
y_L = mu - 2 * std
else:
exit(1)
zeros = torch.zeros_like(y_U)
u = torch.max(zeros, torch.sign(y_U - target))
l = torch.max(zeros, torch.sign(target - y_L))
picp = torch.mean(torch.mul(u, l))
mpiw = torch.mean(y_U - y_L)
return picp, mpiw
# homo
# Normal\MC_dropout\BBB(BBB_LR)
def picp_homo(output, target, type=None):
return picp_mpiw_homo(output, target, type)[0]
def mpiw_homo(output, target, type=None):
return picp_mpiw_homo(output, target, type)[1]
def picp_mpiw_homo(output, target, type=None):
noise = output[1]
output = output[0]
if type in ['MC_dropout', 'BBB', 'VD']:
mean = torch.mean(output, dim=2)
std = torch.std(output, dim=2)
total_unc = (noise ** 2 + (2 * std) ** 2) ** 0.5
y_U = mean + total_unc
y_L = mean - total_unc
else:
y_U = output + noise
y_L = output - noise
zeros = torch.zeros_like(y_U)
u = torch.max(zeros, torch.sign(y_U - target))
l = torch.max(zeros, torch.sign(target - y_L))
picp = torch.mean(torch.mul(u, l))
mpiw = torch.mean(y_U - y_L)
return picp, mpiw
def mse_homo(output, target, type=None, reduction = "mean"):
if type in ['MC_dropout','BBB', 'VD']:
mean = torch.mean(output[0], dim=2)
return F.mse_loss(mean, target, reduction=reduction)
else:
return F.mse_loss(output[0], target, reduction=reduction)
def rmse_homo(output, target, type=None):
return mse_homo(output, target, type, reduction="mean") **0.5
# hetero
# Normal\MC_dropout\BBB(BBB_LR)
def picp_hetero(output, target, type=None):
return picp_mpiw_hetero(output, target, type)[0]
def mpiw_hetero(output, target, type=None):
return picp_mpiw_hetero(output, target, type)[1]
def picp_mpiw_hetero(output, target, type=None):
if type in ['MC_dropout', 'BBB', 'VD']:
mean = torch.mean(output[:, :1, :], dim=2)
std = torch.std(output[:, :1, :], dim=2)
noise = torch.mean(output[:, 1:, :].exp() ** 2, dim=2)
total_unc = (noise ** 2 + (2 * std) ** 2) ** 0.5
y_U = mean + total_unc
y_L = mean - total_unc
else:
noise = output[:, 1:].exp()
y_U = output[:, :1] + noise
y_L = output[:, :1] - noise
zeros = torch.zeros_like(y_U)
u = torch.max(zeros, torch.sign(y_U - target))
l = torch.max(zeros, torch.sign(target - y_L))
picp = torch.mean(torch.mul(u, l))
mpiw = torch.mean(y_U - y_L)
return picp, mpiw
def mse_hetero(output, target, type=None, reduction = "mean"):
if type in ['MC_dropout','BBB', 'VD']:
mean = torch.mean(output[:, :1, :], dim=2)
return F.mse_loss(mean, target, reduction=reduction)
else:
return F.mse_loss(output[:, :1], target, reduction=reduction)
def rmse_hetero(output, target, type=None):
return mse_hetero(output, target, type, reduction="mean") **0.5 | 34.019737 | 69 | 0.600851 | 794 | 5,171 | 3.784635 | 0.104534 | 0.10782 | 0.127787 | 0.099834 | 0.828286 | 0.793677 | 0.700499 | 0.657571 | 0.637604 | 0.583694 | 0 | 0.018641 | 0.2427 | 5,171 | 152 | 70 | 34.019737 | 0.748723 | 0.040224 | 0 | 0.531746 | 0 | 0 | 0.029056 | 0 | 0 | 0 | 0 | 0 | 0.015873 | 1 | 0.134921 | false | 0 | 0.02381 | 0.071429 | 0.333333 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 1 | 1 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 3 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.