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 |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
1c28404d7a492d0885a9063706f3933a81e8a2f2 | 1,258 | py | Python | examples/example2_basic_agent_no_processing.py | joriwinderickx-fm/pyngsi | 3876db4c7e8fd1351f3072476be73cb255ec340e | [
"Apache-2.0"
] | 13 | 2020-06-05T11:49:56.000Z | 2022-01-12T09:10:27.000Z | examples/example2_basic_agent_no_processing.py | joriwinderickx-fm/pyngsi | 3876db4c7e8fd1351f3072476be73cb255ec340e | [
"Apache-2.0"
] | 4 | 2020-06-17T10:16:44.000Z | 2021-07-13T11:42:39.000Z | examples/example2_basic_agent_no_processing.py | joriwinderickx-fm/pyngsi | 3876db4c7e8fd1351f3072476be73cb255ec340e | [
"Apache-2.0"
] | 5 | 2020-06-17T10:56:59.000Z | 2021-03-08T12:58:54.000Z | #!/usr/bin/env python3
# -*- coding: utf-8 -*-
# This agent takes data from the standard input, performs a basic computation, eventually writes to the standard output.
# Note : a Sink expects a NGSI DataModel class as input. If it is not the case it simply writes the string representation of its input
# Use CTRL-D to ... | 38.121212 | 134 | 0.719396 |
from pyngsi.agent import NgsiAgent
from pyngsi.sources.source import Row
def basic_processing(data: Row):
_ = data.provider
return data.record.replace("ping", "pong")
def main():
agent = NgsiAgent.create_agent(process=basic_processing)
# We could have used a lambda,... | true | true |
1c28405217cae71b78220d6f8b844070565b60f4 | 3,367 | py | Python | examples/references/segmentation/pascal_voc2012/code/dataflow/datasets.py | nzare/ignite | 002b595daa8a8345286c5e096c33e278948686a7 | [
"BSD-3-Clause"
] | 1 | 2020-08-29T16:49:36.000Z | 2020-08-29T16:49:36.000Z | examples/references/segmentation/pascal_voc2012/code/dataflow/datasets.py | M3L6H/ignite | 002b595daa8a8345286c5e096c33e278948686a7 | [
"BSD-3-Clause"
] | 5 | 2020-08-29T16:49:48.000Z | 2020-08-29T17:05:54.000Z | examples/references/segmentation/pascal_voc2012/code/dataflow/datasets.py | M3L6H/ignite | 002b595daa8a8345286c5e096c33e278948686a7 | [
"BSD-3-Clause"
] | 1 | 2020-10-15T06:21:01.000Z | 2020-10-15T06:21:01.000Z | from typing import Type, Callable
import numpy as np
import cv2
from PIL import Image
from torch.utils.data import Dataset
from torchvision.datasets.voc import VOCSegmentation
from torchvision.datasets.sbd import SBDataset
class TransformedDataset(Dataset):
def __init__(self, ds: Dataset, transform_fn: Calla... | 29.278261 | 119 | 0.614791 | from typing import Type, Callable
import numpy as np
import cv2
from PIL import Image
from torch.utils.data import Dataset
from torchvision.datasets.voc import VOCSegmentation
from torchvision.datasets.sbd import SBDataset
class TransformedDataset(Dataset):
def __init__(self, ds: Dataset, transform_fn: Calla... | true | true |
1c2841870e0a80969710d699d8da6ed9cefadb8f | 497 | py | Python | fourbranches.py | umbrellagong/VHGPR | 859c135f8a18be0a7e679d44cf292c2825ccd09d | [
"MIT"
] | 3 | 2022-01-14T01:55:11.000Z | 2022-02-11T15:56:52.000Z | fourbranches.py | umbrellagong/VHGPR | 859c135f8a18be0a7e679d44cf292c2825ccd09d | [
"MIT"
] | null | null | null | fourbranches.py | umbrellagong/VHGPR | 859c135f8a18be0a7e679d44cf292c2825ccd09d | [
"MIT"
] | null | null | null | import numpy as np
def f(X):
return mean(X) + np.random.normal(0, std(X))
def mean(X, deviation=5):
X = np.array(X)
if X.ndim == 1:
X=np.atleast_2d(X)
X1 = 3 + 0.1*(X[:,0]-X[:,1])**2 - (X[:,0]+X[:,1])/np.sqrt(2)
X2 = 3 + 0.1*(X[:,0]-X[:,1])**2 + (X[:,0]+X[:,1])/np.sqrt(2)
X3 = (X[:,0]... | 27.611111 | 64 | 0.472837 | import numpy as np
def f(X):
return mean(X) + np.random.normal(0, std(X))
def mean(X, deviation=5):
X = np.array(X)
if X.ndim == 1:
X=np.atleast_2d(X)
X1 = 3 + 0.1*(X[:,0]-X[:,1])**2 - (X[:,0]+X[:,1])/np.sqrt(2)
X2 = 3 + 0.1*(X[:,0]-X[:,1])**2 + (X[:,0]+X[:,1])/np.sqrt(2)
X3 = (X[:,0]... | true | true |
1c2841b5688691194daf70dc0d57f686cc67ca3e | 8,550 | py | Python | electrum_sum/tests/test_revealer.py | jakesum/electrum-sum | f34ac3c042cf73e90acd0771b87f60b750b6c799 | [
"MIT"
] | 3 | 2020-09-02T08:49:37.000Z | 2021-11-05T12:31:47.000Z | electrum_sum/tests/test_revealer.py | jakesum/electrum-sum | f34ac3c042cf73e90acd0771b87f60b750b6c799 | [
"MIT"
] | 1 | 2021-05-04T13:47:57.000Z | 2021-05-04T13:47:57.000Z | electrum_sum/tests/test_revealer.py | jakesum/electrum-sum | f34ac3c042cf73e90acd0771b87f60b750b6c799 | [
"MIT"
] | 3 | 2020-09-21T02:55:02.000Z | 2021-04-07T06:05:13.000Z | from electrum_sum.plugins.revealer.revealer import RevealerPlugin
from . import SequentialTestCase
class TestRevealer(SequentialTestCase):
def test_version_0_noisemap(self):
versioned_seed = RevealerPlugin.get_versioned_seed_from_user_input('03b0c557d6d0d4308a3393851d78bd8c7861')
noise_map = Rev... | 231.081081 | 2,396 | 0.940819 | from electrum_sum.plugins.revealer.revealer import RevealerPlugin
from . import SequentialTestCase
class TestRevealer(SequentialTestCase):
def test_version_0_noisemap(self):
versioned_seed = RevealerPlugin.get_versioned_seed_from_user_input('03b0c557d6d0d4308a3393851d78bd8c7861')
noise_map = Rev... | true | true |
1c284278f87ec86b741b9d47daa3d79b9ab6345e | 838 | py | Python | python/53.maximum-subarray.py | kadaliao/leetcode | 32170b1c2ba24b3765d22f9379534651080bab26 | [
"MIT"
] | null | null | null | python/53.maximum-subarray.py | kadaliao/leetcode | 32170b1c2ba24b3765d22f9379534651080bab26 | [
"MIT"
] | null | null | null | python/53.maximum-subarray.py | kadaliao/leetcode | 32170b1c2ba24b3765d22f9379534651080bab26 | [
"MIT"
] | null | null | null | # [53] 最大子序和
# https://leetcode-cn.com/problems/maximum-subarray/description/
# * algorithms
# * Easy (52.58%)
# * Total Accepted: 349.6K
# * Total Submissions: 664.9K
# * Testcase Example: '[-2,1,-3,4,-1,2,1,-5,4]'
# 给定一个整数数组 nums ,找到一个具有最大和的连续子数组(子数组最少包含一个元素),返回其最大和。
# 示例:
# 输入: [-2,1,-3,4,-1,2,1,-5,4]
# 输出:... | 20.95 | 64 | 0.526253 |
class Solution(object):
def maxSubArray(self, nums):
for i in range(1, len(nums)):
nums[i] = max(nums[i-1] + nums[i], nums[i])
return max(nums)
| true | true |
1c28436b3265ed2ddb8ee81f76e1f52cbdbb9e4a | 26,843 | py | Python | drutils/augmentation.py | lvxingvir/template | 089f5817e031a7c2b2d82e239158a6a5488b3b26 | [
"MIT"
] | null | null | null | drutils/augmentation.py | lvxingvir/template | 089f5817e031a7c2b2d82e239158a6a5488b3b26 | [
"MIT"
] | null | null | null | drutils/augmentation.py | lvxingvir/template | 089f5817e031a7c2b2d82e239158a6a5488b3b26 | [
"MIT"
] | null | null | null | """This file contains utility functions used for numpy-based input augmentation
TODO: make more general for 3D images
"""
import logging
import cv2
import random
import scipy.ndimage
from skimage.filters import threshold_otsu, gaussian
try:
import dicom
except:
import pydicom as dicom
import numpy as np
from ... | 36.72093 | 142 | 0.640577 |
import logging
import cv2
import random
import scipy.ndimage
from skimage.filters import threshold_otsu, gaussian
try:
import dicom
except:
import pydicom as dicom
import numpy as np
from io import BytesIO
from skimage.morphology import erosion, square, disk
from skimage import measure
logging.basicConfig(lev... | true | true |
1c2845b062e01961011e2df7760329783b76e2df | 2,920 | py | Python | api/app/decorators/paginate.py | HotMaps/Toolbox | ba1e287dbc63e34bf9feb80b65b02c1db93ce91c | [
"Apache-2.0"
] | 188 | 2015-01-01T08:54:26.000Z | 2022-03-25T17:50:07.000Z | api/app/decorators/paginate.py | HotMaps/Toolbox | ba1e287dbc63e34bf9feb80b65b02c1db93ce91c | [
"Apache-2.0"
] | 11 | 2017-11-09T22:23:50.000Z | 2017-11-30T16:40:22.000Z | api/app/decorators/paginate.py | HotMaps/Toolbox | ba1e287dbc63e34bf9feb80b65b02c1db93ce91c | [
"Apache-2.0"
] | 117 | 2015-01-11T23:49:04.000Z | 2022-03-01T16:20:57.000Z | import functools
from flask import url_for, request
def paginate(collection, max_per_page=25):
"""Generate a paginated response for a resource collection.
Routes that use this decorator must return a SQLAlchemy query as a
response.
The output of this decorator is a Python dictionary with the paginat... | 44.242424 | 78 | 0.521233 | import functools
from flask import url_for, request
def paginate(collection, max_per_page=25):
def decorator(f):
@functools.wraps(f)
def wrapped(*args, **kwargs):
query = f(*args, **kwargs)
page = request.args.get('page', 1, type=int)
... | true | true |
1c28468d3a7cb435118cb00c2d2ededf834bc12e | 1,123 | py | Python | rec/io/tests/coding_test.py | gergely-flamich/relative-entropy-coding | c99d90cabec4395de2d01d889bd2b7ed7b7453d7 | [
"MIT"
] | 14 | 2020-11-17T23:31:10.000Z | 2022-01-28T04:23:38.000Z | rec/io/tests/coding_test.py | gergely-flamich/relative-entropy-coding | c99d90cabec4395de2d01d889bd2b7ed7b7453d7 | [
"MIT"
] | null | null | null | rec/io/tests/coding_test.py | gergely-flamich/relative-entropy-coding | c99d90cabec4395de2d01d889bd2b7ed7b7453d7 | [
"MIT"
] | 1 | 2021-05-05T04:08:23.000Z | 2021-05-05T04:08:23.000Z | import time
import numpy as np
import tensorflow as tf
from rec.io.entropy_coding import ArithmeticCoder
num_symbols = 2**6
message_length = 2000
test_file_path = "scratch_compression_test.miracle"
P = np.ones(num_symbols + 1, dtype=np.int32)
P[1:] = np.random.choice(100, size=num_symbols) + 1
message = np.zeros(... | 23.893617 | 73 | 0.729297 | import time
import numpy as np
import tensorflow as tf
from rec.io.entropy_coding import ArithmeticCoder
num_symbols = 2**6
message_length = 2000
test_file_path = "scratch_compression_test.miracle"
P = np.ones(num_symbols + 1, dtype=np.int32)
P[1:] = np.random.choice(100, size=num_symbols) + 1
message = np.zeros(... | true | true |
1c28476b39a406b9ea6996a626c53d10048db537 | 1,129 | py | Python | src/c3nav/mapdata/utils/fields.py | johnjohndoe/c3nav | a17f863a3512e305595c16b0300796b6bae81241 | [
"Apache-2.0"
] | 132 | 2016-11-12T01:45:23.000Z | 2022-03-08T15:17:10.000Z | src/c3nav/mapdata/utils/fields.py | johnjohndoe/c3nav | a17f863a3512e305595c16b0300796b6bae81241 | [
"Apache-2.0"
] | 66 | 2016-09-29T09:46:19.000Z | 2022-03-11T23:26:18.000Z | src/c3nav/mapdata/utils/fields.py | johnjohndoe/c3nav | a17f863a3512e305595c16b0300796b6bae81241 | [
"Apache-2.0"
] | 42 | 2016-09-29T08:34:57.000Z | 2022-03-08T15:17:15.000Z | from django.core.exceptions import ObjectDoesNotExist
class LocationById():
def __init__(self):
super().__init__()
self.name = None
self.cached_id = None
self.cached_value = None
def __set_name__(self, owner, name):
self.name = name
def __get__(self, instance, own... | 30.513514 | 92 | 0.635961 | from django.core.exceptions import ObjectDoesNotExist
class LocationById():
def __init__(self):
super().__init__()
self.name = None
self.cached_id = None
self.cached_value = None
def __set_name__(self, owner, name):
self.name = name
def __get__(self, instance, own... | true | true |
1c2848f86652a64fa57a56293965d4425229b5a0 | 363 | py | Python | cfa.py | jmeyers314/astrophotoreduce | 814177f494bbe6bb7ef5cf1b09ab2083a119fa42 | [
"MIT"
] | 3 | 2018-06-14T19:11:05.000Z | 2021-05-04T09:52:27.000Z | cfa.py | jmeyers314/astrophotoreduce | 814177f494bbe6bb7ef5cf1b09ab2083a119fa42 | [
"MIT"
] | null | null | null | cfa.py | jmeyers314/astrophotoreduce | 814177f494bbe6bb7ef5cf1b09ab2083a119fa42 | [
"MIT"
] | null | null | null | import numpy as np
def make_cfa(img):
cfa = np.zeros_like(img[:,:,0])
y, x = np.mgrid[0:cfa.shape[0], 0:cfa.shape[1]]
Rloc = (np.mod(x, 2) == 0) & (np.mod(y, 2) == 0)
Gloc = np.mod(x+y, 2) == 1
Bloc = (np.mod(x, 2) == 1) & (np.mod(y, 2) == 1)
cfa[Rloc] = img[Rloc,0]
cfa[Gloc] = img[Gloc,1]
... | 27.923077 | 52 | 0.506887 | import numpy as np
def make_cfa(img):
cfa = np.zeros_like(img[:,:,0])
y, x = np.mgrid[0:cfa.shape[0], 0:cfa.shape[1]]
Rloc = (np.mod(x, 2) == 0) & (np.mod(y, 2) == 0)
Gloc = np.mod(x+y, 2) == 1
Bloc = (np.mod(x, 2) == 1) & (np.mod(y, 2) == 1)
cfa[Rloc] = img[Rloc,0]
cfa[Gloc] = img[Gloc,1]
... | true | true |
1c28493f1b86a940066892cf80f09d74b31f5a4f | 141 | py | Python | MCA/Machine Learning/mul_table.py | muhammadmuzzammil1998/CollegeStuff | 618cec9ebfbfd29a2d1e5a182b90cfb36b38a906 | [
"MIT"
] | 3 | 2018-03-13T12:34:51.000Z | 2018-10-02T18:54:22.000Z | MCA/Machine Learning/mul_table.py | muhammadmuzzammil1998/CollegeStuff | 618cec9ebfbfd29a2d1e5a182b90cfb36b38a906 | [
"MIT"
] | null | null | null | MCA/Machine Learning/mul_table.py | muhammadmuzzammil1998/CollegeStuff | 618cec9ebfbfd29a2d1e5a182b90cfb36b38a906 | [
"MIT"
] | null | null | null | import sys
x = int(sys.argv[1])
till = int(sys.argv[2])
for i in range(1, int(sys.argv[2])+1):
print("{} x {}\t= {}".format(x, i, x*i))
| 20.142857 | 44 | 0.546099 | import sys
x = int(sys.argv[1])
till = int(sys.argv[2])
for i in range(1, int(sys.argv[2])+1):
print("{} x {}\t= {}".format(x, i, x*i))
| true | true |
1c284a739bf3e96178dbfa87e383d32fe07a8522 | 4,088 | py | Python | app/models.py | geoffrey45/Movium | ef9067e3074da6656db6cc82616250d5f2f0ffbb | [
"MIT"
] | null | null | null | app/models.py | geoffrey45/Movium | ef9067e3074da6656db6cc82616250d5f2f0ffbb | [
"MIT"
] | null | null | null | app/models.py | geoffrey45/Movium | ef9067e3074da6656db6cc82616250d5f2f0ffbb | [
"MIT"
] | null | null | null | from . import db
from werkzeug.security import generate_password_hash,check_password_hash
from flask_login import UserMixin
from . import login_manager
from datetime import datetime
@login_manager.user_loader
def load_user(user_id):
return User.query.get(int(user_id))
class Movie:
def __init__(self,id,title,o... | 29.2 | 189 | 0.65093 | from . import db
from werkzeug.security import generate_password_hash,check_password_hash
from flask_login import UserMixin
from . import login_manager
from datetime import datetime
@login_manager.user_loader
def load_user(user_id):
return User.query.get(int(user_id))
class Movie:
def __init__(self,id,title,o... | true | true |
1c284b7a5dd76a02eb619b67d46de64032c4948c | 1,315 | py | Python | src/transformers/configuration_camembert.py | dom-s/transformers | 66ef8faf6ae805aeb4e71075d4da6eab7be3bc26 | [
"Apache-2.0"
] | 1 | 2020-03-06T02:41:33.000Z | 2020-03-06T02:41:33.000Z | src/transformers/configuration_camembert.py | BlueSkyBubble/transformers | 83446a88d902661fab12bf8c37a1aa2845cdca5f | [
"Apache-2.0"
] | null | null | null | src/transformers/configuration_camembert.py | BlueSkyBubble/transformers | 83446a88d902661fab12bf8c37a1aa2845cdca5f | [
"Apache-2.0"
] | null | null | null | # coding=utf-8
# Copyright 2018 The Google AI Language Team Authors and The HuggingFace Inc. team.
# Copyright (c) 2018, NVIDIA CORPORATION. All rights reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a cop... | 33.717949 | 103 | 0.768821 |
import logging
from .configuration_roberta import RobertaConfig
logger = logging.getLogger(__name__)
CAMEMBERT_PRETRAINED_CONFIG_ARCHIVE_MAP = {
"camembert-base": "https://s3.amazonaws.com/models.huggingface.co/bert/camembert-base-config.json",
}
class CamembertConfig(RobertaConfig):
pre... | true | true |
1c284b8e98df90d69167f643497a8f0231f1d211 | 11,202 | py | Python | sympy/combinatorics/graycode.py | lidavidm/sympy | 971aa94ee6d0774eacfb4aed6965195c4a59e104 | [
"BSD-3-Clause"
] | 26 | 2018-02-14T23:52:58.000Z | 2021-08-16T13:50:03.000Z | sympy/combinatorics/graycode.py | shashank-agg/sympy | ecf69893c0b9927ea7192113b2421d639aee6ffb | [
"BSD-3-Clause"
] | null | null | null | sympy/combinatorics/graycode.py | shashank-agg/sympy | ecf69893c0b9927ea7192113b2421d639aee6ffb | [
"BSD-3-Clause"
] | 10 | 2018-08-13T19:38:39.000Z | 2020-04-19T03:02:00.000Z | from __future__ import print_function, division
from sympy.core import Basic
from sympy.core.compatibility import xrange
import random
class GrayCode(Basic):
"""
A Gray code is essentially a Hamiltonian walk on
a n-dimensional cube with edge length of one.
The vertices of the cube are represented by... | 27.057971 | 80 | 0.524014 | from __future__ import print_function, division
from sympy.core import Basic
from sympy.core.compatibility import xrange
import random
class GrayCode(Basic):
_skip = False
_current = 0
_rank = None
def __new__(cls, n, *args, **kw_args):
if n < 1 or int(n) != n:
raise ValueError... | true | true |
1c284c52fd21b5c4de6ebdb7e124a1b239379caf | 1,488 | py | Python | tests/functional/markers/test_destructive_test.py | ScriptAutomate/pytest-salt-factories | 192e15a7e93eec694f59099021a4d4268a1ab1ea | [
"Apache-2.0"
] | null | null | null | tests/functional/markers/test_destructive_test.py | ScriptAutomate/pytest-salt-factories | 192e15a7e93eec694f59099021a4d4268a1ab1ea | [
"Apache-2.0"
] | null | null | null | tests/functional/markers/test_destructive_test.py | ScriptAutomate/pytest-salt-factories | 192e15a7e93eec694f59099021a4d4268a1ab1ea | [
"Apache-2.0"
] | null | null | null | """
tests.functional.markers.test_destructive_test
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Test the ``@pytest.mark.destructive_test`` marker
"""
def test_run_destructive_skipped(pytester):
pytester.makepyfile(
"""
import pytest
@pytest.mark.destructive_test
def... | 24.393443 | 108 | 0.604839 |
def test_run_destructive_skipped(pytester):
pytester.makepyfile(
"""
import pytest
@pytest.mark.destructive_test
def test_one():
assert True
"""
)
res = pytester.runpytest()
res.assert_outcomes(skipped=1)
res.stdout.no_fnmatch_line("*PytestUnkno... | true | true |
1c284cb55710e8941a1089679746f89092c1f4cc | 896 | py | Python | examples/graph/atlas2.py | rakschahsa/networkx | 6cac55b1064c3c346665f9281680fa3b66442ad0 | [
"BSD-3-Clause"
] | 8 | 2019-05-29T09:38:30.000Z | 2021-01-20T03:36:59.000Z | examples/graph/atlas2.py | rakschahsa/networkx | 6cac55b1064c3c346665f9281680fa3b66442ad0 | [
"BSD-3-Clause"
] | 12 | 2021-03-09T03:01:16.000Z | 2022-03-11T23:59:36.000Z | examples/graph/atlas2.py | rakschahsa/networkx | 6cac55b1064c3c346665f9281680fa3b66442ad0 | [
"BSD-3-Clause"
] | 6 | 2019-01-30T07:12:55.000Z | 2020-02-22T23:21:04.000Z | #!/usr/bin/env python
"""
======
Atlas2
======
Write first 20 graphs from the graph atlas as graphviz dot files
Gn.dot where n=0,19.
"""
# Author: Aric Hagberg (hagberg@lanl.gov)
# Date: 2005-05-19 14:23:02 -0600 (Thu, 19 May 2005)
# Copyright (C) 2006-2018 by
# Aric Hagberg <hagberg@lanl.gov>
# Dan Schult <... | 25.6 | 67 | 0.649554 |
import networkx as nx
from networkx.generators.atlas import graph_atlas_g
atlas = graph_atlas_g()[0:20]
for G in atlas:
print("graph %s has %d nodes with %d edges"
% (G.name, nx.number_of_nodes(G), nx.number_of_edges(G)))
A = nx.nx_agraph.to_agraph(G)
A.graph_attr['label'] = G.name
... | true | true |
1c284d953b2e929d35ab14f1c01c2b5e2d95d96a | 344 | py | Python | EDA/SRC/utils_/apis_tb.py | PabloEduardoMartinezPicazo/Bootcamp-DataScience-2021 | 0fa5288aec5fb14e3796877882e4f1ddc5ad4aea | [
"MIT"
] | null | null | null | EDA/SRC/utils_/apis_tb.py | PabloEduardoMartinezPicazo/Bootcamp-DataScience-2021 | 0fa5288aec5fb14e3796877882e4f1ddc5ad4aea | [
"MIT"
] | null | null | null | EDA/SRC/utils_/apis_tb.py | PabloEduardoMartinezPicazo/Bootcamp-DataScience-2021 | 0fa5288aec5fb14e3796877882e4f1ddc5ad4aea | [
"MIT"
] | null | null | null | #funciones para flasks para la lectura y el return del json
import pandas as pd
import numpy as np
import json
def read_json(fullpath):
with open(fullpath, "r") as json_file_readed:
json_readed = json.load(json_file_readed)
return json_readed
def return_json(filepath):
df = pd.read_csv(filepath)... | 24.571429 | 59 | 0.735465 |
import pandas as pd
import numpy as np
import json
def read_json(fullpath):
with open(fullpath, "r") as json_file_readed:
json_readed = json.load(json_file_readed)
return json_readed
def return_json(filepath):
df = pd.read_csv(filepath)
return df.to_json() | true | true |
1c284db8892ad7fe40d54e3b1fafa0d8ea0ff369 | 29,572 | py | Python | metadeploy/api/models.py | shibinkunnath/MetaDeploy | 0e1bfa1460279f6ab30b1e56b67a4ad78b1e7c94 | [
"BSD-3-Clause"
] | null | null | null | metadeploy/api/models.py | shibinkunnath/MetaDeploy | 0e1bfa1460279f6ab30b1e56b67a4ad78b1e7c94 | [
"BSD-3-Clause"
] | null | null | null | metadeploy/api/models.py | shibinkunnath/MetaDeploy | 0e1bfa1460279f6ab30b1e56b67a4ad78b1e7c94 | [
"BSD-3-Clause"
] | null | null | null | import logging
from statistics import median
from typing import Union
from asgiref.sync import async_to_sync
from colorfield.fields import ColorField
from cumulusci.core.config import FlowConfig
from cumulusci.core.flowrunner import (
FlowCoordinator,
PreflightFlowCoordinator,
StepSpec,
)
from cumulusci.co... | 33.264342 | 88 | 0.668808 | import logging
from statistics import median
from typing import Union
from asgiref.sync import async_to_sync
from colorfield.fields import ColorField
from cumulusci.core.config import FlowConfig
from cumulusci.core.flowrunner import (
FlowCoordinator,
PreflightFlowCoordinator,
StepSpec,
)
from cumulusci.co... | true | true |
1c284ed86e4f6aeadbfca54d7b5a4e3d3ce3d909 | 1,593 | py | Python | u24_lymphocyte/third_party/treeano/sandbox/nodes/guided_backprop.py | ALSM-PhD/quip_classification | 7347bfaa5cf11ae2d7a528fbcc43322a12c795d3 | [
"BSD-3-Clause"
] | 45 | 2015-04-26T04:45:51.000Z | 2022-01-24T15:03:55.000Z | u24_lymphocyte/third_party/treeano/sandbox/nodes/guided_backprop.py | ALSM-PhD/quip_classification | 7347bfaa5cf11ae2d7a528fbcc43322a12c795d3 | [
"BSD-3-Clause"
] | 8 | 2018-07-20T20:54:51.000Z | 2020-06-12T05:36:04.000Z | u24_lymphocyte/third_party/treeano/sandbox/nodes/guided_backprop.py | ALSM-PhD/quip_classification | 7347bfaa5cf11ae2d7a528fbcc43322a12c795d3 | [
"BSD-3-Clause"
] | 22 | 2018-05-21T23:57:20.000Z | 2022-02-21T00:48:32.000Z | """
from "Striving for Simplicity - The All Convolutional Net"
http://arxiv.org/abs/1412.6806
"""
import theano
import theano.tensor as T
import treeano
import treeano.nodes as tn
import treeano.sandbox.utils
import canopy
class _GuidedBackprop(treeano.sandbox.utils.OverwriteGrad):
"""
based on Lasagne Rec... | 26.114754 | 79 | 0.679849 |
import theano
import theano.tensor as T
import treeano
import treeano.nodes as tn
import treeano.sandbox.utils
import canopy
class _GuidedBackprop(treeano.sandbox.utils.OverwriteGrad):
def grad(self, inputs, out_grads):
(inp,) = inputs
(grd,) = out_grads
dtype = inp.dtype
retur... | true | true |
1c284f8a117908ba6abe13fbd7c6a5552a17a17b | 635 | py | Python | atlassian_connect_django/rest_framework/migrations/0002_auto_securitycontexttoken.py | gerasev-kirill/atlassian-connect-django | cd44232df512691d9ec14722c38785cf802862e9 | [
"MIT"
] | null | null | null | atlassian_connect_django/rest_framework/migrations/0002_auto_securitycontexttoken.py | gerasev-kirill/atlassian-connect-django | cd44232df512691d9ec14722c38785cf802862e9 | [
"MIT"
] | null | null | null | atlassian_connect_django/rest_framework/migrations/0002_auto_securitycontexttoken.py | gerasev-kirill/atlassian-connect-django | cd44232df512691d9ec14722c38785cf802862e9 | [
"MIT"
] | null | null | null | # Generated by Django 3.1.2 on 2020-11-08 05:52
from django.db import migrations, models
import django.db.models.deletion
class Migration(migrations.Migration):
dependencies = [
('atlassian_connect_django', '0001_initial'),
('atlassian_connect_django_rest_framework', '0001_initial'),
]
... | 30.238095 | 167 | 0.696063 |
from django.db import migrations, models
import django.db.models.deletion
class Migration(migrations.Migration):
dependencies = [
('atlassian_connect_django', '0001_initial'),
('atlassian_connect_django_rest_framework', '0001_initial'),
]
operations = [
migrations.AlterField(
... | true | true |
1c28501fa755155da0613b7b179976bc8f69a8c9 | 256 | py | Python | mvp/mvp/views/base_view.py | 2110521-2563-1-Software-Architecture/four-guys-one-cup-assignment3 | fb771f7521a15aea5c5b563ff87dbcd83edbec77 | [
"MIT"
] | null | null | null | mvp/mvp/views/base_view.py | 2110521-2563-1-Software-Architecture/four-guys-one-cup-assignment3 | fb771f7521a15aea5c5b563ff87dbcd83edbec77 | [
"MIT"
] | null | null | null | mvp/mvp/views/base_view.py | 2110521-2563-1-Software-Architecture/four-guys-one-cup-assignment3 | fb771f7521a15aea5c5b563ff87dbcd83edbec77 | [
"MIT"
] | null | null | null | import wx
class BaseView(wx.Frame):
def __init__(self, title):
wx.Frame.__init__(self, None, wx.ID_ANY, title, size=(500, 400))
def init_ui(self):
pass
def set_presenter(self, presenter):
self.presenter = presenter
| 18.285714 | 72 | 0.636719 | import wx
class BaseView(wx.Frame):
def __init__(self, title):
wx.Frame.__init__(self, None, wx.ID_ANY, title, size=(500, 400))
def init_ui(self):
pass
def set_presenter(self, presenter):
self.presenter = presenter
| true | true |
1c2850260437806ed0b91404df3e38769d2785e5 | 7,879 | py | Python | airflow/contrib/hooks/sftp_hook.py | ganeshsrirams/airflow | b8c02632136320b8379956411134246cd2f6eb47 | [
"Apache-2.0"
] | 1 | 2019-10-12T09:40:06.000Z | 2019-10-12T09:40:06.000Z | airflow/contrib/hooks/sftp_hook.py | ganeshsrirams/airflow | b8c02632136320b8379956411134246cd2f6eb47 | [
"Apache-2.0"
] | null | null | null | airflow/contrib/hooks/sftp_hook.py | ganeshsrirams/airflow | b8c02632136320b8379956411134246cd2f6eb47 | [
"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
#... | 36.308756 | 87 | 0.593984 |
import datetime
import stat
import pysftp
from airflow.contrib.hooks.ssh_hook import SSHHook
class SFTPHook(SSHHook):
def __init__(self, ftp_conn_id='sftp_default', *args, **kwargs):
kwargs['ssh_conn_id'] = ftp_conn_id
super().__init__(*args, **kwargs)
self.conn = No... | true | true |
1c2850cb0613041302455d674487343bc12d648c | 20,108 | py | Python | sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2018_02_01/operations/_certificates_operations.py | iscai-msft/azure-sdk-for-python | 83715b95c41e519d5be7f1180195e2fba136fc0f | [
"MIT"
] | 8 | 2021-01-13T23:44:08.000Z | 2021-03-17T10:13:36.000Z | sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2018_02_01/operations/_certificates_operations.py | iscai-msft/azure-sdk-for-python | 83715b95c41e519d5be7f1180195e2fba136fc0f | [
"MIT"
] | 226 | 2019-07-24T07:57:21.000Z | 2019-10-15T01:07:24.000Z | sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2018_02_01/operations/_certificates_operations.py | iscai-msft/azure-sdk-for-python | 83715b95c41e519d5be7f1180195e2fba136fc0f | [
"MIT"
] | 5 | 2020-05-09T17:47:09.000Z | 2020-10-01T19:52:06.000Z | # coding=utf-8
# --------------------------------------------------------------------------
# Copyright (c) Microsoft Corporation. All rights reserved.
# Licensed under the MIT License. See License.txt in the project root for
# license information.
#
# Code generated by Microsoft (R) AutoRest Code Generator.
# Changes ... | 45.7 | 174 | 0.661926 |
import uuid
from msrest.pipeline import ClientRawResponse
from msrestazure.azure_exceptions import CloudError
from .. import models
class CertificatesOperations(object):
models = models
def __init__(self, client, config, serializer, deserializer):
self._client = client
self._ser... | true | true |
1c2850df4f9ce764ce3104fbbe8ccf8fed35d1b3 | 910 | py | Python | src/zope/app/error/tests.py | zopefoundation/zope.app.error | 913db8992c7ab0b3f6a396058c88b752699909db | [
"ZPL-2.1"
] | null | null | null | src/zope/app/error/tests.py | zopefoundation/zope.app.error | 913db8992c7ab0b3f6a396058c88b752699909db | [
"ZPL-2.1"
] | 2 | 2017-05-15T15:58:10.000Z | 2018-11-08T07:37:02.000Z | src/zope/app/error/tests.py | zopefoundation/zope.app.error | 913db8992c7ab0b3f6a396058c88b752699909db | [
"ZPL-2.1"
] | 1 | 2015-04-03T07:38:12.000Z | 2015-04-03T07:38:12.000Z | ##############################################################################
#
# Copyright (c) 2001, 2002 Zope Foundation and Contributors.
# All Rights Reserved.
#
# This software is subject to the provisions of the Zope Public License,
# Version 2.1 (ZPL). A copy of the ZPL should accompany this distribution.
# TH... | 32.5 | 78 | 0.594505 | true | true | |
1c28511422146801ff4948980ae7b935e4d9cfcb | 1,481 | py | Python | KRIS/kris1/Poll.py | indah45/KRIS3 | d8dbd281f410bef4bc22231ad899149fa0f8e617 | [
"MIT"
] | null | null | null | KRIS/kris1/Poll.py | indah45/KRIS3 | d8dbd281f410bef4bc22231ad899149fa0f8e617 | [
"MIT"
] | null | null | null | KRIS/kris1/Poll.py | indah45/KRIS3 | d8dbd281f410bef4bc22231ad899149fa0f8e617 | [
"MIT"
] | null | null | null | import os, sys, time
path = os.path.join(os.path.dirname(__file__), '../lib/')
sys.path.insert(0, path)
from thrift.transport import THttpClient
from thrift.protocol import TCompactProtocol
from curve import LineService
from curve.ttypes import *
class Poll:
client = None
auth_query_path = "/api/v4/TalkService... | 27.425926 | 99 | 0.659689 | import os, sys, time
path = os.path.join(os.path.dirname(__file__), '../lib/')
sys.path.insert(0, path)
from thrift.transport import THttpClient
from thrift.protocol import TCompactProtocol
from curve import LineService
from curve.ttypes import *
class Poll:
client = None
auth_query_path = "/api/v4/TalkService... | true | true |
1c28511f355b84b38aeec6e89c55d105f0c11ab1 | 1,447 | py | Python | src/external_api/endpoints/proxy_endpoint.py | hvuhsg/OpenAPIGateway | 76413c69e2f35a2febf899f161ddc4da4b0ea354 | [
"MIT"
] | 1 | 2022-01-29T17:50:38.000Z | 2022-01-29T17:50:38.000Z | src/external_api/endpoints/proxy_endpoint.py | hvuhsg/OpenAPIGateway | 76413c69e2f35a2febf899f161ddc4da4b0ea354 | [
"MIT"
] | null | null | null | src/external_api/endpoints/proxy_endpoint.py | hvuhsg/OpenAPIGateway | 76413c69e2f35a2febf899f161ddc4da4b0ea354 | [
"MIT"
] | null | null | null | from functools import lru_cache
from fastapi import APIRouter, Request as FastAPIRequest, HTTPException, status
from context import get_services
from models.request import Request
from middleware_core import middleware_chain_builder
from middlewares.proxy_middleware import ProxyMiddleware
from middlewares.openapi_val... | 30.787234 | 98 | 0.775397 | from functools import lru_cache
from fastapi import APIRouter, Request as FastAPIRequest, HTTPException, status
from context import get_services
from models.request import Request
from middleware_core import middleware_chain_builder
from middlewares.proxy_middleware import ProxyMiddleware
from middlewares.openapi_val... | true | true |
1c285174355acac1e6a32eeff004b5c0b12e2dbf | 12,260 | py | Python | e2e_tests/tests/model_hub/test_transformers.py | RehanSD/determined | 693ded3b09602f0682f95e5e6ca0aa8650dbfdeb | [
"Apache-2.0"
] | null | null | null | e2e_tests/tests/model_hub/test_transformers.py | RehanSD/determined | 693ded3b09602f0682f95e5e6ca0aa8650dbfdeb | [
"Apache-2.0"
] | null | null | null | e2e_tests/tests/model_hub/test_transformers.py | RehanSD/determined | 693ded3b09602f0682f95e5e6ca0aa8650dbfdeb | [
"Apache-2.0"
] | null | null | null | import os
import subprocess
from typing import Dict
import pytest
from tests import config as conf
from tests import experiment as exp
def set_docker_image(config: Dict) -> Dict:
git_short_hash = subprocess.check_output(["git", "rev-parse", "--short", "HEAD"]).strip()
git_short_hash = git_short_hash.decode(... | 42.71777 | 93 | 0.759462 | import os
import subprocess
from typing import Dict
import pytest
from tests import config as conf
from tests import experiment as exp
def set_docker_image(config: Dict) -> Dict:
git_short_hash = subprocess.check_output(["git", "rev-parse", "--short", "HEAD"]).strip()
git_short_hash = git_short_hash.decode(... | true | true |
1c2852486f25f931d1915cb667eaa077edde1872 | 8,576 | py | Python | usmqe_carbon_mock_data_generator.py | dahorak/usmqe-carbon-mock-data-generator | 462d508a07daf5fe68d56ab1aa5348b19a20db88 | [
"Apache-2.0"
] | 1 | 2018-07-24T12:12:04.000Z | 2018-07-24T12:12:04.000Z | usmqe_carbon_mock_data_generator.py | dahorak/usmqe-carbon-mock-data-generator | 462d508a07daf5fe68d56ab1aa5348b19a20db88 | [
"Apache-2.0"
] | null | null | null | usmqe_carbon_mock_data_generator.py | dahorak/usmqe-carbon-mock-data-generator | 462d508a07daf5fe68d56ab1aa5348b19a20db88 | [
"Apache-2.0"
] | null | null | null | #!/usr/bin/env python3
"""
Scripts for creating mock data for carbon/grafana for Tendrl.
based on: https://github.com/cloudbehl/carbon-random
"""
import argparse
import datetime
import logging
import sys
from pprint import pformat
import yaml
import usmqe_cmdg.carbon_client
# configure logging
logging.basicConfig... | 38.285714 | 107 | 0.597598 |
import argparse
import datetime
import logging
import sys
from pprint import pformat
import yaml
import usmqe_cmdg.carbon_client
logging.basicConfig(level=logging.DEBUG, \
format='#%(levelname)-7s: %(message)s')
logging.getLogger().setLevel(logging.WARNING)
LOGGER = logging.getLogger("usmqe_cmdg")
LOGGER... | true | true |
1c285286a29365934faf56882b76eaed4f587c6e | 531 | py | Python | Python/WebRecon/Util/Utilities.py | gb21oc/Projetos_Basicos | b88106b070039372865bf0ec3d0a00d95a41200b | [
"MIT"
] | 3 | 2022-01-03T11:02:47.000Z | 2022-01-10T23:50:12.000Z | Python/WebRecon/Util/Utilities.py | desecsecurity/Projetos_Basicos | b12ecbc637f6fba991ca2995ae479fa41b84131d | [
"MIT"
] | 1 | 2022-03-20T08:03:34.000Z | 2022-03-20T08:03:34.000Z | Python/WebRecon/Util/Utilities.py | desecsecurity/Projetos_Basicos | b12ecbc637f6fba991ca2995ae479fa41b84131d | [
"MIT"
] | 2 | 2022-01-03T11:02:36.000Z | 2022-01-08T22:25:00.000Z | from selenium.webdriver.common.by import By
from selenium.common.exceptions import NoSuchElementException
class Utilities:
def __init__(self, driver=None):
self.driver = driver
def checkExistsXpath(self): # Consulta Invalida / Invalid Query
try:
text = self.driver.find_element... | 31.235294 | 113 | 0.647834 | from selenium.webdriver.common.by import By
from selenium.common.exceptions import NoSuchElementException
class Utilities:
def __init__(self, driver=None):
self.driver = driver
def checkExistsXpath(self):
try:
text = self.driver.find_element(By.XPATH, "//html/body/div/main/se... | true | true |
1c285306884bf2f0310d8b4f94a4ae2f772fe04f | 3,692 | py | Python | lib/spack/external/py/_process/forkedfunc.py | kkauder/spack | 6ae8d5c380c1f42094b05d38be26b03650aafb39 | [
"ECL-2.0",
"Apache-2.0",
"MIT-0",
"MIT"
] | 6,989 | 2017-07-18T06:23:18.000Z | 2022-03-31T15:58:36.000Z | lib/spack/external/py/_process/forkedfunc.py | kkauder/spack | 6ae8d5c380c1f42094b05d38be26b03650aafb39 | [
"ECL-2.0",
"Apache-2.0",
"MIT-0",
"MIT"
] | 13,838 | 2017-11-04T07:49:45.000Z | 2022-03-31T23:38:39.000Z | lib/spack/external/py/_process/forkedfunc.py | kkauder/spack | 6ae8d5c380c1f42094b05d38be26b03650aafb39 | [
"ECL-2.0",
"Apache-2.0",
"MIT-0",
"MIT"
] | 1,793 | 2017-11-04T07:45:50.000Z | 2022-03-30T14:31:53.000Z |
"""
ForkedFunc provides a way to run a function in a forked process
and get at its return value, stdout and stderr output as well
as signals and exitstatusus.
"""
import py
import os
import sys
import marshal
def get_unbuffered_io(fd, filename):
f = open(str(filename), "w")
if fd != f.fileno():
... | 30.512397 | 68 | 0.560672 |
import py
import os
import sys
import marshal
def get_unbuffered_io(fd, filename):
f = open(str(filename), "w")
if fd != f.fileno():
os.dup2(f.fileno(), fd)
class AutoFlush:
def write(self, data):
f.write(data)
f.flush()
def __getattr__(self, name):
... | true | true |
1c285373296a46c0ebf67ba14a3edc71edcd1913 | 689 | py | Python | mmaction/models/losses/nll_loss.py | HypnosXC/mmaction2 | a26d5f981449445a5e22a0a60d8b285e06c3dd6e | [
"Apache-2.0"
] | 549 | 2020-01-02T05:14:57.000Z | 2022-03-29T18:34:12.000Z | mmaction/models/losses/nll_loss.py | xumingze0308/mmaction2 | 777546f27f8f5a3c83e10d966e2149be2fc9fa31 | [
"Apache-2.0"
] | 98 | 2020-01-21T09:41:30.000Z | 2022-03-12T00:53:06.000Z | mmaction/models/losses/nll_loss.py | xumingze0308/mmaction2 | 777546f27f8f5a3c83e10d966e2149be2fc9fa31 | [
"Apache-2.0"
] | 233 | 2020-01-18T03:46:27.000Z | 2022-03-19T03:17:47.000Z | import torch.nn.functional as F
from ..registry import LOSSES
from .base import BaseWeightedLoss
@LOSSES.register_module()
class NLLLoss(BaseWeightedLoss):
"""NLL Loss.
It will calculate NLL loss given cls_score and label.
"""
def _forward(self, cls_score, label, **kwargs):
"""Forward funct... | 25.518519 | 74 | 0.637155 | import torch.nn.functional as F
from ..registry import LOSSES
from .base import BaseWeightedLoss
@LOSSES.register_module()
class NLLLoss(BaseWeightedLoss):
def _forward(self, cls_score, label, **kwargs):
loss_cls = F.nll_loss(cls_score, label, **kwargs)
return loss_cls
| true | true |
1c2853bf558268a087b9f02f45931ef1c539c9b1 | 4,822 | py | Python | floodsystem/geo.py | oscarliu666/partia-flood-warning-system | 51b9e35266ab9f45f5b32593b93f0c90a3ec55b0 | [
"MIT"
] | null | null | null | floodsystem/geo.py | oscarliu666/partia-flood-warning-system | 51b9e35266ab9f45f5b32593b93f0c90a3ec55b0 | [
"MIT"
] | null | null | null | floodsystem/geo.py | oscarliu666/partia-flood-warning-system | 51b9e35266ab9f45f5b32593b93f0c90a3ec55b0 | [
"MIT"
] | null | null | null | # Copyright (C) 2018 Garth N. Wells
#
# SPDX-License-Identifier: MIT
"""This module contains a collection of functions related to
geographical data.
"""
from .utils import sorted_by_key # noqa
from floodsystem.stationdata import build_station_list
from math import radians, cos, sin, asin, sqrt
def haversine(point... | 37.671875 | 161 | 0.67192 |
from .utils import sorted_by_key
from floodsystem.stationdata import build_station_list
from math import radians, cos, sin, asin, sqrt
def haversine(point1, point2, unit='km'):
TH_RADIUS_KM = 6371.0088
conversions = {'km': 1,
'm': 1000,
'mi': 0.621371192,
... | true | true |
1c2855e17188fe18b8839a52116c4d74d820e98b | 4,101 | py | Python | src/core/command.py | SecureThemAll/cb-repair | 3d1d4422e9a9ab459641e1ca759e3b73887d2950 | [
"MIT"
] | null | null | null | src/core/command.py | SecureThemAll/cb-repair | 3d1d4422e9a9ab459641e1ca759e3b73887d2950 | [
"MIT"
] | null | null | null | src/core/command.py | SecureThemAll/cb-repair | 3d1d4422e9a9ab459641e1ca759e3b73887d2950 | [
"MIT"
] | null | null | null | #!/usr/bin/env python3
import subprocess
import psutil
from os import environ
from sys import stderr
from typing import Union, AnyStr, Tuple, List
from pathlib import Path
from threading import Timer
from .kernel import Kernel
from utils.ui.terminal import TermPrint
class Command:
def __init__(self, name: str, ... | 28.282759 | 111 | 0.539624 |
import subprocess
import psutil
from os import environ
from sys import stderr
from typing import Union, AnyStr, Tuple, List
from pathlib import Path
from threading import Timer
from .kernel import Kernel
from utils.ui.terminal import TermPrint
class Command:
def __init__(self, name: str, kernel: Kernel, log_fi... | true | true |
1c2855ebd393014f3c334062d4d65d9a12bb294f | 1,726 | py | Python | h2o-py/tests/testdir_algos/glm/pyunit_pubdev_6037_fractionalbinomial_pojo_mojo.py | vishalbelsare/h2o-3 | 9322fb0f4c0e2358449e339a434f607d524c69fa | [
"Apache-2.0"
] | 6,098 | 2015-05-22T02:46:12.000Z | 2022-03-31T16:54:51.000Z | h2o-py/tests/testdir_algos/glm/pyunit_pubdev_6037_fractionalbinomial_pojo_mojo.py | vishalbelsare/h2o-3 | 9322fb0f4c0e2358449e339a434f607d524c69fa | [
"Apache-2.0"
] | 2,517 | 2015-05-23T02:10:54.000Z | 2022-03-30T17:03:39.000Z | h2o-py/tests/testdir_algos/glm/pyunit_pubdev_6037_fractionalbinomial_pojo_mojo.py | vishalbelsare/h2o-3 | 9322fb0f4c0e2358449e339a434f607d524c69fa | [
"Apache-2.0"
] | 2,199 | 2015-05-22T04:09:55.000Z | 2022-03-28T22:20:45.000Z | import sys, os
sys.path.insert(1, "../../../")
import h2o
from tests import pyunit_utils
import tempfile
def glm_fractional_binomial_mojo_pojo():
params = set_params()
train = h2o.import_file(pyunit_utils.locate("smalldata/glm_test/fraction_binommialOrig.csv"))
test = h2o.import_file(pyunit_utils.locate("... | 46.648649 | 223 | 0.73175 | import sys, os
sys.path.insert(1, "../../../")
import h2o
from tests import pyunit_utils
import tempfile
def glm_fractional_binomial_mojo_pojo():
params = set_params()
train = h2o.import_file(pyunit_utils.locate("smalldata/glm_test/fraction_binommialOrig.csv"))
test = h2o.import_file(pyunit_utils.locate("... | true | true |
1c285615e3ba59148b4c36eb8a522921f7389c6f | 1,306 | py | Python | conditions/if_condition.py | nv-krishna/python-crash-course | d481faeb2196712cd52ca1d34dc1fe967d13712f | [
"Apache-2.0"
] | 2 | 2020-11-02T05:52:33.000Z | 2021-06-09T01:28:22.000Z | conditions/if_condition.py | nv-krishna/python-crash-course | d481faeb2196712cd52ca1d34dc1fe967d13712f | [
"Apache-2.0"
] | null | null | null | conditions/if_condition.py | nv-krishna/python-crash-course | d481faeb2196712cd52ca1d34dc1fe967d13712f | [
"Apache-2.0"
] | 2 | 2021-04-08T05:26:04.000Z | 2021-06-09T01:28:23.000Z | cars = ['audi', 'bmw', 'toyota', 'subaru']
for car in cars:
if car == "bmw":
print(car.upper())
else:
print(car.title())
requested_topping = "mushrooms"
if requested_topping != "tomatoes":
print("Wait for tomatoes later!")
lower_limit = 18
upper_limit = 30
age_0 = 35
age_1 = 25
contestants... | 26.12 | 78 | 0.659265 | cars = ['audi', 'bmw', 'toyota', 'subaru']
for car in cars:
if car == "bmw":
print(car.upper())
else:
print(car.title())
requested_topping = "mushrooms"
if requested_topping != "tomatoes":
print("Wait for tomatoes later!")
lower_limit = 18
upper_limit = 30
age_0 = 35
age_1 = 25
contestants... | true | true |
1c28574c19f66be232e810c0da94c6db5938a596 | 25,473 | py | Python | testproject/testapp/tests.py | bogdandm/django_sphinxsearch | b3a4a46997b4648413cc0313f409c4bdf2c0ebe9 | [
"Beerware"
] | null | null | null | testproject/testapp/tests.py | bogdandm/django_sphinxsearch | b3a4a46997b4648413cc0313f409c4bdf2c0ebe9 | [
"Beerware"
] | null | null | null | testproject/testapp/tests.py | bogdandm/django_sphinxsearch | b3a4a46997b4648413cc0313f409c4bdf2c0ebe9 | [
"Beerware"
] | null | null | null | import sys
from datetime import timedelta
import pytz
import re
from django.conf import settings
from django.db import connections
from django.db.models import Sum, Q
from django.db.utils import ProgrammingError
from django.test import TransactionTestCase, utils
from django.utils import timezone
from sphinxsearch.rou... | 36.39 | 79 | 0.599655 | import sys
from datetime import timedelta
import pytz
import re
from django.conf import settings
from django.db import connections
from django.db.models import Sum, Q
from django.db.utils import ProgrammingError
from django.test import TransactionTestCase, utils
from django.utils import timezone
from sphinxsearch.rou... | true | true |
1c28576b88793e29d83b92db274f9684e60ee6ac | 3,265 | py | Python | tools/swa.py | JoelPendleton/QDot-Detector | e53b80c02fe95ceacd3dde9981dcd0481b907bdc | [
"Apache-2.0"
] | null | null | null | tools/swa.py | JoelPendleton/QDot-Detector | e53b80c02fe95ceacd3dde9981dcd0481b907bdc | [
"Apache-2.0"
] | null | null | null | tools/swa.py | JoelPendleton/QDot-Detector | e53b80c02fe95ceacd3dde9981dcd0481b907bdc | [
"Apache-2.0"
] | null | null | null | # -*- coding:utf-8 -*-
from __future__ import absolute_import
from __future__ import print_function
from __future__ import division
import tensorflow as tf
import tensorflow.contrib.slim as slim
from tensorflow.python import pywrap_tensorflow
import numpy as np
import sys
import os
sys.path.append('../')
from libs.co... | 34.734043 | 122 | 0.633691 |
from __future__ import absolute_import
from __future__ import print_function
from __future__ import division
import tensorflow as tf
import tensorflow.contrib.slim as slim
from tensorflow.python import pywrap_tensorflow
import numpy as np
import sys
import os
sys.path.append('../')
from libs.configs import cfgs
cl... | true | true |
1c2858f501f5b72e8fe717b2fa99c1da193c80a1 | 4,311 | py | Python | cms/form.py | fossabot/gophr | 3ff69cdb352e871aa61c23cb277d721459de6f41 | [
"MIT"
] | null | null | null | cms/form.py | fossabot/gophr | 3ff69cdb352e871aa61c23cb277d721459de6f41 | [
"MIT"
] | null | null | null | cms/form.py | fossabot/gophr | 3ff69cdb352e871aa61c23cb277d721459de6f41 | [
"MIT"
] | null | null | null | import json
from collections import OrderedDict
from django.db import models
from django import forms
from cms.models import Component, ComponentType, Section
OBJ_TYPE_TO_FIELD_LOOKUP = {
'string': {
'field': models.CharField,
},
'number': {
'field': models.FloatField
},
'bool': {
... | 30.792857 | 112 | 0.602876 | import json
from collections import OrderedDict
from django.db import models
from django import forms
from cms.models import Component, ComponentType, Section
OBJ_TYPE_TO_FIELD_LOOKUP = {
'string': {
'field': models.CharField,
},
'number': {
'field': models.FloatField
},
'bool': {
... | true | true |
1c285928f3ba366f6726e797406628c98a89dcf2 | 22,671 | py | Python | code/lstm.py | ystoto/shelter_ml | a961a6cd6c8771a3a8ee8e807bbe61c5c42ef857 | [
"BSD-3-Clause"
] | 42 | 2015-04-17T08:33:54.000Z | 2021-05-24T08:49:51.000Z | code/lstm.py | ystoto/shelter_ml | a961a6cd6c8771a3a8ee8e807bbe61c5c42ef857 | [
"BSD-3-Clause"
] | null | null | null | code/lstm.py | ystoto/shelter_ml | a961a6cd6c8771a3a8ee8e807bbe61c5c42ef857 | [
"BSD-3-Clause"
] | 20 | 2015-03-15T19:11:47.000Z | 2020-07-22T13:37:16.000Z | '''
Build a tweet sentiment analyzer
'''
from __future__ import print_function
import six.moves.cPickle as pickle
from collections import OrderedDict
import sys
import time
import numpy
import theano
from theano import config
import theano.tensor as tensor
from theano.sandbox.rng_mrg import MRG_RandomStreams as Rand... | 34.454407 | 154 | 0.555688 |
from __future__ import print_function
import six.moves.cPickle as pickle
from collections import OrderedDict
import sys
import time
import numpy
import theano
from theano import config
import theano.tensor as tensor
from theano.sandbox.rng_mrg import MRG_RandomStreams as RandomStreams
import imdb
datasets = {'imdb... | true | true |
1c2859bcd74b3d93917dc784f9fe6dae2e49b458 | 45,114 | py | Python | core_contracts/governance/governance.py | AntonAndell/balanced-contracts | 1444e2eed95087e3b48777832b8de2ca26dfbdfe | [
"MIT"
] | null | null | null | core_contracts/governance/governance.py | AntonAndell/balanced-contracts | 1444e2eed95087e3b48777832b8de2ca26dfbdfe | [
"MIT"
] | null | null | null | core_contracts/governance/governance.py | AntonAndell/balanced-contracts | 1444e2eed95087e3b48777832b8de2ca26dfbdfe | [
"MIT"
] | null | null | null | # Copyright 2021 Balanced DAO
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing,... | 42.044734 | 121 | 0.654697 |
from .data_objects import *
from .utils.checks import *
TAG = 'Governance'
class Governance(IconScoreBase):
def __init__(self, db: IconScoreDatabase) -> None:
super().__init__(db)
self.addresses = Addresses(db, self)
self.vote_execute = VoteActions(db, self)
self._l... | true | true |
1c285a9005fa4ae5e2ed6e4db2706b01f6592187 | 600 | py | Python | sys/debug/ktrace.py | pj1031999/mimiker | ed701132b45dbb6b3b94121cd1ef3820bf4781aa | [
"BSD-3-Clause"
] | 185 | 2016-06-24T16:40:13.000Z | 2022-03-24T18:07:18.000Z | sys/debug/ktrace.py | pj1031999/mimiker | ed701132b45dbb6b3b94121cd1ef3820bf4781aa | [
"BSD-3-Clause"
] | 586 | 2016-04-21T22:54:18.000Z | 2022-03-25T18:34:01.000Z | sys/debug/ktrace.py | pj1031999/mimiker | ed701132b45dbb6b3b94121cd1ef3820bf4781aa | [
"BSD-3-Clause"
] | 57 | 2016-06-03T14:02:11.000Z | 2022-03-12T03:18:54.000Z | from .thread import ThreadCreateBP, ThreadSwitchBP
from .cmd import CommandDispatcher, TraceCommand
class ThreadCreateTrace(TraceCommand):
"""Trace thread create events"""
def __init__(self):
super().__init__('thread_create', ThreadCreateBP)
class ThreadSwitchTrace(TraceCommand):
"""Trace thread... | 27.272727 | 78 | 0.72 | from .thread import ThreadCreateBP, ThreadSwitchBP
from .cmd import CommandDispatcher, TraceCommand
class ThreadCreateTrace(TraceCommand):
def __init__(self):
super().__init__('thread_create', ThreadCreateBP)
class ThreadSwitchTrace(TraceCommand):
def __init__(self):
super().__init__('thread... | true | true |
1c285b2cc0d20cd1cd562b228568e57491468eac | 1,443 | py | Python | utils.py | Snusmumr1000/cara-sample-module | a8d6a83b4472d27ea0d3dc4b2fedc1fb8f8929c1 | [
"MIT"
] | null | null | null | utils.py | Snusmumr1000/cara-sample-module | a8d6a83b4472d27ea0d3dc4b2fedc1fb8f8929c1 | [
"MIT"
] | null | null | null | utils.py | Snusmumr1000/cara-sample-module | a8d6a83b4472d27ea0d3dc4b2fedc1fb8f8929c1 | [
"MIT"
] | null | null | null | import json
import importlib
from pathlib import Path
from caracal.execution import Node
def generate_declarations_in_module_from_implementations(module_directory=".", namespace=None):
module_directory = Path(module_directory)
cfg = json.load(open("cara.json")) # GET repository/cara.json
module_name, nod... | 37 | 104 | 0.738739 | import json
import importlib
from pathlib import Path
from caracal.execution import Node
def generate_declarations_in_module_from_implementations(module_directory=".", namespace=None):
module_directory = Path(module_directory)
cfg = json.load(open("cara.json"))
module_name, node_names = cfg["module_name... | true | true |
1c285c28e3474d8f1d49a5bd2b9a70a38eea62fb | 671 | py | Python | podcasts/migrations/0002_auto_20200705_1958.py | abacaxiguy/filosocast | 837e9991641d4d2fa271c7a1de2fa3ffccd46486 | [
"MIT"
] | null | null | null | podcasts/migrations/0002_auto_20200705_1958.py | abacaxiguy/filosocast | 837e9991641d4d2fa271c7a1de2fa3ffccd46486 | [
"MIT"
] | null | null | null | podcasts/migrations/0002_auto_20200705_1958.py | abacaxiguy/filosocast | 837e9991641d4d2fa271c7a1de2fa3ffccd46486 | [
"MIT"
] | 1 | 2020-07-03T21:04:34.000Z | 2020-07-03T21:04:34.000Z | # Generated by Django 3.0.8 on 2020-07-05 22:58
import datetime
from django.db import migrations, models
from django.utils.timezone import utc
class Migration(migrations.Migration):
dependencies = [
('podcasts', '0001_initial'),
]
operations = [
migrations.AddField(
model_na... | 25.807692 | 110 | 0.609538 |
import datetime
from django.db import migrations, models
from django.utils.timezone import utc
class Migration(migrations.Migration):
dependencies = [
('podcasts', '0001_initial'),
]
operations = [
migrations.AddField(
model_name='podcast',
name='excerto',
... | true | true |
1c285c59aafd2cfdf1fc57993b14e30f92f927a0 | 801 | py | Python | gaphas/painter/painter.py | AhmedMounir/gaphas | a51f0171796199332da8187411ae2d70dc883e2e | [
"Apache-2.0"
] | 1 | 2021-12-17T18:03:15.000Z | 2021-12-17T18:03:15.000Z | gaphas/painter/painter.py | AhmedMounir/gaphas | a51f0171796199332da8187411ae2d70dc883e2e | [
"Apache-2.0"
] | null | null | null | gaphas/painter/painter.py | AhmedMounir/gaphas | a51f0171796199332da8187411ae2d70dc883e2e | [
"Apache-2.0"
] | null | null | null | """The painter module provides different painters for parts of the canvas.
Painters can be swapped in and out.
Each painter takes care of a layer in the canvas (such as grid, items
and handles).
"""
from typing import Collection, Protocol
from cairo import Context as CairoContext
from gaphas.item import Item
cla... | 25.83871 | 74 | 0.685393 |
from typing import Collection, Protocol
from cairo import Context as CairoContext
from gaphas.item import Item
class Painter(Protocol):
def paint(self, items: Collection[Item], cairo: CairoContext) -> None:
pass
class ItemPainterType(Protocol):
def paint_item(self, item: Item, cairo: CairoContex... | true | true |
1c285c63b0e425735f50b2fbbcfe55a32b02dd05 | 51,777 | py | Python | Assoc/annotator.py | jianTaoLiu-SWJTU2012/taolib | 6c3d6bdbfc8d6038ce4835f6e149c0f3dba8ca4d | [
"BSD-3-Clause"
] | 14 | 2015-12-25T14:20:25.000Z | 2022-01-01T07:31:56.000Z | Assoc/annotator.py | jianTaoLiu-SWJTU2012/taolib | 6c3d6bdbfc8d6038ce4835f6e149c0f3dba8ca4d | [
"BSD-3-Clause"
] | null | null | null | Assoc/annotator.py | jianTaoLiu-SWJTU2012/taolib | 6c3d6bdbfc8d6038ce4835f6e149c0f3dba8ca4d | [
"BSD-3-Clause"
] | 11 | 2016-11-06T06:27:10.000Z | 2021-06-16T16:11:01.000Z |
"""Module Description
Copyright (c) 2008 H. Gene Shin <shin@jimmy.harvard.edu>
This code is free software; you can redistribute it and/or modify it
under the terms of the BSD License (see the file COPYING included with
the distribution).
@status: experimental
@version: $Revision$
@author: H. Gene Shin
@contact: s... | 43.916031 | 223 | 0.557526 |
import sys,time,re,operator,copy,sqlite3,warnings
import itertools
from array import *
import bisect
from Cistrome.Assoc.inout import *
from Cistrome.Assoc.tables import *
from Cistrome.Assoc.sampler import *
from Cistrome.Assoc.corelib import *
from Cistrome.CoreLib.BasicStat import *
class Annotator:
... | true | true |
1c285c644645bded97a5d762cd9d1de80f332262 | 664 | py | Python | structure/priority_quene.py | fujihiraryo/library | cdb01e710219d7111f890d09f89531916dd03533 | [
"MIT"
] | null | null | null | structure/priority_quene.py | fujihiraryo/library | cdb01e710219d7111f890d09f89531916dd03533 | [
"MIT"
] | 4 | 2020-12-16T10:00:00.000Z | 2021-02-12T12:51:50.000Z | structure/priority_quene.py | fujihiraryo/python-kyopro-library | cdb01e710219d7111f890d09f89531916dd03533 | [
"MIT"
] | null | null | null | import heapq
from collections import defaultdict
class PriorityQuene:
def __init__(self):
self.heap = []
self.count = defaultdict(int)
def push(self, x):
heapq.heappush(self.heap, x)
self.count[x] += 1
def pop(self):
res = self.top()
self.remove(res)
... | 20.121212 | 38 | 0.53012 | import heapq
from collections import defaultdict
class PriorityQuene:
def __init__(self):
self.heap = []
self.count = defaultdict(int)
def push(self, x):
heapq.heappush(self.heap, x)
self.count[x] += 1
def pop(self):
res = self.top()
self.remove(res)
... | true | true |
1c285cb123a7ce3c58a19bb07d6ecfe7a72e9dd0 | 324 | py | Python | tests/urls.py | softformance/django-social-photostream | 0e9e4a2aca906961b1a75d82fbac998febcfad9a | [
"MIT"
] | null | null | null | tests/urls.py | softformance/django-social-photostream | 0e9e4a2aca906961b1a75d82fbac998febcfad9a | [
"MIT"
] | null | null | null | tests/urls.py | softformance/django-social-photostream | 0e9e4a2aca906961b1a75d82fbac998febcfad9a | [
"MIT"
] | null | null | null | # -*- coding: utf-8
from __future__ import unicode_literals, absolute_import
from django.conf.urls import url, include
from django_social_photostream.urls import urlpatterns as django_social_photostream_urls
urlpatterns = [
url(r'^', include(django_social_photostream_urls, namespace='django_social_photostream'))... | 29.454545 | 94 | 0.811728 |
from __future__ import unicode_literals, absolute_import
from django.conf.urls import url, include
from django_social_photostream.urls import urlpatterns as django_social_photostream_urls
urlpatterns = [
url(r'^', include(django_social_photostream_urls, namespace='django_social_photostream')),
]
| true | true |
1c285dbf137657d1b84e2b84900a179b96fdea7d | 2,968 | py | Python | examples/minimal/models.py | jqueguiner/haven | 7b2a5d46b08f48f1112f8903f1b97c6adadff3f4 | [
"Apache-2.0"
] | 26 | 2020-01-09T14:28:28.000Z | 2020-08-09T08:03:08.000Z | examples/minimal/models.py | jqueguiner/haven | 7b2a5d46b08f48f1112f8903f1b97c6adadff3f4 | [
"Apache-2.0"
] | null | null | null | examples/minimal/models.py | jqueguiner/haven | 7b2a5d46b08f48f1112f8903f1b97c6adadff3f4 | [
"Apache-2.0"
] | 6 | 2020-02-11T19:43:50.000Z | 2020-05-12T01:59:59.000Z | import torch
import tqdm
from torch import nn
def get_model(model_name):
if model_name == 'mlp':
return MLP()
class MLP(nn.Module):
def __init__(self, input_size=784, n_classes=10):
"""Constructor."""
super().__init__()
self.input_size = input_size
self.hidden_layers... | 28 | 81 | 0.579515 | import torch
import tqdm
from torch import nn
def get_model(model_name):
if model_name == 'mlp':
return MLP()
class MLP(nn.Module):
def __init__(self, input_size=784, n_classes=10):
super().__init__()
self.input_size = input_size
self.hidden_layers = nn.ModuleList([nn.Linear... | true | true |
1c285e501ec1f348ac9bc185f83cf8cf89827153 | 2,739 | py | Python | scripts/CursesExample.py | AgalmicVentures/Environment | b2ef280d2424a5a940af7cef0c9a6dbca62d93c4 | [
"MIT"
] | 1 | 2018-10-10T01:06:14.000Z | 2018-10-10T01:06:14.000Z | scripts/CursesExample.py | AgalmicVentures/Environment | b2ef280d2424a5a940af7cef0c9a6dbca62d93c4 | [
"MIT"
] | 1 | 2020-02-28T18:13:05.000Z | 2020-02-28T18:13:05.000Z | scripts/CursesExample.py | AgalmicVentures/Environment | b2ef280d2424a5a940af7cef0c9a6dbca62d93c4 | [
"MIT"
] | 1 | 2017-02-26T09:29:06.000Z | 2017-02-26T09:29:06.000Z | #!/usr/bin/env python3
# Copyright (c) 2015-2021 Agalmic Ventures LLC (www.agalmicventures.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
# in the Software without restriction, including without limit... | 26.085714 | 81 | 0.71705 |
import curses
import sys
import time
def centerText(screen, text, row, flags=0):
c = (curses.COLS - len(text)) // 2
screen.addstr(row, c, text, flags)
return c
def cursesMain(screen):
c = centerText(screen, 'Enter Your Name', 1, curses.A_BOLD | curses.A_UNDERLINE)
name = ''
while name... | true | true |
1c285ebf82531064442be76def442ed35fbe9eaf | 1,046 | py | Python | PythonExercicios/ex042.py | github-felipe/ExerciciosEmPython-cursoemvideo | 0045464a287f21b6245554a975588cf06c5b476d | [
"MIT"
] | null | null | null | PythonExercicios/ex042.py | github-felipe/ExerciciosEmPython-cursoemvideo | 0045464a287f21b6245554a975588cf06c5b476d | [
"MIT"
] | null | null | null | PythonExercicios/ex042.py | github-felipe/ExerciciosEmPython-cursoemvideo | 0045464a287f21b6245554a975588cf06c5b476d | [
"MIT"
] | null | null | null | valores = str(input('Digite o comprimento de 3 retas separando-as por espaços: ')).strip()
n1 = float(valores.split()[0])
n2 = float(valores.split()[1])
n3 = float(valores.split()[2])
if n1 < n2 + n3 and n2 < n1 + n3 and n3 < n1 + n2:
print('Com o comprimento dessas retas é possível de se formar um triângulo!')
... | 47.545455 | 110 | 0.64914 | valores = str(input('Digite o comprimento de 3 retas separando-as por espaços: ')).strip()
n1 = float(valores.split()[0])
n2 = float(valores.split()[1])
n3 = float(valores.split()[2])
if n1 < n2 + n3 and n2 < n1 + n3 and n3 < n1 + n2:
print('Com o comprimento dessas retas é possível de se formar um triângulo!')
... | true | true |
1c285ed6d0793257cfbafe133424593761a8fd62 | 3,286 | py | Python | exampleSite/exampleSite/settings.py | marcanuy/django-staticpages | e65d29e31823cdfda186043ddf5c05a0c49cd73a | [
"MIT"
] | 1 | 2019-06-17T20:57:27.000Z | 2019-06-17T20:57:27.000Z | exampleSite/exampleSite/settings.py | marcanuy/django-mdpages | e65d29e31823cdfda186043ddf5c05a0c49cd73a | [
"MIT"
] | null | null | null | exampleSite/exampleSite/settings.py | marcanuy/django-mdpages | e65d29e31823cdfda186043ddf5c05a0c49cd73a | [
"MIT"
] | null | null | null | """
Django settings for exampleSite project.
Generated by 'django-admin startproject' using Django 2.1.7.
For more information on this file, see
https://docs.djangoproject.com/en/2.1/topics/settings/
For the full list of settings and their values, see
https://docs.djangoproject.com/en/2.1/ref/settings/
"""
import o... | 25.874016 | 91 | 0.6972 |
import os
BASE_DIR = os.path.dirname(os.path.dirname(os.path.abspath(__file__)))
SECRET_KEY = 'ox)pg8l3ac6(+$l7w(xu$j3*^q_1w^uj%h1g^(%r799-kbl^9='
DEBUG = True
ALLOWED_HOSTS = []
# Application definition
INSTALLED_APPS = [
'django.contrib.admin',
'django.contrib.auth',
'django.contrib.content... | true | true |
1c285ef0d6de58092a078922a7328fae2e55d79e | 422 | py | Python | example_project/news/factories.py | pancentric/django-mininews | 3e875c5c7f02eb713c5cca5da938fc50cf0d11aa | [
"MIT"
] | null | null | null | example_project/news/factories.py | pancentric/django-mininews | 3e875c5c7f02eb713c5cca5da938fc50cf0d11aa | [
"MIT"
] | null | null | null | example_project/news/factories.py | pancentric/django-mininews | 3e875c5c7f02eb713c5cca5da938fc50cf0d11aa | [
"MIT"
] | null | null | null | from django.utils.text import slugify
import factory
from .models import Article
class ArticleFactory(factory.django.DjangoModelFactory):
FACTORY_FOR = Article
# Create some dummy default values for the title (which has to be unique).
title = factory.Sequence(lambda n: 'article{0:0>3}'.format(n))
s... | 30.142857 | 78 | 0.748815 | from django.utils.text import slugify
import factory
from .models import Article
class ArticleFactory(factory.django.DjangoModelFactory):
FACTORY_FOR = Article
title = factory.Sequence(lambda n: 'article{0:0>3}'.format(n))
slug = factory.LazyAttribute(lambda a: slugify(unicode(a.title)))
statu... | true | true |
1c285f116a01ff07b067a6acd193ce4a93a5a6b6 | 21,514 | py | Python | stumpy/stimp.py | SaVoAMP/stumpy | d63963caaf6a8b64448953f638c1d3345e05a36a | [
"BSD-3-Clause"
] | null | null | null | stumpy/stimp.py | SaVoAMP/stumpy | d63963caaf6a8b64448953f638c1d3345e05a36a | [
"BSD-3-Clause"
] | null | null | null | stumpy/stimp.py | SaVoAMP/stumpy | d63963caaf6a8b64448953f638c1d3345e05a36a | [
"BSD-3-Clause"
] | null | null | null | # STUMPY
# Copyright 2019 TD Ameritrade. Released under the terms of the 3-Clause BSD license.
# STUMPY is a trademark of TD Ameritrade IP Company, Inc. All rights reserved.
import numpy as np
from . import core, stump, scrump, stumped
from .aamp_stimp import aamp_stimp, aamp_stimped
def _normalize_pan(pan, ms, bfs_... | 35.153595 | 88 | 0.61216 |
import numpy as np
from . import core, stump, scrump, stumped
from .aamp_stimp import aamp_stimp, aamp_stimped
def _normalize_pan(pan, ms, bfs_indices, n_processed):
idx = bfs_indices[:n_processed]
norm = 1.0 / (2.0 * np.sqrt(ms[:n_processed]))
pan[idx] = np.minimum(1.0, pan[idx] * norm[:, np.newaxis]... | true | true |
1c28604cfe7827a11d8bed4b8ef0e41fb846af0f | 827 | py | Python | src/pugs/logic.py | gaborbernat/pugs | 7585a2c6775998d9d3946db08629c5d08096088d | [
"MIT"
] | 14 | 2019-02-13T08:41:48.000Z | 2021-09-15T06:59:26.000Z | src/pugs/logic.py | gaborbernat/pugs | 7585a2c6775998d9d3946db08629c5d08096088d | [
"MIT"
] | null | null | null | src/pugs/logic.py | gaborbernat/pugs | 7585a2c6775998d9d3946db08629c5d08096088d | [
"MIT"
] | 3 | 2019-02-14T05:12:09.000Z | 2020-11-09T13:21:31.000Z | from __future__ import unicode_literals
from collections import namedtuple
import random
Quote = namedtuple("Quote", ["msg", "source"])
QUOTES = [
Quote(
msg="As a wise Pug once said, all you need is love, kibble and a de-worming"
" tablet every three to six months.",
source="A Pug's Guid... | 29.535714 | 112 | 0.648126 | from __future__ import unicode_literals
from collections import namedtuple
import random
Quote = namedtuple("Quote", ["msg", "source"])
QUOTES = [
Quote(
msg="As a wise Pug once said, all you need is love, kibble and a de-worming"
" tablet every three to six months.",
source="A Pug's Guid... | true | true |
1c2861aad231b1ea4b4673b25e1d1fef9a09bc45 | 5,586 | py | Python | manage/generate_releasenotes.py | bdraco/integration | b30e799bb27fdd978bd68f21909c82005d0dd3ea | [
"MIT"
] | 2 | 2019-06-18T11:30:53.000Z | 2019-10-03T21:34:11.000Z | manage/generate_releasenotes.py | bdraco/integration | b30e799bb27fdd978bd68f21909c82005d0dd3ea | [
"MIT"
] | 341 | 2019-06-18T11:30:55.000Z | 2021-07-15T05:38:46.000Z | manage/generate_releasenotes.py | bdraco/integration | b30e799bb27fdd978bd68f21909c82005d0dd3ea | [
"MIT"
] | null | null | null | import json
import re
import sys
from github import Github
BODY = """
[](https://github.com/hacs/integration/releases/{version})
{changes}
## Links
- [Discord server for HACS](https://discord.gg/apgchf8)
- [H... | 30.032258 | 165 | 0.612961 | import json
import re
import sys
from github import Github
BODY = """
[](https://github.com/hacs/integration/releases/{version})
{changes}
## Links
- [Discord server for HACS](https://discord.gg/apgchf8)
- [H... | true | true |
1c28636ec32011e0af41b2f4a6d2b70111d697e7 | 9,225 | py | Python | libs/shape.py | nicolalorusso/roLabelImg | 763e69d56e947793463b3e5fee503320e1be0b86 | [
"MIT"
] | null | null | null | libs/shape.py | nicolalorusso/roLabelImg | 763e69d56e947793463b3e5fee503320e1be0b86 | [
"MIT"
] | null | null | null | libs/shape.py | nicolalorusso/roLabelImg | 763e69d56e947793463b3e5fee503320e1be0b86 | [
"MIT"
] | null | null | null | #!/usr/bin/python
# -*- coding: utf-8 -*-
try:
from PyQt5.QtGui import *
from PyQt5.QtCore import *
except ImportError:
from PyQt4.QtGui import *
from PyQt4.QtCore import *
from lib import distance
import math
DEFAULT_LINE_COLOR = QColor(0, 255, 0, 128)
DEFAULT_FILL_COLOR = QColor(255, 0, 0, 128)
DE... | 33.915441 | 119 | 0.58103 |
try:
from PyQt5.QtGui import *
from PyQt5.QtCore import *
except ImportError:
from PyQt4.QtGui import *
from PyQt4.QtCore import *
from lib import distance
import math
DEFAULT_LINE_COLOR = QColor(0, 255, 0, 128)
DEFAULT_FILL_COLOR = QColor(255, 0, 0, 128)
DEFAULT_SELECT_LINE_COLOR = QColor(255, 25... | true | true |
1c28642a84c4644a6841f8f33fd71d25cd6f0a49 | 11,734 | py | Python | scripts/codegen/generate_system_calls.py | iguessthislldo/os | 4d9b71c196d26af0d60dafbe7123d4e01b939a95 | [
"MIT"
] | 2 | 2018-02-12T10:18:37.000Z | 2018-02-19T13:38:12.000Z | scripts/codegen/generate_system_calls.py | iguessthislldo/os | 4d9b71c196d26af0d60dafbe7123d4e01b939a95 | [
"MIT"
] | null | null | null | scripts/codegen/generate_system_calls.py | iguessthislldo/os | 4d9b71c196d26af0d60dafbe7123d4e01b939a95 | [
"MIT"
] | null | null | null | #!/usr/bin/env python3
# Generates system call interface functions that can be called by programs
# based on the implementation file.
import sys
from pathlib import Path
import re
from subprocess import check_output, PIPE
debug = False
impl_file = Path('kernel/platform/system_calls.zig')
interface_file = Path('libs... | 34.209913 | 97 | 0.547043 |
import sys
from pathlib import Path
import re
from subprocess import check_output, PIPE
debug = False
impl_file = Path('kernel/platform/system_calls.zig')
interface_file = Path('libs/georgios/system_calls.zig')
this_file = Path(__file__)
syscall_error_values_file = Path('tmp/syscall_error_values.zig')
int_num =... | true | true |
1c28644cccaa9b7ccc104007acdb7fe41da7c7ad | 1,198 | py | Python | python/graphscope/experimental/nx/tests/algorithms/forward/operators/test_product.py | wenyuanyu/GraphScope | a40ccaf70557e608d8b091eb25ab04477f99ce21 | [
"Apache-2.0"
] | 2 | 2020-12-15T08:42:10.000Z | 2022-01-14T09:13:16.000Z | python/graphscope/experimental/nx/tests/algorithms/forward/operators/test_product.py | wenyuanyu/GraphScope | a40ccaf70557e608d8b091eb25ab04477f99ce21 | [
"Apache-2.0"
] | 1 | 2020-12-22T13:15:40.000Z | 2020-12-22T13:15:40.000Z | python/graphscope/experimental/nx/tests/algorithms/forward/operators/test_product.py | wenyuanyu/GraphScope | a40ccaf70557e608d8b091eb25ab04477f99ce21 | [
"Apache-2.0"
] | 1 | 2021-11-23T03:40:43.000Z | 2021-11-23T03:40:43.000Z | import networkx.algorithms.operators.tests.test_product
import pytest
from graphscope.experimental.nx.utils.compat import import_as_graphscope_nx
import_as_graphscope_nx(networkx.algorithms.operators.tests.test_product,
decorators=pytest.mark.usefixtures("graphscope_session"))
def test_tenso... | 27.860465 | 81 | 0.724541 | import networkx.algorithms.operators.tests.test_product
import pytest
from graphscope.experimental.nx.utils.compat import import_as_graphscope_nx
import_as_graphscope_nx(networkx.algorithms.operators.tests.test_product,
decorators=pytest.mark.usefixtures("graphscope_session"))
def test_tenso... | true | true |
1c2864a2bdd78822b669b80b46b9d38299caecda | 2,279 | py | Python | src/data_collection/preprocess_data/make_csv.py | GrigalashviliT/spoilerBlocker | 18a5e9689099d3b631a15ed20cc84a043f324055 | [
"MIT"
] | 5 | 2020-05-20T16:59:04.000Z | 2021-08-22T18:30:47.000Z | src/data_collection/preprocess_data/make_csv.py | GrigalashviliT/spoilerBlocker | 18a5e9689099d3b631a15ed20cc84a043f324055 | [
"MIT"
] | 10 | 2020-05-20T16:07:04.000Z | 2020-07-22T19:21:16.000Z | src/data_collection/preprocess_data/make_csv.py | GrigalashviliT/spoilerBlocker | 18a5e9689099d3b631a15ed20cc84a043f324055 | [
"MIT"
] | null | null | null | import pandas as pd
import glob
from re import sub
dct = {
'sentence': [],
'label': []
}
def process_text(text):
text = text.replace('\r\n', '.')
text = text.replace('\n', '.')
text = text.replace('\r', '.')
text = text.lower()
text = text.strip().split('.')
retu... | 23.255102 | 60 | 0.448881 | import pandas as pd
import glob
from re import sub
dct = {
'sentence': [],
'label': []
}
def process_text(text):
text = text.replace('\r\n', '.')
text = text.replace('\n', '.')
text = text.replace('\r', '.')
text = text.lower()
text = text.strip().split('.')
retu... | true | true |
1c28654704522dfcc91b1351cb02b23c007bc10f | 2,265 | py | Python | minset.py | pan0625/pan | 410d7acdecffb6e614522b24ab42765307baf868 | [
"MIT"
] | null | null | null | minset.py | pan0625/pan | 410d7acdecffb6e614522b24ab42765307baf868 | [
"MIT"
] | null | null | null | minset.py | pan0625/pan | 410d7acdecffb6e614522b24ab42765307baf868 | [
"MIT"
] | null | null | null | import networkx as nx
import operator
import random
G = nx.read_gexf("testba4.gexf")
'''G = nx.read_gml('dolphin.gml')'''
'''G = nx.read_gexf("dolphin.gml")'''
'''G = nx.karate_club_graph()'''
nodes = G.nodes()
listnodes = {}
neighbors = {}
payofflist = {}
for n in nodes:
listnodes[n] ="D"
ne... | 22.878788 | 96 | 0.428698 | import networkx as nx
import operator
import random
G = nx.read_gexf("testba4.gexf")
nodes = G.nodes()
listnodes = {}
neighbors = {}
payofflist = {}
for n in nodes:
listnodes[n] ="D"
neighbors[n] = G.neighbors(n)
payofflist[n] = 0
nodes2 = nx.degree(G)
sortednodes2 = sorted(nodes2.items... | true | true |
1c28659d46cb51f7ef1685ef452f77d7ade28727 | 269 | py | Python | init.py | kyehyeon/SNIPER | 2b8723729bfb91275d598b55752f32d8a00a33ad | [
"Apache-2.0"
] | 2,722 | 2018-06-18T10:01:29.000Z | 2022-03-12T09:46:06.000Z | init.py | kyehyeon/SNIPER | 2b8723729bfb91275d598b55752f32d8a00a33ad | [
"Apache-2.0"
] | 184 | 2018-06-18T11:35:54.000Z | 2021-10-19T11:31:56.000Z | init.py | kyehyeon/SNIPER | 2b8723729bfb91275d598b55752f32d8a00a33ad | [
"Apache-2.0"
] | 486 | 2018-06-18T08:55:24.000Z | 2022-02-21T15:51:39.000Z | import sys
import logging
import os
import matplotlib
matplotlib.use('Agg')
os.environ['PYTHONUNBUFFERED'] = '1'
os.environ['MXNET_CUDNN_AUTOTUNE_DEFAULT'] = '0'
logging.basicConfig(level=logging.INFO)
sys.path.insert(0,'lib')
sys.path.insert(0,'SNIPER-mxnet/python')
| 22.416667 | 48 | 0.773234 | import sys
import logging
import os
import matplotlib
matplotlib.use('Agg')
os.environ['PYTHONUNBUFFERED'] = '1'
os.environ['MXNET_CUDNN_AUTOTUNE_DEFAULT'] = '0'
logging.basicConfig(level=logging.INFO)
sys.path.insert(0,'lib')
sys.path.insert(0,'SNIPER-mxnet/python')
| true | true |
1c2865ce773c47280e24a747de8457e9fe369930 | 5,276 | py | Python | puzzles/minesweeper/python/minesweeper.py | CarbonDDR/al-go-rithms | 8e65affbe812931b7dde0e2933eb06c0f44b4130 | [
"CC0-1.0"
] | 1,253 | 2017-06-06T07:19:25.000Z | 2022-03-30T17:07:58.000Z | puzzles/minesweeper/python/minesweeper.py | rishabh99-rc/al-go-rithms | 4df20d7ef7598fda4bc89101f9a99aac94cdd794 | [
"CC0-1.0"
] | 554 | 2017-09-29T18:56:01.000Z | 2022-02-21T15:48:13.000Z | puzzles/minesweeper/python/minesweeper.py | rishabh99-rc/al-go-rithms | 4df20d7ef7598fda4bc89101f9a99aac94cdd794 | [
"CC0-1.0"
] | 2,226 | 2017-09-29T19:59:59.000Z | 2022-03-25T08:59:55.000Z |
import random
class Cell(object):
def __init__(self, is_mine, is_visible=False, is_flagged=False):
self.is_mine = is_mine
self.is_visible = is_visible
self.is_flagged = is_flagged
def show(self):
self.is_visible = True
def flag(self):
self.is_flagged = not self.is... | 32.975 | 104 | 0.539234 |
import random
class Cell(object):
def __init__(self, is_mine, is_visible=False, is_flagged=False):
self.is_mine = is_mine
self.is_visible = is_visible
self.is_flagged = is_flagged
def show(self):
self.is_visible = True
def flag(self):
self.is_flagged = not self.is... | true | true |
1c2865ec283f2dfdf4b6fea9ccb5ea06d0eded6e | 19,030 | py | Python | nova/tests/unit/conductor/tasks/test_live_migrate.py | TMaddox/nova | e5c169d15528a8e2eadb8eca668ea0d183cf8648 | [
"Apache-2.0"
] | 4 | 2015-04-13T14:52:41.000Z | 2018-02-03T19:32:13.000Z | nova/tests/unit/conductor/tasks/test_live_migrate.py | TMaddox/nova | e5c169d15528a8e2eadb8eca668ea0d183cf8648 | [
"Apache-2.0"
] | null | null | null | nova/tests/unit/conductor/tasks/test_live_migrate.py | TMaddox/nova | e5c169d15528a8e2eadb8eca668ea0d183cf8648 | [
"Apache-2.0"
] | 2 | 2015-10-10T05:30:38.000Z | 2020-07-24T01:56:46.000Z | # Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance with the License. You may obtain
# a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# d... | 46.871921 | 79 | 0.667998 |
from mox3 import mox
from nova.compute import power_state
from nova.compute import utils as compute_utils
from nova.conductor.tasks import live_migrate
from nova import exception
from nova import objects
from nova.scheduler import utils as scheduler_utils
from nova import test
from nova.tests.unit import f... | true | true |
1c28661ef85d052fecedd212a0e6458f7e626a95 | 689 | py | Python | python/extremeText/__init__.py | mwydmuch/fastText | 0a9274cfef517aeef47de5e0078933889ca35f68 | [
"BSD-3-Clause"
] | 144 | 2018-10-28T02:39:05.000Z | 2022-03-21T10:36:03.000Z | python/extremeText/__init__.py | Marqt/fastText | 0a9274cfef517aeef47de5e0078933889ca35f68 | [
"BSD-3-Clause"
] | 9 | 2018-10-28T08:01:38.000Z | 2020-09-17T13:45:07.000Z | python/extremeText/__init__.py | Marqt/fastText | 0a9274cfef517aeef47de5e0078933889ca35f68 | [
"BSD-3-Clause"
] | 19 | 2018-12-18T13:32:50.000Z | 2021-01-25T11:46:40.000Z | # Copyright (c) 2017-present, Facebook, Inc.
# All rights reserved.
#
# This source code is licensed under the BSD-style license found in the
# LICENSE file in the root directory of this source tree. An additional grant
# of patent rights can be found in the PATENTS file in the same directory.
from __future__ import a... | 34.45 | 77 | 0.822932 |
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
from __future__ import unicode_literals
from .ExtremeText import train_supervised
from .ExtremeText import train_unsupervised
from .ExtremeText import load_model
from .ExtremeText import tokenize
from .E... | true | true |
1c2866b837763c64b71780243ea635a0768d4d94 | 1,299 | py | Python | src/swarm_rescue/tuto_spg_jupyter/tuto_02_03_rooms.py | filliat/swarm-rescue | ce323c90ccb4a25216c63abccd09d3f31eea1189 | [
"MIT"
] | 5 | 2021-11-11T12:19:00.000Z | 2022-03-09T08:47:37.000Z | src/swarm_rescue/tuto_spg_jupyter/tuto_02_03_rooms.py | filliat/swarm-rescue | ce323c90ccb4a25216c63abccd09d3f31eea1189 | [
"MIT"
] | 4 | 2021-11-06T17:19:11.000Z | 2022-02-16T11:46:54.000Z | src/swarm_rescue/tuto_spg_jupyter/tuto_02_03_rooms.py | filliat/swarm-rescue | ce323c90ccb4a25216c63abccd09d3f31eea1189 | [
"MIT"
] | 3 | 2021-11-10T17:14:55.000Z | 2021-11-22T16:32:17.000Z | from simple_playgrounds.element.elements.basic import Physical
from simple_playgrounds.common.position_utils import CoordinateSampler
from simple_playgrounds.playground import GridRooms
from simple_playgrounds.engine import Engine
# matplotlib inline
import matplotlib.pyplot as plt
def plt_image(img):
plt.axis('... | 34.184211 | 91 | 0.729792 | from simple_playgrounds.element.elements.basic import Physical
from simple_playgrounds.common.position_utils import CoordinateSampler
from simple_playgrounds.playground import GridRooms
from simple_playgrounds.engine import Engine
import matplotlib.pyplot as plt
def plt_image(img):
plt.axis('off')
plt.imsho... | true | true |
1c28683ade3b025ca827addd6d21ab81cf04e580 | 13,272 | py | Python | log_mito_act/model_537.py | LoLab-VU/Bayesian_Inference_of_Network_Dynamics | 54a5ef7e868be34289836bbbb024a2963c0c9c86 | [
"MIT"
] | null | null | null | log_mito_act/model_537.py | LoLab-VU/Bayesian_Inference_of_Network_Dynamics | 54a5ef7e868be34289836bbbb024a2963c0c9c86 | [
"MIT"
] | null | null | null | log_mito_act/model_537.py | LoLab-VU/Bayesian_Inference_of_Network_Dynamics | 54a5ef7e868be34289836bbbb024a2963c0c9c86 | [
"MIT"
] | null | null | null | # exported from PySB model 'model'
from pysb import Model, Monomer, Parameter, Expression, Compartment, Rule, Observable, Initial, MatchOnce, Annotation, ANY, WILD
Model()
Monomer('Ligand', ['Receptor'])
Monomer('ParpU', ['C3A'])
Monomer('C8A', ['BidU'])
Monomer('BaxM', ['BidM', 'BaxA'])
Monomer('Apop', ['C3pro', 'X... | 79.473054 | 614 | 0.80975 |
from pysb import Model, Monomer, Parameter, Expression, Compartment, Rule, Observable, Initial, MatchOnce, Annotation, ANY, WILD
Model()
Monomer('Ligand', ['Receptor'])
Monomer('ParpU', ['C3A'])
Monomer('C8A', ['BidU'])
Monomer('BaxM', ['BidM', 'BaxA'])
Monomer('Apop', ['C3pro', 'Xiap'])
Monomer('Fadd', ['Receptor'... | true | true |
1c2868d84cb76bdb07e982a72bef09da05a81eef | 114 | py | Python | glue/viewers/table/__init__.py | ejeschke/glue | 21689e3474aeaeb70e258d76c60755596856976c | [
"BSD-3-Clause"
] | null | null | null | glue/viewers/table/__init__.py | ejeschke/glue | 21689e3474aeaeb70e258d76c60755596856976c | [
"BSD-3-Clause"
] | null | null | null | glue/viewers/table/__init__.py | ejeschke/glue | 21689e3474aeaeb70e258d76c60755596856976c | [
"BSD-3-Clause"
] | null | null | null | def setup():
from glue.config import qt_client
from .qt import TableViewer
qt_client.add(TableViewer)
| 22.8 | 37 | 0.72807 | def setup():
from glue.config import qt_client
from .qt import TableViewer
qt_client.add(TableViewer)
| true | true |
1c286a016ff53e53cdfd78b1241ee75e3bf3395e | 3,688 | py | Python | gs_extensions/gnome_shell_extension_wrapper.py | ilyachch/gnome_shell_extensions_install_tool | e1e19b4d390db99e243fa0e0cd4466fd843482c9 | [
"MIT"
] | null | null | null | gs_extensions/gnome_shell_extension_wrapper.py | ilyachch/gnome_shell_extensions_install_tool | e1e19b4d390db99e243fa0e0cd4466fd843482c9 | [
"MIT"
] | 4 | 2019-03-25T07:27:45.000Z | 2020-01-16T14:54:07.000Z | gs_extensions/gnome_shell_extension_wrapper.py | ilyachch/gs_extensions | e1e19b4d390db99e243fa0e0cd4466fd843482c9 | [
"MIT"
] | null | null | null | import os
import subprocess
import tempfile
import zipfile
import requests
from gs_extensions.exceptions import NoExtensionVersionForGnomeShell, ExtensionNotFoundInHub
class GnomeShellExtensionWrapper:
EXTENSIONS_API_URL = 'https://extensions.gnome.org/ajax/detail/'
DOWNLOAD_LINK_TPL = 'https://extensions.... | 36.88 | 108 | 0.680857 | import os
import subprocess
import tempfile
import zipfile
import requests
from gs_extensions.exceptions import NoExtensionVersionForGnomeShell, ExtensionNotFoundInHub
class GnomeShellExtensionWrapper:
EXTENSIONS_API_URL = 'https://extensions.gnome.org/ajax/detail/'
DOWNLOAD_LINK_TPL = 'https://extensions.... | true | true |
1c286a01a81a4fb0d9e2dfb76694133b9a13deba | 3,062 | py | Python | mwlib/treecleanerhelper.py | h4ck3rm1k3/mwlib | 11475c6ad7480e35a4a59f276c47f6a5203435cc | [
"Unlicense"
] | 1 | 2019-04-27T20:14:53.000Z | 2019-04-27T20:14:53.000Z | mwlib/treecleanerhelper.py | h4ck3rm1k3/mwlib | 11475c6ad7480e35a4a59f276c47f6a5203435cc | [
"Unlicense"
] | null | null | null | mwlib/treecleanerhelper.py | h4ck3rm1k3/mwlib | 11475c6ad7480e35a4a59f276c47f6a5203435cc | [
"Unlicense"
] | null | null | null | #! /usr/bin/env python
#! -*- coding:utf-8 -*-
# Copyright (c) 2007, PediaPress GmbH
# See README.rst for additional licensing information.
import math
from advtree import Cell, ImageLink, Link, Math, NamedURL, Reference, Text, URL
def getNodeHeight(node, params):
lineHeight = params['lineHeight']
charsPerL... | 35.604651 | 145 | 0.584585 |
import math
from advtree import Cell, ImageLink, Link, Math, NamedURL, Reference, Text, URL
def getNodeHeight(node, params):
lineHeight = params['lineHeight']
charsPerLine = params['charsPerLine']
paragraphMargin = params['paragraphMargin']
imgHeight = params['imgHeight']
height = 0
... | true | true |
1c286a432bd7094910e4e8fc73f9ba28ef9b12d9 | 1,138 | py | Python | maskrcnn_benchmark/data/datasets/evaluation/__init__.py | Loranet-Technologies/traffic-analysis | e1e50b6c36b3da6279678c679500a8cf4e62ccef | [
"MIT"
] | 14 | 2019-10-18T07:54:40.000Z | 2021-11-07T11:43:04.000Z | maskrcnn_benchmark/data/datasets/evaluation/__init__.py | Loranet-Technologies/traffic-analysis | e1e50b6c36b3da6279678c679500a8cf4e62ccef | [
"MIT"
] | 7 | 2019-10-25T17:10:02.000Z | 2022-03-12T00:04:54.000Z | maskrcnn_benchmark/data/datasets/evaluation/__init__.py | Moonlydark/traffic-analysis | e1e50b6c36b3da6279678c679500a8cf4e62ccef | [
"MIT"
] | 13 | 2019-10-18T07:54:43.000Z | 2022-01-21T23:16:33.000Z | from maskrcnn_benchmark.data import datasets
from .coco import coco_evaluation
from .voc import voc_evaluation
from .traffic import traffic_evaluation
def evaluate(dataset, predictions, output_folder, **kwargs):
"""evaluate dataset using different methods based on dataset type.
Args:
dataset: Dataset... | 36.709677 | 87 | 0.714411 | from maskrcnn_benchmark.data import datasets
from .coco import coco_evaluation
from .voc import voc_evaluation
from .traffic import traffic_evaluation
def evaluate(dataset, predictions, output_folder, **kwargs):
args = dict(
dataset=dataset, predictions=predictions, output_folder=output_folder, **kwargs
... | true | true |
1c286bf2262d0711e64b90077cb8b87e488977ce | 311 | py | Python | advancing_hero/screen/screen.py | hentt30/ces22-project | 06f13ebdf06bbab182b83c882846701ab69e8631 | [
"MIT"
] | 1 | 2021-04-12T01:27:34.000Z | 2021-04-12T01:27:34.000Z | advancing_hero/screen/screen.py | hentt30/ces22-project | 06f13ebdf06bbab182b83c882846701ab69e8631 | [
"MIT"
] | null | null | null | advancing_hero/screen/screen.py | hentt30/ces22-project | 06f13ebdf06bbab182b83c882846701ab69e8631 | [
"MIT"
] | 2 | 2021-04-01T00:13:51.000Z | 2021-04-11T07:15:54.000Z | import pygame
class Screen():
def __init__(
self,
background_path: str = "advancing-hero/images/Sample_fantasy.png"
) -> None:
self.background = pygame.image.load(background_path).convert()
def render(self) -> None:
#Display refresh
pygame.display.flip()
| 20.733333 | 73 | 0.62701 | import pygame
class Screen():
def __init__(
self,
background_path: str = "advancing-hero/images/Sample_fantasy.png"
) -> None:
self.background = pygame.image.load(background_path).convert()
def render(self) -> None:
pygame.display.flip()
| true | true |
1c286c0cadb0ef973002a310b250d14b98316439 | 21,446 | py | Python | sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2016_04_30_preview/aio/operations/_availability_sets_operations.py | rsdoherty/azure-sdk-for-python | 6bba5326677468e6660845a703686327178bb7b1 | [
"MIT"
] | 2,728 | 2015-01-09T10:19:32.000Z | 2022-03-31T14:50:33.000Z | sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2016_04_30_preview/aio/operations/_availability_sets_operations.py | rsdoherty/azure-sdk-for-python | 6bba5326677468e6660845a703686327178bb7b1 | [
"MIT"
] | 17,773 | 2015-01-05T15:57:17.000Z | 2022-03-31T23:50:25.000Z | sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2016_04_30_preview/aio/operations/_availability_sets_operations.py | rsdoherty/azure-sdk-for-python | 6bba5326677468e6660845a703686327178bb7b1 | [
"MIT"
] | 1,916 | 2015-01-19T05:05:41.000Z | 2022-03-31T19:36:44.000Z | # coding=utf-8
# --------------------------------------------------------------------------
# Copyright (c) Microsoft Corporation. All rights reserved.
# Licensed under the MIT License. See License.txt in the project root for license information.
# Code generated by Microsoft (R) AutoRest Code Generator.
# Changes may ... | 48.96347 | 204 | 0.665532 |
from typing import Any, AsyncIterable, Callable, Dict, Generic, Optional, TypeVar
import warnings
from azure.core.async_paging import AsyncItemPaged, AsyncList
from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error
from azure.core.pi... | true | true |
1c286ced002b07e3abe2f67d7a28ed393e055bbf | 5,140 | py | Python | qr_code/views.py | chrissam/django-qr-code | bd3b5e554bda09f4fdc1da298286f649d64dcc8a | [
"BSD-3-Clause"
] | null | null | null | qr_code/views.py | chrissam/django-qr-code | bd3b5e554bda09f4fdc1da298286f649d64dcc8a | [
"BSD-3-Clause"
] | null | null | null | qr_code/views.py | chrissam/django-qr-code | bd3b5e554bda09f4fdc1da298286f649d64dcc8a | [
"BSD-3-Clause"
] | null | null | null | import base64
import binascii
from io import BytesIO
from django.conf import settings
from django.core.exceptions import PermissionDenied, SuspiciousOperation
from django.core.signing import BadSignature, Signer
from django.http import HttpResponse
from functools import wraps
from django.views.decorators.cache import ... | 46.727273 | 170 | 0.734241 | import base64
import binascii
from io import BytesIO
from django.conf import settings
from django.core.exceptions import PermissionDenied, SuspiciousOperation
from django.core.signing import BadSignature, Signer
from django.http import HttpResponse
from functools import wraps
from django.views.decorators.cache import ... | true | true |
1c286def6875ef2725bf68e61afe7518d2bfe286 | 525 | py | Python | env/Lib/site-packages/plotly/validators/histogram2d/hoverlabel/_namelength.py | andresgreen-byte/Laboratorio-1--Inversion-de-Capital | 8a4707301d19c3826c31026c4077930bcd6a8182 | [
"MIT"
] | 11,750 | 2015-10-12T07:03:39.000Z | 2022-03-31T20:43:15.000Z | venv/Lib/site-packages/plotly/validators/histogram2d/hoverlabel/_namelength.py | wakisalvador/constructed-misdirection | 74779e9ec640a11bc08d5d1967c85ac4fa44ea5e | [
"Unlicense"
] | 2,951 | 2015-10-12T00:41:25.000Z | 2022-03-31T22:19:26.000Z | venv/Lib/site-packages/plotly/validators/histogram2d/hoverlabel/_namelength.py | wakisalvador/constructed-misdirection | 74779e9ec640a11bc08d5d1967c85ac4fa44ea5e | [
"Unlicense"
] | 2,623 | 2015-10-15T14:40:27.000Z | 2022-03-28T16:05:50.000Z | import _plotly_utils.basevalidators
class NamelengthValidator(_plotly_utils.basevalidators.IntegerValidator):
def __init__(
self, plotly_name="namelength", parent_name="histogram2d.hoverlabel", **kwargs
):
super(NamelengthValidator, self).__init__(
plotly_name=plotly_name,
... | 32.8125 | 86 | 0.64 | import _plotly_utils.basevalidators
class NamelengthValidator(_plotly_utils.basevalidators.IntegerValidator):
def __init__(
self, plotly_name="namelength", parent_name="histogram2d.hoverlabel", **kwargs
):
super(NamelengthValidator, self).__init__(
plotly_name=plotly_name,
... | true | true |
1c286e34c6ff7de79a8a0530387192d565abd9b7 | 4,539 | py | Python | bot.py | SA7BNT/hikvision-camera-bot | a77f2ee48aaf1338ef0c3161af3b3260c94bd3d1 | [
"MIT"
] | null | null | null | bot.py | SA7BNT/hikvision-camera-bot | a77f2ee48aaf1338ef0c3161af3b3260c94bd3d1 | [
"MIT"
] | null | null | null | bot.py | SA7BNT/hikvision-camera-bot | a77f2ee48aaf1338ef0c3161af3b3260c94bd3d1 | [
"MIT"
] | null | null | null | #!/usr/bin/env python3
"""Bot Launcher Module."""
import logging
import itertools
import sys
from collections import defaultdict
from telegram.ext import CommandHandler, Updater
from camerabot.camerabot import CameraBot
from camerabot.config import get_main_config
from camerabot.constants import LOG_LEVELS_STR
from ... | 34.915385 | 79 | 0.640229 |
import logging
import itertools
import sys
from collections import defaultdict
from telegram.ext import CommandHandler, Updater
from camerabot.camerabot import CameraBot
from camerabot.config import get_main_config
from camerabot.constants import LOG_LEVELS_STR
from camerabot.directorywatcher import DirectoryWatche... | true | true |
1c286e39f0c5c54850b4a4ddb71230a6095d5be5 | 2,658 | py | Python | diet-ml/ml-submit.py | makaishi2/cplex-samples | d798a8d2dc14826eb5b3f00e6f64a2a08b2bc5f1 | [
"Apache-2.0"
] | null | null | null | diet-ml/ml-submit.py | makaishi2/cplex-samples | d798a8d2dc14826eb5b3f00e6f64a2a08b2bc5f1 | [
"Apache-2.0"
] | null | null | null | diet-ml/ml-submit.py | makaishi2/cplex-samples | d798a8d2dc14826eb5b3f00e6f64a2a08b2bc5f1 | [
"Apache-2.0"
] | null | null | null | # -*- coding: utf-8 -*-
# コマンドによる事前準備
# $ pip install -U ibm-watson-machine-learning
import sys
# Watson ML credentails
apikey = 'xxxx'
location = 'us-south'
import pandas as pd
# Watson ML credentails
# DO Deployment ID
deployment_uid = 'xxxx'
# Input CSV File
input_data1 = 'diet_food.csv'
input_data2 = 'diet_... | 26.058824 | 119 | 0.57073 |
import sys
apikey = 'xxxx'
location = 'us-south'
import pandas as pd
deployment_uid = 'xxxx'
input_data1 = 'diet_food.csv'
input_data2 = 'diet_nutrients.csv'
input_data3 = 'diet_food_nutrients.csv'
if __name__ == '__main__':
argv = sys.argv
argc = len(argv)
wml_credentials = {
... | true | true |
1c286f1f2eb8949cf8b2845a0a2eb8015734c718 | 1,544 | py | Python | matrix/ops/transpose.py | wesselb/matrix | ba343d69945d7cbc67330d01a87eee363ce5d408 | [
"MIT"
] | 3 | 2021-07-30T17:38:08.000Z | 2021-11-21T04:41:40.000Z | matrix/ops/transpose.py | wesselb/matrix | ba343d69945d7cbc67330d01a87eee363ce5d408 | [
"MIT"
] | null | null | null | matrix/ops/transpose.py | wesselb/matrix | ba343d69945d7cbc67330d01a87eee363ce5d408 | [
"MIT"
] | null | null | null | import lab as B
from lab.util import resolve_axis
from ..constant import Constant, Zero
from ..diagonal import Diagonal
from ..kronecker import Kronecker
from ..lowrank import LowRank
from ..matrix import Dense
from ..tiledblocks import TiledBlocks
from ..triangular import LowerTriangular, UpperTriangular
from ..woodb... | 20.864865 | 77 | 0.70013 | import lab as B
from lab.util import resolve_axis
from ..constant import Constant, Zero
from ..diagonal import Diagonal
from ..kronecker import Kronecker
from ..lowrank import LowRank
from ..matrix import Dense
from ..tiledblocks import TiledBlocks
from ..triangular import LowerTriangular, UpperTriangular
from ..woodb... | true | true |
1c286f288caac65c7e8cd492e0a8b6d04ac5973c | 55 | py | Python | test/config.py | Springf/mQ | 6a28b4e9de22fe27ce5a35efa11c83c5f066df0a | [
"MIT"
] | null | null | null | test/config.py | Springf/mQ | 6a28b4e9de22fe27ce5a35efa11c83c5f066df0a | [
"MIT"
] | null | null | null | test/config.py | Springf/mQ | 6a28b4e9de22fe27ce5a35efa11c83c5f066df0a | [
"MIT"
] | null | null | null | DATABASE_CONFIG = {
'dbname': 'questions_test.db'
} | 18.333333 | 33 | 0.672727 | DATABASE_CONFIG = {
'dbname': 'questions_test.db'
} | true | true |
1c2871ef459b37b79697d4b091712ce065bf59c8 | 3,362 | py | Python | plot.py | Ravirajanan/tennislive-visualization | f5d555a9caea61c1286cc7bc3505281f52d37322 | [
"Apache-2.0"
] | null | null | null | plot.py | Ravirajanan/tennislive-visualization | f5d555a9caea61c1286cc7bc3505281f52d37322 | [
"Apache-2.0"
] | null | null | null | plot.py | Ravirajanan/tennislive-visualization | f5d555a9caea61c1286cc7bc3505281f52d37322 | [
"Apache-2.0"
] | null | null | null | #imports
import pandas as pd
import numpy as np
import re
import dash
import dash_core_components as dcc
import dash_html_components as html
from dash.dependencies import Input, Output
import plotly.express as px
from plotly.subplots import make_subplots
import plotly.graph_objects as go
#reads the input file which ha... | 31.12963 | 130 | 0.716538 |
import pandas as pd
import numpy as np
import re
import dash
import dash_core_components as dcc
import dash_html_components as html
from dash.dependencies import Input, Output
import plotly.express as px
from plotly.subplots import make_subplots
import plotly.graph_objects as go
dataframe = pd.read_csv('Melbourne_06... | true | true |
1c2872645c3580b560b396abcde0246ee067a6d0 | 22,978 | py | Python | tests/test_image.py | catmaid/catpy | 481d87591a6dfaedef2767dcddcbed7185ecc8b8 | [
"MIT"
] | 5 | 2018-04-24T15:45:31.000Z | 2021-06-18T17:38:07.000Z | tests/test_image.py | catmaid/catpy | 481d87591a6dfaedef2767dcddcbed7185ecc8b8 | [
"MIT"
] | 35 | 2017-05-12T21:49:54.000Z | 2022-03-12T00:47:09.000Z | tests/test_image.py | catmaid/catpy | 481d87591a6dfaedef2767dcddcbed7185ecc8b8 | [
"MIT"
] | 4 | 2017-08-24T12:15:41.000Z | 2019-10-13T01:05:34.000Z | from __future__ import absolute_import
from itertools import cycle, chain
import pytest
import numpy as np
import requests
from PIL import Image
from io import BytesIO
from concurrent.futures import Future
from requests import HTTPError
try:
import mock
except ImportError:
from unittest import mock
from cat... | 28.228501 | 105 | 0.652581 | from __future__ import absolute_import
from itertools import cycle, chain
import pytest
import numpy as np
import requests
from PIL import Image
from io import BytesIO
from concurrent.futures import Future
from requests import HTTPError
try:
import mock
except ImportError:
from unittest import mock
from cat... | true | true |
1c28731067440749f4308cd14ccdb9ea40b04122 | 627 | py | Python | Beecrowd/Python/1049.py | felipemsalles/Programming-Studies | 63100fb22a165c4582b10a95d5a583f9bc1e990f | [
"MIT"
] | null | null | null | Beecrowd/Python/1049.py | felipemsalles/Programming-Studies | 63100fb22a165c4582b10a95d5a583f9bc1e990f | [
"MIT"
] | null | null | null | Beecrowd/Python/1049.py | felipemsalles/Programming-Studies | 63100fb22a165c4582b10a95d5a583f9bc1e990f | [
"MIT"
] | null | null | null | primeira = str(input()).lower()
segunda = str(input()).lower()
terceira = str(input()).lower()
if primeira == 'vertebrado':
if segunda == 'ave':
if terceira == 'carnivoro':
print('aguia')
else:
print('pomba')
else:
if terceira == 'onivoro':
print('home... | 25.08 | 36 | 0.481659 | primeira = str(input()).lower()
segunda = str(input()).lower()
terceira = str(input()).lower()
if primeira == 'vertebrado':
if segunda == 'ave':
if terceira == 'carnivoro':
print('aguia')
else:
print('pomba')
else:
if terceira == 'onivoro':
print('home... | true | true |
1c287333426964173b3e1ed47696b8ea64c77b00 | 2,335 | py | Python | UNet/model.py | note-nota/ML_models | e9ede1b5cc3ef7bab43f22467cb806043d86e451 | [
"MIT"
] | null | null | null | UNet/model.py | note-nota/ML_models | e9ede1b5cc3ef7bab43f22467cb806043d86e451 | [
"MIT"
] | null | null | null | UNet/model.py | note-nota/ML_models | e9ede1b5cc3ef7bab43f22467cb806043d86e451 | [
"MIT"
] | null | null | null | from typing import Optional
import argparse
import tensorflow as tf
class conv_set:
def __init__(self, filters: int):
self.filters = filters
def __call__(self, inputs: tf.Tensor) -> tf.Tensor:
y = tf.keras.layers.Conv2D(
self.filters, kernel_size=3, padding="SAME", activation="rel... | 30.723684 | 76 | 0.647537 | from typing import Optional
import argparse
import tensorflow as tf
class conv_set:
def __init__(self, filters: int):
self.filters = filters
def __call__(self, inputs: tf.Tensor) -> tf.Tensor:
y = tf.keras.layers.Conv2D(
self.filters, kernel_size=3, padding="SAME", activation="rel... | true | true |
1c2873eb759110e49eeae4c4f20f562745fbd253 | 4,159 | py | Python | homeassistant/components/baf/config_flow.py | SNoof85/core | 5f44d0f8f9db03371164ff596f7b09615a5f6efe | [
"Apache-2.0"
] | null | null | null | homeassistant/components/baf/config_flow.py | SNoof85/core | 5f44d0f8f9db03371164ff596f7b09615a5f6efe | [
"Apache-2.0"
] | 9 | 2022-01-26T06:25:01.000Z | 2022-03-31T06:27:15.000Z | homeassistant/components/baf/config_flow.py | SNoof85/core | 5f44d0f8f9db03371164ff596f7b09615a5f6efe | [
"Apache-2.0"
] | null | null | null | """Config flow for baf."""
from __future__ import annotations
import asyncio
import logging
from typing import Any
from aiobafi6 import Device, Service
from aiobafi6.discovery import PORT
import voluptuous as vol
from homeassistant import config_entries
from homeassistant.components import zeroconf
from homeassistan... | 34.371901 | 82 | 0.640779 | from __future__ import annotations
import asyncio
import logging
from typing import Any
from aiobafi6 import Device, Service
from aiobafi6.discovery import PORT
import voluptuous as vol
from homeassistant import config_entries
from homeassistant.components import zeroconf
from homeassistant.const import CONF_IP_ADDR... | true | true |
1c2874643725f3d10c31f2f3791eb1b3cd82f603 | 8,646 | py | Python | sdk/python/pulumi_azure_nextgen/network/v20190901/get_nat_gateway.py | pulumi/pulumi-azure-nextgen | 452736b0a1cf584c2d4c04666e017af6e9b2c15c | [
"Apache-2.0"
] | 31 | 2020-09-21T09:41:01.000Z | 2021-02-26T13:21:59.000Z | sdk/python/pulumi_azure_nextgen/network/v20190901/get_nat_gateway.py | pulumi/pulumi-azure-nextgen | 452736b0a1cf584c2d4c04666e017af6e9b2c15c | [
"Apache-2.0"
] | 231 | 2020-09-21T09:38:45.000Z | 2021-03-01T11:16:03.000Z | sdk/python/pulumi_azure_nextgen/network/v20190901/get_nat_gateway.py | pulumi/pulumi-azure-nextgen | 452736b0a1cf584c2d4c04666e017af6e9b2c15c | [
"Apache-2.0"
] | 4 | 2020-09-29T14:14:59.000Z | 2021-02-10T20:38:16.000Z | # coding=utf-8
# *** WARNING: this file was generated by the Pulumi SDK Generator. ***
# *** Do not edit by hand unless you're certain you know what you are doing! ***
import warnings
import pulumi
import pulumi.runtime
from typing import Any, Mapping, Optional, Sequence, Union
from ... import _utilities, _tables
from... | 36.175732 | 257 | 0.644113 |
import warnings
import pulumi
import pulumi.runtime
from typing import Any, Mapping, Optional, Sequence, Union
from ... import _utilities, _tables
from . import outputs
__all__ = [
'GetNatGatewayResult',
'AwaitableGetNatGatewayResult',
'get_nat_gateway',
]
@pulumi.output_type
class GetNatGatewayResult... | true | true |
1c28746e0ae8c3d2fa715eccac69e5bf50f19280 | 2,083 | py | Python | pyimp/girl/dimensions.py | ismaelharunid/girl | 78c703e2788808b0fb2033577e827dcbdb59b797 | [
"MIT"
] | 1 | 2020-06-14T13:42:17.000Z | 2020-06-14T13:42:17.000Z | pyimp/girl/dimensions.py | ismaelharunid/girl | 78c703e2788808b0fb2033577e827dcbdb59b797 | [
"MIT"
] | null | null | null | pyimp/girl/dimensions.py | ismaelharunid/girl | 78c703e2788808b0fb2033577e827dcbdb59b797 | [
"MIT"
] | null | null | null |
from .common import *
from .typehelpers import *
from .interfaces import Area
class Size(object):
def __init__(self, initialzer):
if isinstance(initialzer, Iterable):
size = tuple(int(c) for c in initialzer)
if len(size) == 2:
self._size = size
return
raise ValueError("Size e... | 21.040404 | 81 | 0.629861 |
from .common import *
from .typehelpers import *
from .interfaces import Area
class Size(object):
def __init__(self, initialzer):
if isinstance(initialzer, Iterable):
size = tuple(int(c) for c in initialzer)
if len(size) == 2:
self._size = size
return
raise ValueError("Size e... | true | true |
1c28750c6a39b97a3d0c516caec5a612eecb0a76 | 1,192 | py | Python | setup.py | cchristelis/katsdpdata | a51b6ff23810996ddb7582f28c01319b7f125e81 | [
"BSD-3-Clause"
] | null | null | null | setup.py | cchristelis/katsdpdata | a51b6ff23810996ddb7582f28c01319b7f125e81 | [
"BSD-3-Clause"
] | 10 | 2020-02-26T11:01:21.000Z | 2021-09-13T10:28:19.000Z | setup.py | cchristelis/katsdpdata | a51b6ff23810996ddb7582f28c01319b7f125e81 | [
"BSD-3-Clause"
] | 1 | 2021-02-12T13:59:11.000Z | 2021-02-12T13:59:11.000Z | #!/usr/bin/env python3
from setuptools import setup, find_packages
setup(
name="katsdpdata",
description="Data search and retrieval library for the MeerKAT project",
author="Thomas Bennett, Chris Schollar",
author_email="thomas@ska.ac.za, cschollar@ska.ac.za",
packages=find_packages(),
install... | 31.368421 | 76 | 0.627517 |
from setuptools import setup, find_packages
setup(
name="katsdpdata",
description="Data search and retrieval library for the MeerKAT project",
author="Thomas Bennett, Chris Schollar",
author_email="thomas@ska.ac.za, cschollar@ska.ac.za",
packages=find_packages(),
install_requires=[
"b... | true | true |
1c28760e67743491111d460b3c17cf3a02a08998 | 9,529 | py | Python | art/attacks/universal_perturbation.py | Viktour19/adversarial-robustness-toolbox | 96ba28170d0de1b5db6a16330a312248cc3b8972 | [
"MIT"
] | 1 | 2019-04-14T23:18:02.000Z | 2019-04-14T23:18:02.000Z | art/attacks/universal_perturbation.py | Viktour19/adversarial-robustness-toolbox | 96ba28170d0de1b5db6a16330a312248cc3b8972 | [
"MIT"
] | null | null | null | art/attacks/universal_perturbation.py | Viktour19/adversarial-robustness-toolbox | 96ba28170d0de1b5db6a16330a312248cc3b8972 | [
"MIT"
] | null | null | null | # MIT License
#
# Copyright (C) IBM Corporation 2018
#
# Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated
# documentation files (the "Software"), to deal in the Software without restriction, including without limitation the
# rights to use, copy, modify, merge... | 43.117647 | 120 | 0.625354 |
from __future__ import absolute_import, division, print_function, unicode_literals
import logging
import random
import numpy as np
from art.attacks.attack import Attack
from art.utils import projection
logger = logging.getLogger(__name__)
class UniversalPerturbation(Attack):
attacks_dict = {'... | true | true |
1c2877687ec7a29923701ac0bec5e38b63dee49c | 8,794 | py | Python | vision/assignment1/cs231n/classifiers/k_nearest_neighbor.py | TerenceWangh/course | 6bb26097aca8124f07314857b07f78870293045b | [
"MIT"
] | 2 | 2019-12-14T05:31:32.000Z | 2022-03-17T04:05:41.000Z | vision/assignment1/cs231n/classifiers/k_nearest_neighbor.py | TerenceWangh/course | 6bb26097aca8124f07314857b07f78870293045b | [
"MIT"
] | 11 | 2020-03-24T17:08:18.000Z | 2022-03-12T01:02:06.000Z | vision/assignment1/cs231n/classifiers/k_nearest_neighbor.py | TerenceWangh/course | 6bb26097aca8124f07314857b07f78870293045b | [
"MIT"
] | null | null | null | from builtins import range
from builtins import object
import numpy as np
from past.builtins import xrange
class KNearestNeighbor(object):
""" a kNN classifier with L2 distance """
def __init__(self):
pass
def train(self, X, y):
"""
Train the classifier. For k-nearest neighbors t... | 47.026738 | 86 | 0.478622 | from builtins import range
from builtins import object
import numpy as np
from past.builtins import xrange
class KNearestNeighbor(object):
def __init__(self):
pass
def train(self, X, y):
self.X_train = X
self.y_train = y
def predict(self, X, k=1, num_loops=0):
if num_loo... | true | true |
1c287799f5fba3d75a172f0d8fa19fbe3b7d6c5b | 36,629 | py | Python | Lib/site-packages/spyder/plugins/outlineexplorer/widgets.py | hirorin-demon/hirorin-streamlit | 03fbb6f03ec94f909d451e708a3b30b177607695 | [
"0BSD"
] | null | null | null | Lib/site-packages/spyder/plugins/outlineexplorer/widgets.py | hirorin-demon/hirorin-streamlit | 03fbb6f03ec94f909d451e708a3b30b177607695 | [
"0BSD"
] | null | null | null | Lib/site-packages/spyder/plugins/outlineexplorer/widgets.py | hirorin-demon/hirorin-streamlit | 03fbb6f03ec94f909d451e708a3b30b177607695 | [
"0BSD"
] | null | null | null | # -*- coding: utf-8 -*-
#
# Copyright © Spyder Project Contributors
# Licensed under the terms of the MIT License
# (see spyder/__init__.py for details)
"""Outline explorer widgets."""
# Standard library imports
import bisect
import os.path as osp
import uuid
# Third party imports
from intervaltree import IntervalTr... | 35.424565 | 78 | 0.608261 |
import bisect
import os.path as osp
import uuid
from intervaltree import IntervalTree
from qtpy.compat import from_qvariant
from qtpy.QtCore import Qt, QTimer, Signal, Slot
from qtpy.QtWidgets import (QHBoxLayout, QTreeWidgetItem,
QTreeWidgetItemIterator)
from spyder.api.config.d... | true | true |
1c28780111e6015e8c274024325d4c73b3c6c84d | 778 | py | Python | fairseq/criterions/__init__.py | nedo0shki/fairseq-editor | a0f09787bc0d302be5833ec0dad3e568440f4551 | [
"MIT"
] | 651 | 2015-03-14T23:18:44.000Z | 2022-01-19T14:08:28.000Z | fairseq/criterions/__init__.py | ayu1812/fairseq | a87cafda718c7706e6f1694f0d39fc589ed2b264 | [
"MIT"
] | 362 | 2015-01-26T16:20:28.000Z | 2022-01-26T06:19:23.000Z | fairseq/criterions/__init__.py | ayu1812/fairseq | a87cafda718c7706e6f1694f0d39fc589ed2b264 | [
"MIT"
] | 169 | 2015-09-28T17:06:28.000Z | 2021-12-18T16:02:49.000Z | # Copyright (c) Facebook, Inc. and its affiliates.
#
# This source code is licensed under the MIT license found in the
# LICENSE file in the root directory of this source tree.
import importlib
import os
from fairseq import registry
from fairseq.criterions.fairseq_criterion import FairseqCriterion, LegacyFairseqCrite... | 31.12 | 89 | 0.758355 |
import importlib
import os
from fairseq import registry
from fairseq.criterions.fairseq_criterion import FairseqCriterion, LegacyFairseqCriterion
build_criterion, register_criterion, CRITERION_REGISTRY = registry.setup_registry(
'--criterion',
base_class=FairseqCriterion,
default='cross_entropy',
)
... | true | true |
1c287820c9ee9e808dfa9e5a2e41de852759aef7 | 2,932 | py | Python | creten/indicators/Ichimoku.py | nardew/Creten | 15ddb0b52e6f2afec2c79b3c731fccb34a2c63d6 | [
"MIT"
] | 9 | 2019-12-17T10:42:40.000Z | 2021-12-02T23:07:05.000Z | creten/indicators/Ichimoku.py | nardew/Creten | 15ddb0b52e6f2afec2c79b3c731fccb34a2c63d6 | [
"MIT"
] | null | null | null | creten/indicators/Ichimoku.py | nardew/Creten | 15ddb0b52e6f2afec2c79b3c731fccb34a2c63d6 | [
"MIT"
] | 6 | 2019-03-04T15:01:10.000Z | 2022-01-12T23:22:55.000Z | from indicators.Indicator import Indicator
class Ichimoku(Indicator):
def __init__(self, kijunPeriod, tenkanPeriod, chikouLagPeriod, senkouSlowPeriod, senkouLookUpPeriod, timeSeries):
super(Ichimoku, self).__init__()
self.kijunPeriod = kijunPeriod
self.tenkanPeriod = tenkanPeriod
self.chikouLagPeriod = chiko... | 34.093023 | 155 | 0.71487 | from indicators.Indicator import Indicator
class Ichimoku(Indicator):
def __init__(self, kijunPeriod, tenkanPeriod, chikouLagPeriod, senkouSlowPeriod, senkouLookUpPeriod, timeSeries):
super(Ichimoku, self).__init__()
self.kijunPeriod = kijunPeriod
self.tenkanPeriod = tenkanPeriod
self.chikouLagPeriod = chiko... | true | true |
1c2878b7f9f09e04b4ca43ae6819de773725065a | 4,485 | py | Python | test/functional/rpc_net.py | hackverket/bitcoin-abc-bitcore | cc70c0a66b640a1ac59024bac9a314256ed386b2 | [
"MIT"
] | 78 | 2018-07-16T14:55:15.000Z | 2022-02-26T10:43:23.000Z | test/functional/rpc_net.py | hackverket/bitcoin-abc-bitcore | cc70c0a66b640a1ac59024bac9a314256ed386b2 | [
"MIT"
] | 14 | 2018-07-20T02:17:45.000Z | 2019-05-13T09:50:13.000Z | test/functional/rpc_net.py | hackverket/bitcoin-abc-bitcore | cc70c0a66b640a1ac59024bac9a314256ed386b2 | [
"MIT"
] | 28 | 2018-07-17T01:50:37.000Z | 2021-11-04T08:04:56.000Z | #!/usr/bin/env python3
# Copyright (c) 2017 The Bitcoin Core developers
# Distributed under the MIT software license, see the accompanying
# file COPYING or http://www.opensource.org/licenses/mit-license.php.
"""Test RPC calls related to net.
Tests correspond to code in rpc/net.cpp.
"""
from decimal import Decimal
f... | 42.311321 | 88 | 0.649275 |
from decimal import Decimal
from test_framework.test_framework import BitcoinTestFramework
from test_framework.util import (
assert_equal,
assert_raises_rpc_error,
connect_nodes_bi,
p2p_port,
wait_until,
)
class NetTest(BitcoinTestFramework):
def set_test_params(self):
self.setup... | true | true |
1c287932dd063408f60bc519d0f1ed1176a81c49 | 8,069 | py | Python | aio_marantz_avr/avr.py | silvester747/aio_marantz_avr | 1a8e8f904af3e8c46f9595fa4d714c17ad295572 | [
"MIT"
] | null | null | null | aio_marantz_avr/avr.py | silvester747/aio_marantz_avr | 1a8e8f904af3e8c46f9595fa4d714c17ad295572 | [
"MIT"
] | 1 | 2020-07-16T13:04:45.000Z | 2020-07-16T13:04:45.000Z | aio_marantz_avr/avr.py | silvester747/aio_marantz_avr | 1a8e8f904af3e8c46f9595fa4d714c17ad295572 | [
"MIT"
] | null | null | null | """Control of an AVR over Telnet."""
import asyncio
import telnetlib3
from typing import Any, List, MutableMapping, Optional, Type
from .enums import InputSource, Power, SurroundMode
class AvrError(Exception):
"""Base class for all errors returned from an AVR."""
pass
class DisconnectedError(AvrError):
... | 29.996283 | 95 | 0.614946 |
import asyncio
import telnetlib3
from typing import Any, List, MutableMapping, Optional, Type
from .enums import InputSource, Power, SurroundMode
class AvrError(Exception):
pass
class DisconnectedError(AvrError):
pass
class AvrTimeoutError(AvrError):
pass
async def connect(host: str, port: int... | true | true |
1c287b8fbff673ba57c0365f07c9d1733f25be31 | 1,069 | py | Python | Desafio3_Pandemia/app/Controller/controller_map.py | Renanrbsc/PadawanTemploPython | fb8440e372b7c3fb4624549486c76124c20ef212 | [
"MIT"
] | null | null | null | Desafio3_Pandemia/app/Controller/controller_map.py | Renanrbsc/PadawanTemploPython | fb8440e372b7c3fb4624549486c76124c20ef212 | [
"MIT"
] | null | null | null | Desafio3_Pandemia/app/Controller/controller_map.py | Renanrbsc/PadawanTemploPython | fb8440e372b7c3fb4624549486c76124c20ef212 | [
"MIT"
] | null | null | null | from Desafio3_Pandemia.app.Model.model_function import BaseFunction
from Desafio3_Pandemia.app.Model.model_map import Map
from Desafio3_Pandemia.app.Views.view_terminal import Terminal
class CtrlMap:
def __init__(self):
self._function = BaseFunction()
self._model = Map()
self._view = Termi... | 32.393939 | 67 | 0.719364 | from Desafio3_Pandemia.app.Model.model_function import BaseFunction
from Desafio3_Pandemia.app.Model.model_map import Map
from Desafio3_Pandemia.app.Views.view_terminal import Terminal
class CtrlMap:
def __init__(self):
self._function = BaseFunction()
self._model = Map()
self._view = Termi... | true | true |
1c287db58b9272cc68515d4ef175a1bbdb84e648 | 10,715 | py | Python | classes/game.py | fuji37450/Connect4 | 2277855eff60199b97bcea0c55ce32d1e694b30a | [
"MIT"
] | null | null | null | classes/game.py | fuji37450/Connect4 | 2277855eff60199b97bcea0c55ce32d1e694b30a | [
"MIT"
] | null | null | null | classes/game.py | fuji37450/Connect4 | 2277855eff60199b97bcea0c55ce32d1e694b30a | [
"MIT"
] | null | null | null | import pygame
import random
import time
from classes.player import Player
from classes.board import Board
WHITE = (255, 255, 255)
BLACK = (0, 0, 0)
YELLOW = (249, 233, 102)
DARK_YELLOW = (218, 203, 82)
INF = float('inf')
# initialize the column exploration order, starting with center columns
columnOrder ... | 35.716667 | 145 | 0.49734 | import pygame
import random
import time
from classes.player import Player
from classes.board import Board
WHITE = (255, 255, 255)
BLACK = (0, 0, 0)
YELLOW = (249, 233, 102)
DARK_YELLOW = (218, 203, 82)
INF = float('inf')
columnOrder = [int(7//2 + (1-2*(i % 2))*(i+1)/2) for i in range(7)]
class GameU... | true | true |
1c287ecb56081284e9955590575cd3528ea79744 | 1,176 | py | Python | pinakes/main/catalog/tests/services/test_finish_order.py | hsong-rh/pinakes | 2f08cb757ca64c866af3244686b92a3074fc7571 | [
"Apache-2.0"
] | null | null | null | pinakes/main/catalog/tests/services/test_finish_order.py | hsong-rh/pinakes | 2f08cb757ca64c866af3244686b92a3074fc7571 | [
"Apache-2.0"
] | null | null | null | pinakes/main/catalog/tests/services/test_finish_order.py | hsong-rh/pinakes | 2f08cb757ca64c866af3244686b92a3074fc7571 | [
"Apache-2.0"
] | null | null | null | """ Test starting an order """
import pytest
from pinakes.main.approval.tests.factories import (
RequestFactory,
)
from pinakes.main.catalog.models import (
ApprovalRequest,
Order,
ProgressMessage,
)
from pinakes.main.catalog.services.finish_order import (
FinishOrder,
)
from pinakes.main.catalog... | 24 | 86 | 0.701531 |
import pytest
from pinakes.main.approval.tests.factories import (
RequestFactory,
)
from pinakes.main.catalog.models import (
ApprovalRequest,
Order,
ProgressMessage,
)
from pinakes.main.catalog.services.finish_order import (
FinishOrder,
)
from pinakes.main.catalog.tests.factories import (
A... | true | true |
1c287ed548f78b76fa472f88f72e0248039f3405 | 2,186 | py | Python | c2cgeoportal/resources.py | pgiraud/c2cgeoportal | 3ec955c5c67d16256af726a62d586b3f4ec3b500 | [
"BSD-2-Clause-FreeBSD"
] | null | null | null | c2cgeoportal/resources.py | pgiraud/c2cgeoportal | 3ec955c5c67d16256af726a62d586b3f4ec3b500 | [
"BSD-2-Clause-FreeBSD"
] | null | null | null | c2cgeoportal/resources.py | pgiraud/c2cgeoportal | 3ec955c5c67d16256af726a62d586b3f4ec3b500 | [
"BSD-2-Clause-FreeBSD"
] | null | null | null | # -*- coding: utf-8 -*-
# Copyright (c) 2013, Camptocamp SA
# All rights reserved.
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions are met:
# 1. Redistributions of source code must retain the above copyright notice, this
# l... | 42.038462 | 81 | 0.76624 |
from pyramid.security import Allow, Authenticated, ALL_PERMISSIONS
from pyramid_formalchemy.resources import Models
class Root(object):
def __init__(self, request):
self.request = request
class FAModels(Models):
__acl__ = [
(Allow, Authenticated, ALL_PERMISSIO... | true | true |
1c287f0dc2a6fc10b21bee8151dd3bfb6fb6b7e3 | 201,423 | py | Python | lib/galaxy/model/__init__.py | openminted/galaxy | bd2147cccf814f8cec93372973b5e6ada4668a80 | [
"CC-BY-3.0"
] | 1 | 2021-04-26T08:46:21.000Z | 2021-04-26T08:46:21.000Z | lib/galaxy/model/__init__.py | openminted/galaxy | bd2147cccf814f8cec93372973b5e6ada4668a80 | [
"CC-BY-3.0"
] | null | null | null | lib/galaxy/model/__init__.py | openminted/galaxy | bd2147cccf814f8cec93372973b5e6ada4668a80 | [
"CC-BY-3.0"
] | 1 | 2018-12-09T13:50:28.000Z | 2018-12-09T13:50:28.000Z | """
Galaxy data model classes
Naming: try to use class names that have a distinct plural form so that
the relationship cardinalities are obvious (e.g. prefer Dataset to Data)
"""
import codecs
import errno
import json
import logging
import numbers
import operator
import os
import pwd
import socket
import time
from dat... | 37.740866 | 191 | 0.626964 | import codecs
import errno
import json
import logging
import numbers
import operator
import os
import pwd
import socket
import time
from datetime import datetime, timedelta
from string import Template
from uuid import UUID, uuid4
from six import string_types
from sqlalchemy import (and_, func, join, not_, or_, select,... | true | true |
1c287f5beafb861cb37055b91dcfe076efef1db2 | 8,154 | py | Python | test/basic_test.py | codehelp/pkg-pyocd-dfsg | 3a3b417578242454905d4471440ccc16fb19c955 | [
"Apache-2.0"
] | null | null | null | test/basic_test.py | codehelp/pkg-pyocd-dfsg | 3a3b417578242454905d4471440ccc16fb19c955 | [
"Apache-2.0"
] | 1 | 2018-12-27T03:21:06.000Z | 2018-12-27T03:21:06.000Z | test/basic_test.py | codehelp/pkg-pyocd-dfsg | 3a3b417578242454905d4471440ccc16fb19c955 | [
"Apache-2.0"
] | null | null | null | """
mbed CMSIS-DAP debugger
Copyright (c) 2006-2015 ARM Limited
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 ... | 35.606987 | 130 | 0.59897 | from __future__ import print_function
import argparse, os, sys
from time import sleep
from random import randrange
import math
parentdir = os.path.dirname(os.path.dirname(os.path.abspath(__file__)))
sys.path.insert(0, parentdir)
from pyocd.core.helpers import ConnectHelper
from pyocd.utility.conversion import float3... | true | true |
1c28800aa8fd3f470e9583b0d8c0795acbebf369 | 1,578 | py | Python | goldcoin/timelord/iters_from_block.py | DevMau5x/goldcoin-blockchain-2 | ed223dd16fa290ea710db7202d6c52a056242cfa | [
"Apache-2.0"
] | 17 | 2021-09-08T17:07:54.000Z | 2022-03-30T04:11:58.000Z | goldcoin/timelord/iters_from_block.py | DevMau5x/goldcoin-blockchain-2 | ed223dd16fa290ea710db7202d6c52a056242cfa | [
"Apache-2.0"
] | 15 | 2021-09-28T21:09:49.000Z | 2022-03-22T21:13:23.000Z | goldcoin/timelord/iters_from_block.py | Pierre21dd/gold2 | 4a35f207ed4c8a7745bfbc73fd3c190bd8b60a3f | [
"Apache-2.0"
] | 9 | 2021-09-12T10:03:23.000Z | 2022-03-15T08:35:11.000Z | from typing import Optional, Tuple, Union
from goldcoin.consensus.pot_iterations import calculate_ip_iters, calculate_iterations_quality, calculate_sp_iters
from goldcoin.types.blockchain_format.reward_chain_block import RewardChainBlock, RewardChainBlockUnfinished
from goldcoin.types.blockchain_format.sized_bytes imp... | 35.863636 | 114 | 0.749683 | from typing import Optional, Tuple, Union
from goldcoin.consensus.pot_iterations import calculate_ip_iters, calculate_iterations_quality, calculate_sp_iters
from goldcoin.types.blockchain_format.reward_chain_block import RewardChainBlock, RewardChainBlockUnfinished
from goldcoin.types.blockchain_format.sized_bytes imp... | true | true |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.