max_stars_repo_path stringlengths 4 286 | max_stars_repo_name stringlengths 5 119 | max_stars_count int64 0 191k | id stringlengths 1 7 | content stringlengths 6 1.03M | content_cleaned stringlengths 6 1.03M | language stringclasses 111
values | language_score float64 0.03 1 | comments stringlengths 0 556k | edu_score float64 0.32 5.03 | edu_int_score int64 0 5 |
|---|---|---|---|---|---|---|---|---|---|---|
pyntcloud/geometry/__init__.py | BrianPugh/pyntcloud | 5 | 6632351 |
"""
HAKUNA MATATA
"""
from .models.plane import Plane
from .models.sphere import Sphere
__all__ = ["models.plane.Plane"]
|
"""
HAKUNA MATATA
"""
from .models.plane import Plane
from .models.sphere import Sphere
__all__ = ["models.plane.Plane"]
| ru | 0.14232 | HAKUNA MATATA | 1.248899 | 1 |
var/spack/repos/builtin/packages/r-makecdfenv/package.py | HaochengLIU/spack | 2 | 6632352 | # Copyright 2013-2018 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 *
class RMakecdfenv(RPackage):
"""This package has two functions. One reads a Affymetrix
chip ... | # Copyright 2013-2018 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 *
class RMakecdfenv(RPackage):
"""This package has two functions. One reads a Affymetrix
chip ... | en | 0.783656 | # Copyright 2013-2018 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) This package has two functions. One reads a Affymetrix chip description file (CDF) and creates a hash table environment... | 1.676272 | 2 |
datasets/dealconll.py | anonymous-summa/MLT-ABSum | 0 | 6632353 | # _*_coding: utf-8_*_
import json
import pyconll
total_pos = []
total_relation = []
for file in ["train","valid","test"]:
data = pyconll.load_from_file(file + ".conll")
article = []
for sents in data:
text, head, pos, relations = [], [], [], []
for token in sents:
text.append... | # _*_coding: utf-8_*_
import json
import pyconll
total_pos = []
total_relation = []
for file in ["train","valid","test"]:
data = pyconll.load_from_file(file + ".conll")
article = []
for sents in data:
text, head, pos, relations = [], [], [], []
for token in sents:
text.append... | en | 0.740028 | # _*_coding: utf-8_*_ | 2.530401 | 3 |
challenges/linked_list/add_two_numbers_list.py | lukasmartinelli/sharpen | 13 | 6632354 | def zip_longest_linked_lists(a, b):
default = ListNode(0)
while a or b:
if a and b:
yield a, b
a = a.next
b = b.next
elif a:
yield a, default
a = a.next
elif b:
yield default, b
b = b.next
def add_numbe... | def zip_longest_linked_lists(a, b):
default = ListNode(0)
while a or b:
if a and b:
yield a, b
a = a.next
b = b.next
elif a:
yield a, default
a = a.next
elif b:
yield default, b
b = b.next
def add_numbe... | none | 1 | 3.565694 | 4 | |
rdflib/util.py | donbowman/rdflib | 0 | 6632355 | """
Some utility functions.
Miscellaneous utilities
* list2set
* first
* uniq
* more_than
Term characterisation and generation
* to_term
* from_n3
Date/time utilities
* date_time
* parse_date_time
Statement and component type checkers
* check_context
* check_subject
* check_predicate
* check_object
* check_stat... | """
Some utility functions.
Miscellaneous utilities
* list2set
* first
* uniq
* more_than
Term characterisation and generation
* to_term
* from_n3
Date/time utilities
* date_time
* parse_date_time
Statement and component type checkers
* check_context
* check_subject
* check_predicate
* check_object
* check_stat... | en | 0.549657 | Some utility functions. Miscellaneous utilities * list2set * first * uniq * more_than Term characterisation and generation * to_term * from_n3 Date/time utilities * date_time * parse_date_time Statement and component type checkers * check_context * check_subject * check_predicate * check_object * check_statemen... | 2.785078 | 3 |
parkings/tests/api/conftest.py | dvainio/parkkihubi | 0 | 6632356 | <filename>parkings/tests/api/conftest.py
import pytest
from rest_framework.test import APIClient
from .utils import token_authenticate
@pytest.fixture(autouse=True)
def no_more_mark_django_db(transactional_db):
pass
@pytest.fixture
def api_client():
return APIClient()
@pytest.fixture
def monitoring_api_c... | <filename>parkings/tests/api/conftest.py
import pytest
from rest_framework.test import APIClient
from .utils import token_authenticate
@pytest.fixture(autouse=True)
def no_more_mark_django_db(transactional_db):
pass
@pytest.fixture
def api_client():
return APIClient()
@pytest.fixture
def monitoring_api_c... | en | 0.969988 | # don't use the same user as operator_api_client | 1.903156 | 2 |
LTSpiceGenerator.py | sventhijssen/compact | 2 | 6632357 | from MemristorCrossbar import MemristorCrossbar
class LTSpiceGenerator:
@staticmethod
def write_circuit(crossbar: MemristorCrossbar):
file_name = 'circuit.cir'
r_out = 100
with open(file_name, 'w') as f:
f.write('* Circuit analysis based on Yakopcic\n')
f.wri... | from MemristorCrossbar import MemristorCrossbar
class LTSpiceGenerator:
@staticmethod
def write_circuit(crossbar: MemristorCrossbar):
file_name = 'circuit.cir'
r_out = 100
with open(file_name, 'w') as f:
f.write('* Circuit analysis based on Yakopcic\n')
f.wri... | en | 0.163387 | # Begin memristor crossbar # End memristor crossbar # f.write('.tran 0.1ms startup\n') | 2.689058 | 3 |
application.py | rahulbansal16/vop | 0 | 6632358 | import os
from flask import Flask, url_for
from flask_restplus import Api, Resource, fields
from services.reviewService import insert_review
from services.userService import UserNotFoundException, signup_user, UserAlreadyExistException, \
InvalidLoginDetailsException, login_user
app = Flask(__name__)
if os.envi... | import os
from flask import Flask, url_for
from flask_restplus import Api, Resource, fields
from services.reviewService import insert_review
from services.userService import UserNotFoundException, signup_user, UserAlreadyExistException, \
InvalidLoginDetailsException, login_user
app = Flask(__name__)
if os.envi... | en | 0.322763 | # @app.errorhandler(Exception) # @app.errorhandler(RequiredParametersMissingException) # @app.errorhandler(ReviewAlreadyExistException) # @marshal_with(ErrorSchema, 500) # model = api.model('ReviewModel', { # 'name': fields.String, # 'address': fields.String, # 'date_updated': fields.DateTime(dt_format='rfc... | 2.342144 | 2 |
views/__init__.py | Andrerodrigues0018/LGPD-compliant-website | 0 | 6632359 | <reponame>Andrerodrigues0018/LGPD-compliant-website
from .account import *
from .eventhooks import *
| from .account import *
from .eventhooks import * | none | 1 | 1.080734 | 1 | |
simulation/models/env_db/onboarding_simple.py | LeonardII/KitCarFork | 13 | 6632360 | """A simple road for the onboarding task."""
from simulation.utils.road.road import Road # Definition of the road class
from simulation.utils.road.sections import Intersection, StraightRoad
road = Road()
road.append(StraightRoad())
road.append(StraightRoad(length=2))
road.append(Intersection())
road.append(StraightR... | """A simple road for the onboarding task."""
from simulation.utils.road.road import Road # Definition of the road class
from simulation.utils.road.sections import Intersection, StraightRoad
road = Road()
road.append(StraightRoad())
road.append(StraightRoad(length=2))
road.append(Intersection())
road.append(StraightR... | en | 0.752869 | A simple road for the onboarding task. # Definition of the road class | 2.583316 | 3 |
core/utils/help.py | Thirio27/Pemgu-Bot | 1 | 6632361 | <filename>core/utils/help.py
import discord, contextlib
from discord.ext import commands
import core.views.helpview as hv
class MinimalHelp(commands.MinimalHelpCommand):
def __init__(self):
self.emojis = {
"Anime": "🍘",
"Fun": "😹",
"Game": "🎮",
"Internet":... | <filename>core/utils/help.py
import discord, contextlib
from discord.ext import commands
import core.views.helpview as hv
class MinimalHelp(commands.MinimalHelpCommand):
def __init__(self):
self.emojis = {
"Anime": "🍘",
"Fun": "😹",
"Game": "🎮",
"Internet":... | en | 0.67164 | # Help Main # Help Cog # Help Command # Help Group # Help Error | 2.442163 | 2 |
tests/scanner/audit/iap_rules_engine_test.py | mcunha/forseti-security | 1 | 6632362 | # Copyright 2017 The Forseti Security 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 ap... | # Copyright 2017 The Forseti Security 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 ap... | en | 0.897965 | # Copyright 2017 The Forseti Security 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 ap... | 1.722324 | 2 |
app/src/utils/visualizations.py | Sayar1106/Heart-Disease-Web-Application | 4 | 6632363 | import streamlit as st
import plotly.express as px
def plot_single_feature(df, feature):
"""
This function will be used to plot a single feature.
Every feature's type will be first evaluated and then the
feature's distribution will be graphed accordingly.
Rules for single variable visualizations:... | import streamlit as st
import plotly.express as px
def plot_single_feature(df, feature):
"""
This function will be used to plot a single feature.
Every feature's type will be first evaluated and then the
feature's distribution will be graphed accordingly.
Rules for single variable visualizations:... | en | 0.801653 | This function will be used to plot a single feature. Every feature's type will be first evaluated and then the feature's distribution will be graphed accordingly. Rules for single variable visualizations: * Numerical variables will be represented by histograms. * The visualizations for numerical v... | 4.28752 | 4 |
cbuildbot/cbuildbot_run_unittest.py | hustwei/chromite | 0 | 6632364 | <reponame>hustwei/chromite
# Copyright (c) 2013 The Chromium OS Authors. All rights reserved.
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
"""Test the cbuildbot_run module."""
from __future__ import print_function
import cPickle
import os
import mock
import ti... | # Copyright (c) 2013 The Chromium OS Authors. All rights reserved.
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
"""Test the cbuildbot_run module."""
from __future__ import print_function
import cPickle
import os
import mock
import time
from chromite.cbuildbot... | en | 0.7447 | # Copyright (c) 2013 The Chromium OS Authors. All rights reserved. # Use of this source code is governed by a BSD-style license that can be # found in the LICENSE file. Test the cbuildbot_run module. # pylint: disable=protected-access Extend DEFAULT_OPTIONS with keys/values in kwargs. Extend DEFAULT_CONFIG with keys/va... | 1.783946 | 2 |
code.py | lekhabajpai/nlp-intro | 0 | 6632365 | # --------------
# Importing Necessary libraries
from sklearn.datasets import fetch_20newsgroups
from pprint import pprint
import warnings
warnings.filterwarnings("ignore")
import numpy as np
import pandas as pd
from sklearn.naive_bayes import MultinomialNB
from sklearn.metrics import accuracy_score , f1_score
... | # --------------
# Importing Necessary libraries
from sklearn.datasets import fetch_20newsgroups
from pprint import pprint
import warnings
warnings.filterwarnings("ignore")
import numpy as np
import pandas as pd
from sklearn.naive_bayes import MultinomialNB
from sklearn.metrics import accuracy_score , f1_score
... | en | 0.622246 | # -------------- # Importing Necessary libraries # Load the 20newsgroups dataset #pprint((list(df.target_names))) #Create a list of 4 newsgroup and fetch it using function fetch_20newsgroups #Use TfidfVectorizer on train data and find out the Number of Non-Zero components per sample. #Use TfidfVectorizer on test data a... | 3.028801 | 3 |
mytb/importlib/__init__.py | quentinql/mytb | 0 | 6632366 | #!/usr/bin/env python
# #############################################################################
# Copyright : (C) 2017-2021 by Teledomic.eu All rights reserved
#
# Name: mytb.importlib
#
# Description: helper for locating / importing modules
#
# ###########################################################... | #!/usr/bin/env python
# #############################################################################
# Copyright : (C) 2017-2021 by Teledomic.eu All rights reserved
#
# Name: mytb.importlib
#
# Description: helper for locating / importing modules
#
# ###########################################################... | en | 0.372383 | #!/usr/bin/env python # ############################################################################# # Copyright : (C) 2017-2021 by Teledomic.eu All rights reserved # # Name: mytb.importlib # # Description: helper for locating / importing modules # # ###########################################################... | 3.030757 | 3 |
GNU-Radio/am_receiver.py | IgrikXD/SDR-Exp | 7 | 6632367 | <gh_stars>1-10
#!/usr/bin/env python2
# -*- coding: utf-8 -*-
##################################################
# GNU Radio Python Flow Graph
# Title: AM Receiver
# Author: <NAME>
# GNU Radio version: 3.7.13.5
##################################################
if __name__ == '__main__':
import ctypes
import s... | #!/usr/bin/env python2
# -*- coding: utf-8 -*-
##################################################
# GNU Radio Python Flow Graph
# Title: AM Receiver
# Author: <NAME>
# GNU Radio version: 3.7.13.5
##################################################
if __name__ == '__main__':
import ctypes
import sys
if sys.p... | de | 0.678998 | #!/usr/bin/env python2 # -*- coding: utf-8 -*- ################################################## # GNU Radio Python Flow Graph # Title: AM Receiver # Author: <NAME> # GNU Radio version: 3.7.13.5 ################################################## ################################################## # Variables ##########... | 2.141239 | 2 |
pytext/models/embeddings/char_embedding.py | baronrustamov/pytext | 1 | 6632368 | <gh_stars>1-10
#!/usr/bin/env python3
# Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved
from typing import List, Optional
import torch
import torch.nn as nn
import torch.nn.functional as F
from pytext.config.field_config import CharFeatConfig
from pytext.data.utils import Vocabulary
from pytext.f... | #!/usr/bin/env python3
# Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved
from typing import List, Optional
import torch
import torch.nn as nn
import torch.nn.functional as F
from pytext.config.field_config import CharFeatConfig
from pytext.data.utils import Vocabulary
from pytext.fields import Fi... | en | 0.726061 | #!/usr/bin/env python3 # Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved Module for character aware CNN embeddings for tokens. It uses convolution followed by max-pooling over character embeddings to obtain an embedding vector for each token. Implementation is loosely based on https://... | 2.562251 | 3 |
orquestador/nyc_ccci_etl/orchestrator_tasks/load_bias_fairness_metadata.py | gemathus/dpa-2020 | 1 | 6632369 | import json
import luigi
from datetime import datetime
from luigi.contrib.postgres import CopyToTable
from nyc_ccci_etl.commons.configuration import get_database_connection_parameters
from nyc_ccci_etl.utils.get_os_user import get_os_user
from nyc_ccci_etl.utils.get_current_ip import get_current_ip
from nyc_ccci_etl.... | import json
import luigi
from datetime import datetime
from luigi.contrib.postgres import CopyToTable
from nyc_ccci_etl.commons.configuration import get_database_connection_parameters
from nyc_ccci_etl.utils.get_os_user import get_os_user
from nyc_ccci_etl.utils.get_current_ip import get_current_ip
from nyc_ccci_etl.... | none | 1 | 1.995291 | 2 | |
ramp_experiment/__main__.py | Deric-W/Supratix_experiment | 0 | 6632370 | #!/usr/bin/python3
# run server (dont forget to set the pins 3 and 2 to GPIO mode and enable PWM)
import logging
import signal
import time
from argparse import ArgumentParser
from typing import NamedTuple, Optional
from configparser import ConfigParser, NoOptionError
from contextlib import ExitStack
from enum import E... | #!/usr/bin/python3
# run server (dont forget to set the pins 3 and 2 to GPIO mode and enable PWM)
import logging
import signal
import time
from argparse import ArgumentParser
from typing import NamedTuple, Optional
from configparser import ConfigParser, NoOptionError
from contextlib import ExitStack
from enum import E... | en | 0.809468 | #!/usr/bin/python3 # run server (dont forget to set the pins 3 and 2 to GPIO mode and enable PWM) named tuple containing the mqtt topics logelevels as strings convert variant to log level class enforcing a certain time period between actions init with period in seconds wait remaining time, return time spend sleeping ch... | 2.637961 | 3 |
flambe/cluster/ssh.py | axel-sirota/flambe | 148 | 6632371 | """Implementation of the Manager for SSH hosts"""
import logging
from typing import List, TypeVar, Union, Optional
from flambe.cluster import instance
from flambe.cluster.cluster import Cluster, FactoryInsT
import os
logger = logging.getLogger(__name__)
FactoryT = TypeVar("FactoryT", instance.CPUFactoryInstance,... | """Implementation of the Manager for SSH hosts"""
import logging
from typing import List, TypeVar, Union, Optional
from flambe.cluster import instance
from flambe.cluster.cluster import Cluster, FactoryInsT
import os
logger = logging.getLogger(__name__)
FactoryT = TypeVar("FactoryT", instance.CPUFactoryInstance,... | en | 0.886695 | Implementation of the Manager for SSH hosts The SSH Manager needs to be used when having running instances. For example when having on-prem hardware or just a couple of AWS EC2 instances running. When using this cluster, the user needs to specify the IPs of the machines to use, both the public one and... | 2.936145 | 3 |
nerds/examples/GMB/read_data.py | elsevierlabs-os/nerds | 19 | 6632372 | <gh_stars>10-100
import csv
from nerds.core.model.input.document import Document
from nerds.util.convert import transform_bio_tags_to_annotated_document
PATH_TO_FILE = "train.csv"
def read_kaggle_data():
sentences = []
pos = []
tag = []
tmp_sentence = []
tmp_pos = []
tmp_tag = []
with... | import csv
from nerds.core.model.input.document import Document
from nerds.util.convert import transform_bio_tags_to_annotated_document
PATH_TO_FILE = "train.csv"
def read_kaggle_data():
sentences = []
pos = []
tag = []
tmp_sentence = []
tmp_pos = []
tmp_tag = []
with open(PATH_TO_FIL... | en | 0.162013 | # Ignore the header | 2.864253 | 3 |
mc_states/tests/unit/modules/memcached_tests.py | makinacorpus/makina-states | 18 | 6632373 | #!/usr/bin/env python
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
import unittest
from .. import base
from mc_states.api import invalidate_memoize_cache
class TestCase(base.ModuleCase):
def test_settings(self):
invalidate_memoize_cache('loc... | #!/usr/bin/env python
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
import unittest
from .. import base
from mc_states.api import invalidate_memoize_cache
class TestCase(base.ModuleCase):
def test_settings(self):
invalidate_memoize_cache('loc... | fr | 0.181584 | #!/usr/bin/env python # vim:set et sts=4 ts=4 tw=80: | 1.978644 | 2 |
setup.py | nuga99/tsudo | 6 | 6632374 | import setuptools
with open('README.md') as readme_file:
readme = readme_file.read()
setuptools.setup(
name='tsudo',
python_requires='>3',
version='0.0.5',
author='<NAME>',
author_email='<EMAIL>',
description='Tsundere wrapper for sudo command.',
long_descri... | import setuptools
with open('README.md') as readme_file:
readme = readme_file.read()
setuptools.setup(
name='tsudo',
python_requires='>3',
version='0.0.5',
author='<NAME>',
author_email='<EMAIL>',
description='Tsundere wrapper for sudo command.',
long_descri... | none | 1 | 1.356857 | 1 | |
pdms/qtum_bridge/R8Blockchain/qtumblockchain.py | chris0203/pmes | 0 | 6632375 | from bitcoinrpc.authproxy import AuthServiceProxy
from hashlib import sha256
from R8Blockchain.blockchain_handler import BlockchainHandler
import codecs
import logging
class QtumBlockchain(BlockchainHandler):
def __init__(self, qtum_rpc):
self.qtum_rpc = qtum_rpc
self.decode_hex = codecs.getdecod... | from bitcoinrpc.authproxy import AuthServiceProxy
from hashlib import sha256
from R8Blockchain.blockchain_handler import BlockchainHandler
import codecs
import logging
class QtumBlockchain(BlockchainHandler):
def __init__(self, qtum_rpc):
self.qtum_rpc = qtum_rpc
self.decode_hex = codecs.getdecod... | none | 1 | 2.380917 | 2 | |
backend/bot/modules/tosurnament/bracket/qualifiers_spreadsheet.py | SpartanPlume/Tosurnament | 7 | 6632376 | """Contains all qualifiers spreadsheet settings commands related to Tosurnament."""
from discord.ext import commands
from bot.modules.tosurnament import module as tosurnament
from common.databases.tosurnament.spreadsheets.qualifiers_spreadsheet import QualifiersSpreadsheet
from common.api import spreadsheet as sp... | """Contains all qualifiers spreadsheet settings commands related to Tosurnament."""
from discord.ext import commands
from bot.modules.tosurnament import module as tosurnament
from common.databases.tosurnament.spreadsheets.qualifiers_spreadsheet import QualifiersSpreadsheet
from common.api import spreadsheet as sp... | en | 0.733109 | Contains all qualifiers spreadsheet settings commands related to Tosurnament. Tosurnament qualifiers spreadsheet settings commands. Check function called before any command of the cog. Sets the qualifiers spreadsheet. Puts the input values into the corresponding bracket. Puts the input values into the corresponding bra... | 2.454282 | 2 |
cvpy42.py | L3ndry/guanabara-python | 0 | 6632377 | <filename>cvpy42.py
segmento1 = float(input("Primeiro segmento: "))
segmento2 = float(input("Segundo segmento: "))
segmento3 = float(input("Terceiro segmento: "))
if segmento1 < segmento2 + segmento3 and segmento2 < segmento1 + segmento3 and segmento3 < segmento1 + segmento2:
if segmento1 == segmento2 == segm... | <filename>cvpy42.py
segmento1 = float(input("Primeiro segmento: "))
segmento2 = float(input("Segundo segmento: "))
segmento3 = float(input("Terceiro segmento: "))
if segmento1 < segmento2 + segmento3 and segmento2 < segmento1 + segmento3 and segmento3 < segmento1 + segmento2:
if segmento1 == segmento2 == segm... | none | 1 | 3.757558 | 4 | |
setup.py | kentsanggds/pivotalclient | 0 | 6632378 | from distutils.core import setup
VERSION = '0.4'
setup(
name='pivotalclient',
packages=['pivotalclient'],
version=VERSION,
description='A Python pivotal tracker client.',
author='<NAME>, CloudBolt Software',
author_email='<EMAIL>',
url='https://github.com/CloudBoltSoftware/pivotalclient',
... | from distutils.core import setup
VERSION = '0.4'
setup(
name='pivotalclient',
packages=['pivotalclient'],
version=VERSION,
description='A Python pivotal tracker client.',
author='<NAME>, CloudBolt Software',
author_email='<EMAIL>',
url='https://github.com/CloudBoltSoftware/pivotalclient',
... | none | 1 | 1.195679 | 1 | |
sdk/python/core/tests/test_sanity_filters.py | xulleon/ydk-gen | 0 | 6632379 | <reponame>xulleon/ydk-gen
# ----------------------------------------------------------------
# Copyright 2016 Cisco Systems
#
# 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.... | # ----------------------------------------------------------------
# Copyright 2016 Cisco Systems
#
# 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/LICENS... | en | 0.742718 | # ---------------------------------------------------------------- # Copyright 2016 Cisco Systems # # 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/LICENS... | 1.765766 | 2 |
ccapi/requests/products/productoperations.py | stcstores/ccapi | 1 | 6632380 | """ProductOperations request."""
from ..apirequest import APIRequest
class ProductOperations(APIRequest):
"""ProductOperations request."""
uri = "Handlers/Products/ProductOperations.ashx"
GET_GENERATED_SKU = "getgeneratedsku"
UPDATE_HS_CODE = "updatehscode"
PRODUCT_IDS = "ProductIDs"
HS_COD... | """ProductOperations request."""
from ..apirequest import APIRequest
class ProductOperations(APIRequest):
"""ProductOperations request."""
uri = "Handlers/Products/ProductOperations.ashx"
GET_GENERATED_SKU = "getgeneratedsku"
UPDATE_HS_CODE = "updatehscode"
PRODUCT_IDS = "ProductIDs"
HS_COD... | en | 0.6171 | ProductOperations request. ProductOperations request. Create ProductOperations request. Args: request_mode: requestmode header Get headers for request. Get parameters for get request. Return request data. Handle request response. Response from ProductOperations request. Get information from Product... | 2.606495 | 3 |
host/greatfet/interfaces/spi_bus.py | hewittc/greatfet | 2 | 6632381 | #
# This file is part of GreatFET
#
from ..interface import PirateCompatibleInterface
class SPIBus(PirateCompatibleInterface):
"""
Class representing a GreatFET SPI bus.
For now, supports only the second SPI bus (SPI1), as the first controller
is being used to control the onboard flash.
... | #
# This file is part of GreatFET
#
from ..interface import PirateCompatibleInterface
class SPIBus(PirateCompatibleInterface):
"""
Class representing a GreatFET SPI bus.
For now, supports only the second SPI bus (SPI1), as the first controller
is being used to control the onboard flash.
... | en | 0.834441 | # # This file is part of GreatFET # Class representing a GreatFET SPI bus. For now, supports only the second SPI bus (SPI1), as the first controller is being used to control the onboard flash. # Short name for this type of interface. Set of predefined frequencies used to configure the SPI bus. It ... | 2.999123 | 3 |
tests/test_typeddict.py | bhumikadalal22/druidry | 0 | 6632382 | <reponame>bhumikadalal22/druidry<gh_stars>0
from .context import druidry
import unittest
class TestTypedDict(unittest.TestCase):
def test_invalid_type(self):
class OneTypeDict(druidry.typeddict.TypedDict):
required_fields = {'valid': {}}
with self.assertRaises(druidry.errors.DruidQuer... | from .context import druidry
import unittest
class TestTypedDict(unittest.TestCase):
def test_invalid_type(self):
class OneTypeDict(druidry.typeddict.TypedDict):
required_fields = {'valid': {}}
with self.assertRaises(druidry.errors.DruidQueryError):
OneTypeDict('invalid')
... | none | 1 | 2.902006 | 3 | |
test_client.py | neonbjb/BootstrapNLP | 0 | 6632383 | <filename>test_client.py
from __future__ import print_function
import sys
import threading
# This is a placeholder for a Google-internal import.
import grpc
import numpy
import tensorflow as tf
import orjson
import numpy as np
from transformers import GPT2Tokenizer
from tensorflow_serving.apis import predict_pb2
f... | <filename>test_client.py
from __future__ import print_function
import sys
import threading
# This is a placeholder for a Google-internal import.
import grpc
import numpy
import tensorflow as tf
import orjson
import numpy as np
from transformers import GPT2Tokenizer
from tensorflow_serving.apis import predict_pb2
f... | en | 0.691609 | # This is a placeholder for a Google-internal import. Counter for the prediction results. #result_future = stub.Predict.future(request, 30.0) # 5 seconds # 5 seconds | 2.446189 | 2 |
torch_color_describer.py | pablonm3/cs224u-1 | 1 | 6632384 | <reponame>pablonm3/cs224u-1
import itertools
import numpy as np
import torch
import torch.nn as nn
import torch.utils.data
from torch_model_base import TorchModelBase
import utils
from utils import START_SYMBOL, END_SYMBOL, UNK_SYMBOL
__author__ = "<NAME>"
__version__ = "CS224u, Stanford, Spring 2020"
class ColorDat... | import itertools
import numpy as np
import torch
import torch.nn as nn
import torch.utils.data
from torch_model_base import TorchModelBase
import utils
from utils import START_SYMBOL, END_SYMBOL, UNK_SYMBOL
__author__ = "<NAME>"
__version__ = "CS224u, Stanford, Spring 2020"
class ColorDataset(torch.utils.data.Datase... | en | 0.818079 | PyTorch dataset for contextual color describers. The primary function of this dataset is to organize the raw data into batches of Tensors of the appropriate shape and type. When using this dataset with `torch.utils.data.DataLoader`, it is crucial to supply the `collate_fn` method as the argument for ... | 2.896286 | 3 |
validator/testcases/javascript/instanceactions.py | andymckay/amo-validator | 0 | 6632385 | <filename>validator/testcases/javascript/instanceactions.py<gh_stars>0
"""
Prototype
---------
args
the raw list of arguments
traverser
the traverser
node
the current node being evaluated
"""
import types
from validator.compat import FX10_DEFINITION
from validator.constants import BUGZILLA_BUG
import act... | <filename>validator/testcases/javascript/instanceactions.py<gh_stars>0
"""
Prototype
---------
args
the raw list of arguments
traverser
the traverser
node
the current node being evaluated
"""
import types
from validator.compat import FX10_DEFINITION
from validator.constants import BUGZILLA_BUG
import act... | en | 0.813233 | Prototype --------- args the raw list of arguments traverser the traverser node the current node being evaluated Handles createElement calls Handles createElementNS calls Handles QueryInterface calls Handles getInterface calls # This really only needs to be handled for nsIInterfaceRequestor # intarfaces, b... | 2.448383 | 2 |
plenum/test/test_connections_with_converted_key.py | andkononykhin/plenum | 148 | 6632386 | from binascii import unhexlify
from stp_core.crypto.util import ed25519SkToCurve25519, ed25519PkToCurve25519
def testNodesConnectedUsingConvertedKeys(txnPoolNodeSet):
for node in txnPoolNodeSet:
secretKey = ed25519SkToCurve25519(node.nodestack.keyhex)
publicKey = ed25519PkToCurve25519(node.nodest... | from binascii import unhexlify
from stp_core.crypto.util import ed25519SkToCurve25519, ed25519PkToCurve25519
def testNodesConnectedUsingConvertedKeys(txnPoolNodeSet):
for node in txnPoolNodeSet:
secretKey = ed25519SkToCurve25519(node.nodestack.keyhex)
publicKey = ed25519PkToCurve25519(node.nodest... | none | 1 | 2.363936 | 2 | |
tests/device/test_get_set_temperature_offset.py | Sensirion/python-shdlc-svm40 | 1 | 6632387 | # -*- coding: utf-8 -*-
# (c) Copyright 2020 Sensirion AG, Switzerland
from __future__ import absolute_import, division, print_function
import pytest
@pytest.mark.needs_device
@pytest.mark.parametrize("t_offset", [
(-1.),
(1.),
(0.),
])
def test(device, t_offset):
"""
Test if get_compensation_tem... | # -*- coding: utf-8 -*-
# (c) Copyright 2020 Sensirion AG, Switzerland
from __future__ import absolute_import, division, print_function
import pytest
@pytest.mark.needs_device
@pytest.mark.parametrize("t_offset", [
(-1.),
(1.),
(0.),
])
def test(device, t_offset):
"""
Test if get_compensation_tem... | en | 0.840739 | # -*- coding: utf-8 -*- # (c) Copyright 2020 Sensirion AG, Switzerland Test if get_compensation_temperature_offset() and set_compensation_temperature_offset() work as expected. # reset device and check that the value was not stored in the nv-memory | 2.192295 | 2 |
src/concurrency/__init__.py | technicaltitch/django-concurrency | 0 | 6632388 | __author__ = 'sax'
default_app_config = 'concurrency.apps.ConcurrencyConfig'
VERSION = __version__ = "2.1a0"
NAME = 'django-concurrency'
| __author__ = 'sax'
default_app_config = 'concurrency.apps.ConcurrencyConfig'
VERSION = __version__ = "2.1a0"
NAME = 'django-concurrency'
| none | 1 | 1.061449 | 1 | |
mdp_extras/envs/frozen_lake.py | aaronsnoswell/mdp-extras | 1 | 6632389 | """Utilities for working with the OpenAI Gym FrozenLake MDP"""
import gym
import numpy as np
from mdp_extras import DiscreteExplicitExtras, Indicator, Linear
HUMAN_ACTIONS = ["←", "↓", "→", "↑"]
def frozen_lake_extras(env, gamma=0.99):
"""Get extras for a gym.envs.toy_text.frozen_lake.FrozenLakeEnv
A... | """Utilities for working with the OpenAI Gym FrozenLake MDP"""
import gym
import numpy as np
from mdp_extras import DiscreteExplicitExtras, Indicator, Linear
HUMAN_ACTIONS = ["←", "↓", "→", "↑"]
def frozen_lake_extras(env, gamma=0.99):
"""Get extras for a gym.envs.toy_text.frozen_lake.FrozenLakeEnv
A... | en | 0.622141 | Utilities for working with the OpenAI Gym FrozenLake MDP Get extras for a gym.envs.toy_text.frozen_lake.FrozenLakeEnv Args: env (gym.envs.toy_text.frozen_lake.FrozenLakeEnv): Environment gamma (float): Discount factor Returns: (DiscreteExplicitExtras): Extras object (In... | 2.904455 | 3 |
main.py | itworxs/suite | 890 | 6632390 | import os
import sys
from flask.ext.script import Manager, Server, Shell
from flask.ext.migrate import Migrate, MigrateCommand, upgrade
from app import create_app, db, cache, create_celery_app
from app.caches import SessionCache
from app.models import *
import unittest
app = create_app(os.environ.get("ENV", "prod")... | import os
import sys
from flask.ext.script import Manager, Server, Shell
from flask.ext.migrate import Migrate, MigrateCommand, upgrade
from app import create_app, db, cache, create_celery_app
from app.caches import SessionCache
from app.models import *
import unittest
app = create_app(os.environ.get("ENV", "prod")... | en | 0.769234 | # Set flask-restful to be utf-8 Run the unit tests. Run deployment tasks. # migrate database to latest revision | 2.284924 | 2 |
dothub/config.py | mariocj89/dothub | 12 | 6632391 | import getpass
import json
import time
import os
import logging
import click
import github_token
import os.path
DEFAULT_API_URL = "https://api.github.com"
APP_DIR = click.get_app_dir("dothub")
CONFIG_FILE = os.path.join(APP_DIR, "config.json")
AUTO_CONFIG = {}
LOG = logging.getLogger(__name__)
def load_config():
... | import getpass
import json
import time
import os
import logging
import click
import github_token
import os.path
DEFAULT_API_URL = "https://api.github.com"
APP_DIR = click.get_app_dir("dothub")
CONFIG_FILE = os.path.join(APP_DIR, "config.json")
AUTO_CONFIG = {}
LOG = logging.getLogger(__name__)
def load_config():
... | en | 0.630138 | Returns a config object loaded from disk or an empty dict Runs the config wizard to configure all defaults for the application Sets up the initial config for dothub Asks the user for the general configuration for the app and fills the config object | 2.735516 | 3 |
diesel/hub.py | byrgazov/diesel | 0 | 6632392 | # -*- coding: utf-8 -*-
"""An event hub that supports sockets and timers, based on Python 2.6's select & epoll support."""
import select
try:
import pyev
except:
have_libev = False
else:
have_libev = True
import errno
import fcntl
import os
import signal
import threading
from collections import deque, ... | # -*- coding: utf-8 -*-
"""An event hub that supports sockets and timers, based on Python 2.6's select & epoll support."""
import select
try:
import pyev
except:
have_libev = False
else:
have_libev = True
import errno
import fcntl
import os
import signal
import threading
from collections import deque, ... | en | 0.765633 | # -*- coding: utf-8 -*- An event hub that supports sockets and timers, based on Python 2.6's select & epoll support. A timer is a promise to call some function at a future date. # If we're within 30ms, the timer is due When the external entity checks this timer and determines it's due, this function is called, which ... | 2.572571 | 3 |
setup.py | RobotnikAutomation/perception | 66 | 6632393 | <reponame>RobotnikAutomation/perception
"""
Setup of Berkeley AUTOLab Perception module Python codebase.
Author: <NAME>
"""
import os
from setuptools import setup
requirements = [
"numpy",
"scipy",
"autolab_core",
"opencv-python",
"pyserial>=3.4",
"ffmpeg-python",
]
# load __version__ without ... | """
Setup of Berkeley AUTOLab Perception module Python codebase.
Author: <NAME>
"""
import os
from setuptools import setup
requirements = [
"numpy",
"scipy",
"autolab_core",
"opencv-python",
"pyserial>=3.4",
"ffmpeg-python",
]
# load __version__ without importing anything
version_file = os.pat... | en | 0.625514 | Setup of Berkeley AUTOLab Perception module Python codebase. Author: <NAME> # load __version__ without importing anything # use eval to get a clean string of version from file | 1.429284 | 1 |
zoho_crm_api/related_module.py | ueni-ltd/zoho-crm-api | 0 | 6632394 | <filename>zoho_crm_api/related_module.py<gh_stars>0
from zoho_crm_api.module import ModuleBase
from zoho_crm_api.session import ZohoSession
class RelatedModule(ModuleBase):
def __init__(self, session: ZohoSession, module_name, related_module_name: str):
super().__init__(session, module_name)
self... | <filename>zoho_crm_api/related_module.py<gh_stars>0
from zoho_crm_api.module import ModuleBase
from zoho_crm_api.session import ZohoSession
class RelatedModule(ModuleBase):
def __init__(self, session: ZohoSession, module_name, related_module_name: str):
super().__init__(session, module_name)
self... | none | 1 | 2.059664 | 2 | |
src_py/hat/util/aio.py | hrvojekeserica/hat-core | 0 | 6632395 | """Async utility functions
Attributes:
mlog (logging.Logger): module logger
"""
import asyncio
import collections
import concurrent.futures
import contextlib
import inspect
import itertools
import logging
import signal
import sys
mlog = logging.getLogger(__name__)
async def first(xs, fn=lambda _: True, defau... | """Async utility functions
Attributes:
mlog (logging.Logger): module logger
"""
import asyncio
import collections
import concurrent.futures
import contextlib
import inspect
import itertools
import logging
import signal
import sys
mlog = logging.getLogger(__name__)
async def first(xs, fn=lambda _: True, defau... | en | 0.76769 | Async utility functions Attributes: mlog (logging.Logger): module logger Return the first element from async iterable that satisfies predicate `fn`, or `default` if no such element exists. Args: xs (AsyncIterable[Any]): async collection fn (Callable[[Any],bool]): predicate default ... | 2.899736 | 3 |
nautobot_golden_config/nornir_plays/config_intended.py | jmcgill298/nautobot-plugin-golden-config | 0 | 6632396 | """Nornir job for generating the intended config."""
# pylint: disable=relative-beyond-top-level
import os
import logging
from datetime import datetime
from nornir import InitNornir
from nornir.core.plugins.inventory import InventoryPluginRegister
from nornir.core.task import Result, Task
from nornir_nautobot.except... | """Nornir job for generating the intended config."""
# pylint: disable=relative-beyond-top-level
import os
import logging
from datetime import datetime
from nornir import InitNornir
from nornir.core.plugins.inventory import InventoryPluginRegister
from nornir.core.task import Result, Task
from nornir_nautobot.except... | en | 0.693985 | Nornir job for generating the intended config. # pylint: disable=relative-beyond-top-level # pylint: disable=too-many-arguments Render Jinja Template. Only one template is supported, so the expectation is that that template includes all other templates. Args: task (Task): Nornir task individual object... | 1.910396 | 2 |
day_05/main_test.py | 7Rocky/AoC-2021 | 1 | 6632397 | import io
import sys
import unittest
from main import main
class TestMain(unittest.TestCase):
def test_main(self):
rescued_stdout = io.StringIO()
sys.stdout = rescued_stdout
main()
want = 'Overlapping lines (1): 4421\n' + \
'Overlapping lines (2): 18674\n'
... | import io
import sys
import unittest
from main import main
class TestMain(unittest.TestCase):
def test_main(self):
rescued_stdout = io.StringIO()
sys.stdout = rescued_stdout
main()
want = 'Overlapping lines (1): 4421\n' + \
'Overlapping lines (2): 18674\n'
... | none | 1 | 2.734925 | 3 | |
tests/contrib/timeseries/test_gp.py | futurewarning/pyro | 0 | 6632398 | # Copyright (c) 2017-2019 Uber Technologies, Inc.
# SPDX-License-Identifier: Apache-2.0
import math
import pytest
import torch
import pyro
from pyro.contrib.timeseries import (
DependentMaternGP,
GenericLGSSM,
GenericLGSSMWithGPNoiseModel,
IndependentMaternGP,
LinearlyCoupledMaternGP,
)
from pyro... | # Copyright (c) 2017-2019 Uber Technologies, Inc.
# SPDX-License-Identifier: Apache-2.0
import math
import pytest
import torch
import pyro
from pyro.contrib.timeseries import (
DependentMaternGP,
GenericLGSSM,
GenericLGSSMWithGPNoiseModel,
IndependentMaternGP,
LinearlyCoupledMaternGP,
)
from pyro... | en | 0.6132 | # Copyright (c) 2017-2019 Uber Technologies, Inc. # SPDX-License-Identifier: Apache-2.0 # compare matern log probs to vanilla GP result via multivariate normal # XXX kernel(times) loads old parameters from param store # assert monotonic increase of predictive noise # assert monotonic increase of predictive noise # the ... | 1.85627 | 2 |
leetcode/easy/35-Search_insert_position.py | shubhamoli/practice | 1 | 6632399 | <reponame>shubhamoli/practice
"""
Leetcode #35
"""
from typing import List
class Solution:
def searchInsert_OPTI(self, nums: List[int], target: int) -> int:
if target <= nums[0]:
return 0
if target == nums[-1]:
return len(nums)-1
if target > nums[-1]:
... | """
Leetcode #35
"""
from typing import List
class Solution:
def searchInsert_OPTI(self, nums: List[int], target: int) -> int:
if target <= nums[0]:
return 0
if target == nums[-1]:
return len(nums)-1
if target > nums[-1]:
return len(nums)
... | sv | 0.218448 | Leetcode #35 | 3.563435 | 4 |
Task/Arithmetic-geometric-mean/Python/arithmetic-geometric-mean-2.py | mullikine/RosettaCodeData | 5 | 6632400 | <filename>Task/Arithmetic-geometric-mean/Python/arithmetic-geometric-mean-2.py<gh_stars>1-10
from decimal import Decimal, getcontext
def agm(a, g, tolerance=Decimal("1e-65")):
while True:
a, g = (a + g) / 2, (a * g).sqrt()
if abs(a - g) < tolerance:
return a
getcontext().prec = 70
prin... | <filename>Task/Arithmetic-geometric-mean/Python/arithmetic-geometric-mean-2.py<gh_stars>1-10
from decimal import Decimal, getcontext
def agm(a, g, tolerance=Decimal("1e-65")):
while True:
a, g = (a + g) / 2, (a * g).sqrt()
if abs(a - g) < tolerance:
return a
getcontext().prec = 70
prin... | none | 1 | 2.830511 | 3 | |
podcast_dl/cli.py | kissgyorgy/simple-podcast-dl | 48 | 6632401 | <filename>podcast_dl/cli.py
#!/usr/bin/env python3
import re
import sys
import atexit
import asyncio
import functools
from pathlib import Path
from typing import List, Tuple
from operator import attrgetter
import httpx
import click
from .site_parser import parse_site, InvalidSite
from .podcasts import PODCASTS
from .po... | <filename>podcast_dl/cli.py
#!/usr/bin/env python3
import re
import sys
import atexit
import asyncio
import functools
from pathlib import Path
from typing import List, Tuple
from operator import attrgetter
import httpx
import click
from .site_parser import parse_site, InvalidSite
from .podcasts import PODCASTS
from .po... | en | 0.739628 | #!/usr/bin/env python3 Download podcast episodes to the given directory URL or domain or short name for the PODCAST argument can be specified, e.g. pythonbytes.fm or talkpython or https://talkpython.fm Case insensitive equality. # will be added at the end once, when we know the biggest n value # We have to handle this... | 2.58855 | 3 |
tests/lav.py | sublee/hangulize | 145 | 6632402 | <gh_stars>100-1000
# -*- coding: utf-8 -*-
from tests import HangulizeTestCase
from hangulize.langs.lav import Latvian
class LatvianTestCase(HangulizeTestCase):
lang = Latvian()
def test_people(self):
self.assert_examples({
u'Alberts': u'알베르츠',
u'<NAME>': u'구나르스 아... | # -*- coding: utf-8 -*-
from tests import HangulizeTestCase
from hangulize.langs.lav import Latvian
class LatvianTestCase(HangulizeTestCase):
lang = Latvian()
def test_people(self):
self.assert_examples({
u'Alberts': u'알베르츠',
u'<NAME>': u'구나르스 아스트라',
... | en | 0.769321 | # -*- coding: utf-8 -*- | 2.41372 | 2 |
comparer/migrations/0008_remove_rankingbrowserpluginmodel_show_categories.py | dzejkobi/institution-comparisoner | 0 | 6632403 | <gh_stars>0
# Generated by Django 3.1.12 on 2021-07-08 20:57
from django.db import migrations
class Migration(migrations.Migration):
dependencies = [
('comparer', '0007_auto_20210708_1723'),
]
operations = [
migrations.RemoveField(
model_name='rankingbrowserpluginmodel',
... | # Generated by Django 3.1.12 on 2021-07-08 20:57
from django.db import migrations
class Migration(migrations.Migration):
dependencies = [
('comparer', '0007_auto_20210708_1723'),
]
operations = [
migrations.RemoveField(
model_name='rankingbrowserpluginmodel',
nam... | en | 0.763282 | # Generated by Django 3.1.12 on 2021-07-08 20:57 | 1.397203 | 1 |
great_expectations/util.py | scarrucciu/great_expectations | 0 | 6632404 | <gh_stars>0
import os
import pandas as pd
import json
import logging
from six import string_types
import great_expectations.dataset as dataset
from great_expectations.data_context import DataContext
logger = logging.getLogger(__name__)
def _convert_to_dataset_class(df, dataset_class, expectation_suite=None, profi... | import os
import pandas as pd
import json
import logging
from six import string_types
import great_expectations.dataset as dataset
from great_expectations.data_context import DataContext
logger = logging.getLogger(__name__)
def _convert_to_dataset_class(df, dataset_class, expectation_suite=None, profiler=None):
... | en | 0.698052 | Convert a (pandas) dataframe to a great_expectations dataset, with (optional) expectation_suite # TODO: Refactor this method to use the new ClassConfig (module_name and class_name convention). # Create a dataset of the new class type, and manually initialize expectations according to # the provided expectation suite # ... | 2.818139 | 3 |
sysinv/sysinv/sysinv/sysinv/conductor/rpcapi.py | marcelarosalesj/x.stx-config | 0 | 6632405 | # vim: tabstop=4 shiftwidth=4 softtabstop=4
# coding=utf-8
# Copyright 2013 Hewlett-Packard Development Company, L.P.
# 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 Lic... | # vim: tabstop=4 shiftwidth=4 softtabstop=4
# coding=utf-8
# Copyright 2013 Hewlett-Packard Development Company, L.P.
# 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 Lic... | en | 0.731296 | # vim: tabstop=4 shiftwidth=4 softtabstop=4 # coding=utf-8 # Copyright 2013 Hewlett-Packard Development Company, L.P. # 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 Lice... | 1.719488 | 2 |
Arrays/628_maximum_product_of_three_numbers.py | nikitaKunevich/coding-training | 0 | 6632406 | <reponame>nikitaKunevich/coding-training
'''
Source: Leetcode
628. Maximum Product of Three Numbers
'''
from typing import List
# O(n) time | O(n) space
class SolutionWSortedArray:
def maximumProduct(self, nums: List[int]) -> int:
s = sorted(nums)
return max(s[0] * s[1] * s[-1], s[-3] * s[-2] * s[... | '''
Source: Leetcode
628. Maximum Product of Three Numbers
'''
from typing import List
# O(n) time | O(n) space
class SolutionWSortedArray:
def maximumProduct(self, nums: List[int]) -> int:
s = sorted(nums)
return max(s[0] * s[1] * s[-1], s[-3] * s[-2] * s[-1])
# O(N) time | O(1) space
class Solu... | en | 0.651879 | Source: Leetcode 628. Maximum Product of Three Numbers # O(n) time | O(n) space # O(N) time | O(1) space | 3.863607 | 4 |
sahara-10.0.0/sahara/plugins/base.py | scottwedge/OpenStack-Stein | 161 | 6632407 | <gh_stars>100-1000
# Copyright (c) 2013 Mirantis 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 o... | # Copyright (c) 2013 Mirantis 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... | en | 0.82579 | # Copyright (c) 2013 Mirantis 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... | 1.71192 | 2 |
migrations/versions/b25f088d40c2_.py | DerekBev/tasking-manager | 2 | 6632408 | """empty message
Revision ID: b25f088d40c2
Revises: <PASSWORD>
Create Date: 2019-06-11 12:31:41.697842
"""
from alembic import op
import sqlalchemy as sa
# revision identifiers, used by Alembic.
revision = 'b25f088d40c2'
down_revision = '<PASSWORD>9cebaa79c'
branch_labels = None
depends_on = None
def upgrade():
... | """empty message
Revision ID: b25f088d40c2
Revises: <PASSWORD>
Create Date: 2019-06-11 12:31:41.697842
"""
from alembic import op
import sqlalchemy as sa
# revision identifiers, used by Alembic.
revision = 'b25f088d40c2'
down_revision = '<PASSWORD>9cebaa79c'
branch_labels = None
depends_on = None
def upgrade():
... | en | 0.627553 | empty message Revision ID: b25f088d40c2 Revises: <PASSWORD> Create Date: 2019-06-11 12:31:41.697842 # revision identifiers, used by Alembic. # Remove all task ids in messages for tasks that don't exists anynmore | 1.517149 | 2 |
Day9/main.py | Tribruin/AdventOfCode2021 | 0 | 6632409 | #!/Users/rblount/.pyenv/versions/AdOfCode/bin/python
import sys
import os
from AOC import AOC
import numpy as np
from scipy.ndimage import label
testing = True
def parse_input(data: AOC) -> np.array:
num_array = np.genfromtxt(data.read_lines(), dtype=int, delimiter=1)
num_array = np.pad(num_array, 1, mode... | #!/Users/rblount/.pyenv/versions/AdOfCode/bin/python
import sys
import os
from AOC import AOC
import numpy as np
from scipy.ndimage import label
testing = True
def parse_input(data: AOC) -> np.array:
num_array = np.genfromtxt(data.read_lines(), dtype=int, delimiter=1)
num_array = np.pad(num_array, 1, mode... | en | 0.694946 | #!/Users/rblount/.pyenv/versions/AdOfCode/bin/python # Skip the values that are along the edge. # check if lowest # Mark the map True or False # overlay the low_points array to the floor_array to get only the low points # THIS IS NOT MY CODE. I cheated! # Used code from https://gitlab.com/AsbjornOlling/aoc2021/-/blob/m... | 2.991008 | 3 |
zerver/management/commands/purge_queue.py | SophieHau/zulip | 0 | 6632410 | <reponame>SophieHau/zulip<gh_stars>0
from argparse import ArgumentParser
from typing import Any
from django.core.management import CommandError
from django.core.management.base import BaseCommand
from zerver.lib.queue import SimpleQueueClient
from zerver.worker.queue_processors import get_active_worker_queues
class... | from argparse import ArgumentParser
from typing import Any
from django.core.management import CommandError
from django.core.management.base import BaseCommand
from zerver.lib.queue import SimpleQueueClient
from zerver.worker.queue_processors import get_active_worker_queues
class Command(BaseCommand):
def add_ar... | none | 1 | 2.230536 | 2 | |
pnc_cli/buildrecords.py | vibe13/pnc-cli | 2 | 6632411 | from argh import arg
import pnc_cli.common as common
import pnc_cli.cli_types as types
import pnc_cli.utils as utils
from pnc_cli.pnc_api import pnc_api
@arg("-p", "--page-size", help="Limit the amount of BuildRecords returned", type=int)
@arg("--page-index", help="Select the index of page", type=int)
@arg("-s", "--... | from argh import arg
import pnc_cli.common as common
import pnc_cli.cli_types as types
import pnc_cli.utils as utils
from pnc_cli.pnc_api import pnc_api
@arg("-p", "--page-size", help="Limit the amount of BuildRecords returned", type=int)
@arg("--page-index", help="Select the index of page", type=int)
@arg("-s", "--... | en | 0.805653 | List all BuildRecords List all BuildRecords for a given BuildConfiguration List all BuildRecords for a given Project Get a specific BuildRecord by ID List Artifacts associated with a BuildRecord List dependency artifacts associated with a BuildRecord Get the BuildConfigurationAudited for a given BuildRecord Get the log... | 2.324858 | 2 |
src/python_keycloak_client/aio/mixins.py | roger-schaer/python-keycloak-client | 0 | 6632412 | from python_keycloak_client.aio.abc import AsyncInit
from python_keycloak_client.aio.well_known import KeycloakWellKnown
from python_keycloak_client.mixins import WellKnownMixin as SyncWellKnownMixin
__all__ = (
'WellKnownMixin',
)
class WellKnownMixin(AsyncInit, SyncWellKnownMixin):
def get_path_well_known(... | from python_keycloak_client.aio.abc import AsyncInit
from python_keycloak_client.aio.well_known import KeycloakWellKnown
from python_keycloak_client.mixins import WellKnownMixin as SyncWellKnownMixin
__all__ = (
'WellKnownMixin',
)
class WellKnownMixin(AsyncInit, SyncWellKnownMixin):
def get_path_well_known(... | none | 1 | 2.181944 | 2 | |
functions/checks.py | Brettanda/friday-bot | 5 | 6632413 | <reponame>Brettanda/friday-bot
import discord
from typing import TYPE_CHECKING, Union
from discord.ext import commands
# from interactions import Context as SlashContext
from . import exceptions, config
from .custom_contexts import MyContext
if TYPE_CHECKING:
from discord.ext.commands.core import _CheckDecorator
... | import discord
from typing import TYPE_CHECKING, Union
from discord.ext import commands
# from interactions import Context as SlashContext
from . import exceptions, config
from .custom_contexts import MyContext
if TYPE_CHECKING:
from discord.ext.commands.core import _CheckDecorator
from index import Friday as Bo... | en | 0.614297 | # from interactions import Context as SlashContext # def guild_is_tier(tier: str) -> "_CheckDecorator": Checks if a guild has at least patreon 'tier' SELECT tier FROM patrons WHERE guild_id=$1 LIMIT 1 Checks if a user has at least patreon 'tier' # if not hasattr(user, "guild"): # return False " Checks if the user has... | 2.213725 | 2 |
main.py | ctron/mitemp-gateway | 0 | 6632414 | #!/usr/bin/env python3
import sys
from datetime import datetime
import bluetooth._bluetooth as bluez
import time
import os
import json
import math
import requests
from urllib.parse import urljoin, urlencode, quote, quote_plus
from bluetooth_utils import (toggle_device, enable_le_scan,
pars... | #!/usr/bin/env python3
import sys
from datetime import datetime
import bluetooth._bluetooth as bluez
import time
import os
import json
import math
import requests
from urllib.parse import urljoin, urlencode, quote, quote_plus
from bluetooth_utils import (toggle_device, enable_le_scan,
pars... | en | 0.539681 | #!/usr/bin/env python3 # vorto:ctron.mitemp.status:1.0.0 # Use 0 for hci0 # Set filter to "True" to see only one packet per device # Check for ATC preamble # noinspection PyBroadException # Called on new LE packet # Scan until Ctrl-C | 2.476396 | 2 |
EMNIST.py | zmewshaw/deep_learning | 1 | 6632415 | <gh_stars>1-10
import idx2numpy
import numpy as np
import matplotlib as plt
train_images = "C:/Users/zmews/GitHub/Datasets/mnist/train-images.idx3-ubyte"
train_labels = "C:/Users/zmews/GitHub/Datasets/mnist/train-labels.idx1-ubyte"
test_images = "C:/Users/zmews/GitHub/Datasets/mnist/t10k-images.idx3-ubyte"
test_labels... | import idx2numpy
import numpy as np
import matplotlib as plt
train_images = "C:/Users/zmews/GitHub/Datasets/mnist/train-images.idx3-ubyte"
train_labels = "C:/Users/zmews/GitHub/Datasets/mnist/train-labels.idx1-ubyte"
test_images = "C:/Users/zmews/GitHub/Datasets/mnist/t10k-images.idx3-ubyte"
test_labels = "C:/Users/zm... | en | 0.59599 | # alter (flatten) training and test set if necessary (global) - x.reshape(x.shape[0], -1).T - gives a vector # standardize dataset if necessary # implement with a function: xLayers(X, Y, layerDims, learningRate = x, numIterations = x, printCost = False) | 2.769572 | 3 |
gramhopper/representable.py | OrBin/Bot-Engine | 0 | 6632416 | <reponame>OrBin/Bot-Engine
class Representable:
"""
A "representable" interface for triggers and responses.
The representation is the name of the trigger/response if given,
or "inline <Type of trigger/response>" otherwise.
"""
def __init__(self):
self.__name = None
@property
def... | class Representable:
"""
A "representable" interface for triggers and responses.
The representation is the name of the trigger/response if given,
or "inline <Type of trigger/response>" otherwise.
"""
def __init__(self):
self.__name = None
@property
def name(self):
return... | en | 0.746156 | A "representable" interface for triggers and responses. The representation is the name of the trigger/response if given, or "inline <Type of trigger/response>" otherwise. | 2.616706 | 3 |
Linux/helpers.py | PreCySec/Maldoc-Parser | 0 | 6632417 | <gh_stars>0
import re
import os
import sys
import hexdump
from printy import *
from beautifultable import BeautifulTable
class Helpers:
"""
The Helpers() class has helper methods and regular expressions that are used by all other classes
"""
summary_table = BeautifulTable(maxwidth=200)
summary_ta... | import re
import os
import sys
import hexdump
from printy import *
from beautifultable import BeautifulTable
class Helpers:
"""
The Helpers() class has helper methods and regular expressions that are used by all other classes
"""
summary_table = BeautifulTable(maxwidth=200)
summary_table.headers ... | en | 0.43743 | The Helpers() class has helper methods and regular expressions that are used by all other classes # Magic byte regular expressions: ################################# # OLE related regular expressions: ################################## # EQ_EDIT_CLSID_RE = rb'\x02\xce\x02\x00\x00\x00\x00\x00\xc0\x00\x00\x00\x00\x00\x00... | 2.724998 | 3 |
manchester_analysis.py | y0081106/comparative_analysis | 0 | 6632418 | import time
import calendar
import codecs
import datetime
import json
import sys
import gzip
import string
import glob
import os
import numpy as np
import pandas as pd
import matplotlib.pyplot as plt
global_tweet_counter = 0
time_format = "%a %b %d %H:%M:%S +0000 %Y"
reader = codecs.getreader("utf-8")
local_tweet_li... | import time
import calendar
import codecs
import datetime
import json
import sys
import gzip
import string
import glob
import os
import numpy as np
import pandas as pd
import matplotlib.pyplot as plt
global_tweet_counter = 0
time_format = "%a %b %d %H:%M:%S +0000 %Y"
reader = codecs.getreader("utf-8")
local_tweet_li... | en | 0.76105 | # Try to read tweet JSON into object # Deleted status messages and protected status must be skipped # Try to extract the time of the tweet # Increment tweet count # If our frequency map already has this time, use it, otherwise add # Fill in any gaps # Time step in seconds # Sort the times into an array for future use #... | 2.860904 | 3 |
test/test_notify_base.py | linkmauve/apprise | 4,764 | 6632419 | # -*- coding: utf-8 -*-
#
# Copyright (C) 2019 <NAME> <<EMAIL>>
# All rights reserved.
#
# This code is licensed under the MIT License.
#
# 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 withou... | # -*- coding: utf-8 -*-
#
# Copyright (C) 2019 <NAME> <<EMAIL>>
# All rights reserved.
#
# This code is licensed under the MIT License.
#
# 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 withou... | en | 0.855547 | # -*- coding: utf-8 -*- # # Copyright (C) 2019 <NAME> <<EMAIL>> # All rights reserved. # # This code is licensed under the MIT License. # # 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 withou... | 1.862582 | 2 |
OOP/Person_ines.py | bozhikovstanislav/Python-Fundamentals | 0 | 6632420 | <reponame>bozhikovstanislav/Python-Fundamentals
class Person:
def __init__(self, name, age):
self.name = name
self.age = age
@property
def name(self):
return self.__name
@name.setter
def name(self, name):
if len(name) < 3:
raise Exception("Name's length ... | class Person:
def __init__(self, name, age):
self.name = name
self.age = age
@property
def name(self):
return self.__name
@name.setter
def name(self, name):
if len(name) < 3:
raise Exception("Name's length should not be less than 3 symbols!")
sel... | none | 1 | 4.079394 | 4 | |
doc8/main.py | MarkusPiotrowski/doc8 | 0 | 6632421 | # Copyright (C) 2014 <NAME> <iv at altlinux dot org>
#
# 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 ... | # Copyright (C) 2014 <NAME> <iv at altlinux dot org>
#
# 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 ... | en | 0.769834 | # Copyright (C) 2014 <NAME> <iv at altlinux dot org> # # 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 ... | 2.129418 | 2 |
src/managers.py | MrLIVB/BMSTU_CG_CP | 0 | 6632422 | <filename>src/managers.py
from math import floor
from scene import BaseScene
from builddirector import BuildDirector
from musclemodel import Morph
from visibleobject import *
from visualizer import *
from musclemodel import ComplexMuscleModel
class BaseSceneManager(object):
def __init__(self, scene: BaseScene):
... | <filename>src/managers.py
from math import floor
from scene import BaseScene
from builddirector import BuildDirector
from musclemodel import Morph
from visibleobject import *
from visualizer import *
from musclemodel import ComplexMuscleModel
class BaseSceneManager(object):
def __init__(self, scene: BaseScene):
... | ru | 0.696929 | # Точка вне | 2.303256 | 2 |
metal_python/models/__init__.py | metal-stack/metal-python | 7 | 6632423 | # coding: utf-8
# flake8: noqa
"""
metal-api
API to manage and control plane resources like machines, switches, operating system images, machine sizes, networks, IP addresses and more # noqa: E501
OpenAPI spec version: v0.15.7
Generated by: https://github.com/swagger-api/swagger-codegen.git
"""... | # coding: utf-8
# flake8: noqa
"""
metal-api
API to manage and control plane resources like machines, switches, operating system images, machine sizes, networks, IP addresses and more # noqa: E501
OpenAPI spec version: v0.15.7
Generated by: https://github.com/swagger-api/swagger-codegen.git
"""... | en | 0.768597 | # coding: utf-8 # flake8: noqa metal-api API to manage and control plane resources like machines, switches, operating system images, machine sizes, networks, IP addresses and more # noqa: E501 OpenAPI spec version: v0.15.7 Generated by: https://github.com/swagger-api/swagger-codegen.git # import mod... | 1.473646 | 1 |
pynotes/helpers/file_exist.py | afonsopacifer/pynotes | 8 | 6632424 | <reponame>afonsopacifer/pynotes<filename>pynotes/helpers/file_exist.py
def file_exist(file_name):
try:
open(file_name, "r")
return True
except IOError:
return False | def file_exist(file_name):
try:
open(file_name, "r")
return True
except IOError:
return False | none | 1 | 2.679046 | 3 | |
controllers/PySakuraTurning_PID/PySakuraTurning_PID.py | V-ArkS/Sakura | 0 | 6632425 | <gh_stars>0
from controller import Robot
from controller import Camera
from controller import Compass
from controller import PositionSensor
import numpy as np
#import cv2, time
class Vehicle:
stage = 0
MAX_SPEED = 2
time_tmp = 0
robot = Robot()
motors = []
camera = Camera('camera')
compass ... | from controller import Robot
from controller import Camera
from controller import Compass
from controller import PositionSensor
import numpy as np
#import cv2, time
class Vehicle:
stage = 0
MAX_SPEED = 2
time_tmp = 0
robot = Robot()
motors = []
camera = Camera('camera')
compass = Compass('c... | en | 0.842994 | #import cv2, time #tmp #get motors, camera and initialise them. #release food #Speed setting functions #set speed for four tracks #set speed for turning left or right #set variable as global will accelerate the speed #set as 0.35/0.001/0.02 for mass=40kg #set as 0.5/0/0.05 respectively for mass=400kg #get camera image,... | 3.057513 | 3 |
01-PythonAlgorithms/random/ques_1.py | spendyala/deeplearning-docker | 0 | 6632426 | '''You have a list of timestamps. Each timestamp is a time when there was a glitch in the network.
If 3 or more glitches happen within one second (duration), you need to print the timestamp of the first glitch in that window.
input_lst = [2.1, 2.5, 2.9, 3.0, 3.6, 3.9, 5.2, 5.9, 6.1, 8.2, 10.2, 11.3, 11.8, 11.9]
The... | '''You have a list of timestamps. Each timestamp is a time when there was a glitch in the network.
If 3 or more glitches happen within one second (duration), you need to print the timestamp of the first glitch in that window.
input_lst = [2.1, 2.5, 2.9, 3.0, 3.6, 3.9, 5.2, 5.9, 6.1, 8.2, 10.2, 11.3, 11.8, 11.9]
The... | en | 0.791844 | You have a list of timestamps. Each timestamp is a time when there was a glitch in the network. If 3 or more glitches happen within one second (duration), you need to print the timestamp of the first glitch in that window. input_lst = [2.1, 2.5, 2.9, 3.0, 3.6, 3.9, 5.2, 5.9, 6.1, 8.2, 10.2, 11.3, 11.8, 11.9] The ou... | 3.834007 | 4 |
build/geometry/tf_conversions/catkin_generated/pkg.develspace.context.pc.py | EurobotMDX/eurobot_2020_odroid_cam | 4 | 6632427 | # generated from catkin/cmake/template/pkg.context.pc.in
CATKIN_PACKAGE_PREFIX = ""
PROJECT_PKG_CONFIG_INCLUDE_DIRS = "/home/ros/lidar_ws/src/geometry/tf_conversions/include;/usr/include/eigen3;/opt/ros/kinetic/share/orocos_kdl/../../include".split(';') if "/home/ros/lidar_ws/src/geometry/tf_conversions/include;/usr/in... | # generated from catkin/cmake/template/pkg.context.pc.in
CATKIN_PACKAGE_PREFIX = ""
PROJECT_PKG_CONFIG_INCLUDE_DIRS = "/home/ros/lidar_ws/src/geometry/tf_conversions/include;/usr/include/eigen3;/opt/ros/kinetic/share/orocos_kdl/../../include".split(';') if "/home/ros/lidar_ws/src/geometry/tf_conversions/include;/usr/in... | en | 0.409737 | # generated from catkin/cmake/template/pkg.context.pc.in | 1.254698 | 1 |
CIFAR10/fed.py | sxontheway/BalanceFL | 0 | 6632428 | import copy
import time
from collections import OrderedDict
import torch
from data.dataloader import local_client_dataset, test_dataset
from models.utils import *
from utils.train_helper import validate_one_model
from utils.sampling import *
import numpy as np
from multiprocessing import Process
import time
def ret... | import copy
import time
from collections import OrderedDict
import torch
from data.dataloader import local_client_dataset, test_dataset
from models.utils import *
from utils.train_helper import validate_one_model
from utils.sampling import *
import numpy as np
from multiprocessing import Process
import time
def ret... | en | 0.629402 | save model to state_dict restore model from state_dict # for name, param in state_dict["feat_model"].items(): # print(name, "\t", param.size()) 0. original status (1st FL round) 1. server finished sending: server_network --> mp_list 2. client received, and returned the model: mp_list --> networks[i] --> lo... | 2.26222 | 2 |
datasets/wmt20_mlqe_task3/wmt20_mlqe_task3.py | PierreColombo/datasets | 1 | 6632429 | <reponame>PierreColombo/datasets
# coding=utf-8
# Copyright 2020 The HuggingFace Datasets Authors and the current dataset script contributor.
#
# 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
#... | # coding=utf-8
# Copyright 2020 The HuggingFace Datasets Authors and the current dataset script contributor.
#
# 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/lice... | en | 0.867997 | # coding=utf-8 # Copyright 2020 The HuggingFace Datasets Authors and the current dataset script contributor. # # 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/lice... | 1.344911 | 1 |
demo/put_example.py | untwisted/websnake | 22 | 6632430 | <gh_stars>10-100
from websnake import Put, ResponseHandle, core, die, FormData, TokenAuth
def on_done(con, response):
print('Headers:', response.headers)
print('Code:', response.code)
print('Version:', response.version)
print('Reason:', response.reason)
print('Data:', response.fd.read())
die()... | from websnake import Put, ResponseHandle, core, die, FormData, TokenAuth
def on_done(con, response):
print('Headers:', response.headers)
print('Code:', response.code)
print('Version:', response.version)
print('Reason:', response.reason)
print('Data:', response.fd.read())
die()
if __name__ == ... | none | 1 | 2.302923 | 2 | |
ClienteWSDL/Ambiente/Cliente/ListarBancos/admin.py | argotty2010/ClienteWSDL | 10 | 6632431 | <gh_stars>1-10
from django.contrib import admin
from .models import Comment
admin.site.register(Comment)
| from django.contrib import admin
from .models import Comment
admin.site.register(Comment) | none | 1 | 1.196863 | 1 | |
torchplasma/conversion/xyz.py | hdkai/Plasma | 0 | 6632432 | #
# Plasma
# Copyright (c) 2021 <NAME>.
#
from torch import tensor, Tensor
def rgb_to_xyz (input: Tensor) -> Tensor:
"""
Convert linear RGB to D65 XYZ.
Parameters:
input (Tensor): Input image with shape (N,3,...) in range [-1., 1.].
Returns:
Tensor: XYZ image with shape ... | #
# Plasma
# Copyright (c) 2021 <NAME>.
#
from torch import tensor, Tensor
def rgb_to_xyz (input: Tensor) -> Tensor:
"""
Convert linear RGB to D65 XYZ.
Parameters:
input (Tensor): Input image with shape (N,3,...) in range [-1., 1.].
Returns:
Tensor: XYZ image with shape ... | en | 0.600116 | # # Plasma # Copyright (c) 2021 <NAME>. # Convert linear RGB to D65 XYZ. Parameters: input (Tensor): Input image with shape (N,3,...) in range [-1., 1.]. Returns: Tensor: XYZ image with shape (N,3,...) in range [0., 1.]. Convert D65 XYZ to linear RGB. Parameters: i... | 2.728464 | 3 |
platform/radio/efr32_multiphy_configurator/pyradioconfig/parts/bobcat/calculators/calc_ber.py | PascalGuenther/gecko_sdk | 82 | 6632433 | from pyradioconfig.parts.ocelot.calculators.calc_ber import CALC_Ber_Ocelot
class Calc_BER_Bobcat(CALC_Ber_Ocelot):
pass | from pyradioconfig.parts.ocelot.calculators.calc_ber import CALC_Ber_Ocelot
class Calc_BER_Bobcat(CALC_Ber_Ocelot):
pass | none | 1 | 1.174688 | 1 | |
TAO/Firewall/EXPLOITS/ELCO/fosho/requests/packages/oreos/core.py | dendisuhubdy/grokmachine | 46 | 6632434 | # -*- coding: utf-8 -*-
"""
oreos.core
~~~~~~~~~~
The creamy white center.
"""
from .monkeys import SimpleCookie
def dict_from_string(s):
''''''
cookies = dict()
c = SimpleCookie()
c.load(s)
for k,v in c.items():
cookies.update({k: v.value})
return cookies | # -*- coding: utf-8 -*-
"""
oreos.core
~~~~~~~~~~
The creamy white center.
"""
from .monkeys import SimpleCookie
def dict_from_string(s):
''''''
cookies = dict()
c = SimpleCookie()
c.load(s)
for k,v in c.items():
cookies.update({k: v.value})
return cookies | en | 0.596644 | # -*- coding: utf-8 -*- oreos.core ~~~~~~~~~~ The creamy white center. | 2.330609 | 2 |
lessons/lesson_3/T01/Asym.py | wouter-ham/blockchain | 0 | 6632435 | from cryptography.hazmat.primitives import hashes
from cryptography.hazmat.primitives.asymmetric import rsa, padding
def generate_keys():
private = rsa.generate_private_key(
public_exponent=65537,
key_size=2048,
)
public = private.public_key()
return private, public
def encrypt(messa... | from cryptography.hazmat.primitives import hashes
from cryptography.hazmat.primitives.asymmetric import rsa, padding
def generate_keys():
private = rsa.generate_private_key(
public_exponent=65537,
key_size=2048,
)
public = private.public_key()
return private, public
def encrypt(messa... | none | 1 | 3.19233 | 3 | |
django_auth_ldap3/conf.py | intelie/django_auth_ldap3 | 0 | 6632436 | <reponame>intelie/django_auth_ldap3
from django.conf import settings as django_settings
class LDAPSettings(object):
"""
Class that provides access to the LDAP settings specified in Django's
settings, with defaults set if they are missing.
Settings are prefixed in Django's settings, but are used here ... | from django.conf import settings as django_settings
class LDAPSettings(object):
"""
Class that provides access to the LDAP settings specified in Django's
settings, with defaults set if they are missing.
Settings are prefixed in Django's settings, but are used here without prefix.
So `AUTH_LDAP_UR... | en | 0.867161 | Class that provides access to the LDAP settings specified in Django's settings, with defaults set if they are missing. Settings are prefixed in Django's settings, but are used here without prefix. So `AUTH_LDAP_URI` becomes `settings.URI`. | 2.335215 | 2 |
cohesity_management_sdk/models/update_sources_for_principal_parameters.py | sachinthakare-cohesity/management-sdk-python | 0 | 6632437 | <filename>cohesity_management_sdk/models/update_sources_for_principal_parameters.py
# -*- coding: utf-8 -*-
# Copyright 2019 Cohesity Inc.
import cohesity_management_sdk.models.source_for_principal_parameters
class UpdateSourcesForPrincipalParameters(object):
"""Implementation of the 'Update Sources for Principa... | <filename>cohesity_management_sdk/models/update_sources_for_principal_parameters.py
# -*- coding: utf-8 -*-
# Copyright 2019 Cohesity Inc.
import cohesity_management_sdk.models.source_for_principal_parameters
class UpdateSourcesForPrincipalParameters(object):
"""Implementation of the 'Update Sources for Principa... | en | 0.775785 | # -*- coding: utf-8 -*- # Copyright 2019 Cohesity Inc. Implementation of the 'Update Sources for Principal Parameters.' model. Set Access Permissions for Principals. Specifies a list of principals to set access permissions for. For each principal, set the Protection Sources and View names that the spec... | 2.313383 | 2 |
KthFromLast.py | ropso/AlgorithmDesignAndAnalysis-Python | 0 | 6632438 | import linklist as lk1
class linklist(lk1):
def __init__(self):
super().__init__()
def KthFromLast(self,indexk,node=12):
if node==12:
node=self._head
if node==None:
return [0,node]
else:
tmp=KthFromLast(indexk,node._next)
if t... | import linklist as lk1
class linklist(lk1):
def __init__(self):
super().__init__()
def KthFromLast(self,indexk,node=12):
if node==12:
node=self._head
if node==None:
return [0,node]
else:
tmp=KthFromLast(indexk,node._next)
if t... | none | 1 | 3.690998 | 4 | |
test/datasets/VQuAnDa/results/old/utils/utils.py | librairy/explainable-qa | 1 | 6632439 | <reponame>librairy/explainable-qa
import json
import re
import csv
import pandas
def nthOfChar(string, char, n):
'''
Funcion auxiliar que extrae un substring hasta el n-esimo caracter
'''
regex=r'^((?:[^%c]*%c){%d}[^%c]*)%c(.*)' % (char,char,n-1,char,char)
regexGroups = re.match(regex, string)
... | import json
import re
import csv
import pandas
def nthOfChar(string, char, n):
'''
Funcion auxiliar que extrae un substring hasta el n-esimo caracter
'''
regex=r'^((?:[^%c]*%c){%d}[^%c]*)%c(.*)' % (char,char,n-1,char,char)
regexGroups = re.match(regex, string)
if regexGroups is not None:
... | es | 0.948507 | Funcion auxiliar que extrae un substring hasta el n-esimo caracter Funcion auxiliar que dada la ruta de un json, lo abre y lo convierte a diccionario Funcion auxiliar que dado un csv y un json con preguntas y respuestas, ve que preguntas no estan en el csv. Es utilizado para ver que preguntas no estan siendo ver r... | 3.235064 | 3 |
tests/test_xasx_calendar.py | rajeshyogeshwar/exchange_calendars | 0 | 6632440 | <gh_stars>0
import pytest
import pandas as pd
from exchange_calendars.exchange_calendar_xasx import XASXExchangeCalendar
from .test_exchange_calendar import ExchangeCalendarTestBaseNew
class TestXASXCalendar(ExchangeCalendarTestBaseNew):
@pytest.fixture(scope="class")
def calendar_cls(self):
yield XA... | import pytest
import pandas as pd
from exchange_calendars.exchange_calendar_xasx import XASXExchangeCalendar
from .test_exchange_calendar import ExchangeCalendarTestBaseNew
class TestXASXCalendar(ExchangeCalendarTestBaseNew):
@pytest.fixture(scope="class")
def calendar_cls(self):
yield XASXExchangeCa... | en | 0.944329 | # 2018 # New Year's Day # Australia Day # Good Friday # Easter Monday # Anzac Day # Queen's Birthday # Christmas # Boxing Day # # Holidays made up when fall on weekend. # Anzac Day is observed on the following Monday only when falling # on a Sunday. In years where Anzac Day falls on a Saturday, there # is no make-up. #... | 2.311334 | 2 |
2021/day05/main.py | Kwarf/adventofcode | 0 | 6632441 | <filename>2021/day05/main.py
from collections import defaultdict
part1 = defaultdict(int)
part2 = defaultdict(int)
def step(d): return 1 if d > 0 else -1 if d < 0 else 0
for line in open("input.txt"):
[x1, y1, x2, y2] = map(int, line.replace(" -> ", ",").split(","))
dx = x2 - x1
dy = y2 - y1
for i in... | <filename>2021/day05/main.py
from collections import defaultdict
part1 = defaultdict(int)
part2 = defaultdict(int)
def step(d): return 1 if d > 0 else -1 if d < 0 else 0
for line in open("input.txt"):
[x1, y1, x2, y2] = map(int, line.replace(" -> ", ",").split(","))
dx = x2 - x1
dy = y2 - y1
for i in... | none | 1 | 3.264095 | 3 | |
training_api/src/configuration_module/network_setter.py | michaelnguyen11/BMW-Classification-Training-GUI | 69 | 6632442 | <gh_stars>10-100
import json
import mxnet as mx
from DTO.Configuration import Configuration
from gluoncv import model_zoo
from mxnet import gluon
import os
import sys
from DTO.Checkpoint import Checkpoint
from checkpoint_module.checkpoint_facade import CheckpointFacade
"""
This class is responsible for specifying the ... | import json
import mxnet as mx
from DTO.Configuration import Configuration
from gluoncv import model_zoo
from mxnet import gluon
import os
import sys
from DTO.Checkpoint import Checkpoint
from checkpoint_module.checkpoint_facade import CheckpointFacade
"""
This class is responsible for specifying the network to use
g... | en | 0.840808 | This class is responsible for specifying the network to use get_network is mandatory. Feel free to add to the class any methods you think are necessary. weights folder: folder storing all the pretrained weights from the model zoo checkpoints folder: previous trained jobs weights models folder: networks from scratch... | 2.634589 | 3 |
test.py | nobodyzxc/colorization-pytorch | 0 | 6632443 | <gh_stars>0
import os
from options.train_options import TrainOptions
from models import create_model
from util.visualizer import save_images
from util import html
import string
import torch
import torchvision
import torchvision.transforms as transforms
from util import util
from IPython import embed
import numpy as ... | import os
from options.train_options import TrainOptions
from models import create_model
from util.visualizer import save_images
from util import html
import string
import torch
import torchvision
import torchvision.transforms as transforms
from util import util
from IPython import embed
import numpy as np
if __nam... | en | 0.799134 | # test code only supports nThreads = 1 # test code only supports batch_size = 1 # no visdom display # create website # statistics # with no points #img_path = [string.replace('%08d_%.3f' % (i, sample_p), '.', 'p')] # True means that losses will be computed # Compute and print some summary statistics | 2.107786 | 2 |
model/procedure.py | beda-software/fhir-py-experements | 0 | 6632444 | <filename>model/procedure.py
#!/usr/bin/env python
# -*- coding: utf-8 -*-
#
# Generated from FHIR 4.0.1-9346c8cc45 (http://hl7.org/fhir/StructureDefinition/Procedure) on 2020-02-03.
# 2020, SMART Health IT.
import sys
from dataclasses import dataclass, field
from typing import ClassVar, Optional, List
from .age imp... | <filename>model/procedure.py
#!/usr/bin/env python
# -*- coding: utf-8 -*-
#
# Generated from FHIR 4.0.1-9346c8cc45 (http://hl7.org/fhir/StructureDefinition/Procedure) on 2020-02-03.
# 2020, SMART Health IT.
import sys
from dataclasses import dataclass, field
from typing import ClassVar, Optional, List
from .age imp... | en | 0.927338 | #!/usr/bin/env python # -*- coding: utf-8 -*- # # Generated from FHIR 4.0.1-9346c8cc45 (http://hl7.org/fhir/StructureDefinition/Procedure) on 2020-02-03. # 2020, SMART Health IT. The people who performed the procedure. Limited to "real" people rather than equipment. Manipulated, implanted, or removed device. ... | 2.391583 | 2 |
ParsingProject/instagram/migrations/0002_auto_20210414_2056.py | rzhvn1/Parsing-APi | 0 | 6632445 | # Generated by Django 3.2 on 2021-04-14 14:56
from django.db import migrations, models
import django.db.models.deletion
class Migration(migrations.Migration):
dependencies = [
('instagram', '0001_initial'),
]
operations = [
migrations.AddField(
model_name='comment',
... | # Generated by Django 3.2 on 2021-04-14 14:56
from django.db import migrations, models
import django.db.models.deletion
class Migration(migrations.Migration):
dependencies = [
('instagram', '0001_initial'),
]
operations = [
migrations.AddField(
model_name='comment',
... | en | 0.833513 | # Generated by Django 3.2 on 2021-04-14 14:56 | 1.717413 | 2 |
Chapter1/noreminderdev.py | galinadychko/IntroToPython | 0 | 6632446 | <filename>Chapter1/noreminderdev.py
import sys
import stdio
a, b = map(int, sys.argv[1:3])
stdio.writeln(a % b == 0) | <filename>Chapter1/noreminderdev.py
import sys
import stdio
a, b = map(int, sys.argv[1:3])
stdio.writeln(a % b == 0) | none | 1 | 3.074503 | 3 | |
bdragon/constants.py | bangingheads/BDragon | 3 | 6632447 | <reponame>bangingheads/BDragon<filename>bdragon/constants.py
cdragon_url = 'http://raw.communitydragon.org'
ddragon_url = 'http://ddragon.leagueoflegends.com'
languages = {
'cs_CZ': 'cs_cz',
'de_DE': 'de_de',
'el_GR': 'el_gr',
'en_AU': 'en_au',
'en_GB': 'en_gb',
'en_PH': 'en_ph',
'en_SG': 'e... | cdragon_url = 'http://raw.communitydragon.org'
ddragon_url = 'http://ddragon.leagueoflegends.com'
languages = {
'cs_CZ': 'cs_cz',
'de_DE': 'de_de',
'el_GR': 'el_gr',
'en_AU': 'en_au',
'en_GB': 'en_gb',
'en_PH': 'en_ph',
'en_SG': 'en_sg',
'en_US': 'default',
'es_AR': 'es_ar',
'es_... | none | 1 | 1.942969 | 2 | |
circleguard/exceptions.py | wmpmiles/circleguard | 0 | 6632448 | <reponame>wmpmiles/circleguard
class CircleguardException(Exception):
"""Base class for exceptions in the Circleguard program."""
class InvalidArgumentsException(CircleguardException):
"""Indicates an invalid argument was passed to one of the flags."""
class APIException(CircleguardException):
"""Indicate... | class CircleguardException(Exception):
"""Base class for exceptions in the Circleguard program."""
class InvalidArgumentsException(CircleguardException):
"""Indicates an invalid argument was passed to one of the flags."""
class APIException(CircleguardException):
"""Indicates some error on the API's end t... | en | 0.947462 | Base class for exceptions in the Circleguard program. Indicates an invalid argument was passed to one of the flags. Indicates some error on the API's end that we were not prepared to handle. | 2.590197 | 3 |
_imputation/convert.Minimac3ToOxford.py | swvanderlaan/HerculesToolKit | 0 | 6632449 | <gh_stars>0
#!/hpc/local/CentOS7/common/lang/python/2.7.10/bin/python
# coding=UTF-8
# Alternative shebang for local Mac OS X: #!/usr/bin/python
# Linux version for HPC: #!/hpc/local/CentOS7/common/lang/python/2.7.10/bin/python
### ADD-IN:
### - flag to *optinally* determine which "COLUMNS_TO_KEEP"
#
print ... | #!/hpc/local/CentOS7/common/lang/python/2.7.10/bin/python
# coding=UTF-8
# Alternative shebang for local Mac OS X: #!/usr/bin/python
# Linux version for HPC: #!/hpc/local/CentOS7/common/lang/python/2.7.10/bin/python
### ADD-IN:
### - flag to *optinally* determine which "COLUMNS_TO_KEEP"
#
print "+++++++++++... | en | 0.560018 | #!/hpc/local/CentOS7/common/lang/python/2.7.10/bin/python # coding=UTF-8 # Alternative shebang for local Mac OS X: #!/usr/bin/python # Linux version for HPC: #!/hpc/local/CentOS7/common/lang/python/2.7.10/bin/python ### ADD-IN: ### - flag to *optinally* determine which "COLUMNS_TO_KEEP" # ### ADD-IN: ### - requirement ... | 2.049821 | 2 |
workflows/rivm/data_rivm_dashboard.py | vmenger/CoronaWatchNL | 0 | 6632450 | <filename>workflows/rivm/data_rivm_dashboard.py<gh_stars>0
from datetime import date
from pathlib import Path
import numpy as np
import pandas as pd
import requests
DATA_FOLDER = Path("data-dashboard")
URL = "https://coronadashboard.rijksoverheid.nl/json/NL.json"
def export_date(df, data_folder, prefix, data_date... | <filename>workflows/rivm/data_rivm_dashboard.py<gh_stars>0
from datetime import date
from pathlib import Path
import numpy as np
import pandas as pd
import requests
DATA_FOLDER = Path("data-dashboard")
URL = "https://coronadashboard.rijksoverheid.nl/json/NL.json"
def export_date(df, data_folder, prefix, data_date... | en | 0.760022 | # export with data date # main_national() | 2.891003 | 3 |