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 |
|---|---|---|---|---|---|---|---|---|---|---|
0000_examples/grasping_antipodal_planning.py | huzhengtao14z/wrs | 0 | 10600 | import math
import visualization.panda.world as wd
import modeling.geometric_model as gm
import modeling.collision_model as cm
import grasping.planning.antipodal as gpa
import robot_sim.end_effectors.grippers.yumi_gripper.yumi_gripper as yg
base = wd.World(cam_pos=[1, 1, 1],w=960,
h=540, lookat_pos=[0... | import math
import visualization.panda.world as wd
import modeling.geometric_model as gm
import modeling.collision_model as cm
import grasping.planning.antipodal as gpa
import robot_sim.end_effectors.grippers.yumi_gripper.yumi_gripper as yg
base = wd.World(cam_pos=[1, 1, 1],w=960,
h=540, lookat_pos=[0... | en | 0.725924 | # object # hnd_s | 2.033151 | 2 |
keystone/assignment/core.py | pritha-srivastava/keystone | 0 | 10601 | # Copyright 2012 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
#
# Unless required by applicable law or agreed to in... | # Copyright 2012 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
#
# Unless required by applicable law or agreed to in... | en | 0.915638 | # Copyright 2012 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 # # Unless required by applicable law or agreed to in... | 1.866795 | 2 |
single-shot-pose/lib/linemod_dataset.py | take-cheeze/models | 112 | 10602 | <gh_stars>100-1000
import numpy as np
import os
from chainercv.chainer_experimental.datasets.sliceable import GetterDataset
from chainercv.utils import read_image
linemod_object_diameters = {
'ape': 0.103,
'benchvise': 0.286908,
'cam': 0.173,
'can': 0.202,
'cat': 0.155,
'driller': 0.262,
... | import numpy as np
import os
from chainercv.chainer_experimental.datasets.sliceable import GetterDataset
from chainercv.utils import read_image
linemod_object_diameters = {
'ape': 0.103,
'benchvise': 0.286908,
'cam': 0.173,
'can': 0.202,
'cat': 0.155,
'driller': 0.262,
'duck': 0.109,
... | en | 0.890393 | # to avoid single truth problem | 2.396301 | 2 |
DQM/BeamMonitor/test/44X_beam_dqm_sourceclient-live_cfg.py | nistefan/cmssw | 0 | 10603 | <filename>DQM/BeamMonitor/test/44X_beam_dqm_sourceclient-live_cfg.py
import FWCore.ParameterSet.Config as cms
process = cms.Process("BeamMonitor")
#----------------------------
# Common part for PP and H.I Running
#-----------------------------
process.load("DQM.Integration.test.inputsource_cfi")
#-----------------... | <filename>DQM/BeamMonitor/test/44X_beam_dqm_sourceclient-live_cfg.py
import FWCore.ParameterSet.Config as cms
process = cms.Process("BeamMonitor")
#----------------------------
# Common part for PP and H.I Running
#-----------------------------
process.load("DQM.Integration.test.inputsource_cfi")
#-----------------... | en | 0.35688 | #---------------------------- # Common part for PP and H.I Running #----------------------------- #-------------------------- # HLT Filter # 0=random, 1=physics, 2=calibration, 3=technical #---------------------------- # DQM Live Environment #----------------------------- #---------------------------- # BeamMonitor #--... | 1.583143 | 2 |
tests/routes/test_hackers.py | TorrentofShame/hackathon-2021-backend | 0 | 10604 | <filename>tests/routes/test_hackers.py<gh_stars>0
# flake8: noqa
import json
from src.models.hacker import Hacker
from tests.base import BaseTestCase
from datetime import datetime
class TestHackersBlueprint(BaseTestCase):
"""Tests for the Hackers Endpoints"""
"""create_hacker"""
def test_create_hacker(s... | <filename>tests/routes/test_hackers.py<gh_stars>0
# flake8: noqa
import json
from src.models.hacker import Hacker
from tests.base import BaseTestCase
from datetime import datetime
class TestHackersBlueprint(BaseTestCase):
"""Tests for the Hackers Endpoints"""
"""create_hacker"""
def test_create_hacker(s... | en | 0.384189 | # flake8: noqa Tests for the Hackers Endpoints create_hacker get_all_hackers | 2.516827 | 3 |
open_cp/sources/chicago.py | sumau/PredictCode | 18 | 10605 | """
sources.chicago
===============
Reads a CSV file in the format (as of April 2017) of data available from:
- https://catalog.data.gov/dataset/crimes-one-year-prior-to-present-e171f
- https://catalog.data.gov/dataset/crimes-2001-to-present-398a4
The default data is loaded from a file "chicago.csv" which should be ... | """
sources.chicago
===============
Reads a CSV file in the format (as of April 2017) of data available from:
- https://catalog.data.gov/dataset/crimes-one-year-prior-to-present-e171f
- https://catalog.data.gov/dataset/crimes-2001-to-present-398a4
The default data is loaded from a file "chicago.csv" which should be ... | en | 0.817582 | sources.chicago =============== Reads a CSV file in the format (as of April 2017) of data available from: - https://catalog.data.gov/dataset/crimes-one-year-prior-to-present-e171f - https://catalog.data.gov/dataset/crimes-2001-to-present-398a4 The default data is loaded from a file "chicago.csv" which should be down... | 3.247385 | 3 |
Codility/Lesson/0011.Sieve-of-Eratosthenes/CountSemiprimes/CountSemiprimes.py | kimi0230/LeetcodeGolang | 4 | 10606 | <reponame>kimi0230/LeetcodeGolang<filename>Codility/Lesson/0011.Sieve-of-Eratosthenes/CountSemiprimes/CountSemiprimes.py
# https://github.com/Anfany/Codility-Lessons-By-Python3/blob/master/L11_Sieve%20of%20Eratosthenes/11.2%20CountSemiprimes.md
def solution(N, P, Q):
"""
返回由数组P、Q的元素组成的区间内,不大于N的半素数的个数, 时间复杂度O(N ... | # https://github.com/Anfany/Codility-Lessons-By-Python3/blob/master/L11_Sieve%20of%20Eratosthenes/11.2%20CountSemiprimes.md
def solution(N, P, Q):
"""
返回由数组P、Q的元素组成的区间内,不大于N的半素数的个数, 时间复杂度O(N * log(log(N)) + M)
:param N: 半素数的最大值
:param P: 数组
:param Q: 数组
:return: 每次查询,得到的半素数的个数
"""
# 半素数... | zh | 0.498726 | # https://github.com/Anfany/Codility-Lessons-By-Python3/blob/master/L11_Sieve%20of%20Eratosthenes/11.2%20CountSemiprimes.md 返回由数组P、Q的元素组成的区间内,不大于N的半素数的个数, 时间复杂度O(N * log(log(N)) + M) :param N: 半素数的最大值 :param P: 数组 :param Q: 数组 :return: 每次查询,得到的半素数的个数 # 半素数只有3或4个因子,并且不能是素数的立方,例如(1, 3, 9, 27)(1, 5, 25, 1... | 3.365284 | 3 |
src/zope/formlib/errors.py | zopefoundation/zope.formlib | 4 | 10607 | <reponame>zopefoundation/zope.formlib<filename>src/zope/formlib/errors.py
##############################################################################
#
# Copyright (c) 2006 Zope Foundation and Contributors.
#
# This software is subject to the provisions of the Zope Public License,
# Version 2.1 (ZPL). A copy of the... | ##############################################################################
#
# Copyright (c) 2006 Zope Foundation and Contributors.
#
# This software is subject to the provisions of the Zope Public License,
# Version 2.1 (ZPL). A copy of the ZPL should accompany this distribution.
# THIS SOFTWARE IS PROVIDED "AS I... | en | 0.398117 | ############################################################################## # # Copyright (c) 2006 Zope Foundation and Contributors. # # This software is subject to the provisions of the Zope Public License, # Version 2.1 (ZPL). A copy of the ZPL should accompany this distribution. # THIS SOFTWARE IS PROVIDED "AS I... | 2.010225 | 2 |
src/packagedcode/about.py | sthagen/nexB-scancode-toolkit | 0 | 10608 | #
# Copyright (c) nexB Inc. and others. All rights reserved.
# ScanCode is a trademark of nexB Inc.
# SPDX-License-Identifier: Apache-2.0
# See http://www.apache.org/licenses/LICENSE-2.0 for the license text.
# See https://github.com/nexB/scancode-toolkit for support or download.
# See https://aboutcode.org for more in... | #
# Copyright (c) nexB Inc. and others. All rights reserved.
# ScanCode is a trademark of nexB Inc.
# SPDX-License-Identifier: Apache-2.0
# See http://www.apache.org/licenses/LICENSE-2.0 for the license text.
# See https://github.com/nexB/scancode-toolkit for support or download.
# See https://aboutcode.org for more in... | en | 0.845177 | # # Copyright (c) nexB Inc. and others. All rights reserved. # ScanCode is a trademark of nexB Inc. # SPDX-License-Identifier: Apache-2.0 # See http://www.apache.org/licenses/LICENSE-2.0 for the license text. # See https://github.com/nexB/scancode-toolkit for support or download. # See https://aboutcode.org for more in... | 2.159453 | 2 |
gazepattern/eyedetector/admin.py | AriRodriguezCruz/mcfgpr | 0 | 10609 | # -*- coding: utf-8 -*-
#django
from django.contrib import admin
from django.db import transaction
#python
import csv
from decimal import Decimal
#gazepattern
from .models import Experiment, ExperimentPoint, Image, ImageRectangle, ExperimentPointCSV, ExperimentFunction
@transaction.atomic
def procesar(modeladmin, req... | # -*- coding: utf-8 -*-
#django
from django.contrib import admin
from django.db import transaction
#python
import csv
from decimal import Decimal
#gazepattern
from .models import Experiment, ExperimentPoint, Image, ImageRectangle, ExperimentPointCSV, ExperimentFunction
@transaction.atomic
def procesar(modeladmin, req... | en | 0.399694 | # -*- coding: utf-8 -*- #django #python #gazepattern | 2.069042 | 2 |
orders/tests/test_views.py | ms0680146/Order_System | 0 | 10610 | <reponame>ms0680146/Order_System<filename>orders/tests/test_views.py
from django.test import TestCase, Client
from django.urls import reverse
from orders.models import Order, OrderItem
from datetime import datetime
from django.utils.timezone import get_current_timezone
import pytz
class TestViews(TestCase):
d... | from django.test import TestCase, Client
from django.urls import reverse
from orders.models import Order, OrderItem
from datetime import datetime
from django.utils.timezone import get_current_timezone
import pytz
class TestViews(TestCase):
def setUp(self):
self.client = Client()
def test_home_GET... | none | 1 | 2.421433 | 2 | |
codigo/hexagonal/app/adapter/light_bulb_repository.py | VulturARG/charla_01 | 0 | 10611 | <reponame>VulturARG/charla_01<filename>codigo/hexagonal/app/adapter/light_bulb_repository.py
from codigo.hexagonal.app.domain.switchable_repository import Switchable
class LightBulb(Switchable):
def turn_on(self) -> bool:
print("Connecting with the device...")
print("The light is on")
retu... | from codigo.hexagonal.app.domain.switchable_repository import Switchable
class LightBulb(Switchable):
def turn_on(self) -> bool:
print("Connecting with the device...")
print("The light is on")
return True
def turn_off(self) -> bool:
print("The light is off")
print("Dis... | none | 1 | 3.024101 | 3 | |
aula12/ex1.py | otaviobizulli/python-exercices | 0 | 10612 | from random import randint
menor = 100
linha = 0
maior = 0
m = []
for i in range(10):
m.append([])
for j in range(10):
m[i].append(randint(1,99))
for i in range(10):
for j in range(10):
print(f'{m[i][j]:2}',end=' ')
print()
for i in range(10):
for j in range(10):
if m[i][j... | from random import randint
menor = 100
linha = 0
maior = 0
m = []
for i in range(10):
m.append([])
for j in range(10):
m[i].append(randint(1,99))
for i in range(10):
for j in range(10):
print(f'{m[i][j]:2}',end=' ')
print()
for i in range(10):
for j in range(10):
if m[i][j... | none | 1 | 3.566015 | 4 | |
src/token_classification/format.py | adriens63/BERT_fine_tuning_for_MLM_and_token_classification | 0 | 10613 | <reponame>adriens63/BERT_fine_tuning_for_MLM_and_token_classification
import os.path as osp
import argparse
import yaml
from src.token_classification.archs.data_formatter import *
# ********************* launch formating ***********************
# cmd to launch : python -m src.token_classification.format --config ... | import os.path as osp
import argparse
import yaml
from src.token_classification.archs.data_formatter import *
# ********************* launch formating ***********************
# cmd to launch : python -m src.token_classification.format --config ./src/token_classification/config/config.yml
if __name__ == '__main__... | en | 0.199583 | # ********************* launch formating *********************** # cmd to launch : python -m src.token_classification.format --config ./src/token_classification/config/config.yml | 2.524344 | 3 |
add.py | cleolepart/timedomain | 0 | 10614 | <filename>add.py<gh_stars>0
from __future__ import absolute_import, division, print_function
import os, sys, time
import numpy as np
import scipy.sparse
import scipy.linalg
import scipy.sparse.linalg
from astropy.table import Table, Column
import multiprocessing
from desiutil.log import get_logger
from desispec.i... | <filename>add.py<gh_stars>0
from __future__ import absolute_import, division, print_function
import os, sys, time
import numpy as np
import scipy.sparse
import scipy.linalg
import scipy.sparse.linalg
from astropy.table import Table, Column
import multiprocessing
from desiutil.log import get_logger
from desispec.i... | en | 0.768633 | Coaddition the spectra for each target and each camera. The input spectra is modified. Args: spectra: desispec.spectra.Spectra object Options: cosmics_nsig: float, nsigma clipping threshold for cosmics rays #- if all spectra were flagged as bad (FIBERSTATUS != 0), contine #- to next target, leav... | 1.963416 | 2 |
pontoon/pretranslation/tests/test_pretranslate.py | timvisee/pontoon | 0 | 10615 | from mock import patch
import pytest
from pontoon.base.models import User
from pontoon.pretranslation.pretranslate import get_translations
from pontoon.test.factories import (
EntityFactory,
TranslationMemoryFactory,
)
@patch("pontoon.pretranslation.pretranslate.get_google_translate_data")
@pytest.mark.djan... | from mock import patch
import pytest
from pontoon.base.models import User
from pontoon.pretranslation.pretranslate import get_translations
from pontoon.test.factories import (
EntityFactory,
TranslationMemoryFactory,
)
@patch("pontoon.pretranslation.pretranslate.get_google_translate_data")
@pytest.mark.djan... | en | 0.63322 | # Mock the return value of get_google_translate_data # 100% match exists in translation memory. # 100% match does not exists and locale.google_translate_code is None. # 100% match does not exists and locale.google_translate_code is not None. # Entity.string_plural is not None. | 2.12164 | 2 |
cubes/common.py | digitalsatori/cubes | 1,020 | 10616 | # -*- encoding: utf-8 -*-
"""Utility functions for computing combinations of dimensions and hierarchy
levels"""
from __future__ import absolute_import
import re
import os.path
import json
from collections import OrderedDict
from .errors import ModelInconsistencyError, ArgumentError, ConfigurationError
from . impor... | # -*- encoding: utf-8 -*-
"""Utility functions for computing combinations of dimensions and hierarchy
levels"""
from __future__ import absolute_import
import re
import os.path
import json
from collections import OrderedDict
from .errors import ModelInconsistencyError, ArgumentError, ConfigurationError
from . impor... | en | 0.769611 | # -*- encoding: utf-8 -*- Utility functions for computing combinations of dimensions and hierarchy levels Simple dictionary extension that will ignore any keys of which values are empty (None/False) Sets `value` for `key` even if value is null. Raises ArgumentError when `obj` is not instance of `cls` Raises Argumen... | 2.348462 | 2 |
wavenet_iaf.py | Ella77/ClariNet | 126 | 10617 | import torch
import torch.nn as nn
import torch.nn.functional as F
from modules import Conv, ResBlock
class Wavenet_Student(nn.Module):
def __init__(self, num_blocks_student=[1, 1, 1, 1, 1, 1], num_layers=10,
front_channels=32, residual_channels=64, gate_channels=128, skip_channels=64,
... | import torch
import torch.nn as nn
import torch.nn.functional as F
from modules import Conv, ResBlock
class Wavenet_Student(nn.Module):
def __init__(self, num_blocks_student=[1, 1, 1, 1, 1, 1], num_layers=10,
front_channels=32, residual_channels=64, gate_channels=128, skip_channels=64,
... | none | 1 | 2.430594 | 2 | |
tests/__init__.py | ybelleguic/openbrokerapi | 36 | 10618 | try:
from gevent import monkey
monkey.patch_all()
except ImportError:
# fine if no gevent is available
pass
import base64
import logging
from unittest.mock import Mock
from flask.app import Flask
from flask_testing import TestCase
from openbrokerapi.api import BrokerCredentials
from openbrokerapi.log... | try:
from gevent import monkey
monkey.patch_all()
except ImportError:
# fine if no gevent is available
pass
import base64
import logging
from unittest.mock import Mock
from flask.app import Flask
from flask_testing import TestCase
from openbrokerapi.api import BrokerCredentials
from openbrokerapi.log... | en | 0.577928 | # fine if no gevent is available | 1.896225 | 2 |
ansible/lib/ansible/modules/extras/network/f5/bigip_gtm_wide_ip.py | kiv-box/kafka | 0 | 10619 | <reponame>kiv-box/kafka
#!/usr/bin/python
# -*- coding: utf-8 -*-
#
# (c) 2015, <NAME>
#
# This file is part of Ansible
#
# Ansible is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the Licen... | #!/usr/bin/python
# -*- coding: utf-8 -*-
#
# (c) 2015, <NAME>
#
# This file is part of Ansible
#
# Ansible is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option... | en | 0.677286 | #!/usr/bin/python # -*- coding: utf-8 -*- # # (c) 2015, <NAME> # # This file is part of Ansible # # Ansible is free software: you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by # the Free Software Foundation, either version 3 of the License, or # (at your option... | 1.321861 | 1 |
sql/src/test/resources/joins/create_sample_table.py | MichelaSalvemini/Modelli_project | 677 | 10620 | #! /usr/bin/env python
from __future__ import print_function
import pandas as pd
import numpy as np
import argparse
def generate_csv(start_index, fname):
cols = [
str('A' + str(i)) for i in range(start_index, NUM_COLS + start_index)
]
data = []
for i in range(NUM_ROWS):
vals = (np.ra... | #! /usr/bin/env python
from __future__ import print_function
import pandas as pd
import numpy as np
import argparse
def generate_csv(start_index, fname):
cols = [
str('A' + str(i)) for i in range(start_index, NUM_COLS + start_index)
]
data = []
for i in range(NUM_ROWS):
vals = (np.ra... | ru | 0.148623 | #! /usr/bin/env python | 3.163573 | 3 |
Advanced/1- Introduction/5- Index_words.py | AlirezaMojtabavi/Python_Practice | 0 | 10621 |
indexWords = list()
def PreviousWord(_list, _word):
if _list[_list.index(_word)-1] :
return _list[_list.index(_word)-1]
else:
return
phrase = str(input())
phraseList = phrase.split(" ")
length = len(phraseList)
for item in phraseList :
item = item.strip()
if phrase != "" :
fo... |
indexWords = list()
def PreviousWord(_list, _word):
if _list[_list.index(_word)-1] :
return _list[_list.index(_word)-1]
else:
return
phrase = str(input())
phraseList = phrase.split(" ")
length = len(phraseList)
for item in phraseList :
item = item.strip()
if phrase != "" :
fo... | none | 1 | 3.616851 | 4 | |
appengine/findit/handlers/test/completed_build_pubsub_ingestor_test.py | xswz8015/infra | 0 | 10622 | <filename>appengine/findit/handlers/test/completed_build_pubsub_ingestor_test.py
# Copyright 2017 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.
import base64
import json
import mock
import webapp2
from google.appengine... | <filename>appengine/findit/handlers/test/completed_build_pubsub_ingestor_test.py
# Copyright 2017 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.
import base64
import json
import mock
import webapp2
from google.appengine... | en | 0.922901 | # Copyright 2017 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. #123}' # This build does not isolate any targets. #123}' #123}_with_patch' #123}_without_patch' # Ensure target values were used. | 1.856722 | 2 |
sdk/python/pulumi_azure_native/containerservice/v20191027preview/open_shift_managed_cluster.py | sebtelko/pulumi-azure-native | 0 | 10623 | # coding=utf-8
# *** WARNING: this file was generated by the Pulumi SDK Generator. ***
# *** Do not edit by hand unless you're certain you know what you are doing! ***
import warnings
import pulumi
import pulumi.runtime
from typing import Any, Mapping, Optional, Sequence, Union, overload
from ... import _utilities
fro... | # coding=utf-8
# *** WARNING: this file was generated by the Pulumi SDK Generator. ***
# *** Do not edit by hand unless you're certain you know what you are doing! ***
import warnings
import pulumi
import pulumi.runtime
from typing import Any, Mapping, Optional, Sequence, Union, overload
from ... import _utilities
fro... | en | 0.521206 | # coding=utf-8 # *** WARNING: this file was generated by the Pulumi SDK Generator. *** # *** Do not edit by hand unless you're certain you know what you are doing! *** The set of arguments for constructing a OpenShiftManagedCluster resource. :param pulumi.Input[str] open_shift_version: Version of OpenShift spec... | 1.591294 | 2 |
django_drf_server/quiz/migrations/0017_remove_quiz_questions.py | pammalPrasanna/quizie | 0 | 10624 | <gh_stars>0
# Generated by Django 3.2.4 on 2021-06-17 02:01
from django.db import migrations
class Migration(migrations.Migration):
dependencies = [
('quiz', '0016_auto_20210617_0724'),
]
operations = [
migrations.RemoveField(
model_name='quiz',
name='questions',... | # Generated by Django 3.2.4 on 2021-06-17 02:01
from django.db import migrations
class Migration(migrations.Migration):
dependencies = [
('quiz', '0016_auto_20210617_0724'),
]
operations = [
migrations.RemoveField(
model_name='quiz',
name='questions',
),
... | en | 0.869518 | # Generated by Django 3.2.4 on 2021-06-17 02:01 | 1.426361 | 1 |
main.py | khan-git/webRecipies | 0 | 10625 | <reponame>khan-git/webRecipies
# -*- coding: iso-8859-1 -*-
import os
import shutil
import datetime
import sqlite3
from flask import Flask, request, session, render_template, g, redirect, url_for, abort, flash, make_response
from random import randint
import json
import urllib2
import json
from json.decoder import JSO... | # -*- coding: iso-8859-1 -*-
import os
import shutil
import datetime
import sqlite3
from flask import Flask, request, session, render_template, g, redirect, url_for, abort, flash, make_response
from random import randint
import json
import urllib2
import json
from json.decoder import JSONObject
from werkzeug.utils imp... | en | 0.484113 | # -*- coding: iso-8859-1 -*- #app.config['UPLOAD_FOLDER'] = UPLOAD_FOLDER # Load default config and override config from an environment variable Connects to the specific database. Opens a new database connection if there is none yet for the current application context. Closes the database again at the end of the re... | 2.152878 | 2 |
tests/bugs/core_2678_test.py | FirebirdSQL/firebird-qa | 1 | 10626 | <filename>tests/bugs/core_2678_test.py
#coding:utf-8
#
# id: bugs.core_2678
# title: Full outer join cannot use available indices (very slow execution)
# decription:
# tracker_id: CORE-2678
# min_versions: ['3.0']
# versions: 3.0
# qmid: None
import pytest
from firebird.qa import db_f... | <filename>tests/bugs/core_2678_test.py
#coding:utf-8
#
# id: bugs.core_2678
# title: Full outer join cannot use available indices (very slow execution)
# decription:
# tracker_id: CORE-2678
# min_versions: ['3.0']
# versions: 3.0
# qmid: None
import pytest
from firebird.qa import db_f... | en | 0.36263 | #coding:utf-8 # # id: bugs.core_2678 # title: Full outer join cannot use available indices (very slow execution) # decription: # tracker_id: CORE-2678 # min_versions: ['3.0'] # versions: 3.0 # qmid: None # version: 3.0 # resources: None create table td_data1 ( c1 varchar(20) charact... | 1.624155 | 2 |
application/model/entity/category.py | UniversidadeDeVassouras/labproghiper-2020.1-MatheusTelles-p1 | 1 | 10627 | <filename>application/model/entity/category.py<gh_stars>1-10
from flask import current_app
class Category:
def __init__(self, id, name, description, thumb):
self._id = id
self._name = name
self._description = description
def setId(self, id):
self._id = id
def getId(self):
... | <filename>application/model/entity/category.py<gh_stars>1-10
from flask import current_app
class Category:
def __init__(self, id, name, description, thumb):
self._id = id
self._name = name
self._description = description
def setId(self, id):
self._id = id
def getId(self):
... | none | 1 | 2.527833 | 3 | |
cookietemple/create/templates/cli/cli_python/{{ cookiecutter.project_slug_no_hyphen }}/tests/__init__.py | e2jk/cookietemple | 117 | 10628 | <gh_stars>100-1000
"""Test suite for the {{ cookiecutter.project_slug_no_hyphen }} package."""
| """Test suite for the {{ cookiecutter.project_slug_no_hyphen }} package.""" | en | 0.669544 | Test suite for the {{ cookiecutter.project_slug_no_hyphen }} package. | 0.984817 | 1 |
bricks/ev3dev/modules/pybricks/robotics.py | ZPhilo/pybricks-micropython | 115 | 10629 | # SPDX-License-Identifier: MIT
# Copyright (c) 2018-2020 The Pybricks Authors
"""Pybricks robotics module."""
from _pybricks.robotics import DriveBase
| # SPDX-License-Identifier: MIT
# Copyright (c) 2018-2020 The Pybricks Authors
"""Pybricks robotics module."""
from _pybricks.robotics import DriveBase
| en | 0.264268 | # SPDX-License-Identifier: MIT # Copyright (c) 2018-2020 The Pybricks Authors Pybricks robotics module. | 1.132046 | 1 |
flask-app/web_app/storage_manager/storage_manager.py | PetrMokrov/back_end_project | 0 | 10630 | #!/usr/bin/env python
import psycopg2
import time
from ..models import User
class StorageManager:
def __init__(self):
self.conn = None
self._connect()
self._create_table()
def _connect(self):
while True:
try:
self.conn = psycopg2.connect(
... | #!/usr/bin/env python
import psycopg2
import time
from ..models import User
class StorageManager:
def __init__(self):
self.conn = None
self._connect()
self._create_table()
def _connect(self):
while True:
try:
self.conn = psycopg2.connect(
... | en | 0.540293 | #!/usr/bin/env python If insert is success, the function returns true, Else, it returns false The function returns None, if there is no user with very value of category, else it returns User instance The function sets \'confirmed\' parameter of the user with very value of category as True\n ... | 2.91116 | 3 |
custom/ahex.py | piyush1104/ColorHelper | 0 | 10631 | <reponame>piyush1104/ColorHelper
"""Custon color that looks for colors of format `#RRGGBBAA` as `#AARRGGBB`."""
from coloraide.css.colors import Color, SRGB
from coloraide.colors import _parse as parse
from coloraide import util
import copy
import re
class ASRGB(SRGB):
"""SRGB that looks for alpha first in hex fo... | """Custon color that looks for colors of format `#RRGGBBAA` as `#AARRGGBB`."""
from coloraide.css.colors import Color, SRGB
from coloraide.colors import _parse as parse
from coloraide import util
import copy
import re
class ASRGB(SRGB):
"""SRGB that looks for alpha first in hex format."""
MATCH = re.compile(... | en | 0.750822 | Custon color that looks for colors of format `#RRGGBBAA` as `#AARRGGBB`. SRGB that looks for alpha first in hex format. #(?:{hex}{{8}}|{hex}{{6}})\b".format(**parse.COLOR_PARTS)) Match a CSS color string. Translate channel string. Split channels. Convert to Hex format. # Always fit hex Color object whose sRGB color spa... | 3.093964 | 3 |
source_code/terrain.py | Wiolarz/Console_PY_dungeon | 0 | 10632 | <reponame>Wiolarz/Console_PY_dungeon<filename>source_code/terrain.py
import random
import jobs
import balance
from economy import roman_numbers
class Earth:
def __init__(self):
self.current_day = 1
self.main_quest = None
self.amount_location = 7 # max 8
self.locations = []
... | import random
import jobs
import balance
from economy import roman_numbers
class Earth:
def __init__(self):
self.current_day = 1
self.main_quest = None
self.amount_location = 7 # max 8
self.locations = []
#
self.location_names = []
def new_quest(self):
... | en | 0.761645 | # max 8 # # level, overall location number # suffix = ["", ""] # number of events in location # %(10) chest chance # %(10) chance of quest related enemy | 3.591432 | 4 |
entrepreneurial_property/models/scientificpark.py | CzechInvest/ciis | 1 | 10633 | from django.db import models
from .media import Water
from .media import Electricity
from .media import Gas
from .media import WasteWater
from .media import Telecommunication
from .generic import Attachment
from .generic import Photo
from .generic import Location as EstateLocation
from cigeo.models import GenericNote ... | from django.db import models
from .media import Water
from .media import Electricity
from .media import Gas
from .media import WasteWater
from .media import Telecommunication
from .generic import Attachment
from .generic import Photo
from .generic import Location as EstateLocation
from cigeo.models import GenericNote ... | none | 1 | 2.130654 | 2 | |
pusion/input_output/file_input_output.py | IPVS-AS/pusion | 5 | 10634 | <gh_stars>1-10
import json
import ntpath
import shutil
from pathlib import Path
import pickle5
def load_pickle_files_as_data(file_paths):
"""
Load pickle files containing decision outputs as an data array.
:param file_paths: A List of file paths to the individual pickle files.
:return: A data array.... | import json
import ntpath
import shutil
from pathlib import Path
import pickle5
def load_pickle_files_as_data(file_paths):
"""
Load pickle files containing decision outputs as an data array.
:param file_paths: A List of file paths to the individual pickle files.
:return: A data array.
"""
da... | en | 0.665806 | Load pickle files containing decision outputs as an data array. :param file_paths: A List of file paths to the individual pickle files. :return: A data array. Dump classification output data to the given file using pickle. :param data: A data dictionary. :param file_path: Location of the output pickle... | 3.149871 | 3 |
meiduo_mall/meiduo_mall/apps/meiduo_admin/views/spus.py | aGrass0825/meiduo_project | 0 | 10635 | from rest_framework.generics import ListAPIView
from rest_framework.permissions import IsAdminUser
from goods.models import SPU, SPUSpecification
from meiduo_admin.serializers.spus import SPUSimpleSerializer, SPUSpecSerializer
class SPUSimpleView(ListAPIView):
permission_classes = [IsAdminUser]
queryset = S... | from rest_framework.generics import ListAPIView
from rest_framework.permissions import IsAdminUser
from goods.models import SPU, SPUSpecification
from meiduo_admin.serializers.spus import SPUSimpleSerializer, SPUSpecSerializer
class SPUSimpleView(ListAPIView):
permission_classes = [IsAdminUser]
queryset = S... | zh | 0.911989 | # GET/meiduo_admin/goods/(?P<pk>\d+)/specs/ 获取SPU商品的规格选项数据 # 指定视图类所使用的查询集 # 指定视图类所使用的序列化器类 | 2.151874 | 2 |
Scientific Computing with Python/Probability Calculator/prob_calculator.py | Fradxyz/FCCProjects | 0 | 10636 | <gh_stars>0
# Hacked by Ry2uko :D
import copy
import random
# Consider using the modules imported above.
class Hat:
def __init__(self, **balls):
self.contents = []
for color in balls:
for n in range(0,balls[color]):
self.contents.append(color)
def draw(self, num):
... | # Hacked by Ry2uko :D
import copy
import random
# Consider using the modules imported above.
class Hat:
def __init__(self, **balls):
self.contents = []
for color in balls:
for n in range(0,balls[color]):
self.contents.append(color)
def draw(self, num):
drawn... | en | 0.698494 | # Hacked by Ry2uko :D # Consider using the modules imported above. # Test here | 3.472106 | 3 |
src/frames/add_quantity_frame.py | GolovPavel/ValueConverter | 1 | 10637 | import tkinter as tk
from tkinter.messagebox import showerror
from constants.frames import MAIN_FRAME_NAME
from util import add_new_quantity
class AddQuantityFrame(tk.Frame):
def __init__(self, root, controller):
tk.Frame.__init__(self, root)
self.controller = controller
self.main_label... | import tkinter as tk
from tkinter.messagebox import showerror
from constants.frames import MAIN_FRAME_NAME
from util import add_new_quantity
class AddQuantityFrame(tk.Frame):
def __init__(self, root, controller):
tk.Frame.__init__(self, root)
self.controller = controller
self.main_label... | none | 1 | 3.412262 | 3 | |
setup.py | vwxyzjn/pysc2gym | 6 | 10638 | from setuptools import setup
import versioneer
setup(name='gym_pysc2',
version=versioneer.get_version(),
cmdclass=versioneer.get_cmdclass(),
install_requires=['gym'] # And any other dependencies foo needs
) | from setuptools import setup
import versioneer
setup(name='gym_pysc2',
version=versioneer.get_version(),
cmdclass=versioneer.get_cmdclass(),
install_requires=['gym'] # And any other dependencies foo needs
) | en | 0.720654 | # And any other dependencies foo needs | 1.340532 | 1 |
Compressed downloads/server.py | Aldair47x/aa | 0 | 10639 | <reponame>Aldair47x/aa
import zmq
import sys
import os
import math
def loadFiles(path):
files = {}
dataDir = os.fsencode(path)
for file in os.listdir(dataDir):
filename = os.fsdecode(file)
print("Loading {}".format(filename))
files[filename] = file
return files
def main():
... | import zmq
import sys
import os
import math
def loadFiles(path):
files = {}
dataDir = os.fsencode(path)
for file in os.listdir(dataDir):
filename = os.fsdecode(file)
print("Loading {}".format(filename))
files[filename] = file
return files
def main():
if len(sys.argv) != 3:... | none | 1 | 2.490875 | 2 | |
metric_learn/nca.py | ogrisel/metric-learn | 0 | 10640 | """
Neighborhood Components Analysis (NCA)
Ported to Python from https://github.com/vomjom/nca
"""
from __future__ import absolute_import
import numpy as np
from six.moves import xrange
from sklearn.utils.validation import check_X_y
from .base_metric import BaseMetricLearner
EPS = np.finfo(float).eps
class NCA(Bas... | """
Neighborhood Components Analysis (NCA)
Ported to Python from https://github.com/vomjom/nca
"""
from __future__ import absolute_import
import numpy as np
from six.moves import xrange
from sklearn.utils.validation import check_X_y
from .base_metric import BaseMetricLearner
EPS = np.finfo(float).eps
class NCA(Bas... | en | 0.797032 | Neighborhood Components Analysis (NCA) Ported to Python from https://github.com/vomjom/nca X: data matrix, (n x d) y: scalar labels, (n) # Initialize A to a scaling matrix # Run NCA # shape (n, n, d) # shape (n, n, d, d) # shape (n, num_dims) # shape (n) # shape (n, d, d) | 2.256465 | 2 |
rl_repr/batch_rl/evaluation.py | xxdreck/google-research | 23,901 | 10641 | <reponame>xxdreck/google-research<filename>rl_repr/batch_rl/evaluation.py
# coding=utf-8
# Copyright 2021 The Google Research 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
#
# ... | # coding=utf-8
# Copyright 2021 The Google Research 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 applicab... | en | 0.834176 | # coding=utf-8 # Copyright 2021 The Google Research 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 applicab... | 2.110578 | 2 |
src/nwb_conversion_tools/datainterfaces/ecephys/intan/intandatainterface.py | ben-dichter-consulting/nwbn-conversion-tools | 0 | 10642 | <gh_stars>0
"""Authors: <NAME> and <NAME>."""
from pathlib import Path
import spikeextractors as se
from pynwb.ecephys import ElectricalSeries
from ..baserecordingextractorinterface import BaseRecordingExtractorInterface
from ....utils import get_schema_from_hdmf_class, FilePathType
try:
from pyintan.intan impor... | """Authors: <NAME> and <NAME>."""
from pathlib import Path
import spikeextractors as se
from pynwb.ecephys import ElectricalSeries
from ..baserecordingextractorinterface import BaseRecordingExtractorInterface
from ....utils import get_schema_from_hdmf_class, FilePathType
try:
from pyintan.intan import read_rhd, ... | en | 0.757962 | Authors: <NAME> and <NAME>. Primary data interface class for converting a IntanRecordingExtractor. | 2.088877 | 2 |
Use.py | XtremeCoder1384/SongDownloader | 1 | 10643 | import os
import youtube_dl
os.system("setup.bat")
playlist = input("Paste the Youtube Playlist URL Here.")
track = 1
print("""THIS TOOL WILL ATTEMPT TO DOWNLOAD THE FIRST 1000 SONGS IN THE QUEUE.\n
PLEASE DO NOT INTERRUPT THE TOOL.
YOU MAY CLOSE THE TOOL WHEN IT DISPLAYS "DONE!".
ALL... | import os
import youtube_dl
os.system("setup.bat")
playlist = input("Paste the Youtube Playlist URL Here.")
track = 1
print("""THIS TOOL WILL ATTEMPT TO DOWNLOAD THE FIRST 1000 SONGS IN THE QUEUE.\n
PLEASE DO NOT INTERRUPT THE TOOL.
YOU MAY CLOSE THE TOOL WHEN IT DISPLAYS "DONE!".
ALL... | en | 0.362807 | THIS TOOL WILL ATTEMPT TO DOWNLOAD THE FIRST 1000 SONGS IN THE QUEUE.\n
PLEASE DO NOT INTERRUPT THE TOOL.
YOU MAY CLOSE THE TOOL WHEN IT DISPLAYS "DONE!".
ALL DOWNLOADED SONGS WILL BE IN THE SAME DIRECTORY THIS FILE IS IN.
TO EXTRACT THEM, FILTER BY MP3. | 3.22502 | 3 |
site/manage.py | oaoouo/railgun | 0 | 10644 | # coding: utf-8
"""
manage.py
~~~~~~~~~
"""
import os
import sys
import shutil
import platform
from app import app
from gen import Gen
from flask_script import Manager
"""编码设置"""
if (platform.python_version().split('.')[0] == '2'):
# reload(sys) is evil :)
reload(sys)
sys.setdefaultencoding('utf... | # coding: utf-8
"""
manage.py
~~~~~~~~~
"""
import os
import sys
import shutil
import platform
from app import app
from gen import Gen
from flask_script import Manager
"""编码设置"""
if (platform.python_version().split('.')[0] == '2'):
# reload(sys) is evil :)
reload(sys)
sys.setdefaultencoding('utf... | en | 0.382236 | # coding: utf-8 manage.py ~~~~~~~~~ 编码设置 # reload(sys) is evil :) Git配置 # update static resources | 2.215065 | 2 |
tests/test_segmenters.py | edoarn/cv-models | 0 | 10645 | from typing import Any
import torch
import torch.nn as nn
from cvmodels.segmentation import unet, deeplab as dl
def output(model: nn.Module, input_batch: torch.Tensor) -> Any:
model.eval()
with torch.no_grad():
return model(input_batch)
def numel(m: torch.nn.Module, only_trainable: bool = True) -> ... | from typing import Any
import torch
import torch.nn as nn
from cvmodels.segmentation import unet, deeplab as dl
def output(model: nn.Module, input_batch: torch.Tensor) -> Any:
model.eval()
with torch.no_grad():
return model(input_batch)
def numel(m: torch.nn.Module, only_trainable: bool = True) -> ... | none | 1 | 2.250877 | 2 | |
bagua/torch_api/contrib/sync_batchnorm.py | mmathys/bagua | 635 | 10646 | <gh_stars>100-1000
# Copyright (c) Uber Technologies, Inc. and its affiliates.
# Copyright (c) 2021 Kuaishou AI Platform & DS3 Lab.
#
# All rights reserved.
#
# This source code is licensed under the BSD-style license found in the
# LICENSE file in the root directory of this source tree.
from distutils.version import ... | # Copyright (c) Uber Technologies, Inc. and its affiliates.
# Copyright (c) 2021 Kuaishou AI Platform & DS3 Lab.
#
# All rights reserved.
#
# This source code is licensed under the BSD-style license found in the
# LICENSE file in the root directory of this source tree.
from distutils.version import LooseVersion
impor... | en | 0.743994 | # Copyright (c) Uber Technologies, Inc. and its affiliates. # Copyright (c) 2021 Kuaishou AI Platform & DS3 Lab. # # All rights reserved. # # This source code is licensed under the BSD-style license found in the # LICENSE file in the root directory of this source tree. # Backward compat for old PyTorch Applies synchron... | 2.140937 | 2 |
tests/test_classification_metric.py | DaveFClarke/ml_bias_checking | 2 | 10647 | from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
from __future__ import unicode_literals
import numpy as np
import pandas as pd
from aif360.datasets import BinaryLabelDataset
from aif360.metrics import ClassificationMetric
def test_generalized_entropy_inde... | from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
from __future__ import unicode_literals
import numpy as np
import pandas as pd
from aif360.datasets import BinaryLabelDataset
from aif360.metrics import ClassificationMetric
def test_generalized_entropy_inde... | none | 1 | 2.478663 | 2 | |
PDA/extra_assignments/10.6. Dicts_ Countries and cities/solution/main.py | EMbeDS-education/StatsAndComputing20212022 | 2 | 10648 | city_country = {}
for _ in range(int(input())):
country, *cities = input().split()
for city in cities:
city_country[city] = country
for _ in range(int(input())):
print(city_country[input()]) | city_country = {}
for _ in range(int(input())):
country, *cities = input().split()
for city in cities:
city_country[city] = country
for _ in range(int(input())):
print(city_country[input()]) | none | 1 | 3.767881 | 4 | |
config.py | oyasr/mudawen | 0 | 10649 | <reponame>oyasr/mudawen<gh_stars>0
import os
from dotenv import load_dotenv
load_dotenv()
basedir = os.path.abspath(os.path.dirname(__file__))
class Config:
SECRET_KEY = os.getenv('SECRET_KEY') or os.urandom(32)
SQLALCHEMY_TRACK_MODIFICATIONS = False
SQLALCHEMY_RECORD_QUERIES = True
MAIL_SERVER = os.... | import os
from dotenv import load_dotenv
load_dotenv()
basedir = os.path.abspath(os.path.dirname(__file__))
class Config:
SECRET_KEY = os.getenv('SECRET_KEY') or os.urandom(32)
SQLALCHEMY_TRACK_MODIFICATIONS = False
SQLALCHEMY_RECORD_QUERIES = True
MAIL_SERVER = os.getenv('MAIL_SERVER') or 'smtp.goog... | none | 1 | 2.072506 | 2 | |
experiments/async_tests/async_3.py | 10ks/py_utils | 0 | 10650 | <gh_stars>0
import asyncio
async def wait_sec(l):
print("Before wait")
await asyncio.sleep(1)
print("After wait")
l[0] = False
async def main():
# await asyncio.gather(wait_sec([True]), wait_sec([True]), wait_sec([True]))
run = [True]
asyncio.create_task(wait_sec(run))
await asyncio.... | import asyncio
async def wait_sec(l):
print("Before wait")
await asyncio.sleep(1)
print("After wait")
l[0] = False
async def main():
# await asyncio.gather(wait_sec([True]), wait_sec([True]), wait_sec([True]))
run = [True]
asyncio.create_task(wait_sec(run))
await asyncio.sleep(0)
... | en | 0.475588 | # await asyncio.gather(wait_sec([True]), wait_sec([True]), wait_sec([True])) # for i in range(10): # print(i) # # time.sleep(0.2) # # await asyncio.sleep(0) # await asyncio.sleep(0.2) # Completing unfinished tasks (throws a warning) # loop = asyncio.get_event_loop() # loop.run_until_complete(main()) # p... | 3.408466 | 3 |
vk_bot/mods/util/calculator.py | triangle1984/GLaDOS | 3 | 10651 | # from vk_bot.core.modules.basicplug import BasicPlug
# import math
# class Calculator(BasicPlug):
# doc = "Калькулятор"
# command = ("калькулятор",)
# def main(self):
# try:
# x = self.text[1]; x = int(x)
# encalc = self.text[2]; encalc = encalc.lower()
# y = sel... | # from vk_bot.core.modules.basicplug import BasicPlug
# import math
# class Calculator(BasicPlug):
# doc = "Калькулятор"
# command = ("калькулятор",)
# def main(self):
# try:
# x = self.text[1]; x = int(x)
# encalc = self.text[2]; encalc = encalc.lower()
# y = sel... | ru | 0.234064 | # from vk_bot.core.modules.basicplug import BasicPlug # import math # class Calculator(BasicPlug): # doc = "Калькулятор" # command = ("калькулятор",) # def main(self): # try: # x = self.text[1]; x = int(x) # encalc = self.text[2]; encalc = encalc.lower() # y = sel... | 3.136912 | 3 |
sample-input/homogeneous/geometry.py | AI-Pranto/OpenMOC | 97 | 10652 | import openmoc
import openmoc.log as log
import openmoc.plotter as plotter
import openmoc.materialize as materialize
log.set_log_level('NORMAL')
###############################################################################
########################### Creating Materials ############################
#############... | import openmoc
import openmoc.log as log
import openmoc.plotter as plotter
import openmoc.materialize as materialize
log.set_log_level('NORMAL')
###############################################################################
########################### Creating Materials ############################
#############... | de | 0.847286 | ############################################################################### ########################### Creating Materials ############################ ############################################################################### ############################################################################### ... | 1.948448 | 2 |
google/ads/google_ads/v5/__init__.py | arammaliachi/google-ads-python | 1 | 10653 | # Copyright 2020 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
#
# https://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, ... | # Copyright 2020 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
#
# https://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, ... | en | 0.84044 | # Copyright 2020 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 # # https://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, ... | 1.399003 | 1 |
PNN/model.py | jingxiufenghua/rec-model | 1,323 | 10654 | <reponame>jingxiufenghua/rec-model
"""
Created on July 20, 2020
Updated on May 19, 2021
model: Product-based Neural Networks for User Response Prediction
@author: <NAME>(<EMAIL>)
"""
import tensorflow as tf
from tensorflow.keras import Model
from tensorflow.keras.regularizers import l2
from tensorflow.keras.layers i... | """
Created on July 20, 2020
Updated on May 19, 2021
model: Product-based Neural Networks for User Response Prediction
@author: <NAME>(<EMAIL>)
"""
import tensorflow as tf
from tensorflow.keras import Model
from tensorflow.keras.regularizers import l2
from tensorflow.keras.layers import Embedding, Dense, Layer, Drop... | en | 0.6842 | Created on July 20, 2020 Updated on May 19, 2021 model: Product-based Neural Networks for User Response Prediction @author: <NAME>(<EMAIL>) Product-based Neural Networks :param feature_columns: A list. sparse column feature information. :param hidden_units: A list. Neural network hidden units. ... | 3.030722 | 3 |
exercicio3.py | DrokaGit/-infosatc-lp-avaliativo-02 | 0 | 10655 | nume1 = int(input("Digite um numero"))
nume2 = int(input("Digite um numero"))
nume3 = int(input("Digite um numero"))
nume4 = int(input("Digite um numero"))
nume5 = int(input("Digite um numero"))
table = [nume1,nume2,nume3,nume4,nume5]
tableM = (float((nume1 + nume2 + nume3 + nume4 + nume5)))
print(float(tableM)) | nume1 = int(input("Digite um numero"))
nume2 = int(input("Digite um numero"))
nume3 = int(input("Digite um numero"))
nume4 = int(input("Digite um numero"))
nume5 = int(input("Digite um numero"))
table = [nume1,nume2,nume3,nume4,nume5]
tableM = (float((nume1 + nume2 + nume3 + nume4 + nume5)))
print(float(tableM)) | none | 1 | 3.70969 | 4 | |
platonic/platonic/box/implementation.py | anatoly-scherbakov/platonic | 1 | 10656 | <filename>platonic/platonic/box/implementation.py
from typing import TypeVar
from .abstract import AbstractBox
T = TypeVar('T')
class ValueBox(AbstractBox[T]):
_value: T
@property
def value(self) -> T:
return self._value
@value.setter
def value(self, value: T):
self._value = va... | <filename>platonic/platonic/box/implementation.py
from typing import TypeVar
from .abstract import AbstractBox
T = TypeVar('T')
class ValueBox(AbstractBox[T]):
_value: T
@property
def value(self) -> T:
return self._value
@value.setter
def value(self, value: T):
self._value = va... | none | 1 | 2.999521 | 3 | |
Schemas/Subject.py | esot0/jmsa-tutoring-backend | 0 | 10657 | <reponame>esot0/jmsa-tutoring-backend<filename>Schemas/Subject.py
from mongoengine import *
class Subject(Document):
subject = StringField() | from mongoengine import *
class Subject(Document):
subject = StringField() | none | 1 | 1.912659 | 2 | |
39. Combination Sum.py | MapleLove2014/leetcode | 1 | 10658 | class Solution:
def combinationSum(self, candidates, target):
def lookup(candidates, index, target, combine, result):
if target == 0:
result.append(combine)
return
if index >= len(candidates) and target > 0:
return
... | class Solution:
def combinationSum(self, candidates, target):
def lookup(candidates, index, target, combine, result):
if target == 0:
result.append(combine)
return
if index >= len(candidates) and target > 0:
return
... | none | 1 | 3.487942 | 3 | |
crawl_comments.py | tosh1ki/NicoCrawler | 1 | 10659 | #!/usr/bin/env python
# -*- coding: utf-8 -*-
__doc__ = '''
Crawl comment from nicovideo.jp
Usage:
crawl_comments.py --url <url> --mail <mail> --pass <pass> [--sqlite <sqlite>] [--csv <csv>]
Options:
--url <url>
--mail <mail>
--pass <pass>
--sqlite <sqlite> (optional) path of comment DB [d... | #!/usr/bin/env python
# -*- coding: utf-8 -*-
__doc__ = '''
Crawl comment from nicovideo.jp
Usage:
crawl_comments.py --url <url> --mail <mail> --pass <pass> [--sqlite <sqlite>] [--csv <csv>]
Options:
--url <url>
--mail <mail>
--pass <pass>
--sqlite <sqlite> (optional) path of comment DB [d... | en | 0.181409 | #!/usr/bin/env python # -*- coding: utf-8 -*- Crawl comment from nicovideo.jp Usage: crawl_comments.py --url <url> --mail <mail> --pass <pass> [--sqlite <sqlite>] [--csv <csv>] Options: --url <url> --mail <mail> --pass <pass> --sqlite <sqlite> (optional) path of comment DB [default: comments... | 2.58352 | 3 |
sif/greedy_sim_max.py | longland-m/wikigen | 0 | 10660 | # Functions to do the greedy similarity maximisation for article:node assignments
# All code is original
import random
def computeSimSum(G, similarityMatrix, asgn):
""" Compute the total similarity sum for the current node:article assignment """
S = sum([similarityMatrix[asgn[j], asgn[i]]
for j in ra... | # Functions to do the greedy similarity maximisation for article:node assignments
# All code is original
import random
def computeSimSum(G, similarityMatrix, asgn):
""" Compute the total similarity sum for the current node:article assignment """
S = sum([similarityMatrix[asgn[j], asgn[i]]
for j in ra... | en | 0.746283 | # Functions to do the greedy similarity maximisation for article:node assignments # All code is original Compute the total similarity sum for the current node:article assignment # get random indices for initial node:article assignment # assign articles to nodes and compute initial similarity sum # maximisation loop - r... | 2.86499 | 3 |
plab/photon_counters/Idq801.py | joamatab/photonic-coupling-drivers | 0 | 10661 | import sys
import numpy as np
import shutil
import time
import itertools as it
import collections
import ctypes as ct
import os
import copy
sys.path.append(os.path.dirname(__file__))
from ThreadStoppable import ThreadStoppable
class Idq801(object):
def __init__(
self,
deviceId=-1,
timesta... | import sys
import numpy as np
import shutil
import time
import itertools as it
import collections
import ctypes as ct
import os
import copy
sys.path.append(os.path.dirname(__file__))
from ThreadStoppable import ThreadStoppable
class Idq801(object):
def __init__(
self,
deviceId=-1,
timesta... | en | 0.882109 | # Delay in seconds between setting and # checking that a parameter was set. # Initial parameters. # 1us integration time. Sets a value and makes sure it was set. Deletes all data in the `Idq801Data` directory. Choose which channels to enable. Options include: * -1 or 'all' for (all channels). ... | 2.096775 | 2 |
IRIS/IRIS_formatting.py | Xinglab/IRIS | 7 | 10662 | import sys, numpy, argparse, os
def loadSamplelist(fin_samples, sample_fin_list, sample_header, sample_name_field, sample_size):
for l in open(fin_samples):
ls=l.strip()
sample_fin_list.append(ls)
for r in open(ls):
rs=map(lambda x:x.split('/')[-sample_name_field].split('.bam')[0],r.strip().strip(',').split(... | import sys, numpy, argparse, os
def loadSamplelist(fin_samples, sample_fin_list, sample_header, sample_name_field, sample_size):
for l in open(fin_samples):
ls=l.strip()
sample_fin_list.append(ls)
for r in open(ls):
rs=map(lambda x:x.split('/')[-sample_name_field].split('.bam')[0],r.strip().strip(',').split(... | en | 0.285783 | #rs=map(lambda x:x.split('/')[-2],r.strip().strip(',').split(',')) #prepare files/folders in IRIS db directory #PARSING INPUT FILE LISTS #MAKING MERGED EVENTS LIST #START MERGING MATRICES IN BATCH MODE FOLLOWING EVENTS LIST GENERATED. #create index in IRIS db directory | 2.475284 | 2 |
quests/dataflow_python/streaming_event_generator.py | Glairly/introduction_to_tensorflow | 2 | 10663 | # This program reads a file representing web server logs in common log format and streams them into a PubSub topic
# with lag characteristics as determined by command-line arguments
import argparse
from google.cloud import pubsub_v1
import time
from datetime import datetime, timezone
import random
from anytree... | # This program reads a file representing web server logs in common log format and streams them into a PubSub topic
# with lag characteristics as determined by command-line arguments
import argparse
from google.cloud import pubsub_v1
import time
from datetime import datetime, timezone
import random
from anytree... | en | 0.873355 | # This program reads a file representing web server logs in common log format and streams them into a PubSub topic # with lag characteristics as determined by command-line arguments Reads a .json representing a taxonomy and returns
a data structure representing their hierarchical relationship
:param taxonomy_... | 2.659251 | 3 |
src/models/configs/database.py | Nardri/rbac-service | 0 | 10664 | """Database setup"""
# Third party library
from flask_sqlalchemy import SQLAlchemy
from flask_migrate import Migrate
# initialization of the database and migration
database = SQLAlchemy()
migrate = Migrate()
| """Database setup"""
# Third party library
from flask_sqlalchemy import SQLAlchemy
from flask_migrate import Migrate
# initialization of the database and migration
database = SQLAlchemy()
migrate = Migrate()
| en | 0.772135 | Database setup # Third party library # initialization of the database and migration | 1.596766 | 2 |
postreise/plot/plot_heatmap.py | lanesmith/PostREISE | 1 | 10665 | <reponame>lanesmith/PostREISE<gh_stars>1-10
import datetime as dt
import matplotlib.dates as mdates
import matplotlib.pyplot as plt
import pandas as pd
from powersimdata.input.check import _check_time_series
from postreise.analyze.time import change_time_zone
def plot_heatmap(
series,
time_zone=None,
ti... | import datetime as dt
import matplotlib.dates as mdates
import matplotlib.pyplot as plt
import pandas as pd
from powersimdata.input.check import _check_time_series
from postreise.analyze.time import change_time_zone
def plot_heatmap(
series,
time_zone=None,
time_zone_label=None,
title=None,
cmap... | en | 0.558833 | Show time-series values via an imshow where each column is one color-coded day. :param pandas.Series series: a time-series of values to be color-coded. :param str time_zone: a time zone to be passed as `tz` kwarg to :func:`postreise.analyze.time.change_time_zone`. :param str time_zone_label: a time... | 2.862601 | 3 |
tensorflow_federated/python/simulation/file_per_user_client_data.py | houcharlie/federated-legacy | 0 | 10666 | # Copyright 2018, The TensorFlow Federated 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 applicable law o... | # Copyright 2018, The TensorFlow Federated 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 applicable law o... | en | 0.755005 | # Copyright 2018, The TensorFlow Federated 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 applicable law o... | 2.130845 | 2 |
20-Blog_Clone_Project/blog_project_Practice/blog/admin.py | andy2167565/Django-Bootcamp-Practice | 0 | 10667 | from django.contrib import admin
from blog.models import Post, Comment
# Register your models here.
admin.site.register(Post)
admin.site.register(Comment)
| from django.contrib import admin
from blog.models import Post, Comment
# Register your models here.
admin.site.register(Post)
admin.site.register(Comment)
| en | 0.968259 | # Register your models here. | 1.392694 | 1 |
tests/compilation/request/test_request_compiler.py | ymoch/preacher | 3 | 10668 | <reponame>ymoch/preacher<gh_stars>1-10
from unittest.mock import NonCallableMock, sentinel
from pytest import mark, raises, fixture
from preacher.compilation.argument import Argument
from preacher.compilation.error import CompilationError, NamedNode, IndexedNode
from preacher.compilation.request.request import Reques... | from unittest.mock import NonCallableMock, sentinel
from pytest import mark, raises, fixture
from preacher.compilation.argument import Argument
from preacher.compilation.error import CompilationError, NamedNode, IndexedNode
from preacher.compilation.request.request import RequestCompiler, RequestCompiled
from preache... | none | 1 | 2.264091 | 2 | |
bot/conversation_handlers/stage01.py | gerbigtim/coaching_bot | 0 | 10669 | # imports
from telegram.ext import (
CommandHandler,
MessageHandler,
Filters,
ConversationHandler,
)
from handler_functions.start import start
from handler_functions.bio import bio
from handler_functions.gender import gender
from handler_functions.photo import photo, skip_photo
from handler_functions.lo... | # imports
from telegram.ext import (
CommandHandler,
MessageHandler,
Filters,
ConversationHandler,
)
from handler_functions.start import start
from handler_functions.bio import bio
from handler_functions.gender import gender
from handler_functions.photo import photo, skip_photo
from handler_functions.lo... | en | 0.789791 | # imports # Adds conversation handler with the states GENDER, PHOTO, LOCATION and BIO for stage 1 of the sign up | 2.080321 | 2 |
python100days/day03/conversion.py | lanSeFangZhou/pythonbase | 0 | 10670 | <reponame>lanSeFangZhou/pythonbase
# 英制单位英寸和公制单位厘米互换
value =float(input('请输入长度:'))
unit =input('请输入单位:')
if unit == 'in' or unit == '英寸':
print('%f英寸 = %f厘米' % (value, value * 2.54))
elif unit == '厘米' or unit == 'cm':
print('%f 厘米 = %f英寸' % (value, value / 2.54))
else:
print('请输入有效的单位') | # 英制单位英寸和公制单位厘米互换
value =float(input('请输入长度:'))
unit =input('请输入单位:')
if unit == 'in' or unit == '英寸':
print('%f英寸 = %f厘米' % (value, value * 2.54))
elif unit == '厘米' or unit == 'cm':
print('%f 厘米 = %f英寸' % (value, value / 2.54))
else:
print('请输入有效的单位') | zh | 0.973563 | # 英制单位英寸和公制单位厘米互换 | 3.973188 | 4 |
tests/models/test_dtfactory.py | surajsjain/ocean.py | 4 | 10671 | from ocean_lib.models.data_token import DataToken
from ocean_lib.models.dtfactory import DTFactory
from ocean_lib.ocean.util import to_base_18
def test1(network, alice_wallet, dtfactory_address):
dtfactory = DTFactory(dtfactory_address)
dt_address = dtfactory.createToken('foo_blob', 'DT1', 'DT1', to_base_18(... | from ocean_lib.models.data_token import DataToken
from ocean_lib.models.dtfactory import DTFactory
from ocean_lib.ocean.util import to_base_18
def test1(network, alice_wallet, dtfactory_address):
dtfactory = DTFactory(dtfactory_address)
dt_address = dtfactory.createToken('foo_blob', 'DT1', 'DT1', to_base_18(... | none | 1 | 2.152338 | 2 | |
methods/unilm_based/unilm/src/pytorch_pretrained_bert/optimization_fp16.py | Guaguago/CommonGen | 100 | 10672 | # coding=utf-8
"""PyTorch optimization for BERT model."""
from apex.contrib.optimizers import FP16_Optimizer
class FP16_Optimizer_State(FP16_Optimizer):
def __init__(self,
init_optimizer,
static_loss_scale=1.0,
dynamic_loss_scale=False,
dynamic_... | # coding=utf-8
"""PyTorch optimization for BERT model."""
from apex.contrib.optimizers import FP16_Optimizer
class FP16_Optimizer_State(FP16_Optimizer):
def __init__(self,
init_optimizer,
static_loss_scale=1.0,
dynamic_loss_scale=False,
dynamic_... | en | 0.819276 | # coding=utf-8 PyTorch optimization for BERT model. Returns a dict containing the current state of this :class:`FP16_Optimizer` instance. This dict contains attributes of :class:`FP16_Optimizer`, as well as the state_dict of the contained Pytorch optimizer. Example:: checkpoint = {} ... | 2.504011 | 3 |
ermaket/api/generation/__init__.py | SqrtMinusOne/ERMaket_Experiment | 0 | 10673 | from .generator import *
from .types import *
| from .generator import *
from .types import *
| none | 1 | 1.047746 | 1 | |
Source/stack0verf10w.py | IRIDIUM-SUB/Software-Security-Course-Design | 0 | 10674 | <gh_stars>0
import Bugdetectionuniversalframe
import os
import re
class overflowdetection(Bugdetectionuniversalframe.uniframe):
def __init__(self):
Bugdetectionuniversalframe.uniframe.__init__(self)
def deploy(self):#Re-write deploy method
flag=0
self.filesort()
if self.path !... | import Bugdetectionuniversalframe
import os
import re
class overflowdetection(Bugdetectionuniversalframe.uniframe):
def __init__(self):
Bugdetectionuniversalframe.uniframe.__init__(self)
def deploy(self):#Re-write deploy method
flag=0
self.filesort()
if self.path != "":
... | en | 0.537403 | #Re-write deploy method #print(text) # 打印cmd输出结果 | 2.741443 | 3 |
ndbc/station.py | ppokhrel1/ndbc | 0 | 10675 | <gh_stars>0
"""
station.py
"""
from datetime import datetime, timedelta
import gzip
import numpy as np
import requests
import urllib
_BASEURL = 'http://www.ndbc.noaa.gov/data'
_SENSOR_URL = _BASEURL+'/stations/buoyht.txt'
_REALTIME_URL = _BASEURL+'/realtime2/'
_RECENT_URL = _BASEURL+'/stdmet/'
_HISTORICAL_URL = _BASEU... | """
station.py
"""
from datetime import datetime, timedelta
import gzip
import numpy as np
import requests
import urllib
_BASEURL = 'http://www.ndbc.noaa.gov/data'
_SENSOR_URL = _BASEURL+'/stations/buoyht.txt'
_REALTIME_URL = _BASEURL+'/realtime2/'
_RECENT_URL = _BASEURL+'/stdmet/'
_HISTORICAL_URL = _BASEURL+'/histori... | en | 0.797104 | station.py NDBC Station class. Collects station metadata. Gets the standard meteorological data given start and end times. # re-initialize if we are to overwrite data #if self.time != [] and self.time != None : Reads the full realtime data feed (last 45 days) from the NDBC server. | 2.53855 | 3 |
main.py | kajuna0amendez/Cython_Machine_Learning_Models | 0 | 10676 | # -*- coding: utf-8 -*-
#!/usr/bin/env python
__author__ = "<NAME>"
__copyright__ = "Copyright 2018"
__credits__ = ["<NAME>"]
__license__ = "Apache"
__version__ = "v1.0.0"
__maintainer__ = "<NAME>"
__email = "<EMAIL>"
__status__ = "Development"
from data_model.load_data import create_connection, select_all_tasks
fro... | # -*- coding: utf-8 -*-
#!/usr/bin/env python
__author__ = "<NAME>"
__copyright__ = "Copyright 2018"
__credits__ = ["<NAME>"]
__license__ = "Apache"
__version__ = "v1.0.0"
__maintainer__ = "<NAME>"
__email = "<EMAIL>"
__status__ = "Development"
from data_model.load_data import create_connection, select_all_tasks
fro... | en | 0.400805 | # -*- coding: utf-8 -*- #!/usr/bin/env python # create a database connection | 2.795511 | 3 |
graw/__init__.py | iamsajjad/graw | 0 | 10677 | <filename>graw/__init__.py
# version of the graw package
__version__ = "0.1.0"
| <filename>graw/__init__.py
# version of the graw package
__version__ = "0.1.0"
| en | 0.790388 | # version of the graw package | 1.113284 | 1 |
sdk/python/pulumi_aws/acm/get_certificate.py | mehd-io/pulumi-aws | 0 | 10678 | <gh_stars>0
# coding=utf-8
# *** WARNING: this file was generated by the Pulumi Terraform Bridge (tfgen) Tool. ***
# *** Do not edit by hand unless you're certain you know what you are doing! ***
import warnings
import pulumi
import pulumi.runtime
from typing import Any, Mapping, Optional, Sequence, Union
from .. impo... | # coding=utf-8
# *** WARNING: this file was generated by the Pulumi Terraform Bridge (tfgen) Tool. ***
# *** Do not edit by hand unless you're certain you know what you are doing! ***
import warnings
import pulumi
import pulumi.runtime
from typing import Any, Mapping, Optional, Sequence, Union
from .. import _utilitie... | en | 0.763646 | # coding=utf-8 # *** WARNING: this file was generated by the Pulumi Terraform Bridge (tfgen) Tool. *** # *** Do not edit by hand unless you're certain you know what you are doing! *** A collection of values returned by getCertificate. Set to the ARN of the found certificate, suitable for referencing in other resources ... | 1.885338 | 2 |
Part 3/batch_VS_stochastic.py | m9psy/neural_network_habr_guide | 20 | 10679 | import numpy as np
import matplotlib.pyplot as plt
TOTAL = 200
STEP = 0.25
EPS = 0.1
INITIAL_THETA = [9, 14]
def func(x):
return 0.2 * x + 3
def generate_sample(total=TOTAL):
x = 0
while x < total * STEP:
yield func(x) + np.random.uniform(-1, 1) * np.random.uniform(2, 8)
x += STEP
def... | import numpy as np
import matplotlib.pyplot as plt
TOTAL = 200
STEP = 0.25
EPS = 0.1
INITIAL_THETA = [9, 14]
def func(x):
return 0.2 * x + 3
def generate_sample(total=TOTAL):
x = 0
while x < total * STEP:
yield func(x) + np.random.uniform(-1, 1) * np.random.uniform(2, 8)
x += STEP
def... | ru | 0.662263 | # --------------------------------------------- # Выполнение требования одновремменности # --------------------------------------------- # -------------------------------------- # for i in range(len(Y)): # -------------------------------------- # Нормализацию вкрячил, чтобы парабалоид красивый был | 3.63758 | 4 |
castle.py | codyd51/castle | 2 | 10680 | import castle
from typing import Tuple
def select_player_types() -> Tuple[castle.PlayerType, castle.PlayerType]:
player1, player2 = None, None
while True:
print(f'1) Play a person')
print(f'2) Play the computer')
print(f'3) Play the computer against itself')
choice_str = input... | import castle
from typing import Tuple
def select_player_types() -> Tuple[castle.PlayerType, castle.PlayerType]:
player1, player2 = None, None
while True:
print(f'1) Play a person')
print(f'2) Play the computer')
print(f'3) Play the computer against itself')
choice_str = input... | en | 0.447327 | # https://sites.google.com/site/numptychess/perft/position-3 # f = castle.FenGameConstructor('rnbqkbnr/pppppppp/8/8/8/8/PPPPPPPP/RNBQKBNR w KQkq - 0 1') # test_perft() # play_game() | 3.613317 | 4 |
pyfos/utils/configure/switch_configuration_show.py | madhavinaiduprathap/pyfosbrocade | 44 | 10681 | <gh_stars>10-100
#!/usr/bin/env python3
# Copyright 2018 Brocade Communications Systems LLC. 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 also obtain a copy of the License at
# http://www.apache.or... | #!/usr/bin/env python3
# Copyright 2018 Brocade Communications Systems LLC. 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 also obtain a copy of the License at
# http://www.apache.org/licenses/LICENS... | en | 0.651811 | #!/usr/bin/env python3 # Copyright 2018 Brocade Communications Systems LLC. 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 also obtain a copy of the License at # http://www.apache.org/licenses/LICENSE... | 2.291837 | 2 |
vehicle/views.py | BernardAli/vehicle-service-mgt | 105 | 10682 | <filename>vehicle/views.py
from django.shortcuts import render,redirect,reverse
from . import forms,models
from django.db.models import Sum
from django.contrib.auth.models import Group
from django.http import HttpResponseRedirect
from django.contrib.auth.decorators import login_required,user_passes_test
from django.con... | <filename>vehicle/views.py
from django.shortcuts import render,redirect,reverse
from . import forms,models
from django.db.models import Sum
from django.contrib.auth.models import Group
from django.http import HttpResponseRedirect
from django.contrib.auth.decorators import login_required,user_passes_test
from django.con... | en | 0.374225 | #for showing signup/login button for customer #for showing signup/login button for mechanics #for showing signup/login button for ADMIN(by sumit) #for checking user customer, mechanic or admin(by sumit) #============================================================================================ # ADMIN RELATED views s... | 2.135892 | 2 |
deep_disfluency/utils/tools.py | treena908/deep_disfluency | 0 | 10683 | import random
import numpy as np
import itertools
import re
from collections import defaultdict
import os
def get_tags(s, open_delim='<', close_delim='/>'):
"""Iterator to spit out the xml style disfluency tags in a given string.
Keyword arguments:
s -- input string
"""
while True:
# Sear... | import random
import numpy as np
import itertools
import re
from collections import defaultdict
import os
def get_tags(s, open_delim='<', close_delim='/>'):
"""Iterator to spit out the xml style disfluency tags in a given string.
Keyword arguments:
s -- input string
"""
while True:
# Sear... | en | 0.753053 | Iterator to spit out the xml style disfluency tags in a given string. Keyword arguments: s -- input string # Search for the next two delimiters in the source text # We found a non-empty match # Skip the length of the open delimiter # Spit out the tag # Truncate string to start from last match Takes the complex... | 3.224043 | 3 |
library/favourite/api/pagination.py | furkan-34/library-DRF-django-api | 0 | 10684 | from rest_framework.pagination import PageNumberPagination
class FavouritePagination(PageNumberPagination):
page_size=4 | from rest_framework.pagination import PageNumberPagination
class FavouritePagination(PageNumberPagination):
page_size=4 | none | 1 | 1.354843 | 1 | |
Python-Math/Python-Math/check_prime.py | rgabeflores/Scripts | 2 | 10685 | <gh_stars>1-10
'''
@author <NAME>
Checks the primality of an integer.
'''
def is_prime(x):
'''
Checks the primality of an integer.
'''
sqrt = int(x ** (1/2))
for i in range(2, sqrt, 1):
if x % i == 0:
return False
return True
def main():
try:
print("\n\n")
a = int(input(" Enter an integer to ch... | '''
@author <NAME>
Checks the primality of an integer.
'''
def is_prime(x):
'''
Checks the primality of an integer.
'''
sqrt = int(x ** (1/2))
for i in range(2, sqrt, 1):
if x % i == 0:
return False
return True
def main():
try:
print("\n\n")
a = int(input(" Enter an integer to check if it is pr... | en | 0.624917 | @author <NAME> Checks the primality of an integer. Checks the primality of an integer. | 4.116588 | 4 |
src/contrib/cortex-strings/scripts/plot-top.py | lastweek/source-freebsd | 0 | 10686 | <reponame>lastweek/source-freebsd
#!/usr/bin/env python
"""Plot the performance of different variants of the string routines
for one size.
"""
import libplot
import pylab
def plot(records, bytes):
records = [x for x in records if x.bytes==bytes]
variants = libplot.unique(records, 'variant', prefer='this')... | #!/usr/bin/env python
"""Plot the performance of different variants of the string routines
for one size.
"""
import libplot
import pylab
def plot(records, bytes):
records = [x for x in records if x.bytes==bytes]
variants = libplot.unique(records, 'variant', prefer='this')
functions = libplot.unique(re... | en | 0.651911 | #!/usr/bin/env python Plot the performance of different variants of the string routines for one size. | 2.779841 | 3 |
part1.py | aspiringguru/python_sqlite_demo | 0 | 10687 | <gh_stars>0
import sqlite3
import time, datetime, random
import matplotlib
matplotlib.use("Agg")
#added due to error, possibly due to install configuration
import matplotlib.pyplot as plt
print(matplotlib.get_backend())
import matplotlib.dates as mdates
from matplotlib import style
style.use('fivethirtyeight')
co... | import sqlite3
import time, datetime, random
import matplotlib
matplotlib.use("Agg")
#added due to error, possibly due to install configuration
import matplotlib.pyplot as plt
print(matplotlib.get_backend())
import matplotlib.dates as mdates
from matplotlib import style
style.use('fivethirtyeight')
conn = sqlite3... | en | 0.357809 | #added due to error, possibly due to install configuration Query all rows in the tasks table :param conn: the Connection object :return: #c.execute('SELECT * FROM stufftoplot') #c.execute("SELECT * FROM stufftoplot WHERE value = '5' AND keyword='python' COLLATE NOCASE") #c.execute("SELECT * FROM stufftoplot WHE... | 2.952891 | 3 |
tests/test_oic_consumer.py | infohash/pyoidc | 0 | 10688 | <gh_stars>0
import json
import os
from urllib.parse import parse_qs
from urllib.parse import urlparse
import pytest
import responses
from freezegun import freeze_time
from jwkest import BadSignature
from jwkest.jwk import SYMKey
from oic.oauth2.message import MissingSigningKey
from oic.oauth2.message import WrongSign... | import json
import os
from urllib.parse import parse_qs
from urllib.parse import urlparse
import pytest
import responses
from freezegun import freeze_time
from jwkest import BadSignature
from jwkest.jwk import SYMKey
from oic.oauth2.message import MissingSigningKey
from oic.oauth2.message import WrongSigningAlgorithm... | en | 0.845775 | # type: ignore # abs min # type: ignore # type: ignore # type: ignore # Map the URL path to the local path # Store AuthzReq with state as key # abs min # Store AuthzReq with state as key # abs min # Store AuthzReq with state as key # Downgrade the algorithm to `none` # abs min # Store AuthzReq with state as key # Downg... | 1.796626 | 2 |
setup.py | CristianPachacama/cartoframes | 1 | 10689 | <reponame>CristianPachacama/cartoframes<filename>setup.py
#!/usr/bin/env python
# -*- coding: utf-8 -*-
import os
import io
from codecs import open
from setuptools import setup, find_packages
def walk_subpkg(name):
data_files = []
package_dir = 'cartoframes'
for parent, dirs, files in os.walk(os.path.joi... | #!/usr/bin/env python
# -*- coding: utf-8 -*-
import os
import io
from codecs import open
from setuptools import setup, find_packages
def walk_subpkg(name):
data_files = []
package_dir = 'cartoframes'
for parent, dirs, files in os.walk(os.path.join(package_dir, name)):
# Remove package_dir from t... | en | 0.65402 | #!/usr/bin/env python # -*- coding: utf-8 -*- # Remove package_dir from the path. | 1.902397 | 2 |
Tests/test_BioSQL_mysql_connector_online.py | bioinf-mcb/biopython | 2 | 10690 | <filename>Tests/test_BioSQL_mysql_connector_online.py
#!/usr/bin/env python
# This code is part of the Biopython distribution and governed by its
# license. Please see the LICENSE file that should have been included
# as part of this package.
"""Run BioSQL tests using MySQL."""
import unittest
# Really do want "imp... | <filename>Tests/test_BioSQL_mysql_connector_online.py
#!/usr/bin/env python
# This code is part of the Biopython distribution and governed by its
# license. Please see the LICENSE file that should have been included
# as part of this package.
"""Run BioSQL tests using MySQL."""
import unittest
# Really do want "imp... | en | 0.893456 | #!/usr/bin/env python # This code is part of the Biopython distribution and governed by its # license. Please see the LICENSE file that should have been included # as part of this package. Run BioSQL tests using MySQL. # Really do want "import *" to get all the test clases: # noqa: F403 # noqa: F403 # Import these exp... | 1.905407 | 2 |
kalachakra/saraswati/migrations/0004_ritual_people_name.py | tony-mikhailov/Kalachakra | 0 | 10691 | <filename>kalachakra/saraswati/migrations/0004_ritual_people_name.py
# Generated by Django 2.2.6 on 2020-04-05 07:50
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('saraswati', '0003_auto_20200402_1918'),
]
operations = [
migrations.Add... | <filename>kalachakra/saraswati/migrations/0004_ritual_people_name.py
# Generated by Django 2.2.6 on 2020-04-05 07:50
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('saraswati', '0003_auto_20200402_1918'),
]
operations = [
migrations.Add... | en | 0.835019 | # Generated by Django 2.2.6 on 2020-04-05 07:50 | 1.49402 | 1 |
src/toil/jobStores/abstractJobStore.py | adamnovak/toil | 0 | 10692 | # Copyright (C) 2015 UCSC Computational Genomics Lab
#
# 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) 2015 UCSC Computational Genomics Lab
#
# 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... | en | 0.871181 | # Copyright (C) 2015 UCSC Computational Genomics Lab # # 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... | 1.768173 | 2 |
dashboard.py | TheCrypticMusic/COVID-19 | 0 | 10693 | from datetime import date
import dash
import dash_bootstrap_components as dbc
import dash_core_components as dcc
import dash_html_components as html
import pandas as pd
import plotly.express as px
from dash.dependencies import Input, Output
test_data = pd.read_csv("data/world_data.csv")
today = date.today()
external... | from datetime import date
import dash
import dash_bootstrap_components as dbc
import dash_core_components as dcc
import dash_html_components as html
import pandas as pd
import plotly.express as px
from dash.dependencies import Input, Output
test_data = pd.read_csv("data/world_data.csv")
today = date.today()
external... | en | 0.540385 | # dcc.DatePickerRange(className="date-and-location", # id="month-picker", # min_date_allowed=date(2020, 1, 30), # max_date_allowed=date(today.year, today.month, today.day), # start_date=date(2020, 3, 1), # end_date=date(... | 2.772456 | 3 |
dataset/load_data_queue.py | hezhujun/autofocus-rnn | 7 | 10694 | from collections import OrderedDict
import skimage.io as io
from config import get_config
config = get_config()
class LRUCache:
def __init__(self, capacity: int):
self._ordered_dict = OrderedDict()
self._capacity = capacity
def get(self, key):
self._move_to_end_if_exist(key)
... | from collections import OrderedDict
import skimage.io as io
from config import get_config
config = get_config()
class LRUCache:
def __init__(self, capacity: int):
self._ordered_dict = OrderedDict()
self._capacity = capacity
def get(self, key):
self._move_to_end_if_exist(key)
... | pt | 0.169125 | # image = _cache.get(path) # _cache.put(path, image) | 2.696487 | 3 |
algs/astar.py | jakedolan443/search-algorithm-visualizer | 0 | 10695 | import numpy
from heapq import *
import time
def heuristic(a, b):
return (b[0] - a[0]) ** 2 + (b[1] - a[1]) ** 2
def astar(canvas, array, start, goal):
neighbours = [(0, 1), (0, -1), (1, 0), (-1, 0)]
close_set = set()
came_from = {}
gscore = {start: 0}
fscore = {start: heuristic(start, goal)... | import numpy
from heapq import *
import time
def heuristic(a, b):
return (b[0] - a[0]) ** 2 + (b[1] - a[1]) ** 2
def astar(canvas, array, start, goal):
neighbours = [(0, 1), (0, -1), (1, 0), (-1, 0)]
close_set = set()
came_from = {}
gscore = {start: 0}
fscore = {start: heuristic(start, goal)... | none | 1 | 2.914841 | 3 | |
examples/serial_client.py | marcinbor85/qupy | 0 | 10696 | import logging
import time
from qupy.framing.slip import Slip
from qupy.interface.serial import SerialPort
from qupy.interface.errors import InterfaceTimeoutError, InterfaceIOError, InterfaceError
from qupy.comm.client import CommClient
logging.basicConfig(level=logging.DEBUG)
if __name__ == '__main__':
s = Se... | import logging
import time
from qupy.framing.slip import Slip
from qupy.interface.serial import SerialPort
from qupy.interface.errors import InterfaceTimeoutError, InterfaceIOError, InterfaceError
from qupy.comm.client import CommClient
logging.basicConfig(level=logging.DEBUG)
if __name__ == '__main__':
s = Se... | none | 1 | 2.526952 | 3 | |
summary/abs_summarization.py | solarpark7346/sukjulyo | 0 | 10697 | <filename>summary/abs_summarization.py
import torch
from transformers import PreTrainedTokenizerFast
from transformers import BartForConditionalGeneration
class AbsSummarization():
def __init__(self):
self.tokenizer = PreTrainedTokenizerFast.from_pretrained('gogamza/kobart-summarization')
self.model = BartForCon... | <filename>summary/abs_summarization.py
import torch
from transformers import PreTrainedTokenizerFast
from transformers import BartForConditionalGeneration
class AbsSummarization():
def __init__(self):
self.tokenizer = PreTrainedTokenizerFast.from_pretrained('gogamza/kobart-summarization')
self.model = BartForCon... | none | 1 | 2.466064 | 2 | |
dp_tornado/helper/io/image/__init__.py | donghak-shin/dp-tornado | 18 | 10698 | <reponame>donghak-shin/dp-tornado
# -*- coding: utf-8 -*-
import tempfile
from dp_tornado.engine.helper import Helper as dpHelper
class ImageHelper(dpHelper):
def compare(self, i1, i2, error=0):
i1 = self.load(i1)
i2 = self.load(i2)
if not i1 or not i2:
return None
... | # -*- coding: utf-8 -*-
import tempfile
from dp_tornado.engine.helper import Helper as dpHelper
class ImageHelper(dpHelper):
def compare(self, i1, i2, error=0):
i1 = self.load(i1)
i2 = self.load(i2)
if not i1 or not i2:
return None
s1 = i1.size
s2 = i2.size... | en | 0.656029 | # -*- coding: utf-8 -*- # Image Resizing # TODO # Crop # Resize # Radius # Border # Colorize # Save | 2.065348 | 2 |
script.py | triethyl/wbut-results-parsed | 1 | 10699 | import requests
from bs4 import BeautifulSoup
import json
import re
# Range of Roll Number - User Input
start_roll = int(input("Starting Roll Number: "))
end_roll = int(input("Ending Roll Number: "))
# Semester - User Input
sem = int(input("Which Semester[1-8]: "))
# Verbosity
verbose = int(input("Verbo... | import requests
from bs4 import BeautifulSoup
import json
import re
# Range of Roll Number - User Input
start_roll = int(input("Starting Roll Number: "))
end_roll = int(input("Ending Roll Number: "))
# Semester - User Input
sem = int(input("Which Semester[1-8]: "))
# Verbosity
verbose = int(input("Verbo... | en | 0.740917 | # Range of Roll Number - User Input # Semester - User Input # Verbosity # Roll Number Tuple # Getting the Websites # Semester Codes # Handle session cookies appropriately # Parse CSRF-Token # Create dict for post request # Get Result Data # This result has not yet been published # Basic Data # Subject Data # SGPA YGPA ... | 2.981308 | 3 |