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 |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
f70930266a9947b1e4d78fd8cb4f0ee3fd4e8801 | 7,397 | py | Python | src/api/dataflow/shared/datamanage/datamanage_helper.py | Chromico/bk-base | be822d9bbee544a958bed4831348185a75604791 | [
"MIT"
] | 84 | 2021-06-30T06:20:23.000Z | 2022-03-22T03:05:49.000Z | src/api/dataflow/shared/datamanage/datamanage_helper.py | Chromico/bk-base | be822d9bbee544a958bed4831348185a75604791 | [
"MIT"
] | 7 | 2021-06-30T06:21:16.000Z | 2022-03-29T07:36:13.000Z | src/api/dataflow/shared/datamanage/datamanage_helper.py | Chromico/bk-base | be822d9bbee544a958bed4831348185a75604791 | [
"MIT"
] | 40 | 2021-06-30T06:21:26.000Z | 2022-03-29T12:42:26.000Z | # -*- coding: utf-8 -*-
"""
Tencent is pleased to support the open source community by making BK-BASE 蓝鲸基础平台 available.
Copyright (C) 2021 THL A29 Limited, a Tencent company. All rights reserved.
BK-BASE 蓝鲸基础平台 is licensed under the MIT License.
License for BK-BASE 蓝鲸基础平台:
------------------------------------------... | 33.931193 | 111 | 0.680681 |
import json
from django.utils.translation import ugettext as _
from dataflow.pizza_settings import KAFKA_OP_ROLE_NAME
from dataflow.shared.api.modules.datamanage import DatamanageApi
from dataflow.shared.api.util.api_driver import APIResponseUtil as res_util
from dataflow.shared.databus.databus_helper import Databu... | true | true |
f709302f607362b2ef2384ba1503f4713840f6d2 | 3,390 | py | Python | tic-tac.py | kobe81venum/tic-tac | c34841f31655bbfa85b3ae3ec548e99d0555589a | [
"MIT"
] | null | null | null | tic-tac.py | kobe81venum/tic-tac | c34841f31655bbfa85b3ae3ec548e99d0555589a | [
"MIT"
] | null | null | null | tic-tac.py | kobe81venum/tic-tac | c34841f31655bbfa85b3ae3ec548e99d0555589a | [
"MIT"
] | null | null | null | #main game section
# %%
plansza_do_gry = {'7':' ','8':' ','9':' ',
'4':' ','5':' ','6':' ',
'1':' ','2':' ','3':' '}
klawisze_gry=[]
for key in plansza_do_gry:
klawisze_gry.append(key)
# print(klawisze_gry)
def drukuj_plansze(pole):
print(f"{pole['7']} | {pole['8']} | {p... | 32.912621 | 90 | 0.484956 |
plansza_do_gry = {'7':' ','8':' ','9':' ',
'4':' ','5':' ','6':' ',
'1':' ','2':' ','3':' '}
klawisze_gry=[]
for key in plansza_do_gry:
klawisze_gry.append(key)
def drukuj_plansze(pole):
print(f"{pole['7']} | {pole['8']} | {pole['9']}")
print('- + - + -')
prin... | true | true |
f70931652a71d14009a5d59d657e6473e79290df | 401 | py | Python | backend/thread_33988/wsgi.py | crowdbotics-apps/thread-33988 | 4a80fd631efce5785fcfadc057b4f90ac9a4749e | [
"FTL",
"AML",
"RSA-MD"
] | null | null | null | backend/thread_33988/wsgi.py | crowdbotics-apps/thread-33988 | 4a80fd631efce5785fcfadc057b4f90ac9a4749e | [
"FTL",
"AML",
"RSA-MD"
] | null | null | null | backend/thread_33988/wsgi.py | crowdbotics-apps/thread-33988 | 4a80fd631efce5785fcfadc057b4f90ac9a4749e | [
"FTL",
"AML",
"RSA-MD"
] | null | null | null | """
WSGI config for thread_33988 project.
It exposes the WSGI callable as a module-level variable named ``application``.
For more information on this file, see
https://docs.djangoproject.com/en/2.2/howto/deployment/wsgi/
"""
import os
from django.core.wsgi import get_wsgi_application
os.environ.setdefault('DJANGO_... | 23.588235 | 78 | 0.790524 |
import os
from django.core.wsgi import get_wsgi_application
os.environ.setdefault('DJANGO_SETTINGS_MODULE', 'thread_33988.settings')
application = get_wsgi_application()
| true | true |
f709328daa9880d8b3313f573584ecdd16f15dea | 30,599 | py | Python | run_classifier.py | ksboy/superglue | 12b5bf6d729ba5b95b8a29682f6bfa584131ae9c | [
"Apache-2.0"
] | null | null | null | run_classifier.py | ksboy/superglue | 12b5bf6d729ba5b95b8a29682f6bfa584131ae9c | [
"Apache-2.0"
] | null | null | null | run_classifier.py | ksboy/superglue | 12b5bf6d729ba5b95b8a29682f6bfa584131ae9c | [
"Apache-2.0"
] | null | null | null | # coding=utf-8
# Copyright 2018 The Google AI Language Team Authors and The HuggingFace Inc. team.
# Copyright (c) 2018, NVIDIA CORPORATION. All rights reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a cop... | 47.513975 | 145 | 0.587013 |
from __future__ import absolute_import, division, print_function
import argparse
import logging
import os
import sys
import random
from tqdm import tqdm, trange
import numpy as np
from scipy.special import softmax
import torch
from torch.utils.data import (DataLoader, RandomSampler, SequentialSample... | true | true |
f7093398654a58555f899c5a5f2cf4cb9551af39 | 89 | py | Python | src/lesson_developer_tools/compileall_recursion_depth.py | jasonwee/asus-rt-n14uhp-mrtg | 4fa96c3406e32ea6631ce447db6d19d70b2cd061 | [
"Apache-2.0"
] | 3 | 2018-08-14T09:33:52.000Z | 2022-03-21T12:31:58.000Z | src/lesson_developer_tools/compileall_recursion_depth.py | jasonwee/asus-rt-n14uhp-mrtg | 4fa96c3406e32ea6631ce447db6d19d70b2cd061 | [
"Apache-2.0"
] | null | null | null | src/lesson_developer_tools/compileall_recursion_depth.py | jasonwee/asus-rt-n14uhp-mrtg | 4fa96c3406e32ea6631ce447db6d19d70b2cd061 | [
"Apache-2.0"
] | null | null | null | import compileall
import re
compileall.compile_dir(
'examples',
maxlevels=0,
)
| 9.888889 | 23 | 0.707865 | import compileall
import re
compileall.compile_dir(
'examples',
maxlevels=0,
)
| true | true |
f70933ecf281da6cda4b19389d3bb7d2e6f3df4b | 9,330 | py | Python | saleor/graphql/core/tests/test_graphql.py | fairhopeweb/saleor | 9ac6c22652d46ba65a5b894da5f1ba5bec48c019 | [
"CC-BY-4.0"
] | 15,337 | 2015-01-12T02:11:52.000Z | 2021-10-05T19:19:29.000Z | saleor/graphql/core/tests/test_graphql.py | fairhopeweb/saleor | 9ac6c22652d46ba65a5b894da5f1ba5bec48c019 | [
"CC-BY-4.0"
] | 7,486 | 2015-02-11T10:52:13.000Z | 2021-10-06T09:37:15.000Z | saleor/graphql/core/tests/test_graphql.py | aminziadna/saleor | 2e78fb5bcf8b83a6278af02551a104cfa555a1fb | [
"CC-BY-4.0"
] | 5,864 | 2015-01-16T14:52:54.000Z | 2021-10-05T23:01:15.000Z | from functools import partial
from unittest.mock import Mock, patch
import graphene
import pytest
from django.contrib.auth.models import AnonymousUser
from django.db.models import Q
from django.shortcuts import reverse
from graphql.error import GraphQLError
from graphql_relay import to_global_id
from ...core.utils im... | 29.432177 | 87 | 0.602572 | from functools import partial
from unittest.mock import Mock, patch
import graphene
import pytest
from django.contrib.auth.models import AnonymousUser
from django.db.models import Q
from django.shortcuts import reverse
from graphql.error import GraphQLError
from graphql_relay import to_global_id
from ...core.utils im... | true | true |
f70937bd4d44bb239528e4d0a4eeca186cddd1d3 | 6,375 | py | Python | sales_forecast/scoring/score.py | AghaSaad04/mlops-v2 | d312ae108c93bacfb3541968bb913874af060ab2 | [
"MIT"
] | null | null | null | sales_forecast/scoring/score.py | AghaSaad04/mlops-v2 | d312ae108c93bacfb3541968bb913874af060ab2 | [
"MIT"
] | null | null | null | sales_forecast/scoring/score.py | AghaSaad04/mlops-v2 | d312ae108c93bacfb3541968bb913874af060ab2 | [
"MIT"
] | null | null | null | import numpy
import os
import math
from azureml.core.model import Model
from azureml.core.dataset import Dataset
from inference_schema.schema_decorators \
import input_schema, output_schema
from inference_schema.parameter_types.numpy_parameter_type \
import NumpyParameterType
import keras
from keras.m... | 34.646739 | 217 | 0.642353 | import numpy
import os
import math
from azureml.core.model import Model
from azureml.core.dataset import Dataset
from inference_schema.schema_decorators \
import input_schema, output_schema
from inference_schema.parameter_types.numpy_parameter_type \
import NumpyParameterType
import keras
from keras.m... | true | true |
f70938f0d7e8390db2b65b8b2287c08bd4a5e663 | 16,026 | py | Python | plata/shop/migrations/0007_auto__add_field_order_billing_call_prefix__add_field_order_shipping_ca.py | DjangoAdminHackers/plata | 9f09431ef30a1e2022baa47cc89796c6d0879a25 | [
"BSD-3-Clause"
] | null | null | null | plata/shop/migrations/0007_auto__add_field_order_billing_call_prefix__add_field_order_shipping_ca.py | DjangoAdminHackers/plata | 9f09431ef30a1e2022baa47cc89796c6d0879a25 | [
"BSD-3-Clause"
] | null | null | null | plata/shop/migrations/0007_auto__add_field_order_billing_call_prefix__add_field_order_shipping_ca.py | DjangoAdminHackers/plata | 9f09431ef30a1e2022baa47cc89796c6d0879a25 | [
"BSD-3-Clause"
] | null | null | null | # encoding: utf-8
import datetime
from south.db import db
from south.v2 import SchemaMigration
from django.db import models
class Migration(SchemaMigration):
def forwards(self, orm):
# Adding field 'Order.billing_call_prefix'
db.add_column(u'shop_order', 'billing_call_prefix', self.gf('dj... | 83.905759 | 195 | 0.567328 |
import datetime
from south.db import db
from south.v2 import SchemaMigration
from django.db import models
class Migration(SchemaMigration):
def forwards(self, orm):
db.add_column(u'shop_order', 'billing_call_prefix', self.gf('django.db.models.fields.CharField')(default='', max_length=10... | true | true |
f70939b28be639a86193981881a264d901c31701 | 481 | py | Python | tests/test_signal/test_generator.py | mcanatalay/SIMULOC | af32c522887dec08a0815052a5878b5a595b8d44 | [
"MIT"
] | null | null | null | tests/test_signal/test_generator.py | mcanatalay/SIMULOC | af32c522887dec08a0815052a5878b5a595b8d44 | [
"MIT"
] | null | null | null | tests/test_signal/test_generator.py | mcanatalay/SIMULOC | af32c522887dec08a0815052a5878b5a595b8d44 | [
"MIT"
] | null | null | null | import unittest
from simuloc.signal import Generator
class GeneratorTestCase(unittest.TestCase):
"""GeneratorTestCase tests the generator class."""
def setUp(self):
"""Creates a instance of the generator class."""
self.cinst = Generator()
def tearDown(self):
pass
def test_noi... | 24.05 | 56 | 0.656965 | import unittest
from simuloc.signal import Generator
class GeneratorTestCase(unittest.TestCase):
def setUp(self):
self.cinst = Generator()
def tearDown(self):
pass
def test_noise(self):
self.assertTrue(self.cinst.noise(0.1) < 4)
if __name__ == '__main__':
unittest.main()
| true | true |
f70939c6c4c8363f7dcf9a0f1d8507a2c83f495d | 4,882 | py | Python | source/Project.py | victorchen276/CarND-Advanced-Lane-Lines | 436d81150107c181e3f328adfd3f1c31d6a5cb15 | [
"MIT"
] | 1 | 2019-01-20T10:59:36.000Z | 2019-01-20T10:59:36.000Z | source/Project.py | victorchen276/CarND-Advanced-Lane-Lines | 436d81150107c181e3f328adfd3f1c31d6a5cb15 | [
"MIT"
] | 4 | 2021-03-18T21:58:46.000Z | 2022-01-13T01:04:22.000Z | source/Project.py | victorchen276/CarND-Advanced-Lane-Lines | 436d81150107c181e3f328adfd3f1c31d6a5cb15 | [
"MIT"
] | 2 | 2019-01-20T10:59:39.000Z | 2019-08-04T13:08:14.000Z |
from source.camera import camera
from source.LaneDetect import LaneDetect
from moviepy.editor import VideoFileClip
import glob
import matplotlib.pyplot as plt
import matplotlib.gridspec as gridspec
import matplotlib.image as mpimg
import numpy as np
import cv2
#
# def process_video(input_video_file):
# clip1 = V... | 35.897059 | 105 | 0.648914 |
from source.camera import camera
from source.LaneDetect import LaneDetect
from moviepy.editor import VideoFileClip
import glob
import matplotlib.pyplot as plt
import matplotlib.gridspec as gridspec
import matplotlib.image as mpimg
import numpy as np
import cv2
def rgb2gray(rgb):
return np.dot(rgb[...,:3], ... | true | true |
f7093aa21d3221a29bbe4a8c0a4d8dbde9443d8d | 3,322 | py | Python | doc/source/conf.py | lostmap/python-mistralclient | f77c1d23fb68b24d7406647b489f3f960026c46b | [
"Apache-2.0"
] | null | null | null | doc/source/conf.py | lostmap/python-mistralclient | f77c1d23fb68b24d7406647b489f3f960026c46b | [
"Apache-2.0"
] | null | null | null | doc/source/conf.py | lostmap/python-mistralclient | f77c1d23fb68b24d7406647b489f3f960026c46b | [
"Apache-2.0"
] | null | null | null | # Mistral documentation build configuration file
import os
import sys
on_rtd = os.environ.get('READTHEDOCS', None) == 'True'
# If extensions (or modules to document with autodoc) are in another directory,
# add these directories to sys.path here. If the directory is relative to the
# documentation root, use os.path.... | 31.046729 | 79 | 0.689344 |
import os
import sys
on_rtd = os.environ.get('READTHEDOCS', None) == 'True'
sys.path.insert(0, os.path.abspath('../../'))
sys.path.insert(0, os.path.abspath('../'))
sys.path.insert(0, os.path.abspath('./'))
extensions = [
'sphinxcontrib.apidoc',
'openstackdocstheme',
]
apidoc_module_dir = '../.... | true | true |
f7093c16a586362247f066ec5e801495ab9cae9d | 547 | py | Python | reviews/migrations/0009_movie_poster_thumbnail.py | UrbanBogger/horrorexplosion | 3698e00a6899a5e8b224cd3d1259c3deb3a2ca80 | [
"MIT"
] | null | null | null | reviews/migrations/0009_movie_poster_thumbnail.py | UrbanBogger/horrorexplosion | 3698e00a6899a5e8b224cd3d1259c3deb3a2ca80 | [
"MIT"
] | 4 | 2020-06-05T18:21:18.000Z | 2021-06-10T20:17:31.000Z | reviews/migrations/0009_movie_poster_thumbnail.py | UrbanBogger/horrorexplosion | 3698e00a6899a5e8b224cd3d1259c3deb3a2ca80 | [
"MIT"
] | null | null | null | # -*- coding: utf-8 -*-
# Generated by Django 1.11.6 on 2018-07-08 17:37
from __future__ import unicode_literals
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('reviews', '0008_auto_20180623_2009'),
]
operations = [
migrations.AddField(... | 26.047619 | 139 | 0.650823 |
from __future__ import unicode_literals
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('reviews', '0008_auto_20180623_2009'),
]
operations = [
migrations.AddField(
model_name='movie',
name='poster_thumbnail',
... | true | true |
f7093def5323b66ffaaea55ff027d9e85613d2dd | 42,660 | py | Python | model/stage.py | Lee-Ft/RHA | 8a832a9afebc9204148bbd340c31e26c83138024 | [
"MIT"
] | 3 | 2021-04-23T11:53:13.000Z | 2022-02-11T12:29:34.000Z | model/stage.py | Lee-Ft/RHA | 8a832a9afebc9204148bbd340c31e26c83138024 | [
"MIT"
] | 2 | 2022-02-11T12:43:03.000Z | 2022-02-14T15:18:39.000Z | model/stage.py | Lee-Ft/RHA | 8a832a9afebc9204148bbd340c31e26c83138024 | [
"MIT"
] | null | null | null | import torch
import torch.nn as nn
import torch.nn.functional as F
import numpy as np
import pprint
from collections import defaultdict
from .context_query_attention import StructuredAttention
from .encoder import StackedEncoder
from .cnn import DepthwiseSeparableConv
from .model_utils import save_pickle, mask_logits, ... | 52.92804 | 121 | 0.560267 | import torch
import torch.nn as nn
import torch.nn.functional as F
import numpy as np
import pprint
from collections import defaultdict
from .context_query_attention import StructuredAttention
from .encoder import StackedEncoder
from .cnn import DepthwiseSeparableConv
from .model_utils import save_pickle, mask_logits, ... | true | true |
f7093e4a3f79f87ff0d626827bd64f15c5c476cf | 8,085 | py | Python | legacy/20210120/prun_table.py | artec-kk/Studth | 52cfa9c61355852163e1e4b42832480f51fda410 | [
"MIT"
] | 1 | 2020-12-24T08:17:52.000Z | 2020-12-24T08:17:52.000Z | legacy/20210120/prun_table.py | Nyanyan/Studth | d603f209d3125b3eafa875d47bd72c3607454391 | [
"MIT"
] | 1 | 2021-04-19T09:08:02.000Z | 2021-04-19T09:08:02.000Z | legacy/20210120/prun_table.py | artec-kk/Studth | 52cfa9c61355852163e1e4b42832480f51fda410 | [
"MIT"
] | 1 | 2021-03-11T09:26:49.000Z | 2021-03-11T09:26:49.000Z | from basic_functions import *
import csv
from collections import deque
inf = 1000
def table_phase0():
trans_ep = []
with open('trans_ep_phase0.csv', mode='r') as f:
for line in map(str.strip, f):
trans_ep.append([int(i) for i in line.replace('\n', '').split(',')])
trans = []
w... | 42.109375 | 85 | 0.557699 | from basic_functions import *
import csv
from collections import deque
inf = 1000
def table_phase0():
trans_ep = []
with open('trans_ep_phase0.csv', mode='r') as f:
for line in map(str.strip, f):
trans_ep.append([int(i) for i in line.replace('\n', '').split(',')])
trans = []
w... | true | true |
f7093e4ef346f30cf5169badac19ffab90a46d22 | 1,314 | py | Python | past_archive/swexpert/1979(whereToIn).py | DongHyunByun/algorithm_practice | c726c69d35306d23467f4af6e10f2db6fdc68234 | [
"MIT"
] | null | null | null | past_archive/swexpert/1979(whereToIn).py | DongHyunByun/algorithm_practice | c726c69d35306d23467f4af6e10f2db6fdc68234 | [
"MIT"
] | null | null | null | past_archive/swexpert/1979(whereToIn).py | DongHyunByun/algorithm_practice | c726c69d35306d23467f4af6e10f2db6fdc68234 | [
"MIT"
] | null | null | null | def numOfAbled(L,k):
hori=0
verti=0
for i in range(len(L)):
for j in range(len(L)-k+1):
num=0
for m in range(k):
if L[i][j+m]!=1:
break
else :
num+=1
if num==k:
if j==len(L)-k:... | 25.269231 | 51 | 0.314307 | def numOfAbled(L,k):
hori=0
verti=0
for i in range(len(L)):
for j in range(len(L)-k+1):
num=0
for m in range(k):
if L[i][j+m]!=1:
break
else :
num+=1
if num==k:
if j==len(L)-k:... | true | true |
f7093f4912a687d4e7ec0a6c86c92b455f7b055d | 274,474 | py | Python | rsl_comm_py/shearwater_registers.py | RedshiftLabsPtyLtd/rsl_comm_py | e53b4e85079898c894dac25842a08bcc303edfbb | [
"MIT"
] | null | null | null | rsl_comm_py/shearwater_registers.py | RedshiftLabsPtyLtd/rsl_comm_py | e53b4e85079898c894dac25842a08bcc303edfbb | [
"MIT"
] | null | null | null | rsl_comm_py/shearwater_registers.py | RedshiftLabsPtyLtd/rsl_comm_py | e53b4e85079898c894dac25842a08bcc303edfbb | [
"MIT"
] | null | null | null | #!/usr/bin/env python
# Author: Dr. Konstantin Selyunin
# License: MIT
# Created: 2020.08.19
import logging
import os.path
import struct
from abc import abstractmethod, ABC
from typing import Union, Tuple
from .rsl_xml_svd.rsl_svd_parser import RslSvdParser
class ShearWaterRegisters(ABC):
def __init__(self, ... | 40.66884 | 287 | 0.63888 |
import logging
import os.path
import struct
from abc import abstractmethod, ABC
from typing import Union, Tuple
from .rsl_xml_svd.rsl_svd_parser import RslSvdParser
class ShearWaterRegisters(ABC):
def __init__(self, **kwargs):
self.svd_parser = RslSvdParser(svd_file=ShearWaterRegisters.find_svd('... | true | true |
f7093fe62cd2fc34b1c1b4274b909f0daecbb510 | 418 | py | Python | day-3/binary_converter.py | MarkGhebrial/advent-of-code-2021 | eb38b152f41a61e4d92578fe1187636f22e82d6c | [
"MIT"
] | null | null | null | day-3/binary_converter.py | MarkGhebrial/advent-of-code-2021 | eb38b152f41a61e4d92578fe1187636f22e82d6c | [
"MIT"
] | null | null | null | day-3/binary_converter.py | MarkGhebrial/advent-of-code-2021 | eb38b152f41a61e4d92578fe1187636f22e82d6c | [
"MIT"
] | null | null | null | def binaryToInt (string: str, oneChar = "1", zeroChar = "0"):
out = 0
for i in range(len(string)):
currentDigit = None
if string[len(string) - 1 - i] == oneChar:
currentDigit = 1
elif string[len(string) - 1 - i] == zeroChar:
currentDigit = 0
out +... | 29.857143 | 61 | 0.538278 | def binaryToInt (string: str, oneChar = "1", zeroChar = "0"):
out = 0
for i in range(len(string)):
currentDigit = None
if string[len(string) - 1 - i] == oneChar:
currentDigit = 1
elif string[len(string) - 1 - i] == zeroChar:
currentDigit = 0
out +... | true | true |
f70940369734952cf51e11dce622dd3ae73eaef4 | 4,192 | py | Python | tests/test_poetry.py | radek-sprta/poetry | c57e1ddfd50da4e4ec60c3c27152811e07bdba2a | [
"MIT"
] | null | null | null | tests/test_poetry.py | radek-sprta/poetry | c57e1ddfd50da4e4ec60c3c27152811e07bdba2a | [
"MIT"
] | null | null | null | tests/test_poetry.py | radek-sprta/poetry | c57e1ddfd50da4e4ec60c3c27152811e07bdba2a | [
"MIT"
] | null | null | null | # -*- coding: utf-8 -*-
from __future__ import absolute_import
from __future__ import unicode_literals
from poetry.poetry import Poetry
from poetry.utils._compat import Path
from poetry.utils.toml_file import TomlFile
fixtures_dir = Path(__file__).parent / "fixtures"
def test_poetry():
poetry = Poetry.create(s... | 32.75 | 87 | 0.666508 |
from __future__ import absolute_import
from __future__ import unicode_literals
from poetry.poetry import Poetry
from poetry.utils._compat import Path
from poetry.utils.toml_file import TomlFile
fixtures_dir = Path(__file__).parent / "fixtures"
def test_poetry():
poetry = Poetry.create(str(fixtures_dir / "samp... | true | true |
f7094221dcff97c2f472e146693d17b871a4455a | 5,032 | py | Python | SLpackage/private/pacbio/pythonpkgs/pbreports/lib/python2.7/site-packages/pbreports/report/barcode_ccs.py | fanglab/6mASCOPE | 3f1fdcb7693ff152f17623ce549526ec272698b1 | [
"BSD-3-Clause"
] | 5 | 2022-02-20T07:10:02.000Z | 2022-03-18T17:47:53.000Z | SLpackage/private/pacbio/pythonpkgs/pbreports/lib/python2.7/site-packages/pbreports/report/barcode_ccs.py | fanglab/6mASCOPE | 3f1fdcb7693ff152f17623ce549526ec272698b1 | [
"BSD-3-Clause"
] | null | null | null | SLpackage/private/pacbio/pythonpkgs/pbreports/lib/python2.7/site-packages/pbreports/report/barcode_ccs.py | fanglab/6mASCOPE | 3f1fdcb7693ff152f17623ce549526ec272698b1 | [
"BSD-3-Clause"
] | null | null | null | #! python
"""
Modified version of barcode report for use on CCS inputs
"""
from pprint import pformat
import functools
import logging
import json
import os.path as op
import sys
from pbcommand.models import DataStore, FileTypes
from pbcommand.models.report import PlotGroup
from pbcommand.cli import pbparser_runner
f... | 34 | 101 | 0.67031 |
from pprint import pformat
import functools
import logging
import json
import os.path as op
import sys
from pbcommand.models import DataStore, FileTypes
from pbcommand.models.report import PlotGroup
from pbcommand.cli import pbparser_runner
from pbcommand.utils import setup_log
from pbcore.io import ConsensusReadSe... | true | true |
f7094232e1c00bad93777f3c61dca4a3fa60846e | 3,130 | py | Python | custom-recipes/amazon-comprehend-nlp-language-detection/recipe.py | dataiku/dss-plugin-amazon-comprehend | 95ce7bc560209f849a55849f8846bd6dbc0ec6f5 | [
"Apache-2.0"
] | 2 | 2020-05-15T16:29:47.000Z | 2021-12-10T18:47:31.000Z | custom-recipes/amazon-comprehend-nlp-language-detection/recipe.py | dataiku/dss-plugin-amazon-comprehend-nlp | 95ce7bc560209f849a55849f8846bd6dbc0ec6f5 | [
"Apache-2.0"
] | 3 | 2020-04-23T18:39:51.000Z | 2020-10-14T16:45:05.000Z | custom-recipes/amazon-comprehend-nlp-language-detection/recipe.py | dataiku/dss-plugin-amazon-comprehend | 95ce7bc560209f849a55849f8846bd6dbc0ec6f5 | [
"Apache-2.0"
] | null | null | null | # -*- coding: utf-8 -*-
from typing import List, Dict, AnyStr
from retry import retry
from ratelimit import limits, RateLimitException
import dataiku
from dataiku.customrecipe import get_recipe_config, get_input_names_for_role, get_output_names_for_role
from plugin_io_utils import ErrorHandlingEnum, validate_column_... | 37.710843 | 103 | 0.741853 |
from typing import List, Dict, AnyStr
from retry import retry
from ratelimit import limits, RateLimitException
import dataiku
from dataiku.customrecipe import get_recipe_config, get_input_names_for_role, get_output_names_for_role
from plugin_io_utils import ErrorHandlingEnum, validate_column_input
from dku_io_utils... | true | true |
f709424b1033001a56abcfb6869bc07c967d7d91 | 720 | py | Python | src/examples_in_my_book/general_problems/strings/find_edit_distance.py | lucidrohit/Over-100-Exercises-Python-and-Algorithms | 62345c7d7c9cc2269f240d134189645fc96c3e80 | [
"MIT"
] | 2 | 2022-01-07T11:46:32.000Z | 2022-02-24T08:44:31.000Z | src/examples_in_my_book/general_problems/strings/find_edit_distance.py | lucidrohit/Over-100-Exercises-Python-and-Algorithms | 62345c7d7c9cc2269f240d134189645fc96c3e80 | [
"MIT"
] | null | null | null | src/examples_in_my_book/general_problems/strings/find_edit_distance.py | lucidrohit/Over-100-Exercises-Python-and-Algorithms | 62345c7d7c9cc2269f240d134189645fc96c3e80 | [
"MIT"
] | 1 | 2021-10-01T15:35:05.000Z | 2021-10-01T15:35:05.000Z | #!/usr/bin/python3
# mari von steinkirch @2013
# steinkirch at gmail
def find_edit_distance(str1, str2):
''' computes the edit distance between two strings '''
m = len(str1)
n = len(str2)
diff = lambda c1, c2: 0 if c1 == c2 else 1
E = [[0] * (n + 1) for i in range(m + 1)]
for i in range(m + 1):
E[i][0] = i
f... | 20.571429 | 88 | 0.575 |
def find_edit_distance(str1, str2):
m = len(str1)
n = len(str2)
diff = lambda c1, c2: 0 if c1 == c2 else 1
E = [[0] * (n + 1) for i in range(m + 1)]
for i in range(m + 1):
E[i][0] = i
for j in range(1, n + 1):
E[0][j] = j
for i in range(1, m + 1):
for j in range(1, n + 1):
E[i][j] = min(E[i-1][j] +... | true | true |
f70942b36a139c80f233905649b19f8e01e0b8a4 | 7,712 | py | Python | cats_and_dogs_classification.py | janewen134/catsdogs | 051dc0d4bf695ca2db03df6fc3cf758331df4aaa | [
"MIT"
] | null | null | null | cats_and_dogs_classification.py | janewen134/catsdogs | 051dc0d4bf695ca2db03df6fc3cf758331df4aaa | [
"MIT"
] | null | null | null | cats_and_dogs_classification.py | janewen134/catsdogs | 051dc0d4bf695ca2db03df6fc3cf758331df4aaa | [
"MIT"
] | null | null | null | #!/usr/bin/env python
# coding: utf-8
# # Cats and Dogs Classification
# Data Loading and Exploring
# In[1]:
import os
base_dir = './cats_and_dogs_filtered'
train_dir = os.path.join(base_dir, 'train')
validation_dir = os.path.join(base_dir, 'validation')
# cat training pictures
train_cats_dir = os.path.join(train... | 27.741007 | 206 | 0.741701 |
/cats_and_dogs_filtered'
train_dir = os.path.join(base_dir, 'train')
validation_dir = os.path.join(base_dir, 'validation')
train_cats_dir = os.path.join(train_dir, 'cats')
train_dogs_dir = os.path.join(train_dir, 'dogs')
validation_cats_dir = os.path.join(validation_dir, 'cats')
validation_dogs_dir = os.path... | true | true |
f709437e54330c11d20bceb3045c97b073567f65 | 4,211 | py | Python | data_preparation/rebuild_limited_train/utils.py | dweekly/libri-light | 2a181b2482e0e3a539bf4d8b387b1838fdbfacac | [
"MIT"
] | 246 | 2019-12-19T21:40:48.000Z | 2022-03-30T12:40:22.000Z | data_preparation/rebuild_limited_train/utils.py | dweekly/libri-light | 2a181b2482e0e3a539bf4d8b387b1838fdbfacac | [
"MIT"
] | 11 | 2020-01-17T14:45:05.000Z | 2021-09-20T21:53:27.000Z | data_preparation/rebuild_limited_train/utils.py | dweekly/libri-light | 2a181b2482e0e3a539bf4d8b387b1838fdbfacac | [
"MIT"
] | 48 | 2019-12-20T16:34:12.000Z | 2022-03-26T13:14:35.000Z | # Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved
import pathlib
from collections import namedtuple
import torchaudio
import shutil
Speaker = namedtuple('Speaker', ['id', 'gender', 'subset'])
FileRecord = namedtuple(
'FileRecord', ['fname', 'length', 'speaker', 'book', 'text_file'])
def get... | 30.078571 | 96 | 0.632391 |
import pathlib
from collections import namedtuple
import torchaudio
import shutil
Speaker = namedtuple('Speaker', ['id', 'gender', 'subset'])
FileRecord = namedtuple(
'FileRecord', ['fname', 'length', 'speaker', 'book', 'text_file'])
def get_speakers(speaker_path):
all_speakers = []
with open(speaker_p... | true | true |
f70943c6ac3aca9a74aba66e5048de86b69d40c3 | 201 | py | Python | code/global_vars.py | btaille/sincere | dd1c34916ddcdc5ceb2799d64b17e80cdf1a5b31 | [
"Apache-2.0"
] | 12 | 2020-10-22T13:04:36.000Z | 2021-12-30T10:34:28.000Z | code/global_vars.py | btaille/sincere | dd1c34916ddcdc5ceb2799d64b17e80cdf1a5b31 | [
"Apache-2.0"
] | null | null | null | code/global_vars.py | btaille/sincere | dd1c34916ddcdc5ceb2799d64b17e80cdf1a5b31 | [
"Apache-2.0"
] | 2 | 2020-11-27T12:23:22.000Z | 2021-11-16T09:17:06.000Z | import os
PROJECT_DIR = os.path.abspath(os.pardir)
RUN_DIR = os.path.join(PROJECT_DIR, "runs/")
DATA_DIR = os.path.join(PROJECT_DIR, "data/")
EMBEDDINGS_DIR = os.path.join(PROJECT_DIR, "embeddings/")
| 28.714286 | 57 | 0.746269 | import os
PROJECT_DIR = os.path.abspath(os.pardir)
RUN_DIR = os.path.join(PROJECT_DIR, "runs/")
DATA_DIR = os.path.join(PROJECT_DIR, "data/")
EMBEDDINGS_DIR = os.path.join(PROJECT_DIR, "embeddings/")
| true | true |
f70943e4a0c52d5d4276cd23f2fe2071c7a54270 | 1,185 | py | Python | 05-1class-func/tagger.py | banjin/FluentPython-example | 268866ef52da4109072088778953d7ed47132001 | [
"MIT"
] | 5,651 | 2015-01-06T21:58:46.000Z | 2022-03-31T13:39:07.000Z | 05-1class-func/tagger.py | banjin/FluentPython-example | 268866ef52da4109072088778953d7ed47132001 | [
"MIT"
] | 42 | 2016-12-11T19:17:11.000Z | 2021-11-23T19:41:16.000Z | 05-1class-func/tagger.py | banjin/FluentPython-example | 268866ef52da4109072088778953d7ed47132001 | [
"MIT"
] | 2,394 | 2015-01-18T10:57:38.000Z | 2022-03-31T11:41:12.000Z |
"""
# BEGIN TAG_DEMO
>>> tag('br') # <1>
'<br />'
>>> tag('p', 'hello') # <2>
'<p>hello</p>'
>>> print(tag('p', 'hello', 'world'))
<p>hello</p>
<p>world</p>
>>> tag('p', 'hello', id=33) # <3>
'<p id="33">hello</p>'
>>> print(tag('p', 'hello', 'world', cls='sidebar')) # <4>
<p class="sidebar">hello</p>
<p class="s... | 26.333333 | 68 | 0.491139 |
def tag(name, *content, cls=None, **attrs):
if cls is not None:
attrs['class'] = cls
if attrs:
attr_str = ''.join(' %s="%s"' % (attr, value)
for attr, value
in sorted(attrs.items()))
else:
attr_str = ''
if content:
... | true | true |
f7094645f95735c801cc8b9f916dc205d0f15abb | 470 | py | Python | dp/longestPalindromicSubsequence/Solution.py | shahbagdadi/py-algo-n-ds | ff689534b771ddb4869b001b20a0e21b4896bb0a | [
"MIT"
] | null | null | null | dp/longestPalindromicSubsequence/Solution.py | shahbagdadi/py-algo-n-ds | ff689534b771ddb4869b001b20a0e21b4896bb0a | [
"MIT"
] | null | null | null | dp/longestPalindromicSubsequence/Solution.py | shahbagdadi/py-algo-n-ds | ff689534b771ddb4869b001b20a0e21b4896bb0a | [
"MIT"
] | null | null | null | from functools import lru_cache
class Solution:
def longestPalindromeSubseq(self, s: str) -> int:
@lru_cache(None)
def helper(b,e):
print(b,e)
if b > e : return 0
if b == e : return 1
if s[b] == s[e] :
return helper(b+1,e-1) + 2
... | 26.111111 | 53 | 0.52766 | from functools import lru_cache
class Solution:
def longestPalindromeSubseq(self, s: str) -> int:
@lru_cache(None)
def helper(b,e):
print(b,e)
if b > e : return 0
if b == e : return 1
if s[b] == s[e] :
return helper(b+1,e-1) + 2
... | true | true |
f70946ff7a42e2971d93f7c6e7bd44b2b8487ee5 | 3,501 | py | Python | run_with_submitit.py | haozy008/detr_transformer | f2cca52a1ea97a31c9497451714373bb691589e9 | [
"Apache-2.0"
] | 22 | 2020-09-20T15:08:57.000Z | 2022-03-27T14:06:09.000Z | run_with_submitit.py | haozy008/detr_transformer | f2cca52a1ea97a31c9497451714373bb691589e9 | [
"Apache-2.0"
] | 4 | 2020-12-16T15:52:13.000Z | 2021-08-14T02:40:07.000Z | run_with_submitit.py | haozy008/detr_transformer | f2cca52a1ea97a31c9497451714373bb691589e9 | [
"Apache-2.0"
] | 7 | 2020-08-24T03:12:55.000Z | 2022-03-27T14:06:34.000Z | # Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved
"""
A script to run multinode training with submitit.
"""
import argparse
import os
import uuid
from pathlib import Path
import main as detection
import submitit
def parse_args():
detection_parser = detection.get_args_parser()
parser = ar... | 31.258929 | 102 | 0.677235 |
import argparse
import os
import uuid
from pathlib import Path
import main as detection
import submitit
def parse_args():
detection_parser = detection.get_args_parser()
parser = argparse.ArgumentParser("Submitit for detection", parents=[detection_parser])
parser.add_argument("--ngpus", default=8, type=i... | true | true |
f70948eb04aae6c332dfeb082bf8b190c4d271e1 | 11,461 | py | Python | homeassistant/components/zha/entity.py | mib1185/core | b17d4ac65cde9a27ff6032d70b148792e5eba8df | [
"Apache-2.0"
] | null | null | null | homeassistant/components/zha/entity.py | mib1185/core | b17d4ac65cde9a27ff6032d70b148792e5eba8df | [
"Apache-2.0"
] | null | null | null | homeassistant/components/zha/entity.py | mib1185/core | b17d4ac65cde9a27ff6032d70b148792e5eba8df | [
"Apache-2.0"
] | null | null | null | """Entity for Zigbee Home Automation."""
from __future__ import annotations
import asyncio
from collections.abc import Callable
import functools
import logging
from typing import TYPE_CHECKING, Any
from homeassistant.const import ATTR_NAME
from homeassistant.core import CALLBACK_TYPE, Event, callback
from homeassista... | 33.609971 | 88 | 0.639997 | from __future__ import annotations
import asyncio
from collections.abc import Callable
import functools
import logging
from typing import TYPE_CHECKING, Any
from homeassistant.const import ATTR_NAME
from homeassistant.core import CALLBACK_TYPE, Event, callback
from homeassistant.helpers import entity
from homeassista... | true | true |
f70949c899c61f3c27374377db66bdcead46f9ca | 1,408 | py | Python | exmail/client/api/department.py | ni-ning/exmail-sdk | 8ffefd70c46c4df755e0ab25559aeb0bb4e9b194 | [
"MIT"
] | 5 | 2019-11-14T03:23:06.000Z | 2021-12-23T02:24:15.000Z | exmail/client/api/department.py | ni-ning/exmail-sdk | 8ffefd70c46c4df755e0ab25559aeb0bb4e9b194 | [
"MIT"
] | null | null | null | exmail/client/api/department.py | ni-ning/exmail-sdk | 8ffefd70c46c4df755e0ab25559aeb0bb4e9b194 | [
"MIT"
] | 1 | 2021-01-11T08:33:00.000Z | 2021-01-11T08:33:00.000Z | # -*- coding:utf-8 -*-
from __future__ import absolute_import, unicode_literals
from exmail.client.api.base import EmailBaseAPI
class Department(EmailBaseAPI):
def create(self, department_data):
'''
创建部门
:param department_data: 创建部门所需数据
:return:
'''
return self._... | 20.405797 | 56 | 0.497159 |
from __future__ import absolute_import, unicode_literals
from exmail.client.api.base import EmailBaseAPI
class Department(EmailBaseAPI):
def create(self, department_data):
return self._post(
'/department/create',
data=department_data
)
def update(self, department_da... | true | true |
f7094a287be0868ea1021a5b882a2a214996f97e | 41,174 | py | Python | src/transformers/modeling_albert.py | dom-s/transformers | 66ef8faf6ae805aeb4e71075d4da6eab7be3bc26 | [
"Apache-2.0"
] | 1 | 2020-03-06T02:41:33.000Z | 2020-03-06T02:41:33.000Z | src/transformers/modeling_albert.py | BlueSkyBubble/transformers | 83446a88d902661fab12bf8c37a1aa2845cdca5f | [
"Apache-2.0"
] | null | null | null | src/transformers/modeling_albert.py | BlueSkyBubble/transformers | 83446a88d902661fab12bf8c37a1aa2845cdca5f | [
"Apache-2.0"
] | null | null | null | # coding=utf-8
# Copyright 2018 Google AI, Google Brain and the HuggingFace Inc. 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
#
# U... | 46.107503 | 148 | 0.670253 |
import logging
import math
import os
import torch
import torch.nn as nn
from torch.nn import CrossEntropyLoss, MSELoss
from transformers.configuration_albert import AlbertConfig
from transformers.modeling_bert import ACT2FN, BertEmbeddings, BertSelfAttention, prune_linear_layer
from transformers.modeli... | true | true |
f7094bfea756491c4f21b1c24a374dfa1e15b117 | 1,134 | py | Python | logreader.py | trim-uec/notify | c763d87d8654ce46366e9d5bf4d30191fc0db5bf | [
"MIT"
] | null | null | null | logreader.py | trim-uec/notify | c763d87d8654ce46366e9d5bf4d30191fc0db5bf | [
"MIT"
] | null | null | null | logreader.py | trim-uec/notify | c763d87d8654ce46366e9d5bf4d30191fc0db5bf | [
"MIT"
] | null | null | null | import datetime as dt
import os
# ログファイル差分チェッカー
# ファイル名を受け取り、update()実行ごとに差分を返す
# 更新実行時の時間をもつ
# 更新にかかった総所要時間の計測はせず、上のレイヤーに任せる
# 監視対象のファイルは行を追加する形で情報が増えていくものとする
class LogReader:
# filename, last_update, tail_ix
def __init__(self, filename):
self.filename = filename
self.last_update = dt.datet... | 31.5 | 71 | 0.65873 | import datetime as dt
import os
class LogReader:
def __init__(self, filename):
self.filename = filename
self.last_update = dt.datetime.now()
assert os.path.isfile(filename), '存在しないファイルを指定しました'
with open(self.filename, 'r') as f:
lines = f.readlines()
... | true | true |
f7094c34c8b66e96e77d0858e274b7b1eede1bf8 | 594 | py | Python | demo/blog/migrations/0002_auto_20160420_2154.py | andrewebdev/django-ostinato | 2c435dea23319be6e9011e7381afca2b4092b5a2 | [
"MIT"
] | 5 | 2015-01-28T09:56:48.000Z | 2020-05-22T21:07:30.000Z | demo/blog/migrations/0002_auto_20160420_2154.py | andrewebdev/django-ostinato | 2c435dea23319be6e9011e7381afca2b4092b5a2 | [
"MIT"
] | 18 | 2015-02-03T15:37:22.000Z | 2020-06-05T16:41:15.000Z | demo/blog/migrations/0002_auto_20160420_2154.py | andrewebdev/django-ostinato | 2c435dea23319be6e9011e7381afca2b4092b5a2 | [
"MIT"
] | 2 | 2015-02-23T19:34:59.000Z | 2017-01-22T02:10:12.000Z | # -*- coding: utf-8 -*-
# Generated by Django 1.9.4 on 2016-04-20 21:54
from __future__ import unicode_literals
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('blog', '0001_initial'),
]
operations = [
migrations.AlterField(
... | 28.285714 | 210 | 0.619529 |
from __future__ import unicode_literals
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('blog', '0001_initial'),
]
operations = [
migrations.AlterField(
model_name='entry',
name='state',
field=models... | true | true |
f7094d7d2b07f9b1f3da84df7d2308db1dff55eb | 1,474 | py | Python | benchmark/experimental_vectors.py | guyang3532/text | e2fc987ff6a002018040cffac5e0d61c3d0b06c6 | [
"BSD-3-Clause"
] | null | null | null | benchmark/experimental_vectors.py | guyang3532/text | e2fc987ff6a002018040cffac5e0d61c3d0b06c6 | [
"BSD-3-Clause"
] | null | null | null | benchmark/experimental_vectors.py | guyang3532/text | e2fc987ff6a002018040cffac5e0d61c3d0b06c6 | [
"BSD-3-Clause"
] | null | null | null | import time
import torch
from torchtext.experimental.datasets import AG_NEWS
from torchtext.experimental.vectors import FastText as FastTextExperimental
from torchtext.vocab import FastText
def benchmark_experimental_vectors():
def _run_benchmark_lookup(tokens, vector):
t0 = time.monotonic()
for ... | 30.708333 | 75 | 0.713026 | import time
import torch
from torchtext.experimental.datasets import AG_NEWS
from torchtext.experimental.vectors import FastText as FastTextExperimental
from torchtext.vocab import FastText
def benchmark_experimental_vectors():
def _run_benchmark_lookup(tokens, vector):
t0 = time.monotonic()
for ... | true | true |
f7094f7293ea2a022771f9ba3ca7252c82e92c07 | 6,012 | py | Python | tacker/db/migration/cli.py | mail2nsrajesh/tacker | dce6690659836c2885f1cf8227c19be234f8fe25 | [
"Apache-2.0"
] | 1 | 2020-10-13T05:20:38.000Z | 2020-10-13T05:20:38.000Z | tacker/db/migration/cli.py | mail2nsrajesh/tacker | dce6690659836c2885f1cf8227c19be234f8fe25 | [
"Apache-2.0"
] | null | null | null | tacker/db/migration/cli.py | mail2nsrajesh/tacker | dce6690659836c2885f1cf8227c19be234f8fe25 | [
"Apache-2.0"
] | null | null | null | # Copyright 2012 New Dream Network, LLC (DreamHost)
#
# 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 a... | 33.775281 | 79 | 0.66018 |
import os
from alembic import command as alembic_command
from alembic import config as alembic_config
from alembic import script as alembic_script
from alembic import util as alembic_util
from oslo_config import cfg
from tacker.db.migration.models import head
from tacker.db.migration import purge_tabl... | true | true |
f7095169f139557a45e67599ce006c31ba8e3471 | 157 | py | Python | python/pip_package/__init__.py | kanishkg/lab | a9a3b5c38ad160ffd2e77a3af3e13c6e66eed457 | [
"CC-BY-4.0"
] | 16 | 2019-02-27T22:37:25.000Z | 2021-11-08T12:39:33.000Z | python/pip_package/__init__.py | kanishkg/lab | a9a3b5c38ad160ffd2e77a3af3e13c6e66eed457 | [
"CC-BY-4.0"
] | null | null | null | python/pip_package/__init__.py | kanishkg/lab | a9a3b5c38ad160ffd2e77a3af3e13c6e66eed457 | [
"CC-BY-4.0"
] | 7 | 2019-05-28T06:26:26.000Z | 2021-11-27T16:33:55.000Z | """Loads deepmind_lab.so."""
import imp
import pkg_resources
imp.load_dynamic(__name__, pkg_resources.resource_filename(
__name__, 'deepmind_lab.so'))
| 19.625 | 59 | 0.77707 |
import imp
import pkg_resources
imp.load_dynamic(__name__, pkg_resources.resource_filename(
__name__, 'deepmind_lab.so'))
| true | true |
f70951dfc2d5ffb763356ce62e348b225daba092 | 468 | py | Python | sigmapiweb/apps/PartyListV2/migrations/0003_partyguest_hasprepartyaccess.py | Jacobvs/sigmapi-web | ca8d5a5294385fe5f4634c483a1278df904e2f85 | [
"MIT"
] | null | null | null | sigmapiweb/apps/PartyListV2/migrations/0003_partyguest_hasprepartyaccess.py | Jacobvs/sigmapi-web | ca8d5a5294385fe5f4634c483a1278df904e2f85 | [
"MIT"
] | null | null | null | sigmapiweb/apps/PartyListV2/migrations/0003_partyguest_hasprepartyaccess.py | Jacobvs/sigmapi-web | ca8d5a5294385fe5f4634c483a1278df904e2f85 | [
"MIT"
] | null | null | null | # -*- coding: utf-8 -*-
# Generated by Django 1.11.4 on 2018-05-05 02:05
from __future__ import unicode_literals
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
("PartyListV2", "0002_restrictedguest"),
]
operations = [
migrations.AddField... | 22.285714 | 53 | 0.630342 |
from __future__ import unicode_literals
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
("PartyListV2", "0002_restrictedguest"),
]
operations = [
migrations.AddField(
model_name="partyguest",
name="hasPrepartyAcc... | true | true |
f70953a63bbc0820445c238e63d7232ef154338a | 3,503 | py | Python | python/phonenumbers/data/region_HR.py | Eyepea/python-phonenumbers | 0336e191fda80a21ed5c19d5e029ad8c70f620ee | [
"Apache-2.0"
] | 2 | 2019-03-30T02:12:54.000Z | 2021-03-08T18:59:40.000Z | python/phonenumbers/data/region_HR.py | Eyepea/python-phonenumbers | 0336e191fda80a21ed5c19d5e029ad8c70f620ee | [
"Apache-2.0"
] | null | null | null | python/phonenumbers/data/region_HR.py | Eyepea/python-phonenumbers | 0336e191fda80a21ed5c19d5e029ad8c70f620ee | [
"Apache-2.0"
] | 1 | 2018-11-10T03:47:34.000Z | 2018-11-10T03:47:34.000Z | """Auto-generated file, do not edit by hand. HR metadata"""
from ..phonemetadata import NumberFormat, PhoneNumberDesc, PhoneMetadata
PHONE_METADATA_HR = PhoneMetadata(id='HR', country_code=385, international_prefix='00',
general_desc=PhoneNumberDesc(national_number_pattern='[1-7]\\d{5,8}|[89]\\d{6,11}', possible_n... | 113 | 171 | 0.68684 | from ..phonemetadata import NumberFormat, PhoneNumberDesc, PhoneMetadata
PHONE_METADATA_HR = PhoneMetadata(id='HR', country_code=385, international_prefix='00',
general_desc=PhoneNumberDesc(national_number_pattern='[1-7]\\d{5,8}|[89]\\d{6,11}', possible_number_pattern='\\d{6,12}'),
fixed_line=PhoneNumberDesc(n... | true | true |
f7095508ece920b6fcd73d161319d0dad95e7721 | 3,451 | py | Python | misago/misago/legal/admin/views.py | vascoalramos/misago-deployment | 20226072138403108046c0afad9d99eb4163cedc | [
"MIT"
] | 2 | 2021-03-06T21:06:13.000Z | 2021-03-09T15:05:12.000Z | misago/misago/legal/admin/views.py | vascoalramos/misago-deployment | 20226072138403108046c0afad9d99eb4163cedc | [
"MIT"
] | null | null | null | misago/misago/legal/admin/views.py | vascoalramos/misago-deployment | 20226072138403108046c0afad9d99eb4163cedc | [
"MIT"
] | null | null | null | from django.contrib import messages
from django.utils import timezone
from django.utils.translation import gettext_lazy as _
from ...admin.views import generic
from ..models import Agreement
from .forms import AgreementForm, FilterAgreementsForm
from .utils import disable_agreement, set_agreement_as_active
class Agr... | 33.833333 | 88 | 0.676615 | from django.contrib import messages
from django.utils import timezone
from django.utils.translation import gettext_lazy as _
from ...admin.views import generic
from ..models import Agreement
from .forms import AgreementForm, FilterAgreementsForm
from .utils import disable_agreement, set_agreement_as_active
class Agr... | true | true |
f70955228f7c65d8e4a1e24999a745383cb9b48b | 397 | py | Python | apiwrapper/wsgi.py | drinkingjava/coingeckoapiwrapper | e95fcc3a80504f60aada4875f896ed5195ab351d | [
"MIT"
] | null | null | null | apiwrapper/wsgi.py | drinkingjava/coingeckoapiwrapper | e95fcc3a80504f60aada4875f896ed5195ab351d | [
"MIT"
] | null | null | null | apiwrapper/wsgi.py | drinkingjava/coingeckoapiwrapper | e95fcc3a80504f60aada4875f896ed5195ab351d | [
"MIT"
] | null | null | null | """
WSGI config for apiwrapper project.
It exposes the WSGI callable as a module-level variable named ``application``.
For more information on this file, see
https://docs.djangoproject.com/en/3.1/howto/deployment/wsgi/
"""
import os
from django.core.wsgi import get_wsgi_application
os.environ.setdefault('DJANGO_SE... | 23.352941 | 78 | 0.788413 |
import os
from django.core.wsgi import get_wsgi_application
os.environ.setdefault('DJANGO_SETTINGS_MODULE', 'apiwrapper.settings')
application = get_wsgi_application()
| true | true |
f709555143c36af3622b8322e5e065810a378a8a | 132 | py | Python | profiles_api/urls.py | karthiksar15/UdemyPython1 | d8b96935629f22df76c41ff6cd7a91b3c99b2b19 | [
"MIT"
] | null | null | null | profiles_api/urls.py | karthiksar15/UdemyPython1 | d8b96935629f22df76c41ff6cd7a91b3c99b2b19 | [
"MIT"
] | null | null | null | profiles_api/urls.py | karthiksar15/UdemyPython1 | d8b96935629f22df76c41ff6cd7a91b3c99b2b19 | [
"MIT"
] | null | null | null | from django.urls import path
from profiles_api import views
urlpatterns =[
path('hello-view/',views.HelloApiView.as_view())
]
| 16.5 | 52 | 0.75 | from django.urls import path
from profiles_api import views
urlpatterns =[
path('hello-view/',views.HelloApiView.as_view())
]
| true | true |
f709560f12383812ac7749a0819306cdeb93570b | 2,529 | py | Python | sdks/python/apache_beam/io/external/generate_sequence.py | eyal0/beam | 9c6922976cc2a5c6a2ef836c1986ff769cda99a5 | [
"Apache-2.0"
] | 35 | 2016-09-22T22:53:14.000Z | 2020-02-13T15:12:21.000Z | sdks/python/apache_beam/io/external/generate_sequence.py | eyal0/beam | 9c6922976cc2a5c6a2ef836c1986ff769cda99a5 | [
"Apache-2.0"
] | 80 | 2020-01-16T09:55:09.000Z | 2020-10-03T13:43:07.000Z | sdks/python/apache_beam/io/external/generate_sequence.py | eyal0/beam | 9c6922976cc2a5c6a2ef836c1986ff769cda99a5 | [
"Apache-2.0"
] | 88 | 2016-11-27T02:16:11.000Z | 2020-02-28T05:10:26.000Z | #
# Licensed to the Apache Software Foundation (ASF) under one or more
# contributor license agreements. See the NOTICE file distributed with
# this work for additional information regarding copyright ownership.
# The ASF licenses this file to You under the Apache License, Version 2.0
# (the "License"); you may not us... | 37.191176 | 78 | 0.740214 |
from __future__ import absolute_import
from apache_beam.transforms.external import ExternalTransform
from apache_beam.transforms.external import ImplicitSchemaPayloadBuilder
class GenerateSequence(ExternalTransform):
URN = 'beam:external:java:generate_sequence:v1'
def __init__(
self,
... | true | true |
f709562b3b66244cdea52b42ea35831e94e2b9a0 | 7,079 | py | Python | aiml50/source/setup_pipeline.py | nswitanek/ignite-learning-paths-training-aiml | 018968f413f6c1aa11230c802f785fdaea54e480 | [
"CC-BY-4.0",
"MIT"
] | 203 | 2019-10-07T10:44:09.000Z | 2021-11-08T09:21:17.000Z | aiml50/source/setup_pipeline.py | nswitanek/ignite-learning-paths-training-aiml | 018968f413f6c1aa11230c802f785fdaea54e480 | [
"CC-BY-4.0",
"MIT"
] | 53 | 2019-10-08T15:15:04.000Z | 2020-11-23T16:29:39.000Z | aiml50/source/setup_pipeline.py | nswitanek/ignite-learning-paths-training-aiml | 018968f413f6c1aa11230c802f785fdaea54e480 | [
"CC-BY-4.0",
"MIT"
] | 210 | 2019-10-04T14:41:49.000Z | 2021-11-04T23:05:22.000Z | import azureml
from azureml.core import VERSION
from azureml.core import Workspace, Experiment, Datastore, Environment
from azureml.core.runconfig import RunConfiguration
from azureml.data.datapath import DataPath, DataPathComputeBinding
from azureml.data.data_reference import DataReference
from azureml.core.compute im... | 32.925581 | 115 | 0.647973 | import azureml
from azureml.core import VERSION
from azureml.core import Workspace, Experiment, Datastore, Environment
from azureml.core.runconfig import RunConfiguration
from azureml.data.datapath import DataPath, DataPathComputeBinding
from azureml.data.data_reference import DataReference
from azureml.core.compute im... | true | true |
f709570944e58ff82295df04816197313a44f4f1 | 1,286 | py | Python | cnns/nnlib/robustness/pni/code/models/nomarlization_layer.py | anonymous-user-commits/perturb-net | 66fc7c4a1234fa34b92bcc85751f0a6e23d80a23 | [
"MIT"
] | 1 | 2018-03-25T13:19:46.000Z | 2018-03-25T13:19:46.000Z | cnns/nnlib/robustness/pni/code/models/nomarlization_layer.py | anonymous-user-commits/perturb-net | 66fc7c4a1234fa34b92bcc85751f0a6e23d80a23 | [
"MIT"
] | null | null | null | cnns/nnlib/robustness/pni/code/models/nomarlization_layer.py | anonymous-user-commits/perturb-net | 66fc7c4a1234fa34b92bcc85751f0a6e23d80a23 | [
"MIT"
] | null | null | null | import torch
import torch.nn as nn
class Normalize_layer(nn.Module):
def __init__(self, mean, std):
super(Normalize_layer, self).__init__()
self.mean = nn.Parameter(torch.Tensor(mean).unsqueeze(1).unsqueeze(1),
requires_grad=False)
self.std = nn.Parameter(... | 33.842105 | 78 | 0.618196 | import torch
import torch.nn as nn
class Normalize_layer(nn.Module):
def __init__(self, mean, std):
super(Normalize_layer, self).__init__()
self.mean = nn.Parameter(torch.Tensor(mean).unsqueeze(1).unsqueeze(1),
requires_grad=False)
self.std = nn.Parameter(... | true | true |
f709582419a8e95e38133c411de04161dcccc9b3 | 19,859 | py | Python | modeling/backbones/resnet.py | yihui-he2020/epipolar-transformers | 6824f4345b2998500fbacd0f4e30f67f8e3da7b8 | [
"MIT"
] | 360 | 2020-03-30T07:15:45.000Z | 2022-03-04T14:08:04.000Z | modeling/backbones/resnet.py | yihui-he2020/epipolar-transformers | 6824f4345b2998500fbacd0f4e30f67f8e3da7b8 | [
"MIT"
] | 30 | 2020-05-12T11:12:20.000Z | 2021-12-31T05:49:10.000Z | modeling/backbones/resnet.py | yihui-he2020/epipolar-transformers | 6824f4345b2998500fbacd0f4e30f67f8e3da7b8 | [
"MIT"
] | 38 | 2020-05-12T05:33:46.000Z | 2022-01-25T22:27:45.000Z | import logging
import os
import torch
import torch.nn as nn
import torch.utils.model_zoo as model_zoo
from modeling.layers.epipolar import Epipolar
from modeling import registry
from core import cfg
from .basic_batch import find_tensor_peak_batch
from utils.logger import setup_logger
from utils.model_serialization imp... | 38.190385 | 199 | 0.599376 | import logging
import os
import torch
import torch.nn as nn
import torch.utils.model_zoo as model_zoo
from modeling.layers.epipolar import Epipolar
from modeling import registry
from core import cfg
from .basic_batch import find_tensor_peak_batch
from utils.logger import setup_logger
from utils.model_serialization imp... | true | true |
f7095a4b8f156351c6d348572d6e6f9a2c1cc9f1 | 1,173 | py | Python | st2client/st2client/models/keyvalue.py | kkkanil/st2 | 07cd195d7a6e177a37dd019e5c9ab8329259d0fa | [
"Apache-2.0"
] | null | null | null | st2client/st2client/models/keyvalue.py | kkkanil/st2 | 07cd195d7a6e177a37dd019e5c9ab8329259d0fa | [
"Apache-2.0"
] | 15 | 2021-02-11T22:58:54.000Z | 2021-08-06T18:03:47.000Z | st2client/st2client/models/keyvalue.py | kkkanil/st2 | 07cd195d7a6e177a37dd019e5c9ab8329259d0fa | [
"Apache-2.0"
] | 1 | 2021-07-10T15:02:29.000Z | 2021-07-10T15:02:29.000Z | # Copyright 2020 The StackStorm Authors.
# Copyright 2019 Extreme Networks, 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 ... | 28.609756 | 92 | 0.729753 |
from __future__ import absolute_import
import logging
from st2client.models import core
LOG = logging.getLogger(__name__)
class KeyValuePair(core.Resource):
_alias = 'Key'
_display_name = 'Key Value Pair'
_plural = 'Keys'
_plural_display_name = 'Key Value Pairs'
_repr_attributes... | true | true |
f7095a719021448b51dcc63041132d4d9b8b1f68 | 10,043 | py | Python | didipack/latex_table.py | AntoineDidisheim/didipack | 9c9266bf248cae79e6ffddd98b7e573108abaa57 | [
"MIT"
] | null | null | null | didipack/latex_table.py | AntoineDidisheim/didipack | 9c9266bf248cae79e6ffddd98b7e573108abaa57 | [
"MIT"
] | null | null | null | didipack/latex_table.py | AntoineDidisheim/didipack | 9c9266bf248cae79e6ffddd98b7e573108abaa57 | [
"MIT"
] | 1 | 2021-02-08T09:26:04.000Z | 2021-02-08T09:26:04.000Z | import pandas as pd
import numpy as np
import statsmodels.api as sm
from enum import Enum
class ParValue(Enum):
TSTAT = 1
PVALUE = 2
STD = 3
class OneReg:
def __init__(self, reg, show_list=[], hide_list=[], blocks=[], bottom_blocks=[]):
self.reg = reg
if show_list == []:
se... | 34.393836 | 148 | 0.502738 | import pandas as pd
import numpy as np
import statsmodels.api as sm
from enum import Enum
class ParValue(Enum):
TSTAT = 1
PVALUE = 2
STD = 3
class OneReg:
def __init__(self, reg, show_list=[], hide_list=[], blocks=[], bottom_blocks=[]):
self.reg = reg
if show_list == []:
se... | true | true |
f7095a92645eb428a3155a581060c078485a7603 | 13,318 | py | Python | src/stim/stabilizers/pauli_string_pybind_test.py | noajshu/Stim | 503de420b1e56e90d7f44337ead1065a2ae26740 | [
"Apache-2.0"
] | 99 | 2021-03-03T19:03:25.000Z | 2022-03-22T11:39:08.000Z | src/stim/stabilizers/pauli_string_pybind_test.py | noajshu/Stim | 503de420b1e56e90d7f44337ead1065a2ae26740 | [
"Apache-2.0"
] | 95 | 2021-03-04T00:11:30.000Z | 2022-03-30T08:53:44.000Z | src/stim/stabilizers/pauli_string_pybind_test.py | noajshu/Stim | 503de420b1e56e90d7f44337ead1065a2ae26740 | [
"Apache-2.0"
] | 20 | 2021-03-09T14:10:13.000Z | 2022-03-15T04:40:12.000Z | # Copyright 2021 Google LLC
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, ... | 28.037895 | 92 | 0.570431 |
import stim
import pytest
def test_identity():
p = stim.PauliString(3)
assert len(p) == 3
assert p[0] == p[1] == p[2] == 0
assert p.sign == +1
def test_from_str():
p = stim.PauliString("-_XYZ_ZYX")
assert len(p) == 8
assert p[0] == 0
assert p[1] == 1
assert p[2] == ... | true | true |
f7095b8e4b08b57406f35839c522b08a768a6216 | 1,113 | py | Python | src/sumo_controller_node.py | ps-thunderatz/sumo_controller | 635219bbb9841ed83a391be3142fb87efd22a461 | [
"MIT"
] | null | null | null | src/sumo_controller_node.py | ps-thunderatz/sumo_controller | 635219bbb9841ed83a391be3142fb87efd22a461 | [
"MIT"
] | 7 | 2021-08-28T18:54:58.000Z | 2021-09-06T03:01:06.000Z | src/sumo_controller_node.py | ps-thunderatz/sumo_controller | 635219bbb9841ed83a391be3142fb87efd22a461 | [
"MIT"
] | 1 | 2021-09-05T18:59:05.000Z | 2021-09-05T18:59:05.000Z | #!/usr/bin/env python3
"""Node para controlar um robô de sumô
File
-------
sumo_controller/src/sumo_controller_node.py
Authors
-------
ThundeRatz Team <comp@thunderatz.org>
"""
import rospy
from std_msgs.msg import Float64
CONTROL_RATE = 60 # Hz
def main():
""" Lógica principal do node de controle
""... | 24.195652 | 91 | 0.680144 |
import rospy
from std_msgs.msg import Float64
CONTROL_RATE = 60
def main():
rospy.init_node("sumo_controller", disable_signals=True, anonymous=True)
rospy.loginfo(f"Node de controle iniciado {rospy.get_time()}")
rate = rospy.Rate(CONTROL_RATE)
while not rospy.is_shutdown():
... | true | true |
f7095bec43a635319555dc50a6ab8fae0442f341 | 9,403 | py | Python | tests/tools/commands/test_venv.py | Eric-Arellano/pex | 49955249ec3a8dfa8da5fd7da6a06b9666ae73c7 | [
"Apache-2.0"
] | null | null | null | tests/tools/commands/test_venv.py | Eric-Arellano/pex | 49955249ec3a8dfa8da5fd7da6a06b9666ae73c7 | [
"Apache-2.0"
] | null | null | null | tests/tools/commands/test_venv.py | Eric-Arellano/pex | 49955249ec3a8dfa8da5fd7da6a06b9666ae73c7 | [
"Apache-2.0"
] | 1 | 2021-03-08T21:42:57.000Z | 2021-03-08T21:42:57.000Z | # Copyright 2020 Pants project contributors (see CONTRIBUTORS.md).
# Licensed under the Apache License, Version 2.0 (see LICENSE).
from __future__ import absolute_import
import os
import subprocess
import tempfile
from subprocess import CalledProcessError
from textwrap import dedent
import pytest
from pex.common im... | 32.536332 | 98 | 0.622461 |
from __future__ import absolute_import
import os
import subprocess
import tempfile
from subprocess import CalledProcessError
from textwrap import dedent
import pytest
from pex.common import temporary_dir, touch
from pex.executor import Executor
from pex.testing import run_pex_command
from pex.tools.commands.virtu... | true | true |
f7095d1db7c3f81dc0dfa863c114fdc12fc2c216 | 2,964 | py | Python | test_scripts/main_cvxpy_simple.py | forgi86/pyMPC | 291db149554767a035fcb01df3fed7a6b3fe60e4 | [
"MIT"
] | 84 | 2019-05-28T09:27:37.000Z | 2022-03-31T08:38:23.000Z | test_scripts/main_cvxpy_simple.py | passion4energy/pyMPC | 4b004ba707dab49cd36d96a3575b8593c870a904 | [
"MIT"
] | 2 | 2020-04-17T00:03:27.000Z | 2021-01-30T11:35:58.000Z | test_scripts/main_cvxpy_simple.py | passion4energy/pyMPC | 4b004ba707dab49cd36d96a3575b8593c870a904 | [
"MIT"
] | 20 | 2019-10-13T13:50:16.000Z | 2022-03-31T08:38:25.000Z | from cvxpy import Variable, Parameter, Minimize, Problem, OSQP, quad_form
import numpy as np
import scipy as sp
import scipy.sparse as sparse
import time
if __name__ == "__main__":
# Discrete time model of a quadcopter
Ts = 0.2
M = 2.0
Ad = sparse.csc_matrix([
[1.0, Ts],
[0, 1.0]
... | 28.5 | 90 | 0.567476 | from cvxpy import Variable, Parameter, Minimize, Problem, OSQP, quad_form
import numpy as np
import scipy as sp
import scipy.sparse as sparse
import time
if __name__ == "__main__":
Ts = 0.2
M = 2.0
Ad = sparse.csc_matrix([
[1.0, Ts],
[0, 1.0]
])
Bd = sparse.csc_matrix([
... | true | true |
f7095f4389a092c609358f7f82ea89c7b96159a9 | 11,890 | py | Python | src/ppscore/calculation.py | SuryaThiru/ppscore | 59df800e32d4ef5fda4be2bdf4b3235db2a39fee | [
"MIT"
] | null | null | null | src/ppscore/calculation.py | SuryaThiru/ppscore | 59df800e32d4ef5fda4be2bdf4b3235db2a39fee | [
"MIT"
] | null | null | null | src/ppscore/calculation.py | SuryaThiru/ppscore | 59df800e32d4ef5fda4be2bdf4b3235db2a39fee | [
"MIT"
] | null | null | null | from sklearn import tree
from sklearn import preprocessing
from sklearn.model_selection import cross_val_score
from sklearn.metrics import mean_absolute_error, f1_score
import pandas as pd
from pandas.api.types import (
is_numeric_dtype,
is_bool_dtype,
is_categorical_dtype,
is_string_dtype,
is_date... | 34.970588 | 306 | 0.655341 | from sklearn import tree
from sklearn import preprocessing
from sklearn.model_selection import cross_val_score
from sklearn.metrics import mean_absolute_error, f1_score
import pandas as pd
from pandas.api.types import (
is_numeric_dtype,
is_bool_dtype,
is_categorical_dtype,
is_string_dtype,
is_date... | true | true |
f7095f7c93a14717410ae3c0c3514e781f186551 | 832 | py | Python | direct/cli/utils.py | NKI-AI/direct | 7c9d59345b68ea70bc20a5cea2c895c6059f8e46 | [
"Apache-2.0"
] | 57 | 2021-12-21T23:11:46.000Z | 2022-03-26T23:25:36.000Z | direct/cli/utils.py | NKI-AI/direct | 7c9d59345b68ea70bc20a5cea2c895c6059f8e46 | [
"Apache-2.0"
] | 23 | 2021-12-22T15:02:20.000Z | 2022-03-29T21:12:37.000Z | direct/cli/utils.py | NKI-AI/direct | 7c9d59345b68ea70bc20a5cea2c895c6059f8e46 | [
"Apache-2.0"
] | 5 | 2021-12-22T17:15:28.000Z | 2022-03-03T02:44:12.000Z | # coding=utf-8
# Copyright (c) DIRECT Contributors
import argparse
import pathlib
import sys
from direct.types import FileOrUrl, PathOrString
from direct.utils.io import check_is_valid_url
def is_file(path):
path = pathlib.Path(path)
if path.is_file():
return path
raise argparse.ArgumentTypeErro... | 25.212121 | 116 | 0.704327 |
import argparse
import pathlib
import sys
from direct.types import FileOrUrl, PathOrString
from direct.utils.io import check_is_valid_url
def is_file(path):
path = pathlib.Path(path)
if path.is_file():
return path
raise argparse.ArgumentTypeError(f"{path} is not a valid file or url.")
def fi... | true | true |
f7095fdd9792bebf1514154b53900ed899f43e29 | 303 | py | Python | Eshop/urls.py | deepchatterjeevns/Green-veggies-ECommerce-App | 142e8f9cb6766b99c0f8212ca77dc9bec41a9a83 | [
"MIT"
] | null | null | null | Eshop/urls.py | deepchatterjeevns/Green-veggies-ECommerce-App | 142e8f9cb6766b99c0f8212ca77dc9bec41a9a83 | [
"MIT"
] | null | null | null | Eshop/urls.py | deepchatterjeevns/Green-veggies-ECommerce-App | 142e8f9cb6766b99c0f8212ca77dc9bec41a9a83 | [
"MIT"
] | null | null | null | from django.contrib import admin
from django.urls import path, include
from django.conf import settings
from django.conf.urls.static import static
urlpatterns = [
path('admin/', admin.site.urls),
path('', include('store.urls'))
] + static(settings.MEDIA_URL, document_root=settings.MEDIA_ROOT)
| 30.3 | 65 | 0.759076 | from django.contrib import admin
from django.urls import path, include
from django.conf import settings
from django.conf.urls.static import static
urlpatterns = [
path('admin/', admin.site.urls),
path('', include('store.urls'))
] + static(settings.MEDIA_URL, document_root=settings.MEDIA_ROOT)
| true | true |
f70960b00381015a48deaf6009d765c36d4c15c3 | 10,878 | py | Python | register.py | joakimlindblad/py_alpha_amd_release | 6a95286753c48e9f0c882d650158b15b58bcdd46 | [
"MIT"
] | null | null | null | register.py | joakimlindblad/py_alpha_amd_release | 6a95286753c48e9f0c882d650158b15b58bcdd46 | [
"MIT"
] | null | null | null | register.py | joakimlindblad/py_alpha_amd_release | 6a95286753c48e9f0c882d650158b15b58bcdd46 | [
"MIT"
] | null | null | null |
#
# Py-Alpha-AMD Registration Framework
# Author: Johan Ofverstedt
# Reference: Fast and Robust Symmetric Image Registration Based on Distances Combining Intensity and Spatial Information
#
# Copyright 2019 Johan Ofverstedt
#
# Permission is hereby granted, free of charge, to any person obtaining a copy of this softwa... | 38.574468 | 206 | 0.668505 |
import numpy as np
import scipy as sp
import scipy.misc
from transforms import CompositeTransform
from transforms import AffineTransform
from transforms import Rigid2DTransform
from transforms import Rotate2DTransform
from transforms import TranslationTransform
from transforms import ScalingT... | true | true |
f70964bda74141f4f7530508848019e326ef048c | 99 | py | Python | fedml_api/data_preprocessing/stackoverflow_lr/__init__.py | GabriJP/FedML | 9ccf52baddc065bf9cf3ca8ae2eeaadbc338e988 | [
"Apache-2.0"
] | null | null | null | fedml_api/data_preprocessing/stackoverflow_lr/__init__.py | GabriJP/FedML | 9ccf52baddc065bf9cf3ca8ae2eeaadbc338e988 | [
"Apache-2.0"
] | null | null | null | fedml_api/data_preprocessing/stackoverflow_lr/__init__.py | GabriJP/FedML | 9ccf52baddc065bf9cf3ca8ae2eeaadbc338e988 | [
"Apache-2.0"
] | null | null | null | from .data_loader import StackOverflowLRDataLoader
__all__ = [
'StackOverflowLRDataLoader',
]
| 16.5 | 50 | 0.787879 | from .data_loader import StackOverflowLRDataLoader
__all__ = [
'StackOverflowLRDataLoader',
]
| true | true |
f70964db97d98144a8ce1f0e75a35480642ce6b9 | 1,273 | py | Python | discretisedfield/ovf2vtk.py | minrk/discretisedfield | 251584f8d976a7fafdff5402d16327489407c4dd | [
"BSD-3-Clause"
] | null | null | null | discretisedfield/ovf2vtk.py | minrk/discretisedfield | 251584f8d976a7fafdff5402d16327489407c4dd | [
"BSD-3-Clause"
] | null | null | null | discretisedfield/ovf2vtk.py | minrk/discretisedfield | 251584f8d976a7fafdff5402d16327489407c4dd | [
"BSD-3-Clause"
] | null | null | null | import argparse
import discretisedfield as df
def convert_files(input_files, output_files):
for input_file, output_file in zip(input_files, output_files):
field = df.Field.fromfile(input_file)
field.write(output_file)
def main():
parser = argparse.ArgumentParser(
prog='ovf2vtk',
... | 31.825 | 76 | 0.600157 | import argparse
import discretisedfield as df
def convert_files(input_files, output_files):
for input_file, output_file in zip(input_files, output_files):
field = df.Field.fromfile(input_file)
field.write(output_file)
def main():
parser = argparse.ArgumentParser(
prog='ovf2vtk',
... | true | true |
f70965108055debeb1faafd0a789bccc53cc61ee | 3,586 | py | Python | wallstreet_cli/main.py | kuuurt/wallstreet_cli | ce4f48b23c77a2955842685d9688fee6f45ba64f | [
"MIT"
] | null | null | null | wallstreet_cli/main.py | kuuurt/wallstreet_cli | ce4f48b23c77a2955842685d9688fee6f45ba64f | [
"MIT"
] | null | null | null | wallstreet_cli/main.py | kuuurt/wallstreet_cli | ce4f48b23c77a2955842685d9688fee6f45ba64f | [
"MIT"
] | null | null | null | import os
import argparse
# import json
from wallstreet import Stock
from wallstreet_cli import xetra
from forex_python.converter import CurrencyRates
LOCAL_DB_PATH = os.path.join(os.path.dirname(__file__), "data", "db.txt")
def _currency_conversion(source_v: float, source_currency: str, target_currency: str):
... | 32.017857 | 91 | 0.687395 | import os
import argparse
from wallstreet import Stock
from wallstreet_cli import xetra
from forex_python.converter import CurrencyRates
LOCAL_DB_PATH = os.path.join(os.path.dirname(__file__), "data", "db.txt")
def _currency_conversion(source_v: float, source_currency: str, target_currency: str):
c = CurrencyR... | true | true |
f7096668b0d05bfcb253d440a0e8ab2c6d1bcb9f | 15,440 | py | Python | torch_ecg/models/cnn/multi_scopic.py | DeepPSP/torch_ecg | 6db5ffb063d0e8fb4ce97029a0d184a658f43a37 | [
"MIT"
] | 9 | 2021-06-26T03:00:55.000Z | 2022-03-03T13:43:00.000Z | torch_ecg/models/cnn/multi_scopic.py | DeepPSP/torch_ecg | 6db5ffb063d0e8fb4ce97029a0d184a658f43a37 | [
"MIT"
] | 1 | 2021-10-01T09:29:30.000Z | 2021-10-02T03:41:55.000Z | torch_ecg/models/cnn/multi_scopic.py | DeepPSP/torch_ecg | 6db5ffb063d0e8fb4ce97029a0d184a658f43a37 | [
"MIT"
] | 2 | 2021-05-25T14:52:03.000Z | 2021-12-29T15:09:08.000Z | """
The core part of the SOTA model of CPSC2019,
branched, and has different scope (in terms of dilation) in each branch
"""
from copy import deepcopy
from itertools import repeat
from collections import OrderedDict
from typing import Union, Optional, Sequence, NoReturn
import numpy as np
np.set_printoptions(precision... | 38.217822 | 147 | 0.592034 | from copy import deepcopy
from itertools import repeat
from collections import OrderedDict
from typing import Union, Optional, Sequence, NoReturn
import numpy as np
np.set_printoptions(precision=5, suppress=True)
import torch
from torch import nn
from torch import Tensor
from ...cfg import CFG, DEFAULTS
from ...utils... | true | true |
f70966e3c9f9dccb779b1817d27df03b62c5153e | 5,073 | py | Python | tensorflow/contrib/distributions/python/kernel_tests/distribution_test.py | My-Technical-Architect/tensorflow | 35cf4653e6fe15953e2e565afc5a0fd2ab4d5290 | [
"Apache-2.0"
] | null | null | null | tensorflow/contrib/distributions/python/kernel_tests/distribution_test.py | My-Technical-Architect/tensorflow | 35cf4653e6fe15953e2e565afc5a0fd2ab4d5290 | [
"Apache-2.0"
] | null | null | null | tensorflow/contrib/distributions/python/kernel_tests/distribution_test.py | My-Technical-Architect/tensorflow | 35cf4653e6fe15953e2e565afc5a0fd2ab4d5290 | [
"Apache-2.0"
] | null | null | null | # Copyright 2016 The TensorFlow Authors. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applica... | 40.91129 | 80 | 0.650897 |
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
import tensorflow as tf
from tensorflow.python.framework import tensor_util
dists = tf.contrib.distributions
class DistributionTest(tf.test.TestCase):
def testParamShapesAndFromParams(self):... | true | true |
f7096801f14d2d26bd55f170d586739f77960dfb | 618 | py | Python | chat/migrations/0001_initial.py | bionikspoon/django_channels_chat | b756bb6a8a361ef190ea70120f70c7b420559d74 | [
"MIT"
] | null | null | null | chat/migrations/0001_initial.py | bionikspoon/django_channels_chat | b756bb6a8a361ef190ea70120f70c7b420559d74 | [
"MIT"
] | null | null | null | chat/migrations/0001_initial.py | bionikspoon/django_channels_chat | b756bb6a8a361ef190ea70120f70c7b420559d74 | [
"MIT"
] | null | null | null | # -*- coding: utf-8 -*-
# Generated by Django 1.9.7 on 2016-06-25 23:37
from __future__ import unicode_literals
from django.db import migrations, models
class Migration(migrations.Migration):
initial = True
dependencies = [
]
operations = [
migrations.CreateModel(
name='ChatMes... | 24.72 | 114 | 0.590615 |
from __future__ import unicode_literals
from django.db import migrations, models
class Migration(migrations.Migration):
initial = True
dependencies = [
]
operations = [
migrations.CreateModel(
name='ChatMessage',
fields=[
('id', models.AutoField(au... | true | true |
f70969aa61bc9bce48678cb70237665201eecd01 | 2,621 | py | Python | homeassistant/components/bbox/device_tracker.py | zalke/home-assistant | a31e49c857722c0723dc5297cd83cbce0f8716f6 | [
"Apache-2.0"
] | 4 | 2019-07-03T22:36:57.000Z | 2019-08-10T15:33:25.000Z | homeassistant/components/bbox/device_tracker.py | zalke/home-assistant | a31e49c857722c0723dc5297cd83cbce0f8716f6 | [
"Apache-2.0"
] | 7 | 2019-08-23T05:26:02.000Z | 2022-03-11T23:57:18.000Z | homeassistant/components/bbox/device_tracker.py | zalke/home-assistant | a31e49c857722c0723dc5297cd83cbce0f8716f6 | [
"Apache-2.0"
] | 3 | 2019-04-28T16:35:45.000Z | 2020-05-28T15:21:59.000Z | """Support for French FAI Bouygues Bbox routers."""
from collections import namedtuple
from datetime import timedelta
import logging
import voluptuous as vol
from homeassistant.components.device_tracker import (
DOMAIN, PLATFORM_SCHEMA, DeviceScanner)
from homeassistant.const import CONF_HOST
import homeassistant... | 28.48913 | 75 | 0.660053 | from collections import namedtuple
from datetime import timedelta
import logging
import voluptuous as vol
from homeassistant.components.device_tracker import (
DOMAIN, PLATFORM_SCHEMA, DeviceScanner)
from homeassistant.const import CONF_HOST
import homeassistant.helpers.config_validation as cv
from homeassistant.... | true | true |
f7096a6d4471f4bf32467c0baac5db6cb57c25b5 | 1,353 | py | Python | data_structures/sorting_algos/mergesort/test_mergesort.py | jeremyCtown/data-structures-and-algorithms | d4ba8741f858fb5298f8ce560240373fb7742e20 | [
"MIT"
] | null | null | null | data_structures/sorting_algos/mergesort/test_mergesort.py | jeremyCtown/data-structures-and-algorithms | d4ba8741f858fb5298f8ce560240373fb7742e20 | [
"MIT"
] | null | null | null | data_structures/sorting_algos/mergesort/test_mergesort.py | jeremyCtown/data-structures-and-algorithms | d4ba8741f858fb5298f8ce560240373fb7742e20 | [
"MIT"
] | null | null | null | import pytest
from mergesort import mergesort, merge
def test_empty_list_returns_empty_list():
"""Test mergesort on empty list returns same."""
empty = []
assert mergesort(empty) == []
def test_list_with_one_value():
"""Test mergesort on empty list returns same."""
lst = [8]
assert mergesort... | 23.736842 | 68 | 0.601626 | import pytest
from mergesort import mergesort, merge
def test_empty_list_returns_empty_list():
empty = []
assert mergesort(empty) == []
def test_list_with_one_value():
lst = [8]
assert mergesort(lst) == [8]
def test_list_with_two_values():
lst = [8, 3]
assert mergesort(lst) == [3, 8]
def... | true | true |
f7096bdce2180e86cf1d57c069d0bf48eacda9db | 2,648 | py | Python | model/encoder.py | project-delphi/ACS-QG | 03aa5b79030b5ba4c09a99363a58454743876592 | [
"MIT"
] | 63 | 2020-02-11T06:40:17.000Z | 2022-03-03T08:07:16.000Z | model/encoder.py | project-delphi/ACS-QG | 03aa5b79030b5ba4c09a99363a58454743876592 | [
"MIT"
] | 18 | 2020-02-11T06:30:50.000Z | 2022-03-24T08:39:49.000Z | model/encoder.py | project-delphi/ACS-QG | 03aa5b79030b5ba4c09a99363a58454743876592 | [
"MIT"
] | 17 | 2020-02-24T14:29:16.000Z | 2022-01-12T06:42:13.000Z | """
Implement input sentence encoder.
"""
import torch.nn as nn
from torch.nn.utils.rnn import pad_packed_sequence as unpack
from torch.nn.utils.rnn import pack_padded_sequence as pack
from .config import *
from common.constants import DEVICE
from util.tensor_utils import to_sorted_tensor, to_original_tensor
class En... | 44.133333 | 96 | 0.673338 | import torch.nn as nn
from torch.nn.utils.rnn import pad_packed_sequence as unpack
from torch.nn.utils.rnn import pack_padded_sequence as pack
from .config import *
from common.constants import DEVICE
from util.tensor_utils import to_sorted_tensor, to_original_tensor
class Encoder(nn.Module):
def __init__(self, ... | true | true |
f7096c3f584c384ca7d480068e8e6659333d3299 | 356 | py | Python | backend/backend/utils.py | reidy-p/DublinBusPredictions | a6b1fc8a5c28500a3292883ea0dfcde1770d78d1 | [
"MIT"
] | null | null | null | backend/backend/utils.py | reidy-p/DublinBusPredictions | a6b1fc8a5c28500a3292883ea0dfcde1770d78d1 | [
"MIT"
] | null | null | null | backend/backend/utils.py | reidy-p/DublinBusPredictions | a6b1fc8a5c28500a3292883ea0dfcde1770d78d1 | [
"MIT"
] | null | null | null | from dublinbus.serializers import UserSerializer
def my_jwt_response_handler(token, user=None, request=None):
''' JWT response handler
Adds a new ‘user’ field with the user’s serialized data when a token is generated
'''
response = UserSerializer(user, context={'request': request}).data
response["... | 32.363636 | 85 | 0.727528 | from dublinbus.serializers import UserSerializer
def my_jwt_response_handler(token, user=None, request=None):
response = UserSerializer(user, context={'request': request}).data
response["token"] = token
return response
| true | true |
f7096d295eeb57b3737ef0aea08fc63bc3d5f3d0 | 4,713 | py | Python | python/paddle/fluid/tests/unittests/distribution/test_distribution_dirichlet_static.py | RangeKing/Paddle | 2d87300809ae75d76f5b0b457d8112cb88dc3e27 | [
"Apache-2.0"
] | 8 | 2016-08-15T07:02:27.000Z | 2016-08-24T09:34:00.000Z | python/paddle/fluid/tests/unittests/distribution/test_distribution_dirichlet_static.py | RangeKing/Paddle | 2d87300809ae75d76f5b0b457d8112cb88dc3e27 | [
"Apache-2.0"
] | 1 | 2022-01-28T07:23:22.000Z | 2022-01-28T07:23:22.000Z | python/paddle/fluid/tests/unittests/distribution/test_distribution_dirichlet_static.py | RangeKing/Paddle | 2d87300809ae75d76f5b0b457d8112cb88dc3e27 | [
"Apache-2.0"
] | null | null | null | # Copyright (c) 2021 PaddlePaddle Authors. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by appli... | 44.046729 | 80 | 0.591767 |
import unittest
import numpy as np
import paddle
import scipy.stats
from config import ATOL, DEVICES, RTOL
from parameterize import TEST_CASE_NAME, parameterize_cls, place, xrand
paddle.enable_static()
@place(DEVICES)
@parameterize_cls((TEST_CASE_NAME, 'concentration'),
[('test-one-... | true | true |
f7096ddd23613e7d847f5b1698c484bd8f0b6508 | 7,244 | py | Python | src/datadog_api_client/v2/model/api_key_update_data.py | rchenzheng/datadog-api-client-python | 2e86ac098c6f0c7fdd90ed218224587c0f8eafef | [
"Apache-2.0"
] | null | null | null | src/datadog_api_client/v2/model/api_key_update_data.py | rchenzheng/datadog-api-client-python | 2e86ac098c6f0c7fdd90ed218224587c0f8eafef | [
"Apache-2.0"
] | null | null | null | src/datadog_api_client/v2/model/api_key_update_data.py | rchenzheng/datadog-api-client-python | 2e86ac098c6f0c7fdd90ed218224587c0f8eafef | [
"Apache-2.0"
] | null | null | null | # Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License.
# This product includes software developed at Datadog (https://www.datadoghq.com/).
# Copyright 2019-Present Datadog, Inc.
import re # noqa: F401
import sys # noqa: F401
from datadog_api_client.v2.model_uti... | 39.369565 | 108 | 0.587659 |
import re
import sys
from datadog_api_client.v2.model_utils import (
ApiTypeError,
ModelComposed,
ModelNormal,
ModelSimple,
cached_property,
change_keys_js_to_python,
convert_js_args_to_python_args,
date,
datetime,
file_type,
none_type,
validate_get_composed_i... | true | true |
f7096dfb774ef917c1fa89ce59bb06b35dcfd16b | 13,101 | py | Python | nmt/utils/iterator_utils_test.py | luckmoon/nmt | 4f6a4acf8d8e086f9d894444a2877ac1f0856ad0 | [
"Apache-2.0"
] | null | null | null | nmt/utils/iterator_utils_test.py | luckmoon/nmt | 4f6a4acf8d8e086f9d894444a2877ac1f0856ad0 | [
"Apache-2.0"
] | null | null | null | nmt/utils/iterator_utils_test.py | luckmoon/nmt | 4f6a4acf8d8e086f9d894444a2877ac1f0856ad0 | [
"Apache-2.0"
] | null | null | null | # Copyright 2017 Google Inc. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or a... | 40.813084 | 81 | 0.558507 |
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
import tensorflow as tf
from tensorflow.python.ops import lookup_ops
from ..utils import iterator_utils
class IteratorUtilsTest(tf.test.TestCase):
def testGetIterator(self):
tf.... | true | true |
f7096e12c17cddb1193c96063117037bd1a0d6c7 | 1,392 | py | Python | misc/graph.py | OlegSomov/light-motion-analysis | 4f510250aaa32929a6ccff3c796b53151addb9e9 | [
"MIT"
] | null | null | null | misc/graph.py | OlegSomov/light-motion-analysis | 4f510250aaa32929a6ccff3c796b53151addb9e9 | [
"MIT"
] | null | null | null | misc/graph.py | OlegSomov/light-motion-analysis | 4f510250aaa32929a6ccff3c796b53151addb9e9 | [
"MIT"
] | null | null | null | import os
import matplotlib
import json
from datetime import datetime
from matplotlib import pyplot
def show_results_graph(timer, name=None):
with (open('light_plot.json', 'r')) as f:
data = json.load(f)
with (open('light_plot_imporved.json', 'r')) as f:
data_improved = json.load(f)
os.r... | 30.933333 | 121 | 0.631466 | import os
import matplotlib
import json
from datetime import datetime
from matplotlib import pyplot
def show_results_graph(timer, name=None):
with (open('light_plot.json', 'r')) as f:
data = json.load(f)
with (open('light_plot_imporved.json', 'r')) as f:
data_improved = json.load(f)
os.r... | true | true |
f7096eb7eef28d54b1ae656d37094eb075a9cb64 | 6,618 | py | Python | horovod/common/elastic.py | Infi-zc/horovod | 94cd8561a21d449fc8c80c8fef422025b84dfc22 | [
"Apache-2.0"
] | 7,676 | 2019-02-12T02:57:22.000Z | 2022-03-31T21:05:40.000Z | horovod/common/elastic.py | Infi-zc/horovod | 94cd8561a21d449fc8c80c8fef422025b84dfc22 | [
"Apache-2.0"
] | 2,431 | 2019-02-12T01:34:21.000Z | 2022-03-31T21:43:38.000Z | horovod/common/elastic.py | Infi-zc/horovod | 94cd8561a21d449fc8c80c8fef422025b84dfc22 | [
"Apache-2.0"
] | 1,557 | 2019-02-12T07:52:15.000Z | 2022-03-31T21:05:43.000Z | # Copyright 2020 Uber Technologies, Inc. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applica... | 37.602273 | 109 | 0.663342 |
import functools
import queue
from horovod.common.exceptions import HorovodInternalError, HostsUpdatedInterrupt
from horovod.runner.elastic.worker import HostUpdateResult, WorkerNotificationManager
notification_manager = WorkerNotificationManager()
class State(object):
def __init__(self, bcast_o... | true | true |
f70970e710b91e652b69cabb5611ea3fb3a4a51b | 3,331 | py | Python | tests/performance/WorkerThreadsBuildTimePerformance/run.py | xpybuild/xpybuild | c71a73e47414871c8192381d0356ab62f5a58127 | [
"Apache-2.0"
] | 9 | 2017-02-06T16:45:46.000Z | 2021-12-05T09:42:58.000Z | tests/performance/WorkerThreadsBuildTimePerformance/run.py | xpybuild/xpybuild | c71a73e47414871c8192381d0356ab62f5a58127 | [
"Apache-2.0"
] | 15 | 2019-01-11T19:39:34.000Z | 2022-01-08T11:11:35.000Z | tests/performance/WorkerThreadsBuildTimePerformance/run.py | xpybuild/xpybuild | c71a73e47414871c8192381d0356ab62f5a58127 | [
"Apache-2.0"
] | 5 | 2017-02-06T16:51:17.000Z | 2020-12-02T17:36:30.000Z | import multiprocessing
import random
import time
from pysys.constants import *
from xpybuild.xpybuild_basetest import XpybuildBaseTest
class PySysTest(XpybuildBaseTest):
buildRoot = None # can override this with -XbuildRoot=path to measure your own build
def execute(self):
buildroot = self.buildRoot if self.buil... | 40.621951 | 223 | 0.709997 | import multiprocessing
import random
import time
from pysys.constants import *
from xpybuild.xpybuild_basetest import XpybuildBaseTest
class PySysTest(XpybuildBaseTest):
buildRoot = None
def execute(self):
buildroot = self.buildRoot if self.buildRoot else self.input
assert os.path.isdir(buildroot), self.build... | true | true |
f709711aa64e6d3bbb5a25ff10f73af015d6369a | 723 | py | Python | karmagrambot/config.py | patrickelectric/karmagrambot | b76d79172905c5ce906c0ff60591d75dd2994565 | [
"MIT"
] | 6 | 2019-05-31T18:57:08.000Z | 2021-05-03T19:02:28.000Z | karmagrambot/config.py | patrickelectric/karmagrambot | b76d79172905c5ce906c0ff60591d75dd2994565 | [
"MIT"
] | 20 | 2019-05-23T22:57:44.000Z | 2021-11-19T01:43:16.000Z | karmagrambot/config.py | patrickelectric/karmagrambot | b76d79172905c5ce906c0ff60591d75dd2994565 | [
"MIT"
] | 8 | 2019-05-31T18:57:17.000Z | 2021-11-18T19:57:26.000Z | import json
from os import environ
from pathlib import Path
try:
CONFIG_DIR = Path(environ['XDG_CONFIG_HOME'], __package__)
except KeyError:
CONFIG_DIR = Path.home() / '.config' / __package__
if not CONFIG_DIR.exists():
CONFIG_DIR.mkdir()
CONFIG_FILE = CONFIG_DIR / 'config.json'
with open(CONFIG_FILE) a... | 21.264706 | 76 | 0.679115 | import json
from os import environ
from pathlib import Path
try:
CONFIG_DIR = Path(environ['XDG_CONFIG_HOME'], __package__)
except KeyError:
CONFIG_DIR = Path.home() / '.config' / __package__
if not CONFIG_DIR.exists():
CONFIG_DIR.mkdir()
CONFIG_FILE = CONFIG_DIR / 'config.json'
with open(CONFIG_FILE) a... | true | true |
f709713726d342f65a2d86eaded3bf3a8690609d | 230 | py | Python | tests/themes/golden/demo_basic_button.py | Rahuum/glooey | 932edca1c8fdd710f1941038e47ac8d25a31a1a8 | [
"MIT"
] | 86 | 2016-11-28T12:34:28.000Z | 2022-03-17T13:49:49.000Z | tests/themes/golden/demo_basic_button.py | Rahuum/glooey | 932edca1c8fdd710f1941038e47ac8d25a31a1a8 | [
"MIT"
] | 57 | 2017-03-07T10:11:52.000Z | 2022-01-16T19:35:33.000Z | tests/themes/golden/demo_basic_button.py | Rahuum/glooey | 932edca1c8fdd710f1941038e47ac8d25a31a1a8 | [
"MIT"
] | 9 | 2017-03-15T18:55:50.000Z | 2022-02-17T14:52:49.000Z | #!/usr/bin/env python3
import pyglet
import run_demos
import glooey.themes.golden as golden
window = pyglet.window.Window()
gui = golden.Gui(window)
button = golden.BasicButton('Lorem Ipsum')
gui.add(button)
pyglet.app.run()
| 15.333333 | 42 | 0.756522 |
import pyglet
import run_demos
import glooey.themes.golden as golden
window = pyglet.window.Window()
gui = golden.Gui(window)
button = golden.BasicButton('Lorem Ipsum')
gui.add(button)
pyglet.app.run()
| true | true |
f70971933fba0cc7545a7ef491245651e48915fc | 16,353 | py | Python | tests/test_lex.py | Chaformbintrano/hy | 1b220a93a509acd2c5c3c4159e841b5eb12a7a95 | [
"MIT"
] | null | null | null | tests/test_lex.py | Chaformbintrano/hy | 1b220a93a509acd2c5c3c4159e841b5eb12a7a95 | [
"MIT"
] | null | null | null | tests/test_lex.py | Chaformbintrano/hy | 1b220a93a509acd2c5c3c4159e841b5eb12a7a95 | [
"MIT"
] | null | null | null | # Copyright 2019 the authors.
# This file is part of Hy, which is free software licensed under the Expat
# license. See the LICENSE.
import sys
import traceback
import pytest
from math import isnan
from hy.models import (HyExpression, HyInteger, HyFloat, HyComplex, HySymbol,
HyString, HyDict, H... | 33.237805 | 105 | 0.597994 |
import sys
import traceback
import pytest
from math import isnan
from hy.models import (HyExpression, HyInteger, HyFloat, HyComplex, HySymbol,
HyString, HyDict, HyList, HySet, HyKeyword)
from hy.lex import tokenize
from hy.lex.exceptions import LexException, PrematureEndOfInput
from hy.error... | true | true |
f70971dadca4fb414382ea607136ad5493b59e79 | 3,068 | py | Python | vendor/github.com/elastic/beats/metricbeat/tests/system/test_kubernetes.py | plinde/mqttbeat | 64e3bf19a45686a5cc6aecae58d9d2e140e7c915 | [
"Apache-2.0"
] | 35 | 2017-07-05T07:48:03.000Z | 2022-01-10T16:29:37.000Z | vendor/github.com/elastic/beats/metricbeat/tests/system/test_kubernetes.py | plinde/mqttbeat | 64e3bf19a45686a5cc6aecae58d9d2e140e7c915 | [
"Apache-2.0"
] | 8 | 2017-07-20T21:13:17.000Z | 2020-01-10T08:08:34.000Z | vendor/github.com/elastic/beats/metricbeat/tests/system/test_kubernetes.py | plinde/mqttbeat | 64e3bf19a45686a5cc6aecae58d9d2e140e7c915 | [
"Apache-2.0"
] | 19 | 2017-08-03T16:49:27.000Z | 2022-01-27T01:48:35.000Z | import os
import metricbeat
import unittest
KUBERNETES_FIELDS = metricbeat.COMMON_FIELDS + ["kubernetes"]
class Test(metricbeat.BaseTest):
@unittest.skipUnless(metricbeat.INTEGRATION_TESTS, "integration test")
def test_kubelet_node(self):
""" Kubernetes kubelet node metricset tests """
self.... | 36.094118 | 79 | 0.659061 | import os
import metricbeat
import unittest
KUBERNETES_FIELDS = metricbeat.COMMON_FIELDS + ["kubernetes"]
class Test(metricbeat.BaseTest):
@unittest.skipUnless(metricbeat.INTEGRATION_TESTS, "integration test")
def test_kubelet_node(self):
self._test_metricset('node', 1, self.get_kubelet_hosts())
... | true | true |
f709722cba9996c6b9ab92c49c7def3b7f426a8a | 2,240 | py | Python | oneflow/python/test/ops/test_function_input_output.py | wanghongsheng01/framework_enflame | debf613e05e3f5ea8084c3e79b60d0dd9e349526 | [
"Apache-2.0"
] | 1 | 2021-04-14T03:19:35.000Z | 2021-04-14T03:19:35.000Z | oneflow/python/test/ops/test_function_input_output.py | wanghongsheng01/framework_enflame | debf613e05e3f5ea8084c3e79b60d0dd9e349526 | [
"Apache-2.0"
] | 1 | 2021-06-16T08:37:50.000Z | 2021-06-16T08:37:50.000Z | oneflow/python/test/ops/test_function_input_output.py | wanghongsheng01/framework_enflame | debf613e05e3f5ea8084c3e79b60d0dd9e349526 | [
"Apache-2.0"
] | null | null | null | """
Copyright 2020 The OneFlow Authors. All rights reserved.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agr... | 33.939394 | 72 | 0.691071 | import unittest
import numpy as np
import oneflow as flow
import oneflow.typing as oft
import oneflow._oneflow_internal
from typing import Tuple
@flow.unittest.skip_unless_1n4d()
class TestFunctionInputOutput(flow.unittest.TestCase):
def test_FixedTensorDef(test_case):
@flow.global_function()
def ... | true | true |
f70972932e906ce90dd1294411cbbd58bc445a32 | 158 | py | Python | tests/test_contrib_sentry.py | gtors/stories | 0614624f472151f20617afa4e6c4a0af9b409b6d | [
"BSD-2-Clause"
] | null | null | null | tests/test_contrib_sentry.py | gtors/stories | 0614624f472151f20617afa4e6c4a0af9b409b6d | [
"BSD-2-Clause"
] | null | null | null | tests/test_contrib_sentry.py | gtors/stories | 0614624f472151f20617afa4e6c4a0af9b409b6d | [
"BSD-2-Clause"
] | null | null | null | import pytest
pytest.importorskip("foo")
from stories.contrib.sentry.django import ( # FIXME: # isort:skip # pragma: no cover # noqa
DjangoClient,
)
| 19.75 | 94 | 0.708861 | import pytest
pytest.importorskip("foo")
from stories.contrib.sentry.django import ( | true | true |
f7097307a99544d97a4ccf6bbdb873a3320a9c8c | 8,779 | py | Python | scripts/update_forecast_hub.py | ConsultingMD/covid-data-public | 2b7091f7cc3877df45a7887709e999b0ebdf30ec | [
"MIT"
] | null | null | null | scripts/update_forecast_hub.py | ConsultingMD/covid-data-public | 2b7091f7cc3877df45a7887709e999b0ebdf30ec | [
"MIT"
] | null | null | null | scripts/update_forecast_hub.py | ConsultingMD/covid-data-public | 2b7091f7cc3877df45a7887709e999b0ebdf30ec | [
"MIT"
] | null | null | null | import enum
from typing import Any
import click
import pandas as pd
import numpy as np
import structlog
import pathlib
import pydantic
import datetime
import zoltpy.util
from covidactnow.datapublic import common_init, common_df
from scripts import helpers
from covidactnow.datapublic.common_fields import (
GetB... | 37.517094 | 100 | 0.663971 | import enum
from typing import Any
import click
import pandas as pd
import numpy as np
import structlog
import pathlib
import pydantic
import datetime
import zoltpy.util
from covidactnow.datapublic import common_init, common_df
from scripts import helpers
from covidactnow.datapublic.common_fields import (
GetB... | true | true |
f709733239a4148a5fa9de69a8f2a8c2f75394e3 | 1,280 | py | Python | tethys/core/pipes/filters/filter_base.py | tethys-platform/tethys | c27daf5a832b05f9d771b04355001c331bc08766 | [
"ECL-2.0",
"Apache-2.0"
] | 2 | 2020-05-20T19:03:14.000Z | 2020-06-03T20:43:34.000Z | tethys/core/pipes/filters/filter_base.py | tethys-platform/tethys | c27daf5a832b05f9d771b04355001c331bc08766 | [
"ECL-2.0",
"Apache-2.0"
] | null | null | null | tethys/core/pipes/filters/filter_base.py | tethys-platform/tethys | c27daf5a832b05f9d771b04355001c331bc08766 | [
"ECL-2.0",
"Apache-2.0"
] | null | null | null | # Copyright 2020 Konstruktor, Inc. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable la... | 32 | 74 | 0.70625 |
from abc import abstractmethod
from typing import Any
from serobj.utils.serobj_calls import SerobjCallsBase
class FilterBase(SerobjCallsBase):
_SEROBJ__ATTRS = []
@abstractmethod
def execute(self, data_packet: Any, **kwargs) -> float:
raise NotImplementedError
| true | true |
f70973aa106803b09683a40d97d6be0f8cce325f | 369 | py | Python | 2017/future/first_unique_character.py | littlepea/beijing-python-meetup | 393d7723bc092ae548fe4e6ed82aa30ee3c7801d | [
"MIT"
] | 10 | 2016-11-15T10:39:36.000Z | 2020-01-14T04:59:08.000Z | 2017/future/first_unique_character.py | littlepea/beijing-python-meetup | 393d7723bc092ae548fe4e6ed82aa30ee3c7801d | [
"MIT"
] | 7 | 2017-01-10T05:40:05.000Z | 2020-06-28T05:59:20.000Z | 2017/future/first_unique_character.py | littlepea/beijing-python-meetup | 393d7723bc092ae548fe4e6ed82aa30ee3c7801d | [
"MIT"
] | 3 | 2017-09-19T09:12:31.000Z | 2018-10-31T06:35:21.000Z | """
Find the first non-repeated character in a string
https://www.codeeval.com/open_challenges/12/
"""
import unittest
def first_unique_character(s):
return
class FirstUniqueCharacterTest(unittest.TestCase):
def test_yellow(self):
self.assertEquals('y', first_unique_character('yellow'))
if __name... | 17.571429 | 64 | 0.731707 | import unittest
def first_unique_character(s):
return
class FirstUniqueCharacterTest(unittest.TestCase):
def test_yellow(self):
self.assertEquals('y', first_unique_character('yellow'))
if __name__ == '__main__':
unittest.main(exit=False)
| true | true |
f70974bd8c96a08043d013ab757fa388f47f81f6 | 1,832 | py | Python | tests/models.py | charkins/boolean_parser | 10d42610cd13e4af5afec1fdfda53a4de0e2d00c | [
"BSD-3-Clause"
] | 6 | 2020-09-25T06:55:37.000Z | 2022-03-24T20:17:11.000Z | tests/models.py | charkins/boolean_parser | 10d42610cd13e4af5afec1fdfda53a4de0e2d00c | [
"BSD-3-Clause"
] | 6 | 2020-11-10T16:32:30.000Z | 2022-03-31T20:59:33.000Z | tests/models.py | charkins/boolean_parser | 10d42610cd13e4af5afec1fdfda53a4de0e2d00c | [
"BSD-3-Clause"
] | 1 | 2020-12-16T12:19:11.000Z | 2020-12-16T12:19:11.000Z | # !/usr/bin/env python
# -*- coding: utf-8 -*-
#
# Filename: models.py
# Project: tests
# Author: Brian Cherinka
# Created: Friday, 15th February 2019 2:44:13 pm
# License: BSD 3-clause "New" or "Revised" License
# Copyright (c) 2019 Brian Cherinka
# Last Modified: Sunday, 3rd March 2019 4:47:18 pm
# Modified By: Brian... | 29.079365 | 79 | 0.704694 |
from __future__ import print_function, division, absolute_import
from sqlalchemy import Column, String, BigInteger, Integer, Float
from .database import Base, engine, Session
import factory
import factory.fuzzy
from pytest_factoryboy import register
class ModelA(Base):
__tablename__ = 'modela'
p... | true | true |
f7097552e3f4f3c653e56165e572f774956c3add | 6,585 | py | Python | env/lib/python3.6/site-packages/scipy/optimize/tests/test__spectral.py | anthowen/duplify | 846d01c1b21230937fdf0281b0cf8c0b08a8c24e | [
"MIT"
] | 6,989 | 2017-07-18T06:23:18.000Z | 2022-03-31T15:58:36.000Z | venv/lib/python3.7/site-packages/scipy/optimize/tests/test__spectral.py | John1001Song/Big-Data-Robo-Adviser | 9444dce96954c546333d5aecc92a06c3bfd19aa5 | [
"MIT"
] | 1,978 | 2017-07-18T09:17:58.000Z | 2022-03-31T14:28:43.000Z | venv/lib/python3.7/site-packages/scipy/optimize/tests/test__spectral.py | John1001Song/Big-Data-Robo-Adviser | 9444dce96954c546333d5aecc92a06c3bfd19aa5 | [
"MIT"
] | 1,228 | 2017-07-18T09:03:13.000Z | 2022-03-29T05:57:40.000Z | from __future__ import division, absolute_import, print_function
import itertools
import numpy as np
from numpy import exp
from numpy.testing import assert_, assert_equal
from scipy.optimize import root
def test_performance():
# Compare performance results to those listed in
# [Cheng & Li, IMA J. Num. An. ... | 31.208531 | 120 | 0.528929 | from __future__ import division, absolute_import, print_function
import itertools
import numpy as np
from numpy import exp
from numpy.testing import assert_, assert_equal
from scipy.optimize import root
def test_performance():
#
# Where the results disagree, the largest limits are ... | true | true |
f70975b2a600c129a02d2b7302e2595d0a4aa9c1 | 138 | py | Python | src/apps/cecyrd/config.py | SGC-Tlaxcala/cerebro | 6c842f66d849065a70002fccdb1eaca1e3d61d99 | [
"MIT"
] | null | null | null | src/apps/cecyrd/config.py | SGC-Tlaxcala/cerebro | 6c842f66d849065a70002fccdb1eaca1e3d61d99 | [
"MIT"
] | 48 | 2017-04-21T17:35:23.000Z | 2020-08-29T04:19:35.000Z | src/apps/cecyrd/config.py | SGC-Tlaxcala/cerebro | 6c842f66d849065a70002fccdb1eaca1e3d61d99 | [
"MIT"
] | null | null | null | from django.apps import AppConfig
class CecyrdConfig(AppConfig):
name = 'apps.cecyrd'
verbose_name = 'Evaluación del proveedor'
| 19.714286 | 45 | 0.746377 | from django.apps import AppConfig
class CecyrdConfig(AppConfig):
name = 'apps.cecyrd'
verbose_name = 'Evaluación del proveedor'
| true | true |
f70975e19b9a44269656d1320aa5ab33699c0fbe | 120,184 | py | Python | pandas/core/indexes/multi.py | FlingeR/pandas | 01f399854f9febefa9e97005f3720aa312409b98 | [
"PSF-2.0",
"Apache-2.0",
"BSD-3-Clause-No-Nuclear-License-2014",
"MIT",
"ECL-2.0",
"BSD-3-Clause"
] | null | null | null | pandas/core/indexes/multi.py | FlingeR/pandas | 01f399854f9febefa9e97005f3720aa312409b98 | [
"PSF-2.0",
"Apache-2.0",
"BSD-3-Clause-No-Nuclear-License-2014",
"MIT",
"ECL-2.0",
"BSD-3-Clause"
] | null | null | null | pandas/core/indexes/multi.py | FlingeR/pandas | 01f399854f9febefa9e97005f3720aa312409b98 | [
"PSF-2.0",
"Apache-2.0",
"BSD-3-Clause-No-Nuclear-License-2014",
"MIT",
"ECL-2.0",
"BSD-3-Clause"
] | null | null | null | from sys import getsizeof
from typing import (
TYPE_CHECKING,
Any,
Hashable,
Iterable,
List,
Optional,
Sequence,
Tuple,
Union,
)
import warnings
import numpy as np
from pandas._config import get_option
from pandas._libs import algos as libalgos, index as libindex, lib
from pandas.... | 33.769036 | 88 | 0.537601 | from sys import getsizeof
from typing import (
TYPE_CHECKING,
Any,
Hashable,
Iterable,
List,
Optional,
Sequence,
Tuple,
Union,
)
import warnings
import numpy as np
from pandas._config import get_option
from pandas._libs import algos as libalgos, index as libindex, lib
from pandas.... | true | true |
f70976272c40dc0ae0eee0a064546febb929a4e0 | 347 | py | Python | src/sql/master/stock_item_group.py | springmaple/yotimes_sql_bridge | 0d1d17c63d867bb2c2ad286851343c1884fdddf8 | [
"Apache-2.0"
] | null | null | null | src/sql/master/stock_item_group.py | springmaple/yotimes_sql_bridge | 0d1d17c63d867bb2c2ad286851343c1884fdddf8 | [
"Apache-2.0"
] | 4 | 2020-06-02T14:29:17.000Z | 2021-05-16T09:13:52.000Z | src/sql/master/stock_item_group.py | springmaple/yotimes_sql_bridge | 0d1d17c63d867bb2c2ad286851343c1884fdddf8 | [
"Apache-2.0"
] | null | null | null | from sql.entity import Entity
class StockItemGroup(Entity):
def __init__(self, data):
super().__init__(data)
self.code = self._get_str('Code') # Primary Key
self.description = self._get_str('Description')
self.is_active = self._get_bool('IsActive')
self.last_modified = sel... | 31.545455 | 58 | 0.67147 | from sql.entity import Entity
class StockItemGroup(Entity):
def __init__(self, data):
super().__init__(data)
self.code = self._get_str('Code')
self.description = self._get_str('Description')
self.is_active = self._get_bool('IsActive')
self.last_modified = self._get_int('L... | true | true |
f70977cc983222645bc9a20cd05075c26c497868 | 456 | py | Python | src/slime/core/utils.py | ihmeuw-msca/SLIME | 255dfc6fc1880545f1ca9a5062eff823571cc025 | [
"MIT"
] | null | null | null | src/slime/core/utils.py | ihmeuw-msca/SLIME | 255dfc6fc1880545f1ca9a5062eff823571cc025 | [
"MIT"
] | null | null | null | src/slime/core/utils.py | ihmeuw-msca/SLIME | 255dfc6fc1880545f1ca9a5062eff823571cc025 | [
"MIT"
] | null | null | null | # -*- coding: utf-8 -*-
"""
utils
~~~~~
"""
import numpy as np
def sizes_to_indices(sizes):
"""Converting sizes to corresponding indices.
Args:
sizes (numpy.dnarray):
An array consist of non-negative number.
Returns:
list{range}:
List the indices.
"""
... | 19 | 52 | 0.537281 |
import numpy as np
def sizes_to_indices(sizes):
u_id = np.cumsum(sizes)
l_id = np.insert(u_id[:-1], 0, 0)
return [
np.arange(l, u) for l, u in zip(l_id, u_id)
]
| true | true |
f70978299ac9e682f5cdb99a7396541fd08c115c | 2,119 | py | Python | youtube_dl/extractor/unistra.py | Logmytech/youtube-dl-QT | 1497297719a95c4f70fbfa32e0fa4e38cdd475dc | [
"MIT"
] | 1 | 2015-02-19T13:13:47.000Z | 2015-02-19T13:13:47.000Z | youtube_dl/extractor/unistra.py | Logmytech/youtube-dl-QT | 1497297719a95c4f70fbfa32e0fa4e38cdd475dc | [
"MIT"
] | 2 | 2019-05-20T12:46:30.000Z | 2020-11-07T12:50:32.000Z | youtube_dl/extractor/unistra.py | Logmytech/youtube-dl-QT | 1497297719a95c4f70fbfa32e0fa4e38cdd475dc | [
"MIT"
] | 5 | 2020-10-25T09:18:58.000Z | 2021-05-23T22:57:55.000Z | from __future__ import unicode_literals
import re
from .common import InfoExtractor
from ..utils import qualities
class UnistraIE(InfoExtractor):
_VALID_URL = r'http://utv\.unistra\.fr/(?:index|video)\.php\?id_video\=(?P<id>\d+)'
_TESTS = [
{
'url': 'http://utv.unistra.fr/video.php?id_v... | 31.626866 | 97 | 0.511562 | from __future__ import unicode_literals
import re
from .common import InfoExtractor
from ..utils import qualities
class UnistraIE(InfoExtractor):
_VALID_URL = r'http://utv\.unistra\.fr/(?:index|video)\.php\?id_video\=(?P<id>\d+)'
_TESTS = [
{
'url': 'http://utv.unistra.fr/video.php?id_v... | true | true |
f70978813547c167df85dc88b5887caeeabba537 | 2,408 | py | Python | lab-12-2-char-seq-rnn.py | KANG91/Deep_Learning | e3e9de769ab835215d0ebeee79ff869afbe64ebf | [
"MIT"
] | null | null | null | lab-12-2-char-seq-rnn.py | KANG91/Deep_Learning | e3e9de769ab835215d0ebeee79ff869afbe64ebf | [
"MIT"
] | null | null | null | lab-12-2-char-seq-rnn.py | KANG91/Deep_Learning | e3e9de769ab835215d0ebeee79ff869afbe64ebf | [
"MIT"
] | null | null | null | import tensorflow as tf
import numpy as np
tf.set_random_seed(777) # reproducibility
sample = " if you want you"
idx2char = list(set(sample)) # index -> char
char2idx = {c: i for i, c in enumerate(idx2char)} # char -> idex
# hyper parameters
dic_size = len(char2idx) # RNN input size (one hot size)
rnn_hidden_size... | 36.484848 | 75 | 0.71387 | import tensorflow as tf
import numpy as np
tf.set_random_seed(777)
sample = " if you want you"
idx2char = list(set(sample))
char2idx = {c: i for i, c in enumerate(idx2char)}
dic_size = len(char2idx)
rnn_hidden_size = len(char2idx)
num_classes = len(char2idx)
batch_size = 1
sequence_length = len(sample)... | true | true |
f70979275ff6133599e91195e91f814fe1e7645d | 10,392 | py | Python | p2_continuous-control/agent_ddpg.py | zhulingchen/deep-reinforcement-learning | 193486659e17861208fa0a8703487e7be5868ff9 | [
"MIT"
] | null | null | null | p2_continuous-control/agent_ddpg.py | zhulingchen/deep-reinforcement-learning | 193486659e17861208fa0a8703487e7be5868ff9 | [
"MIT"
] | 4 | 2020-09-26T00:50:40.000Z | 2022-02-10T00:43:36.000Z | p2_continuous-control/agent_ddpg.py | zhulingchen/deep-reinforcement-learning | 193486659e17861208fa0a8703487e7be5868ff9 | [
"MIT"
] | null | null | null | import numpy as np
import random
import copy
from collections import namedtuple, deque
import torch
import torch.nn.functional as F
import torch.optim as optim
from model_ddpg import Actor, Critic
from replay_buffer import ReplayBuffer, PrioritizedReplayBuffer
BUFFER_SIZE = int(1e6) # replay buffer size
START_SIZE = ... | 44.410256 | 124 | 0.610277 | import numpy as np
import random
import copy
from collections import namedtuple, deque
import torch
import torch.nn.functional as F
import torch.optim as optim
from model_ddpg import Actor, Critic
from replay_buffer import ReplayBuffer, PrioritizedReplayBuffer
BUFFER_SIZE = int(1e6)
START_SIZE = 1024
BATCH_SI... | true | true |
f7097ac4b4a333a6d31d512970f1db16724cdd27 | 30,578 | py | Python | src/python/system/environment.py | acrofrank/clusterfuzz | 4b3c8b6e3beff5299f642ee139cad57c1061974f | [
"Apache-2.0"
] | 1 | 2019-11-09T23:09:00.000Z | 2019-11-09T23:09:00.000Z | src/python/system/environment.py | acrofrank/clusterfuzz | 4b3c8b6e3beff5299f642ee139cad57c1061974f | [
"Apache-2.0"
] | null | null | null | src/python/system/environment.py | acrofrank/clusterfuzz | 4b3c8b6e3beff5299f642ee139cad57c1061974f | [
"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
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, ... | 31.588843 | 80 | 0.715482 |
from builtins import range
import ast
import functools
import os
import re
import six
import socket
import sys
import yaml
try:
from shlex import quote
except ImportError:
from pipes import quote
SUPPORTED_MEMORY_TOOLS_FOR_OPTIONS = [
'HWASAN', 'ASAN', 'CFI', 'MSAN', 'TSAN', 'UBSAN'
]
SANITI... | true | true |
f7097b11985e8d3d6942661393042492e18ebdfc | 18,311 | py | Python | python/paddle/fluid/dygraph/dygraph_to_static/loop_transformer.py | muxiaoqi/Paddle | 9291c7019ae6287b5b88da138bf6bb1d3d1d8bba | [
"Apache-2.0"
] | null | null | null | python/paddle/fluid/dygraph/dygraph_to_static/loop_transformer.py | muxiaoqi/Paddle | 9291c7019ae6287b5b88da138bf6bb1d3d1d8bba | [
"Apache-2.0"
] | null | null | null | python/paddle/fluid/dygraph/dygraph_to_static/loop_transformer.py | muxiaoqi/Paddle | 9291c7019ae6287b5b88da138bf6bb1d3d1d8bba | [
"Apache-2.0"
] | null | null | null | # Copyright (c) 2020 PaddlePaddle Authors. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by app... | 36.476096 | 103 | 0.597837 |
from __future__ import print_function
import copy
import gast
from collections import defaultdict
from paddle.fluid import unique_name
from paddle.fluid.dygraph.dygraph_to_static.static_analysis import AstNodeWrapper
from paddle.fluid.dygraph.dygraph_to_static.static_analysis import StaticAnalysisVisito... | true | true |
f7097b887ec1a020df4865f96866666a50dcd027 | 1,589 | py | Python | api/tests/test_models.py | SP-Vita-Tolstikova/avt_checktwfriends | 2b5a77b1284b24ed189d8fb741a25221a15d0ab5 | [
"MIT"
] | null | null | null | api/tests/test_models.py | SP-Vita-Tolstikova/avt_checktwfriends | 2b5a77b1284b24ed189d8fb741a25221a15d0ab5 | [
"MIT"
] | null | null | null | api/tests/test_models.py | SP-Vita-Tolstikova/avt_checktwfriends | 2b5a77b1284b24ed189d8fb741a25221a15d0ab5 | [
"MIT"
] | null | null | null | """
Test module for NotFollowerTwFriend model
"""
from django.test import TestCase
from ..models import NotFollowerTwFriend
# Create your tests here.
class NotFollowerTwFriendTestCase(TestCase):
"""
Test class for NotFollowerTwFriend model
"""
def setUp(self):
NotFollowerTwFriend.objects.creat... | 44.138889 | 91 | 0.709251 | from django.test import TestCase
from ..models import NotFollowerTwFriend
class NotFollowerTwFriendTestCase(TestCase):
def setUp(self):
NotFollowerTwFriend.objects.create(
id_str='123456789',
screen_name='tw_user',
name='Twitter User',
created_at='Mon Jan 0... | true | true |
f7097b8c2b03efc35c14a367968343a8798ac543 | 1,798 | py | Python | app/templating/summary/block.py | uk-gov-mirror/ONSdigital.eq-survey-runner | b3a67a82347d024177f7fa6bf05499f47ece7ea5 | [
"MIT"
] | 27 | 2015-10-02T17:27:54.000Z | 2021-04-05T12:39:16.000Z | app/templating/summary/block.py | uk-gov-mirror/ONSdigital.eq-survey-runner | b3a67a82347d024177f7fa6bf05499f47ece7ea5 | [
"MIT"
] | 1,836 | 2015-09-16T09:59:03.000Z | 2022-03-30T14:27:06.000Z | app/templating/summary/block.py | uk-gov-mirror/ONSdigital.eq-survey-runner | b3a67a82347d024177f7fa6bf05499f47ece7ea5 | [
"MIT"
] | 20 | 2016-09-09T16:56:12.000Z | 2021-11-12T06:09:27.000Z | from flask import url_for
from app.questionnaire.rules import evaluate_skip_conditions
from app.templating.summary.question import Question
class Block:
def __init__(self, block_schema, group_id, answer_store, metadata, schema, group_instance):
self.id = block_schema['id']
self.title = block_sch... | 40.863636 | 121 | 0.640156 | from flask import url_for
from app.questionnaire.rules import evaluate_skip_conditions
from app.templating.summary.question import Question
class Block:
def __init__(self, block_schema, group_id, answer_store, metadata, schema, group_instance):
self.id = block_schema['id']
self.title = block_sch... | true | true |
f7097c0f0380fec1555929058faf1457682eb112 | 15,917 | py | Python | logicqubit/gates.py | clnrp/logicqubit | 516022186e2611eaf64a0683bcd70500695c6bbd | [
"Apache-2.0"
] | null | null | null | logicqubit/gates.py | clnrp/logicqubit | 516022186e2611eaf64a0683bcd70500695c6bbd | [
"Apache-2.0"
] | null | null | null | logicqubit/gates.py | clnrp/logicqubit | 516022186e2611eaf64a0683bcd70500695c6bbd | [
"Apache-2.0"
] | null | null | null | #!/usr/bin/python
# -*- coding: UTF-8 -*-
# Author Cleoner S. Pietralonga
# e-mail: cleonerp@gmail.com
# Apache License
from cmath import *
from logicqubit.hilbert import *
"""
In this class, the numerical definition of operators is performed,
and the quantum gates methods performs the tensor product with the matri... | 39.594527 | 120 | 0.540177 |
from cmath import *
from logicqubit.hilbert import *
class Gates(Hilbert):
def __init__(self, number_of_qubits=1):
self.__number_of_qubits = number_of_qubits
def ID(self):
M = Matrix([[1, 0], [0, 1]], self.getCuda())
return M
def P0(self):
M = Matrix([[1... | true | true |
f7097ce5e9c1d1df1ec6a26a98baacb0e39f483a | 2,709 | py | Python | plugins/module_utils/zpa_trusted_networks.py | willguibr/zpacloud_ansible | 1d95e004ffccbcef787640ccea625bb051083414 | [
"Apache-2.0"
] | 1 | 2022-02-23T08:26:45.000Z | 2022-02-23T08:26:45.000Z | plugins/module_utils/zpa_trusted_networks.py | willguibr/zpacloud_ansible | 1d95e004ffccbcef787640ccea625bb051083414 | [
"Apache-2.0"
] | 2 | 2022-02-23T21:08:09.000Z | 2022-03-01T16:45:29.000Z | plugins/module_utils/zpa_trusted_networks.py | willguibr/zpacloud-ansible | 1d95e004ffccbcef787640ccea625bb051083414 | [
"Apache-2.0"
] | null | null | null | from __future__ import absolute_import, division, print_function
__metaclass__ = type
from ansible_collections.willguibr.zpacloud.plugins.module_utils.zpa_client import (
ZPAClientHelper,
delete_none,
)
class TrustedNetworksService:
def __init__(self, module, customer_id):
self.module = module
... | 33.036585 | 86 | 0.590993 | from __future__ import absolute_import, division, print_function
__metaclass__ = type
from ansible_collections.willguibr.zpacloud.plugins.module_utils.zpa_client import (
ZPAClientHelper,
delete_none,
)
class TrustedNetworksService:
def __init__(self, module, customer_id):
self.module = module
... | true | true |
f7097d15c9ecb42b5428f69937bba55aab9bc051 | 204 | py | Python | showdown/admin.py | sunshinejen/boardgameshowdown- | 5e9b9765aba1680464d0a0ccb591019f510ed284 | [
"Apache-2.0"
] | null | null | null | showdown/admin.py | sunshinejen/boardgameshowdown- | 5e9b9765aba1680464d0a0ccb591019f510ed284 | [
"Apache-2.0"
] | null | null | null | showdown/admin.py | sunshinejen/boardgameshowdown- | 5e9b9765aba1680464d0a0ccb591019f510ed284 | [
"Apache-2.0"
] | 1 | 2019-10-16T05:57:13.000Z | 2019-10-16T05:57:13.000Z | from django.contrib import admin
from .models import BoardGame, Participant, Event
# Register your models here.
admin.site.register(BoardGame)
admin.site.register(Participant)
admin.site.register(Event)
| 25.5 | 49 | 0.818627 | from django.contrib import admin
from .models import BoardGame, Participant, Event
admin.site.register(BoardGame)
admin.site.register(Participant)
admin.site.register(Event)
| true | true |
f7097e8a7d68efba02074bc095cee9e2b8faf45a | 6,536 | py | Python | chb/simulation/SimSharedMemory.py | kestreltechnology/CodeHawk-Binary | aa0b2534e0318e5fb3770ec7b4d78feb0feb2394 | [
"MIT"
] | null | null | null | chb/simulation/SimSharedMemory.py | kestreltechnology/CodeHawk-Binary | aa0b2534e0318e5fb3770ec7b4d78feb0feb2394 | [
"MIT"
] | null | null | null | chb/simulation/SimSharedMemory.py | kestreltechnology/CodeHawk-Binary | aa0b2534e0318e5fb3770ec7b4d78feb0feb2394 | [
"MIT"
] | null | null | null | # ------------------------------------------------------------------------------
# CodeHawk Binary Analyzer
# Author: Henny Sipma
# ------------------------------------------------------------------------------
# The MIT License (MIT)
#
# Copyright (c) 2021 Aarno Labs LLC
#
# Permission is hereby granted, free of ... | 36.926554 | 87 | 0.564259 |
from typing import Dict, List, Optional, TYPE_CHECKING
from chb.simulation.SimMemory import SimMemory
import chb.simulation.SimSymbolicValue as SSV
import chb.simulation.SimUtil as SU
import chb.simulation.SimValue as SV
import chb.util.fileutil as UF
if TYPE_CHECKING:
from chb.simulat... | true | true |
f7097ff6a7ec39265a96dc285dc2098161c3638d | 7,274 | py | Python | src/compas/datastructures/mesh/remesh.py | mpopescu/compas | 55f259607deea501f862cbaea79bd97d7e56ead6 | [
"MIT"
] | null | null | null | src/compas/datastructures/mesh/remesh.py | mpopescu/compas | 55f259607deea501f862cbaea79bd97d7e56ead6 | [
"MIT"
] | null | null | null | src/compas/datastructures/mesh/remesh.py | mpopescu/compas | 55f259607deea501f862cbaea79bd97d7e56ead6 | [
"MIT"
] | null | null | null | from __future__ import print_function
from __future__ import absolute_import
from __future__ import division
from compas.datastructures.mesh.smoothing import mesh_smooth_area
from compas.datastructures.mesh.operations import trimesh_collapse_edge
from compas.datastructures.mesh.operations import trimesh_swap_edge
from... | 30.057851 | 111 | 0.532444 | from __future__ import print_function
from __future__ import absolute_import
from __future__ import division
from compas.datastructures.mesh.smoothing import mesh_smooth_area
from compas.datastructures.mesh.operations import trimesh_collapse_edge
from compas.datastructures.mesh.operations import trimesh_swap_edge
from... | true | true |
f7098021d6e538e37a267ecd884e0a951ed9d92e | 7,124 | py | Python | tests/samsung_multiroom/service/tunein/test_player_tuneinplayer.py | krygal/samsung_multiroom | 49172c4e54d092bfc6dab07245b526c442eb18bc | [
"MIT"
] | 6 | 2019-04-05T19:10:39.000Z | 2021-11-23T17:26:49.000Z | tests/samsung_multiroom/service/tunein/test_player_tuneinplayer.py | krygal/samsung_multiroom | 49172c4e54d092bfc6dab07245b526c442eb18bc | [
"MIT"
] | 3 | 2020-09-25T06:58:00.000Z | 2021-12-13T19:57:50.000Z | tests/samsung_multiroom/service/tunein/test_player_tuneinplayer.py | krygal/samsung_multiroom | 49172c4e54d092bfc6dab07245b526c442eb18bc | [
"MIT"
] | 4 | 2019-04-05T18:58:11.000Z | 2021-07-22T19:54:56.000Z | import unittest
from unittest.mock import MagicMock
from samsung_multiroom.service import REPEAT_ALL
from samsung_multiroom.service import REPEAT_OFF
from samsung_multiroom.service.tunein import TuneInPlayer
def _get_player():
api = MagicMock()
api.get_preset_list.return_value = [
{
'kind... | 29.196721 | 81 | 0.570606 | import unittest
from unittest.mock import MagicMock
from samsung_multiroom.service import REPEAT_ALL
from samsung_multiroom.service import REPEAT_OFF
from samsung_multiroom.service.tunein import TuneInPlayer
def _get_player():
api = MagicMock()
api.get_preset_list.return_value = [
{
'kind... | true | true |
f709807e8a6d21ec7d63e906aec6a61cbd27f4f0 | 7,733 | py | Python | src/egypt_model_test.py | DylanFouche/EGYPT | baa3d7cd1dc657a89a4e072b4d175e8255114961 | [
"MIT"
] | 1 | 2021-03-14T22:44:09.000Z | 2021-03-14T22:44:09.000Z | src/egypt_model_test.py | DylanFouche/EGYPT | baa3d7cd1dc657a89a4e072b4d175e8255114961 | [
"MIT"
] | null | null | null | src/egypt_model_test.py | DylanFouche/EGYPT | baa3d7cd1dc657a89a4e072b4d175e8255114961 | [
"MIT"
] | null | null | null | import egypt_model
import unittest
class TestAggregateMethods(unittest.TestCase):
def test_aggregates(self):
model = egypt_model.EgyptModel(31, 30, starting_settlements=9, starting_households=5, starting_household_size=5, starting_grain=1000)
self.assertEqual(egypt_model.compute_total_population(... | 43.201117 | 146 | 0.709298 | import egypt_model
import unittest
class TestAggregateMethods(unittest.TestCase):
def test_aggregates(self):
model = egypt_model.EgyptModel(31, 30, starting_settlements=9, starting_households=5, starting_household_size=5, starting_grain=1000)
self.assertEqual(egypt_model.compute_total_population(... | true | true |
f709816f89e0bcceb3dc86f45da921b110797cce | 403 | py | Python | lantz/drivers/sutter/__init__.py | noelniles/lantz | 08b5d23674566e200e24d8baf13e454a0917cb58 | [
"BSD-3-Clause"
] | 88 | 2015-02-10T09:49:53.000Z | 2021-11-21T20:17:44.000Z | lantz/drivers/sutter/__init__.py | varses/awsch | 6fbff4dd293d4110d002d477d2642a7e75cc9ace | [
"BSD-3-Clause"
] | 34 | 2015-02-08T05:35:21.000Z | 2021-01-04T17:45:00.000Z | lantz/drivers/sutter/__init__.py | varses/awsch | 6fbff4dd293d4110d002d477d2642a7e75cc9ace | [
"BSD-3-Clause"
] | 38 | 2015-02-11T07:25:52.000Z | 2021-11-05T02:41:53.000Z | # -*- coding: utf-8 -*-
"""
lantz.drivers.sutter
~~~~~~~~~~~~~~~~~~~~
:company: Sutter Instrument.
:description: Biomedical and scientific instrumentation.
:website: http://www.sutter.com/
---
:copyright: 2015 by Lantz Authors, see AUTHORS for more details.
:license: BSD, see LICENSE ... | 21.210526 | 68 | 0.62531 |
from .lambda103 import Lambda103
__all__ = ['Lambda103', ]
| true | true |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.