content
stringlengths
27
928k
path
stringlengths
4
230
size
int64
27
928k
nl_text
stringlengths
21
396k
nl_size
int64
21
396k
nl_language
stringlengths
2
3
nl_language_score
float64
0.04
1
# Copyright 2018 The TensorFlow Authors. All Rights Reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applica...
official/resnet/keras/keras_benchmark.py
4,175
Base benchmark class with methods to simplify testing. Report benchmark results by writing to local protobuf file. Args: stats: dict returned from keras models with known entries. wall_time_sec: the during of the benchmark execution in seconds top_1_max: highest passing level for top_1 accuracy. top_1_min: low...
1,563
en
0.857356
# 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 t...
tests/__init__.py
768
Run on testing package. Test Package set up. 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 writin...
569
en
0.87509
# -*- coding: utf-8 -*- # # pytest-dasktest documentation build configuration file, created by # sphinx-quickstart on Thu Oct 1 00:43:18 2015. # # This file is execfile()d with the current directory set to its # containing dir. # # Note that not all possible configuration values are present in this # autogenerated fil...
docs/conf.py
9,414
-*- coding: utf-8 -*- pytest-dasktest documentation build configuration file, created by sphinx-quickstart on Thu Oct 1 00:43:18 2015. This file is execfile()d with the current directory set to its containing dir. Note that not all possible configuration values are present in this autogenerated file. All configuration...
7,941
en
0.642776
import numpy as np import torch import torch.nn as nn import torch.nn.functional as F import sys sys.path.append('./') from update import BasicUpdateBlock, SmallUpdateBlock from extractor import BasicEncoder, SmallEncoder from corr import CorrBlock, AlternateCorrBlock from util import bilinear_sampler, coords_grid, u...
nets/raft_core/backraft.py
5,512
get featmap for one frame Flow is represented as difference between two coordinate grids flow = coords1 - coords0 Estimate optical flow between pair of frames Upsample flow field [H/8, W/8, 2] -> [H, W, 2] using convex combination dummy autocast for PyTorch < 1.6 feature network, context network, and update block ...
587
en
0.819941
#!/usr/bin/env python import subprocess from pathlib import Path from distutils.cmd import Command from setuptools import setup, find_packages # pylint: disable=unused-import import fastentrypoints # noqa: F401 # pylint: enable=unused-import import howdoi class Lint(Command): """A custom command to run Flake8 o...
setup.py
2,929
A custom command to run Flake8 on all Python source files. !/usr/bin/env python pylint: disable=unused-import noqa: F401 pylint: enable=unused-import pylint: disable=unspecified-encoding pylint: disable=consider-using-f-string pylint: enable=consider-using-f-string
271
en
0.535923
from __future__ import print_function from __future__ import absolute_import # Copyright (c) 2003-2016 CORE Security Technologies # # This software is provided under under a slightly modified version # of the Apache Software License. See the accompanying LICENSE file # for more information. # # -*- mode: python; tab-...
deps/src/curl-7.65.1/tests/python_dependencies/impacket/nmb.py
35,940
This is a packet as defined in RFC 1002 Copyright (c) 2003-2016 CORE Security Technologies This software is provided under under a slightly modified version of the Apache Software License. See the accompanying LICENSE file for more information. -*- mode: python; tab-width: 4 -*- Copyright (C) 2001 Michael Teo <micha...
5,288
en
0.820243
#! /usr/bin/env python # coding:utf-8 import unittest from kovot.response import Response from kovot.response import ResponseTransformer from kovot.response import ResponseSelector class ResponseTest(unittest.TestCase): def test_response(self): text = "京都にいます" score = 1.2 res = Response(...
test/test_response.py
1,385
! /usr/bin/env python coding:utf-8
34
en
0.408602
import random # create the initial array regionsEMEA = ["Central Eastern Europe", "France", "Germany", "Middle East / Africa", "United Kingdom", "Western Europe"] # randomly pick region after region num = len(regionsEMEA) for x in range(num): numRegions = len(regionsEMEA) pos = random.randint(0,numRegions-1) ...
randEMEA.py
397
create the initial array randomly pick region after region
58
en
0.568883
import logging from typing import Callable, TypeVar, List, Optional, Dict import ray from ray.exceptions import RayActorError from ray.util.sgd.v2.worker_group import WorkerGroup from ray.util.sgd.v2.session import init_session, get_session, shutdown_session T = TypeVar("T") logger = logging.getLogger(__name__) cl...
python/ray/util/sgd/v2/backends/backend.py
9,304
Parent class for configurations of training backend. Main execution class for training backends. This class holds a worker group and is responsible for executing the training function on the workers, and collecting intermediate results from ``sgd.report()``. Args: backend_config (BackendConfig): The configuration...
2,641
en
0.895064
from django.test import TestCase from authors.apps.authentication.models import User class UserModelTest(TestCase): """ Test Suite for the User model class, User authentication. """ def test_create_user(self): """ Test User model can create a user successfully """ sel...
authors/apps/authentication/tests/test_create_user.py
527
Test Suite for the User model class, User authentication. Test User model can create a user successfully
104
en
0.851033
#!/usr/bin/env python # -*- coding: utf-8 -*- # MIT License # # Copyright 2018-2020 New York University Abu Dhabi # # Permission is hereby granted, free of charge, to any person obtaining a copy # of this software and associated documentation files (the "Software"), to deal # in the Software without restriction, inclu...
camel_tools/cli/camel_transliterate.py
7,318
The CAMeL Tools transliteration utility. Usage: camel_transliterate (-s SCHEME | --scheme=SCHEME) [-m MARKER | --marker=MARKER] [-I | --ignore-markers] [-S | --strip-markers] [-o OUTPUT | --output=OUTPUT] [FILE] cam...
2,375
en
0.717559
# -*- coding: utf-8 -*- """ Created on Mon Mar 7 16:41:25 2011 @author: - """ import os; import time; import sys; import plot_pca_functions; import numpy as np import matplotlib.pyplot as plt import math taylor_error_capitol= 0.608546356589; pca_error_9_capitol = 0.614236131016; #at 10% sample-training taylor_err...
bvpl/bvpl_octree/taylor_vs_pca.py
467
Created on Mon Mar 7 16:41:25 2011 @author: - -*- coding: utf-8 -*-at 10% sample-trainingthis is for downtown12_12_4!this is for downtown3_3_1!
147
en
0.842077
# encoding: UTF-8 import os print u'load {0}/*'.format(os.path.dirname(__file__)) # 默认设置 from chinese import text # 是否要使用英文 from vnpy.trader.vtGlobal import globalSetting if globalSetting['language'] == 'english': from english import text
vnpy/trader/gateway/ctpGateway/language/__init__.py
267
encoding: UTF-8 默认设置 是否要使用英文
28
zh
0.969302
# Copyright 2020 Huawei Technologies Co., Ltd # # 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...
tests/ut/python/dataset/test_random_color.py
10,052
Compare Random Color op in Python and Cpp Test Cpp RandomColor Test that Cpp RandomColor errors with bad input Test Python RandomColor Test Python RandomColor with md5 check Testing RandomColor op in DE Copyright 2020 Huawei Technologies Co., Ltd Licensed under the Apache License, Version 2.0 (the "License"); you may...
1,379
en
0.739068
# -*- coding: utf-8 -*- check_state = 0 d = {} p = [] e = [] m = [] n = int(input()) for _ in range(n): ln = input().split() d[ln[0]] = (int(ln[1]), int(ln[2]), int(ln[3])) p.append(int(ln[1])) e.append(int(ln[2])) m.append(int(ln[3])) while True: if check_state == 0: if p.cou...
2654.py
2,110
-*- coding: utf-8 -*- Ordem lexicográfica é a mesma coisa que afabética nesse caso
82
pt
0.925756
# encoding: utf-8 """ parse_process.py Created by Thomas Mangin on 2015-06-05. Copyright (c) 2009-2017 Exa Networks. All rights reserved. License: 3-clause BSD. (See the COPYRIGHT file) """ import time import copy from collections import defaultdict from exabgp.configuration.core import Section from exabgp.configura...
lib/exabgp/configuration/neighbor/api.py
4,096
parse_process.py Created by Thomas Mangin on 2015-06-05. Copyright (c) 2009-2017 Exa Networks. All rights reserved. License: 3-clause BSD. (See the COPYRIGHT file) encoding: utf-8
182
en
0.81894
# Copyright 2018 The TensorFlow Authors. All Rights Reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applica...
tensorflow/python/ops/boosted_trees_ops.py
13,157
Class for working with Pruning modes. SaveableObject implementation for QuantileAccumulator. The bucket boundaries are serialized and deserialized from checkpointing. SaveableObject implementation for QuantileAccumulator. Creates TreeEnsemble resource. SaveableObject implementation for TreeEnsemble. Creates a _TreeEns...
2,515
en
0.798041
# -------------- # Code starts here import pandas as pd import matplotlib.pyplot as plt from sklearn.preprocessing import Imputer from sklearn.preprocessing import LabelEncoder import numpy as np from scipy.stats import skew #### Data 1 # Load the data df = pd.read_csv(path) # Overview of the data df.info() df.descr...
code.py
1,913
-------------- Code starts here Data 1 Load the data Overview of the data Histogram showing distribution of car prices Countplot of the make column Jointplot showing relationship between 'horsepower' and 'price' of the car Correlation heat map boxplot that shows the variability of each 'body-style' with respect to the ...
438
en
0.777727
class CookieContainer(object): """ Provides a container for a collection of System.Net.CookieCollection objects. CookieContainer() CookieContainer(capacity: int) CookieContainer(capacity: int,perDomainCapacity: int,maxCookieSize: int) """ def ZZZ(self): """hardcoded/mock instance of the class"""...
release/stubs.min/System/Net/__init___parts/CookieContainer.py
4,720
Provides a container for a collection of System.Net.CookieCollection objects. CookieContainer() CookieContainer(capacity: int) CookieContainer(capacity: int,perDomainCapacity: int,maxCookieSize: int) Add(self: CookieContainer,cookie: Cookie) Adds a System.Net.Cookie to a System.Net.CookieContainer. This method u...
2,828
en
0.68817
"""Retrieve county->CBSA crosswalk file from the NBER""" from collections import defaultdict import unicodecsv as csv import logging import requests from utils.fs import cache_json URL = 'http://www.nber.org/cbsa-msa-fips-ssa-county-crosswalk/2016/cbsatocountycrosswalk2016.csv' @cache_json('cbsa_lookup.json') def c...
datasets/nber_county_cbsa.py
1,053
Construct a County->CBSA Lookup table from NBER data Returns: dict each key is a (State Code, County FIPS code) tuple each value is a (CBSA FIPS code, CBSA Name) tuple Retrieve county->CBSA crosswalk file from the NBER skip header line
245
en
0.806278
#!/usr/bin/env python # -*- coding: utf-8 -*- class Config(object): DEBUG = True RELOADER = True PORT = 8080 class DevelopmentConfig(Config): pass class ProductionConfig(Config): DEBUG = False RELOADER = False
{{ cookiecutter.app_name }}/{{ cookiecutter.app_name }}_backend/{{ cookiecutter.app_name }}/config.py
237
!/usr/bin/env python -*- coding: utf-8 -*-
42
en
0.34282
import torch import torch.nn as nn import torch.nn.functional as F import torch.nn.utils.spectral_norm as spectral_norm import math import numpy as np import torchvision.models as models from modules.networks import get_pad from torch.distributions.multivariate_normal import MultivariateNormal from util.utils import l...
models/SketchTransformer/models/networks.py
52,613
A Lite BERT: Parameter Sharing layers_setting[list]: [[12, ], []] Truely a CNN model max_size[tuple](x_length, y_length) The module to upsample the embedding feature, idea from the ALBERT: Factorized Embedding layers_setting[list]: [[12, ], []] Assume Label in the Input Assume Label in the Input A transformer layer for...
4,676
en
0.458285
import binascii import re try: import json except: import simplejson as json # Inserting certain referenced dicts in here means they can be declared in the same order as in the spec. maps = {} # SMPP PDU Definition - SMPP v3.4, section 4, page 45 mandatory_parameter_lists = { 'bind_transmitter': [ # S...
smpp/__init__.py
78,858
Inserting certain referenced dicts in here means they can be declared in the same order as in the spec. SMPP PDU Definition - SMPP v3.4, section 4, page 45 SMPP v3.4, section 4.1.1, table 4-1, page 46 SMPP v3.4, section 4.1.2, table 4-2, page 47 SMPP v3.4, section 4.1.3, table 4-3, page 48 SMPP v3.4, section 4.1.4, tab...
6,344
en
0.240071
# Copyright 2018 Iguazio # # 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, softwa...
mlrun/runtimes/function_reference.py
4,734
function reference/template, point to function and add/override resources deploy the function get the generated function object generate a function object from the ref definitions Copyright 2018 Iguazio Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with...
766
en
0.795771
# -*- coding: utf-8 -*- # Copyright 2019 Cohesity Inc. class HypervBackupEnvParams(object): """Implementation of the 'HyperVBackupEnvParams' model. Message to capture any additional backup params for a HyperV environment. Attributes: allow_crash_consistent_snapshot (bool): Whether to fallback t...
cohesity_management_sdk/models/hyperv_backup_env_params.py
1,631
Implementation of the 'HyperVBackupEnvParams' model. Message to capture any additional backup params for a HyperV environment. Attributes: allow_crash_consistent_snapshot (bool): Whether to fallback to take a crash-consistent snapshot incase taking an app-consistent snapshot fails. Constructor for...
890
en
0.749928
""" This file contains SPRKKRAtoms - an enhanced version of Atoms to be used with SPRKKR """ from ase import Atoms from ..common.unique_values import UniqueValuesMapping import spglib from ase.spacegroup import Spacegroup import numpy as np from ..sprkkr.sites import Site from ..common.misc import numpy_index class ...
src/ase2sprkkr/sprkkr/sprkkr_atoms.py
11,396
ASE Atoms object extended by the data necessary for SPR-KKR calculations Creates SPRKKRAtoms atoms Parameters ---------- *args: list The positionals arguments of ase.Atoms.__init__ symmetry: boolean The symmetry will be computed when the sites property will be initialized. I.e., the by-symmetry-equal atomic ...
4,324
en
0.838233
""" Open Orchestrator Cloud Radio Access Network 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...
oocran/django/images/forms.py
1,952
Open Orchestrator Cloud Radio Access Network 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...
568
en
0.862218
#!/usr/bin/env python3 # -*- coding: utf-8 -*- """ Created on Mon Jul 8 23:53:58 2019 @author: yanyanyu """ from spark import start_spark from pyspark import SparkConf from pyspark import SparkFiles from pyspark.sql import Row def main(): spark,conf=start_spark() steps_per_floor_=conf['steps_per_floor'] ...
examples_pyspark/pyspark_small_project/etl_job.py
1,617
Created on Mon Jul 8 23:53:58 2019 @author: yanyanyu !/usr/bin/env python3 -*- coding: utf-8 -*-
99
en
0.456094
# -*- coding: utf-8 -*- from __future__ import unicode_literals from django.db import migrations, models from django.conf import settings class Migration(migrations.Migration): dependencies = [ migrations.swappable_dependency(settings.AUTH_USER_MODEL), ('report_database', '0003_auto_20160501_164...
report_database/migrations/0004_report_shared_users.py
563
-*- coding: utf-8 -*-
21
en
0.767281
# Copyright 2015 Amazon.com, Inc. or its affiliates. All Rights Reserved. # # Licensed under the Apache License, Version 2.0 (the "License"). You # may not use this file except in compliance with the License. A copy of # the License is located at # # https://aws.amazon.com/apache2.0/ # # or in the "license" file accomp...
tests/functional/test_resource.py
2,029
Copyright 2015 Amazon.com, Inc. or its affiliates. All Rights Reserved. Licensed under the Apache License, Version 2.0 (the "License"). You may not use this file except in compliance with the License. A copy of the License is located at https://aws.amazon.com/apache2.0/ or in the "license" file accompanying this file. ...
537
en
0.910893
# -*- coding: utf-8 -*- #BEGIN_HEADER # The header block is where all import statements should live from __future__ import print_function import os import re import uuid import requests import json import psutil import subprocess import numpy as np import yaml import time from pprint import pformat from installed_clie...
lib/kb_SPAdes/kb_SPAdesImpl.py
38,864
Module Name: kb_SPAdes Module Description: A KBase module: kb_SPAdes A wrapper for the SPAdes assembler with hybrid features supported. http://bioinf.spbau.ru/spades Always runs in careful mode. Runs 3 threads / CPU. Maximum memory use is set to available memory - 1G. Autodetection is used for the PHRED q...
12,025
en
0.651245
import os import tensorflow as tf from tensorkit.log import logger, Color class Restore(object): def __init__(self): self._var_list = None self._restore_saver = None self._restore_optimistic = False self.restore_ckpt_file = None self._inited = False def init(self, va...
tensorkit/restore.py
4,687
restore weights of same names with model. :param sess: :return: :param sess: :return: boolean for successful or not :param var_list: vars for restore :param ckpt_dir: prefix of model files. :param ckpt_file: exact name of model file, priority is higher than `ckpt_dir` :param optimistic: only restore weights of...
369
en
0.711414
import config as c import random as r def print_map(map_grid): print("= " * (len(map_grid) + 2)) for row in map_grid: print("||", end='') print(*row, sep=" ", end='') print("||") print("= " * (len(map_grid) + 2)) # Builds map with all of one type of tile # Should be WALL or FLOOR d...
map.py
3,433
Builds map with all of one type of tile Should be WALL or FLOOR def build_ruins(dimension, p_mod): map_grid = init_empty_map(dimension, c.FLOOR) build_dungeon_walls(map_grid, p_mod) return map_grid Randomly populate wall tiles across an empty dungeon floor Determine if wall tile will be populated Determine ...
757
en
0.81798
# Nodes represent a definition of a value in our graph of operators. from typing import TYPE_CHECKING, Union, Callable, Any, Tuple, List, Optional, Dict, Set from ._compatibility import compatibility from .immutable_collections import immutable_dict, immutable_list import torch import builtins import types from ...
venv/Lib/site-packages/torch/fx/node.py
26,552
``Node`` is the data structure that represents individual operations within a ``Graph``. For the most part, Nodes represent callsites to various entities, such as operators, methods, and Modules (some exceptions include nodes that specify function inputs and outputs). Each ``Node`` has a function specified by its ``op`...
11,775
en
0.742337
""" Copyright 2021 Anderson Faustino da Silva 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, ...
examples/algorithms/sga.py
6,061
Generate genetic sequences for each benchmark Copyright 2021 Anderson Faustino da Silva 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 b...
783
en
0.791814
import numpy as np import matplotlib.pyplot as plt import os, sys sys.path.append(os.path.join(os.path.dirname(__file__))) import plot_settings from test_utilities import gausspuls_coeff, gausspulse, gauss_ft # time domain plot fc = 5e6 bandwidth = 2/3 bwr = -6 t_vals = np.linspace(-3/fc, 3/fc, 200) h = gausspulse(t_...
report_results/fig1p6_pulse_shape.py
1,143
time domain plot frequency domain pulse
39
en
0.70615
#!/usr/bin/env python """Django's command-line utility for administrative tasks.""" import os import sys def main(): """Run administrative tasks.""" os.environ.setdefault('DJANGO_SETTINGS_MODULE', 'apibox.settings') try: from django.core.management import execute_from_command_line except Impor...
manage.py
662
Run administrative tasks. Django's command-line utility for administrative tasks. !/usr/bin/env python
103
en
0.725633
#!/usr/bin/python3 import subprocess import sys import json import math import os from os.path import expanduser from tempfile import TemporaryFile def get_workspace(): handle = subprocess.Popen( ["i3-msg", "-t", "get_workspaces"], stdout=subprocess.PIPE) output = handle.communicate()[0] data = js...
scripts/workspace_controller.py
4,434
!/usr/bin/python3 default switch number they passed in a number to move to get the workspace number default value if name parseing fails only look for digits in the number include - in the ignore list incase it is a negative number handle the commands go to workspace in block move the current container to the selected ...
381
en
0.722751
# this is a library that can be used to update and create parts # of the bulkdata import urllib import json import time from django.conf import settings from apps.bulk.models import Character, Corporation, Alliance from apps.static.models import Crpnpccorporations from connection import connection #Make sure not t...
utils/whoapi.py
3,311
this is a library that can be used to update and create parts of the bulkdataMake sure not to many requests are made to evewho.comget the basepart of the api url get the data from urltemp function
196
en
0.905902
# Copyright (c) 2011 Citrix Systems, Inc. # Copyright 2011 OpenStack Foundation # # 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...
fs_patches_of_hybrid_cloud/cherry_for_111T/nova_cascaded/nova/virt/vmwareapi/vim_util.py
8,596
Cancels the retrieve operation. Continues to get the list of objects of the type specified. Get the About Info from the service content. Gets the specified properties of the Managed Object. Gets a particular property of the Managed Object. Gets the list of inner objects of the type specified. Builds the Object Spec obj...
1,414
en
0.841088
#################### # ES-DOC CIM Questionnaire # Copyright (c) 2017 ES-DOC. All rights reserved. # # University of Colorado, Boulder # http://cires.colorado.edu/ # # This project is distributed according to the terms of the MIT license [http://www.opensource.org/licenses/MIT]. #################### from djan...
Q/questionnaire/views/views_realizations.py
15,547
this is meant to be used from external requests (ie: further_info_url) where uniquely identifying model fields (including pk) are passed if a unique realization cannot be found then an error is returned otherwise the response is routed to "q_edit_existing" :param request: :param project_name: :param ontology_key: :para...
3,284
en
0.800682
# -*- coding: utf-8 -*- # Copyright 2015 OpenMarket Ltd # # 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 la...
tests/crypto/test_event_signing.py
3,619
-*- coding: utf-8 -*- Copyright 2015 OpenMarket Ltd 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 wr...
693
en
0.853696
from core.datasource import DataSource from core.model.member import KarmaMember, Member # karma database service class, perform operations on the configured mongodb. from util.config import config, profile class KarmaService: def __init__(self): self._karma = DataSource(config['database']['host'], conf...
core/service/karma_service.py
3,984
karma database service class, perform operations on the configured mongodb. update or insert karma member if not exist on first karma check on inc if inc or dec query should be applied. remove all karma, regardless of channel aggregate overall karma of a member
261
en
0.848897
# Copyright 2021 solo-learn development team. # Permission is hereby granted, free of charge, to any person obtaining a copy of # this software and associated documentation files (the "Software"), to deal in # the Software without restriction, including without limitation the rights to use, # copy, modify, merge, publ...
tests/utils/test_gather.py
1,403
Copyright 2021 solo-learn development team. Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distri...
1,064
en
0.878381
import numpy as np import sys import os import re import ntpath from subprocess import call #### DISCLAIMER: This script uses the `pythonSubmit.py` format #### that has been replaced by the `runSubmit.py` and #### `compasConfigDefault.yaml` combo as of v02.25.10. #### The `pythonSubmit.py` format will eventually beco...
utils/example_plots/methods_paper_plots/fig_5_HR_diagram/pythonSubmit.py
36,202
A class to store and access COMPAS program options in python clean up string parameters to avoid confusing Boost Write out the compas input parameters into a shell string. Ensure the Compas executable is first, and not repeated. Options are non-ordered. This function generates a dictionary mapping COMPAS options to th...
8,731
en
0.830982
from django.contrib.auth import get_user_model from django.utils.translation import gettext_lazy as _ from rest_framework import HTTP_HEADER_ENCODING, authentication from .exceptions import AuthenticationFailed, InvalidToken, TokenError from .settings import api_settings AUTH_HEADER_TYPES = api_settings.AUTH_HEADER_T...
webpersonal/env/Lib/site-packages/rest_framework_simplejwt/authentication.py
5,057
An authentication plugin that authenticates requests through a JSON web token provided in a request header. Extracts the header containing the JSON web token from the given request. Extracts an unvalidated JSON web token from the given "Authorization" header value. Attempts to find and return a user using the given val...
1,162
en
0.709103
import random import numpy as np import torch import torch.nn as nn from torch.autograd import Variable import torch.nn.functional as F from .attention import Attention from .baseRNN import BaseRNN if torch.cuda.is_available(): import torch.cuda as device else: import torch as device class DecoderRNN(Base...
seq2seq/models/DecoderRNN.py
9,892
Provides functionality for decoding in a seq2seq framework, with an option for attention. Args: vocab_size (int): size of the vocabulary max_len (int): a maximum allowed length for the sequence to be processed hidden_size (int): the number of features in the hidden state `h` sos_id (int): index of the ...
3,361
en
0.691797
import torch from mmcv import Config from mmcv.parallel import MMDataParallel from mmcv.runner import load_checkpoint from mmdet.apis import single_gpu_mergetiles_visualize from mmdet.core import wrap_fp16_model from mmdet.datasets import build_dataloader, build_dataset from mmdet.models import build_detector import ...
rtools/dota_result_visualize.py
1,935
set cudnn_benchmark build the dataloaderworkers_per_gpu=cfg.data.workers_per_gpu, build the model and load checkpoint checkpoint = load_checkpoint(model, args.checkpoint, map_location='cpu') old versions did not save class info in checkpoints, this walkaround is for backward compatibility
289
en
0.771434
#!/usr/bin/env python # encoding: utf-8 """ Mobi.py Created by Elliot Kroo on 2009-12-25. Copyright (c) 2009 Elliot Kroo. All rights reserved. """ import sys import os import unittest from struct import * from pprint import pprint import mobi.utils from mobi.lz77 import uncompress_lz77 class Mobi: def parse(self) ...
dbookbee/mobi/__init__.py
8,115
Returns the author of the book reads in the file, then parses record tables Returns the title of the book Mobi.py Created by Elliot Kroo on 2009-12-25. Copyright (c) 2009 Elliot Kroo. All rights reserved. !/usr/bin/env python encoding: utf-8 elif self.config['palmdoc']['Compression'] == 2: result = uncompress_lz77(...
1,050
en
0.656903
# coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. # Licensed under the MIT License. See License.txt in the project root for license information. # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may ...
sdk/network/azure-mgmt-network/azure/mgmt/network/v2018_07_01/aio/operations/_security_rules_operations.py
20,920
SecurityRulesOperations async operations. You should not instantiate this class directly. Instead, you should create a Client instance that instantiates it for you and attaches it as an attribute. :ivar models: Alias to model classes used in this operation group. :type models: ~azure.mgmt.network.v2018_07_01.models :...
2,438
en
0.511493
""" Copyright (c) 2014-2015 F-Secure See LICENSE for details """ import re import inspect import datetime from copy import copy from collections import defaultdict import isodate import pytz from .errors import ValidationError, DeclarationError class BaseField(object): """ Superclass for all fields des...
src/resource_api/schema.py
20,619
Parse datetime Convert to naive UTC Convert to naive UTC
56
en
0.677463
""" The tool to check the availability or syntax of domains, IPv4, IPv6 or URL. :: ██████╗ ██╗ ██╗███████╗██╗ ██╗███╗ ██╗ ██████╗███████╗██████╗ ██╗ ███████╗ ██╔══██╗╚██╗ ██╔╝██╔════╝██║ ██║████╗ ██║██╔════╝██╔════╝██╔══██╗██║ ██╔════╝ ██████╔╝ ╚████╔╝ █████╗ ██║ ██║██╔██╗ ██║██║ ...
PyFunceble/output/clean.py
9,585
Provide the cleaning logic. .. note:: By cleaning we mean the cleaning of the :code:`output` directory. :param list_to_test: The list of domains we are testing. :type list_to_test: list|None :param bool clean_all: Tell the subsystem if we need to clean all. Which include, of course, the output directory ...
4,246
en
0.783106
""" ANIMATE RIGID OBJECTS IN BLENDER. Requirements: ------------------------------------------------------------------------------ IMPORTANT! This has only been tested with Blender 2.79 API. Warnings: ------------------------------------------------------------------------------ Do not expect all blends to be perfect...
creativeflow/blender/animate_main.py
5,720
ANIMATE RIGID OBJECTS IN BLENDER. Requirements: ------------------------------------------------------------------------------ IMPORTANT! This has only been tested with Blender 2.79 API. Warnings: ------------------------------------------------------------------------------ Do not expect all blends to be perfect; we...
1,497
en
0.506539
# Copyright 2021 Huawei Technologies Co., Ltd # # 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...
tests/st/fl/mobile/test_mobile_lenet.py
5,807
Copyright 2021 Huawei Technologies Co., Ltd 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, softw...
733
en
0.740875
# -*- coding: utf-8 -*- # Generated by Django 1.10.4 on 2016-12-12 00:16 from __future__ import unicode_literals from django.db import migrations, models class Migration(migrations.Migration): initial = True dependencies = [ ] operations = [ migrations.CreateModel( name='Accoun...
authentication/migrations/0001_initial.py
1,344
-*- coding: utf-8 -*- Generated by Django 1.10.4 on 2016-12-12 00:16
68
en
0.752644
#! /usr/bin/env python3.6 from selenium import webdriver import time browser = webdriver.Chrome(executable_path='/home/coslate/anaconda3/bin/chromedriver') #url = 'https://stats.nba.com/leaders' url = 'http://stats.nba.com/teams/traditional/#!?sort=W_PCT&dir=-1' browser.get(url) time.sleep(5) #browser.find_element_by...
crawler/test_code/test_selenium.py
1,177
! /usr/bin/env python3.6url = 'https://stats.nba.com/leaders'browser.find_element_by_xpath('/html/body/main/div[2]/div/div[2]/div/div/div[1]/div[1]/div/div/label/select/option[3]').click()browser.find_element_by_xpath('/html/body/main/div[2]/div/div[2]/div/div/div[1]/div[2]/div/div/label/select/option[2]').click()brows...
552
en
0.132153
# Large amount of credit goes to: # https://github.com/keras-team/keras-contrib/blob/master/examples/improved_wgan.py # which I've used as a reference for this implementation from __future__ import print_function, division from keras.datasets import mnist from keras.layers.merge import _Merge from keras.layers impor...
wgan_gp/wgan_gp.py
8,958
Provides a (random) weighted average between real and generated image samples Computes gradient penalty based on prediction and weighted real / fake samples Large amount of credit goes to: https://github.com/keras-team/keras-contrib/blob/master/examples/improved_wgan.py which I've used as a reference for this impleme...
1,807
en
0.760732
""" sphinx.writers.texinfo ~~~~~~~~~~~~~~~~~~~~~~ Custom docutils writer for Texinfo. :copyright: Copyright 2007-2022 by the Sphinx team, see AUTHORS. :license: BSD, see LICENSE for details. """ import re import textwrap import warnings from os import path from typing import (TYPE_CHECKING, Any, ...
sphinx/writers/texinfo.py
53,356
Texinfo writer for generating Texinfo documents. Collect the menu entries for each "node" section. Generates a unique id for each section. Assigns the attribute ``node_name`` to each section. Collect the relative links (next, previous, up) for each "node". Ensure the last line in body is terminated by new line. Return...
3,732
en
0.770669
#!/usr/bin/env python3 # -*- coding: utf-8 -*- """ Created on Thu Feb 22 17:28:54 2018 @author: galengao This is the original analysis code as it exists in the environment where it was writen and initially run. Portions and modifications of this script constitute all other .py scripts in this directory. """ import nu...
scripts/AnalysisCode.py
11,800
Scan and analyze manually currated DocumentedDriverDifferences.txt file. Returns: 1) Number of driver genes called in both hg19 & hg38 GISTIC peaks 2) Number of drivers missing in hg38 peaks that appeared in hg19 peaks and 3) Number of drivers present in hg38 peaks but absent from hg19 peaks. Load in the hg38 and hg19...
2,763
en
0.873616
from colored import fg, stylize, attr import requests as rq from yaspin import yaspin version = "0.4beta" greeting = stylize(""" ╭────────────────────────────────────────────────────────────────╮ │ Добро пожаловать в │ │ _____ _ _ ____ _...
eljur.py
5,600
yakuri354 - Для обозначения времени окон butukay - Я бы назвал это костылём } < Немогу удалить yakuri354 ~> ну я согласен, но а как ещё окна отображать Объект ученика Получение информации об ученике через запрос getrules
247
ru
0.994596
from datetime import date from dateutil.relativedelta import relativedelta from django.contrib.auth.models import Group from django.contrib.gis.geos import GEOSGeometry from django.core.mail import send_mail from ..api.get_table import * from ..utils.get_data import has_access, is_int, is_float from ..water_network.m...
code/haitiwater/apps/api/add_table.py
14,381
Creation Creation Create an invoice for individual outlets New random password
78
en
0.766852
# Author: Luke Bloy <bloyl@chop.edu> # # License: BSD (3-clause) import numpy as np import os.path as op import datetime import calendar from .utils import _load_mne_locs from ...utils import logger, warn from ..utils import _read_segments_file from ..base import BaseRaw from ..meas_info import _empty_info from ..con...
mne/io/artemis123/artemis123.py
10,473
Raw object from Artemis123 file. Parameters ---------- input_fname : str Path to the Artemis123 data file (ending in ``'.bin'``). preload : bool or str (default False) Preload data into memory for data manipulation and faster indexing. If True, the data will be preloaded into memory (fast, requires lar...
3,149
en
0.764032
"""The DAS response. The DAS response describes the attributes associated with a dataset and its variables. Together with the DDS the DAS response completely describes the metadata of a dataset, allowing it to be introspected and data to be downloaded. """ try: from functools import singledispatch except ImportE...
src/pydap/responses/das.py
4,733
The DAS response. Recursive function to build the DAS. Single dispatcher that generates the DAS response. Extract the type of a variable. This function tries to determine the DAP type of a Python variable using several methods. Returns the DAP type as a string. Map Python objects to the corresponding Opendap types. R...
790
en
0.826689
# -*- coding: utf-8 -*- # Generated by Django 1.10.5 on 2017-11-11 04:06 from __future__ import unicode_literals from django.conf import settings from django.db import migrations, models import django.db.models.deletion class Migration(migrations.Migration): initial = True dependencies = [ migratio...
seven23/models/terms/migrations/0001_initial.py
1,634
-*- coding: utf-8 -*- Generated by Django 1.10.5 on 2017-11-11 04:06
68
en
0.542058
# pypi from pyramid.httpexceptions import HTTPFound from pyramid.view import view_config # local from ..lib.handler import Handler from ...lib import db as lib_db from ...lib import errors from ...model import utils as model_utils # ============================================================================== cl...
src/peter_sslers/web/views_admin/operation.py
11,602
turns the request's `event_type=operations__update_recents__global` into an id. pypi local ============================================================================== - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - ...
1,187
it
0.437631
####################################################################### # Copyright (C) 2017 Shangtong Zhang(zhangshangtong.cpp@gmail.com) # # Permission given to modify the code as long as you keep this # # declaration at the top # ################################...
deep_rl/network/hyper_heads.py
4,473
Copyright (C) 2017 Shangtong Zhang(zhangshangtong.cpp@gmail.com) Permission given to modify the code as long as you keep this declaration at the top self.sample_model_seed() sample_z = sample_z.unsqueeze(0).repeat(self.features.config['n_gen'], 1, 1) dm_env retu...
444
en
0.753257
from django.utils import timezone from .forms import SchedDayForm class AdminCommonMixin(object): """ common methods for all admin class set default values for owner, date, etc """ def save_model(self, request, obj, form, change): try: obj.created_by = request.user exce...
schedules/mixins.py
2,241
common methods for all admin class set default values for owner, date, etc read queryset if is superuser or read owns objects read queryset if is superuser or read owns objects get from response change some custom action from post ej: '_custom_action' in request.POST: get from response change some custom action from po...
398
en
0.810766
# coding=utf-8 # Copyright 2020 The HuggingFace NLP Authors # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicabl...
datasets/daily_dialog/daily_dialog.py
6,224
DailyDialog: A Manually Labelled Multi-turn Dialogue Dataset Yields examples. Returns SplitGenerators. DailyDialog: A Manually Labelled Multi-turn Dialogue Dataset coding=utf-8 Copyright 2020 The HuggingFace NLP Authors Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except ...
1,126
en
0.793973
#!/usr/bin/env python # -*- coding: utf-8 -*- # Copyright © 2007 Free Software Foundation, Inc. <https://fsf.org/> # # Licensed under the GNU General Public License, version 3 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # https://jxs...
sfo_server/decorate.py
3,725
用于记录用户登录后访问网址行为的装饰器 :param func: :return: 验证是否登录 :param func: :return: 权限验证的前提是用户已经登录 权限验证 :param resources: 控制的资源对象 !/usr/bin/env python -*- coding: utf-8 -*- Copyright © 2007 Free Software Foundation, Inc. <https://fsf.org/> Licensed under the GNU General Public License, version 3 (the "License"); you may not use t...
763
en
0.758358
# Copyright 2013-2021 Lawrence Livermore National Security, LLC and other # Spack Project Developers. See the top-level COPYRIGHT file for details. # # SPDX-License-Identifier: (Apache-2.0 OR MIT) from spack import * import os class PyPybind11(CMakePackage): """pybind11 -- Seamless operability between C++11 and ...
var/spack/repos/builtin/packages/py-pybind11/package.py
3,865
pybind11 -- Seamless operability between C++11 and Python. pybind11 is a lightweight header-only library that exposes C++ types in Python and vice versa, mainly to create Python bindings of existing C++ code. Its goals and syntax are similar to the excellent Boost.Python library by David Abrahams: to minimize boilerpl...
772
en
0.843012
# Copyright 2015 The Chromium Authors. All rights reserved. # Use of this source code is governed by a BSD-style license that can be # found in the LICENSE file. """URL endpoint to allow Buildbot slaves to post data to the dashboard.""" import copy import json import logging import math import re from google.appengi...
dashboard/dashboard/add_point.py
28,460
URL endpoint to post data to the dashboard. An error indicating that a 400 response status should be returned. Returns the integer ID for a new Row. This method is also responsible for validating the input fields related to making the new row ID. Args: row_dict: A dictionary obtained from the input JSON. Returns: ...
13,430
en
0.853517
import spacy # 读取zh_core_web_md流程 nlp = spacy.load("zh_core_web_md") # 处理文本 doc = nlp("两只老虎跑得快") for token in doc: print(token.text) # 获取词符"老虎"的向量 laohu_vector = doc[2].vector print(laohu_vector)
exercises/zh/solution_02_09.py
252
读取zh_core_web_md流程 处理文本 获取词符"老虎"的向量
35
zh
0.87396
''' Second example calculation from: Smart, S. E., & Mazziotti, D. A. (2021). Lowering tomography costs in quantum simulation with a symmetry projected operator basis. Physical Review A, 103(1), 012420. https://doi.org/10.1103/PhysRevA.103.012420 Here we are simuatling a noisy quantum system using a tun...
examples/r2021_pra_tomography/02_pra_example_2.py
5,606
Second example calculation from: Smart, S. E., & Mazziotti, D. A. (2021). Lowering tomography costs in quantum simulation with a symmetry projected operator basis. Physical Review A, 103(1), 012420. https://doi.org/10.1103/PhysRevA.103.012420 Here we are simuatling a noisy quantum system using a tunable...
779
en
0.720822
# ---------------------------------------------------------------------------- # Imports: # ---------------------------------------------------------------------------- from dpa.action import Action, ActionError from dpa.ptask.action.sync import _PTaskSyncAction from dpa.location import current_location_code from dpa...
dpa/ptask/action/source.py
1,820
---------------------------------------------------------------------------- Imports: ---------------------------------------------------------------------------- ---------------------------------------------------------------------------- Classes: -----------------------------------------------------------------------...
536
en
0.216276
""" Module: 'collections' on esp32 1.11.0 """ # MCU: (sysname='esp32', nodename='esp32', release='1.11.0', version='v1.11 on 2019-05-29', machine='ESP32 module with ESP32') # Stubber: 1.3.2 class OrderedDict: '' def clear(): pass def copy(): pass def fromkeys(): pass def ...
stubs/micropython-esp32-1_11/collections.py
678
Module: 'collections' on esp32 1.11.0 MCU: (sysname='esp32', nodename='esp32', release='1.11.0', version='v1.11 on 2019-05-29', machine='ESP32 module with ESP32') Stubber: 1.3.2
179
en
0.166619
import os import lcd from Maix import GPIO from board import board_info from fpioa_manager import fm # import uos S_IFDIR = 0o040000 # directory # noinspection PyPep8Naming def S_IFMT(mode): """Return the portion of the file's mode that describes the file type. """ return mode & 0o170000 # noin...
others/explorer_standalone.py
3,683
Return the portion of the file's mode that describes the file type. Return True if mode is from a directory. import uos directory noinspection PyPep8Naming noinspection PyPep8Naming gc.collect() gc.collect() gc.collect() Rotate the lcd 180deg fm.register(board_info.BUTTON_A, fm.fpioa.GPIOHS21, force=True)
309
en
0.365742
from tytus.parser.team21.Analisis_Ascendente.Instrucciones.Expresiones.Expresion import Expresion from tytus.parser.team21.Analisis_Ascendente.Instrucciones.expresion import Primitivo from tytus.parser.team21.Analisis_Ascendente.Instrucciones.instruccion import Instruccion from tytus.parser.team21.Analisis_Ascendente.s...
parser/team21/Analisis_Ascendente/Instrucciones/Insert/insert.py
13,476
INSERT INTO nombre de la bd se busca el simbolo y por lo tanto se pide el entorno de la bd print(lista_valores[index].valor) print(date.fromisoformat(lista_valores[index].valor)) print(isinstance(date.fromisoformat(lista_valores[index].valor),date)) print('DATE' in str(lista_tabla.get(campo).tipo).upper())t...
394
es
0.362164
from django.db import models from osoba.models import ServiseID, Company from django.utils.translation import gettext as _ class SHPK(models.Model): name = models.CharField(max_length=512, verbose_name=_('Name')) short_name = models.CharField(max_length=512, verbose_name=_('Short name')) def __str__(self...
zampol/staff/models.py
16,122
Штаткапорядковий номер в штатціwtf?wtf?wtf? Field name made lowercase. Field renamed to remove unsuitable characters. Field name made lowercase. Field renamed to remove unsuitable characters. Field name made lowercase. Field renamed to remove unsuitable characters. Field name made lowercase. Field renamed to remove uns...
597
en
0.788995
# -*- coding: utf-8 -*- """Define general test helper attributes and utilities.""" import os import sys TRAVIS=os.getenv("TRAVIS_PYTHON_VERSION") is not None PYTHON_VERSION = "%s.%s" % (sys.version_info.major, sys.version_info.minor) TMP_DIR="/tmp"
tests/test_helper.py
250
Define general test helper attributes and utilities. -*- coding: utf-8 -*-
76
en
0.700675
import ipdb import medis.speckle_nulling.sn_hardware as hardware import medis.speckle_nulling.sn_preprocessing as pre import numpy as np import os import astropy.io.fits as pf import medis.speckle_nulling.sn_filehandling as flh from configobj import ConfigObj def build_median(imagelist, outputfile = None): """Tak...
medis/speckle_nulling/take_flats_and_darks_old.py
5,251
data= hdulist[0].datadata = pre.combine_quadrants(data)filesused.append(image+'; ')XXXX fix flat fieldingbp = build_badpixmask(targ_bkgd-cal_bkgd, outputfile = os.path.join(outputdir,'badpix.fits'))
204
en
0.335031
class Solution: def canPlaceFlowers(self, flowerbed, n: int) -> bool: # Even with an empty list, the maximum amount we can place # is len(flowerbed) // 2 (+ 1 if odd, +0 if even) length = len(flowerbed) if n > (length // 2) + 1 * (length & 1): return False # bail ...
Python/Algorithms/605.py
1,734
Even with an empty list, the maximum amount we can place is len(flowerbed) // 2 (+ 1 if odd, +0 if even) bail early. fits everywhere. bail early if [0]. Start counting from 2 pos if [_, 0, ...] but decrement n if [0, 0, ...] Start counting from 3rd pos if [_, 1, ...] Go through the flower bed and check adjacent positio...
521
en
0.896816
def belong(in_list1: list, in_list2: list) -> list: """ Check wheter or not all the element in list in_list1 belong into in_list2 :param in_list1: the source list :param in_list2: the target list where to find the element in in_list1 :return: return True if the statement is verified otherwise return...
Python/List/14.belong.py
471
Check wheter or not all the element in list in_list1 belong into in_list2 :param in_list1: the source list :param in_list2: the target list where to find the element in in_list1 :return: return True if the statement is verified otherwise return False
250
en
0.533722
# # PySNMP MIB module CISCO-WAN-FR-CONN-MIB (http://snmplabs.com/pysmi) # ASN.1 source file:///Users/davwang4/Dev/mibs.snmplabs.com/asn1/CISCO-WAN-FR-CONN-MIB # Produced by pysmi-0.3.4 at Wed May 1 12:20:25 2019 # On host DAVWANG4-M-1475 platform Darwin version 18.5.0 by user davwang4 # Using Python version 3.7.3 (def...
pysnmp-with-texts/CISCO-WAN-FR-CONN-MIB.py
86,389
PySNMP MIB module CISCO-WAN-FR-CONN-MIB (http://snmplabs.com/pysmi) ASN.1 source file:///Users/davwang4/Dev/mibs.snmplabs.com/asn1/CISCO-WAN-FR-CONN-MIB Produced by pysmi-0.3.4 at Wed May 1 12:20:25 2019 On host DAVWANG4-M-1475 platform Darwin version 18.5.0 by user davwang4 Using Python version 3.7.3 (default, Mar 27...
336
en
0.442734
""" Adds troposphere methods for adding scaling to a cluster """ from troposphere.awslambda import Function, Code, Environment, Permission from troposphere import Ref, Sub, GetAtt from troposphere.iam import Role, Policy from troposphere.events import Target, Rule from troposphere.ssm import Parameter from ecs_cluster_...
ecs_cluster_deployer/compute/lambda_scaler.py
4,805
Add scaling resources to a cluster Adds troposphere methods for adding scaling to a cluster
92
en
0.651314
#!/usr/bin/python from ansible.module_utils.basic import AnsibleModule from ansible.module_utils.helpers import ModuleRes, CartridgeException, cartridge_errcodes from ansible.module_utils.helpers import get_control_console from ansible.module_utils.helpers import dynamic_box_cfg_params import os argument_spec = { ...
library/cartridge_needs_restart.py
5,931
!/usr/bin/python check new conf keys check old conf keys check if instance was not started yet check if application code was updated check if instance config was changed (except memtx_memory) check if default config was changed (except memtx_memory) This code is ran after attempt to change parameter in runtime If curre...
423
en
0.888001
import sys, os sys.path.append('../../') #get rid of this at some point with central test script or when package is built os.chdir('../../') import MSI.simulations.instruments.shock_tube as st import MSI.cti_core.cti_processor as pr import MSI.optimization.matrix_loader as ml import MSI.optimization.opt_runner as opt ...
tests/shock_tube_optimization_shell_six_paramter_fit_test_modified.py
22,491
get rid of this at some point with central test script or when package is builtrate_constant_target_value_data = 'burke_target_value_single_reactions.csv'this would be an empty string '' if you do not want to include it master_index = [2,3,4,5,6,7]this could be 'On'start here need to fix this and return _s_matrix and y...
1,221
en
0.546867
# Copyright 2020 Huawei Technologies Co., Ltd # # 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...
mindspore/ops/_op_impl/aicpu/stack_push_pop.py
2,809
StackDestroy aicpu register StackInit aicpu register StackPop aicpu register StackPush aicpu register StackPush and StackPop op Copyright 2020 Huawei Technologies Co., Ltd 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 ...
768
en
0.780292
from tree import TreeNode def min_depth(self, root): """ :type root: TreeNode :rtype: int """ if root is None: return 0 if root.left is not None or root.right is not None: return max(self.minDepth(root.left), self.minDepth(root.right))+1 return min(self.minDepth(root.left),...
algorithms/tree/min_height.py
1,318
:type root: TreeNode :rtype: int iterative
44
en
0.441816
# This Source Code Form is subject to the terms of the Mozilla Public # License, v. 2.0. If a copy of the MPL was not distributed with this # file, You can obtain one at http://mozilla.org/MPL/2.0/. import os from django.core.management.base import BaseCommand from django.conf import settings from lib.l10n_utils.get...
lib/l10n_utils/management/commands/l10n_merge.py
867
This Source Code Form is subject to the terms of the Mozilla Public License, v. 2.0. If a copy of the MPL was not distributed with this file, You can obtain one at http://mozilla.org/MPL/2.0/. Positional arguments
213
en
0.89557
#-*- coding: utf-8 -*- from DBP.models import Base, session from DBP.models.user import User from sqlalchemy.orm import class_mapper from sqlalchemy.inspection import inspect from sqlalchemy.sql import func from sqlalchemy.dialects.mysql import INTEGER,VARCHAR, DATETIME from datetime import datetime import csv import...
DBP/models/instance.py
6,647
-*- coding: utf-8 -*-
21
en
0.767281
# Copyright (C) 2017 Red Hat, Inc. # # 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 writ...
roles/write-devstack-local-conf/library/test.py
8,942
Test that LIBS_FROM_GIT is auto-generated Test that LIBS_FROM_GIT can be overridden Test that plugins with circular dependencies fail Test that plugins with dependencies work Test that plugins without dependencies work Copyright (C) 2017 Red Hat, Inc. Licensed under the Apache License, Version 2.0 (the "License"); yo...
1,035
en
0.876369
# Copyright 2018 Google LLC # # 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, ...
sdk/python/kfp/compiler/_k8s_helper.py
7,990
Kubernetes Helper _create_k8s_job creates a kubernetes job based on the yaml spec _delete_k8s_job deletes a pod _wait_for_k8s_job waits for the job to complete Builds a JSON K8s object. If obj is None, return None. If obj is str, int, long, float, bool, return directly. If obj is datetime.datetime, datetime.date ...
1,663
en
0.753673
"""Webhook tests for mobile_app.""" import logging import pytest from homeassistant.components.camera import SUPPORT_STREAM as CAMERA_SUPPORT_STREAM from homeassistant.components.mobile_app.const import CONF_SECRET from homeassistant.components.zone import DOMAIN as ZONE_DOMAIN from homeassistant.const import CONF_WE...
tests/components/mobile_app/test_webhook.py
13,006
Return a decrypted payload given a key and a string of encrypted data. Return a encrypted payload given a key and dictionary of data. Helepr to store events. Webhook tests for mobile_app. Default frontend theme color
218
en
0.648925
# (C) Copyright 2016 Hewlett Packard Enterprise Development LP # Copyright 2016 FUJITSU LIMITED # 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 #...
monasca_notification/common/utils.py
5,281
Initialize an Offline Connection object. >>> monascastatsd = MonascaStatsd() :name: the name for this client. Everything sent by this client will be prefixed by name :param host: the host of the MonascaStatsd server. :param port: the port of the MonascaStatsd server. :param max_buffer_size: Maximum number of met...
1,210
en
0.854416
#!/usr/bin/env python3 # -*- coding: utf-8 -*- __author__ = "Christian Heider Nielsen" __doc__ = r""" """ import h5py import torch import torch.utils import torch.utils.data from .h5_mnist_data import download_binary_mnist def load_binary_mnist(cfg, **kwcfg): fname = cfg.data_dir / "binary_mnist.h5...
samples/regression/vae/flow/data_loader.py
1,163
!/usr/bin/env python3 -*- coding: utf-8 -*-
43
fr
0.304089
import json import os # set working directory def gen_json(t): print(os.getcwd()) # read log file with open('Screenshots/Screenshoot_meta.txt', 'r') as f: log = f.read() data = {"camera_angle_x": 0.6911112070083618} frames = [] line_cnt = 0 for line in log.split('\n...
my_src/meta_json.py
802
set working directory read log file %% %%
41
en
0.767718
# This program and the accompanying materials are made available under the # terms of the Mozilla Public License v2.0 which accompanies this distribution, # and is available at https://www.mozilla.org/en-US/MPL/2.0/ from pyincore.utils.cgeoutputprocess import CGEOutputProcess import os PYINCOREPATH = "path-to-pyincor...
tests/pyincore/utils/test_csvoutputjson.py
1,503
This program and the accompanying materials are made available under the terms of the Mozilla Public License v2.0 which accompanies this distribution, and is available at https://www.mozilla.org/en-US/MPL/2.0/ run the JoplinCGE analysis first to get results, csv files
268
en
0.875409
import numpy as np import matplotlib.pyplot as plt import time from IPython import display # Implemented methods methods = ['DynProg', 'ValIter']; # Some colours LIGHT_RED = '#FFC4CC'; LIGHT_GREEN = '#95FD99'; BLACK = '#000000'; WHITE = '#FFFFFF'; LIGHT_PURPLE = '#E8D0FF'; LIGHT_ORANGE = '#FAE0C3'; ...
Assignment 2/robbing_banks.py
16,523
Constructor of the environment town_map. Makes a step in the town_map, given a current position and an action. If the action STAY or an inadmissible action is used, the robber stays in place. :return integer next_cell corresponding to position (x,y) x (x,y) on the town_map that agent transitions to. Input: Th...
3,782
en
0.776706
# -*- coding: utf-8 -*- # Copyright 2018, IBM. # # This source code is licensed under the Apache License, Version 2.0 found in # the LICENSE.txt file in the root directory of this source tree. # pylint: disable=invalid-name, bad-continuation """Provider for local backends.""" import logging from qiskit._qiskiterror...
qiskit/backends/local/localprovider.py
4,407
Provider for local backends. Return an instance of a backend from its class. Args: backend_cls (class): Backend class. Returns: BaseBackend: a backend instance. Raises: QISKitError: if the backend could not be instantiated or does not provide a valid configuration containing a name. Return the loca...
1,237
en
0.803416
# -*- coding: utf-8 -*- """ product.py Implementing Add listing wizard for downstream modules: * In the __setup__ method of `product.listing.add.start` in downstream module, add the type as a valid channel type. Since this is non trivial a convenience method `add_source` is provided which will add the source ...
product.py
11,959
Add product Channel Listing Wizard Add listing form start Product Product - Sale Channel This model keeps a record of a product's association with Sale Channels. A product can be listed on multiple marketplaces Product Template Template - Sale Channel This model keeps a record of a template's association with Sale Chan...
2,396
en
0.866166