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 |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
1c2b503dcae407a91374699d400e6ce2f325764f | 1,940 | py | Python | python/test/function/test_log_softmax.py | sdonatti/nnabla | ac4a42e62dd358f16bd79c08a9a9f3d83c0100c9 | [
"Apache-2.0"
] | 1 | 2020-08-03T12:49:19.000Z | 2020-08-03T12:49:19.000Z | python/test/function/test_log_softmax.py | langbin2014/nnabla | e94bac5bed65337010e2ac07a5937fb862ab2dd8 | [
"Apache-2.0"
] | 1 | 2020-11-09T07:33:29.000Z | 2020-11-09T07:33:29.000Z | python/test/function/test_log_softmax.py | langbin2014/nnabla | e94bac5bed65337010e2ac07a5937fb862ab2dd8 | [
"Apache-2.0"
] | null | null | null | # Copyright (c) 2017 Sony 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 copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicabl... | 40.416667 | 82 | 0.713918 |
import pytest
import numpy as np
import nnabla.functions as F
from nbla_test_utils import list_context
def ref_log_softmax(x, axis):
x = x - x.max(axis, keepdims=True)
x = x - np.log(np.exp(x).sum(axis, keepdims=True))
return x
@pytest.mark.parametrize("seed", [313])
@pytest.mark.parametri... | true | true |
1c2b509e3a950854ffb86dc4c6e88bf0e9f99e61 | 3,170 | py | Python | kubernetes/client/models/v1beta2_scale_spec.py | jashandeep-sohi/kubernetes-python | e057f273069de445a2d5a250ac5fe37d79671f3b | [
"Apache-2.0"
] | 1 | 2020-05-08T12:41:04.000Z | 2020-05-08T12:41:04.000Z | kubernetes/client/models/v1beta2_scale_spec.py | jashandeep-sohi/kubernetes-python | e057f273069de445a2d5a250ac5fe37d79671f3b | [
"Apache-2.0"
] | null | null | null | kubernetes/client/models/v1beta2_scale_spec.py | jashandeep-sohi/kubernetes-python | e057f273069de445a2d5a250ac5fe37d79671f3b | [
"Apache-2.0"
] | 2 | 2021-07-09T08:49:05.000Z | 2021-08-03T18:08:36.000Z | # coding: utf-8
"""
Kubernetes
No description provided (generated by Swagger Codegen https://github.com/swagger-api/swagger-codegen)
OpenAPI spec version: v1.10.0
Generated by: https://github.com/swagger-api/swagger-codegen.git
"""
from pprint import pformat
from six import iteritems
import re... | 24.96063 | 105 | 0.547319 |
from pprint import pformat
from six import iteritems
import re
class V1beta2ScaleSpec(object):
swagger_types = {
'replicas': 'int'
}
attribute_map = {
'replicas': 'replicas'
}
def __init__(self, replicas=None):
self._replicas = None
self.discriminator = Non... | true | true |
1c2b50e3041167a0f64de7ee49838ee9ea968d07 | 1,486 | py | Python | src/item_nesting/nested_item.py | uoshvis/scrapy-examples | ba1b274543436e3856a852c62111090fdd322c60 | [
"MIT"
] | null | null | null | src/item_nesting/nested_item.py | uoshvis/scrapy-examples | ba1b274543436e3856a852c62111090fdd322c60 | [
"MIT"
] | null | null | null | src/item_nesting/nested_item.py | uoshvis/scrapy-examples | ba1b274543436e3856a852c62111090fdd322c60 | [
"MIT"
] | null | null | null | import scrapy
from scrapy.crawler import CrawlerProcess
from scrapy.item import Item, Field
class FamilyItem(Item):
name = Field()
sons = Field()
class SonsItem(Item):
name = Field()
grandsons = Field()
class GrandsonsItem(Item):
name = Field()
age = Field()
weight = Field()
class My... | 23.21875 | 130 | 0.535666 | import scrapy
from scrapy.crawler import CrawlerProcess
from scrapy.item import Item, Field
class FamilyItem(Item):
name = Field()
sons = Field()
class SonsItem(Item):
name = Field()
grandsons = Field()
class GrandsonsItem(Item):
name = Field()
age = Field()
weight = Field()
class My... | true | true |
1c2b52b2edc8446836b1d3e0ad5969f8ab03d62b | 3,922 | py | Python | bin/discovery.py | rog-works/lf3py | e89937f7aa133ed54d85764f06101ab9abf6b960 | [
"CNRI-Python"
] | null | null | null | bin/discovery.py | rog-works/lf3py | e89937f7aa133ed54d85764f06101ab9abf6b960 | [
"CNRI-Python"
] | 48 | 2020-12-19T13:47:26.000Z | 2021-01-07T22:27:56.000Z | bin/discovery.py | rog-works/lf3py | e89937f7aa133ed54d85764f06101ab9abf6b960 | [
"CNRI-Python"
] | null | null | null | from types import ModuleType
from typing import Any, Dict, List, Optional, Tuple
from typing_extensions import Protocol
from lf3py.app.app import App
from lf3py.lang.dict import deep_merge
from lf3py.lang.module import import_module
from lf3py.lang.sequence import first, flatten, last
from lf3py.middleware import Midd... | 37.352381 | 108 | 0.649414 | from types import ModuleType
from typing import Any, Dict, List, Optional, Tuple
from typing_extensions import Protocol
from lf3py.app.app import App
from lf3py.lang.dict import deep_merge
from lf3py.lang.module import import_module
from lf3py.lang.sequence import first, flatten, last
from lf3py.middleware import Midd... | true | true |
1c2b540b4943418dd69ae5877da213effcf117cb | 6,901 | py | Python | examples/vae.py | ethanabrooks/dm-haiku | 0c030422f0e3a331b6df5aa8f2fe92576444bd3b | [
"Apache-2.0"
] | null | null | null | examples/vae.py | ethanabrooks/dm-haiku | 0c030422f0e3a331b6df5aa8f2fe92576444bd3b | [
"Apache-2.0"
] | null | null | null | examples/vae.py | ethanabrooks/dm-haiku | 0c030422f0e3a331b6df5aa8f2fe92576444bd3b | [
"Apache-2.0"
] | null | null | null | # Copyright 2020 DeepMind Technologies Limited. 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 ... | 32.399061 | 99 | 0.686712 |
from typing import Generator, Mapping, Tuple, NamedTuple, Sequence
from absl import app
from absl import flags
from absl import logging
import haiku as hk
import jax
import jax.numpy as jnp
import numpy as np
import optax
import tensorflow_datasets as tfds
flags.DEFINE_integer("batch_size", 128, "Siz... | true | true |
1c2b56f9c54f6473c047b01c41373222dfecefb3 | 20,584 | py | Python | stock_report/pdf.py | pfeiffer-dev/stock-report | da9f3926a8fa5c6bc40febf1afd83c36699f19aa | [
"MIT"
] | null | null | null | stock_report/pdf.py | pfeiffer-dev/stock-report | da9f3926a8fa5c6bc40febf1afd83c36699f19aa | [
"MIT"
] | null | null | null | stock_report/pdf.py | pfeiffer-dev/stock-report | da9f3926a8fa5c6bc40febf1afd83c36699f19aa | [
"MIT"
] | null | null | null | # pdf.py
# stock-report
# Copyright 2022 Kevin Pfeiffer
# MIT License
import os
from fpdf import FPDF
from datetime import date
class PDF:
def __init__(self, data, name, ticker):
"""
Inherit PDF class with its default arguments.
"""
self.date = date.today()
self.data = da... | 46.888383 | 139 | 0.598815 |
import os
from fpdf import FPDF
from datetime import date
class PDF:
def __init__(self, data, name, ticker):
self.date = date.today()
self.data = data
self.name = name
self.ticker = ticker
self.width = 210
self.height = 297
pdf = FPDF("P", "mm", "A4... | true | true |
1c2b5707eacc35166817d17fd215e17cbfc0edcd | 1,651 | py | Python | bobenv.py | GT-melee/initial-trial | 88799120788130805927c7139c477aee06b435e1 | [
"MIT"
] | null | null | null | bobenv.py | GT-melee/initial-trial | 88799120788130805927c7139c477aee06b435e1 | [
"MIT"
] | null | null | null | bobenv.py | GT-melee/initial-trial | 88799120788130805927c7139c477aee06b435e1 | [
"MIT"
] | null | null | null | import math
import gym
from gym_minigrid.envs import EmptyEnv, MiniGridEnv, Grid, Goal
import numpy as np
from gym_minigrid.wrappers import RGBImgPartialObsWrapper, ImgObsWrapper
class _BobEnv(MiniGridEnv):
"""
Empty grid environment, no obstacles, sparse reward
"""
def __init__(self,
size,
... | 25.796875 | 79 | 0.616596 | import math
import gym
from gym_minigrid.envs import EmptyEnv, MiniGridEnv, Grid, Goal
import numpy as np
from gym_minigrid.wrappers import RGBImgPartialObsWrapper, ImgObsWrapper
class _BobEnv(MiniGridEnv):
def __init__(self,
size,
):
self.size = size
self.agent_start_pos = (1,1)
... | true | true |
1c2b596f621af73e6b9b729fb2b3b74a24f2a32f | 983 | py | Python | aliyun-python-sdk-cloudmarketing/aliyunsdkcloudmarketing/request/v20180910/RequestUploadFileRequest.py | liumihust/aliyun-openapi-python-sdk | c7b5dd4befae4b9c59181654289f9272531207ef | [
"Apache-2.0"
] | null | null | null | aliyun-python-sdk-cloudmarketing/aliyunsdkcloudmarketing/request/v20180910/RequestUploadFileRequest.py | liumihust/aliyun-openapi-python-sdk | c7b5dd4befae4b9c59181654289f9272531207ef | [
"Apache-2.0"
] | 1 | 2020-05-31T14:51:47.000Z | 2020-05-31T14:51:47.000Z | aliyun-python-sdk-cloudmarketing/aliyunsdkcloudmarketing/request/v20180910/RequestUploadFileRequest.py | liumihust/aliyun-openapi-python-sdk | c7b5dd4befae4b9c59181654289f9272531207ef | [
"Apache-2.0"
] | null | null | null | # 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 u... | 40.958333 | 80 | 0.775178 |
from aliyunsdkcore.request import RpcRequest
class RequestUploadFileRequest(RpcRequest):
def __init__(self):
RpcRequest.__init__(self, 'cloudmarketing', '2018-09-10', 'RequestUploadFile') | true | true |
1c2b59918a6ccaefb2b585c1f6d876aa8abfb389 | 556 | py | Python | collect_monitor.py | bopopescu/Lauecollect | 60ae2b05ea8596ba0decf426e37aeaca0bc8b6be | [
"MIT"
] | null | null | null | collect_monitor.py | bopopescu/Lauecollect | 60ae2b05ea8596ba0decf426e37aeaca0bc8b6be | [
"MIT"
] | 1 | 2019-10-22T21:28:31.000Z | 2019-10-22T21:39:12.000Z | collect_monitor.py | bopopescu/Lauecollect | 60ae2b05ea8596ba0decf426e37aeaca0bc8b6be | [
"MIT"
] | 2 | 2019-06-06T15:06:46.000Z | 2020-07-20T02:03:22.000Z | #!/usr/bin/env python
"""
Author: Friedrich Schotte
Date created: 2019-02-02
Date last modified: 2019-02-03
"""
from redirect import redirect
redirect("collect_monitor")
from CA import camonitor
camonitor("NIH:TIMING.registers.ch7_state.count")
camonitor("NIH:TIMING.registers.image_number.count")
camonitor("NIH:TIMING.... | 30.888889 | 55 | 0.802158 |
from redirect import redirect
redirect("collect_monitor")
from CA import camonitor
camonitor("NIH:TIMING.registers.ch7_state.count")
camonitor("NIH:TIMING.registers.image_number.count")
camonitor("NIH:TIMING.registers.xdet_count.count")
camonitor("NIH:TIMING.registers.xdet_trig_count.count")
camonitor("NIH:TIMING.regi... | true | true |
1c2b5adc03c2891478a803b74f77ab8dd34fc1e3 | 3,257 | py | Python | airflow/providers/ftp/sensors/ftp.py | dorranh/airflow | 1a9a2cadcf8606cfcb729d1323dd33dfacc64633 | [
"Apache-2.0"
] | null | null | null | airflow/providers/ftp/sensors/ftp.py | dorranh/airflow | 1a9a2cadcf8606cfcb729d1323dd33dfacc64633 | [
"Apache-2.0"
] | 1 | 2019-05-14T14:32:40.000Z | 2019-05-14T14:32:40.000Z | airflow/providers/ftp/sensors/ftp.py | dorranh/airflow | 1a9a2cadcf8606cfcb729d1323dd33dfacc64633 | [
"Apache-2.0"
] | null | null | null | # -*- coding: utf-8 -*-
#
# 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
#... | 33.57732 | 78 | 0.650906 |
import ftplib
import re
from airflow.providers.ftp.hooks.ftp import FTPHook, FTPSHook
from airflow.sensors.base_sensor_operator import BaseSensorOperator
from airflow.utils.decorators import apply_defaults
class FTPSensor(BaseSensorOperator):
template_fields = ('path',)
transient_errors =... | true | true |
1c2b5add923f0efb8e9b26f4f4bf3fd50e09fa50 | 25,746 | py | Python | mmdet/models/roi_heads/keypoint_roi_head.py | VGrondin/CBNetV2_mask_remote | b27246af5081d5395db3c3105d32226de05fcd13 | [
"Apache-2.0"
] | null | null | null | mmdet/models/roi_heads/keypoint_roi_head.py | VGrondin/CBNetV2_mask_remote | b27246af5081d5395db3c3105d32226de05fcd13 | [
"Apache-2.0"
] | null | null | null | mmdet/models/roi_heads/keypoint_roi_head.py | VGrondin/CBNetV2_mask_remote | b27246af5081d5395db3c3105d32226de05fcd13 | [
"Apache-2.0"
] | null | null | null | import numpy as np
import torch
from torch.nn import functional as F
from typing import Any, List, Tuple, Union
from detectron2.layers import cat
from mmdet.core import bbox2result, bbox2roi
from ..builder import HEADS, build_head, build_roi_extractor
from .standard_roi_head import StandardRoIHead
_TOTAL_SKIPPED = 0... | 41.592892 | 151 | 0.567273 | import numpy as np
import torch
from torch.nn import functional as F
from typing import Any, List, Tuple, Union
from detectron2.layers import cat
from mmdet.core import bbox2result, bbox2roi
from ..builder import HEADS, build_head, build_roi_extractor
from .standard_roi_head import StandardRoIHead
_TOTAL_SKIPPED = 0... | true | true |
1c2b5b7db40236f6841cb409ec51c9284c7bc93a | 38,122 | py | Python | models/rexnetv1.py | www516717402/TinyNeuralNetwork | 23e7931b4377462fad94a9ab0651b6d9a346252d | [
"MIT"
] | 241 | 2021-11-02T06:59:37.000Z | 2022-03-31T03:20:42.000Z | models/rexnetv1.py | kingkie/TinyNeuralNetwork | 9b4313bbe6fb46d602681b69799e4725eef4d71b | [
"MIT"
] | 48 | 2021-11-03T11:55:06.000Z | 2022-03-29T10:46:07.000Z | models/rexnetv1.py | kingkie/TinyNeuralNetwork | 9b4313bbe6fb46d602681b69799e4725eef4d71b | [
"MIT"
] | 41 | 2021-11-02T07:50:43.000Z | 2022-03-29T03:47:45.000Z |
import torch
import torch.nn
import torch.functional
import torch.nn.functional
class rexnetv1(torch.nn.Module):
def __init__(self):
super().__init__()
self.features_0 = torch.nn.modules.conv.Conv2d(3, 32, (3, 3), stride=(2, 2), padding=(1, 1), dilation=(1, 1), bias=False)
self.features_... | 78.118852 | 154 | 0.730444 |
import torch
import torch.nn
import torch.functional
import torch.nn.functional
class rexnetv1(torch.nn.Module):
def __init__(self):
super().__init__()
self.features_0 = torch.nn.modules.conv.Conv2d(3, 32, (3, 3), stride=(2, 2), padding=(1, 1), dilation=(1, 1), bias=False)
self.features_... | true | true |
1c2b5bec4cab56954edbec66a7e38f74ff08915c | 699 | py | Python | deciphon/task_result.py | EBI-Metagenomics/deciphon-py | 81df946c4f2f53c55ac96fc78ed2f95958b291d8 | [
"MIT"
] | null | null | null | deciphon/task_result.py | EBI-Metagenomics/deciphon-py | 81df946c4f2f53c55ac96fc78ed2f95958b291d8 | [
"MIT"
] | 1 | 2021-07-02T10:24:19.000Z | 2021-07-02T10:24:19.000Z | deciphon/task_result.py | EBI-Metagenomics/deciphon-py | 81df946c4f2f53c55ac96fc78ed2f95958b291d8 | [
"MIT"
] | null | null | null | from __future__ import annotations
from ._cdata import CData
from ._ffi import ffi, lib
from .codon_table import CodonTable
from .result import Result
__all__ = ["TaskResult"]
class TaskResult:
def __init__(self, dcp_results: CData, codon_table: CodonTable):
self._dcp_results = dcp_results
if se... | 26.884615 | 68 | 0.672389 | from __future__ import annotations
from ._cdata import CData
from ._ffi import ffi, lib
from .codon_table import CodonTable
from .result import Result
__all__ = ["TaskResult"]
class TaskResult:
def __init__(self, dcp_results: CData, codon_table: CodonTable):
self._dcp_results = dcp_results
if se... | true | true |
1c2b5c72e77f2a2281155c99de844dc719473b3f | 8,283 | py | Python | metadata-etl/src/main/resources/jython/CodeSearchExtract.py | simplesteph/WhereHows | e34bbcc629d529238a62b4bd4405713f8ee1519c | [
"ECL-2.0",
"Apache-2.0"
] | null | null | null | metadata-etl/src/main/resources/jython/CodeSearchExtract.py | simplesteph/WhereHows | e34bbcc629d529238a62b4bd4405713f8ee1519c | [
"ECL-2.0",
"Apache-2.0"
] | null | null | null | metadata-etl/src/main/resources/jython/CodeSearchExtract.py | simplesteph/WhereHows | e34bbcc629d529238a62b4bd4405713f8ee1519c | [
"ECL-2.0",
"Apache-2.0"
] | 2 | 2020-02-03T14:12:46.000Z | 2021-07-25T03:23:56.000Z | #
# Copyright 2015 LinkedIn Corp. 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 ... | 43.366492 | 119 | 0.543644 |
import sys,os,re
import requests
import subprocess
from wherehows.common import Constant
from wherehows.common.schemas import SCMOwnerRecord
from wherehows.common.writers import FileWriter
from org.slf4j import LoggerFactory
class CodeSearchExtract:
limit_search_result = 500
def... | true | true |
1c2b5cb3fc61452aed2ffa3b1df033d244d6a253 | 2,232 | py | Python | WaveBlocksND/GradientLinearCombinationHAWP.py | raoulbq/WaveBlocksND | 225b5dd9b1af1998bd40b5f6467ee959292b6a83 | [
"BSD-3-Clause"
] | 3 | 2016-09-01T21:13:54.000Z | 2020-03-23T15:45:32.000Z | WaveBlocksND/GradientLinearCombinationHAWP.py | raoulbq/WaveBlocksND | 225b5dd9b1af1998bd40b5f6467ee959292b6a83 | [
"BSD-3-Clause"
] | null | null | null | WaveBlocksND/GradientLinearCombinationHAWP.py | raoulbq/WaveBlocksND | 225b5dd9b1af1998bd40b5f6467ee959292b6a83 | [
"BSD-3-Clause"
] | 6 | 2016-03-16T15:22:01.000Z | 2021-03-13T14:06:54.000Z | """The WaveBlocks Project
Compute the action of the gradient operator applied to a
linear combination of Hagedorn wavepackets.
@author: R. Bourquin
@copyright: Copyright (C) 2013, 2014 R. Bourquin
@license: Modified BSD License
"""
from numpy import squeeze
from WaveBlocksND.Gradient import Gradient
from WaveBlocks... | 34.875 | 89 | 0.672939 |
from numpy import squeeze
from WaveBlocksND.Gradient import Gradient
from WaveBlocksND.GradientHAWP import GradientHAWP
from WaveBlocksND.LinearCombinationOfHAWPs import LinearCombinationOfHAWPs
__all__ = ["GradientLinearCombinationHAWP"]
class GradientLinearCombinationHAWP(Gradient):
def __init__(self):
... | true | true |
1c2b5cddeed73856f0a5b51097432c841f9523fa | 1,846 | py | Python | x20bf/depends/git/git/ext/gitdb/gitdb/test/db/test_git.py | bitkarrot/x20bf | cf61146fcb9aadfb4b6d6e2a45bf4ac7a3217345 | [
"Apache-2.0"
] | 4 | 2022-02-20T07:25:43.000Z | 2022-03-01T21:15:40.000Z | x20bf/depends/git/git/ext/gitdb/gitdb/test/db/test_git.py | bitkarrot/x20bf | cf61146fcb9aadfb4b6d6e2a45bf4ac7a3217345 | [
"Apache-2.0"
] | 8 | 2022-02-26T15:20:47.000Z | 2022-03-09T03:19:21.000Z | x20bf/depends/git/git/ext/gitdb/gitdb/test/db/test_git.py | bitkarrot/x20bf | cf61146fcb9aadfb4b6d6e2a45bf4ac7a3217345 | [
"Apache-2.0"
] | 2 | 2022-02-21T04:25:55.000Z | 2022-02-22T22:50:42.000Z | # Copyright (C) 2010, 2011 Sebastian Thiel (byronimo@gmail.com) and contributors
#
# This module is part of GitDB and is released under
# the New BSD License: http://www.opensource.org/licenses/bsd-license.php
import os
from gitdb.base import OInfo, OStream
from gitdb.db import GitDB
from gitdb.exc import BadObject
fr... | 34.185185 | 82 | 0.656555 |
import os
from gitdb.base import OInfo, OStream
from gitdb.db import GitDB
from gitdb.exc import BadObject
from gitdb.test.db.lib import TestDBBase, with_rw_directory
from gitdb.util import bin_to_hex
class TestGitDB(TestDBBase):
def test_reading(self):
gdb = GitDB(os.path.join(self.gitrepopath, "obj... | true | true |
1c2b5cf477d0d0e802f44eb132aa3ae05d93d7b2 | 2,199 | py | Python | app/browser_action.py | I-s-23/selenium-docker-env | 5ee0a2f3a6ca8be90d4cfb3cfcdea1fde3cf07df | [
"MIT"
] | null | null | null | app/browser_action.py | I-s-23/selenium-docker-env | 5ee0a2f3a6ca8be90d4cfb3cfcdea1fde3cf07df | [
"MIT"
] | null | null | null | app/browser_action.py | I-s-23/selenium-docker-env | 5ee0a2f3a6ca8be90d4cfb3cfcdea1fde3cf07df | [
"MIT"
] | null | null | null | # -*- coding: utf-8 -*-
from __future__ import annotations
import sys
from selenium import webdriver
from selenium.common.exceptions import TimeoutException
from webdriver_manager.chrome import ChromeDriverManager
from pyvirtualdisplay import Display
class Chrome:
def preparation(self, headless: bool, set_size=... | 30.541667 | 90 | 0.58754 |
from __future__ import annotations
import sys
from selenium import webdriver
from selenium.common.exceptions import TimeoutException
from webdriver_manager.chrome import ChromeDriverManager
from pyvirtualdisplay import Display
class Chrome:
def preparation(self, headless: bool, set_size=(0, 0)):
displ... | true | true |
1c2b5d1f0b9407169b2ba7a7623ba0fe3a0ada62 | 715 | py | Python | setup.py | sevashasla/TowerDefence | 73625d88cdb70d4c026d6f452604d193bc32c127 | [
"MIT"
] | null | null | null | setup.py | sevashasla/TowerDefence | 73625d88cdb70d4c026d6f452604d193bc32c127 | [
"MIT"
] | null | null | null | setup.py | sevashasla/TowerDefence | 73625d88cdb70d4c026d6f452604d193bc32c127 | [
"MIT"
] | null | null | null | from setuptools import setup, find_packages
import os
def read(fname):
return open(os.path.join(os.path.dirname(__file__), fname)).read()
setup(
name="TowerDefence",
version="0.0.6",
author="ArtemyBobkov & sevashasla",
url="https://github.com/sevashasla/TowerDefence",
long_description=read("... | 22.34375 | 70 | 0.604196 | from setuptools import setup, find_packages
import os
def read(fname):
return open(os.path.join(os.path.dirname(__file__), fname)).read()
setup(
name="TowerDefence",
version="0.0.6",
author="ArtemyBobkov & sevashasla",
url="https://github.com/sevashasla/TowerDefence",
long_description=read("... | true | true |
1c2b5d87f190678bdff399a2bcdc29f35b3abe34 | 709 | py | Python | mooringlicensing/migrations/0267_auto_20211007_1204.py | mintcoding/mooringlicensing | aac8cba1c84834b834a702c15b758121aeae0de7 | [
"Apache-2.0"
] | null | null | null | mooringlicensing/migrations/0267_auto_20211007_1204.py | mintcoding/mooringlicensing | aac8cba1c84834b834a702c15b758121aeae0de7 | [
"Apache-2.0"
] | null | null | null | mooringlicensing/migrations/0267_auto_20211007_1204.py | mintcoding/mooringlicensing | aac8cba1c84834b834a702c15b758121aeae0de7 | [
"Apache-2.0"
] | null | null | null | # -*- coding: utf-8 -*-
# Generated by Django 1.11.29 on 2021-10-07 04:04
from __future__ import unicode_literals
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('mooringlicensing', '0266_remove_applicationfee_fee_items'),
]
operations = [
... | 28.36 | 155 | 0.657264 |
from __future__ import unicode_literals
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('mooringlicensing', '0266_remove_applicationfee_fee_items'),
]
operations = [
migrations.RemoveField(
model_name='applicationfee',
... | true | true |
1c2b5ec53d77460426ee69f984ffe6c23061e78a | 18,163 | py | Python | platform/radio/efr32_multiphy_configurator/pyradioconfig/parts/dumbo/phys/Phys_connect.py | lmnotran/gecko_sdk | 2e82050dc8823c9fe0e8908c1b2666fb83056230 | [
"Zlib"
] | 82 | 2016-06-29T17:24:43.000Z | 2021-04-16T06:49:17.000Z | platform/radio/efr32_multiphy_configurator/pyradioconfig/parts/dumbo/phys/Phys_connect.py | lmnotran/gecko_sdk | 2e82050dc8823c9fe0e8908c1b2666fb83056230 | [
"Zlib"
] | 6 | 2022-01-12T18:22:08.000Z | 2022-03-25T10:19:27.000Z | platform/radio/efr32_multiphy_configurator/pyradioconfig/parts/dumbo/phys/Phys_connect.py | lmnotran/gecko_sdk | 2e82050dc8823c9fe0e8908c1b2666fb83056230 | [
"Zlib"
] | 56 | 2016-08-02T10:50:50.000Z | 2021-07-19T08:57:34.000Z | from pyradioconfig.calculator_model_framework.interfaces.iphy import IPhy
from py_2_and_3_compatibility import *
class PHYS_connect(IPhy):
def Connect_base(self, phy, model):
phy.profile_inputs.baudrate_tol_ppm.value = 0
phy.profile_inputs.dsss_chipping_code.value = long(0)
phy.profile_i... | 60.949664 | 140 | 0.754721 | from pyradioconfig.calculator_model_framework.interfaces.iphy import IPhy
from py_2_and_3_compatibility import *
class PHYS_connect(IPhy):
def Connect_base(self, phy, model):
phy.profile_inputs.baudrate_tol_ppm.value = 0
phy.profile_inputs.dsss_chipping_code.value = long(0)
phy.profile_i... | true | true |
1c2b5efb56224d81baa5d6537238741d384c72c3 | 470 | py | Python | src/111.minimum-depth-of-binary-tree.py | hippieZhou/The-Way-Of-LeetCode | c63d777e01413726b6214c616c20c61f8e5b330b | [
"MIT"
] | null | null | null | src/111.minimum-depth-of-binary-tree.py | hippieZhou/The-Way-Of-LeetCode | c63d777e01413726b6214c616c20c61f8e5b330b | [
"MIT"
] | null | null | null | src/111.minimum-depth-of-binary-tree.py | hippieZhou/The-Way-Of-LeetCode | c63d777e01413726b6214c616c20c61f8e5b330b | [
"MIT"
] | null | null | null | # Definition for a binary tree node.
class TreeNode:
def __init__(self, x):
self.val = x
self.left = None
self.right = None
class Solution:
def minDepth(self, root: TreeNode) -> int:
if not root:
return 0
if root.left and root.right:
return min(s... | 27.647059 | 79 | 0.589362 |
class TreeNode:
def __init__(self, x):
self.val = x
self.left = None
self.right = None
class Solution:
def minDepth(self, root: TreeNode) -> int:
if not root:
return 0
if root.left and root.right:
return min(self.minDepth(root.left), self.minDep... | true | true |
1c2b606fe7eda08c0d867b30d7c90a164e33a20c | 29,600 | py | Python | Packs/PrismaCloud/Integrations/RedLock/RedLock.py | satyakidroid/content | b5342c522d44aec8f31f4ee0fc8ad269ac970903 | [
"MIT"
] | null | null | null | Packs/PrismaCloud/Integrations/RedLock/RedLock.py | satyakidroid/content | b5342c522d44aec8f31f4ee0fc8ad269ac970903 | [
"MIT"
] | 51 | 2022-02-25T22:28:40.000Z | 2022-03-31T22:34:58.000Z | Packs/PrismaCloud/Integrations/RedLock/RedLock.py | satyakidroid/content | b5342c522d44aec8f31f4ee0fc8ad269ac970903 | [
"MIT"
] | 1 | 2021-11-27T09:12:29.000Z | 2021-11-27T09:12:29.000Z | from CommonServerPython import *
# disable insecure warnings
requests.packages.urllib3.disable_warnings() # pylint: disable=no-member
URL = ''
VERIFY = False
DEFAULT_LIMIT = 100
# Standard headers
HEADERS = {'Content-Type': 'application/json', 'Accept': '*/*'}
TOKEN = None
def get_token():
"""
Retrieve th... | 37.232704 | 121 | 0.592804 | from CommonServerPython import *
requests.packages.urllib3.disable_warnings()
URL = ''
VERIFY = False
DEFAULT_LIMIT = 100
HEADERS = {'Content-Type': 'application/json', 'Accept': '*/*'}
TOKEN = None
def get_token():
response = requests.post(URL + 'login', headers=HEADERS, verify=VERIFY, json={
'cus... | true | true |
1c2b60828b8f0fee941b317732028ca4b322668c | 3,143 | py | Python | switchboard/base.py | frankban/switchboard | 9982b36308273b5157701fd6b984238add44a047 | [
"Apache-2.0"
] | null | null | null | switchboard/base.py | frankban/switchboard | 9982b36308273b5157701fd6b984238add44a047 | [
"Apache-2.0"
] | null | null | null | switchboard/base.py | frankban/switchboard | 9982b36308273b5157701fd6b984238add44a047 | [
"Apache-2.0"
] | null | null | null | """
switchboard.base
~~~~~~~~~~~~~~~
:copyright: (c) 2015 Kyle Adams.
:license: Apache License 2.0, see LICENSE for more details.
"""
import threading
class ModelDict(threading.local):
"""
Dictionary-style access to :func:`~switchboard.model.Model` data.
If ``auto_create=True`` accessing modeldict[key]... | 28.572727 | 93 | 0.602291 |
import threading
class ModelDict(threading.local):
def __init__(self, model, key='key', auto_create=False, *args, **kwargs):
self._key = key
self._model = model
self._auto_create = auto_create
def __getitem__(self, key):
if self._auto_create:
instance = self._mode... | true | true |
1c2b62e2140ca22c2a53fafc8a0aaf485f25b2c5 | 170 | py | Python | tests/models.py | Apkawa/django-archive-field | a2d7f7550a3a3c676b6343a511f25e676b360ba3 | [
"MIT"
] | null | null | null | tests/models.py | Apkawa/django-archive-field | a2d7f7550a3a3c676b6343a511f25e676b360ba3 | [
"MIT"
] | 1 | 2019-12-17T13:06:07.000Z | 2019-12-17T13:06:07.000Z | tests/models.py | Apkawa/django-archive-field | a2d7f7550a3a3c676b6343a511f25e676b360ba3 | [
"MIT"
] | null | null | null | from django.db import models
from archive_field.fields import ArchiveFileField
class TestModel(models.Model):
archive = ArchiveFileField(upload_to='test_archive')
| 21.25 | 56 | 0.811765 | from django.db import models
from archive_field.fields import ArchiveFileField
class TestModel(models.Model):
archive = ArchiveFileField(upload_to='test_archive')
| true | true |
1c2b62eb69141adfc572ee53f5dc30246bc76465 | 1,141 | py | Python | tests/builtins/test_sorted.py | SouravJohar/voc | 82d1d03dff8619dc04cddd0e7fdfeb712f82363a | [
"BSD-3-Clause"
] | 1 | 2018-10-04T21:46:37.000Z | 2018-10-04T21:46:37.000Z | tests/builtins/test_sorted.py | SouravJohar/voc | 82d1d03dff8619dc04cddd0e7fdfeb712f82363a | [
"BSD-3-Clause"
] | null | null | null | tests/builtins/test_sorted.py | SouravJohar/voc | 82d1d03dff8619dc04cddd0e7fdfeb712f82363a | [
"BSD-3-Clause"
] | 1 | 2020-06-16T17:07:25.000Z | 2020-06-16T17:07:25.000Z | from .. utils import TranspileTestCase, BuiltinFunctionTestCase
class SortedTests(TranspileTestCase):
def test_minimal(self):
self.assertCodeExecution("""
samples = [
([1, 5, 3, 2, 4, 9, 12], None),
(["foo", "bar"], None),
(["foo", "bar"], "inval... | 30.837838 | 80 | 0.467134 | from .. utils import TranspileTestCase, BuiltinFunctionTestCase
class SortedTests(TranspileTestCase):
def test_minimal(self):
self.assertCodeExecution("""
samples = [
([1, 5, 3, 2, 4, 9, 12], None),
(["foo", "bar"], None),
(["foo", "bar"], "inval... | true | true |
1c2b63a2b5ee33eb07f1f7ba3563a844177a3538 | 5,768 | py | Python | src/cpu/StaticInstFlags.py | He-Liu-ooo/Computer-Architecture-THUEE-2022-spring- | 9d36aaacbc7eea357608524113bec97bae2ea229 | [
"BSD-3-Clause"
] | 4 | 2020-12-25T03:12:00.000Z | 2022-01-07T03:35:35.000Z | src/cpu/StaticInstFlags.py | He-Liu-ooo/Computer-Architecture-THUEE-2022-spring- | 9d36aaacbc7eea357608524113bec97bae2ea229 | [
"BSD-3-Clause"
] | 2 | 2020-09-09T15:42:46.000Z | 2020-10-22T20:45:04.000Z | src/cpu/StaticInstFlags.py | He-Liu-ooo/Computer-Architecture-THUEE-2022-spring- | 9d36aaacbc7eea357608524113bec97bae2ea229 | [
"BSD-3-Clause"
] | 3 | 2020-04-27T06:22:06.000Z | 2021-04-15T10:12:33.000Z | # Copyright (c) 2020 ARM Limited
# Copyright (c) 2003-2005 The Regents of The University of Michigan
# Copyright (c) 2013 Advanced Micro Devices, Inc.
# All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions are
# ... | 48.470588 | 77 | 0.67181 |
from m5.params import *
# behavior into the pipeline outside of fetch. Once we go to an exec-in-exec
# CPU model we should be able to get rid of these flags and implement this
# behavior via the execute() methods.
class StaticInstFlags(Enum):
wrapper_name = 'StaticInstFl... | true | true |
1c2b644bea2ff45a9fe96975432add11f8e84e34 | 4,955 | py | Python | 2016/08_Two-FactorAuthentication/test_display.py | deanearlwright/AdventOfCode | ca4cf6315c0efa38bd7748fb6f4bc99e7934871d | [
"MIT"
] | 1 | 2021-01-03T23:09:28.000Z | 2021-01-03T23:09:28.000Z | 2016/08_Two-FactorAuthentication/test_display.py | deanearlwright/AdventOfCode | ca4cf6315c0efa38bd7748fb6f4bc99e7934871d | [
"MIT"
] | 6 | 2020-12-26T21:02:42.000Z | 2020-12-26T21:02:52.000Z | 2016/08_Two-FactorAuthentication/test_display.py | deanearlwright/AdventOfCode | ca4cf6315c0efa38bd7748fb6f4bc99e7934871d | [
"MIT"
] | null | null | null | # ======================================================================
# Two-Factor Authentication
# Advent of Code 2016 Day 08 -- Eric Wastl -- https://adventofcode.com
#
# Python implementation by Dr. Dean Earl Wright III
# ======================================================================
# ================... | 34.172414 | 97 | 0.47003 |
import unittest
import aoc_08
import display
EXAMPLE_TEXT = """
rect 3x2
rotate column x=1 by 1
rotate row y=0 by 4
rotate column x=1 by 1
"""
DISPLAY_START = """.......
.......
......."""
DISPLAY_ONE = """###....
###....
......."""
DISPLAY_TWO = """#.#....
###....
.#....."""
DISPLAY_THREE = """.... | true | true |
1c2b653ecaad8665de7e54918f181253274a3a9c | 18,704 | py | Python | apper/apper/Fusion360AppEvents.py | WilkoV/Fusion360_ExportIt | ab32bcb8003aed9a9a5b29ae66a326db44d04df6 | [
"MIT"
] | 6 | 2020-09-20T01:01:16.000Z | 2022-03-30T11:35:24.000Z | apper/apper/Fusion360AppEvents.py | WilkoV/Fusion360_ExportIt | ab32bcb8003aed9a9a5b29ae66a326db44d04df6 | [
"MIT"
] | 23 | 2020-06-05T16:30:11.000Z | 2022-01-11T06:48:10.000Z | apper/apper/Fusion360AppEvents.py | WilkoV/Fusion360_ExportIt | ab32bcb8003aed9a9a5b29ae66a326db44d04df6 | [
"MIT"
] | null | null | null | """
Fusion360AppEvents.py
=====================
Python module for creating Fusion 360 event handlers
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
:copyright: (c) 2019 by Patrick Rainsberry.
:license: Apache 2.0, see LICENSE for more details.
"""
import adsk.core
import adsk.fusion
import adsk.cam
... | 35.091932 | 147 | 0.626176 | import adsk.core
import adsk.fusion
import adsk.cam
import traceback
import threading
import json
handlers = []
class Fusion360CustomThread:
def __init__(self, event_id, auto_start=True):
self.event_id = event_id
self.thread = None
self.fusion_app = None
app ... | true | true |
1c2b65979c2e2af3d50481ec12dfa21dd2dcdfa2 | 12,231 | py | Python | manila/tests/api/v1/test_scheduler_stats.py | gouthampacha/manila | 4b7ba9b99d272663f519b495668715fbf979ffbc | [
"Apache-2.0"
] | null | null | null | manila/tests/api/v1/test_scheduler_stats.py | gouthampacha/manila | 4b7ba9b99d272663f519b495668715fbf979ffbc | [
"Apache-2.0"
] | 5 | 2019-08-14T06:46:03.000Z | 2021-12-13T20:01:25.000Z | manila/tests/api/v1/test_scheduler_stats.py | gouthampacha/manila | 4b7ba9b99d272663f519b495668715fbf979ffbc | [
"Apache-2.0"
] | 2 | 2020-03-15T01:24:15.000Z | 2020-07-22T20:34:26.000Z | # Copyright (c) 2015 Clinton Knight. 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 requir... | 35.763158 | 79 | 0.484425 |
import ddt
import mock
from oslo_utils import uuidutils
from webob import exc
from manila.api.openstack import api_version_request as api_version
from manila.api.v1 import scheduler_stats
from manila import context
from manila import policy
from manila.scheduler import rpcapi
from manila.share import sha... | true | true |
1c2b66c2df3cabd37c9bb363673aedd583e96669 | 13,909 | py | Python | spherical_cluster.py | JoeyTeng/Algorithm-Selection-for-Classification-Problems-via-Cluster-based-Meta-features | 61fe5a231a0062d9939d1ccdfc0babcbe9562867 | [
"MIT"
] | 2 | 2021-08-19T14:04:25.000Z | 2022-03-17T11:37:24.000Z | spherical_cluster.py | JoeyTeng/Algorithm-Selection-for-Classification-Problems-via-Cluster-based-Meta-features | 61fe5a231a0062d9939d1ccdfc0babcbe9562867 | [
"MIT"
] | null | null | null | spherical_cluster.py | JoeyTeng/Algorithm-Selection-for-Classification-Problems-via-Cluster-based-Meta-features | 61fe5a231a0062d9939d1ccdfc0babcbe9562867 | [
"MIT"
] | 2 | 2020-04-09T10:50:50.000Z | 2021-09-28T00:50:23.000Z | # @Author: Joey Teng
# @Email: joey.teng.dev@gmail.com
# @Filename: spherical_cluster.py
# @Last modified by: Joey Teng
# @Last modified time: 25-Mar-2018
"""Obtain clusters and calculate meta-features.
Args:
dataset_filename (string): path to the dataset
Predefined types:
Point (dict): {'coordinate': (flo... | 30.636564 | 79 | 0.580272 |
import argparse
import collections
import json
import logging
import logging.handlers
import math
import multiprocessing.pool
import os
import numpy
import meta_features
INFINITESIMAL = 1e-323
PROCESS_COUNT = int(os.cpu_count() / 2)
def initialize_logger(
name='LOG',
filename=None,
le... | true | true |
1c2b67624d4b2e4333ce0b5b480b99628453e500 | 2,535 | py | Python | docs/conf.py | eriksf/reproducible_python | bd34b17ddf4b9c1eaab5c6bf18750fb53d21ac96 | [
"BSD-3-Clause"
] | 1 | 2020-07-11T03:49:59.000Z | 2020-07-11T03:49:59.000Z | docs/conf.py | eriksf/reproducible_python | bd34b17ddf4b9c1eaab5c6bf18750fb53d21ac96 | [
"BSD-3-Clause"
] | null | null | null | docs/conf.py | eriksf/reproducible_python | bd34b17ddf4b9c1eaab5c6bf18750fb53d21ac96 | [
"BSD-3-Clause"
] | null | null | null | # Configuration file for the Sphinx documentation builder.
#
# This file only contains a selection of the most common options. For a full
# list see the documentation:
# https://www.sphinx-doc.org/en/master/usage/configuration.html
# -- Path setup --------------------------------------------------------------
# If ex... | 32.922078 | 79 | 0.665483 |
import os
on_rtd = os.environ.get('READTHEDOCS', None) == 'True'
project = 'Reproducible Science - Python Packaging'
copyright = '2020, Texas Advanced Computing Center'
author = 'Texas Advanced Computing Center'
version = ''
release = ''
extensions = [
]
templates_path = ['_templates']
... | true | true |
1c2b686b543c717aea4a52684174aa319361d211 | 5,467 | py | Python | fouruc/manager/migrations/0001_initial.py | Alfareiza/4uc-manager-silver | 8a83d2a9e3630d18322c78e0fd632e73bf59a799 | [
"MIT"
] | null | null | null | fouruc/manager/migrations/0001_initial.py | Alfareiza/4uc-manager-silver | 8a83d2a9e3630d18322c78e0fd632e73bf59a799 | [
"MIT"
] | 12 | 2021-05-11T11:18:16.000Z | 2021-09-30T14:13:30.000Z | fouruc/manager/migrations/0001_initial.py | Alfareiza/4uc-manager-silver | 8a83d2a9e3630d18322c78e0fd632e73bf59a799 | [
"MIT"
] | null | null | null | # Generated by Django 3.2.2 on 2021-09-29 14:52
from django.db import migrations, models
import django.db.models.deletion
class Migration(migrations.Migration):
initial = True
dependencies = [
]
operations = [
migrations.CreateModel(
name='Account',
fields=[
... | 49.7 | 159 | 0.565209 |
from django.db import migrations, models
import django.db.models.deletion
class Migration(migrations.Migration):
initial = True
dependencies = [
]
operations = [
migrations.CreateModel(
name='Account',
fields=[
('id', models.BigAutoField(auto_create... | true | true |
1c2b687fcbe5edccf9480b9de721b1f6ece5331a | 1,873 | py | Python | peryton/Flow_analysis/list_spy.py | jweinst1/Peryton | 250fba0bf35d27c9d0e9a96d4adfdf92987189e0 | [
"Apache-2.0"
] | 97 | 2016-05-30T08:02:53.000Z | 2022-03-25T05:38:19.000Z | peryton/Flow_analysis/list_spy.py | jweinst1/Peryton | 250fba0bf35d27c9d0e9a96d4adfdf92987189e0 | [
"Apache-2.0"
] | 3 | 2016-12-26T05:18:06.000Z | 2022-03-20T22:52:41.000Z | peryton/Flow_analysis/list_spy.py | jweinst1/Peryton | 250fba0bf35d27c9d0e9a96d4adfdf92987189e0 | [
"Apache-2.0"
] | 30 | 2016-10-13T05:42:02.000Z | 2022-03-05T05:22:55.000Z | #object that allows lists to be spyed on through a process
import sys
import operator
class listspy(list):
#class the simulates an integer but collects changes to it's value
def __init__(self, *values):
self.container = [elem for elem in values]
self.operations = []
def __getattribute__(se... | 41.622222 | 81 | 0.658836 |
import sys
import operator
class listspy(list):
def __init__(self, *values):
self.container = [elem for elem in values]
self.operations = []
def __getattribute__(self, item):
if item == 'operations':
return object.__getattribute__(self, item)
elif item == '__c... | true | true |
1c2b68ca21ee50d8f9d052a9e69cdd6fbfe740eb | 1,823 | py | Python | tests/test_typeutils.py | victor-torres/andi | c77a57013ae7d6c0d871d582edf9ab6edbb73fb8 | [
"BSD-3-Clause"
] | 13 | 2019-08-28T23:08:38.000Z | 2022-03-10T14:32:21.000Z | tests/test_typeutils.py | victor-torres/andi | c77a57013ae7d6c0d871d582edf9ab6edbb73fb8 | [
"BSD-3-Clause"
] | 21 | 2020-02-10T15:26:46.000Z | 2021-02-11T18:41:12.000Z | tests/test_typeutils.py | victor-torres/andi | c77a57013ae7d6c0d871d582edf9ab6edbb73fb8 | [
"BSD-3-Clause"
] | 2 | 2020-04-27T22:08:29.000Z | 2021-04-24T02:18:25.000Z | # -*- coding: utf-8 -*-
from typing import Union, Optional
import pytest
from andi.typeutils import get_union_args, get_callable_func_obj
def test_get_union_args():
assert get_union_args(Union[str, int]) == [str, int]
def test_get_union_args_optional():
assert get_union_args(Optional[Union[str, int]]) == ... | 21.963855 | 82 | 0.665387 |
from typing import Union, Optional
import pytest
from andi.typeutils import get_union_args, get_callable_func_obj
def test_get_union_args():
assert get_union_args(Union[str, int]) == [str, int]
def test_get_union_args_optional():
assert get_union_args(Optional[Union[str, int]]) == [str, int, None.__class... | true | true |
1c2b68f04b50f0983f33a900ce9f7b937251c3b5 | 1,448 | py | Python | cride/circles/models/circles.py | mdark1001/crideApiRest | 228efec90d7f1ad8a6766b5a8085dd6bbf49fc8a | [
"MIT"
] | null | null | null | cride/circles/models/circles.py | mdark1001/crideApiRest | 228efec90d7f1ad8a6766b5a8085dd6bbf49fc8a | [
"MIT"
] | null | null | null | cride/circles/models/circles.py | mdark1001/crideApiRest | 228efec90d7f1ad8a6766b5a8085dd6bbf49fc8a | [
"MIT"
] | null | null | null | """
@author: Miguel Cabrera R. <miguel.cabrera@oohel.net>
@date: 10/04/21
@name: circles
"""
from cride.utils.models import CrideModel
from django.db import models
class Circle(CrideModel):
"""
"""
name = models.CharField(
max_length=150,
)
slug = models.SlugField(
unique=True,
... | 22.625 | 68 | 0.610497 | from cride.utils.models import CrideModel
from django.db import models
class Circle(CrideModel):
name = models.CharField(
max_length=150,
)
slug = models.SlugField(
unique=True,
max_length=40,
)
description = models.TextField(
null=True,
blank=True,
)
... | true | true |
1c2b69d0cf5b6359b4654c47953a0a04bddff8cf | 609 | py | Python | aioclustermanager/service.py | sunbit/aioclustermanager | f5a2f4ba7936a75c7748cff9f77c3bfff1a3a61d | [
"BSD-3-Clause"
] | null | null | null | aioclustermanager/service.py | sunbit/aioclustermanager | f5a2f4ba7936a75c7748cff9f77c3bfff1a3a61d | [
"BSD-3-Clause"
] | 4 | 2019-07-23T14:46:34.000Z | 2020-08-23T21:59:58.000Z | aioclustermanager/service.py | sunbit/aioclustermanager | f5a2f4ba7936a75c7748cff9f77c3bfff1a3a61d | [
"BSD-3-Clause"
] | 2 | 2020-05-21T17:32:23.000Z | 2021-05-11T12:17:56.000Z | class Service:
"""Generic job class."""
def __init__(self, namespace=None, name=None, ports=None, selector=None, type=None, data=None, **kw):
if data is not None:
self._raw = data
else:
self._raw = self.create(
namespace,
name=name,
... | 24.36 | 105 | 0.517241 | class Service:
def __init__(self, namespace=None, name=None, ports=None, selector=None, type=None, data=None, **kw):
if data is not None:
self._raw = data
else:
self._raw = self.create(
namespace,
name=name,
ports=ports,
... | true | true |
1c2b6a42b381ee7f947f4e3bd93a598d50e0e046 | 3,004 | py | Python | src/pages/event_volatility.py | PFX-Public/pfx-app | 9bc6421b49356934d1df311fe399d2bc2b37f63b | [
"MIT"
] | null | null | null | src/pages/event_volatility.py | PFX-Public/pfx-app | 9bc6421b49356934d1df311fe399d2bc2b37f63b | [
"MIT"
] | null | null | null | src/pages/event_volatility.py | PFX-Public/pfx-app | 9bc6421b49356934d1df311fe399d2bc2b37f63b | [
"MIT"
] | null | null | null | from typing import List
from pathlib import Path
import streamlit as st
import numpy as np
import pandas as pd
import matplotlib.pyplot as plt
from .event_utils import *
def render() -> None:
st.title("Event Volatility")
ccy_pairs = ['EURUSD', 'EURAUD', 'EURCAD', 'EURCHF', 'EURGBP', 'EURJPY', 'EURNZD', ... | 40.053333 | 100 | 0.643475 | from typing import List
from pathlib import Path
import streamlit as st
import numpy as np
import pandas as pd
import matplotlib.pyplot as plt
from .event_utils import *
def render() -> None:
st.title("Event Volatility")
ccy_pairs = ['EURUSD', 'EURAUD', 'EURCAD', 'EURCHF', 'EURGBP', 'EURJPY', 'EURNZD', ... | true | true |
1c2b6ab3cb65aef03242cda050e06f529b100e6f | 1,590 | py | Python | src/OTLMOW/OTLModel/Datatypes/KlOntvangerToepassing.py | davidvlaminck/OTLClassPython | 71330afeb37c3ea6d9981f521ff8f4a3f8b946fc | [
"MIT"
] | 2 | 2022-02-01T08:58:11.000Z | 2022-02-08T13:35:17.000Z | src/OTLMOW/OTLModel/Datatypes/KlOntvangerToepassing.py | davidvlaminck/OTLMOW | 71330afeb37c3ea6d9981f521ff8f4a3f8b946fc | [
"MIT"
] | null | null | null | src/OTLMOW/OTLModel/Datatypes/KlOntvangerToepassing.py | davidvlaminck/OTLMOW | 71330afeb37c3ea6d9981f521ff8f4a3f8b946fc | [
"MIT"
] | null | null | null | # coding=utf-8
from OTLMOW.OTLModel.Datatypes.KeuzelijstField import KeuzelijstField
from OTLMOW.OTLModel.Datatypes.KeuzelijstWaarde import KeuzelijstWaarde
# Generated with OTLEnumerationCreator. To modify: extend, do not edit
class KlOntvangerToepassing(KeuzelijstField):
"""Keuzelijst met modelnamen voor Ontvan... | 54.827586 | 126 | 0.64717 |
from OTLMOW.OTLModel.Datatypes.KeuzelijstField import KeuzelijstField
from OTLMOW.OTLModel.Datatypes.KeuzelijstWaarde import KeuzelijstWaarde
class KlOntvangerToepassing(KeuzelijstField):
naam = 'KlOntvangerToepassing'
label = 'Ontvanger toepassing'
objectUri = 'https://wegenenverkeer.data.vlaanderen.be... | true | true |
1c2b6b83cc21f4f9cf393e72f0fd8b6d10b253b6 | 493 | py | Python | profiles_api/urls.py | SameyaAlam/profiles-rest-api | d92772cfd53b6a7606cb612b468d4460c7645a55 | [
"MIT"
] | null | null | null | profiles_api/urls.py | SameyaAlam/profiles-rest-api | d92772cfd53b6a7606cb612b468d4460c7645a55 | [
"MIT"
] | null | null | null | profiles_api/urls.py | SameyaAlam/profiles-rest-api | d92772cfd53b6a7606cb612b468d4460c7645a55 | [
"MIT"
] | null | null | null | from django.urls import path,include
from profiles_api import views
from rest_framework.routers import DefaultRouter
router = DefaultRouter()
router.register('hello-viewset', views.HelloViewSet, basename='hello-viewset')
router.register('profiles', views.UserProfileViewSet)
router.register('feed', views.UserProfileFe... | 32.866667 | 78 | 0.768763 | from django.urls import path,include
from profiles_api import views
from rest_framework.routers import DefaultRouter
router = DefaultRouter()
router.register('hello-viewset', views.HelloViewSet, basename='hello-viewset')
router.register('profiles', views.UserProfileViewSet)
router.register('feed', views.UserProfileFe... | true | true |
1c2b6ec667cdf8df3798a7119d20da4ae586253f | 15,809 | py | Python | 05-ACGAN/acgan.py | stephenwithav/25-gans-of-04-20 | ae8c475084c95869fc3992a8c6aa5acae693377f | [
"MIT"
] | null | null | null | 05-ACGAN/acgan.py | stephenwithav/25-gans-of-04-20 | ae8c475084c95869fc3992a8c6aa5acae693377f | [
"MIT"
] | null | null | null | 05-ACGAN/acgan.py | stephenwithav/25-gans-of-04-20 | ae8c475084c95869fc3992a8c6aa5acae693377f | [
"MIT"
] | null | null | null | '''Trains ACGAN on MNIST using Keras
This version of ACGAN is similar to DCGAN. The difference mainly
is that the z-vector of geneerator is conditioned by a one-hot label
to produce specific fake images. The discriminator is trained to
discriminate real from fake images and predict the corresponding
one-hot labels.
[... | 36.594907 | 74 | 0.609906 |
from tensorflow.keras.layers import Activation, Dense, Input
from tensorflow.keras.layers import Conv2D, Flatten
from tensorflow.keras.layers import Reshape, Conv2DTranspose
from tensorflow.keras.layers import LeakyReLU
from tensorflow.keras.layers import BatchNormalization
from tensorflow.keras.layers import concate... | true | true |
1c2b6ed4432e6ada01769e62bcdbd23019e41bea | 242 | py | Python | BOJ/08000~08999/8700~8799/8716.py | shinkeonkim/today-ps | f3e5e38c5215f19579bb0422f303a9c18c626afa | [
"Apache-2.0"
] | 2 | 2020-01-29T06:54:41.000Z | 2021-11-07T13:23:27.000Z | BOJ/08000~08999/8700~8799/8716.py | shinkeonkim/Today_PS | bb0cda0ee1b9c57e1cfa38355e29d0f1c6167a44 | [
"Apache-2.0"
] | null | null | null | BOJ/08000~08999/8700~8799/8716.py | shinkeonkim/Today_PS | bb0cda0ee1b9c57e1cfa38355e29d0f1c6167a44 | [
"Apache-2.0"
] | null | null | null | A = list(map(int,input().split()))
B = list(map(int,input().split()))
if (min(A[2],B[2])-max(A[0],B[0])) < 0 or (min(A[1],B[1])-max(A[3],B[3])) < 0:
print(0)
else:
print((min(A[2],B[2])-max(A[0],B[0]))*(min(A[1],B[1])-max(A[3],B[3]))) | 40.333333 | 78 | 0.491736 | A = list(map(int,input().split()))
B = list(map(int,input().split()))
if (min(A[2],B[2])-max(A[0],B[0])) < 0 or (min(A[1],B[1])-max(A[3],B[3])) < 0:
print(0)
else:
print((min(A[2],B[2])-max(A[0],B[0]))*(min(A[1],B[1])-max(A[3],B[3]))) | true | true |
1c2b6fb7c8ea9bb292916e0effb3a81bc4e7e8fa | 3,153 | py | Python | data/p2DJ/New/program/qiskit/noisy/startQiskit_noisy208.py | UCLA-SEAL/QDiff | d968cbc47fe926b7f88b4adf10490f1edd6f8819 | [
"BSD-3-Clause"
] | null | null | null | data/p2DJ/New/program/qiskit/noisy/startQiskit_noisy208.py | UCLA-SEAL/QDiff | d968cbc47fe926b7f88b4adf10490f1edd6f8819 | [
"BSD-3-Clause"
] | null | null | null | data/p2DJ/New/program/qiskit/noisy/startQiskit_noisy208.py | UCLA-SEAL/QDiff | d968cbc47fe926b7f88b4adf10490f1edd6f8819 | [
"BSD-3-Clause"
] | null | null | null | # qubit number=2
# total number=12
import cirq
import qiskit
from qiskit.providers.aer import QasmSimulator
from qiskit.test.mock import FakeVigo
from qiskit import IBMQ
from qiskit import QuantumCircuit, QuantumRegister, ClassicalRegister
from qiskit import BasicAer, execute, transpile
from pprint import pprint
from ... | 28.151786 | 82 | 0.627022 |
import cirq
import qiskit
from qiskit.providers.aer import QasmSimulator
from qiskit.test.mock import FakeVigo
from qiskit import IBMQ
from qiskit import QuantumCircuit, QuantumRegister, ClassicalRegister
from qiskit import BasicAer, execute, transpile
from pprint import pprint
from qiskit.test.mock import FakeVigo
... | true | true |
1c2b6fce8b515def8f4278b4af8f986068125807 | 8,930 | py | Python | dynaconf/utils/__init__.py | Bernardoow/dynaconf | bb6282cf04214f13c0bcbacdb4cee65d4c9ddafb | [
"MIT"
] | null | null | null | dynaconf/utils/__init__.py | Bernardoow/dynaconf | bb6282cf04214f13c0bcbacdb4cee65d4c9ddafb | [
"MIT"
] | null | null | null | dynaconf/utils/__init__.py | Bernardoow/dynaconf | bb6282cf04214f13c0bcbacdb4cee65d4c9ddafb | [
"MIT"
] | null | null | null | import functools
import os
import warnings
from json import JSONDecoder
BANNER = """
██████╗ ██╗ ██╗███╗ ██╗ █████╗ ██████╗ ██████╗ ███╗ ██╗███████╗
██╔══██╗╚██╗ ██╔╝████╗ ██║██╔══██╗██╔════╝██╔═══██╗████╗ ██║██╔════╝
██║ ██║ ╚████╔╝ ██╔██╗ ██║███████║██║ ██║ ██║██╔██╗ ██║█████╗
██║ ██║ ╚██╔╝ ██║╚█... | 28.530351 | 79 | 0.586786 | import functools
import os
import warnings
from json import JSONDecoder
BANNER = """
██████╗ ██╗ ██╗███╗ ██╗ █████╗ ██████╗ ██████╗ ███╗ ██╗███████╗
██╔══██╗╚██╗ ██╔╝████╗ ██║██╔══██╗██╔════╝██╔═══██╗████╗ ██║██╔════╝
██║ ██║ ╚████╔╝ ██╔██╗ ██║███████║██║ ██║ ██║██╔██╗ ██║█████╗
██║ ██║ ╚██╔╝ ██║╚█... | true | true |
1c2b7048d9f5521d56350cccb5d7d760eff311ae | 6,678 | py | Python | nsff_scripts/flow_utils.py | k-washi/Neural-Scene-Flow-Fields | 7a954cf817cd8272e91f3438bed8114bcef7cc0a | [
"MIT"
] | null | null | null | nsff_scripts/flow_utils.py | k-washi/Neural-Scene-Flow-Fields | 7a954cf817cd8272e91f3438bed8114bcef7cc0a | [
"MIT"
] | null | null | null | nsff_scripts/flow_utils.py | k-washi/Neural-Scene-Flow-Fields | 7a954cf817cd8272e91f3438bed8114bcef7cc0a | [
"MIT"
] | null | null | null | import numpy as np
import os
import sys
import glob
import cv2
import scipy.io
import matplotlib
matplotlib.use('Agg')
import matplotlib.pyplot as plt
def read_img(img_dir, img1_name, img2_name):
# print(os.path.join(img_dir, img1_name + '.png'))
return cv2.imread(os.path.join(img_dir, img1_name + '.png')), cv2.i... | 25.48855 | 117 | 0.608715 | import numpy as np
import os
import sys
import glob
import cv2
import scipy.io
import matplotlib
matplotlib.use('Agg')
import matplotlib.pyplot as plt
def read_img(img_dir, img1_name, img2_name):
return cv2.imread(os.path.join(img_dir, img1_name + '.png')), cv2.imread(os.path.join(img_dir, img2_name + '.png'))
... | true | true |
1c2b7048e14c09b0f05388ac43fd85007e596a93 | 7,140 | py | Python | extra/gen_stubs.py | henry4k/dummy | 25710b38774e04a1ef9570baabd9f02b7a14e17e | [
"Unlicense"
] | null | null | null | extra/gen_stubs.py | henry4k/dummy | 25710b38774e04a1ef9570baabd9f02b7a14e17e | [
"Unlicense"
] | null | null | null | extra/gen_stubs.py | henry4k/dummy | 25710b38774e04a1ef9570baabd9f02b7a14e17e | [
"Unlicense"
] | null | null | null | #!/usr/bin/env python3.3
import re
import sys
import os.path
import argparse
class CParameter():
def __init__(self, name, type):
self.name = name
self.type = type
def __str__(self):
return '{} {}'.format(
self.type,
self.name)
def __repr__(self):
r... | 34.326923 | 106 | 0.602381 |
import re
import sys
import os.path
import argparse
class CParameter():
def __init__(self, name, type):
self.name = name
self.type = type
def __str__(self):
return '{} {}'.format(
self.type,
self.name)
def __repr__(self):
return "CParameter(name='... | true | true |
1c2b71b4e3dc14512b5483ec779dc897e2647111 | 4,854 | py | Python | LIP_model.py | julijanjug/lip2dense_v2 | 8a1147f7da1949908b703ba13cbb4dc454d22161 | [
"MIT"
] | null | null | null | LIP_model.py | julijanjug/lip2dense_v2 | 8a1147f7da1949908b703ba13cbb4dc454d22161 | [
"MIT"
] | null | null | null | LIP_model.py | julijanjug/lip2dense_v2 | 8a1147f7da1949908b703ba13cbb4dc454d22161 | [
"MIT"
] | null | null | null | import tensorflow as tf
from utils.ops import *
#------------------------network setting---------------------
#################################################
## refine net version 4. 07.17
def pose_net(image, name):
with tf.variable_scope(name) as scope:
is_BN = False
pose_conv1 = conv2d(image, 5... | 53.933333 | 118 | 0.666873 | import tensorflow as tf
from utils.ops import *
r, 512, 3, 1, relu=True, bn=is_BN, name='conv1')
conv2 = conv2d(conv1, 256, 5, 1, relu=True, bn=is_BN, name='conv2')
conv3 = conv2d(conv2, 256, 7, 1, relu=True, bn=is_BN, name='conv3')
conv4 = conv2d(conv3, 256, 9, 1, relu=True, bn=is_BN, name='conv4'... | true | true |
1c2b73c0082d64b6808b7729e0139460fbb9f8af | 137,915 | py | Python | api_server/switch_api/services/osemo/Code/OSESMO_SC2019.py | cliftbar/switch_suncode2019 | cad8fcca50a4848ba946f39aeaa624a230af679d | [
"MIT"
] | null | null | null | api_server/switch_api/services/osemo/Code/OSESMO_SC2019.py | cliftbar/switch_suncode2019 | cad8fcca50a4848ba946f39aeaa624a230af679d | [
"MIT"
] | null | null | null | api_server/switch_api/services/osemo/Code/OSESMO_SC2019.py | cliftbar/switch_suncode2019 | cad8fcca50a4848ba946f39aeaa624a230af679d | [
"MIT"
] | 1 | 2019-08-31T01:10:10.000Z | 2019-08-31T01:10:10.000Z | ## Script Description Header
# File Name: OSESMO.py
# File Location: "~/Desktop/OSESMO Git Repository"
# Project: Open-Source Energy Storage Model (OSESMO)
# Description: Simulates operation of energy storage system.
# Calculates customer savings, GHG reduction, and battery cycling.
import os
import math as math
impo... | 52.499048 | 248 | 0.665439 | th as math
import time as time
import datetime as datetime
import numpy as np
import pandas as pd
from cvxopt import matrix, sparse, solvers
import matplotlib
matplotlib.use('TkAgg')
import matplotlib.pyplot as plt
def OSESMO(Modeling_Team_Input=None, Model_Run_Number_Input=None, Model_Type_Input=None,
Mod... | true | true |
1c2b73de6e210c7cc184c6ee35f19a2fc5bc0c04 | 2,465 | py | Python | research/cv/single_path_nas/export.py | leelige/mindspore | 5199e05ba3888963473f2b07da3f7bca5b9ef6dc | [
"Apache-2.0"
] | 1 | 2021-11-18T08:17:44.000Z | 2021-11-18T08:17:44.000Z | research/cv/single_path_nas/export.py | leelige/mindspore | 5199e05ba3888963473f2b07da3f7bca5b9ef6dc | [
"Apache-2.0"
] | null | null | null | research/cv/single_path_nas/export.py | leelige/mindspore | 5199e05ba3888963473f2b07da3f7bca5b9ef6dc | [
"Apache-2.0"
] | 2 | 2019-09-01T06:17:04.000Z | 2019-10-04T08:39:45.000Z | # Copyright 2021 Huawei Technologies Co., Ltd
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to... | 44.818182 | 119 | 0.720487 |
import argparse
import numpy as np
from mindspore import Tensor, load_checkpoint, load_param_into_net, export, context
import src.spnasnet as spnasnet
from src.config import imagenet_cfg
parser = argparse.ArgumentParser(description='single-path-nas export')
parser.add_argument("--device_id", type=int, ... | true | true |
1c2b74326eae540c91b2eb24110cab90bd010e16 | 3,720 | py | Python | scripts/fonts.py | mmotl/cheatsheets | afebd6b32dc3fcfdfde0fe83fb0b74b4b795344c | [
"BSD-2-Clause"
] | 1 | 2021-03-20T18:33:02.000Z | 2021-03-20T18:33:02.000Z | scripts/fonts.py | yuxionghuang/cheatsheets | 404a2fc6675f27dc85c0f952da7864c03058a3c7 | [
"BSD-2-Clause"
] | null | null | null | scripts/fonts.py | yuxionghuang/cheatsheets | 404a2fc6675f27dc85c0f952da7864c03058a3c7 | [
"BSD-2-Clause"
] | 1 | 2021-12-21T17:15:07.000Z | 2021-12-21T17:15:07.000Z | # -----------------------------------------------------------------------------
# Matplotlib cheat sheet
# Released under the BSD License
# -----------------------------------------------------------------------------
import matplotlib.pyplot as plt
from matplotlib.font_manager import FontProperties
fig = plt.figure(f... | 33.818182 | 79 | 0.466935 |
import matplotlib.pyplot as plt
from matplotlib.font_manager import FontProperties
fig = plt.figure(figsize=(4.25, 3.8))
ax = fig.add_axes([0,0,1,1], frameon=False, xticks=[], yticks=[],
xlim=[0,40], ylim=[0,38])
y = 1
variants = {
"normal" : "../fonts/delicious-123/Delicious-Roman.otf",
... | true | true |
1c2b74e91255ed084190d5b468b11d8bbfcdb81b | 303 | py | Python | data/multilingual/Latn.NNO/Sans_16/pdf_to_json_test_Latn.NNO_Sans_16.py | antoinecarme/pdf_to_json_tests | d57a024fde862e698d916a1178f285883d7a3b2f | [
"BSD-3-Clause"
] | 1 | 2021-09-19T19:47:35.000Z | 2021-09-19T19:47:35.000Z | data/multilingual/Latn.NNO/Sans_16/pdf_to_json_test_Latn.NNO_Sans_16.py | antoinecarme/pdf_to_json_tests | d57a024fde862e698d916a1178f285883d7a3b2f | [
"BSD-3-Clause"
] | null | null | null | data/multilingual/Latn.NNO/Sans_16/pdf_to_json_test_Latn.NNO_Sans_16.py | antoinecarme/pdf_to_json_tests | d57a024fde862e698d916a1178f285883d7a3b2f | [
"BSD-3-Clause"
] | null | null | null | import pdf_to_json as p2j
import json
url = "file:data/multilingual/Latn.NNO/Sans_16/udhr_Latn.NNO_Sans_16.pdf"
lConverter = p2j.pdf_to_json.pdf_to_json_converter()
lConverter.mImageHashOnly = True
lDict = lConverter.convert(url)
print(json.dumps(lDict, indent=4, ensure_ascii=False, sort_keys=True))
| 30.3 | 73 | 0.811881 | import pdf_to_json as p2j
import json
url = "file:data/multilingual/Latn.NNO/Sans_16/udhr_Latn.NNO_Sans_16.pdf"
lConverter = p2j.pdf_to_json.pdf_to_json_converter()
lConverter.mImageHashOnly = True
lDict = lConverter.convert(url)
print(json.dumps(lDict, indent=4, ensure_ascii=False, sort_keys=True))
| true | true |
1c2b75568bc51e54d3ce8a67a1b8fcb2925bf9a8 | 5,638 | py | Python | vas/shared/Instance.py | spring-operator/vas-python-api | ce7148a2044863e078e78b47abbaafc426f732ee | [
"Apache-2.0"
] | null | null | null | vas/shared/Instance.py | spring-operator/vas-python-api | ce7148a2044863e078e78b47abbaafc426f732ee | [
"Apache-2.0"
] | null | null | null | vas/shared/Instance.py | spring-operator/vas-python-api | ce7148a2044863e078e78b47abbaafc426f732ee | [
"Apache-2.0"
] | null | null | null | # vFabric Administration Server API
# Copyright (c) 2012 VMware, 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
... | 43.369231 | 120 | 0.64828 |
from vas.shared.Deletable import Deletable
from vas.shared.Resource import Resource
from vas.util.LinkUtils import LinkUtils
class Instance(Resource, Deletable):
__group = None
__live_configurations = None
__pending_configurations = None
@property
def group(self):
self.__g... | true | true |
1c2b794452d028520cdffa11e59d2765dc7c5893 | 14,135 | py | Python | tests/test_eos_mix_methods.py | brunokiyoshi/thermo | 5b31d21fd087dd0fc3302f023c5f3c52d9cbee3b | [
"MIT"
] | null | null | null | tests/test_eos_mix_methods.py | brunokiyoshi/thermo | 5b31d21fd087dd0fc3302f023c5f3c52d9cbee3b | [
"MIT"
] | null | null | null | tests/test_eos_mix_methods.py | brunokiyoshi/thermo | 5b31d21fd087dd0fc3302f023c5f3c52d9cbee3b | [
"MIT"
] | null | null | null | # -*- coding: utf-8 -*-
'''Chemical Engineering Design Library (ChEDL). Utilities for process modeling.
Copyright (C) 2020, Caleb Bell <Caleb.Andrew.Bell@gmail.com>
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal... | 117.791667 | 1,048 | 0.79908 |
import pytest
from thermo.eos import *
from thermo.eos_mix import *
from thermo.eos_alpha_functions import *
from thermo.eos_mix_methods import *
from fluids.constants import R
from fluids.numerics import jacobian, hessian, assert_close, assert_close1d, assert_close2d, assert_close3d, derivative
from math import log,... | true | true |
1c2b79947d05c95e76c939f6ce3e06fb0419a3ae | 487 | py | Python | git_init.py | xrun0213/beginner | 7fa9bb68dceffa94c15a2c82945961cf61d995fa | [
"Apache-2.0"
] | null | null | null | git_init.py | xrun0213/beginner | 7fa9bb68dceffa94c15a2c82945961cf61d995fa | [
"Apache-2.0"
] | null | null | null | git_init.py | xrun0213/beginner | 7fa9bb68dceffa94c15a2c82945961cf61d995fa | [
"Apache-2.0"
] | null | null | null | #! usr/bin/env python3
#-*- coding:utf-8 -*-
import argparse, io, os, sys
parser = argparse.ArgumentParser()
# parser.add_argument('account', help='the account of GITHUB')
parser.add_argument('repository', help='name of the repository')
args = parser.parse_args()
cmd1 = 'git init'
cmd2 = 'git remote add origin git@g... | 24.35 | 86 | 0.698152 |
import argparse, io, os, sys
parser = argparse.ArgumentParser()
parser.add_argument('repository', help='name of the repository')
args = parser.parse_args()
cmd1 = 'git init'
cmd2 = 'git remote add origin git@github.com:xrun0213/{0}.git'.format(args.repository)
msg = '&'.join( (cmd1, cmd2) )
os.system(msg)
| true | true |
1c2b79dfe93716447fb6e457d9d92a3368f4e808 | 481 | py | Python | Python-code-snippets-101-200/141-List audio devices.py | abartoha/python-snippets-ref | 04e4feada96077f0e849b277204c012194e8fbcd | [
"Unlicense"
] | null | null | null | Python-code-snippets-101-200/141-List audio devices.py | abartoha/python-snippets-ref | 04e4feada96077f0e849b277204c012194e8fbcd | [
"Unlicense"
] | null | null | null | Python-code-snippets-101-200/141-List audio devices.py | abartoha/python-snippets-ref | 04e4feada96077f0e849b277204c012194e8fbcd | [
"Unlicense"
] | null | null | null | '''
141-List audio devices
more Python code snippets
stevepython.wordpress.com
source:
https://pbaumgarten.com/python/audio/
pip3 install pyaudio
Linux:
sudo apt-get install python-pyaudio python3-pyaudio
'''
import pyaudio
def list_devices():
p = pyaudio.PyAudio()
device_count = p.get_device_count()
f... | 19.24 | 67 | 0.704782 |
import pyaudio
def list_devices():
p = pyaudio.PyAudio()
device_count = p.get_device_count()
for i in range(0, device_count):
info = p.get_device_info_by_index(i)
print("Device {} = {}".format(info["index"], info["name"]))
list_devices()
| true | true |
1c2b7a5151f3bc3b5c321f442d7805380c9b1d7d | 2,332 | py | Python | TweetViz/TweetViz/tests/test_filter.py | alperkesen/agile-tweetviz | e5c91b6bb3d40603697da7a33f8f320f78f24867 | [
"MIT"
] | null | null | null | TweetViz/TweetViz/tests/test_filter.py | alperkesen/agile-tweetviz | e5c91b6bb3d40603697da7a33f8f320f78f24867 | [
"MIT"
] | null | null | null | TweetViz/TweetViz/tests/test_filter.py | alperkesen/agile-tweetviz | e5c91b6bb3d40603697da7a33f8f320f78f24867 | [
"MIT"
] | null | null | null | import os
import unittest
import tweepy
from TweetViz import app
class FilterTests(unittest.TestCase):
def setUp(self):
app.config['TESTING'] = True
self.app = app.test_client()
def tearDown(self):
pass
def test_tweepy_api(self):
tweepyAuth = tweepy.OAuthHandler(
... | 38.229508 | 112 | 0.620497 | import os
import unittest
import tweepy
from TweetViz import app
class FilterTests(unittest.TestCase):
def setUp(self):
app.config['TESTING'] = True
self.app = app.test_client()
def tearDown(self):
pass
def test_tweepy_api(self):
tweepyAuth = tweepy.OAuthHandler(
... | true | true |
1c2b7abd38a5e3f4e0acc5577af2eeab442d813b | 5,147 | py | Python | sharpy/plans/step_gas.py | MadManSC2/sharpy-sc2 | 13950357df2db58033daab24f076e3ae83f0b2a8 | [
"MIT"
] | 1 | 2020-03-05T19:21:56.000Z | 2020-03-05T19:21:56.000Z | sharpy/plans/step_gas.py | MadManSC2/sharpy-sc2 | 13950357df2db58033daab24f076e3ae83f0b2a8 | [
"MIT"
] | null | null | null | sharpy/plans/step_gas.py | MadManSC2/sharpy-sc2 | 13950357df2db58033daab24f076e3ae83f0b2a8 | [
"MIT"
] | null | null | null | import sc2
from sharpy.plans.acts import ActBase
from sharpy.plans.require import RequireBase
from sc2 import UnitTypeId, BotAI, Race
from sc2.constants import ALL_GAS
from sc2.unit import Unit
from sharpy.knowledges import Knowledge
class StepBuildGas(ActBase):
"""Builds a new gas mining facility close... | 38.125926 | 103 | 0.612201 | import sc2
from sharpy.plans.acts import ActBase
from sharpy.plans.require import RequireBase
from sc2 import UnitTypeId, BotAI, Race
from sc2.constants import ALL_GAS
from sc2.unit import Unit
from sharpy.knowledges import Knowledge
class StepBuildGas(ActBase):
def __init__(self, to_count: int, requi... | true | true |
1c2b7b3937375f7903705e74282e9b50748d9d58 | 2,515 | py | Python | first_app/routes.py | Stocastico/tutorial_flask | c387420a8cc7b4756bfb970636315ce03ed34b94 | [
"MIT"
] | null | null | null | first_app/routes.py | Stocastico/tutorial_flask | c387420a8cc7b4756bfb970636315ce03ed34b94 | [
"MIT"
] | null | null | null | first_app/routes.py | Stocastico/tutorial_flask | c387420a8cc7b4756bfb970636315ce03ed34b94 | [
"MIT"
] | null | null | null | from flask import render_template, flash, redirect, request, url_for
from flask_login import current_user, login_user, logout_user, login_required
from werkzeug.urls import url_parse
from flask_dance.consumer import oauth_authorized
from flask_dance.contrib.twitter import twitter
from sqlalchemy.orm.exc import NoResult... | 32.662338 | 77 | 0.669185 | from flask import render_template, flash, redirect, request, url_for
from flask_login import current_user, login_user, logout_user, login_required
from werkzeug.urls import url_parse
from flask_dance.consumer import oauth_authorized
from flask_dance.contrib.twitter import twitter
from sqlalchemy.orm.exc import NoResult... | true | true |
1c2b7bae31d71feb8023b416cd5fc16ab6aca20e | 911 | py | Python | python/mxnet/gluon/data/vision/__init__.py | Vikas-kum/incubator-mxnet | ba02bf2fe2da423caa59ddb3fd5e433b90b730bf | [
"Apache-2.0"
] | 228 | 2018-12-06T09:34:01.000Z | 2022-03-08T17:02:02.000Z | python/mxnet/gluon/data/vision/__init__.py | Vikas-kum/incubator-mxnet | ba02bf2fe2da423caa59ddb3fd5e433b90b730bf | [
"Apache-2.0"
] | 187 | 2018-03-16T23:44:43.000Z | 2021-12-14T21:19:54.000Z | python/mxnet/gluon/data/vision/__init__.py | Vikas-kum/incubator-mxnet | ba02bf2fe2da423caa59ddb3fd5e433b90b730bf | [
"Apache-2.0"
] | 58 | 2016-10-27T07:37:08.000Z | 2021-07-03T16:50:17.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 u... | 36.44 | 62 | 0.765093 |
from .datasets import *
from . import transforms
| true | true |
1c2b7c9c6596d06788472fa738d06376431b0fb9 | 1,854 | py | Python | tests/lists_tests/test_index.py | lycantropos/cppbuiltins | c1facfe06f8af33201cd64e713da93bbc14763f2 | [
"MIT"
] | 1 | 2021-08-15T11:35:45.000Z | 2021-08-15T11:35:45.000Z | tests/lists_tests/test_index.py | lycantropos/cppbuiltins | c1facfe06f8af33201cd64e713da93bbc14763f2 | [
"MIT"
] | null | null | null | tests/lists_tests/test_index.py | lycantropos/cppbuiltins | c1facfe06f8af33201cd64e713da93bbc14763f2 | [
"MIT"
] | null | null | null | from typing import (Any,
Tuple)
import pytest
from hypothesis import given
from tests.utils import AlternativeNativeListsPair
from . import strategies
@given(strategies.non_empty_lists_pairs_with_their_elements)
def test_defaults(pair_with_value: Tuple[AlternativeNativeListsPair, Any]
... | 34.333333 | 79 | 0.695254 | from typing import (Any,
Tuple)
import pytest
from hypothesis import given
from tests.utils import AlternativeNativeListsPair
from . import strategies
@given(strategies.non_empty_lists_pairs_with_their_elements)
def test_defaults(pair_with_value: Tuple[AlternativeNativeListsPair, Any]
... | true | true |
1c2b7cdc7e4f5fc598df2df5d55ec25514d76efa | 16,287 | py | Python | elasticsearch_dsl/document.py | shentianyi/elasticsearch-dsl-py | eec61aa7205ca9a6b21d6f9aa604fcb4b8d0f113 | [
"Apache-2.0"
] | 1 | 2021-02-25T04:35:51.000Z | 2021-02-25T04:35:51.000Z | elasticsearch_dsl/document.py | shentianyi/elasticsearch-dsl-py | eec61aa7205ca9a6b21d6f9aa604fcb4b8d0f113 | [
"Apache-2.0"
] | null | null | null | elasticsearch_dsl/document.py | shentianyi/elasticsearch-dsl-py | eec61aa7205ca9a6b21d6f9aa604fcb4b8d0f113 | [
"Apache-2.0"
] | 1 | 2019-05-30T06:24:31.000Z | 2019-05-30T06:24:31.000Z | try:
import collections.abc as collections_abc # only works on python 3.3+
except ImportError:
import collections as collections_abc
from fnmatch import fnmatch
from elasticsearch.exceptions import NotFoundError, RequestError
from six import iteritems, add_metaclass, string_types
from .field import Field
fr... | 36.113082 | 114 | 0.585498 | try:
import collections.abc as collections_abc
except ImportError:
import collections as collections_abc
from fnmatch import fnmatch
from elasticsearch.exceptions import NotFoundError, RequestError
from six import iteritems, add_metaclass, string_types
from .field import Field
from .mapping import Mapping
... | true | true |
1c2b7e0b08d6ae42b877f6e8ad11f555c397a023 | 14,260 | py | Python | neutron/tests/unit/nuage/test_syncmanager.py | venkataanil/juno_neutron | 2e62e150c264ccae2dd75fb78caae453eaa77e9f | [
"Apache-2.0"
] | 1 | 2021-02-19T05:54:04.000Z | 2021-02-19T05:54:04.000Z | neutron/tests/unit/nuage/test_syncmanager.py | venkataanil/juno_neutron | 2e62e150c264ccae2dd75fb78caae453eaa77e9f | [
"Apache-2.0"
] | null | null | null | neutron/tests/unit/nuage/test_syncmanager.py | venkataanil/juno_neutron | 2e62e150c264ccae2dd75fb78caae453eaa77e9f | [
"Apache-2.0"
] | 2 | 2016-11-29T11:22:58.000Z | 2016-11-29T11:54:41.000Z | # Copyright 2014 Alcatel-Lucent USA Inc.
#
# Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance with the License. You may obtain
# a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable l... | 41.574344 | 79 | 0.591865 |
import contextlib
from neutron import context
from neutron.openstack.common import uuidutils
from neutron.plugins.nuage import nuage_models
from neutron.plugins.nuage import syncmanager as sync
from neutron.tests.unit.nuage import test_netpartition
from neutron.tests.unit.nuage import test_nuage_plugin
... | true | true |
1c2b803d760833ae4012d084fc3dcf2af46c29c1 | 5,009 | py | Python | docs/conf.py | rpatil524/mlrun | bb2259a959f871d7a479834ddc55ad1470e6c2c0 | [
"Apache-2.0"
] | null | null | null | docs/conf.py | rpatil524/mlrun | bb2259a959f871d7a479834ddc55ad1470e6c2c0 | [
"Apache-2.0"
] | 1 | 2020-12-31T14:36:29.000Z | 2020-12-31T14:36:29.000Z | docs/conf.py | rpatil524/mlrun | bb2259a959f871d7a479834ddc55ad1470e6c2c0 | [
"Apache-2.0"
] | 1 | 2019-12-10T01:54:27.000Z | 2019-12-10T01:54:27.000Z | # Configuration file for the Sphinx documentation builder.
#
# This file only contains a selection of the most common options. For a full
# list see the documentation:
# https://www.sphinx-doc.org/en/master/usage/configuration.html
# -- Path setup --------------------------------------------------------------
# If ex... | 29.994012 | 79 | 0.643641 |
import re
import sys
from os import path
sys.path.insert(0, "..")
def current_version():
root = path.dirname(path.dirname(path.abspath(__file__)))
with open(f"{root}/mlrun/__init__.py") as fp:
for line in fp:
match = re.search(r"__version__\s*=\s*'([^']+)'", lin... | true | true |
1c2b80a86cbda2d9e203138fd259cb3685938830 | 4,335 | py | Python | python/orca/test/bigdl/orca/tfpark/test_tfnet.py | DirkFi/BigDL | 7493209165c046116470b9a1e1c8f527915d6f1e | [
"Apache-2.0"
] | 3 | 2021-07-14T01:28:47.000Z | 2022-03-02T01:16:32.000Z | python/orca/test/bigdl/orca/tfpark/test_tfnet.py | DirkFi/BigDL | 7493209165c046116470b9a1e1c8f527915d6f1e | [
"Apache-2.0"
] | null | null | null | python/orca/test/bigdl/orca/tfpark/test_tfnet.py | DirkFi/BigDL | 7493209165c046116470b9a1e1c8f527915d6f1e | [
"Apache-2.0"
] | null | null | null | #
# Copyright 2016 The BigDL Authors.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in ... | 40.514019 | 90 | 0.634371 |
import pytest
from bigdl.orca.test_zoo_utils import ZooTestCase
from bigdl.orca.tfpark import TFNet, TFDataset
from bigdl.dllib.utils.common import *
np.random.seed(1337)
class TestTF(ZooTestCase):
resource_path = os.path.join(os.path.split(__file__)[0], "../resources")
def test_init_tf... | true | true |
1c2b811d48251a2858ecac893eb856d9182a7692 | 1,802 | py | Python | function/python/brightics/function/transform/sample.py | sharon1321/studio | c5ce7f6db5503f5020b2aa0c6f2e6acfc61c90c5 | [
"Apache-2.0"
] | null | null | null | function/python/brightics/function/transform/sample.py | sharon1321/studio | c5ce7f6db5503f5020b2aa0c6f2e6acfc61c90c5 | [
"Apache-2.0"
] | null | null | null | function/python/brightics/function/transform/sample.py | sharon1321/studio | c5ce7f6db5503f5020b2aa0c6f2e6acfc61c90c5 | [
"Apache-2.0"
] | null | null | null | """
Copyright 2019 Samsung SDS
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 applic... | 40.954545 | 90 | 0.727525 |
from brightics.common.groupby import _function_by_group
from brightics.common.utils import check_required_parameters
from brightics.common.utils import get_default_from_parameters_if_required
from brightics.common.validation import validate
from brightics.common.validation import greater_than_or_equal_to
def... | true | true |
1c2b815b6bb28739d8726c91bc08bc3601d2ba4e | 5,781 | py | Python | test/test_selectLog.py | s-naoya/plotlog | 278c7e1d6f2af90a55bb9fa121051e00e976c1c0 | [
"MIT"
] | null | null | null | test/test_selectLog.py | s-naoya/plotlog | 278c7e1d6f2af90a55bb9fa121051e00e976c1c0 | [
"MIT"
] | null | null | null | test/test_selectLog.py | s-naoya/plotlog | 278c7e1d6f2af90a55bb9fa121051e00e976c1c0 | [
"MIT"
] | null | null | null | import unittest
from plotlog.selectlog import SelectLog
import create_exlog as ce
class TestSelectLog(unittest.TestCase):
def setUp(self):
pass
def tearDown(self):
pass
def test_get_paths_of_all(self):
self.sl = SelectLog("log/", "graph/", "YYMMDDhhmmss")
ce.create_exlog... | 40.711268 | 106 | 0.636222 | import unittest
from plotlog.selectlog import SelectLog
import create_exlog as ce
class TestSelectLog(unittest.TestCase):
def setUp(self):
pass
def tearDown(self):
pass
def test_get_paths_of_all(self):
self.sl = SelectLog("log/", "graph/", "YYMMDDhhmmss")
ce.create_exlog... | true | true |
1c2b816c781d5855b8f1a09c54df81e93d75adfb | 115 | py | Python | autotune/__version__.py | liuyangzhuan/autotune | bc24177a617025d2a47bc79563538cc6da45cfa9 | [
"BSD-2-Clause"
] | 2 | 2021-01-11T01:55:33.000Z | 2022-03-06T15:39:18.000Z | autotune/__version__.py | liuyangzhuan/autotune | bc24177a617025d2a47bc79563538cc6da45cfa9 | [
"BSD-2-Clause"
] | 2 | 2021-11-02T04:32:27.000Z | 2021-12-01T17:36:09.000Z | autotune/__version__.py | liuyangzhuan/autotune | bc24177a617025d2a47bc79563538cc6da45cfa9 | [
"BSD-2-Clause"
] | 5 | 2020-04-11T16:56:48.000Z | 2021-05-19T18:08:45.000Z | VERSION = (0, 0, 1)
__version__ = '.'.join(map(str, VERSION))
# alpha/beta/rc tags
__version_suffix__ = 'alpha0'
| 16.428571 | 41 | 0.669565 | VERSION = (0, 0, 1)
__version__ = '.'.join(map(str, VERSION))
__version_suffix__ = 'alpha0'
| true | true |
1c2b81ceac98cbc20aa92d8bf5f43895fe279a5c | 4,632 | py | Python | analysis/word2vec.py | chuajiesheng/twitter-sentiment-analysis | 7617243c953a20c517a737c79fe0f54e55aef140 | [
"Apache-2.0"
] | null | null | null | analysis/word2vec.py | chuajiesheng/twitter-sentiment-analysis | 7617243c953a20c517a737c79fe0f54e55aef140 | [
"Apache-2.0"
] | null | null | null | analysis/word2vec.py | chuajiesheng/twitter-sentiment-analysis | 7617243c953a20c517a737c79fe0f54e55aef140 | [
"Apache-2.0"
] | null | null | null | import numpy as np
from sklearn.model_selection import *
from sklearn.ensemble import *
def get_dataset():
files = ['./analysis/input/negative_tweets.txt', './analysis/input/neutral_tweets.txt', './analysis/input/positive_tweets.txt']
x = []
for file in files:
s = []
with open(file, 'r') ... | 29.692308 | 150 | 0.634283 | import numpy as np
from sklearn.model_selection import *
from sklearn.ensemble import *
def get_dataset():
files = ['./analysis/input/negative_tweets.txt', './analysis/input/neutral_tweets.txt', './analysis/input/positive_tweets.txt']
x = []
for file in files:
s = []
with open(file, 'r') ... | true | true |
1c2b81e7ab90bffaa94a18139ec9ba87b0252dae | 12,712 | py | Python | visualization/tokens_listener.py | suhasini-gesis/IWAAN | 343b48908198019e9be25332639cded204f8e7b4 | [
"MIT"
] | null | null | null | visualization/tokens_listener.py | suhasini-gesis/IWAAN | 343b48908198019e9be25332639cded204f8e7b4 | [
"MIT"
] | null | null | null | visualization/tokens_listener.py | suhasini-gesis/IWAAN | 343b48908198019e9be25332639cded204f8e7b4 | [
"MIT"
] | null | null | null | import copy
import qgrid
import pandas as pd
import numpy as np
import matplotlib.pyplot as plt
from IPython.display import display, Markdown as md, clear_output, HTML
from ipywidgets import Output, fixed
from .wordclouder import WordClouder
from .editors_listener import remove_stopwords
from datetime import datetime,... | 51.674797 | 261 | 0.590387 | import copy
import qgrid
import pandas as pd
import numpy as np
import matplotlib.pyplot as plt
from IPython.display import display, Markdown as md, clear_output, HTML
from ipywidgets import Output, fixed
from .wordclouder import WordClouder
from .editors_listener import remove_stopwords
from datetime import datetime,... | true | true |
1c2b825ce775bcdbbcb3a728e961d8a28b823a22 | 921 | py | Python | backend/game/models.py | Daanvdk/duunbox | 7ea3397a48cf34faefb856b511526bffc88598be | [
"MIT"
] | null | null | null | backend/game/models.py | Daanvdk/duunbox | 7ea3397a48cf34faefb856b511526bffc88598be | [
"MIT"
] | 5 | 2021-03-30T12:57:03.000Z | 2021-09-22T18:47:27.000Z | backend/game/models.py | daanvdk/duunbox | 7ea3397a48cf34faefb856b511526bffc88598be | [
"MIT"
] | null | null | null | from django.db import models
from django.contrib.postgres.fields import JSONField
from django.conf import settings
class Room(models.Model):
code = models.TextField(primary_key=True)
game = models.TextField(
choices=[(name, name) for name in settings.INSTALLED_GAMES],
blank=True, null=True,
... | 27.088235 | 68 | 0.703583 | from django.db import models
from django.contrib.postgres.fields import JSONField
from django.conf import settings
class Room(models.Model):
code = models.TextField(primary_key=True)
game = models.TextField(
choices=[(name, name) for name in settings.INSTALLED_GAMES],
blank=True, null=True,
... | true | true |
1c2b838887442a3c302c3d5dc6f729de862f8c98 | 13,865 | py | Python | model/extract.py | iwangjian/ByteCup2018 | c59c6a495f81c493eaaf7fda710c8acd7ef148b9 | [
"MIT"
] | 80 | 2018-09-08T01:11:36.000Z | 2022-01-18T13:41:30.000Z | model/extract.py | Whoolly/ByteCup2018 | 348bdee3215c146ef7d6e4fe1fecbe4598798c8a | [
"MIT"
] | 3 | 2018-12-02T15:08:05.000Z | 2020-02-10T04:11:28.000Z | model/extract.py | Whoolly/ByteCup2018 | 348bdee3215c146ef7d6e4fe1fecbe4598798c8a | [
"MIT"
] | 21 | 2018-10-27T07:40:25.000Z | 2022-03-28T12:30:01.000Z | import torch
import numpy as np
from torch import nn
from torch.nn import init
from torch.nn import functional as F
from .rnn import MultiLayerLSTMCells
from .rnn import lstm_encoder
from .util import sequence_mean, len_mask
from .attention import prob_normalize
from .embed_regularize import embedded_dropout
from .rnn... | 40.422741 | 114 | 0.605337 | import torch
import numpy as np
from torch import nn
from torch.nn import init
from torch.nn import functional as F
from .rnn import MultiLayerLSTMCells
from .rnn import lstm_encoder
from .util import sequence_mean, len_mask
from .attention import prob_normalize
from .embed_regularize import embedded_dropout
from .rnn... | true | true |
1c2b85511b0a7346be53799fb87eca7fbb9ef91b | 365 | py | Python | be_test/users/urls.py | greg-argulla/be_test | b745f26c5c3d63ef1bfcdbd7a71a222c6c332fd4 | [
"MIT"
] | null | null | null | be_test/users/urls.py | greg-argulla/be_test | b745f26c5c3d63ef1bfcdbd7a71a222c6c332fd4 | [
"MIT"
] | null | null | null | be_test/users/urls.py | greg-argulla/be_test | b745f26c5c3d63ef1bfcdbd7a71a222c6c332fd4 | [
"MIT"
] | null | null | null | from django.urls import path
from be_test.users.views import (
user_detail_view,
user_redirect_view,
user_update_view,
)
app_name = "users"
urlpatterns = [
path("~redirect/", view=user_redirect_view, name="redirect"),
path("~update/", view=user_update_view, name="update"),
path("<str:username>... | 24.333333 | 66 | 0.70137 | from django.urls import path
from be_test.users.views import (
user_detail_view,
user_redirect_view,
user_update_view,
)
app_name = "users"
urlpatterns = [
path("~redirect/", view=user_redirect_view, name="redirect"),
path("~update/", view=user_update_view, name="update"),
path("<str:username>... | true | true |
1c2b85b738b3b070506fd47fd2ffff0694c1fe00 | 1,481 | py | Python | tohtml.py | tcaenen/IkeaTrainTrack | 51b19250494292dd1c6da5a5d8808498c31f9b1e | [
"MIT"
] | 2 | 2017-05-10T06:13:35.000Z | 2019-06-23T09:03:12.000Z | tohtml.py | tcaenen/IkeaTrainTrack | 51b19250494292dd1c6da5a5d8808498c31f9b1e | [
"MIT"
] | 21 | 2017-05-10T12:53:25.000Z | 2017-09-24T19:22:05.000Z | tohtml.py | tcaenen/IkeaTrainTrack | 51b19250494292dd1c6da5a5d8808498c31f9b1e | [
"MIT"
] | 1 | 2020-01-28T11:06:21.000Z | 2020-01-28T11:06:21.000Z | #!/usr/local/bin/python3
"""
Render all tracks from the input into html page.
"""
import argparse
import sys
import os
import track
def write_report(tracks):
os.makedirs('report', exist_ok=True)
with open('report/index.html', 'w') as report:
report.write('<!doctype html>\n')
report.write('<b... | 26.927273 | 95 | 0.554355 |
import argparse
import sys
import os
import track
def write_report(tracks):
os.makedirs('report', exist_ok=True)
with open('report/index.html', 'w') as report:
report.write('<!doctype html>\n')
report.write('<body>\n')
report.write('<table>\n')
report.write('''<tr>
<th>descr... | true | true |
1c2b881e80ccc36f41d3949450868f43bcd38f83 | 2,601 | py | Python | generate/generate_simple.py | guoguo12/haskell-ptable | 93857351c8db915cb59e773a30c0ec77eab7ac4c | [
"Apache-2.0"
] | 1 | 2015-11-08T08:51:05.000Z | 2015-11-08T08:51:05.000Z | generate/generate_simple.py | guoguo12/haskell-ptable | 93857351c8db915cb59e773a30c0ec77eab7ac4c | [
"Apache-2.0"
] | null | null | null | generate/generate_simple.py | guoguo12/haskell-ptable | 93857351c8db915cb59e773a30c0ec77eab7ac4c | [
"Apache-2.0"
] | null | null | null | #!/usr/bin/env python
"""generate_simple.py: Generates simple Haskell chemical elements data file."""
__author__ = 'Allen Guo'
__license__ = 'Apache License'
__version__ = '2.0'
import collections
import os
import re
FIELDS = ['anum', 'symb', 'name', 'gnum', 'pnum', 'awei']
DATA_PATH = 'ptable_simple.csv'
OUTPUT_N... | 34.68 | 90 | 0.639754 |
__author__ = 'Allen Guo'
__license__ = 'Apache License'
__version__ = '2.0'
import collections
import os
import re
FIELDS = ['anum', 'symb', 'name', 'gnum', 'pnum', 'awei']
DATA_PATH = 'ptable_simple.csv'
OUTPUT_NAME = 'ptable.hs'
OUTPUT_PATH = os.path.join('..', OUTPUT_NAME)
OUTPUT_HEADER = '--%s: Simple Haskell... | true | true |
1c2b882f66594a45254e24f2e75a12183c29d43a | 31,715 | py | Python | src/bootstrap/bootstrap.py | TheSirC/rust | 823a75d9ba34860b9a6712c7a9d35e86e0a88436 | [
"ECL-2.0",
"Apache-2.0",
"MIT-0",
"MIT"
] | 518 | 2015-08-13T08:50:23.000Z | 2020-07-23T19:52:51.000Z | src/bootstrap/bootstrap.py | TheSirC/rust | 823a75d9ba34860b9a6712c7a9d35e86e0a88436 | [
"ECL-2.0",
"Apache-2.0",
"MIT-0",
"MIT"
] | 157 | 2015-08-09T12:52:55.000Z | 2020-07-19T20:02:52.000Z | src/bootstrap/bootstrap.py | TheSirC/rust | 823a75d9ba34860b9a6712c7a9d35e86e0a88436 | [
"ECL-2.0",
"Apache-2.0",
"MIT-0",
"MIT"
] | 29 | 2015-09-06T00:03:53.000Z | 2020-04-05T10:05:38.000Z | from __future__ import absolute_import, division, print_function
import argparse
import contextlib
import datetime
import hashlib
import os
import re
import shutil
import subprocess
import sys
import tarfile
import tempfile
from time import time
def get(url, path, verbose=False):
suffix = '.sha256'
sha_url =... | 36.66474 | 96 | 0.57632 | from __future__ import absolute_import, division, print_function
import argparse
import contextlib
import datetime
import hashlib
import os
import re
import shutil
import subprocess
import sys
import tarfile
import tempfile
from time import time
def get(url, path, verbose=False):
suffix = '.sha256'
sha_url =... | true | true |
1c2b88ed5ec3568339f2f644baf1031a78b8c89f | 12,105 | py | Python | sdks/python/client/argo_workflows/model/azure_file_volume_source.py | BearerPipelineTest/argo-workflows | ecd91b1c4215a2ab8742f7c43eaade98a1d47eba | [
"Apache-2.0"
] | 1 | 2022-02-24T01:45:03.000Z | 2022-02-24T01:45:03.000Z | sdks/python/client/argo_workflows/model/azure_file_volume_source.py | BearerPipelineTest/argo-workflows | ecd91b1c4215a2ab8742f7c43eaade98a1d47eba | [
"Apache-2.0"
] | 18 | 2022-02-01T23:09:58.000Z | 2022-03-31T23:28:41.000Z | sdks/python/client/argo_workflows/model/azure_file_volume_source.py | BearerPipelineTest/argo-workflows | ecd91b1c4215a2ab8742f7c43eaade98a1d47eba | [
"Apache-2.0"
] | null | null | null | """
Argo Workflows API
Argo Workflows is an open source container-native workflow engine for orchestrating parallel jobs on Kubernetes. For more information, please see https://argoproj.github.io/argo-workflows/ # noqa: E501
The version of the OpenAPI document: VERSION
Generated by: https://openapi-g... | 44.503676 | 206 | 0.580008 |
import re
import sys
from argo_workflows.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_info,
)
fro... | true | true |
1c2b88fb227d84629ce8a214ac3e7fa19aff31d5 | 2,527 | py | Python | src/datamodules/num_datamodule.py | kevin3314/gcn_ppi | 39b0e618bbb592f9cb8d37edf28deeb7c0987dad | [
"MIT"
] | null | null | null | src/datamodules/num_datamodule.py | kevin3314/gcn_ppi | 39b0e618bbb592f9cb8d37edf28deeb7c0987dad | [
"MIT"
] | 1 | 2021-12-08T02:47:10.000Z | 2021-12-08T02:47:10.000Z | src/datamodules/num_datamodule.py | kevin3314/gcn_ppi | 39b0e618bbb592f9cb8d37edf28deeb7c0987dad | [
"MIT"
] | null | null | null | from pathlib import Path
from typing import Optional, Union
from pytorch_lightning import LightningDataModule
from torch.utils.data import DataLoader, Dataset
from src.datamodules.datasets.num_dataset import NumDataset
class NumDatasetModule(LightningDataModule):
def __init__(
self,
train_csv_pa... | 33.25 | 78 | 0.629205 | from pathlib import Path
from typing import Optional, Union
from pytorch_lightning import LightningDataModule
from torch.utils.data import DataLoader, Dataset
from src.datamodules.datasets.num_dataset import NumDataset
class NumDatasetModule(LightningDataModule):
def __init__(
self,
train_csv_pa... | true | true |
1c2b897085353aa185789b82ad3aa2c503b3a00a | 3,928 | py | Python | discordbot/stocks/technical_analysis/kc.py | CameronBeebe/GamestonkTerminal | e235f09290fbc188566643e5a7be46298d33ac35 | [
"MIT"
] | 1 | 2021-12-01T02:54:28.000Z | 2021-12-01T02:54:28.000Z | discordbot/stocks/technical_analysis/kc.py | CameronBeebe/GamestonkTerminal | e235f09290fbc188566643e5a7be46298d33ac35 | [
"MIT"
] | null | null | null | discordbot/stocks/technical_analysis/kc.py | CameronBeebe/GamestonkTerminal | e235f09290fbc188566643e5a7be46298d33ac35 | [
"MIT"
] | null | null | null | import discord
import config_discordbot as cfg
from discordbot import gst_imgur
from datetime import datetime, timedelta
from matplotlib import pyplot as plt
import os
import helpers
from gamestonk_terminal.helper_funcs import plot_autoscale
from gamestonk_terminal.common.technical_analysis import volatility_model
fro... | 32.733333 | 91 | 0.588595 | import discord
import config_discordbot as cfg
from discordbot import gst_imgur
from datetime import datetime, timedelta
from matplotlib import pyplot as plt
import os
import helpers
from gamestonk_terminal.helper_funcs import plot_autoscale
from gamestonk_terminal.common.technical_analysis import volatility_model
fro... | true | true |
1c2b8a06abf17dae9e8a8c3ce166e9aebc12b8e5 | 3,198 | py | Python | examples/secret.py | ironman9356/discord.py | 65084a52df071dd2cabb806321a748a1b7e2af24 | [
"MIT"
] | 1 | 2021-08-28T04:50:31.000Z | 2021-08-28T04:50:31.000Z | examples/secret.py | ironman9356/discord.py | 65084a52df071dd2cabb806321a748a1b7e2af24 | [
"MIT"
] | null | null | null | examples/secret.py | ironman9356/discord.py | 65084a52df071dd2cabb806321a748a1b7e2af24 | [
"MIT"
] | null | null | null | import typing
import discord
from discord.ext import commands
bot = commands.Bot(command_prefix=commands.when_mentioned, description="Nothing to see here!")
# the `hidden` keyword argument hides it from the help command.
@bot.group(hidden=True)
async def secret(ctx: commands.Context):
"""What is this "secret" yo... | 32.969072 | 100 | 0.719199 | import typing
import discord
from discord.ext import commands
bot = commands.Bot(command_prefix=commands.when_mentioned, description="Nothing to see here!")
@bot.group(hidden=True)
async def secret(ctx: commands.Context):
if ctx.invoked_subcommand is None:
await ctx.send("Shh!", delete_after=5)
def cr... | true | true |
1c2b8c273175f9b60343e43eb7cc07fa5f1d8bc0 | 1,106 | py | Python | examples/impls.py | ashwinvin/Tanjun | e16e28a3be7b809762e2cdc583ae9fe9edf8a0ab | [
"BSD-3-Clause"
] | null | null | null | examples/impls.py | ashwinvin/Tanjun | e16e28a3be7b809762e2cdc583ae9fe9edf8a0ab | [
"BSD-3-Clause"
] | null | null | null | examples/impls.py | ashwinvin/Tanjun | e16e28a3be7b809762e2cdc583ae9fe9edf8a0ab | [
"BSD-3-Clause"
] | null | null | null | # -*- coding: utf-8 -*-
# cython: language_level=3
"""Placeholder for `proto`'s standard implementations including logic for injecting them."""
import typing
import examples.config
import tanjun
from examples import protos
async def connect_to_database(*args: typing.Any, **kwargs: typing.Any) -> typing.Any:
rais... | 35.677419 | 120 | 0.745027 |
import typing
import examples.config
import tanjun
from examples import protos
async def connect_to_database(*args: typing.Any, **kwargs: typing.Any) -> typing.Any:
raise NotImplementedError
class DatabaseImpl:
def __init__(self, connection: typing.Any) -> None:
self._conn = connection
@cl... | true | true |
1c2b8e04a61867b25fa43d687483bf205d9c6ce0 | 4,308 | py | Python | graphene_neo4j/settings.py | Usama0121/graphene-neo4j | 8d8c5a106b3d41851516eb7334d4f9beb8bb301c | [
"MIT"
] | null | null | null | graphene_neo4j/settings.py | Usama0121/graphene-neo4j | 8d8c5a106b3d41851516eb7334d4f9beb8bb301c | [
"MIT"
] | null | null | null | graphene_neo4j/settings.py | Usama0121/graphene-neo4j | 8d8c5a106b3d41851516eb7334d4f9beb8bb301c | [
"MIT"
] | null | null | null | """
Settings for Graphene are all namespaced in the GRAPHENE setting.
For example your project's `settings.py` file might look like this:
GRAPHENE = {
'SCHEMA': 'my_app.schema.schema'
'MIDDLEWARE': (
'graphene_neo4j.debug.DjangoDebugMiddleware',
)
}
This module provides the `graphene_settings` objec... | 29.710345 | 81 | 0.674327 | from __future__ import unicode_literals
from django.conf import settings
from django.test.signals import setting_changed
from django.utils import six
try:
import importlib
except ImportError:
from django.utils import importlib
DEFAULTS = {
"SCHEMA": None,
"SCHEMA_OUTPUT": "schema.json",
"S... | true | true |
1c2b8fae919acb7bbfb4b3891c86c5b4efb0cec8 | 315 | py | Python | python/petitBloc/ui/const.py | sol-ansano-kim/unitBlock | ba95a5e5625359d4bbab97cbf18df5ba259e1aee | [
"MIT"
] | 24 | 2018-01-17T02:58:10.000Z | 2021-08-20T20:34:08.000Z | python/petitBloc/ui/const.py | sol-ansano-kim/unitBlock | ba95a5e5625359d4bbab97cbf18df5ba259e1aee | [
"MIT"
] | 2 | 2018-12-05T08:02:49.000Z | 2021-05-21T06:57:02.000Z | python/petitBloc/ui/const.py | sol-ansano-kim/unitBlock | ba95a5e5625359d4bbab97cbf18df5ba259e1aee | [
"MIT"
] | 5 | 2018-02-06T05:40:17.000Z | 2022-03-19T06:30:20.000Z | ObjectName = "petitBloc"
ParamEditorBlockNameMaximumWidth = 300
ParamLabelMinimumWidth = 50
ParamLabelMaximumWidth = 200
LogMaximumHeight = 400
from .. import const as petitBlocConst
RootBoxName = petitBlocConst.RootBoxName
InProxyBlock = petitBlocConst.InProxyBlock
OutProxyBlock = petitBlocConst.OutProxyBlock
| 24.230769 | 44 | 0.847619 | ObjectName = "petitBloc"
ParamEditorBlockNameMaximumWidth = 300
ParamLabelMinimumWidth = 50
ParamLabelMaximumWidth = 200
LogMaximumHeight = 400
from .. import const as petitBlocConst
RootBoxName = petitBlocConst.RootBoxName
InProxyBlock = petitBlocConst.InProxyBlock
OutProxyBlock = petitBlocConst.OutProxyBlock
| true | true |
1c2b902fa54767ec48c56cb5fd6be4d410cd6e74 | 1,136 | py | Python | rest_registration/utils/verification.py | pragex/django-rest-registration | 2750b3e6d33cde15ba46d5c5b4cb683973f7b914 | [
"MIT"
] | null | null | null | rest_registration/utils/verification.py | pragex/django-rest-registration | 2750b3e6d33cde15ba46d5c5b4cb683973f7b914 | [
"MIT"
] | 4 | 2021-04-08T21:52:33.000Z | 2021-06-10T20:25:03.000Z | rest_registration/utils/verification.py | pragex/django-rest-registration | 2750b3e6d33cde15ba46d5c5b4cb683973f7b914 | [
"MIT"
] | null | null | null | from urllib.parse import urlencode
from django.core.signing import BadSignature, SignatureExpired
from django.utils.translation import gettext as _
from rest_registration.exceptions import BadRequest
def verify_signer_or_bad_request(signer):
try:
signer.verify()
except SignatureExpired:
rais... | 28.4 | 72 | 0.712148 | from urllib.parse import urlencode
from django.core.signing import BadSignature, SignatureExpired
from django.utils.translation import gettext as _
from rest_registration.exceptions import BadRequest
def verify_signer_or_bad_request(signer):
try:
signer.verify()
except SignatureExpired:
rais... | true | true |
1c2b9435d8c802973218dc178d9ea3d7468dc3f8 | 10,031 | py | Python | webapp/api.py | nairsshreya/cs257 | 4703e21bb70a313647b8cbfd0b5b7e4a5e9a28b0 | [
"MIT"
] | null | null | null | webapp/api.py | nairsshreya/cs257 | 4703e21bb70a313647b8cbfd0b5b7e4a5e9a28b0 | [
"MIT"
] | null | null | null | webapp/api.py | nairsshreya/cs257 | 4703e21bb70a313647b8cbfd0b5b7e4a5e9a28b0 | [
"MIT"
] | null | null | null | '''
api.py
Shreya Nair and Elliot Hanson, 5th November 2021
Updated 8th - 24th November, 2021
Flask API to support a national parks web application that connects to a database and uses user input to
format queries and display results.
'''
import flask
import json
import psycopg2
import config
import... | 37.85283 | 154 | 0.574021 | import flask
import json
import psycopg2
import config
import sys
api = flask.Blueprint('api', __name__)
def get_connection():
return psycopg2.connect(database=config.database,
user=config.user,
password=config.password)
def get_state():
query = '''... | true | true |
1c2b94b1aac569b3095b406511f6fdc947e04413 | 122 | py | Python | Discord_Games/__init__.py | v1s1t0r999/Discord-Games | 275bbb52fdcdb87d2116d1248619ea98e8b7d721 | [
"MIT"
] | 24 | 2021-04-03T21:18:15.000Z | 2022-03-26T09:37:53.000Z | Discord_Games/__init__.py | v1s1t0r999/Discord-Games | 275bbb52fdcdb87d2116d1248619ea98e8b7d721 | [
"MIT"
] | 7 | 2021-05-12T11:34:33.000Z | 2022-03-31T21:53:27.000Z | Discord_Games/__init__.py | v1s1t0r999/Discord-Games | 275bbb52fdcdb87d2116d1248619ea98e8b7d721 | [
"MIT"
] | 12 | 2021-05-15T13:50:10.000Z | 2022-01-17T03:42:38.000Z | __version__ = "1.6.9"
__author__ = "Tom-the-Bomb"
__license__ = "MIT"
__copyright__ = "Copyright 2021 Tom-the-Bomb" | 30.5 | 45 | 0.688525 | __version__ = "1.6.9"
__author__ = "Tom-the-Bomb"
__license__ = "MIT"
__copyright__ = "Copyright 2021 Tom-the-Bomb" | true | true |
1c2b94f5bfd726db80963fcd865ef59f20582ca1 | 8,082 | py | Python | riam_api_client/models/inline_response20033_message_tabla_desarrollo.py | RiskAmerica/api-client-python | 468c554a0440bef5086828631e25d99d41e28571 | [
"MIT"
] | null | null | null | riam_api_client/models/inline_response20033_message_tabla_desarrollo.py | RiskAmerica/api-client-python | 468c554a0440bef5086828631e25d99d41e28571 | [
"MIT"
] | null | null | null | riam_api_client/models/inline_response20033_message_tabla_desarrollo.py | RiskAmerica/api-client-python | 468c554a0440bef5086828631e25d99d41e28571 | [
"MIT"
] | 1 | 2021-04-14T15:52:03.000Z | 2021-04-14T15:52:03.000Z | # coding: utf-8
"""
APIs RISKAMERICA
A continuación les presentamos la documentación las **APIs** **de** **RiskAmerica**, el cual es un servicio pagado ofrecido por RiskAmerica que se contrata por separado a nuestras otras ofertas de software. Algunas consideraciones que debe tener al momento de usar las API... | 36.080357 | 1,070 | 0.641673 |
import pprint
import re
import six
class InlineResponse20033MessageTablaDesarrollo(object):
swagger_types = {
'fecha_cupon': 'date',
'interes': 'float',
'amortizacion': 'float',
'capital_insoluto': 'float',
'flujo': 'float'
}
attribute_map = {
'fec... | true | true |
1c2b9585be8b8a990ab91b217805fb2d1ec67fb8 | 2,517 | py | Python | tasks/task_11_CAD_cell_tally_heat/example_CAD_simulation.py | py1sl/openmc_workshop | 4468b0d9e9e57c6c7cb491d365ef2c3a019e3ecd | [
"MIT"
] | 1 | 2021-08-23T22:49:31.000Z | 2021-08-23T22:49:31.000Z | tasks/task_11_CAD_cell_tally_heat/example_CAD_simulation.py | pshriwise/neutronics-workshop | d2b80b2f73c50b94a56b98f0bb180c03ecb0a906 | [
"MIT"
] | null | null | null | tasks/task_11_CAD_cell_tally_heat/example_CAD_simulation.py | pshriwise/neutronics-workshop | d2b80b2f73c50b94a56b98f0bb180c03ecb0a906 | [
"MIT"
] | null | null | null | #!/usr/bin/env python3
"""example_CAD_simulation.py: uses a dagmc.h5m file for the geometry."""
__author__ = "Jonathan Shimwell"
import openmc
import json
import os
from neutronics_material_maker import Material
from parametric_plasma_source import Plasma
# MATERIALS using the neutronics material maker
breeder_mat... | 30.325301 | 205 | 0.756456 |
__author__ = "Jonathan Shimwell"
import openmc
import json
import os
from neutronics_material_maker import Material
from parametric_plasma_source import Plasma
breeder_material = Material(material_name='Li4SiO4', enrichment=90).openmc_material
copper = Material(material_name="copper").openmc_material
eurofer =... | true | true |
1c2b96c9e94e311f4a24da718b549b59fea95823 | 507 | py | Python | nams/solutions/io.py | nitish-awasthi/Network-Analysis-Made-Simple | 1829f63d9814c7893a1e008b8b1717da95a54ae7 | [
"MIT"
] | 853 | 2015-04-08T01:58:34.000Z | 2022-03-28T15:39:30.000Z | nams/solutions/io.py | alex-soldatkin/Network-Analysis-Made-Simple | 85328910d90ce0540476c8ffe7bf026dce7dc8c5 | [
"MIT"
] | 177 | 2015-08-08T05:33:06.000Z | 2022-03-21T15:43:07.000Z | nams/solutions/io.py | alex-soldatkin/Network-Analysis-Made-Simple | 85328910d90ce0540476c8ffe7bf026dce7dc8c5 | [
"MIT"
] | 390 | 2015-03-28T02:22:34.000Z | 2022-03-24T18:47:43.000Z | """Solutions to I/O chapter"""
def filter_graph(G, minimum_num_trips):
"""
Filter the graph such that
only edges that have minimum_num_trips or more
are present.
"""
G_filtered = G.copy()
for u, v, d in G.edges(data=True):
if d["num_trips"] < minimum_num_trips:
G_filter... | 24.142857 | 50 | 0.631164 |
def filter_graph(G, minimum_num_trips):
G_filtered = G.copy()
for u, v, d in G.edges(data=True):
if d["num_trips"] < minimum_num_trips:
G_filtered.remove_edge(u, v)
return G_filtered
def test_graph_integrity(G):
assert len(G.nodes()) == 300
assert len(G.edges()) == 44422
| true | true |
1c2b979139a59f1ab39a1be1902c8412e0c51c9a | 12,928 | py | Python | wifipumpkin3/core/wirelessmode/docker.py | paramint/wifipumpkin3 | cd985184d471a85d0a7b1c826b93f798ef478772 | [
"Apache-2.0"
] | 1 | 2021-02-03T22:54:35.000Z | 2021-02-03T22:54:35.000Z | wifipumpkin3/core/wirelessmode/docker.py | quang9bh/wifipumpkin3 | f372012daf7936e4597c067e8337c124c9c0042b | [
"Apache-2.0"
] | 1 | 2021-02-10T16:12:08.000Z | 2021-02-10T16:12:08.000Z | wifipumpkin3/core/wirelessmode/docker.py | quang9bh/wifipumpkin3 | f372012daf7936e4597c067e8337c124c9c0042b | [
"Apache-2.0"
] | null | null | null | from wifipumpkin3.core.config.globalimport import *
import weakref
from os import system, path, getcwd, popen, listdir, mkdir, chown
from pwd import getpwnam
from grp import getgrnam
from time import asctime
from subprocess import check_output, Popen, PIPE, STDOUT, CalledProcessError, call
from wifipumpkin3.core.contro... | 42.110749 | 93 | 0.546643 | from wifipumpkin3.core.config.globalimport import *
import weakref
from os import system, path, getcwd, popen, listdir, mkdir, chown
from pwd import getpwnam
from grp import getgrnam
from time import asctime
from subprocess import check_output, Popen, PIPE, STDOUT, CalledProcessError, call
from wifipumpkin3.core.contro... | true | true |
1c2b97e7cb9d89cc18c7b84286ca91c8ae9fc482 | 827 | py | Python | backend/app/core/tests/test_models.py | DBankx/qlip_py | 0e5622c45ce6a817e24583e9f395f9391f7e6361 | [
"MIT"
] | null | null | null | backend/app/core/tests/test_models.py | DBankx/qlip_py | 0e5622c45ce6a817e24583e9f395f9391f7e6361 | [
"MIT"
] | null | null | null | backend/app/core/tests/test_models.py | DBankx/qlip_py | 0e5622c45ce6a817e24583e9f395f9391f7e6361 | [
"MIT"
] | null | null | null | from django.test import TestCase
from rest_framework.test import APIClient
from rest_framework import status
from django.contrib.auth import get_user_model
class TestModels(TestCase):
"""Test database models"""
def setUp(self):
self.test_email = 'test@test.com'
self.test_password = 'Pa$$w0rd'
self.first_name ... | 33.08 | 175 | 0.783555 | from django.test import TestCase
from rest_framework.test import APIClient
from rest_framework import status
from django.contrib.auth import get_user_model
class TestModels(TestCase):
def setUp(self):
self.test_email = 'test@test.com'
self.test_password = 'Pa$$w0rd'
self.first_name = 'Test'
self.last_name = ... | true | true |
1c2b9a0bea0e5ad14b22a7621c2559944af40027 | 1,577 | py | Python | setup.py | jsfehler/pytest-match-skip | 2e907b528c155bd95d90d45e1cdf3d96f0df608d | [
"MIT"
] | 2 | 2018-04-13T05:37:31.000Z | 2019-07-19T21:53:20.000Z | setup.py | jsfehler/pytest-match-skip | 2e907b528c155bd95d90d45e1cdf3d96f0df608d | [
"MIT"
] | 3 | 2017-10-05T11:42:55.000Z | 2019-05-08T15:55:38.000Z | setup.py | jsfehler/pytest-match-skip | 2e907b528c155bd95d90d45e1cdf3d96f0df608d | [
"MIT"
] | 1 | 2017-10-02T15:02:54.000Z | 2017-10-02T15:02:54.000Z | #!/usr/bin/env python
# -*- coding: utf-8 -*-
import os
from setuptools import setup
def read(fname):
file_path = os.path.join(os.path.dirname(__file__), fname)
with open(file_path, 'r') as f:
return f.read()
setup(
name='pytest-match-skip',
version='0.2.1',
author='Joshua Fehler',
... | 30.921569 | 78 | 0.607483 |
import os
from setuptools import setup
def read(fname):
file_path = os.path.join(os.path.dirname(__file__), fname)
with open(file_path, 'r') as f:
return f.read()
setup(
name='pytest-match-skip',
version='0.2.1',
author='Joshua Fehler',
author_email='jsfehler@gmail.com',
main... | true | true |
1c2b9b26d4dfe531f0458928aa5bc51aa6683e42 | 3,452 | py | Python | brownie/test/stateful.py | AlanVerbner/brownie | c41311d30d7d0b25d32e83caa4943209969ceee0 | [
"MIT"
] | null | null | null | brownie/test/stateful.py | AlanVerbner/brownie | c41311d30d7d0b25d32e83caa4943209969ceee0 | [
"MIT"
] | null | null | null | brownie/test/stateful.py | AlanVerbner/brownie | c41311d30d7d0b25d32e83caa4943209969ceee0 | [
"MIT"
] | 1 | 2020-08-30T01:18:53.000Z | 2020-08-30T01:18:53.000Z | #!/usr/bin/python3
import sys
from collections import deque
from inspect import getmembers
from types import FunctionType
from typing import Any, Optional
from hypothesis import settings as hp_settings
from hypothesis import stateful as sf
from hypothesis.strategies import SearchStrategy
import brownie
from brownie.... | 31.669725 | 99 | 0.641367 |
import sys
from collections import deque
from inspect import getmembers
from types import FunctionType
from typing import Any, Optional
from hypothesis import settings as hp_settings
from hypothesis import stateful as sf
from hypothesis.strategies import SearchStrategy
import brownie
from brownie.utils import color... | true | true |
1c2b9dc7b756c2d3c66afbf2db52e2f1e4fe8fa4 | 1,213 | py | Python | src/main/python/fearank/ranking/RandomForestClassifierScore.py | catilgan/featureranking | b37fdba4aa0adf678e3e415e909bbdc54a977b07 | [
"BSD-3-Clause"
] | null | null | null | src/main/python/fearank/ranking/RandomForestClassifierScore.py | catilgan/featureranking | b37fdba4aa0adf678e3e415e909bbdc54a977b07 | [
"BSD-3-Clause"
] | 7 | 2019-07-30T09:22:18.000Z | 2019-07-30T09:42:45.000Z | src/main/python/fearank/ranking/RandomForestClassifierScore.py | catilgan/featureranking | b37fdba4aa0adf678e3e415e909bbdc54a977b07 | [
"BSD-3-Clause"
] | 1 | 2020-04-07T12:54:19.000Z | 2020-04-07T12:54:19.000Z | from sklearn.ensemble import RandomForestClassifier
from fearank.ranking.Ranking import Ranking
class RandomForestClassifierScore(Ranking):
"""Select features according to Mutual Info Regression.
"""
TYPE = 'random_forest_classifier'
@staticmethod
def execute(data, cols):
return Ranking... | 30.325 | 110 | 0.703215 | from sklearn.ensemble import RandomForestClassifier
from fearank.ranking.Ranking import Ranking
class RandomForestClassifierScore(Ranking):
TYPE = 'random_forest_classifier'
@staticmethod
def execute(data, cols):
return Ranking._execute_single(RandomForestClassifierScore._execute_ranking_sorted... | true | true |
1c2b9e11330dff349d1ec406c6330edeaf4d9929 | 2,969 | py | Python | scripts/internal/print_announce.py | alxchk/psutil | 550ae6f8119f2d4607d283e9fc224ead24862d1a | [
"BSD-3-Clause"
] | 1 | 2021-08-14T13:48:32.000Z | 2021-08-14T13:48:32.000Z | scripts/internal/print_announce.py | alxchk/psutil | 550ae6f8119f2d4607d283e9fc224ead24862d1a | [
"BSD-3-Clause"
] | 1 | 2018-04-15T22:59:15.000Z | 2018-04-15T22:59:15.000Z | scripts/internal/print_announce.py | alxchk/psutil | 550ae6f8119f2d4607d283e9fc224ead24862d1a | [
"BSD-3-Clause"
] | null | null | null | #!/usr/bin/env python
# Copyright (c) 2009 Giampaolo Rodola'. All rights reserved.
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
"""
Prints release announce based on HISTORY.rst file content.
"""
import os
import re
from psutil import __version__ as PRJ_VERSIO... | 25.594828 | 79 | 0.659818 |
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
import os
import re
from psutil import __version__ as PRJ_VERSION
HERE = os.path.abspath(os.path.dirname(__file__))
HISTORY = os.path.abspath(os.path.join(HERE, '../../HISTORY.rst'))
PRJ_NAME = 'psutil'
PRJ_UR... | true | true |
1c2b9e70ddd9e1cd920f14b13cc3dbab1e8517a2 | 1,106 | py | Python | fqn_decorators/asynchronous.py | riyazudheen/py-fqn-decorators | 406582ad7b40592b51c0699ef95fca883dd36c42 | [
"Apache-2.0"
] | null | null | null | fqn_decorators/asynchronous.py | riyazudheen/py-fqn-decorators | 406582ad7b40592b51c0699ef95fca883dd36c42 | [
"Apache-2.0"
] | null | null | null | fqn_decorators/asynchronous.py | riyazudheen/py-fqn-decorators | 406582ad7b40592b51c0699ef95fca883dd36c42 | [
"Apache-2.0"
] | null | null | null | """This module implements an async-aware decorator.
For backwards compatibility with Python 2.x, it needs to remain separate from
the rest of the codebase, since it uses Python 3.5 syntax (``async def``, ``await``).
"""
import sys
from .decorators import Decorator
class AsyncDecorator(Decorator):
# __call__ sho... | 32.529412 | 91 | 0.605787 | import sys
from .decorators import Decorator
class AsyncDecorator(Decorator):
def __call__(self, *args, **kwargs):
if not self.func:
return self.__class__(args[0], **self.params)
self.fqn = self.get_fqn()
self.args = args
self.kwargs = kwargs
... | true | true |
1c2b9f92a91f10c5d75799254c078e9c640eb6d2 | 698 | py | Python | t637.py | showerhhh/leetcode_python | ea26e756dd10befbc22d99c258acd8198b215630 | [
"MIT"
] | null | null | null | t637.py | showerhhh/leetcode_python | ea26e756dd10befbc22d99c258acd8198b215630 | [
"MIT"
] | null | null | null | t637.py | showerhhh/leetcode_python | ea26e756dd10befbc22d99c258acd8198b215630 | [
"MIT"
] | null | null | null | # Definition for a binary tree node.
class TreeNode:
def __init__(self, x):
self.val = x
self.left = None
self.right = None
class Solution:
def averageOfLevels(self, root: TreeNode):
queue = [root]
results = []
while queue:
sum = 0
count... | 24.928571 | 46 | 0.477077 |
class TreeNode:
def __init__(self, x):
self.val = x
self.left = None
self.right = None
class Solution:
def averageOfLevels(self, root: TreeNode):
queue = [root]
results = []
while queue:
sum = 0
count = 0
for i in range(len(... | true | true |
1c2b9f9b114fc6e8b804d732af432f29101e1d7e | 10,668 | py | Python | terminusdb_client/tests/integration_tests/test_schema.py | polyneme/terminusdb-client-python | 720024e33465f830709691507b4fbd5b3597e29f | [
"Apache-2.0"
] | null | null | null | terminusdb_client/tests/integration_tests/test_schema.py | polyneme/terminusdb-client-python | 720024e33465f830709691507b4fbd5b3597e29f | [
"Apache-2.0"
] | null | null | null | terminusdb_client/tests/integration_tests/test_schema.py | polyneme/terminusdb-client-python | 720024e33465f830709691507b4fbd5b3597e29f | [
"Apache-2.0"
] | null | null | null | import datetime as dt
import pytest
from terminusdb_client.errors import DatabaseError
from terminusdb_client.woqlclient.woqlClient import WOQLClient
from terminusdb_client.woqlschema.woql_schema import DocumentTemplate, WOQLSchema
def test_create_schema(docker_url, test_schema):
my_schema = test_schema
cli... | 34.636364 | 119 | 0.636577 | import datetime as dt
import pytest
from terminusdb_client.errors import DatabaseError
from terminusdb_client.woqlclient.woqlClient import WOQLClient
from terminusdb_client.woqlschema.woql_schema import DocumentTemplate, WOQLSchema
def test_create_schema(docker_url, test_schema):
my_schema = test_schema
cli... | true | true |
1c2ba08b86b59e9429b3258f1e7080d34292710c | 1,253 | py | Python | sixpack/analysis.py | mehrdad-shokri/sixpack | d14a3107fb2facdd18b644c1d8d5d673ca4dab21 | [
"BSD-2-Clause"
] | 779 | 2015-01-04T16:31:04.000Z | 2017-12-12T20:02:36.000Z | sixpack/analysis.py | mehrdad-shokri/sixpack | d14a3107fb2facdd18b644c1d8d5d673ca4dab21 | [
"BSD-2-Clause"
] | 134 | 2015-01-10T15:07:31.000Z | 2017-12-02T18:00:49.000Z | sixpack/analysis.py | mehrdad-shokri/sixpack | d14a3107fb2facdd18b644c1d8d5d673ca4dab21 | [
"BSD-2-Clause"
] | 136 | 2015-01-08T08:47:13.000Z | 2017-12-04T22:26:25.000Z | import cStringIO as StringIO
import csv
class ExportExperiment(object):
def __init__(self, experiment=None):
self.experiment = experiment
def __call__(self):
csvfile = StringIO.StringIO()
writer = csv.writer(csvfile)
writer.writerow(['Alternative Details'])
writer.wri... | 37.969697 | 117 | 0.63767 | import cStringIO as StringIO
import csv
class ExportExperiment(object):
def __init__(self, experiment=None):
self.experiment = experiment
def __call__(self):
csvfile = StringIO.StringIO()
writer = csv.writer(csvfile)
writer.writerow(['Alternative Details'])
writer.wri... | true | true |
1c2ba0d37cdd89dfd9e64adfe762767c37b5b6f9 | 5,582 | py | Python | src/models/densenet.py | HwangJohn/model_compression | 1df40c8a531313cc9e79255f4477f39d66d9b849 | [
"MIT"
] | 216 | 2020-08-24T04:09:06.000Z | 2022-03-10T01:28:16.000Z | src/models/densenet.py | bopker/model_compression | dd537d306d100ce53cc5f24ef0ff315cccf8c9da | [
"MIT"
] | 17 | 2020-08-24T16:54:59.000Z | 2022-02-15T10:52:47.000Z | src/models/densenet.py | bopker/model_compression | dd537d306d100ce53cc5f24ef0ff315cccf8c9da | [
"MIT"
] | 20 | 2020-08-27T02:45:43.000Z | 2022-03-10T01:27:52.000Z | # -*- coding: utf-8 -*-
"""Fixed DenseNet Model.
All blocks consist of ConvBNReLU for quantization.
- Author: Curt-Park
- Email: jwpark@jmarple.ai
- References:
https://github.com/bearpaw/pytorch-classification
https://github.com/gpleiss/efficient_densenet_pytorch
"""
import math
from typing import Any, Tupl... | 31.715909 | 82 | 0.596919 |
import math
from typing import Any, Tuple
import torch
import torch.nn as nn
import torch.utils.checkpoint as cp
from src.models.common_layers import ConvBNReLU
class Bottleneck(nn.Module):
def __init__(
self, inplanes: int, expansion: int, growthRate: int, efficient: bool,
) -> None:
sup... | true | true |
1c2ba1405fb1578f973c04f6e8d59a5ab765ab33 | 8,137 | py | Python | liver_disease_detection_machine_learning.py | FahadMostafa91/Liver_disease_detection_by_Machine_learning_methods | fbe80344fc690a088dc7d2b1128c930194ca2abd | [
"MIT"
] | 1 | 2022-01-19T05:04:23.000Z | 2022-01-19T05:04:23.000Z | liver_disease_detection_machine_learning.py | FahadMostafa91/Liver_disease_detection_by_Machine_learning_methods | fbe80344fc690a088dc7d2b1128c930194ca2abd | [
"MIT"
] | null | null | null | liver_disease_detection_machine_learning.py | FahadMostafa91/Liver_disease_detection_by_Machine_learning_methods | fbe80344fc690a088dc7d2b1128c930194ca2abd | [
"MIT"
] | null | null | null | # -*- coding: utf-8 -*-
"""PCA_Liver_disease_article.ipynb
Automatically generated by Colaboratory.
Original file is located at
https://colab.research.google.com/drive/1M6PyB8Awmb-osk4ZrxMPuHzKeQQAKI0b
"""
import pandas as pd
import seaborn as sns
sns.set(rc={'figure.figsize':(8,8)})
import numpy as np
from skle... | 29.805861 | 102 | 0.719798 |
import pandas as pd
import seaborn as sns
sns.set(rc={'figure.figsize':(8,8)})
import numpy as np
from sklearn.decomposition import PCA
from sklearn.preprocessing import StandardScaler
from sklearn.model_selection import train_test_split
import tensorflow as tf
from sklearn.metrics import confusion_matrix, accuracy_s... | true | true |
1c2ba1b72a92c6e4aee2fff64b518521515c3292 | 499 | py | Python | tests/api/test_status.py | felliott/SHARE | 8fd60ff4749349c9b867f6188650d71f4f0a1a56 | [
"Apache-2.0"
] | 87 | 2015-01-06T18:24:45.000Z | 2021-08-08T07:59:40.000Z | tests/api/test_status.py | fortress-biotech/SHARE | 9c5a05dd831447949fa6253afec5225ff8ab5d4f | [
"Apache-2.0"
] | 442 | 2015-01-01T19:16:01.000Z | 2022-03-30T21:10:26.000Z | tests/api/test_status.py | fortress-biotech/SHARE | 9c5a05dd831447949fa6253afec5225ff8ab5d4f | [
"Apache-2.0"
] | 67 | 2015-03-10T16:32:58.000Z | 2021-11-12T16:33:41.000Z | from django.test import override_settings
class TestAPIStatusView:
@override_settings(VERSION='TESTCASE')
def test_works(self, client):
resp = client.get('/api/v2/status/')
assert resp.status_code == 200
assert resp.json() == {
'data': {
'id': '1',
... | 24.95 | 44 | 0.452906 | from django.test import override_settings
class TestAPIStatusView:
@override_settings(VERSION='TESTCASE')
def test_works(self, client):
resp = client.get('/api/v2/status/')
assert resp.status_code == 200
assert resp.json() == {
'data': {
'id': '1',
... | true | true |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.