hexsha stringlengths 40 40 | size int64 2 1.02M | ext stringclasses 10
values | lang stringclasses 1
value | max_stars_repo_path stringlengths 4 245 | max_stars_repo_name stringlengths 6 130 | max_stars_repo_head_hexsha stringlengths 40 40 | max_stars_repo_licenses listlengths 1 10 | max_stars_count int64 1 191k ⌀ | max_stars_repo_stars_event_min_datetime stringlengths 24 24 ⌀ | max_stars_repo_stars_event_max_datetime stringlengths 24 24 ⌀ | max_issues_repo_path stringlengths 4 245 | max_issues_repo_name stringlengths 6 130 | max_issues_repo_head_hexsha stringlengths 40 40 | max_issues_repo_licenses listlengths 1 10 | max_issues_count int64 1 67k ⌀ | max_issues_repo_issues_event_min_datetime stringlengths 24 24 ⌀ | max_issues_repo_issues_event_max_datetime stringlengths 24 24 ⌀ | max_forks_repo_path stringlengths 4 245 | max_forks_repo_name stringlengths 6 130 | max_forks_repo_head_hexsha stringlengths 40 40 | max_forks_repo_licenses listlengths 1 10 | max_forks_count int64 1 105k ⌀ | max_forks_repo_forks_event_min_datetime stringlengths 24 24 ⌀ | max_forks_repo_forks_event_max_datetime stringlengths 24 24 ⌀ | content stringlengths 2 1.02M | avg_line_length float64 1 417k | max_line_length int64 1 987k | alphanum_fraction float64 0 1 | content_no_comment stringlengths 0 1.01M | is_comment_constant_removed bool 1
class | is_sharp_comment_removed bool 1
class |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
f740f2ef727f4a5e7a691eea29bab538de4beda4 | 521 | py | Python | openbook_posts/migrations/0063_auto_20191001_1302.py | TamaraAbells/okuna-api | f87d8e80d2f182c01dbce68155ded0078ee707e4 | [
"MIT"
] | 164 | 2019-07-29T17:59:06.000Z | 2022-03-19T21:36:01.000Z | openbook_posts/migrations/0063_auto_20191001_1302.py | TamaraAbells/okuna-api | f87d8e80d2f182c01dbce68155ded0078ee707e4 | [
"MIT"
] | 188 | 2019-03-16T09:53:25.000Z | 2019-07-25T14:57:24.000Z | openbook_posts/migrations/0063_auto_20191001_1302.py | TamaraAbells/okuna-api | f87d8e80d2f182c01dbce68155ded0078ee707e4 | [
"MIT"
] | 80 | 2019-08-03T17:49:08.000Z | 2022-02-28T16:56:33.000Z | # Generated by Django 2.2.5 on 2019-10-01 11:02
from django.db import migrations, models
import django.db.models.deletion
class Migration(migrations.Migration):
dependencies = [
('openbook_posts', '0062_merge_20190920_1428'),
]
operations = [
migrations.AlterField(
model_nam... | 26.05 | 145 | 0.658349 |
from django.db import migrations, models
import django.db.models.deletion
class Migration(migrations.Migration):
dependencies = [
('openbook_posts', '0062_merge_20190920_1428'),
]
operations = [
migrations.AlterField(
model_name='toppost',
name='post',
... | true | true |
f740f358508cf272368da36004bb5d30387b76e9 | 8,659 | py | Python | mlagents/trainers/tests/test_ghost.py | kmakeev/RLs | c47e9b504db157731c26d7c881719a4fb54cc355 | [
"Apache-2.0"
] | 2 | 2020-12-01T20:46:13.000Z | 2021-03-07T16:17:45.000Z | mlagents/trainers/tests/test_ghost.py | kmakeev/RLs | c47e9b504db157731c26d7c881719a4fb54cc355 | [
"Apache-2.0"
] | null | null | null | mlagents/trainers/tests/test_ghost.py | kmakeev/RLs | c47e9b504db157731c26d7c881719a4fb54cc355 | [
"Apache-2.0"
] | null | null | null | import pytest
import numpy as np
import yaml
from mlagents.trainers.ghost.trainer import GhostTrainer
from mlagents.trainers.ghost.controller import GhostController
from mlagents.trainers.behavior_id_utils import BehaviorIdentifiers
from mlagents.trainers.ppo.trainer import PPOTrainer
from mlagents.trainers.brain im... | 34.361111 | 87 | 0.722023 | import pytest
import numpy as np
import yaml
from mlagents.trainers.ghost.trainer import GhostTrainer
from mlagents.trainers.ghost.controller import GhostController
from mlagents.trainers.behavior_id_utils import BehaviorIdentifiers
from mlagents.trainers.ppo.trainer import PPOTrainer
from mlagents.trainers.brain im... | true | true |
f740f4be54a19a8f370e3c6110f947762e6a87fe | 10,687 | py | Python | autotest/gcore/overviewds.py | trundev/gdal | d5777940975f2784980ef0b7561eeeb655fd0ab5 | [
"MIT"
] | 2 | 2018-03-22T22:31:00.000Z | 2021-07-16T01:34:47.000Z | autotest/gcore/overviewds.py | trundev/gdal | d5777940975f2784980ef0b7561eeeb655fd0ab5 | [
"MIT"
] | 3 | 2019-02-27T00:43:06.000Z | 2019-06-28T21:57:10.000Z | autotest/gcore/overviewds.py | trundev/gdal | d5777940975f2784980ef0b7561eeeb655fd0ab5 | [
"MIT"
] | null | null | null | #!/usr/bin/env pytest
# -*- coding: utf-8 -*-
###############################################################################
# $Id$
#
# Project: GDAL/OGR Test Suite
# Purpose: Test GDALOverviewDataset
# Author: Even Rouault <even dot rouault at spatialys.com>
#
#####################################################... | 34.253205 | 113 | 0.599233 | true | true | |
f740f56effb0a56f57e3cf705c3c074e7732db52 | 15,183 | py | Python | colin-api/src/colin_api/models/business.py | bsnopek-freshworks/lear | e1c53e70b62bd3073d2e5210deb6b3658fd1b719 | [
"Apache-2.0"
] | null | null | null | colin-api/src/colin_api/models/business.py | bsnopek-freshworks/lear | e1c53e70b62bd3073d2e5210deb6b3658fd1b719 | [
"Apache-2.0"
] | null | null | null | colin-api/src/colin_api/models/business.py | bsnopek-freshworks/lear | e1c53e70b62bd3073d2e5210deb6b3658fd1b719 | [
"Apache-2.0"
] | null | null | null | # Copyright © 2019 Province of British Columbia
#
# 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 agr... | 44.394737 | 120 | 0.568926 |
from datetime import datetime
from flask import current_app
from colin_api.exceptions import BusinessNotFoundException
from colin_api.resources.db import DB
from colin_api.utils import convert_to_json_date, convert_to_json_datetime, stringify_list
class Business:
business = None
def __init__(... | true | true |
f740f77a0b62dc9cfcf9e23e582da867280ae9b6 | 285 | py | Python | docs/manual/settings_local.py | asterisk/reviewboard | 34eed26d1c2122e1b05953a40c6f4cd1e8caa70b | [
"MIT"
] | 1 | 2018-10-14T15:12:19.000Z | 2018-10-14T15:12:19.000Z | docs/manual/settings_local.py | asterisk/reviewboard | 34eed26d1c2122e1b05953a40c6f4cd1e8caa70b | [
"MIT"
] | null | null | null | docs/manual/settings_local.py | asterisk/reviewboard | 34eed26d1c2122e1b05953a40c6f4cd1e8caa70b | [
"MIT"
] | null | null | null | import os
DATABASE_ENGINE = 'sqlite3'
DATABASE_NAME = 'docs.db'
SECRET_KEY = 'HASJFDYWQ98r6y2hesakjfhakjfy87eyr1hakjwfa'
CACHE_BACKEND = 'locmem://'
LOCAL_ROOT = os.path.abspath(os.path.join(os.path.dirname(__file__), 'data'))
ADMINS = [
('Example Admin', 'admin@example.com'),
]
| 25.909091 | 77 | 0.736842 | import os
DATABASE_ENGINE = 'sqlite3'
DATABASE_NAME = 'docs.db'
SECRET_KEY = 'HASJFDYWQ98r6y2hesakjfhakjfy87eyr1hakjwfa'
CACHE_BACKEND = 'locmem://'
LOCAL_ROOT = os.path.abspath(os.path.join(os.path.dirname(__file__), 'data'))
ADMINS = [
('Example Admin', 'admin@example.com'),
]
| true | true |
f740f77c0a4bbb3fed0fc05b3f31ce7b0b5a7425 | 54,659 | py | Python | electrum/wallet_db.py | chuhi4Ai/electrum | cedd2baad753e7d9a96823114bdd737b8ddbaf89 | [
"MIT"
] | 1 | 2021-03-28T17:59:38.000Z | 2021-03-28T17:59:38.000Z | electrum/wallet_db.py | chuhi4Ai/electrum | cedd2baad753e7d9a96823114bdd737b8ddbaf89 | [
"MIT"
] | null | null | null | electrum/wallet_db.py | chuhi4Ai/electrum | cedd2baad753e7d9a96823114bdd737b8ddbaf89 | [
"MIT"
] | null | null | null | #!/usr/bin/env python
#
# Electrum - lightweight Bitcoin client
# Copyright (C) 2015 Thomas Voegtlin
#
# Permission is hereby granted, free of charge, to any person
# obtaining a copy of this software and associated documentation files
# (the "Software"), to deal in the Software without restriction,
# including without... | 40.160911 | 136 | 0.5806 |
import os
import ast
import json
import copy
import threading
from collections import defaultdict
from typing import Dict, Optional, List, Tuple, Set, Iterable, NamedTuple, Sequence, TYPE_CHECKING, Union
import binascii
from . import util, bitcoin
from .util import profiler, WalletFileException... | true | true |
f740f7d5fcd69432ac8296dd37e6f0b5888bcce2 | 22,168 | py | Python | pyzoo/zoo/util/tf_graph_util.py | abdolence/analytics-zoo | 364856abcbe9aff7f7b6cf9b9f8648d51e07ca64 | [
"Apache-2.0"
] | null | null | null | pyzoo/zoo/util/tf_graph_util.py | abdolence/analytics-zoo | 364856abcbe9aff7f7b6cf9b9f8648d51e07ca64 | [
"Apache-2.0"
] | null | null | null | pyzoo/zoo/util/tf_graph_util.py | abdolence/analytics-zoo | 364856abcbe9aff7f7b6cf9b9f8648d51e07ca64 | [
"Apache-2.0"
] | null | null | null | # This file is adapted from https://github.com/tensorflow/tensorflow/blob/master
# /tensorflow/python/framework/graph_util_impl.py
#
# Copyright 2015 The TensorFlow Authors, 2019 Analytics Zoo Authors.
# All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file... | 40.75 | 90 | 0.645751 |
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
import copy
import re
import six
from tensorflow.core.framework import attr_value_pb2
from tensorflow.core.framework import graph_pb2
from tensorflow.core.framework import node_def_pb2
from t... | true | true |
f740f7e1edb9a966dbdbd060dc6c4ee70820917c | 4,626 | py | Python | tests/bugs/core_2729_test.py | reevespaul/firebird-qa | 98f16f425aa9ab8ee63b86172f959d63a2d76f21 | [
"MIT"
] | null | null | null | tests/bugs/core_2729_test.py | reevespaul/firebird-qa | 98f16f425aa9ab8ee63b86172f959d63a2d76f21 | [
"MIT"
] | null | null | null | tests/bugs/core_2729_test.py | reevespaul/firebird-qa | 98f16f425aa9ab8ee63b86172f959d63a2d76f21 | [
"MIT"
] | null | null | null | #coding:utf-8
#
# id: bugs.core_2729
# title: Current connection may be used by EXECUTE STATEMENT instead of creation of new attachment
# decription:
# Checked on:
# 4.0.0.1635 SS: 1.326s.
# 4.0.0.1633 CS: 1.725s.
# ... | 33.766423 | 123 | 0.566364 |
import pytest
from firebird.qa import db_factory, isql_act, Action
substitutions_1 = []
init_script_1 = """"""
db_1 = db_factory(sql_dialect=3, init=init_script_1)
test_script_1 = """
-- Refactored 05-JAN-2016: removed dependency on recource 'test_user' because this lead to:
-- UNTESTED... | true | true |
f740f80ccea797f47ebe2d7da18d3157cdd0d36b | 496 | py | Python | data/scripts/templates/object/tangible/ship/components/booster/shared_bst_incom_intimidator_mk2.py | obi-two/GameServer | 7d37024e2291a97d49522610cd8f1dbe5666afc2 | [
"MIT"
] | 20 | 2015-02-23T15:11:56.000Z | 2022-03-18T20:56:48.000Z | data/scripts/templates/object/tangible/ship/components/booster/shared_bst_incom_intimidator_mk2.py | apathyboy/swganh | 665128efe9154611dec4cb5efc61d246dd095984 | [
"MIT"
] | null | null | null | data/scripts/templates/object/tangible/ship/components/booster/shared_bst_incom_intimidator_mk2.py | apathyboy/swganh | 665128efe9154611dec4cb5efc61d246dd095984 | [
"MIT"
] | 20 | 2015-04-04T16:35:59.000Z | 2022-03-24T14:54:37.000Z | #### NOTICE: THIS FILE IS AUTOGENERATED
#### MODIFICATIONS MAY BE LOST IF DONE IMPROPERLY
#### PLEASE SEE THE ONLINE DOCUMENTATION FOR EXAMPLES
from swgpy.object import *
def create(kernel):
result = Tangible()
result.template = "object/tangible/ship/components/booster/shared_bst_incom_intimidator_mk2.iff"
resul... | 29.176471 | 97 | 0.75 | true | true | |
f740fa263ffd0fecb918bb3d728ade0807b7d999 | 3,188 | py | Python | examples/users/users/settings.py | mazulo/django-mock-queries | ad89723e92d6e3c08e017a6147cc50498872bd86 | [
"MIT"
] | 235 | 2016-03-27T20:04:25.000Z | 2022-03-23T01:39:49.000Z | examples/users/users/settings.py | mazulo/django-mock-queries | ad89723e92d6e3c08e017a6147cc50498872bd86 | [
"MIT"
] | 136 | 2016-03-30T13:10:43.000Z | 2022-03-10T17:38:44.000Z | examples/users/users/settings.py | sdelements/django-mock-queries | 0bab367c8a0553d1c52f2ca45cae7ead5bb24445 | [
"MIT"
] | 52 | 2016-05-30T23:00:59.000Z | 2022-03-29T12:55:56.000Z | """
Django settings for users project.
Generated by 'django-admin startproject' using Django 1.8.6.
For more information on this file, see
https://docs.djangoproject.com/en/1.8/topics/settings/
For the full list of settings and their values, see
https://docs.djangoproject.com/en/1.8/ref/settings/
"""
# Build paths ... | 27.482759 | 73 | 0.694166 |
import os
import django
BASE_DIR = os.path.dirname(os.path.dirname(os.path.abspath(__file__)))
SECRET_KEY = '3sy3!6p&s&g2@t922(%@4z+(np+yc#amz0id80vyk03$x8&38$'
DEBUG = True
ALLOWED_HOSTS = []
# Application definition
INSTALLED_APPS = (
'django.contrib.admin',
'django.contrib.auth',
'django.c... | true | true |
f740fabb5a04d9846da0a4a5441b0105ae0fbf9f | 807 | py | Python | scripts/sequence_clusters/treefam/add_lengths_to_fam_file.py | mahajrod/MAVR | 4db74dff7376a2ffe4426db720b241de9198f329 | [
"MIT"
] | 10 | 2015-04-28T14:15:04.000Z | 2021-03-15T00:07:38.000Z | scripts/sequence_clusters/treefam/add_lengths_to_fam_file.py | mahajrod/MAVR | 4db74dff7376a2ffe4426db720b241de9198f329 | [
"MIT"
] | null | null | null | scripts/sequence_clusters/treefam/add_lengths_to_fam_file.py | mahajrod/MAVR | 4db74dff7376a2ffe4426db720b241de9198f329 | [
"MIT"
] | 6 | 2017-03-16T22:38:41.000Z | 2021-08-11T00:22:52.000Z | #!/usr/bin/env python
__author__ = 'Sergei F. Kliver'
import sys
import argparse
from RouToolPa.Routines import TreeFamRoutines
parser = argparse.ArgumentParser()
parser.add_argument("-i", "--fam_file", action="store", dest="fam_file", required=True,
help="File with families")
parser.add_argumen... | 35.086957 | 112 | 0.695167 |
__author__ = 'Sergei F. Kliver'
import sys
import argparse
from RouToolPa.Routines import TreeFamRoutines
parser = argparse.ArgumentParser()
parser.add_argument("-i", "--fam_file", action="store", dest="fam_file", required=True,
help="File with families")
parser.add_argument("-l", "--length_fil... | true | true |
f740fb6cd3885f76396a865dabd0f14898ed8d87 | 3,240 | py | Python | yatube/yatube/settings.py | xxxcuzme/yatube_project | d71e76ef6994e3bf11815bf6f21eca44fcaef487 | [
"MIT"
] | null | null | null | yatube/yatube/settings.py | xxxcuzme/yatube_project | d71e76ef6994e3bf11815bf6f21eca44fcaef487 | [
"MIT"
] | null | null | null | yatube/yatube/settings.py | xxxcuzme/yatube_project | d71e76ef6994e3bf11815bf6f21eca44fcaef487 | [
"MIT"
] | null | null | null | """
Django settings for yatube project.
Generated by 'django-admin startproject' using Django 2.2.19.
For more information on this file, see
https://docs.djangoproject.com/en/2.2/topics/settings/
For the full list of settings and their values, see
https://docs.djangoproject.com/en/2.2/ref/settings/
"""
import os
#... | 25.92 | 91 | 0.698148 |
import os
BASE_DIR = os.path.dirname(os.path.dirname(os.path.abspath(__file__)))
STATICFILES_DIRS = (os.path.join(BASE_DIR, 'static'),)
SECRET_KEY = 'szx!&jiapx#&vo^8aw=ffsv9^+63hdzt!2)gf##751noj!tu73'
DEBUG = True
ALLOWED_HOSTS = []
# Application definition
INSTALLED_APPS = [
'django.contrib.admin',... | true | true |
f740fc36a982c97fb094fd7080009a42d74da885 | 2,167 | py | Python | thebookgarden/thebookgarden/views.py | ArsalanJamali/TheBookGarden | 153bfa229cd897b19b9e0827acc06dbe63558174 | [
"MIT"
] | null | null | null | thebookgarden/thebookgarden/views.py | ArsalanJamali/TheBookGarden | 153bfa229cd897b19b9e0827acc06dbe63558174 | [
"MIT"
] | null | null | null | thebookgarden/thebookgarden/views.py | ArsalanJamali/TheBookGarden | 153bfa229cd897b19b9e0827acc06dbe63558174 | [
"MIT"
] | null | null | null | from django.shortcuts import render
from django.views.generic import TemplateView
from django.utils.translation import ugettext as _
from django.core.mail import send_mail
from django.contrib import messages
from django.conf import settings
import json
from product_app.models import Book
from .utils import get_new_cart... | 29.684932 | 105 | 0.612829 | from django.shortcuts import render
from django.views.generic import TemplateView
from django.utils.translation import ugettext as _
from django.core.mail import send_mail
from django.contrib import messages
from django.conf import settings
import json
from product_app.models import Book
from .utils import get_new_cart... | true | true |
f740fc88144601bfdf9391c6d3610da068731846 | 799 | py | Python | web_app/tasks/tasks.py | MartykQ/flask-celery-postgres-template | 808d00de77a878ac78442d2956fd54c09fe932f8 | [
"MIT"
] | 2 | 2022-02-01T08:03:53.000Z | 2022-02-07T09:34:39.000Z | web_app/tasks/tasks.py | MartykQ/flask-celery-postgres-template | 808d00de77a878ac78442d2956fd54c09fe932f8 | [
"MIT"
] | null | null | null | web_app/tasks/tasks.py | MartykQ/flask-celery-postgres-template | 808d00de77a878ac78442d2956fd54c09fe932f8 | [
"MIT"
] | null | null | null | """
Definitions of tasks executed by Celery
"""
import logging
from web_app.extensions import celery
from web_app.extensions import db
from web_app.models.example_table import ExampleTable
from web_app.scheduled_tasks.scheduled_task import example_scheduled_task
@celery.task(name="healthcheck_task")
def healthcheck... | 25.774194 | 73 | 0.765957 |
import logging
from web_app.extensions import celery
from web_app.extensions import db
from web_app.models.example_table import ExampleTable
from web_app.scheduled_tasks.scheduled_task import example_scheduled_task
@celery.task(name="healthcheck_task")
def healthcheck_task():
i = db.session.query(ExampleTable)
... | true | true |
f740fdba9729fd19a221e6183d4f17f1bf87da07 | 7,745 | py | Python | uliweb/form/template_layout.py | timgates42/uliweb | 80c0459c5e5d257b665eb2e1d0b5f68ad55c42f1 | [
"BSD-2-Clause"
] | 202 | 2015-01-12T08:10:48.000Z | 2021-11-08T09:04:32.000Z | uliweb/form/template_layout.py | timgates42/uliweb | 80c0459c5e5d257b665eb2e1d0b5f68ad55c42f1 | [
"BSD-2-Clause"
] | 30 | 2015-01-01T09:07:17.000Z | 2021-06-03T12:58:45.000Z | uliweb/form/template_layout.py | timgates42/uliweb | 80c0459c5e5d257b665eb2e1d0b5f68ad55c42f1 | [
"BSD-2-Clause"
] | 58 | 2015-01-12T03:28:54.000Z | 2022-01-14T01:58:08.000Z | from __future__ import with_statement
from layout import Layout
from uliweb.core import uaml
from uliweb.core.html import Tag, begin_tag, end_tag, u_str
class FormWriter(uaml.Writer):
field_classes = {
('Text', 'Password', 'TextArea'):'type-text',
('Button', 'Submit', 'Reset'):'type-butto... | 35.204545 | 130 | 0.521627 | from __future__ import with_statement
from layout import Layout
from uliweb.core import uaml
from uliweb.core.html import Tag, begin_tag, end_tag, u_str
class FormWriter(uaml.Writer):
field_classes = {
('Text', 'Password', 'TextArea'):'type-text',
('Button', 'Submit', 'Reset'):'type-butto... | true | true |
f741003f8c1b2e34ce20886381b753ba1ddacaf1 | 2,597 | py | Python | utils.py | uzck/tf_net_parser | 5e9da1e8a317ef24c2f1577a56d6445e432b1f5d | [
"Apache-2.0"
] | null | null | null | utils.py | uzck/tf_net_parser | 5e9da1e8a317ef24c2f1577a56d6445e432b1f5d | [
"Apache-2.0"
] | null | null | null | utils.py | uzck/tf_net_parser | 5e9da1e8a317ef24c2f1577a56d6445e432b1f5d | [
"Apache-2.0"
] | null | null | null | import os
import numpy as np
import matplotlib.image as mpimg
import matplotlib.pyplot as plt
import cv2
import tensorflow as tf
from PIL import Image
def image_to_ndarray(image_path: str) -> np.ndarray:
"""
Args:
image_path: 图片文件路径
"""
pass
def read_image(image_path: str):
"""
读取图片
... | 27.052083 | 144 | 0.648441 | import os
import numpy as np
import matplotlib.image as mpimg
import matplotlib.pyplot as plt
import cv2
import tensorflow as tf
from PIL import Image
def image_to_ndarray(image_path: str) -> np.ndarray:
pass
def read_image(image_path: str):
if not os.path.exists(image_path):
print('图片文件路径出错')
im... | true | true |
f741004276c2d3f5ad1e36378e0385939309e820 | 221 | py | Python | Python/DataStructure/Anagram/Anagram.py | Rr1901/AlgorithmsAndDataStructure | b5606bbdc2a8e924a111e3757d02b3aeb780e053 | [
"MIT"
] | 195 | 2020-05-09T02:26:13.000Z | 2022-03-30T06:12:07.000Z | Python/DataStructure/Anagram/Anagram.py | Trombokendu-dev/AlgorithmsAndDataStructure | acdef5145e53f71281e8ae353f90bda98b100063 | [
"MIT"
] | 31 | 2021-06-15T19:00:57.000Z | 2022-02-02T15:51:25.000Z | Python/DataStructure/Anagram/Anagram.py | Trombokendu-dev/AlgorithmsAndDataStructure | acdef5145e53f71281e8ae353f90bda98b100063 | [
"MIT"
] | 64 | 2020-05-09T02:26:15.000Z | 2022-02-23T16:02:01.000Z | # Checking if two words are anagrams or not
# or without having to import anything
def is_anagram(str1, str2):
return sorted(str1) == sorted(str2)
print(is_anagram('geek', 'eegk'))
print(is_anagram('geek', 'peek'))
| 24.555556 | 43 | 0.714932 |
def is_anagram(str1, str2):
return sorted(str1) == sorted(str2)
print(is_anagram('geek', 'eegk'))
print(is_anagram('geek', 'peek'))
| true | true |
f74100ac1dbd5701a96b7132c9c2e4722c5cacc3 | 728 | py | Python | code/python_scripts/reverse.py | lukaschoebel/LUMOS | 5d084e487d937957896a58ef3ab719f86074fa9a | [
"MIT"
] | null | null | null | code/python_scripts/reverse.py | lukaschoebel/LUMOS | 5d084e487d937957896a58ef3ab719f86074fa9a | [
"MIT"
] | null | null | null | code/python_scripts/reverse.py | lukaschoebel/LUMOS | 5d084e487d937957896a58ef3ab719f86074fa9a | [
"MIT"
] | null | null | null | import unittest
def reverse(str) -> str:
if len(str) < 2:
return str
else:
result = ''
for character in reversed(str):
result += character
return result
class TestReverse(unittest.TestCase):
def setUp(self):
pass
def test_string(self):
... | 22.060606 | 81 | 0.585165 | import unittest
def reverse(str) -> str:
if len(str) < 2:
return str
else:
result = ''
for character in reversed(str):
result += character
return result
class TestReverse(unittest.TestCase):
def setUp(self):
pass
def test_string(self):
... | true | true |
f74100c13208dc5b8324ad662068f3d4b92f92e8 | 47 | py | Python | 09_Operator_plus/main.py | jmmedel/Python-Tutorials- | 243ae9a6b51a4fce03dd90c02da13b859cbfbe5f | [
"MIT"
] | null | null | null | 09_Operator_plus/main.py | jmmedel/Python-Tutorials- | 243ae9a6b51a4fce03dd90c02da13b859cbfbe5f | [
"MIT"
] | null | null | null | 09_Operator_plus/main.py | jmmedel/Python-Tutorials- | 243ae9a6b51a4fce03dd90c02da13b859cbfbe5f | [
"MIT"
] | null | null | null |
x = 1
y = 1
result = x + y
print(result)
| 5.875 | 15 | 0.489362 |
x = 1
y = 1
result = x + y
print(result)
| true | true |
f741012a7674f507f8c0ca0ca794cc81a327dc39 | 1,514 | py | Python | controller/network_generator.py | demx8as6/network-topology-instance-generator | 5dcdba9ad295de32a5a0986f6f39c36c5a4695db | [
"Apache-2.0"
] | null | null | null | controller/network_generator.py | demx8as6/network-topology-instance-generator | 5dcdba9ad295de32a5a0986f6f39c36c5a4695db | [
"Apache-2.0"
] | null | null | null | controller/network_generator.py | demx8as6/network-topology-instance-generator | 5dcdba9ad295de32a5a0986f6f39c36c5a4695db | [
"Apache-2.0"
] | null | null | null | # Copyright 2022 highstreet technologies GmbH
#
# 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 agree... | 31.541667 | 75 | 0.712021 |
from model.python.tapi_common_context import TapiCommonContext
class TopologyGenerator:
__configuration: dict = {}
def __init__(self, configuration: dict):
self.__configuration = configuration
def configuration(self) -> dict:
return self.__configuration
... | true | true |
f74102316e6c17c2a7757279b5fc73a1fd0e9e25 | 4,369 | py | Python | qatrack/notifications/service_log_scheduling/admin.py | crcrewso/qatrackplus | b9da3bc542d9e3eca8b7291bb631d1c7255d528e | [
"MIT"
] | 20 | 2021-03-11T18:37:32.000Z | 2022-03-23T19:38:07.000Z | qatrack/notifications/service_log_scheduling/admin.py | crcrewso/qatrackplus | b9da3bc542d9e3eca8b7291bb631d1c7255d528e | [
"MIT"
] | 75 | 2021-02-12T02:37:33.000Z | 2022-03-29T20:56:16.000Z | qatrack/notifications/service_log_scheduling/admin.py | crcrewso/qatrackplus | b9da3bc542d9e3eca8b7291bb631d1c7255d528e | [
"MIT"
] | 5 | 2021-04-07T15:46:53.000Z | 2021-09-18T16:55:00.000Z | from django import forms
from django.contrib import admin
from django.utils.translation import gettext as _
from django.utils.translation import gettext_lazy as _l
from qatrack.notifications import models
from qatrack.qatrack_core.admin import BaseQATrackAdmin
class ServiceEventSchedulingNoticeAdminForm(forms.ModelF... | 34.401575 | 118 | 0.623255 | from django import forms
from django.contrib import admin
from django.utils.translation import gettext as _
from django.utils.translation import gettext_lazy as _l
from qatrack.notifications import models
from qatrack.qatrack_core.admin import BaseQATrackAdmin
class ServiceEventSchedulingNoticeAdminForm(forms.ModelF... | true | true |
f74102324da513b12e04e16be5caf383e6295c80 | 10,335 | py | Python | pennylane/circuit_drawer/tape_mpl.py | emildi/pennylane | 64901ef2f920f42385b65c8da538941ff36da7be | [
"Apache-2.0"
] | 1 | 2021-12-07T17:18:26.000Z | 2021-12-07T17:18:26.000Z | pennylane/circuit_drawer/tape_mpl.py | emildi/pennylane | 64901ef2f920f42385b65c8da538941ff36da7be | [
"Apache-2.0"
] | null | null | null | pennylane/circuit_drawer/tape_mpl.py | emildi/pennylane | 64901ef2f920f42385b65c8da538941ff36da7be | [
"Apache-2.0"
] | 1 | 2021-12-07T17:18:36.000Z | 2021-12-07T17:18:36.000Z | # Copyright 2018-2021 Xanadu Quantum Technologies 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... | 34.915541 | 122 | 0.641122 |
from pennylane import ops
from pennylane.wires import Wires
from .mpldrawer import MPLDrawer
from .drawable_layers import drawable_layers
from .utils import convert_wire_order
pped_wires = [wire_map[w] for w in op.wires]
specialfunc(drawer, layer, mapped_wires, op)
else:
... | true | true |
f74102928e259947f33fb24491fd27754c557cc2 | 476 | py | Python | 014-max.py | richardvecsey/python-basics | b66abef77bce2ddd6f2f39b631e1dd97a9aa2fac | [
"MIT"
] | 3 | 2019-12-29T18:52:21.000Z | 2020-02-20T09:18:08.000Z | 014-max.py | richardvecsey/python-basics | b66abef77bce2ddd6f2f39b631e1dd97a9aa2fac | [
"MIT"
] | null | null | null | 014-max.py | richardvecsey/python-basics | b66abef77bce2ddd6f2f39b631e1dd97a9aa2fac | [
"MIT"
] | 2 | 2020-02-20T09:18:13.000Z | 2020-06-04T04:51:44.000Z | """
Get the highest value from an iterable
--------------------------------------
Input: iterable
Return: highest value
"""
numbers = [6, 5, 2, -1, 0, 1, 2, 3, 4, 5]
print('list: {}\n max: {}'.format(numbers, max(numbers)))
floats = [6.0, 5.1, 2.0, -1.0, 0.5, 1.9, 2.8, 3.4, 4.6, 5.1]
print('\nli... | 29.75 | 61 | 0.495798 |
numbers = [6, 5, 2, -1, 0, 1, 2, 3, 4, 5]
print('list: {}\n max: {}'.format(numbers, max(numbers)))
floats = [6.0, 5.1, 2.0, -1.0, 0.5, 1.9, 2.8, 3.4, 4.6, 5.1]
print('\nlist: {}\n max: {}'.format(floats, max(floats)))
cars = ["Ford", "Audi", "BMW", "Chrysler", "Dodge"]
print('\nlist: {}\n max: {}'.format(ca... | true | true |
f74102ab2066203ee44afa3688c7f9b83ae05885 | 132 | py | Python | standard_bisim/constants.py | SuperElephant/Bisimulation_fyp_2019 | 736f7e64dc9f381450c3539ec254ef23dae65c5b | [
"Apache-2.0"
] | 1 | 2019-04-29T12:37:17.000Z | 2019-04-29T12:37:17.000Z | standard_bisim/constants.py | SuperElephant/Bisimulation_fyp_2019 | 736f7e64dc9f381450c3539ec254ef23dae65c5b | [
"Apache-2.0"
] | 7 | 2019-03-15T01:56:03.000Z | 2022-02-10T00:06:36.000Z | standard_bisim/constants.py | SuperElephant/Bisimulation_fyp_2019 | 736f7e64dc9f381450c3539ec254ef23dae65c5b | [
"Apache-2.0"
] | null | null | null | # this file define all constant used in the project
# visualization.py
NODE_COLOR_SCHEME = "dark28"
EDGE_COLOR_SCHEME = "paired12"
| 22 | 51 | 0.787879 |
NODE_COLOR_SCHEME = "dark28"
EDGE_COLOR_SCHEME = "paired12"
| true | true |
f74102b921b1a3ec657ff99ede4ae6a62b84fd5c | 21,564 | py | Python | blender/addons/2.7/mira_tools/mi_curve_main.py | belzecue/mifthtools | 4ac6d848ccaf118adc1a870b5bb9f9c01407baa3 | [
"BSD-3-Clause"
] | 730 | 2015-01-06T13:13:22.000Z | 2022-03-30T09:47:56.000Z | blender/addons/2.7/mira_tools/mi_curve_main.py | belzecue/mifthtools | 4ac6d848ccaf118adc1a870b5bb9f9c01407baa3 | [
"BSD-3-Clause"
] | 32 | 2015-02-17T03:09:58.000Z | 2021-05-26T10:47:40.000Z | blender/addons/2.7/mira_tools/mi_curve_main.py | belzecue/mifthtools | 4ac6d848ccaf118adc1a870b5bb9f9c01407baa3 | [
"BSD-3-Clause"
] | 126 | 2015-01-06T10:56:43.000Z | 2022-03-20T13:46:48.000Z | # ***** BEGIN GPL LICENSE BLOCK *****
#
#
# This program 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 2
# of the License, or (at your option) any later version.
#
# This program is distribute... | 35.006494 | 138 | 0.636709 |
import bpy
import bgl
import blf
import string
from bpy.props import *
from bpy.types import Operator, AddonPreferences
from bpy_extras import view3d_utils
import math
import mathutils as mathu
import random
from mathutils import Vector
from . import mi_utils_base as ut_base
... | true | true |
f74104225468f45c9407df69ec54498763326488 | 1,258 | py | Python | backend/manage.py | dasdachs/flask-blog | d484026c1057e991a89df54d3fec20b43a507d1b | [
"MIT"
] | null | null | null | backend/manage.py | dasdachs/flask-blog | d484026c1057e991a89df54d3fec20b43a507d1b | [
"MIT"
] | null | null | null | backend/manage.py | dasdachs/flask-blog | d484026c1057e991a89df54d3fec20b43a507d1b | [
"MIT"
] | 1 | 2020-04-08T17:48:34.000Z | 2020-04-08T17:48:34.000Z | #!/usr/bin/env python3.4
import os
import sys
from subprocess import call
from flask_script import Manager
from flask_migrate import MigrateCommand
from config import config
from app import app_factory, db
app = app_factory('development') # TODO implement env variables
manager = Manager(app)
# The migrate comand
m... | 26.208333 | 81 | 0.673291 |
import os
import sys
from subprocess import call
from flask_script import Manager
from flask_migrate import MigrateCommand
from config import config
from app import app_factory, db
app = app_factory('development')
manager = Manager(app)
manager.add_command('db', MigrateCommand)
@manager.command
def test():
... | true | true |
f7410499d1122699b82ce6a7c68b6aaced6ae347 | 578 | py | Python | lab/refactoring/replace_nested_conditional_with_guard_clauses.py | sprajjwal/spd2.3-Testing_and_Architecture | 333e4e191d51eae3f8e84b2aca2f2f63731a22aa | [
"MIT"
] | null | null | null | lab/refactoring/replace_nested_conditional_with_guard_clauses.py | sprajjwal/spd2.3-Testing_and_Architecture | 333e4e191d51eae3f8e84b2aca2f2f63731a22aa | [
"MIT"
] | null | null | null | lab/refactoring/replace_nested_conditional_with_guard_clauses.py | sprajjwal/spd2.3-Testing_and_Architecture | 333e4e191d51eae3f8e84b2aca2f2f63731a22aa | [
"MIT"
] | null | null | null | # by Kami Bigdely
# Replace nested conditional with guard clauses
def extract_position(line):
if line is not None and "x:" in line:
start_index = line.find("x:") + 2
pos = line[start_index:] # from start_index to the end.
else:
pos = None
return pos
if __name__ == "... | 28.9 | 85 | 0.640138 |
def extract_position(line):
if line is not None and "x:" in line:
start_index = line.find("x:") + 2
pos = line[start_index:]
else:
pos = None
return pos
if __name__ == "__main__":
result1 = extract_position("|error| numerical calculations could not converge.")
... | true | true |
f74105373cdd2d7cc2a1c4cfafa7abdd7842398a | 4,119 | py | Python | sunpy/tests/setup_command.py | Naman9639/sunpy | 24c0cfbd9b03d7f9554bc86036fac2b78a5fcc56 | [
"BSD-2-Clause"
] | null | null | null | sunpy/tests/setup_command.py | Naman9639/sunpy | 24c0cfbd9b03d7f9554bc86036fac2b78a5fcc56 | [
"BSD-2-Clause"
] | null | null | null | sunpy/tests/setup_command.py | Naman9639/sunpy | 24c0cfbd9b03d7f9554bc86036fac2b78a5fcc56 | [
"BSD-2-Clause"
] | null | null | null | # -*- coding: utf-8 -*-
"""
This file is designed to be imported and ran only via setup.py, hence it's
dependency on astropy_helpers which will be available in that context.
"""
import os
import copy
from astropy_helpers.commands.test import AstropyTest
class SunPyTest(AstropyTest):
description = 'Run the tests ... | 38.858491 | 96 | 0.53144 |
import os
import copy
from astropy_helpers.commands.test import AstropyTest
class SunPyTest(AstropyTest):
description = 'Run the tests for this package'
user_options = copy.copy(AstropyTest.user_options)
user_options.remove(('remote-data=', 'R',
'Run tests that download remote... | true | true |
f741060cc87ca9ddffdb3de329a246db1e669adf | 12,088 | py | Python | src/prefect/tasks/snowflake/snowflake.py | concreted/prefect | dd732f5990ee2b0f3d816adb285168fd63b239e4 | [
"Apache-2.0"
] | 2 | 2021-10-07T19:56:51.000Z | 2021-11-09T10:47:01.000Z | src/prefect/tasks/snowflake/snowflake.py | concreted/prefect | dd732f5990ee2b0f3d816adb285168fd63b239e4 | [
"Apache-2.0"
] | 15 | 2021-12-18T09:11:34.000Z | 2022-03-31T03:37:15.000Z | src/prefect/tasks/snowflake/snowflake.py | concreted/prefect | dd732f5990ee2b0f3d816adb285168fd63b239e4 | [
"Apache-2.0"
] | 1 | 2021-11-30T05:49:13.000Z | 2021-11-30T05:49:13.000Z | from pathlib import Path
import snowflake.connector as sf
from snowflake.connector.cursor import SnowflakeCursor
from prefect import Task
from prefect.utilities.tasks import defaults_from_attrs
class SnowflakeQuery(Task):
"""
Task for executing a query against a Snowflake database.
Args:
- accou... | 36.519637 | 97 | 0.5886 | from pathlib import Path
import snowflake.connector as sf
from snowflake.connector.cursor import SnowflakeCursor
from prefect import Task
from prefect.utilities.tasks import defaults_from_attrs
class SnowflakeQuery(Task):
def __init__(
self,
account: str = None,
user: str = None,
... | true | true |
f74107635e5229b83d83a4068496c8bb73f4a249 | 3,413 | py | Python | app/app/settings.py | TxiviDavid/recipe-app-api | 8c9b7402abe78bd04b65f7900914a3170266a8a1 | [
"MIT"
] | null | null | null | app/app/settings.py | TxiviDavid/recipe-app-api | 8c9b7402abe78bd04b65f7900914a3170266a8a1 | [
"MIT"
] | null | null | null | app/app/settings.py | TxiviDavid/recipe-app-api | 8c9b7402abe78bd04b65f7900914a3170266a8a1 | [
"MIT"
] | null | null | null | """
Django settings for app project.
Generated by 'django-admin startproject' using Django 2.1.15.
For more information on this file, see
https://docs.djangoproject.com/en/2.1/topics/settings/
For the full list of settings and their values, see
https://docs.djangoproject.com/en/2.1/ref/settings/
"""
import os
# Bu... | 25.281481 | 91 | 0.686786 |
import os
BASE_DIR = os.path.dirname(os.path.dirname(os.path.abspath(__file__)))
SECRET_KEY = 'h*a+l$fv=kzviydb68m@knh=6wh17c(e(tkdyq&fn4ht5lhrqt'
DEBUG = True
ALLOWED_HOSTS = []
# Application definition
INSTALLED_APPS = [
'django.contrib.admin',
'django.contrib.auth',
'django.contrib.content... | true | true |
f74109dae63626a9507aa0b0c84537a357c1ae03 | 1,114 | py | Python | client/models/status.py | onlineconvert/onlineconvert-api-sdk-python3 | 7541fa4cbc39dab226a2822fca3491f4ba1b6e69 | [
"Apache-2.0"
] | null | null | null | client/models/status.py | onlineconvert/onlineconvert-api-sdk-python3 | 7541fa4cbc39dab226a2822fca3491f4ba1b6e69 | [
"Apache-2.0"
] | null | null | null | client/models/status.py | onlineconvert/onlineconvert-api-sdk-python3 | 7541fa4cbc39dab226a2822fca3491f4ba1b6e69 | [
"Apache-2.0"
] | 2 | 2017-11-16T01:52:21.000Z | 2019-05-07T22:43:43.000Z | #!/usr/bin/env python
"""
Copyright 2015 SmartBear Software
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... | 25.906977 | 80 | 0.608618 |
class Status:
def __init__(self):
self.swaggerTypes = {
'code': 'str',
'info': 'str'
}
self.code = None
self.info = None
| true | true |
f7410aba28e5f187cf4008e5341018bd13f1434d | 13,981 | py | Python | frame_2D_alg/class_cluster.py | Kelvin-spacy/CogAlg | e0f44a8746ba33a07864505d6e2ae959859024b0 | [
"MIT"
] | 2 | 2021-05-11T00:52:38.000Z | 2021-05-31T07:04:49.000Z | frame_2D_alg/class_cluster.py | Kelvin-spacy/CogAlg | e0f44a8746ba33a07864505d6e2ae959859024b0 | [
"MIT"
] | null | null | null | frame_2D_alg/class_cluster.py | Kelvin-spacy/CogAlg | e0f44a8746ba33a07864505d6e2ae959859024b0 | [
"MIT"
] | null | null | null | """
Provide a base class for cluster objects in CogAlg.
Features:
- Unique instance ids per class.
- Instances are retrievable by ids via class.
- Reduced memory usage compared to using dict.
- Methods generated via string templates so overheads caused by
differences in interfaces are mostly eliminated.
- Can be extend... | 37.583333 | 139 | 0.546527 |
import weakref
from numbers import Number
from inspect import isclass
import numpy as np
NoneType = type(None)
_methods_template = '''
@property
def id(self):
return self._id
def pack(self{pack_args}):
"""Pack all fields/params back into {typename}."""
{pack_assignments}
def unpack(self):
... | true | true |
f7410afe47b274ded292fa54e063b332cb417d51 | 6,989 | py | Python | kinto/core/cache/testing.py | shivasheeshyadav/kinto | 814c30c5dd745717b8ea50d708d9163a38d2a9ec | [
"Apache-2.0"
] | null | null | null | kinto/core/cache/testing.py | shivasheeshyadav/kinto | 814c30c5dd745717b8ea50d708d9163a38d2a9ec | [
"Apache-2.0"
] | 2 | 2019-11-06T11:45:41.000Z | 2019-11-06T13:25:51.000Z | kinto/core/cache/testing.py | shivasheeshyadav/kinto | 814c30c5dd745717b8ea50d708d9163a38d2a9ec | [
"Apache-2.0"
] | 1 | 2021-02-14T05:59:37.000Z | 2021-02-14T05:59:37.000Z | import time
from unittest import mock
import pytest
from pyramid import testing
from kinto.core.cache import heartbeat
from kinto.core.storage import exceptions
class CacheTest:
backend = None
settings = {}
def setUp(self):
super().setUp()
self.cache = self.backend.load_from_config(self... | 33.280952 | 89 | 0.641723 | import time
from unittest import mock
import pytest
from pyramid import testing
from kinto.core.cache import heartbeat
from kinto.core.storage import exceptions
class CacheTest:
backend = None
settings = {}
def setUp(self):
super().setUp()
self.cache = self.backend.load_from_config(self... | true | true |
f7410b435039d25682a806dcb16c4cbcefc192a6 | 1,098 | py | Python | hunkim/ml_lab_03_02.py | juvenilehex/ml2 | 57fa64660a87b2e432872c06414d1a86846ce380 | [
"Apache-2.0"
] | 33 | 2017-02-20T09:26:26.000Z | 2021-03-17T15:15:21.000Z | hunkim/ml_lab_03_02.py | angelkim88/ml | 57fa64660a87b2e432872c06414d1a86846ce380 | [
"Apache-2.0"
] | null | null | null | hunkim/ml_lab_03_02.py | angelkim88/ml | 57fa64660a87b2e432872c06414d1a86846ce380 | [
"Apache-2.0"
] | 58 | 2017-02-22T05:18:00.000Z | 2021-06-08T08:41:17.000Z | # 참고자료
# 모두를 위한 머신러닝/딥러닝 강의
# 홍콩과기대 김성훈
# http://hunkim.github.io/ml
import tensorflow as tf
import matplotlib.pyplot as plt
x_data = [1., 2., 3.]
y_data = [1., 2., 3.]
W = tf.Variable(tf.random_uniform([1], -10.0, 10.0))
X = tf.placeholder(tf.float32)
Y = tf.placeholder(tf.float32)
hypothesis = W * X
cost = tf.... | 21.115385 | 73 | 0.656648 |
import tensorflow as tf
import matplotlib.pyplot as plt
x_data = [1., 2., 3.]
y_data = [1., 2., 3.]
W = tf.Variable(tf.random_uniform([1], -10.0, 10.0))
X = tf.placeholder(tf.float32)
Y = tf.placeholder(tf.float32)
hypothesis = W * X
cost = tf.reduce_mean(tf.square(hypothesis - Y))
decent = W - tf.multiply... | true | true |
f7410d46ea71ecd1d63b93f154cbb03e00be759a | 1,487 | py | Python | algorithms/bfs/maze_search.py | Heart-throb-Rajnish/algorithms | bc0b1d33aad8e07bc6f35c54d1b5ace01ea92a9e | [
"MIT"
] | 22,426 | 2017-01-17T04:01:44.000Z | 2022-03-31T12:06:16.000Z | algorithms/bfs/maze_search.py | khiemtran99/algorithms | e498d4e01619b85cd4db0b150e24508946ac32d7 | [
"MIT"
] | 523 | 2017-04-18T12:05:11.000Z | 2022-03-20T11:10:41.000Z | algorithms/bfs/maze_search.py | khiemtran99/algorithms | e498d4e01619b85cd4db0b150e24508946ac32d7 | [
"MIT"
] | 4,900 | 2017-01-19T23:47:05.000Z | 2022-03-31T10:00:47.000Z | from collections import deque
'''
BFS time complexity : O(|E| + |V|)
BFS space complexity : O(|E| + |V|)
do BFS from (0,0) of the grid and get the minimum number of steps needed to get to the lower right column
only step on the columns whose value is 1
if there is no path, it returns -1
Ex 1)
If grid is
[[1,0,1,1,... | 21.867647 | 105 | 0.563551 | from collections import deque
def maze_search(maze):
BLOCKED, ALLOWED = 0, 1
UNVISITED, VISITED = 0, 1
initial_x, initial_y = 0, 0
if maze[initial_x][initial_y] == BLOCKED:
return -1
directions = [(0, -1), (0, 1), (-1, 0), (1, 0)]
height, width = len(maze), len(maze[0])
ta... | true | true |
f7410e81e0c4cbdf1ebe3997b9e1b1ee24151644 | 9,737 | py | Python | lmctl/project/source/core.py | manojn97/lmctl | 844925cb414722351efac90cb97f10c1185eef7a | [
"Apache-2.0"
] | 3 | 2021-07-19T09:46:01.000Z | 2022-03-07T13:51:25.000Z | lmctl/project/source/core.py | manojn97/lmctl | 844925cb414722351efac90cb97f10c1185eef7a | [
"Apache-2.0"
] | 43 | 2019-08-27T12:36:29.000Z | 2020-08-27T14:50:40.000Z | lmctl/project/source/core.py | manojn97/lmctl | 844925cb414722351efac90cb97f10c1185eef7a | [
"Apache-2.0"
] | 7 | 2020-09-22T20:32:17.000Z | 2022-03-29T12:25:51.000Z | import os
import lmctl.files as files
import yaml
import lmctl.utils.descriptors as descriptor_utils
import lmctl.project.source.config as project_configs
import lmctl.project.journal as project_journal
import lmctl.project.processes.validation as validation_exec
import lmctl.project.processes.staging as stage_exec
imp... | 34.651246 | 191 | 0.689124 | import os
import lmctl.files as files
import yaml
import lmctl.utils.descriptors as descriptor_utils
import lmctl.project.source.config as project_configs
import lmctl.project.journal as project_journal
import lmctl.project.processes.validation as validation_exec
import lmctl.project.processes.staging as stage_exec
imp... | true | true |
f7410e91ed3a5be19acb4e96a3fa17dc762263c6 | 4,325 | py | Python | distributed/mondrian/anonymization.py | stegianna/mondrian | 2a96fdd68c1addfb5e153869e759fd8a3d8c4be3 | [
"Apache-2.0"
] | 10 | 2020-12-02T17:41:21.000Z | 2022-01-18T15:40:54.000Z | distributed/mondrian/anonymization.py | stegianna/mondrian | 2a96fdd68c1addfb5e153869e759fd8a3d8c4be3 | [
"Apache-2.0"
] | null | null | null | distributed/mondrian/anonymization.py | stegianna/mondrian | 2a96fdd68c1addfb5e153869e759fd8a3d8c4be3 | [
"Apache-2.0"
] | 3 | 2021-04-08T16:12:01.000Z | 2022-03-10T11:45:39.000Z | # Copyright 2020 Unibg Seclab (https://seclab.unibg.it)
#
# 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 l... | 37.284483 | 76 | 0.590289 |
import generalization as gnrlz
from mondrian import partition_dataframe
from validation import get_validation_function
def join_column(ser, dtype, generalization=None):
values = ser.unique()
if len(values) == 1:
return str(values[0])
try:
if not generalization:
... | true | true |
f7410f396056cc1b11a98ac616a4ffbb328e2886 | 2,932 | py | Python | World-Wide-Covid19/automate_us_predictions.py | T-Cube-AI/Time-dependent-SEIRD-Model-API | 6de58cba219ae35f3aeca50671373171d97a688e | [
"MIT"
] | null | null | null | World-Wide-Covid19/automate_us_predictions.py | T-Cube-AI/Time-dependent-SEIRD-Model-API | 6de58cba219ae35f3aeca50671373171d97a688e | [
"MIT"
] | null | null | null | World-Wide-Covid19/automate_us_predictions.py | T-Cube-AI/Time-dependent-SEIRD-Model-API | 6de58cba219ae35f3aeca50671373171d97a688e | [
"MIT"
] | null | null | null | #!/usr/bin/python3
from US_Model import SEIRD
import re
import json
DATASETS_DIR = "./Datasets/US"
PREDICTIONS_DIR = "./Predictions/US"
INSIGHTS_DIR = "./Insights/US"
usStatesPopulationFile = "./US-population.json"
usStatesPopulation = json.load(open(usStatesPopulationFile))
stateToHeatFactorsMap = dict()
usHeatFact... | 27.660377 | 96 | 0.664052 |
from US_Model import SEIRD
import re
import json
DATASETS_DIR = "./Datasets/US"
PREDICTIONS_DIR = "./Predictions/US"
INSIGHTS_DIR = "./Insights/US"
usStatesPopulationFile = "./US-population.json"
usStatesPopulation = json.load(open(usStatesPopulationFile))
stateToHeatFactorsMap = dict()
usHeatFactorsFile = "./us_he... | true | true |
f741107b3aaadf428cf75dcd861ba833921faa15 | 35 | py | Python | python/Lib/test/test_import/data/circular_imports/from_cycle2.py | jasam/ciclo_vida_datos_scraping | 3f7cffc944a0a0752a502dc7868cf43c4144f16c | [
"MIT"
] | 1 | 2020-10-25T16:33:22.000Z | 2020-10-25T16:33:22.000Z | python/Lib/test/test_import/data/circular_imports/from_cycle2.py | jasam/ciclo_vida_datos_scraping | 3f7cffc944a0a0752a502dc7868cf43c4144f16c | [
"MIT"
] | 1 | 2021-02-03T01:56:56.000Z | 2021-02-03T01:56:56.000Z | python/Lib/test/test_import/data/circular_imports/from_cycle2.py | jasam/ciclo_vida_datos_scraping | 3f7cffc944a0a0752a502dc7868cf43c4144f16c | [
"MIT"
] | 1 | 2022-01-11T18:31:05.000Z | 2022-01-11T18:31:05.000Z | from .from_cycle1 import b
a = 1
| 11.666667 | 27 | 0.685714 | from .from_cycle1 import b
a = 1
| true | true |
f74110cbe6c0e76b09149fbe9d79dfd462f9a7ad | 12,252 | py | Python | apdcam_control/apdcam10g_channel_map.py | fusion-flap/flap_apdcam | fce208414044fb288328090ba697e8e2482e1c75 | [
"MIT"
] | 1 | 2019-09-16T11:45:37.000Z | 2019-09-16T11:45:37.000Z | apdcam_control/apdcam10g_channel_map.py | fusion-flap/flap_apdcam | fce208414044fb288328090ba697e8e2482e1c75 | [
"MIT"
] | 1 | 2019-06-04T13:09:19.000Z | 2019-06-05T08:26:31.000Z | apdcam_control/apdcam10g_channel_map.py | fusion-flap/flap_apdcam | fce208414044fb288328090ba697e8e2482e1c75 | [
"MIT"
] | null | null | null | # -*- coding: utf-8 -*-
"""
Created on Sun Feb 27 12:51:00 2022
@author: Zoletnik
"""
import numpy as np
def apdcam10g_channel_map(camera_type=None,camera_version=1):
"""
Returns a 2D matrix with the ADC channel numbers as one looks onto the detector.
Parameters
----------
camera_type : string
... | 44.552727 | 119 | 0.328273 |
import numpy as np
def apdcam10g_channel_map(camera_type=None,camera_version=1):
if (camera_type == "4x32"):
channel_map = np.ndarray((32,4),int)
if (camera_version == 0):
chmap = np.array([[ 20, 90, 75, 76],
[ 18, 92, 1, 2],
... | true | true |
f7411131d55a8cd69c027d53eeffdf57e2f2588d | 870 | py | Python | celerite/__init__.py | sczesla/celerite | ec6c5e39267c07df4aacd3ced70d3af24634e08c | [
"MIT"
] | null | null | null | celerite/__init__.py | sczesla/celerite | ec6c5e39267c07df4aacd3ced70d3af24634e08c | [
"MIT"
] | null | null | null | celerite/__init__.py | sczesla/celerite | ec6c5e39267c07df4aacd3ced70d3af24634e08c | [
"MIT"
] | null | null | null | # -*- coding: utf-8 -*-
__version__ = "0.3.0"
__bibtex__ = """
@article{celerite,
author = {{Foreman-Mackey}, D. and {Agol}, E. and {Angus}, R. and
{Ambikasaran}, S.},
title = {Fast and scalable Gaussian process modeling
with applications to astronomical time series},
year = ... | 25.588235 | 69 | 0.614943 |
__version__ = "0.3.0"
__bibtex__ = """
@article{celerite,
author = {{Foreman-Mackey}, D. and {Agol}, E. and {Angus}, R. and
{Ambikasaran}, S.},
title = {Fast and scalable Gaussian process modeling
with applications to astronomical time series},
year = {2017},
journal = {A... | true | true |
f741118e107455b149208868f1c8c79c3b3cbd9f | 4,999 | py | Python | neupre/cli.py | horvathpeter/neural_prediction | df053ebe60a1837f95532329201d4b95b8b8ffa3 | [
"Apache-2.0"
] | null | null | null | neupre/cli.py | horvathpeter/neural_prediction | df053ebe60a1837f95532329201d4b95b8b8ffa3 | [
"Apache-2.0"
] | null | null | null | neupre/cli.py | horvathpeter/neural_prediction | df053ebe60a1837f95532329201d4b95b8b8ffa3 | [
"Apache-2.0"
] | null | null | null | """
neupre
Usage:
neupre staticmlp [--onestep --multistep --onestep96] [-f FILE]
neupre staticrecurrent [--onestep --multistep --onestep96] [-f FILE]
neupre onlinemlp --simsteps=<steps> [--buffsize=<days>] [-f FILE]
neupre onlinerecurrent --simsteps=<steps> [--buffsize=<days>] [-f FILE]
neupre -h | --help
... | 32.888158 | 115 | 0.625725 |
from inspect import getmembers, isclass
from docopt import docopt
from . import __version__ as VERSION
def main():
import instructions
options = docopt(__doc__, version=VERSION)
# with a pre-defined command class we've already created.
for k, v in options.iteritems():
if hasattr(i... | true | true |
f7411193c9e74da9972af45d8cd83b30e71b72c3 | 1,071 | py | Python | scripts/genSplitPDBlists.py | demattox/lec_gly_binding | 44a12445d3ed89029a21bed1c516a67bd86e0c68 | [
"MIT"
] | null | null | null | scripts/genSplitPDBlists.py | demattox/lec_gly_binding | 44a12445d3ed89029a21bed1c516a67bd86e0c68 | [
"MIT"
] | null | null | null | scripts/genSplitPDBlists.py | demattox/lec_gly_binding | 44a12445d3ed89029a21bed1c516a67bd86e0c68 | [
"MIT"
] | null | null | null | #!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
Created on Sat Aug 1 16:23:55 2020
@author: dmattox
"""
import os
import dill
import lec_gly as LecGly
from bSiteResiFeatures import plipFile
os.chdir(LecGly.homeDir)
##########################
outDir = './data/structures/bsites/batchLists/'
if not os.path.exists... | 24.340909 | 136 | 0.61718 |
import os
import dill
import lec_gly as LecGly
from bSiteResiFeatures import plipFile
os.chdir(LecGly.homeDir)
| true | true |
f741121ea236150036c8713e6b64b057ec7cc89e | 22,829 | py | Python | tests/rest/admin/test_media.py | bradtgmurray/synapse | f42e4c4eb9b5b84bd1da80a4f3938c1c06305364 | [
"Apache-2.0"
] | null | null | null | tests/rest/admin/test_media.py | bradtgmurray/synapse | f42e4c4eb9b5b84bd1da80a4f3938c1c06305364 | [
"Apache-2.0"
] | null | null | null | tests/rest/admin/test_media.py | bradtgmurray/synapse | f42e4c4eb9b5b84bd1da80a4f3938c1c06305364 | [
"Apache-2.0"
] | null | null | null | # Copyright 2020 Dirk Klimpel
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing,... | 34.381024 | 90 | 0.613562 |
import json
import os
from binascii import unhexlify
from parameterized import parameterized
import synapse.rest.admin
from synapse.api.errors import Codes
from synapse.rest.client.v1 import login, profile, room
from synapse.rest.media.v1.filepath import MediaFilePaths
from tests import unittest
from t... | true | true |
f7411321056f532b191b2b636447955a8298bf76 | 3,945 | py | Python | reckon/client_test.py | Cjen1/Resolving-Consensus | 04c4c0eb3aac9a6bab61d9172f40cc235be44a18 | [
"MIT"
] | 4 | 2020-10-29T10:33:57.000Z | 2020-11-07T11:44:00.000Z | reckon/client_test.py | Cjen1/Resolving-Consensus | 04c4c0eb3aac9a6bab61d9172f40cc235be44a18 | [
"MIT"
] | 8 | 2020-10-29T10:35:09.000Z | 2020-12-16T14:07:15.000Z | reckon/client_test.py | Cjen1/Resolving-Consensus | 04c4c0eb3aac9a6bab61d9172f40cc235be44a18 | [
"MIT"
] | 1 | 2020-10-30T22:06:04.000Z | 2020-10-30T22:06:04.000Z | from typing import cast, IO, Tuple, List, Any, Union
from threading import Thread
import shlex
import subprocess as sp
import reckon.reckon_types as t
import reckon.client_runner as cr
def spawn(command: List[str]) -> Tuple[t.Client, sp.Popen[bytes]]:
p = sp.Popen(command, stdin=sp.PIPE, stdout=sp.PIPE, stderr=... | 29.007353 | 88 | 0.577947 | from typing import cast, IO, Tuple, List, Any, Union
from threading import Thread
import shlex
import subprocess as sp
import reckon.reckon_types as t
import reckon.client_runner as cr
def spawn(command: List[str]) -> Tuple[t.Client, sp.Popen[bytes]]:
p = sp.Popen(command, stdin=sp.PIPE, stdout=sp.PIPE, stderr=... | true | true |
f74114abdf7cd2b8e5f585c8b679aa0828971a3d | 3,716 | py | Python | api/transports/http_production.py | djzelenak/espa-api | ebf347a4dd58008e3e9c368cf6086925e3bf12b7 | [
"Unlicense"
] | null | null | null | api/transports/http_production.py | djzelenak/espa-api | ebf347a4dd58008e3e9c368cf6086925e3bf12b7 | [
"Unlicense"
] | null | null | null | api/transports/http_production.py | djzelenak/espa-api | ebf347a4dd58008e3e9c368cf6086925e3bf12b7 | [
"Unlicense"
] | null | null | null | from flask import request, make_response, jsonify
from flask_restful import Resource
from api.interfaces.production.version1 import API as APIv1
from api.domain import production_api_operations, default_error_message
espa = APIv1()
def whitelist(func):
"""
Provide a decorator to enact a white filter on an e... | 30.459016 | 93 | 0.639935 | from flask import request, make_response, jsonify
from flask_restful import Resource
from api.interfaces.production.version1 import API as APIv1
from api.domain import production_api_operations, default_error_message
espa = APIv1()
def whitelist(func):
def decorated(*args, **kwargs):
white_ls = espa.get... | true | true |
f74114babff999e00ae5dde173a0c41ebb1d8e48 | 1,898 | py | Python | pset6/ps6_recursion.py | ankgitk/6.001-pset-answers | 4b5a51de2983e549ac6150b72db45b7bc2e88459 | [
"MIT"
] | null | null | null | pset6/ps6_recursion.py | ankgitk/6.001-pset-answers | 4b5a51de2983e549ac6150b72db45b7bc2e88459 | [
"MIT"
] | null | null | null | pset6/ps6_recursion.py | ankgitk/6.001-pset-answers | 4b5a51de2983e549ac6150b72db45b7bc2e88459 | [
"MIT"
] | null | null | null | # 6.00x Problem Set 6
#
# Part 2 - RECURSION
#
# Problem 3: Recursive String Reversal
#
def reverseString(aStr):
"""
Given a string, recursively returns a reversed copy of the string.
For example, if the string is 'abc', the function returns 'cba'.
The only string operations you are allowed to use are ... | 26.361111 | 78 | 0.631191 |
def reverseString(aStr):
if len(aStr) == 0:
return ''
return aStr[-1] + reverseString(aStr[0:-1])
def x_ian(x, word):
# in word
if len(x) == 0:
return True
# check if the next character can be found in rest of string
pos_x_i = word.find(x[0])
if pos_... | true | true |
f74114dbbf8f3cfe8d96934a1c757123dc30d02f | 2,694 | py | Python | Python/network/server_basic/example02_query.py | sug5806/TIL | 2309d8a270e4a7b8961268a40b6492c5db317e37 | [
"MIT"
] | null | null | null | Python/network/server_basic/example02_query.py | sug5806/TIL | 2309d8a270e4a7b8961268a40b6492c5db317e37 | [
"MIT"
] | 102 | 2020-02-12T00:10:33.000Z | 2022-03-11T23:58:41.000Z | Python/network/server_basic/example02_query.py | sug5806/TIL | 2309d8a270e4a7b8961268a40b6492c5db317e37 | [
"MIT"
] | null | null | null | from http.server import BaseHTTPRequestHandler, HTTPServer
from urllib.parse import parse_qs, urlparse
# 1. 코드를 보낸다
# 2. 코드를 읽는다
# 3. 분리한다
PORT = 8080
class Handler(BaseHTTPRequestHandler):
# do_GET과 do_POST라는 이름은 바꾸면 안되며 고정이다
# 과제
# do_GET : 검색창 만들기
# do_POST : 검색 결과 보여주기 - 네이버에서 크롤링
def do_GE... | 28.967742 | 72 | 0.569042 | from http.server import BaseHTTPRequestHandler, HTTPServer
from urllib.parse import parse_qs, urlparse
PORT = 8080
class Handler(BaseHTTPRequestHandler):
def do_GET(self):
self.send_response(200)
self.send_header('Content-type', 'text/html')
self.end_headers()
... | true | true |
f74114f938752f08d1ebc0f7f2abe12ee5e060bd | 6,838 | py | Python | scripts/evaluate.py | RulerOf/keras-yolo3 | 8d091cf42b2f126626ad8610adf31293225b7daa | [
"MIT"
] | 37 | 2018-10-20T15:50:18.000Z | 2021-06-18T14:31:50.000Z | scripts/evaluate.py | RulerOf/keras-yolo3 | 8d091cf42b2f126626ad8610adf31293225b7daa | [
"MIT"
] | 34 | 2019-04-10T18:59:08.000Z | 2021-03-24T11:08:36.000Z | scripts/evaluate.py | RulerOf/keras-yolo3 | 8d091cf42b2f126626ad8610adf31293225b7daa | [
"MIT"
] | 13 | 2019-08-29T08:19:05.000Z | 2021-09-20T10:13:31.000Z | """
Evaluation of predictions againsts given dataset (in TXT format the same as training).
We expect that the predictions are in single folder and image names in dataset are the same
python evaluate.py \
--path_dataset ../model_data/VOC_2007_train.txt \
--path_results ../results \
--confide... | 40.223529 | 96 | 0.676221 |
import os
import sys
import argparse
import logging
from functools import partial
from pathos.multiprocessing import ProcessPool
import tqdm
import pandas as pd
sys.path += [os.path.abspath('.'), os.path.abspath('..')]
from keras_yolo3.utils import check_params_path, nb_workers, image_open, update_path
from keras_yo... | true | true |
f74115099600e0d065030f72e87f6d658038e8ac | 4,751 | py | Python | contre/training.py | b2-hive/CONTRE | 9176861400fcc5887d8a8944ee2c636ba09aa239 | [
"MIT"
] | 2 | 2020-06-16T13:53:46.000Z | 2020-09-22T13:01:59.000Z | contre/training.py | b2-hive/CONTRE | 9176861400fcc5887d8a8944ee2c636ba09aa239 | [
"MIT"
] | 2 | 2020-09-24T17:41:24.000Z | 2020-11-03T16:51:45.000Z | contre/training.py | b2-hive/CONTRE | 9176861400fcc5887d8a8944ee2c636ba09aa239 | [
"MIT"
] | null | null | null | import root_pandas
import basf2_mva
import b2luigi
import pandas as pd
from sklearn.model_selection import train_test_split
def split_sample(
ntuple_file,
train_size,
test_size,
random_seed=42):
"""Split rootfile and return dataframes. Select 0th candidate."""
df = root_pandas.... | 36.546154 | 79 | 0.661124 | import root_pandas
import basf2_mva
import b2luigi
import pandas as pd
from sklearn.model_selection import train_test_split
def split_sample(
ntuple_file,
train_size,
test_size,
random_seed=42):
df = root_pandas.read_root(ntuple_file)
try:
train, test = train_test_split... | true | true |
f741152e6797e6002dfe7c594d414c7dbc12b223 | 9,861 | py | Python | MusicTager/ui/ui_source/ModifyDialog.py | Mai-icy/MusicTagger | 210388f1830f8268717d892cc6ec318df1b731cf | [
"MIT"
] | 3 | 2021-12-07T05:28:46.000Z | 2022-03-10T04:26:42.000Z | MusicTager/ui/ui_source/ModifyDialog.py | Mai-icy/MusicTagger | 210388f1830f8268717d892cc6ec318df1b731cf | [
"MIT"
] | null | null | null | MusicTager/ui/ui_source/ModifyDialog.py | Mai-icy/MusicTagger | 210388f1830f8268717d892cc6ec318df1b731cf | [
"MIT"
] | null | null | null | # -*- coding: utf-8 -*-
# Form implementation generated from reading ui file 'ModifyDialogUI.ui'
#
# Created by: PyQt5 UI code generator 5.15.4
#
# WARNING: Any manual changes made to this file will be lost when pyuic5 is
# run again. Do not edit this file unless you know what you are doing.
from PyQt5 import QtCor... | 48.816832 | 115 | 0.708245 |
from PyQt5 import QtCore, QtGui, QtWidgets
class Ui_ModifyDialog(object):
def setupUi(self, ModifyDialog):
ModifyDialog.setObjectName("ModifyDialog")
ModifyDialog.resize(400, 300)
font = QtGui.QFont()
font.setFamily("微软雅黑")
font.setPointSize(13)
ModifyDial... | true | true |
f741161985eae5e503974310987839f338a7b267 | 285 | py | Python | mapa_de_obras/pipelines.py | alesservin/Datos-Abiertos---Obras-del-MOPC | 9a9f27f70afa3e65c613de16e4d50ef3f25dbab3 | [
"CC0-1.0"
] | null | null | null | mapa_de_obras/pipelines.py | alesservin/Datos-Abiertos---Obras-del-MOPC | 9a9f27f70afa3e65c613de16e4d50ef3f25dbab3 | [
"CC0-1.0"
] | null | null | null | mapa_de_obras/pipelines.py | alesservin/Datos-Abiertos---Obras-del-MOPC | 9a9f27f70afa3e65c613de16e4d50ef3f25dbab3 | [
"CC0-1.0"
] | null | null | null | # -*- coding: utf-8 -*-
# Define your item pipelines here
#
# Don't forget to add your pipeline to the ITEM_PIPELINES setting
# See: https://docs.scrapy.org/en/latest/topics/item-pipeline.html
class MapaDeObrasPipeline:
def process_item(self, item, spider):
return item
| 23.75 | 66 | 0.715789 |
# See: https://docs.scrapy.org/en/latest/topics/item-pipeline.html
class MapaDeObrasPipeline:
def process_item(self, item, spider):
return item
| true | true |
f741164fdc28f80f6d27571f50e67665926e3cf0 | 5,953 | py | Python | Lv3_presto_candidates.py | masonng-astro/nicerpy_xrayanalysis | c21c7c9bc5570c63c986197fb363ae80691515d5 | [
"MIT"
] | 3 | 2020-01-13T20:13:14.000Z | 2021-06-03T21:58:08.000Z | Lv3_presto_candidates.py | masonng-astro/nicerpy_xrayanalysis | c21c7c9bc5570c63c986197fb363ae80691515d5 | [
"MIT"
] | null | null | null | Lv3_presto_candidates.py | masonng-astro/nicerpy_xrayanalysis | c21c7c9bc5570c63c986197fb363ae80691515d5 | [
"MIT"
] | 2 | 2020-01-15T15:08:40.000Z | 2021-07-09T11:49:30.000Z | #!/usr/bin/env python
# -*- coding: utf-8 -*-
"""
Created on Fri Jul 5 1:28pm 2019
Script to automate getting pulsation candidates of a certain frequency range,
and reporting other germane information?
"""
from __future__ import division, print_function
import numpy as np
from scipy import stats, signal
from tqdm imp... | 66.88764 | 335 | 0.632622 |
from __future__ import division, print_function
import numpy as np
from scipy import stats, signal
from tqdm import tqdm
import matplotlib.pyplot as plt
from astropy.io import fits
import glob
import Lv0_dirs
Lv0_dirs.global_par()
def get_candidates(obsid,name_par_list,zmax,f1,f2):
if type(obsid) != str:
... | true | true |
f74117b9e6a4af129b4a8a8bb3aa89e905a96a35 | 3,324 | py | Python | Python-Programs/Sorting Algorithms/insertionSort.py | naschwin/Simple-Programs | a06e62b7280890cc8e3b9d2dfac9b7fd90706af3 | [
"MIT"
] | null | null | null | Python-Programs/Sorting Algorithms/insertionSort.py | naschwin/Simple-Programs | a06e62b7280890cc8e3b9d2dfac9b7fd90706af3 | [
"MIT"
] | null | null | null | Python-Programs/Sorting Algorithms/insertionSort.py | naschwin/Simple-Programs | a06e62b7280890cc8e3b9d2dfac9b7fd90706af3 | [
"MIT"
] | 1 | 2021-10-09T09:51:22.000Z | 2021-10-09T09:51:22.000Z | import pygame, sys, random
WIDTH = 720
HEIGHT = 400
pygame.init()
win = pygame.display.set_mode((WIDTH, HEIGHT))
pygame.display.set_caption('Insertion Sort')
clock = pygame.time.Clock()
# Bar Width
n = 4
w = int(WIDTH/n)
h_arr = []
def maps(num, in_min, in_max, out_min, out_max):
return (num ... | 13.85 | 116 | 0.453369 | import pygame, sys, random
WIDTH = 720
HEIGHT = 400
pygame.init()
win = pygame.display.set_mode((WIDTH, HEIGHT))
pygame.display.set_caption('Insertion Sort')
clock = pygame.time.Clock()
n = 4
w = int(WIDTH/n)
h_arr = []
def maps(num, in_min, in_max, out_min, out_max):
return (num - in_min) * ... | true | true |
f741182e10abddbb8b10adb3dbd7f45b204f71fd | 3,729 | py | Python | dq0/sdk/examples/newsgroups/_data/generate_preprocessed_dataset.py | gradientzero/dq0-sdk | 90856dd5ac56216971ffe33004447fd037a21660 | [
"0BSD"
] | 2 | 2020-09-16T09:28:00.000Z | 2021-03-18T21:26:29.000Z | dq0/sdk/examples/newsgroups/_data/generate_preprocessed_dataset.py | gradientzero/dq0-sdk | 90856dd5ac56216971ffe33004447fd037a21660 | [
"0BSD"
] | 22 | 2020-04-15T10:19:33.000Z | 2022-03-12T00:20:57.000Z | dq0/sdk/examples/newsgroups/_data/generate_preprocessed_dataset.py | gradientzero/dq0-sdk | 90856dd5ac56216971ffe33004447fd037a21660 | [
"0BSD"
] | null | null | null | # -*- coding: utf-8 -*-
"""20Newsgroups Data Source.
This is a data source example known from the Scikit-learn API:
https://scikit-learn.org/stable/datasets/index.html#the-20-newsgroups-text-dataset
The 20 newsgroups dataset comprises around 18000 newsgroups posts on 20 topics
split in two subsets: one for training (... | 33.594595 | 82 | 0.699383 |
from pathlib import Path
from dq0.sdk.data.preprocessing import preprocessing
from dq0.sdk.data.utils import util
from dq0.sdk.examples.newsgroups._data.dump_text_labels_to_df_csv import \
_dump_text_and_labels_to_csv
import pandas as pd
from sklearn.model_selection import train_test_split
def _generate_prep... | true | true |
f7411915b61c8b468563c54c4388026a0f6798e2 | 11,792 | py | Python | swig/python/samples/ogr2vrt.py | gajgeospatial/gdal-3.2.2 | f03032b8b734f611d5b3039c0e5cdbf81adc306e | [
"Apache-2.0"
] | null | null | null | swig/python/samples/ogr2vrt.py | gajgeospatial/gdal-3.2.2 | f03032b8b734f611d5b3039c0e5cdbf81adc306e | [
"Apache-2.0"
] | null | null | null | swig/python/samples/ogr2vrt.py | gajgeospatial/gdal-3.2.2 | f03032b8b734f611d5b3039c0e5cdbf81adc306e | [
"Apache-2.0"
] | 1 | 2022-02-21T06:31:07.000Z | 2022-02-21T06:31:07.000Z | #!/usr/bin/env python3
# -*- coding: utf-8 -*-
###############################################################################
# $Id: ogr2vrt.py a47364611c193ff14f084bade64d37c7e1443d3b 2020-05-30 17:04:38 +0200 Even Rouault $
#
# Project: OGR Python samples
# Purpose: Create OGR VRT from source datasource
# Author: ... | 35.2 | 99 | 0.517385 | true | true | |
f7411a3eaa651e0137105fa37fd4d1ab8997d09a | 3,283 | py | Python | rdmo/projects/rules.py | dario-pilori/rdmo | d94e0f85f7a1cfedbfcbf40da1fcc8deb07e1a01 | [
"Apache-2.0"
] | null | null | null | rdmo/projects/rules.py | dario-pilori/rdmo | d94e0f85f7a1cfedbfcbf40da1fcc8deb07e1a01 | [
"Apache-2.0"
] | null | null | null | rdmo/projects/rules.py | dario-pilori/rdmo | d94e0f85f7a1cfedbfcbf40da1fcc8deb07e1a01 | [
"Apache-2.0"
] | null | null | null | import rules
@rules.predicate
def is_project_member(user, project):
return user in project.member
@rules.predicate
def is_project_owner(user, project):
return user in project.owners
@rules.predicate
def is_project_manager(user, project):
return user in project.managers
@rules.predicate
def is_projec... | 46.9 | 123 | 0.83308 | import rules
@rules.predicate
def is_project_member(user, project):
return user in project.member
@rules.predicate
def is_project_owner(user, project):
return user in project.owners
@rules.predicate
def is_project_manager(user, project):
return user in project.managers
@rules.predicate
def is_projec... | true | true |
f7411b9336abfde0d604ea30e3f2ff842b11aa5f | 12,377 | py | Python | sdl2/render.py | cmitu/py-sdl2 | d178fe2a3c86e1cdfdf3cc77920b98b572d86a2d | [
"CC0-1.0"
] | 222 | 2017-08-19T00:51:59.000Z | 2022-02-05T19:39:33.000Z | sdl2/render.py | cmitu/py-sdl2 | d178fe2a3c86e1cdfdf3cc77920b98b572d86a2d | [
"CC0-1.0"
] | 103 | 2017-08-20T17:13:05.000Z | 2022-02-05T20:20:01.000Z | sdl2/render.py | cmitu/py-sdl2 | d178fe2a3c86e1cdfdf3cc77920b98b572d86a2d | [
"CC0-1.0"
] | 54 | 2017-08-20T17:13:00.000Z | 2022-01-14T23:51:13.000Z | from ctypes import Structure, POINTER, c_int, c_char_p, c_void_p, c_float, \
c_double
from .dll import _bind
from .stdinc import Uint8, Uint32, SDL_bool
from .blendmode import SDL_BlendMode
from .rect import SDL_Point, SDL_FPoint, SDL_Rect, SDL_FRect
from .surface import SDL_Surface
from .video import SDL_Window
_... | 66.187166 | 204 | 0.788075 | from ctypes import Structure, POINTER, c_int, c_char_p, c_void_p, c_float, \
c_double
from .dll import _bind
from .stdinc import Uint8, Uint32, SDL_bool
from .blendmode import SDL_BlendMode
from .rect import SDL_Point, SDL_FPoint, SDL_Rect, SDL_FRect
from .surface import SDL_Surface
from .video import SDL_Window
_... | true | true |
f7411c61428fb52ad834d2f373b5dfe15f9c2f1c | 4,622 | py | Python | ai_challenge/methods/dqn.py | village-people/flying-pig | c86b589aadb02dbfd42a917a388c2b8488ecd338 | [
"MIT"
] | 72 | 2017-05-22T18:22:58.000Z | 2019-03-11T22:49:00.000Z | ai_challenge/methods/dqn.py | village-people/flying-pig | c86b589aadb02dbfd42a917a388c2b8488ecd338 | [
"MIT"
] | 1 | 2017-06-09T05:26:43.000Z | 2017-08-22T11:41:41.000Z | ai_challenge/methods/dqn.py | village-people/flying-pig | c86b589aadb02dbfd42a917a388c2b8488ecd338 | [
"MIT"
] | 3 | 2017-05-25T08:49:27.000Z | 2019-09-09T18:41:54.000Z | """ Deep Q-Learning policy evaluation and improvement
"""
import torch
from torch.autograd import Variable
import torch.nn.functional as F
import torch.optim as optim
from termcolor import colored as clr
class DQNPolicyImprovement(object):
""" Deep Q-Learning training method. """
def __init__(self, policy, ... | 34.75188 | 79 | 0.556253 | import torch
from torch.autograd import Variable
import torch.nn.functional as F
import torch.optim as optim
from termcolor import colored as clr
class DQNPolicyImprovement(object):
def __init__(self, policy, target_policy, cfg, ddqn=False):
self.name = "DQN-PI"
self.policy = policy
self... | true | true |
f7411cab6af2026a634f9ccae284128e6f5002e7 | 10,643 | py | Python | routeros_api.py | iprok/RouterOS_API | e414b9d1e386d749a59f1800a1b72adcd9ef73e2 | [
"MIT"
] | 1 | 2021-03-13T11:27:12.000Z | 2021-03-13T11:27:12.000Z | routeros_api.py | iprok/RouterOS_API | e414b9d1e386d749a59f1800a1b72adcd9ef73e2 | [
"MIT"
] | null | null | null | routeros_api.py | iprok/RouterOS_API | e414b9d1e386d749a59f1800a1b72adcd9ef73e2 | [
"MIT"
] | null | null | null | # Author: Arturs Laizans
import socket
import ssl
import hashlib
import binascii
from .verbose import Log
# Constants - Define defaults
PORT = 8728
SSL_PORT = 8729
USER = 'admin'
PASSWORD = ''
USE_SSL = False
VERBOSE = False # Whether to print API conversation width the router. Useful for debugging
VERBOSE_LOGIC ... | 37.083624 | 118 | 0.57371 |
import socket
import ssl
import hashlib
import binascii
from .verbose import Log
PORT = 8728
SSL_PORT = 8729
USER = 'admin'
PASSWORD = ''
USE_SSL = False
VERBOSE = False
VERBOSE_LOGIC = 'OR'
VERBOSE_FILE_MODE = 'w'
CONTEXT = ssl.create_default_context()
CONTEXT.check_hostname = False
CONTEXT.verify_mode... | true | true |
f7411db8733c11550e350a271a14103f5930102c | 507 | py | Python | predict.py | BikesSaver/efficientdet-pytorch | c1e02484733cf2080ecb2ee57c184038a77a09e8 | [
"MIT"
] | 1 | 2020-09-17T00:51:38.000Z | 2020-09-17T00:51:38.000Z | predict.py | BikesSaver/efficientdet-pytorch | c1e02484733cf2080ecb2ee57c184038a77a09e8 | [
"MIT"
] | null | null | null | predict.py | BikesSaver/efficientdet-pytorch | c1e02484733cf2080ecb2ee57c184038a77a09e8 | [
"MIT"
] | null | null | null | #-------------------------------------#
# 对单张图片进行预测
#-------------------------------------#
from efficientdet import EfficientDet
from PIL import Image
efficientdet = EfficientDet('./logs/Epoch29-Total_Loss0.7971-Val_Loss0.7432.pth')
while True:
img = input('Input image filename:')
try:
... | 26.684211 | 82 | 0.530572 | rom efficientdet import EfficientDet
from PIL import Image
efficientdet = EfficientDet('./logs/Epoch29-Total_Loss0.7971-Val_Loss0.7432.pth')
while True:
img = input('Input image filename:')
try:
image = Image.open(img)
except:
print('Open Error! Try again!')
continue
... | true | true |
f7411fb58803e767faca0cd0bddcc3c8936903f4 | 3,666 | py | Python | app/user/tests/test_user_api.py | pnitin10/user-app-api | 264e45f4698e6099f737194f41b0593779ccb8b6 | [
"MIT"
] | null | null | null | app/user/tests/test_user_api.py | pnitin10/user-app-api | 264e45f4698e6099f737194f41b0593779ccb8b6 | [
"MIT"
] | null | null | null | app/user/tests/test_user_api.py | pnitin10/user-app-api | 264e45f4698e6099f737194f41b0593779ccb8b6 | [
"MIT"
] | null | null | null | from django.test import TestCase
from django.contrib.auth import get_user_model
from django.urls import reverse
from rest_framework.test import APIClient
from rest_framework import status
CREATE_USER_URL = reverse('user:create')
# TOKEN_URL = reverse('user:token')
ME_URL = reverse('user:me')
def create_user(**param... | 34.914286 | 79 | 0.63557 | from django.test import TestCase
from django.contrib.auth import get_user_model
from django.urls import reverse
from rest_framework.test import APIClient
from rest_framework import status
CREATE_USER_URL = reverse('user:create')
ME_URL = reverse('user:me')
def create_user(**params):
return get_user_model().obj... | true | true |
f7411fdf68289f86248cd68336b984faf9c3c880 | 14,098 | py | Python | tftest.py | 1n/terraform-python-testing-helper | 2552998a0a49d45724ea3533fae88925abb6d062 | [
"Apache-2.0"
] | null | null | null | tftest.py | 1n/terraform-python-testing-helper | 2552998a0a49d45724ea3533fae88925abb6d062 | [
"Apache-2.0"
] | null | null | null | tftest.py | 1n/terraform-python-testing-helper | 2552998a0a49d45724ea3533fae88925abb6d062 | [
"Apache-2.0"
] | null | null | null | # Copyright 2019 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, ... | 35.333333 | 117 | 0.686055 |
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
from __future__ import unicode_literals
import collections
import itertools
import json
import logging
import os
import shutil
import subprocess
import tempfile
import weakref
__version__ = '1.5... | true | true |
f741208b78753f7603d95f70a25ff3cd88f3334c | 1,592 | py | Python | src/bulk_producto2.py | cnavarreteliz/Datos-COVID19 | 4383c6a82f5ec41d55875daf6ce2d2ed71785aa4 | [
"MIT"
] | null | null | null | src/bulk_producto2.py | cnavarreteliz/Datos-COVID19 | 4383c6a82f5ec41d55875daf6ce2d2ed71785aa4 | [
"MIT"
] | null | null | null | src/bulk_producto2.py | cnavarreteliz/Datos-COVID19 | 4383c6a82f5ec41d55875daf6ce2d2ed71785aa4 | [
"MIT"
] | null | null | null | import pandas as pd
import glob
import re
df = []
for file in glob.glob("../output/producto2/*.csv"):
date = re.search("\d{4}-\d{2}-\d{2}", file).group(0).replace("-", "/")
fragment = pd.read_csv(file)
fragment["Fecha"] = date
df.append(fragment)
df = pd.concat(df)
# Reemplaza nombres de comuna, para... | 38.829268 | 139 | 0.679648 | import pandas as pd
import glob
import re
df = []
for file in glob.glob("../output/producto2/*.csv"):
date = re.search("\d{4}-\d{2}-\d{2}", file).group(0).replace("-", "/")
fragment = pd.read_csv(file)
fragment["Fecha"] = date
df.append(fragment)
df = pd.concat(df)
df["Comuna"] = df["Comuna"].replac... | true | true |
f741208bea5d73da7f6e6db42afb2ca0a0ba4bcb | 1,716 | py | Python | Packs/HealthCheck/Scripts/HealthCheckIncidentsCreatedDaily/HealthCheckIncidentsCreatedDaily.py | diCagri/content | c532c50b213e6dddb8ae6a378d6d09198e08fc9f | [
"MIT"
] | 799 | 2016-08-02T06:43:14.000Z | 2022-03-31T11:10:11.000Z | Packs/HealthCheck/Scripts/HealthCheckIncidentsCreatedDaily/HealthCheckIncidentsCreatedDaily.py | diCagri/content | c532c50b213e6dddb8ae6a378d6d09198e08fc9f | [
"MIT"
] | 9,317 | 2016-08-07T19:00:51.000Z | 2022-03-31T21:56:04.000Z | Packs/HealthCheck/Scripts/HealthCheckIncidentsCreatedDaily/HealthCheckIncidentsCreatedDaily.py | diCagri/content | c532c50b213e6dddb8ae6a378d6d09198e08fc9f | [
"MIT"
] | 1,297 | 2016-08-04T13:59:00.000Z | 2022-03-31T23:43:06.000Z | import demistomock as demisto # noqa: F401
from CommonServerPython import * # noqa: F401
incident = demisto.incidents()[0]
accountName = incident.get('account')
accountName = f"acc_{accountName}/" if accountName != "" else ""
stats = demisto.executeCommand(
"demisto-api-post",
{
"uri": f"{accountNam... | 25.235294 | 106 | 0.463869 | import demistomock as demisto
from CommonServerPython import *
incident = demisto.incidents()[0]
accountName = incident.get('account')
accountName = f"acc_{accountName}/" if accountName != "" else ""
stats = demisto.executeCommand(
"demisto-api-post",
{
"uri": f"{accountName}statistics/widgets/que... | true | true |
f741210e990fe912e6f404891bd75bfb8316c912 | 50,458 | py | Python | django/template/defaulttags.py | ChrisLiao-bupt/test | 48710c599f07da735aab7a9be54d6072553f46e4 | [
"MIT"
] | null | null | null | django/template/defaulttags.py | ChrisLiao-bupt/test | 48710c599f07da735aab7a9be54d6072553f46e4 | [
"MIT"
] | null | null | null | django/template/defaulttags.py | ChrisLiao-bupt/test | 48710c599f07da735aab7a9be54d6072553f46e4 | [
"MIT"
] | null | null | null | """Default tags used by the template system, available to all templates."""
from __future__ import unicode_literals
import re
import sys
import warnings
from collections import namedtuple
from datetime import datetime
from itertools import cycle as itertools_cycle, groupby
from django.conf import settings
from django... | 33.796383 | 119 | 0.594534 | from __future__ import unicode_literals
import re
import sys
import warnings
from collections import namedtuple
from datetime import datetime
from itertools import cycle as itertools_cycle, groupby
from django.conf import settings
from django.utils import six, timezone
from django.utils.encoding import force_text
fro... | true | true |
f74121199df99d67cb1bc4527c9eaf51e9c35ddf | 35,821 | py | Python | NeurIPS_2021/Figure_1/DER_cubic/trainers/evidential_V2.py | streeve/PI3NN | f7f08a195096e0388bb9230bc67c6acd6f41581a | [
"Apache-2.0"
] | 11 | 2021-11-08T20:38:50.000Z | 2022-01-30T02:46:39.000Z | NeurIPS_2021/Figure_1/DER_cubic/trainers/evidential_V2.py | streeve/PI3NN | f7f08a195096e0388bb9230bc67c6acd6f41581a | [
"Apache-2.0"
] | 1 | 2022-01-13T19:46:32.000Z | 2022-02-09T16:23:56.000Z | NeurIPS_2021/Figure_1/DER_cubic/trainers/evidential_V2.py | streeve/PI3NN | f7f08a195096e0388bb9230bc67c6acd6f41581a | [
"Apache-2.0"
] | 1 | 2021-12-17T18:38:26.000Z | 2021-12-17T18:38:26.000Z | import numpy as np
import tensorflow as tf
import time
import datetime
import os
import sys
import h5py
from pathlib import Path
import pandas as pd
import matplotlib.pyplot as plt
import evidential_deep_learning as edl
from .util import normalize, gallery
class Evidential:
def __init__(self, model, opts, dataset... | 57.039809 | 197 | 0.57215 | import numpy as np
import tensorflow as tf
import time
import datetime
import os
import sys
import h5py
from pathlib import Path
import pandas as pd
import matplotlib.pyplot as plt
import evidential_deep_learning as edl
from .util import normalize, gallery
class Evidential:
def __init__(self, model, opts, dataset... | true | true |
f74122343672fb7a04833b376127e1a333580103 | 531 | py | Python | objectset/__init__.py | rysdyk/django-objectset | cc3b6b1fe120d5bd61ffe5b42ea7b3d5457e949f | [
"BSD-2-Clause"
] | null | null | null | objectset/__init__.py | rysdyk/django-objectset | cc3b6b1fe120d5bd61ffe5b42ea7b3d5457e949f | [
"BSD-2-Clause"
] | null | null | null | objectset/__init__.py | rysdyk/django-objectset | cc3b6b1fe120d5bd61ffe5b42ea7b3d5457e949f | [
"BSD-2-Clause"
] | 3 | 2015-05-27T15:11:24.000Z | 2016-12-03T18:51:18.000Z | __version_info__ = {
'major': 0,
'minor': 2,
'micro': 5,
'releaselevel': 'beta',
'serial': 1
}
def get_version(short=False):
assert __version_info__['releaselevel'] in ('alpha', 'beta', 'final')
vers = ["%(major)i.%(minor)i.%(micro)i" % __version_info__]
if __version_info__['releaselev... | 27.947368 | 73 | 0.591337 | __version_info__ = {
'major': 0,
'minor': 2,
'micro': 5,
'releaselevel': 'beta',
'serial': 1
}
def get_version(short=False):
assert __version_info__['releaselevel'] in ('alpha', 'beta', 'final')
vers = ["%(major)i.%(minor)i.%(micro)i" % __version_info__]
if __version_info__['releaselev... | true | true |
f74122438eac8c27185a1e21f6a8dc2cc9dca269 | 3,088 | py | Python | utils.py | goberoi/face_experiments | 2fd23b902fd62ad1571bb2d537f1cf6977589534 | [
"MIT"
] | 54 | 2018-01-24T22:23:02.000Z | 2022-01-11T10:01:52.000Z | utils.py | AyushBherwani1998/sketch_face | 2fd23b902fd62ad1571bb2d537f1cf6977589534 | [
"MIT"
] | null | null | null | utils.py | AyushBherwani1998/sketch_face | 2fd23b902fd62ad1571bb2d537f1cf6977589534 | [
"MIT"
] | 15 | 2018-02-22T06:21:08.000Z | 2022-02-16T05:31:06.000Z | """Utilities for measuring frame rate, and reading frames in a separate thread.
This code was mostly taken from:
http://www.pyimagesearch.com/2015/12/21/increasing-webcam-fps-with-python-and-opencv/
"""
import cv2
import datetime
import time
from threading import Thread
class FPS:
"""Helper class to track numb... | 31.510204 | 109 | 0.640544 |
import cv2
import datetime
import time
from threading import Thread
class FPS:
def __init__(self):
self._start = None
self._end = None
self._numFrames = 0
self._last_update_time = time.time()
def start(self):
self._start = datetime.datetime... | true | true |
f741234a05cba77dc77834fa7addcb1e920e0ef9 | 1,029 | py | Python | src/tox/session/commands/show_env.py | wvangeit/tox | d1984d1682e0c760e2170486e006793ced3b8ae8 | [
"MIT"
] | null | null | null | src/tox/session/commands/show_env.py | wvangeit/tox | d1984d1682e0c760e2170486e006793ced3b8ae8 | [
"MIT"
] | 10 | 2020-05-11T20:29:28.000Z | 2022-01-13T01:41:27.000Z | src/tox/session/commands/show_env.py | wvangeit/tox | d1984d1682e0c760e2170486e006793ced3b8ae8 | [
"MIT"
] | null | null | null | from __future__ import absolute_import, unicode_literals
from tox import reporter as report
def show_envs(config, all_envs=False, description=False):
env_conf = config.envconfigs # this contains all environments
default = config.envlist # this only the defaults
ignore = {config.isolated_build_env, conf... | 32.15625 | 81 | 0.632653 | from __future__ import absolute_import, unicode_literals
from tox import reporter as report
def show_envs(config, all_envs=False, description=False):
env_conf = config.envconfigs
default = config.envlist
ignore = {config.isolated_build_env, config.provision_tox_env}.union(default)
extra = [e for ... | true | true |
f74123f3d133416bf5d2155a9a17e41f1f5a04c7 | 44,210 | py | Python | tests/test_modeling_prophetnet.py | savindi-wijenayaka/transformer_old | 016960521eaaf5393c9fad1c4db15338455213f8 | [
"Apache-2.0"
] | 1 | 2022-02-22T18:38:35.000Z | 2022-02-22T18:38:35.000Z | tests/test_modeling_prophetnet.py | savindi-wijenayaka/transformer_old | 016960521eaaf5393c9fad1c4db15338455213f8 | [
"Apache-2.0"
] | 1 | 2021-03-21T03:28:23.000Z | 2021-03-21T06:06:39.000Z | tests/test_modeling_prophetnet.py | savindi-wijenayaka/transformer_old | 016960521eaaf5393c9fad1c4db15338455213f8 | [
"Apache-2.0"
] | null | null | null | # coding=utf-8
# Copyright 2020 The HuggingFace Inc. team, The Microsoft Research team.
#
# 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
#
# ... | 39.614695 | 695 | 0.656797 |
import copy
import tempfile
import unittest
from transformers import is_torch_available
from transformers.testing_utils import require_torch, slow, torch_device
from .test_configuration_common import ConfigTester
from .test_modeling_common import ModelTesterMixin, floats_tensor, ids_tensor
if is_tor... | true | true |
f7412446cb6eb5874a37cff88689c35fb8b0ae11 | 12,390 | py | Python | bot_files/plugins/reddit.py | gorpoorko/Manicomio-Bot-GUI | e471381a3620d4fa1fa5562b5691a609cbafc9c4 | [
"FTL"
] | 1 | 2020-12-11T10:15:46.000Z | 2020-12-11T10:15:46.000Z | bot_files/plugins/reddit.py | gorpoorko/Manicomio-Bot-GUI | e471381a3620d4fa1fa5562b5691a609cbafc9c4 | [
"FTL"
] | null | null | null | bot_files/plugins/reddit.py | gorpoorko/Manicomio-Bot-GUI | e471381a3620d4fa1fa5562b5691a609cbafc9c4 | [
"FTL"
] | 1 | 2021-06-22T19:27:30.000Z | 2021-06-22T19:27:30.000Z | # -*- coding: utf-8 -*-
# ███╗ ███╗ █████╗ ███╗ ██╗██╗ ██████╗ ██████╗ ███╗ ███╗██╗ ██████╗
# ████╗ ████║██╔══██╗████╗ ██║██║██╔════╝██╔═══██╗████╗ ████║██║██╔═══██╗
# ██╔████╔██║███████║██╔██╗ ██║██║██║ ██║ ██║██╔████╔██║██║██║ ██║
# ██║╚██╔╝██║██╔══██║██║╚██╗██║██║██║ ██║ ██║██║╚██╔╝██║██║██║ █... | 60.439024 | 126 | 0.353511 |
import re
import aiohttp
from config import bot
import urllib
def treattitle(title):
title = title.replace("_", " ")
title = title.replace("[", "(")
title = title.replace("]", ")")
title = title.replace("(", "(")
title = title.replace(")", ")")
return title
async def reddit(msg)... | true | true |
f7412449c0da3cf4ec849c50b2664129b70ad433 | 38 | py | Python | configgen/generators/amiberry/__init__.py | batocera-linux/recalbox-configgen | b875d317b33129ce3f18342b1011f63c9b98bc80 | [
"MIT"
] | 2 | 2018-10-09T23:46:13.000Z | 2020-11-20T10:01:11.000Z | configgen/generators/amiberry/__init__.py | batocera-linux/_old_batocera-configgen_old | b875d317b33129ce3f18342b1011f63c9b98bc80 | [
"MIT"
] | 3 | 2018-01-12T12:10:39.000Z | 2018-02-19T20:32:29.000Z | configgen/generators/amiberry/__init__.py | batocera-linux/_old_batocera-configgen_old | b875d317b33129ce3f18342b1011f63c9b98bc80 | [
"MIT"
] | 4 | 2018-01-11T18:28:23.000Z | 2018-04-25T16:16:39.000Z | __author__ = 'Nicolas Adenis-Lamarre'
| 19 | 37 | 0.789474 | __author__ = 'Nicolas Adenis-Lamarre'
| true | true |
f741245fbaa8a2dd7773541b19013f3c7b7747ad | 2,393 | py | Python | trainer_table_generator.py | Blampharos/gym-order-randomiser | 0dbfd08bb5b2a0bc1fd42a3fd7917855e7b15d15 | [
"MIT"
] | null | null | null | trainer_table_generator.py | Blampharos/gym-order-randomiser | 0dbfd08bb5b2a0bc1fd42a3fd7917855e7b15d15 | [
"MIT"
] | null | null | null | trainer_table_generator.py | Blampharos/gym-order-randomiser | 0dbfd08bb5b2a0bc1fd42a3fd7917855e7b15d15 | [
"MIT"
] | 1 | 2021-06-01T17:02:51.000Z | 2021-06-01T17:02:51.000Z | #!/usr/bin/env python3
from pycparser import c_parser, c_ast, parse_file
from json import dump
from glob import glob
from re import sub
from string import digits
ast = parse_file("../pokeruby/src/data/trainer_parties.h")
#ast = parse_file("trainer_parties_trimmed.h")
#ast.show()
map_script_paths = glob('../pokeruby/... | 33.704225 | 80 | 0.688675 |
from pycparser import c_parser, c_ast, parse_file
from json import dump
from glob import glob
from re import sub
from string import digits
ast = parse_file("../pokeruby/src/data/trainer_parties.h")
map_script_paths = glob('../pokeruby/data/maps/*/scripts.inc')
map_scripts = []
for path in map_script_paths:
wi... | true | true |
f74124f9811c8e2f0ee1b354da22d90c6405cf3b | 327 | py | Python | ruleta/rule.py | Glinrens-corner/ruleta | e49f5701170d97366a47378229ade449ed729402 | [
"MIT"
] | null | null | null | ruleta/rule.py | Glinrens-corner/ruleta | e49f5701170d97366a47378229ade449ed729402 | [
"MIT"
] | null | null | null | ruleta/rule.py | Glinrens-corner/ruleta | e49f5701170d97366a47378229ade449ed729402 | [
"MIT"
] | null | null | null | from ruleta.exceptions import NoActionException
from collections import namedtuple
class Rule(namedtuple("Rule", ["if_", "then_"]) ):
__slots__ = []
def __call__(self, input_):
if ( self.if_(input_)):
return self.then_(input_)
else:
raise NoActionException()
... | 19.235294 | 50 | 0.602446 | from ruleta.exceptions import NoActionException
from collections import namedtuple
class Rule(namedtuple("Rule", ["if_", "then_"]) ):
__slots__ = []
def __call__(self, input_):
if ( self.if_(input_)):
return self.then_(input_)
else:
raise NoActionException()
... | true | true |
f741260a064892cf08393ba45c4146dffc0ffffc | 1,132 | py | Python | agent.py | adityasaxena26/OpenAI-Gym-Taxi-v2-Task | e6061b39134c511de47b490f034317466c3c892e | [
"MIT"
] | null | null | null | agent.py | adityasaxena26/OpenAI-Gym-Taxi-v2-Task | e6061b39134c511de47b490f034317466c3c892e | [
"MIT"
] | null | null | null | agent.py | adityasaxena26/OpenAI-Gym-Taxi-v2-Task | e6061b39134c511de47b490f034317466c3c892e | [
"MIT"
] | null | null | null | import numpy as np
from collections import defaultdict
class Agent:
def __init__(self, nA=6):
"""
Initialize agent.
Params
======
nA: number of actions available to the agent
"""
self.nA = nA
self.Q = defaultdict(lambda: np.zeros(self.nA))
def ... | 25.727273 | 76 | 0.575972 | import numpy as np
from collections import defaultdict
class Agent:
def __init__(self, nA=6):
self.nA = nA
self.Q = defaultdict(lambda: np.zeros(self.nA))
def select_action(self, state):
return np.random.choice(self.nA)
def step(self, state, action, reward, next_state, done):
... | true | true |
f741262f8ec2be68d44e078d2c3fc3b53116b370 | 643 | py | Python | polyaxon/stats/__init__.py | gzcf/polyaxon | 77ac8838c6444a36541e6c28aba7ae42de392fee | [
"MIT"
] | null | null | null | polyaxon/stats/__init__.py | gzcf/polyaxon | 77ac8838c6444a36541e6c28aba7ae42de392fee | [
"MIT"
] | null | null | null | polyaxon/stats/__init__.py | gzcf/polyaxon | 77ac8838c6444a36541e6c28aba7ae42de392fee | [
"MIT"
] | null | null | null | from django.conf import settings
from libs.services import LazyServiceWrapper
from stats.base import BaseStatsBackend
def get_stats_backend():
if settings.STATS_BACKEND == settings.STATS_BACKEND_NOOP:
return 'stats.noop.NoOpStatsBackend'
if settings.STATS_BACKEND == settings.STATS_BACKEND_DATADOG:
... | 27.956522 | 64 | 0.765163 | from django.conf import settings
from libs.services import LazyServiceWrapper
from stats.base import BaseStatsBackend
def get_stats_backend():
if settings.STATS_BACKEND == settings.STATS_BACKEND_NOOP:
return 'stats.noop.NoOpStatsBackend'
if settings.STATS_BACKEND == settings.STATS_BACKEND_DATADOG:
... | true | true |
f74126be16cc2833e8c99970fac16ae21211bab2 | 4,669 | py | Python | pro/shangmi/serializer_helpers.py | jaxsbin/shangmi | 304edaf77d4dcebed4dcac2e7e4841c26ed2d0af | [
"Apache-2.0"
] | 1 | 2018-10-24T09:48:41.000Z | 2018-10-24T09:48:41.000Z | pro/shangmi/serializer_helpers.py | jaxsbin/shangmi | 304edaf77d4dcebed4dcac2e7e4841c26ed2d0af | [
"Apache-2.0"
] | null | null | null | pro/shangmi/serializer_helpers.py | jaxsbin/shangmi | 304edaf77d4dcebed4dcac2e7e4841c26ed2d0af | [
"Apache-2.0"
] | null | null | null | from __future__ import unicode_literals
import collections
from collections import OrderedDict
from django.utils.encoding import force_text
class ReturnDict(OrderedDict):
"""
Return object from `serializer.data` for the `Serializer` class.
Includes a backlink to the serializer instance for renderers
... | 29.18125 | 77 | 0.631827 | from __future__ import unicode_literals
import collections
from collections import OrderedDict
from django.utils.encoding import force_text
class ReturnDict(OrderedDict):
def __init__(self, *args, **kwargs):
self.serializer = kwargs.pop('serializer')
super(ReturnDict, self).__init__(*args, **k... | true | true |
f741277d92f247216451cb334687254ee6806d11 | 1,764 | py | Python | test/emitter.test.py | thongdong7/socket.io-python-emitter | 13e794606b3c538899ca8bc4d463c7316e94e174 | [
"MIT"
] | null | null | null | test/emitter.test.py | thongdong7/socket.io-python-emitter | 13e794606b3c538899ca8bc4d463c7316e94e174 | [
"MIT"
] | null | null | null | test/emitter.test.py | thongdong7/socket.io-python-emitter | 13e794606b3c538899ca8bc4d463c7316e94e174 | [
"MIT"
] | null | null | null | __author__ = 'ziyasal'
from unittest import TestCase
import subprocess
import redis
from emitter import Emitter
class TestEmitter(TestCase):
@classmethod
def setUpClass(cls):
cls.redis_server = subprocess.Popen("redis-server", stdout=subprocess.PIPE, shell=True)
def setUp(self):
self.... | 27.138462 | 116 | 0.617347 | __author__ = 'ziyasal'
from unittest import TestCase
import subprocess
import redis
from emitter import Emitter
class TestEmitter(TestCase):
@classmethod
def setUpClass(cls):
cls.redis_server = subprocess.Popen("redis-server", stdout=subprocess.PIPE, shell=True)
def setUp(self):
self.... | true | true |
f741279159c0358e1b07ed17ba8d847b83c74c51 | 1,152 | py | Python | var/spack/repos/builtin/packages/mosh/package.py | xiki-tempula/spack | 9d66c05e93ab8a933fc59915040c0e0c86a4aac4 | [
"ECL-2.0",
"Apache-2.0",
"MIT"
] | 9 | 2018-04-18T07:51:40.000Z | 2021-09-10T03:56:57.000Z | var/spack/repos/builtin/packages/mosh/package.py | xiki-tempula/spack | 9d66c05e93ab8a933fc59915040c0e0c86a4aac4 | [
"ECL-2.0",
"Apache-2.0",
"MIT"
] | 907 | 2018-04-18T11:17:57.000Z | 2022-03-31T13:20:25.000Z | var/spack/repos/builtin/packages/mosh/package.py | xiki-tempula/spack | 9d66c05e93ab8a933fc59915040c0e0c86a4aac4 | [
"ECL-2.0",
"Apache-2.0",
"MIT"
] | 29 | 2018-11-05T16:14:23.000Z | 2022-02-03T16:07:09.000Z | # Copyright 2013-2020 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 Mosh(AutotoolsPackage):
"""Remote terminal application that allows roaming, supports inter... | 36 | 95 | 0.739583 |
from spack import *
class Mosh(AutotoolsPackage):
homepage = "https://mosh.org/"
url = "https://mosh.org/mosh-1.2.6.tar.gz"
version('1.3.2', sha256='da600573dfa827d88ce114e0fed30210689381bbdcff543c931e4d6a2e851216')
version('1.3.0', sha256='320e12f461e55d71566597976bd9440ba6c5265fa68fbf614... | true | true |
f741286cfa52825b39a20e5b50e2b3fbd5be91d3 | 12,111 | py | Python | lib/mysqlx/protobuf/mysqlx_pb2.py | nmariz/mysql-connector-python | 2ce54eabb3862b3429febffaa0e9e3827601304b | [
"Artistic-1.0-Perl"
] | 3 | 2020-03-16T02:49:59.000Z | 2022-03-21T15:04:44.000Z | lib/mysqlx/protobuf/mysqlx_pb2.py | nmariz/mysql-connector-python | 2ce54eabb3862b3429febffaa0e9e3827601304b | [
"Artistic-1.0-Perl"
] | 1 | 2020-12-10T08:04:25.000Z | 2020-12-10T08:04:25.000Z | lib/mysqlx/protobuf/mysqlx_pb2.py | nmariz/mysql-connector-python | 2ce54eabb3862b3429febffaa0e9e3827601304b | [
"Artistic-1.0-Perl"
] | 2 | 2020-05-01T08:16:25.000Z | 2020-07-21T00:12:06.000Z | # Generated by the protocol buffer compiler. DO NOT EDIT!
# source: mysqlx.proto
import sys
_b=sys.version_info[0]<3 and (lambda x:x) or (lambda x:x.encode('latin1'))
from google.protobuf import descriptor as _descriptor
from google.protobuf import message as _message
from google.protobuf import reflection as _reflec... | 32.469169 | 1,693 | 0.721988 |
import sys
_b=sys.version_info[0]<3 and (lambda x:x) or (lambda x:x.encode('latin1'))
from google.protobuf import descriptor as _descriptor
from google.protobuf import message as _message
from google.protobuf import reflection as _reflection
from google.protobuf import symbol_database as _symbol_database
from google... | true | true |
f7412936434132683d6db3a406f13310f72bbacf | 345 | py | Python | py/place/lattice2.py | teppchan/tkintertips | dc4b43e86185906d72ba5d5712edee94c76f8b37 | [
"MIT"
] | null | null | null | py/place/lattice2.py | teppchan/tkintertips | dc4b43e86185906d72ba5d5712edee94c76f8b37 | [
"MIT"
] | null | null | null | py/place/lattice2.py | teppchan/tkintertips | dc4b43e86185906d72ba5d5712edee94c76f8b37 | [
"MIT"
] | null | null | null | #!/usr/bin/env python
import Tkinter as Tk
root=Tk.Tk()
Tk.Button(root,
text="ABC",
).grid(row=0, column=0)
Tk.Button(root,
text="ABC\nabc",
).grid(row=0, column=1)
Tk.Button(root,
text="ABCABC\nABCABC",
).grid(row=1, column=0)
Tk.Button(root,
text="ABCABC",
).grid(row=1, co... | 15 | 32 | 0.594203 |
import Tkinter as Tk
root=Tk.Tk()
Tk.Button(root,
text="ABC",
).grid(row=0, column=0)
Tk.Button(root,
text="ABC\nabc",
).grid(row=0, column=1)
Tk.Button(root,
text="ABCABC\nABCABC",
).grid(row=1, column=0)
Tk.Button(root,
text="ABCABC",
).grid(row=1, column=1)
root.mainloo... | true | true |
f7412a11d01e819fd382497e5a7239ff19dc2b3d | 1,541 | py | Python | starbursts/plots/mpl.SFEoscil.py | astrobeard/VICEdev | c78804ec63b48a760ce3e50b8d3afc7b699ec75f | [
"MIT"
] | null | null | null | starbursts/plots/mpl.SFEoscil.py | astrobeard/VICEdev | c78804ec63b48a760ce3e50b8d3afc7b699ec75f | [
"MIT"
] | null | null | null | starbursts/plots/mpl.SFEoscil.py | astrobeard/VICEdev | c78804ec63b48a760ce3e50b8d3afc7b699ec75f | [
"MIT"
] | null | null | null |
import visuals
import matplotlib.pyplot as plt
from matplotlib.ticker import FormatStrFormatter
import vice
import sys
import warnings
warnings.filterwarnings("ignore")
if __name__ == "__main__":
axes = visuals.subplots(1, 3, figsize = (21, 7))
axes.insert(1, visuals.append_subplot_below(axes[0]))
axes[0... | 33.5 | 71 | 0.683323 |
import visuals
import matplotlib.pyplot as plt
from matplotlib.ticker import FormatStrFormatter
import vice
import sys
import warnings
warnings.filterwarnings("ignore")
if __name__ == "__main__":
axes = visuals.subplots(1, 3, figsize = (21, 7))
axes.insert(1, visuals.append_subplot_below(axes[0]))
axes[0... | true | true |
f7412a23c26f2fc2be1462553a9744f28259907f | 1,317 | py | Python | Dashboard with Django/app/migrations/0004_auto_20180518_1257.py | reddyprasade/Data-Analysis-with-Python- | 2440e23486856eea5556c8262467b3a618032bc2 | [
"MIT"
] | 1 | 2021-06-29T23:15:05.000Z | 2021-06-29T23:15:05.000Z | Dashboard with Django/app/migrations/0004_auto_20180518_1257.py | reddyprasade/Data-Analysis-with-Python- | 2440e23486856eea5556c8262467b3a618032bc2 | [
"MIT"
] | null | null | null | Dashboard with Django/app/migrations/0004_auto_20180518_1257.py | reddyprasade/Data-Analysis-with-Python- | 2440e23486856eea5556c8262467b3a618032bc2 | [
"MIT"
] | 1 | 2021-12-20T10:04:53.000Z | 2021-12-20T10:04:53.000Z | # -*- coding: utf-8 -*-
# Generated by Django 1.11.3 on 2018-05-18 07:27
from __future__ import unicode_literals
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('app', '0003_auto_20180518_1221'),
]
operations = [
migrations.CreateModel(
... | 36.583333 | 114 | 0.58694 |
from __future__ import unicode_literals
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('app', '0003_auto_20180518_1221'),
]
operations = [
migrations.CreateModel(
name='crimes_against_women',
fields=[
... | true | true |
f7412a571fe5ab280392cae51178480f1541cac3 | 3,644 | py | Python | common-python/rest_wrappers/oc/oc/delete_ip_association.py | LaudateCorpus1/atg-commerce-iaas | f1ae31657fc0111a5c019d46a28a3c81aae1acb2 | [
"MIT"
] | 28 | 2016-11-07T14:03:25.000Z | 2022-02-01T08:46:52.000Z | common-python/rest_wrappers/oc/oc/delete_ip_association.py | LaudateCorpus1/atg-commerce-iaas | f1ae31657fc0111a5c019d46a28a3c81aae1acb2 | [
"MIT"
] | 3 | 2016-11-09T13:23:03.000Z | 2018-04-05T15:49:22.000Z | common-python/rest_wrappers/oc/oc/delete_ip_association.py | LaudateCorpus1/atg-commerce-iaas | f1ae31657fc0111a5c019d46a28a3c81aae1acb2 | [
"MIT"
] | 13 | 2016-10-27T17:59:38.000Z | 2022-02-18T04:38:38.000Z | #!/usr/bin/python
# Copyright (c) 2013, 2014-2017 Oracle and/or its affiliates. All rights reserved.
"""Provide Module Description
"""
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~#
__author__ = "Andrew Hopkinson (Oracle Cloud Solutions A-Team)"
__copyright__ = "Copyright (... | 31.413793 | 115 | 0.612514 |
__author__ = "Andrew Hopkinson (Oracle Cloud Solutions A-Team)"
__copyright__ = "Copyright (c) 2013, 2014-2017 Oracle and/or its affiliates. All rights reserved."
__ekitversion__ = "@VERSION@"
__ekitrelease__ = "@RELEASE@"
__version__ = "1.0.0.0"
__date__ = "@BUILDDATE@"
__status__ = "Development"
__module__ = "de... | true | true |
f7412a5a7f73e47ba450bf6080b7eb7f44446fa9 | 35,604 | py | Python | CutPlanner.py | frogmaster/meerk40t | 9288b71c05670acf47976b18b2d6bf9d6c58ba99 | [
"MIT"
] | null | null | null | CutPlanner.py | frogmaster/meerk40t | 9288b71c05670acf47976b18b2d6bf9d6c58ba99 | [
"MIT"
] | null | null | null | CutPlanner.py | frogmaster/meerk40t | 9288b71c05670acf47976b18b2d6bf9d6c58ba99 | [
"MIT"
] | null | null | null | from svgelements import *
class CutPlanner:
@staticmethod
def bounding_box(elements):
if isinstance(elements, SVGElement):
elements = [elements]
elif isinstance(elements, list):
try:
elements = [e.object for e in elements if isinstance(e.obje... | 34.97446 | 119 | 0.50587 | from svgelements import *
class CutPlanner:
@staticmethod
def bounding_box(elements):
if isinstance(elements, SVGElement):
elements = [elements]
elif isinstance(elements, list):
try:
elements = [e.object for e in elements if isinstance(e.obje... | true | true |
f7412ab4117cda35749acbdde76ae6ae3767d0e0 | 77 | py | Python | Python/Unsorted/318a.py | LittleEndu/Codeforces | 82c49b10702c58bc5ce062801d740a2f5f600062 | [
"MIT"
] | null | null | null | Python/Unsorted/318a.py | LittleEndu/Codeforces | 82c49b10702c58bc5ce062801d740a2f5f600062 | [
"MIT"
] | null | null | null | Python/Unsorted/318a.py | LittleEndu/Codeforces | 82c49b10702c58bc5ce062801d740a2f5f600062 | [
"MIT"
] | null | null | null | # Shortest
a,b=map(int,input().split());c=b-(a+1)//2;print([b*2-1,c*2][c>0]) | 25.666667 | 65 | 0.558442 |
a,b=map(int,input().split());c=b-(a+1)//2;print([b*2-1,c*2][c>0]) | true | true |
f7412b01058d3f0a4f9c7ac716c5f428decb1e83 | 12,483 | py | Python | qa/rpc-tests/p2p-acceptblock.py | moeye/executecoin | af86c812a99b09c31ad2b35803b8ae9b25831208 | [
"MIT"
] | 1 | 2019-04-08T01:45:23.000Z | 2019-04-08T01:45:23.000Z | qa/rpc-tests/p2p-acceptblock.py | moeye/executecoin | af86c812a99b09c31ad2b35803b8ae9b25831208 | [
"MIT"
] | null | null | null | qa/rpc-tests/p2p-acceptblock.py | moeye/executecoin | af86c812a99b09c31ad2b35803b8ae9b25831208 | [
"MIT"
] | 1 | 2019-04-15T03:48:50.000Z | 2019-04-15T03:48:50.000Z | #!/usr/bin/env python3
# Copyright (c) 2015-2016 The Bitcoin Core developers
# Distributed under the MIT software license, see the accompanying
# file COPYING or http://www.opensource.org/licenses/mit-license.php.
from test_framework.mininode import *
from test_framework.test_framework import BitcoinTestFramework
from... | 42.604096 | 107 | 0.651206 |
from test_framework.mininode import *
from test_framework.test_framework import BitcoinTestFramework
from test_framework.util import *
import time
from test_framework.blocktools import create_block, create_coinbase
class TestNode(NodeConnCB):
def __init__(self):
NodeConnCB.__init__(self)
se... | true | true |
f7412b220fbb2410fe7e8d495c082347924712f0 | 7,276 | py | Python | flatland/envs/distance_map.py | HarryTanNguyen/flatland-railway-enviroment | 5306871a6dbedd8d2745be4ff0caf0515e4d88ac | [
"MIT"
] | 1 | 2021-04-27T12:31:07.000Z | 2021-04-27T12:31:07.000Z | flatland/envs/distance_map.py | HarryTanNguyen/flatland-railway-enviroment | 5306871a6dbedd8d2745be4ff0caf0515e4d88ac | [
"MIT"
] | null | null | null | flatland/envs/distance_map.py | HarryTanNguyen/flatland-railway-enviroment | 5306871a6dbedd8d2745be4ff0caf0515e4d88ac | [
"MIT"
] | null | null | null | from collections import deque
from typing import List, Optional
import numpy as np
from flatland.core.grid.grid4_utils import get_new_position
from flatland.core.transition_map import GridTransitionMap
from flatland.envs.agent_utils import EnvAgent
class DistanceMap:
def __init__(self, agents: List[E... | 45.192547 | 121 | 0.592908 | from collections import deque
from typing import List, Optional
import numpy as np
from flatland.core.grid.grid4_utils import get_new_position
from flatland.core.transition_map import GridTransitionMap
from flatland.envs.agent_utils import EnvAgent
class DistanceMap:
def __init__(self, agents: List[E... | true | true |
f7412c2dd37b8fde9068ac9fef2a8fe95929f0c6 | 4,624 | py | Python | examples/protocols/sockets/tcp_client/example_test.py | cablelabs/esp-idf | a8f9a65f251a33cd5a5deaf14e95ca417abad41b | [
"Apache-2.0"
] | 8,747 | 2016-08-18T14:58:24.000Z | 2022-03-31T20:58:55.000Z | examples/protocols/sockets/tcp_client/example_test.py | cablelabs/esp-idf | a8f9a65f251a33cd5a5deaf14e95ca417abad41b | [
"Apache-2.0"
] | 8,603 | 2016-08-20T08:55:56.000Z | 2022-03-31T23:04:01.000Z | examples/protocols/sockets/tcp_client/example_test.py | cablelabs/esp-idf | a8f9a65f251a33cd5a5deaf14e95ca417abad41b | [
"Apache-2.0"
] | 6,380 | 2016-08-18T18:17:00.000Z | 2022-03-31T22:25:57.000Z | # This example code is in the Public Domain (or CC0 licensed, at your option.)
# Unless required by applicable law or agreed to in writing, this
# software is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR
# CONDITIONS OF ANY KIND, either express or implied.
# -*- coding: utf-8 -*-
from __future__ import pri... | 35.030303 | 123 | 0.614619 |
from __future__ import print_function, unicode_literals
import os
import re
import socket
import sys
from builtins import input
from threading import Event, Thread
import netifaces
import ttfw_idf
PORT = 3333
INTERFACE = 'eth0'
def get_my_ip(type):
for i in netifaces.ifaddresses(INTERFACE)[type]:
... | true | true |
f7412d10302dc195f5566319ef57207d09bad3b3 | 5,802 | py | Python | djangox/lib/python3.8/site-packages/allauth/socialaccount/providers/bitbucket_oauth2/tests.py | DemarcusL/django_wiki_lab | 3b7cf18af7e0f89c94d10eb953ca018a150a2f55 | [
"MIT"
] | 6,342 | 2015-01-01T07:40:30.000Z | 2022-03-31T04:18:30.000Z | djangox/lib/python3.8/site-packages/allauth/socialaccount/providers/bitbucket_oauth2/tests.py | DemarcusL/django_wiki_lab | 3b7cf18af7e0f89c94d10eb953ca018a150a2f55 | [
"MIT"
] | 2,198 | 2015-01-02T15:17:45.000Z | 2022-03-28T10:20:43.000Z | djangox/lib/python3.8/site-packages/allauth/socialaccount/providers/bitbucket_oauth2/tests.py | DemarcusL/django_wiki_lab | 3b7cf18af7e0f89c94d10eb953ca018a150a2f55 | [
"MIT"
] | 2,928 | 2015-01-01T10:44:13.000Z | 2022-03-31T03:20:16.000Z | # -*- coding: utf-8 -*-
from __future__ import unicode_literals
from unittest import mock
from django.test.utils import override_settings
from allauth.socialaccount.models import SocialAccount
from allauth.socialaccount.providers import registry
from allauth.socialaccount.tests import create_oauth2_tests
from allaut... | 36.955414 | 129 | 0.510686 |
from __future__ import unicode_literals
from unittest import mock
from django.test.utils import override_settings
from allauth.socialaccount.models import SocialAccount
from allauth.socialaccount.providers import registry
from allauth.socialaccount.tests import create_oauth2_tests
from allauth.tests import MockedRe... | true | true |
f7412e2f270169d30451207b48b6f20c5ce468ff | 701 | py | Python | app/lecture06-styles/font.py | vahidfzm/python-and-excel-course-code | 1c975c61d97d7bebb13622362011f68943f954e9 | [
"MIT"
] | 2 | 2021-06-19T08:08:20.000Z | 2021-06-30T13:46:04.000Z | app/lecture06-styles/font.py | vahidfzm/python-and-excel-course-code | 1c975c61d97d7bebb13622362011f68943f954e9 | [
"MIT"
] | null | null | null | app/lecture06-styles/font.py | vahidfzm/python-and-excel-course-code | 1c975c61d97d7bebb13622362011f68943f954e9 | [
"MIT"
] | null | null | null | ###############################################################
################# https://www.fardanesh.ir ####################
###############################################################
from openpyxl import load_workbook
from openpyxl.styles import Font
wb=load_workbook('lecture06-styles/list1.xlsx')
ws1=wb.... | 21.90625 | 63 | 0.430813 | true | true | |
f7412fdc8e9db23924f3d74f806dd17170976acc | 1,006 | py | Python | app/validators/v1/order_forms.py | zcxyun/snack-api-lin | 7b728c583f5467fcfffaf30ccf75c3e5ffefb7e5 | [
"MIT"
] | 1 | 2020-02-03T18:39:33.000Z | 2020-02-03T18:39:33.000Z | app/validators/v1/order_forms.py | zcxyun/snack-api-lin | 7b728c583f5467fcfffaf30ccf75c3e5ffefb7e5 | [
"MIT"
] | null | null | null | app/validators/v1/order_forms.py | zcxyun/snack-api-lin | 7b728c583f5467fcfffaf30ccf75c3e5ffefb7e5 | [
"MIT"
] | null | null | null | from flask import request
from lin.exception import ParameterException
from lin.forms import Form
from wtforms import Form as WTForm, IntegerField
from wtforms.validators import DataRequired, NumberRange, AnyOf
class OneProductOfOrder(WTForm):
product_id = IntegerField(validators=[DataRequired(message='商品ID不能为空')... | 35.928571 | 88 | 0.659046 | from flask import request
from lin.exception import ParameterException
from lin.forms import Form
from wtforms import Form as WTForm, IntegerField
from wtforms.validators import DataRequired, NumberRange, AnyOf
class OneProductOfOrder(WTForm):
product_id = IntegerField(validators=[DataRequired(message='商品ID不能为空')... | true | true |
f74130593d62d948df1657ffb1e7184bcb2446c0 | 196 | py | Python | python_ghost_cursor/playwright_sync/_mouse_helper.py | mcolella14/python_ghost_cursor | eb2188d75bbef8a01cde209d66ab9a4cac433b98 | [
"MIT"
] | 7 | 2021-11-08T23:25:34.000Z | 2021-12-27T12:17:18.000Z | python_ghost_cursor/playwright_sync/_mouse_helper.py | mcolella14/pyppeteer_ghost_cursor | eb2188d75bbef8a01cde209d66ab9a4cac433b98 | [
"MIT"
] | 2 | 2021-06-19T12:50:57.000Z | 2021-06-30T09:54:45.000Z | python_ghost_cursor/playwright_sync/_mouse_helper.py | mcolella14/python_ghost_cursor | eb2188d75bbef8a01cde209d66ab9a4cac433b98 | [
"MIT"
] | 2 | 2021-05-27T10:45:27.000Z | 2021-05-27T10:50:36.000Z | from playwright.sync_api import Page
from pathlib import Path
def install_mouse_helper(page: Page) -> None:
page.add_init_script(path=Path(__file__).parent.joinpath("../js/mouseHelper.js"))
| 28 | 85 | 0.77551 | from playwright.sync_api import Page
from pathlib import Path
def install_mouse_helper(page: Page) -> None:
page.add_init_script(path=Path(__file__).parent.joinpath("../js/mouseHelper.js"))
| true | true |
f741310e2114e1269517eb16daff889e0c8f4e2e | 944 | py | Python | cryptotest.py | BoeJaker/JARVIS | 6fdef2fac80fa38933dba275b3456e06f483e656 | [
"Apache-2.0"
] | null | null | null | cryptotest.py | BoeJaker/JARVIS | 6fdef2fac80fa38933dba275b3456e06f483e656 | [
"Apache-2.0"
] | null | null | null | cryptotest.py | BoeJaker/JARVIS | 6fdef2fac80fa38933dba275b3456e06f483e656 | [
"Apache-2.0"
] | null | null | null | import ccxt
class crypto(object):
watchlist = {"BTC":"", "ETH":"", "EOS":"", "ADA":"", "IOTA":"", "NULS":"", "NEO":"", "SKY":"", "PAL":""}
def __init__(self):
self.build_market()
def list_exchanges(self):
n = [print(x) for x in ccxt.exchanges]
def build_market(self):
self.binance = ccxt.binance()
self.c... | 23.02439 | 105 | 0.647246 | import ccxt
class crypto(object):
watchlist = {"BTC":"", "ETH":"", "EOS":"", "ADA":"", "IOTA":"", "NULS":"", "NEO":"", "SKY":"", "PAL":""}
def __init__(self):
self.build_market()
def list_exchanges(self):
n = [print(x) for x in ccxt.exchanges]
def build_market(self):
self.binance = ccxt.binance()
self.c... | true | true |
f7413134398bc969b47fb6a2fb8bfb14d3e3ca48 | 94 | py | Python | myParams.py | giladddd/MLN | 52876e75671d3fee8905b16931aadc9ecdc7bd4f | [
"MIT"
] | 2 | 2019-04-16T05:04:23.000Z | 2020-05-20T15:31:19.000Z | myParams.py | giladddd/MLN | 52876e75671d3fee8905b16931aadc9ecdc7bd4f | [
"MIT"
] | null | null | null | myParams.py | giladddd/MLN | 52876e75671d3fee8905b16931aadc9ecdc7bd4f | [
"MIT"
] | 2 | 2018-12-30T14:16:02.000Z | 2019-08-06T16:43:46.000Z | # myParams.py
def init():
global myList
global myDict
myList = []
myDict = {} | 13.428571 | 17 | 0.56383 |
def init():
global myList
global myDict
myList = []
myDict = {} | true | true |
f741313b46c2030440d04c34d219d852a2a82311 | 1,597 | py | Python | _old/interface/bar.py | mccartnm/spaceman | 6f6f668c46531c68b87b0aaa16fb3f616375ed7d | [
"MIT"
] | 1 | 2019-05-12T23:33:19.000Z | 2019-05-12T23:33:19.000Z | _old/interface/bar.py | mccartnm/spaceman | 6f6f668c46531c68b87b0aaa16fb3f616375ed7d | [
"MIT"
] | null | null | null | _old/interface/bar.py | mccartnm/spaceman | 6f6f668c46531c68b87b0aaa16fb3f616375ed7d | [
"MIT"
] | null | null | null | """
Progress bars, health bars, etc
"""
import arcade
from ..core.utils import Rect, Position
from .iabstract import _AbstractInterfaceObject
class Bar(_AbstractInterfaceObject):
"""
Drawable bar
"""
MIDDLE_OUT = 'mi'
RIGHT_TO_LEFT = 'rtl'
def __init__(self,
geometry: Rect... | 21.876712 | 62 | 0.547276 |
import arcade
from ..core.utils import Rect, Position
from .iabstract import _AbstractInterfaceObject
class Bar(_AbstractInterfaceObject):
MIDDLE_OUT = 'mi'
RIGHT_TO_LEFT = 'rtl'
def __init__(self,
geometry: Rect = Rect(),
color = arcade.color.BLUE,
p... | true | true |
f7413153eb991e962c90cc4cfae59300d84da55a | 14,578 | bzl | Python | source/extensions/extensions_build_config.bzl | Monkeyanator/envoy-wasm | a7a2318fdfb3cff4f90cb79edf5de834e8d3b24d | [
"Apache-2.0"
] | null | null | null | source/extensions/extensions_build_config.bzl | Monkeyanator/envoy-wasm | a7a2318fdfb3cff4f90cb79edf5de834e8d3b24d | [
"Apache-2.0"
] | null | null | null | source/extensions/extensions_build_config.bzl | Monkeyanator/envoy-wasm | a7a2318fdfb3cff4f90cb79edf5de834e8d3b24d | [
"Apache-2.0"
] | null | null | null | # See bazel/README.md for details on how this system works.
EXTENSIONS = {
#
# Access loggers
#
"envoy.access_loggers.file": "//source/extensions/access_loggers/file:config",
"envoy.access_loggers.http_grpc": "//source/extensions/access_loggers/http_grpc:con... | 59.99177 | 132 | 0.633626 |
EXTENSIONS = {
"envoy.access_loggers.file": "//source/extensions/access_loggers/file:config",
"envoy.access_loggers.http_grpc": "//source/extensions/access_loggers/http_grpc:config",
"envoy.access_loggers.wasm": "//source/exten... | true | true |
f7413192fc5522cc662032a7134b7700ac49edd1 | 1,603 | py | Python | logistic_regression/logistic_regression.py | ryanirl/ml-basics | e143eacf6338877d8111d1c0ee56853475efa914 | [
"MIT"
] | null | null | null | logistic_regression/logistic_regression.py | ryanirl/ml-basics | e143eacf6338877d8111d1c0ee56853475efa914 | [
"MIT"
] | null | null | null | logistic_regression/logistic_regression.py | ryanirl/ml-basics | e143eacf6338877d8111d1c0ee56853475efa914 | [
"MIT"
] | null | null | null | import numpy as np
from sklearn.datasets import make_blobs
import matplotlib.pyplot as plt
### --- Gather Dataset --- ###
n = 100
X, y = make_blobs(n_samples = n, centers = 2)
y = y[:, np.newaxis]
### --- Build Model --- ###
def sigmoid(z):
return 1.0 / (1.0 + np.exp(-z))
class LogisticRegression:
def ... | 21.662162 | 95 | 0.537742 | import numpy as np
from sklearn.datasets import make_blobs
import matplotlib.pyplot as plt
:, np.newaxis]
lass LogisticRegression:
def predict(self, X, w, b):
return sigmoid(X.dot(w) + b)
def loss(self, pred, y):
BCE = (y * np.log(pred + 1e-6) + (1 - y) * np.log(1 - pred + 1e-6))
r... | true | true |
f74131f2be5a1955c0e90e47083a2e5dc843720e | 1,913 | py | Python | benchmark/startPyquil3243.py | UCLA-SEAL/QDiff | d968cbc47fe926b7f88b4adf10490f1edd6f8819 | [
"BSD-3-Clause"
] | null | null | null | benchmark/startPyquil3243.py | UCLA-SEAL/QDiff | d968cbc47fe926b7f88b4adf10490f1edd6f8819 | [
"BSD-3-Clause"
] | null | null | null | benchmark/startPyquil3243.py | UCLA-SEAL/QDiff | d968cbc47fe926b7f88b4adf10490f1edd6f8819 | [
"BSD-3-Clause"
] | null | null | null | # qubit number=4
# total number=42
import pyquil
from pyquil.api import local_forest_runtime, QVMConnection
from pyquil import Program, get_qc
from pyquil.gates import *
import numpy as np
conn = QVMConnection()
def make_circuit()-> Program:
prog = Program() # circuit begin
prog += H(3) # number=31
prog... | 25.171053 | 64 | 0.558808 |
import pyquil
from pyquil.api import local_forest_runtime, QVMConnection
from pyquil import Program, get_qc
from pyquil.gates import *
import numpy as np
conn = QVMConnection()
def make_circuit()-> Program:
prog = Program()
prog += H(3)
prog += CZ(0,3)
prog += H(3)
prog += H(3)
prog +... | true | true |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.