hexsha stringlengths 40 40 | size int64 4 996k | ext stringclasses 8
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 4 996k | avg_line_length float64 1.33 58.2k | max_line_length int64 2 323k | alphanum_fraction float64 0 0.97 | content_no_comment stringlengths 0 946k | is_comment_constant_removed bool 2
classes | is_sharp_comment_removed bool 1
class |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
f72bc4838f0722457e558e34b578faff5078826d | 27,139 | py | Python | swift/container/sync.py | ctvera/swift-deb | cf889b6fa8b8059ac5ce2680064d60db7602d166 | [
"Apache-2.0"
] | null | null | null | swift/container/sync.py | ctvera/swift-deb | cf889b6fa8b8059ac5ce2680064d60db7602d166 | [
"Apache-2.0"
] | null | null | null | swift/container/sync.py | ctvera/swift-deb | cf889b6fa8b8059ac5ce2680064d60db7602d166 | [
"Apache-2.0"
] | null | null | null | # Copyright (c) 2010-2012 OpenStack Foundation
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agree... | 45.765599 | 79 | 0.562659 |
import errno
import os
import uuid
from swift import gettext_ as _
from time import ctime, time
from random import choice, random
from struct import unpack_from
from eventlet import sleep, Timeout
import swift.common.db
from swift.common.db import DatabaseConnectionError
from swift.container.backend im... | true | true |
f72bc64706a2419c1f41c94124de0ffce474b339 | 307 | py | Python | imgs.py | Entropy03/linyi | 1e5f924c217095d6757e29cac128e5ac5085ec11 | [
"MIT"
] | null | null | null | imgs.py | Entropy03/linyi | 1e5f924c217095d6757e29cac128e5ac5085ec11 | [
"MIT"
] | null | null | null | imgs.py | Entropy03/linyi | 1e5f924c217095d6757e29cac128e5ac5085ec11 | [
"MIT"
] | null | null | null | from PIL import Image
from PIL import ImageFilter
import urllib
import urllib2
import requests
import re
import json
import ssl
http://jlnetc.blog.51cto.com/10920149/1907446
http://python.jobbole.com/81359/
http://jlnetc.blog.51cto.com/10920149/1907446
https://gist.github.com/loveNight/214f82b43926528342f2 | 25.583333 | 54 | 0.827362 | from PIL import Image
from PIL import ImageFilter
import urllib
import urllib2
import requests
import re
import json
import ssl
http://jlnetc.blog.51cto.com/10920149/1907446
http://python.jobbole.com/81359/
http://jlnetc.blog.51cto.com/10920149/1907446
https://gist.github.com/loveNight/214f82b43926528342f2 | false | true |
f72bc6e7a5a7d63e1045e7006d2cabcd2f8a9690 | 1,305 | py | Python | oauth2_provider/generators.py | dqfort/django-oauth-toolkit | 492a867499b50f348c28db4ef3e429e8f46dc412 | [
"BSD-2-Clause-FreeBSD"
] | 1,406 | 2018-04-09T18:46:01.000Z | 2022-03-30T00:42:23.000Z | oauth2_provider/generators.py | dqfort/django-oauth-toolkit | 492a867499b50f348c28db4ef3e429e8f46dc412 | [
"BSD-2-Clause-FreeBSD"
] | 625 | 2018-04-08T06:06:29.000Z | 2022-03-28T20:48:19.000Z | oauth2_provider/generators.py | dqfort/django-oauth-toolkit | 492a867499b50f348c28db4ef3e429e8f46dc412 | [
"BSD-2-Clause-FreeBSD"
] | 378 | 2018-04-11T20:08:11.000Z | 2022-03-30T17:53:21.000Z | from oauthlib.common import UNICODE_ASCII_CHARACTER_SET
from oauthlib.common import generate_client_id as oauthlib_generate_client_id
from .settings import oauth2_settings
class BaseHashGenerator:
"""
All generators should extend this class overriding `.hash()` method.
"""
def hash(self):
ra... | 28.369565 | 88 | 0.743295 | from oauthlib.common import UNICODE_ASCII_CHARACTER_SET
from oauthlib.common import generate_client_id as oauthlib_generate_client_id
from .settings import oauth2_settings
class BaseHashGenerator:
def hash(self):
raise NotImplementedError()
class ClientIdGenerator(BaseHashGenerator):
def hash(self... | true | true |
f72bc75458786940b2244977b48352162a62d379 | 767 | py | Python | src/data_consumer.py | perrycao/docker_project | e07c4a388eb4936a5f88f63e291ecb8a115bcbe2 | [
"MIT"
] | null | null | null | src/data_consumer.py | perrycao/docker_project | e07c4a388eb4936a5f88f63e291ecb8a115bcbe2 | [
"MIT"
] | null | null | null | src/data_consumer.py | perrycao/docker_project | e07c4a388eb4936a5f88f63e291ecb8a115bcbe2 | [
"MIT"
] | null | null | null | # -*- coding:utf-8 -*-
# version 0.1 2019-05-03 First update
import argparse
from kafka import KafkaConsumer
def consume(_topic_name, _kafka_broker):
"""
helper method to consume certain topic data from kafka broker
"""
consumer = KafkaConsumer(_topic_name, bootstrap_servers=_kafka_broker)
for me... | 26.448276 | 77 | 0.711864 |
import argparse
from kafka import KafkaConsumer
def consume(_topic_name, _kafka_broker):
consumer = KafkaConsumer(_topic_name, bootstrap_servers=_kafka_broker)
for message in consumer:
print(message)
if __name__ == '__main__':
parser = argparse.ArgumentParser()
parser.add_argument("topic_... | true | true |
f72bc80b55e85e3fe6182a7b4565c13a421a0651 | 1,734 | py | Python | bioseq/management/commands/import_genome.py | ezequieljsosa/sndg-web | 7763c8fbc83dc92abb9c53326e2fe227bcabf607 | [
"MIT"
] | null | null | null | bioseq/management/commands/import_genome.py | ezequieljsosa/sndg-web | 7763c8fbc83dc92abb9c53326e2fe227bcabf607 | [
"MIT"
] | 2 | 2021-03-10T17:08:59.000Z | 2021-09-29T17:40:48.000Z | bioseq/management/commands/import_genome.py | sndg-arg/covid19-web | fe809c87563a00bbec53c3646338d571fdde6a69 | [
"MIT"
] | null | null | null | import os
import warnings
from tqdm import tqdm
import subprocess as sp
import gzip
from io import StringIO
import Bio.SeqIO as bpio
from django.core.management.base import BaseCommand, CommandError
from django.db import transaction
from bioseq.io.BioIO import BioIO
from Bio import BiopythonWarning, BiopythonParserW... | 36.125 | 115 | 0.703576 | import os
import warnings
from tqdm import tqdm
import subprocess as sp
import gzip
from io import StringIO
import Bio.SeqIO as bpio
from django.core.management.base import BaseCommand, CommandError
from django.db import transaction
from bioseq.io.BioIO import BioIO
from Bio import BiopythonWarning, BiopythonParserW... | true | true |
f72bc81ec96d1edc6e8d005ef6645e2c6fb9e483 | 14,906 | py | Python | models/SHL_2018/transforms.py | HuguesMoreau/Sensors_similariy | 4b8592049c83b03a11f5c57fab247290ee29b8f5 | [
"Apache-2.0"
] | null | null | null | models/SHL_2018/transforms.py | HuguesMoreau/Sensors_similariy | 4b8592049c83b03a11f5c57fab247290ee29b8f5 | [
"Apache-2.0"
] | null | null | null | models/SHL_2018/transforms.py | HuguesMoreau/Sensors_similariy | 4b8592049c83b03a11f5c57fab247290ee29b8f5 | [
"Apache-2.0"
] | null | null | null | #!/usr/bin/env python
# -*- coding: utf-8 -*-
"""
This file contains diverse preprocessing functions (mostly norms ans spectrograms),
and basic tests and visualizations.
If you are to work with any IPython console (ex: with Jupyter or spyder), is is advised
to launch a '%matplotlib qt' ,to get clean widow
"""
... | 40.395664 | 216 | 0.619616 |
if __name__ == '__main__':
import sys
sys.path.append("../..")
import numpy as np
import torch
import scipy.signal, scipy.interpolate, scipy.ndimage
from param import classes_names, fs, duration_window, duration_overlap, spectro_batch_size
from models.SHL_2018 import Datasets
if __name__ =... | true | true |
f72bc8fafdff910faf1d81e8260be95f5fd4d2f1 | 6,823 | py | Python | lib/rpn_layer/proposal_target_layer.py | aditya2592/PoseCNN | a763120ce0ceb55cf3432980287ef463728f8052 | [
"MIT"
] | 655 | 2018-03-21T19:55:45.000Z | 2022-03-25T20:41:21.000Z | lib/rpn_layer/proposal_target_layer.py | SergioRAgostinho/PoseCNN | da9eaae850eed7521a2a48a4d27474d655caab42 | [
"MIT"
] | 122 | 2018-04-04T13:57:49.000Z | 2022-03-18T09:28:44.000Z | lib/rpn_layer/proposal_target_layer.py | SergioRAgostinho/PoseCNN | da9eaae850eed7521a2a48a4d27474d655caab42 | [
"MIT"
] | 226 | 2018-03-22T01:40:04.000Z | 2022-03-17T11:56:14.000Z | # --------------------------------------------------------
# Faster R-CNN
# Copyright (c) 2015 Microsoft
# Licensed under The MIT License [see LICENSE for details]
# Written by Ross Girshick, Sean Bell and Xinlei Chen
# --------------------------------------------------------
from __future__ import absolute_import
from... | 39.212644 | 118 | 0.725194 |
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
import numpy as np
import numpy.random as npr
from fcn.config import cfg
from utils.bbox_transform import bbox_transform
from utils.cython_bbox import bbox_overlaps
def proposal_target_layer(rpn_rois, rp... | true | true |
f72bca34371f9e866f547515c6eb963685418158 | 3,878 | py | Python | alveo/apps/whole_app_acceleration/classification/test_classify_pp.py | dendisuhubdy/Vitis-AI | 524f65224c52314155dafc011d488ed30e458fcb | [
"Apache-2.0"
] | 3 | 2020-10-29T15:00:30.000Z | 2021-10-21T08:09:34.000Z | alveo/apps/whole_app_acceleration/classification/test_classify_pp.py | dendisuhubdy/Vitis-AI | 524f65224c52314155dafc011d488ed30e458fcb | [
"Apache-2.0"
] | 20 | 2020-10-31T03:19:03.000Z | 2020-11-02T18:59:49.000Z | alveo/apps/whole_app_acceleration/classification/test_classify_pp.py | dendisuhubdy/Vitis-AI | 524f65224c52314155dafc011d488ed30e458fcb | [
"Apache-2.0"
] | 9 | 2020-10-14T02:04:10.000Z | 2020-12-01T08:23:02.000Z | # Copyright 2019 Xilinx Inc.
# Copyright 2019 Xilinx Inc.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable ... | 34.318584 | 183 | 0.687726 |
from __future__ import print_function
from six import itervalues, iteritems
from ctypes import *
import numpy as np
import os, sys
from vai.dpuv1.rt import xdnn, xdnn_io
from vai.dpuv1.rt.vitis.python.dpu.runner import Runner
import waa_rt
import multiprocessing as mp
import ctypes
def pre_process(q,... | true | true |
f72bca80139a374bf9bcf9170ec60403226e508e | 5,931 | py | Python | code/networks/Unet.py | loveredcarrot/ssl_multi_seg | 5315dbcc2c44e8effab28699c1491dd67b7ce00b | [
"Apache-2.0"
] | 3 | 2021-04-28T09:36:32.000Z | 2021-11-17T02:52:07.000Z | code/networks/Unet.py | loveredcarrot/ssl_multi_seg | 5315dbcc2c44e8effab28699c1491dd67b7ce00b | [
"Apache-2.0"
] | null | null | null | code/networks/Unet.py | loveredcarrot/ssl_multi_seg | 5315dbcc2c44e8effab28699c1491dd67b7ce00b | [
"Apache-2.0"
] | null | null | null | # -*- coding: utf-8 -*-
# @Time : 2021/4/8 15:52
# @Author : aurorazeng
# @File : Unet.py
# @license: (C) Copyright 2021-2026, aurorazeng; No reprobaiction without permission.
"""
The implementation is borrowed from: https://github.com/HiLab-git/PyMIC
"""
from __future__ import division, print_function
import nump... | 31.887097 | 85 | 0.572079 |
from __future__ import division, print_function
import numpy as np
import torch
import torch.nn as nn
from torch.distributions.uniform import Uniform
class ConvBlock(nn.Module):
def __init__(self, in_channels, out_channels, dropout_p):
super(ConvBlock, self).__init__()
self.conv_conv = nn... | true | true |
f72bca982790961f6bbe8bc31f1a60032438e1a2 | 154 | py | Python | chat_assistant/chat_assistant_app/urls.py | mrhegemon/Rasa_zero_rpc_XR_bot | a468cc1f2b1a4e935ce18e97dcb7a11070bbea0b | [
"MIT"
] | 1 | 2021-06-21T10:44:51.000Z | 2021-06-21T10:44:51.000Z | chat_assistant/chat_assistant_app/urls.py | mrhegemon/Rasa_zero_rpc_XR_bot | a468cc1f2b1a4e935ce18e97dcb7a11070bbea0b | [
"MIT"
] | null | null | null | chat_assistant/chat_assistant_app/urls.py | mrhegemon/Rasa_zero_rpc_XR_bot | a468cc1f2b1a4e935ce18e97dcb7a11070bbea0b | [
"MIT"
] | 1 | 2021-06-07T23:09:30.000Z | 2021-06-07T23:09:30.000Z | from django.conf.urls import url
from . import views
urlpatterns = [
url('', views.chat, name='chat'),
url('^chat/', views.chat, name='chat'),
]
| 19.25 | 43 | 0.62987 | from django.conf.urls import url
from . import views
urlpatterns = [
url('', views.chat, name='chat'),
url('^chat/', views.chat, name='chat'),
]
| true | true |
f72bcb05e1a89751517adfac4596a0dd60fe06f8 | 2,516 | py | Python | actions/macro/building_positioning.py | drakonnan1st/JackBot | 345df784098cb9eb055b3901fe7455807c58a4e1 | [
"MIT"
] | null | null | null | actions/macro/building_positioning.py | drakonnan1st/JackBot | 345df784098cb9eb055b3901fe7455807c58a4e1 | [
"MIT"
] | null | null | null | actions/macro/building_positioning.py | drakonnan1st/JackBot | 345df784098cb9eb055b3901fe7455807c58a4e1 | [
"MIT"
] | null | null | null | """Everything related to building positioning goes here"""
from sc2.constants import EVOLUTIONCHAMBER, ENGINEERINGBAY
from sc2.data import ACTION_RESULT
from sc2.position import Point2
class BuildingPositioning:
"""Ok for now"""
async def prepare_building_positions(self, center):
"""Check all possibl... | 45.745455 | 114 | 0.604134 | from sc2.constants import EVOLUTIONCHAMBER, ENGINEERINGBAY
from sc2.data import ACTION_RESULT
from sc2.position import Point2
class BuildingPositioning:
async def prepare_building_positions(self, center):
mineral_field = self.state.mineral_field
if mineral_field:
close_points = range(... | true | true |
f72bcbbdf799538cf2dba7ece50cc212bc7de632 | 1,341 | py | Python | 2020/day03/toboggan_trajectory.py | rycmak/advent-of-code | 2a3289516f4c1d0bc1d24a38d495a93edcb19e29 | [
"MIT"
] | 1 | 2021-03-03T01:40:09.000Z | 2021-03-03T01:40:09.000Z | 2020/day03/toboggan_trajectory.py | rycmak/advent-of-code | 2a3289516f4c1d0bc1d24a38d495a93edcb19e29 | [
"MIT"
] | null | null | null | 2020/day03/toboggan_trajectory.py | rycmak/advent-of-code | 2a3289516f4c1d0bc1d24a38d495a93edcb19e29 | [
"MIT"
] | null | null | null | # Pseudo code:
# assume original map is narrow (has more rows than columns)
# transform map to array
# no. of steps downwards = no. of rows
# no. of map copies = ceil((no. of steps downwards - 1) * 3 / no. of columns)
# start at (i, j) = (0, 0)
# move across to (i + 3, j + 1)
# if element == '#', increment num_trees
#... | 31.928571 | 108 | 0.681581 |
# NB: If using numpy, could make use of concatenate, hstack, etc.
# to stack (repeat) copies of original map to the right.
# But without numpy, we'll try to use zip instead...
file = open("input.txt", "r")
map_original = []
num_rows = 0
for line in file:
num_rows += 1
map_original.append(list(line.str... | true | true |
f72bcbc28f844d28924574ebaa52197a6519cc46 | 380 | py | Python | api.py | BabakShah/DS-SafetyPrediction | bc4c99512d04fa73994616584e3f4ab78c3e979e | [
"MIT"
] | null | null | null | api.py | BabakShah/DS-SafetyPrediction | bc4c99512d04fa73994616584e3f4ab78c3e979e | [
"MIT"
] | null | null | null | api.py | BabakShah/DS-SafetyPrediction | bc4c99512d04fa73994616584e3f4ab78c3e979e | [
"MIT"
] | 2 | 2021-06-29T17:28:03.000Z | 2022-02-26T08:41:35.000Z | import pickle
import numpy as np
xgboost = pickle.load(open('./xgboost.pkl', 'rb'))
scaler = pickle.load(open('./scaler.pkl', 'rb'))
def transform_input(input):
return scaler.transform([input])
def make_hard_prediction(input):
return xgboost.predict(transform_input(input))
def make_soft_prediction(input):
... | 23.75 | 61 | 0.747368 | import pickle
import numpy as np
xgboost = pickle.load(open('./xgboost.pkl', 'rb'))
scaler = pickle.load(open('./scaler.pkl', 'rb'))
def transform_input(input):
return scaler.transform([input])
def make_hard_prediction(input):
return xgboost.predict(transform_input(input))
def make_soft_prediction(input):
... | true | true |
f72bcd0625e2740abc5c1c5b36b3afdb5cde844c | 6,402 | py | Python | train_dalle.py | Atica57/DALLE-pytorch | 4fa108271aeb1972fcb118390ec15b656f2c328a | [
"MIT"
] | 1 | 2021-03-08T12:26:49.000Z | 2021-03-08T12:26:49.000Z | train_dalle.py | Atica57/DALLE-pytorch | 4fa108271aeb1972fcb118390ec15b656f2c328a | [
"MIT"
] | null | null | null | train_dalle.py | Atica57/DALLE-pytorch | 4fa108271aeb1972fcb118390ec15b656f2c328a | [
"MIT"
] | null | null | null | import argparse
from random import choice
from pathlib import Path
# torch
import torch
from torch.optim import Adam
from torch.nn.utils import clip_grad_norm_
# vision imports
from PIL import Image
from torchvision import transforms as T
from torch.utils.data import DataLoader, Dataset
from torchvision.datasets im... | 24.813953 | 110 | 0.617619 | import argparse
from random import choice
from pathlib import Path
import torch
from torch.optim import Adam
from torch.nn.utils import clip_grad_norm_
from PIL import Image
from torchvision import transforms as T
from torch.utils.data import DataLoader, Dataset
from torchvision.datasets import ImageFolder
from t... | true | true |
f72bcdcacf211151e2476c6876771adc77e8a368 | 930 | py | Python | CartPole/_CartPole_mathematical_helpers.py | jhuebotter/CartpoleSNNdemo | d18a85cbc45bff48295c46c9cd8c9fc00192318c | [
"MIT"
] | null | null | null | CartPole/_CartPole_mathematical_helpers.py | jhuebotter/CartpoleSNNdemo | d18a85cbc45bff48295c46c9cd8c9fc00192318c | [
"MIT"
] | null | null | null | CartPole/_CartPole_mathematical_helpers.py | jhuebotter/CartpoleSNNdemo | d18a85cbc45bff48295c46c9cd8c9fc00192318c | [
"MIT"
] | null | null | null | """
Small general mathematical functions.
This file was necessary to make CartPole module self-contained.
"""
from math import fmod
import numpy as np
# Wraps the angle into range [-π, π]
def wrap_angle_rad(angle: float) -> float:
Modulo = fmod(angle, 2 * np.pi) # positive modulo
if Modulo < -np.pi:
... | 25.833333 | 66 | 0.649462 |
from math import fmod
import numpy as np
def wrap_angle_rad(angle: float) -> float:
Modulo = fmod(angle, 2 * np.pi)
if Modulo < -np.pi:
angle = Modulo + 2 * np.pi
elif Modulo > np.pi:
angle = Modulo - 2 * np.pi
else:
angle = Modulo
return angle
def wrap_angle_rad_inpl... | true | true |
f72bce4067eef5d32a5ccf8b7a440fc4ed4d0c42 | 1,114 | py | Python | dadmatools/models/flair/parser/utils/vocab.py | njzr/DadmaTools | 64ff407d5d818d5a9216340cccf0d1cc909d3b1b | [
"Apache-2.0"
] | 25 | 2021-12-01T15:19:36.000Z | 2022-03-12T12:50:28.000Z | dadmatools/models/flair/parser/utils/vocab.py | ebad84/DadmaTools | b26ad8aa834f642d49bd120bd7cf1fdf40741be1 | [
"Apache-2.0"
] | 3 | 2021-12-14T06:34:52.000Z | 2022-02-17T08:23:20.000Z | dadmatools/models/flair/parser/utils/vocab.py | ebad84/DadmaTools | b26ad8aa834f642d49bd120bd7cf1fdf40741be1 | [
"Apache-2.0"
] | 6 | 2021-10-12T13:44:17.000Z | 2022-03-07T13:54:17.000Z | # -*- coding: utf-8 -*-
from collections.abc import Iterable
from dadmatools.models.flair.parser.utils.common import unk
class Vocab(object):
def __init__(self, counter, min_freq=1, specials=[]):
self.itos = specials
self.stoi = {token: i for i, token in enumerate(self.itos)}
self.exten... | 28.564103 | 75 | 0.61939 |
from collections.abc import Iterable
from dadmatools.models.flair.parser.utils.common import unk
class Vocab(object):
def __init__(self, counter, min_freq=1, specials=[]):
self.itos = specials
self.stoi = {token: i for i, token in enumerate(self.itos)}
self.extend([token for token, fre... | true | true |
f72bd002b56ea30cddba78b9525df205cb9088df | 7,561 | py | Python | tests/lint/check_file_type.py | PhilippvK/tvm | e7748aac40bd4c263882323393ea8896837614a9 | [
"Zlib",
"Unlicense",
"Apache-2.0",
"BSD-2-Clause",
"MIT",
"ECL-2.0"
] | null | null | null | tests/lint/check_file_type.py | PhilippvK/tvm | e7748aac40bd4c263882323393ea8896837614a9 | [
"Zlib",
"Unlicense",
"Apache-2.0",
"BSD-2-Clause",
"MIT",
"ECL-2.0"
] | null | null | null | tests/lint/check_file_type.py | PhilippvK/tvm | e7748aac40bd4c263882323393ea8896837614a9 | [
"Zlib",
"Unlicense",
"Apache-2.0",
"BSD-2-Clause",
"MIT",
"ECL-2.0"
] | null | null | null | # Licensed to the Apache Software Foundation (ASF) under one
# or more contributor license agreements. See the NOTICE file
# distributed with this work for additional information
# regarding copyright ownership. The ASF licenses this file
# to you under the Apache License, Version 2.0 (the
# "License"); you may not u... | 28.003704 | 118 | 0.624653 |
import os
import sys
import subprocess
ALLOW_EXTENSION = {
"cc",
"c",
"h",
"s",
"rs",
"m",
"mm",
"g4",
"gradle",
"js",
"tcl",
"scala",
"java",
"go",
"ts",
"sh",
"py",
"pyi",
"pxi",
"pyd",
"pyx",
"cu",
"bat... | true | true |
f72bd0034cfdcd02a88b42c82d265f8271a74c19 | 30,361 | py | Python | covid/wallet/cc_wallet/cc_wallet.py | grayfallstown/covid-blockchain | 194d5351c70d3ee5d928f767e21c7894cfbb59a7 | [
"Apache-2.0"
] | null | null | null | covid/wallet/cc_wallet/cc_wallet.py | grayfallstown/covid-blockchain | 194d5351c70d3ee5d928f767e21c7894cfbb59a7 | [
"Apache-2.0"
] | null | null | null | covid/wallet/cc_wallet/cc_wallet.py | grayfallstown/covid-blockchain | 194d5351c70d3ee5d928f767e21c7894cfbb59a7 | [
"Apache-2.0"
] | null | null | null | from __future__ import annotations
import logging
import time
from dataclasses import replace
from secrets import token_bytes
from typing import Any, Dict, List, Optional, Set
from blspy import AugSchemeMPL, G2Element
from covid.consensus.cost_calculator import calculate_cost_of_program, NPCResult
from covid.full_no... | 40.589572 | 118 | 0.647969 | from __future__ import annotations
import logging
import time
from dataclasses import replace
from secrets import token_bytes
from typing import Any, Dict, List, Optional, Set
from blspy import AugSchemeMPL, G2Element
from covid.consensus.cost_calculator import calculate_cost_of_program, NPCResult
from covid.full_no... | true | true |
f72bd026e80c9b36f6569dca3e1e436f15855ecb | 417 | py | Python | tests/integration/test_segway_train.py | procha2/segway-pipeline | d0d3b8603eea9c9cbe92b56899c670dc41e89ca8 | [
"MIT"
] | 1 | 2021-03-13T11:34:45.000Z | 2021-03-13T11:34:45.000Z | tests/integration/test_segway_train.py | procha2/segway-pipeline | d0d3b8603eea9c9cbe92b56899c670dc41e89ca8 | [
"MIT"
] | null | null | null | tests/integration/test_segway_train.py | procha2/segway-pipeline | d0d3b8603eea9c9cbe92b56899c670dc41e89ca8 | [
"MIT"
] | 1 | 2020-10-01T11:48:17.000Z | 2020-10-01T11:48:17.000Z | from pathlib import Path
import pytest
@pytest.mark.workflow("test_segway_train")
def test_segway_train_traindirs_match(test_data_dir, workflow_dir, traindirs_match):
actual_traindir_path = workflow_dir / Path("test-output/traindir.tar.gz")
expected_traindir_path = test_data_dir / Path("segway_train_traindir... | 37.909091 | 86 | 0.822542 | from pathlib import Path
import pytest
@pytest.mark.workflow("test_segway_train")
def test_segway_train_traindirs_match(test_data_dir, workflow_dir, traindirs_match):
actual_traindir_path = workflow_dir / Path("test-output/traindir.tar.gz")
expected_traindir_path = test_data_dir / Path("segway_train_traindir... | true | true |
f72bd02dde43d0b610faacf919e7788a178ef0a9 | 1,359 | py | Python | vsts/vsts/service_endpoint/v4_1/models/service_endpoint_execution_owner.py | kenkuo/azure-devops-python-api | 9e920bd25e938fa89ff7f60153e5b9e113ca839d | [
"MIT"
] | null | null | null | vsts/vsts/service_endpoint/v4_1/models/service_endpoint_execution_owner.py | kenkuo/azure-devops-python-api | 9e920bd25e938fa89ff7f60153e5b9e113ca839d | [
"MIT"
] | null | null | null | vsts/vsts/service_endpoint/v4_1/models/service_endpoint_execution_owner.py | kenkuo/azure-devops-python-api | 9e920bd25e938fa89ff7f60153e5b9e113ca839d | [
"MIT"
] | null | null | null | # --------------------------------------------------------------------------------------------
# Copyright (c) Microsoft Corporation. All rights reserved.
# Licensed under the MIT License. See License.txt in the project root for license information.
# --------------------------------------------------------------------... | 39.970588 | 94 | 0.532009 |
from msrest.serialization import Model
class ServiceEndpointExecutionOwner(Model):
_attribute_map = {
'_links': {'key': '_links', 'type': 'ReferenceLinks'},
'id': {'key': 'id', 'type': 'int'},
'name': {'key': 'name', 'type': 'str'}
}
def __init__(self, _links=None, id=Non... | true | true |
f72bd05b364336d0dfa60b4f0cb91cab8257f3a8 | 17,511 | py | Python | cirq-google/cirq_google/serialization/op_serializer_test.py | augustehirth/Cirq | e616710a0fa243524a9f6d7bc0d35e6b952fe3d0 | [
"Apache-2.0"
] | null | null | null | cirq-google/cirq_google/serialization/op_serializer_test.py | augustehirth/Cirq | e616710a0fa243524a9f6d7bc0d35e6b952fe3d0 | [
"Apache-2.0"
] | null | null | null | cirq-google/cirq_google/serialization/op_serializer_test.py | augustehirth/Cirq | e616710a0fa243524a9f6d7bc0d35e6b952fe3d0 | [
"Apache-2.0"
] | null | null | null | # Copyright 2019 The Cirq Developers
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# https://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in ... | 32.669776 | 100 | 0.640911 |
from typing import Dict, List
import copy
import numpy as np
import pytest
import sympy
from google.protobuf import json_format
import cirq
import cirq_google as cg
from cirq_google.api import v2
DEFAULT_TOKEN = 'test_tag'
def op_proto(json: Dict) -> v2.program_pb2.Operation:
op = v2.program_pb... | true | true |
f72bd06d2f9f175effe7beb9a4509946d29b33e0 | 158 | py | Python | build.py | pengguanjun/zeno_learn | bd5298f14180f1b2ce1edb83305bbc2ce4c7d0c8 | [
"MIT"
] | 4 | 2021-08-03T16:26:52.000Z | 2022-03-30T10:32:23.000Z | build.py | pengguanjun/zeno_learn | bd5298f14180f1b2ce1edb83305bbc2ce4c7d0c8 | [
"MIT"
] | 1 | 2021-11-09T10:54:24.000Z | 2021-11-09T10:54:24.000Z | build.py | pengguanjun/zeno_learn | bd5298f14180f1b2ce1edb83305bbc2ce4c7d0c8 | [
"MIT"
] | 3 | 2021-11-09T10:48:16.000Z | 2021-11-09T15:18:02.000Z | #!/usr/bin/env python3
import subprocess
subprocess.check_call(['cmake', '-B', 'build'])
subprocess.check_call(['cmake', '--build', 'build', '--parallel'])
| 22.571429 | 66 | 0.670886 |
import subprocess
subprocess.check_call(['cmake', '-B', 'build'])
subprocess.check_call(['cmake', '--build', 'build', '--parallel'])
| true | true |
f72bd075c6cfb39433750fb4807078e2c2bb2e91 | 4,623 | py | Python | SuperB/api/serializers.py | rialrustamov/SuperB-E-Commerce-RR | 099fcfb50bd1623237fd352a87d19926dda52904 | [
"MIT"
] | null | null | null | SuperB/api/serializers.py | rialrustamov/SuperB-E-Commerce-RR | 099fcfb50bd1623237fd352a87d19926dda52904 | [
"MIT"
] | null | null | null | SuperB/api/serializers.py | rialrustamov/SuperB-E-Commerce-RR | 099fcfb50bd1623237fd352a87d19926dda52904 | [
"MIT"
] | null | null | null | from rest_framework import serializers
from django.db.models import fields
from product.models import Product, ProductVersion, Category, Review, Image
from order.models import ShoppingCart, Wishlist, CartItem
from blog.models import Category as BlogCategory, Blog
from django.contrib.auth import get_user_model
from use... | 28.361963 | 110 | 0.689812 | from rest_framework import serializers
from django.db.models import fields
from product.models import Product, ProductVersion, Category, Review, Image
from order.models import ShoppingCart, Wishlist, CartItem
from blog.models import Category as BlogCategory, Blog
from django.contrib.auth import get_user_model
from use... | true | true |
f72bd109a480d8206801746e5910512f5d37e064 | 444 | py | Python | tests/test_cpplibhub.py | iotanbo/cpplibhub | 0758d416c8d2c0b29d70300f25ccc898a7ad64df | [
"MIT"
] | null | null | null | tests/test_cpplibhub.py | iotanbo/cpplibhub | 0758d416c8d2c0b29d70300f25ccc898a7ad64df | [
"MIT"
] | null | null | null | tests/test_cpplibhub.py | iotanbo/cpplibhub | 0758d416c8d2c0b29d70300f25ccc898a7ad64df | [
"MIT"
] | null | null | null |
import pytest
from click.testing import CliRunner
from cpplibhub.cli import main
@pytest.fixture(scope="module")
def runner():
return CliRunner()
def test_main(runner):
# assert main([]) == 0 # run without click
result = runner.invoke(main)
# result = runner.invoke(main, ['--name', 'Amy'])
as... | 22.2 | 53 | 0.671171 |
import pytest
from click.testing import CliRunner
from cpplibhub.cli import main
@pytest.fixture(scope="module")
def runner():
return CliRunner()
def test_main(runner):
r.invoke(main)
assert result.exit_code == 0
| true | true |
f72bd1370d655bb4ca4fe412e26c161f507ca79b | 7,667 | py | Python | lib/dblatex-0.3.2/lib/dbtexmf/dblatex/grubber/plugins.py | jonathanmorley/HR-XSL | 799b1075cbec4cda3d686d588eea92a62d59963f | [
"Apache-2.0"
] | 1 | 2017-12-29T23:23:14.000Z | 2017-12-29T23:23:14.000Z | lib/dblatex-0.3.2/lib/dbtexmf/dblatex/grubber/plugins.py | jonathanmorley/HR-XSL | 799b1075cbec4cda3d686d588eea92a62d59963f | [
"Apache-2.0"
] | null | null | null | lib/dblatex-0.3.2/lib/dbtexmf/dblatex/grubber/plugins.py | jonathanmorley/HR-XSL | 799b1075cbec4cda3d686d588eea92a62d59963f | [
"Apache-2.0"
] | null | null | null | # This file is part of Rubber and thus covered by the GPL
# (c) Emmanuel Beffara, 2002--2006
"""
Mechanisms to dynamically load extra modules to help the LaTeX compilation.
All the modules must be derived from the TexModule class.
"""
import imp
from os.path import *
from msg import _, msg
import sys
class TexModule... | 33.480349 | 78 | 0.589148 |
import imp
from os.path import *
from msg import _, msg
import sys
class TexModule (object):
def __init__ (self, env, dict):
def pre_compile (self):
return 0
def post_compile (self):
return 0
def last_compile (self):
return 0
def clean (self):
def command (self,... | true | true |
f72bd2060174e51a551060a884d7fdfeb1276fa6 | 15,646 | py | Python | pandaharvester/harvesterbody/master.py | nikmagini/harvester | 1d62dd0e35b53a51919b0250fffec478778f460a | [
"Apache-2.0"
] | 11 | 2017-06-01T10:16:58.000Z | 2019-11-22T08:41:36.000Z | pandaharvester/harvesterbody/master.py | nikmagini/harvester | 1d62dd0e35b53a51919b0250fffec478778f460a | [
"Apache-2.0"
] | 34 | 2016-10-25T19:15:24.000Z | 2021-03-05T12:59:04.000Z | pandaharvester/harvesterbody/master.py | nikmagini/harvester | 1d62dd0e35b53a51919b0250fffec478778f460a | [
"Apache-2.0"
] | 17 | 2016-10-24T13:29:45.000Z | 2021-03-23T17:35:27.000Z | import os
import pwd
import grp
import sys
import socket
import signal
import logging
import daemon.pidfile
import argparse
import threading
import cProfile
import atexit
from future.utils import iteritems
try:
import pprofile
except Exception:
pass
from pandalogger import logger_config
from pandaharvester im... | 37.430622 | 104 | 0.604244 | import os
import pwd
import grp
import sys
import socket
import signal
import logging
import daemon.pidfile
import argparse
import threading
import cProfile
import atexit
from future.utils import iteritems
try:
import pprofile
except Exception:
pass
from pandalogger import logger_config
from pandaharvester im... | true | true |
f72bd257412e17141e60758b6a2232418acfb73b | 895 | py | Python | sdks/python/test/test_PurgeResponse.py | Brantone/appcenter-sdks | eeb063ecf79908b6e341fb00196d2cd9dc8f3262 | [
"MIT"
] | null | null | null | sdks/python/test/test_PurgeResponse.py | Brantone/appcenter-sdks | eeb063ecf79908b6e341fb00196d2cd9dc8f3262 | [
"MIT"
] | 6 | 2019-10-23T06:38:53.000Z | 2022-01-22T07:57:58.000Z | sdks/python/test/test_PurgeResponse.py | Brantone/appcenter-sdks | eeb063ecf79908b6e341fb00196d2cd9dc8f3262 | [
"MIT"
] | 2 | 2019-10-23T06:31:05.000Z | 2021-08-21T17:32:47.000Z | # coding: utf-8
"""
App Center Client
Microsoft Visual Studio App Center API # noqa: E501
OpenAPI spec version: preview
Contact: benedetto.abbenanti@gmail.com
Project Repository: https://github.com/b3nab/appcenter-sdks
"""
from __future__ import absolute_import
import unittest
import appcente... | 22.375 | 85 | 0.709497 |
from __future__ import absolute_import
import unittest
import appcenter_sdk
from PurgeResponse.clsPurgeResponse import PurgeResponse
from appcenter_sdk.rest import ApiException
class TestPurgeResponse(unittest.TestCase):
def setUp(self):
pass
def tearDown(self):
pass
def testPurg... | true | true |
f72bd2eca21eed63e0f6123f34b5568c86396f4a | 176,314 | py | Python | mkt/reviewers/tests/test_views.py | jasonthomas/zamboni | 948247609cb4b2ed72e6daa4da5257927bfe0c17 | [
"BSD-3-Clause"
] | null | null | null | mkt/reviewers/tests/test_views.py | jasonthomas/zamboni | 948247609cb4b2ed72e6daa4da5257927bfe0c17 | [
"BSD-3-Clause"
] | null | null | null | mkt/reviewers/tests/test_views.py | jasonthomas/zamboni | 948247609cb4b2ed72e6daa4da5257927bfe0c17 | [
"BSD-3-Clause"
] | null | null | null | # -*- coding: utf-8 -*-
import json
import re
import time
from datetime import datetime, timedelta
from itertools import cycle
from os import path
from django import test
from django.conf import settings
from django.core import mail
from django.core.urlresolvers import reverse
from django.test.client import RequestFac... | 40.79454 | 79 | 0.620518 |
import json
import re
import time
from datetime import datetime, timedelta
from itertools import cycle
from os import path
from django import test
from django.conf import settings
from django.core import mail
from django.core.urlresolvers import reverse
from django.test.client import RequestFactory
from django.test.u... | true | true |
f72bd40ce088f4120389f93fcd804f18f5fdfbf5 | 7,929 | py | Python | tests/rastrigin_accept_action.py | LiyrAstroph/CDNest | afb6b869ce1c4ebd76662b20310f1d9d3db4e26e | [
"MIT"
] | 6 | 2019-09-11T03:34:45.000Z | 2020-10-16T12:14:05.000Z | tests/rastrigin_accept_action.py | LiyrAstroph/DNest_C | afb6b869ce1c4ebd76662b20310f1d9d3db4e26e | [
"MIT"
] | 2 | 2020-05-14T10:04:48.000Z | 2021-01-06T02:04:19.000Z | tests/rastrigin_accept_action.py | LiyrAstroph/DNest_C | afb6b869ce1c4ebd76662b20310f1d9d3db4e26e | [
"MIT"
] | null | null | null | #
# sample from a Rastrigin test function
# this is to illustrate how to use accept_action in CDNest to avoid repeat calculations.
#
# A 2D Rastrigin function looks
#
# logL=-(10.0*2 + (coords[0]**2 - 10*np.cos(2.0*np.pi*coords[0])) + (coords[1]**2 - 10*np.cos(2.0*np.pi*coords[1])) )
#
# Every perturb, only one param... | 37.225352 | 118 | 0.66137 |
from mpi4py import MPI
import numpy as np
import cydnest
import matplotlib.pyplot as plt
from matplotlib import cm
comm = MPI.COMM_WORLD
rank = comm.Get_rank()
def randh():
return 10.0**(1.5 - 3*np.abs(np.random.randn()/np.sqrt(-np.log(np.random.rand()))))*np.random.randn()
def wrap(x, a, b):
asse... | true | true |
f72bd6613a23fb41a75040d39b206992b03cd8d2 | 27,303 | py | Python | catalyst/marketplace/marketplace.py | echo-ray/catalyst | 8b4274d17f0a42ee4d1d5e09d30fb0919aea2a51 | [
"Apache-2.0"
] | null | null | null | catalyst/marketplace/marketplace.py | echo-ray/catalyst | 8b4274d17f0a42ee4d1d5e09d30fb0919aea2a51 | [
"Apache-2.0"
] | null | null | null | catalyst/marketplace/marketplace.py | echo-ray/catalyst | 8b4274d17f0a42ee4d1d5e09d30fb0919aea2a51 | [
"Apache-2.0"
] | null | null | null | from __future__ import print_function
import glob
import json
import os
import re
import shutil
import sys
import time
import webbrowser
import bcolz
import logbook
import pandas as pd
import requests
from requests_toolbelt import MultipartDecoder
from requests_toolbelt.multipart.decoder import \
NonMultipartCont... | 34.430013 | 79 | 0.517892 | from __future__ import print_function
import glob
import json
import os
import re
import shutil
import sys
import time
import webbrowser
import bcolz
import logbook
import pandas as pd
import requests
from requests_toolbelt import MultipartDecoder
from requests_toolbelt.multipart.decoder import \
NonMultipartCont... | true | true |
f72bd87c0f6308b1597913764a10b8ad4d63132c | 2,172 | py | Python | coevolution_transformer/model/msa_embeddings.py | microsoft/Protein-Folding | f534b2dd1e3f192fbcdadf234f25828c7f458a58 | [
"MIT"
] | 1 | 2021-11-12T03:00:28.000Z | 2021-11-12T03:00:28.000Z | coevolution_transformer/model/msa_embeddings.py | microsoft/Protein-Folding | f534b2dd1e3f192fbcdadf234f25828c7f458a58 | [
"MIT"
] | 1 | 2022-01-11T17:09:26.000Z | 2022-01-11T17:09:26.000Z | coevolution_transformer/model/msa_embeddings.py | microsoft/Protein-Folding | f534b2dd1e3f192fbcdadf234f25828c7f458a58 | [
"MIT"
] | 2 | 2021-11-10T11:42:11.000Z | 2021-12-09T05:37:09.000Z | # Copyright (c) Microsoft Corporation.
# Licensed under the MIT License.
import math
import torch
from torch import nn
import torch.nn.functional as F
class PositionalEncoding(nn.Module):
def __init__(self, d_model, max_len=1 << 13):
super(PositionalEncoding, self).__init__()
self.ninp = d_model
... | 36.2 | 98 | 0.603131 |
import math
import torch
from torch import nn
import torch.nn.functional as F
class PositionalEncoding(nn.Module):
def __init__(self, d_model, max_len=1 << 13):
super(PositionalEncoding, self).__init__()
self.ninp = d_model
pe = torch.zeros(max_len, d_model)
position = torch.ara... | true | true |
f72bd8ae65fb7e4bb2f7694fe3f07aad90af90c7 | 5,513 | py | Python | pywavefront/material.py | elgrandt/ShooterInc | 0552e563d9ea81b0e0a0c4be1648412aa52c56e6 | [
"MIT"
] | null | null | null | pywavefront/material.py | elgrandt/ShooterInc | 0552e563d9ea81b0e0a0c4be1648412aa52c56e6 | [
"MIT"
] | null | null | null | pywavefront/material.py | elgrandt/ShooterInc | 0552e563d9ea81b0e0a0c4be1648412aa52c56e6 | [
"MIT"
] | null | null | null | # ----------------------------------------------------------------------------
# PyWavefront
# Copyright (c) 2013 Kurt Yoder
# All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions
# are met:
#
# * Redistribution... | 35.339744 | 79 | 0.649737 |
from OpenGL.GL import *
import pywavefront.parser as parser
import pywavefront.texture as texture
class Material(object):
def __init__(self, name):
self.name = name
self.diffuse = [.8, .8, .8, 1.]
self.ambient = [.2, .2, .2, 1.]
self.specular = [0.... | true | true |
f72bd8c09290fd4650b93bed148f010025633ae2 | 5,361 | py | Python | hla_hed.py | sunhuaibo/HLA-HED | bb0672e62a20baad80f5f154c9220bf8e5b8b28c | [
"MIT"
] | null | null | null | hla_hed.py | sunhuaibo/HLA-HED | bb0672e62a20baad80f5f154c9220bf8e5b8b28c | [
"MIT"
] | null | null | null | hla_hed.py | sunhuaibo/HLA-HED | bb0672e62a20baad80f5f154c9220bf8e5b8b28c | [
"MIT"
] | null | null | null | #!/usr/bin/env python
# -*- coding=utf-8 -*-
# =====================================
# Author: Huaibo Sun
# E-mail: huaibo_sun@foxmail.com
# date: 2022-03-31
# =====================================
import os
import pandas as pd
from Bio import SeqIO
from pathlib import Path
from itertools import combinations
from a... | 39.711111 | 312 | 0.610707 |
import os
import pandas as pd
from Bio import SeqIO
from pathlib import Path
from itertools import combinations
from argparse import ArgumentParser, RawDescriptionHelpFormatter
def get_opt():
script = os.path.dirname(os.path.abspath(__file__))
parser = ArgumentParser(formatter_class=RawDescriptio... | true | true |
f72bd93c4d17e05aa0d2db88c1b2ffb816c8ad18 | 2,936 | py | Python | sdk/monitor/azure-monitor-query/setup.py | vincenttran-msft/azure-sdk-for-python | 348b56f9f03eeb3f7b502eed51daf494ffff874d | [
"MIT"
] | 1 | 2022-03-09T08:59:13.000Z | 2022-03-09T08:59:13.000Z | sdk/monitor/azure-monitor-query/setup.py | vincenttran-msft/azure-sdk-for-python | 348b56f9f03eeb3f7b502eed51daf494ffff874d | [
"MIT"
] | null | null | null | sdk/monitor/azure-monitor-query/setup.py | vincenttran-msft/azure-sdk-for-python | 348b56f9f03eeb3f7b502eed51daf494ffff874d | [
"MIT"
] | null | null | null | #!/usr/bin/env python
#-------------------------------------------------------------------------
# Copyright (c) Microsoft Corporation. All rights reserved.
# Licensed under the MIT License. See License.txt in the project root for
# license information.
#----------------------------------------------------------------... | 33.363636 | 85 | 0.609673 |
import re
import os.path
from io import open
from setuptools import find_packages, setup
PACKAGE_NAME = "azure-monitor-query"
PACKAGE_PPRINT_NAME = "Azure Monitor Query"
package_folder_path = PACKAGE_NAME.replace('-', '/')
namespace_name = PACKAGE_NAME.replace('-', '.')
try:
import azure
try:
... | true | true |
f72bd93f9a0200f463455bbe0367f69059d57081 | 1,045 | py | Python | src/serialize_tree.py | kemingy/daily-coding-problem | 0839311ec0848f8f0b4a9edba817ecceb8f944a0 | [
"Unlicense"
] | 3 | 2019-03-06T03:14:56.000Z | 2020-01-07T16:00:48.000Z | src/serialize_tree.py | kemingy/daily-coding-problem | 0839311ec0848f8f0b4a9edba817ecceb8f944a0 | [
"Unlicense"
] | null | null | null | src/serialize_tree.py | kemingy/daily-coding-problem | 0839311ec0848f8f0b4a9edba817ecceb8f944a0 | [
"Unlicense"
] | null | null | null | # Given the root to a binary tree, implement serialize(root), which serializes
# the tree into a string, and deserialize(s), which deserializes the string back
# into the tree.
class Node:
def __init__(self, val, left=None, right=None):
self.val = val
self.left = left
self.right ... | 25.487805 | 89 | 0.579904 |
class Node:
def __init__(self, val, left=None, right=None):
self.val = val
self.left = left
self.right = right
def serialize(node):
ans = []
level = [node]
while level:
children = []
for n in level:
if n:
children... | true | true |
f72bd97572c539099427f5e9007176593b7fce2c | 470 | py | Python | test_project/views/response_types/http_redirect.py | korantu/lona | 5039fa59f37cc32b9c789753af2ed8a8670ab611 | [
"MIT"
] | 230 | 2021-08-15T20:46:24.000Z | 2022-03-30T10:17:43.000Z | test_project/views/response_types/http_redirect.py | korantu/lona | 5039fa59f37cc32b9c789753af2ed8a8670ab611 | [
"MIT"
] | 176 | 2021-08-18T08:19:37.000Z | 2022-03-29T16:45:06.000Z | test_project/views/response_types/http_redirect.py | korantu/lona | 5039fa59f37cc32b9c789753af2ed8a8670ab611 | [
"MIT"
] | 13 | 2021-08-20T10:35:04.000Z | 2022-01-17T15:49:40.000Z | from lona.html import Strong, Div, H2, P
from lona.view import LonaView
class HTTPRedirectView(LonaView):
def handle_request(self, request):
s = Strong()
html = Div(
H2('Redirect'),
P('You will be HTTP redirected in ', s, ' seconds'),
)
for i in [3, 2, 1]:... | 19.583333 | 64 | 0.497872 | from lona.html import Strong, Div, H2, P
from lona.view import LonaView
class HTTPRedirectView(LonaView):
def handle_request(self, request):
s = Strong()
html = Div(
H2('Redirect'),
P('You will be HTTP redirected in ', s, ' seconds'),
)
for i in [3, 2, 1]:... | true | true |
f72bd9dea41c09da28f2a59df1bc45565df5f22d | 1,064 | py | Python | products/migrations/0003_reviews.py | ankit-ak/django-ecommerce-1 | 248127526c03c7c0f25a2df84365a0d0199b9693 | [
"MIT"
] | 4 | 2021-04-06T16:50:57.000Z | 2022-03-02T00:50:44.000Z | products/migrations/0003_reviews.py | ankit-ak/django-ecommerce-1 | 248127526c03c7c0f25a2df84365a0d0199b9693 | [
"MIT"
] | null | null | null | products/migrations/0003_reviews.py | ankit-ak/django-ecommerce-1 | 248127526c03c7c0f25a2df84365a0d0199b9693 | [
"MIT"
] | 7 | 2021-02-22T08:07:20.000Z | 2022-03-06T10:17:28.000Z | # Generated by Django 2.2.11 on 2020-04-01 18:44
from django.conf import settings
from django.db import migrations, models
import django.db.models.deletion
class Migration(migrations.Migration):
dependencies = [
migrations.swappable_dependency(settings.AUTH_USER_MODEL),
('products', '0002_auto_2... | 39.407407 | 166 | 0.631579 |
from django.conf import settings
from django.db import migrations, models
import django.db.models.deletion
class Migration(migrations.Migration):
dependencies = [
migrations.swappable_dependency(settings.AUTH_USER_MODEL),
('products', '0002_auto_20200314_0741'),
]
operations = [
... | true | true |
f72bda1f9861b327f93273a74d2beaf0c1884dd9 | 1,026 | py | Python | INBa/2015/Sarocvashin_M/task_4_23.py | YukkaSarasti/pythonintask | eadf4245abb65f4400a3bae30a4256b4658e009c | [
"Apache-2.0"
] | null | null | null | INBa/2015/Sarocvashin_M/task_4_23.py | YukkaSarasti/pythonintask | eadf4245abb65f4400a3bae30a4256b4658e009c | [
"Apache-2.0"
] | null | null | null | INBa/2015/Sarocvashin_M/task_4_23.py | YukkaSarasti/pythonintask | eadf4245abb65f4400a3bae30a4256b4658e009c | [
"Apache-2.0"
] | null | null | null | # Задача 4. Вариант 23
# Напишите программу, которая выводит имя, под которым скрывается Илья Арнольдович Файзильберг. Дополнительно необходимо вывести область интересов указанной личности, место рождения, годы рождения и смерти (если человек умер), вычислить возраст на данный момент (или момент смерти). Для хранения в... | 46.636364 | 449 | 0.783626 |
name = "Илья Арнольдович Файзильберг"
birthplace = "Одесса,СССР"
birthyear = int (1897)
deathyear = int (1937)
age = int (deathyear - birthyear)
interest = "Писатель"
print(name+" наиболее известен как Илья Ильф - русский советский писатель, журналист и сценарист. Соавтор Евгения Петрова")
print("Место рождени... | true | true |
f72bdb03716d1c420cd5c2e0dab725ff70c1358a | 8,629 | py | Python | src/python3/sdp/math/interpolation.py | LeiShi/Synthetic-Diagnostics-Platform | 870120d3fd14b2a3c89c6e6e85625d1e9109a2de | [
"BSD-3-Clause"
] | 5 | 2019-08-16T22:08:19.000Z | 2021-02-24T02:47:05.000Z | src/python3/sdp/math/interpolation.py | justthepython/Synthetic-Diagnostics-Platform | 5f1cb5c29d182490acbd4f3c167f0e09ec211236 | [
"BSD-3-Clause"
] | 1 | 2016-05-11T12:58:00.000Z | 2016-05-11T17:18:36.000Z | src/python3/sdp/math/interpolation.py | justthepython/Synthetic-Diagnostics-Platform | 5f1cb5c29d182490acbd4f3c167f0e09ec211236 | [
"BSD-3-Clause"
] | 5 | 2018-04-29T12:35:59.000Z | 2020-01-10T03:38:30.000Z | """This module contains some useful interpolation methods
"""
import numpy as np
from scipy.interpolate import BarycentricInterpolator
class InterpolationError(Exception):
def __init__(self,value):
self.value = value
def __str__(self):
return repr(self.value)
class OutofBoundError(Interpolati... | 40.70283 | 565 | 0.585004 |
import numpy as np
from scipy.interpolate import BarycentricInterpolator
class InterpolationError(Exception):
def __init__(self,value):
self.value = value
def __str__(self):
return repr(self.value)
class OutofBoundError(InterpolationError, ValueError):
def __init__(self, value):
s... | true | true |
f72bdb07358bd565efec3e28ef5e0ed2041de357 | 7,081 | py | Python | cla-backend/cla/tests/unit/test_user_event.py | tejasadg/easycla | 12284c957ab543d0d09c63aa8e82d70ecf09ccaf | [
"Apache-2.0",
"CC-BY-4.0",
"MIT"
] | null | null | null | cla-backend/cla/tests/unit/test_user_event.py | tejasadg/easycla | 12284c957ab543d0d09c63aa8e82d70ecf09ccaf | [
"Apache-2.0",
"CC-BY-4.0",
"MIT"
] | null | null | null | cla-backend/cla/tests/unit/test_user_event.py | tejasadg/easycla | 12284c957ab543d0d09c63aa8e82d70ecf09ccaf | [
"Apache-2.0",
"CC-BY-4.0",
"MIT"
] | null | null | null | # Copyright The Linux Foundation and each contributor to CommunityBridge.
# SPDX-License-Identifier: MIT
from unittest.mock import patch, Mock
import unittest
import pytest
from cla.models.dynamo_models import User, Project, Company, CCLAWhitelistRequest
from cla.models.event_types import EventType
from cla.controll... | 41.168605 | 102 | 0.656263 |
from unittest.mock import patch, Mock
import unittest
import pytest
from cla.models.dynamo_models import User, Project, Company, CCLAWhitelistRequest
from cla.models.event_types import EventType
from cla.controllers import user as user_controller
from cla.auth import AuthUser
@pytest.fixture
def create_event_use... | true | true |
f72bdc7b9355d16ea5ca646e0db1ca2a4c402827 | 5,135 | py | Python | win_unc/unc_directory.py | zo-edv/py_win_unc | 610b7c9ce4ea17554d04342126169b488c8ccfae | [
"MIT"
] | 10 | 2015-08-14T06:34:28.000Z | 2020-10-03T17:48:09.000Z | win_unc/unc_directory.py | zo-edv/py_win_unc | 610b7c9ce4ea17554d04342126169b488c8ccfae | [
"MIT"
] | 11 | 2017-01-12T23:43:56.000Z | 2020-06-19T18:32:56.000Z | win_unc/unc_directory.py | zo-edv/py_win_unc | 610b7c9ce4ea17554d04342126169b488c8ccfae | [
"MIT"
] | 8 | 2015-09-25T20:44:33.000Z | 2018-10-04T03:19:42.000Z | from win_unc.errors import InvalidUncPathError
from win_unc.cleaners import clean_unc_path
from win_unc.unc_credentials import get_creds_from_string
from win_unc.validators import is_valid_unc_path
class UncDirectory(object):
"""
Represents a UNC directory on Windows. A UNC directory is a path and optionally ... | 37.481752 | 98 | 0.637196 | from win_unc.errors import InvalidUncPathError
from win_unc.cleaners import clean_unc_path
from win_unc.unc_credentials import get_creds_from_string
from win_unc.validators import is_valid_unc_path
class UncDirectory(object):
def __init__(self, path, creds=None):
if creds is None and isinstance(path, Un... | true | true |
f72bde3b469c3f1a0eb70bdea36a1aef13bbb4ee | 1,302 | py | Python | donkeycar/parts/terminator.py | Stippos/donkeycar | 4d8bc923f3c188df4b72057c4fdf4315f5d1ad67 | [
"MIT"
] | 1 | 2020-12-08T07:43:07.000Z | 2020-12-08T07:43:07.000Z | donkeycar/parts/terminator.py | ari-viitala/donkeycar | 4d8bc923f3c188df4b72057c4fdf4315f5d1ad67 | [
"MIT"
] | null | null | null | donkeycar/parts/terminator.py | ari-viitala/donkeycar | 4d8bc923f3c188df4b72057c4fdf4315f5d1ad67 | [
"MIT"
] | null | null | null | class Terminator:
def __init__(self):
self.dead = False
self.training = False
self.image = None
self.steering = 0
self.throttle = 0
def poll():
self.dead = self.is_dead(self.image)
self.steering *= self.dead
self.throttle *= self.dead
def up... | 27.125 | 93 | 0.570661 | class Terminator:
def __init__(self):
self.dead = False
self.training = False
self.image = None
self.steering = 0
self.throttle = 0
def poll():
self.dead = self.is_dead(self.image)
self.steering *= self.dead
self.throttle *= self.dead
def up... | false | true |
f72bdee1d28143d175cb1971a290684cad30cafc | 479 | py | Python | Code/sentiment_analysis.py | mayureeb/fakenews | c47a72c8bbe4d413b309da0c662da784c002fe3f | [
"Unlicense"
] | 12 | 2017-06-25T23:06:31.000Z | 2021-02-27T23:06:57.000Z | Code/sentiment_analysis.py | mayureeb/fakenews | c47a72c8bbe4d413b309da0c662da784c002fe3f | [
"Unlicense"
] | 6 | 2021-03-31T20:03:11.000Z | 2022-03-12T00:49:42.000Z | Code/sentiment_analysis.py | mayureeb/fakenews | c47a72c8bbe4d413b309da0c662da784c002fe3f | [
"Unlicense"
] | 5 | 2017-06-25T23:05:41.000Z | 2018-11-22T16:10:58.000Z | import pandas as pd
from textblob import TextBlob
pd.options.mode.chained_assignment = None # ignores the SettingWithCopy Warning
df = pd.read_csv('INPUT.csv', encoding = 'utf8')
df['polarity'] = 0.0
df['subjectivity'] = 0.0
for i in range(0, len(df.index)):
print(i)
blob = TextBlob(str(df['text'][i]))
df... | 29.9375 | 80 | 0.691023 | import pandas as pd
from textblob import TextBlob
pd.options.mode.chained_assignment = None
df = pd.read_csv('INPUT.csv', encoding = 'utf8')
df['polarity'] = 0.0
df['subjectivity'] = 0.0
for i in range(0, len(df.index)):
print(i)
blob = TextBlob(str(df['text'][i]))
df['subjectivity'][i] = blob.sentiment.... | true | true |
f72bdf31e9017fd309d269003029962f0606f6e1 | 22,621 | py | Python | client.py | iegorman/netspeed | 6eec201791b89be69ed9d6a6563d90cf324f2f14 | [
"BSD-2-Clause"
] | null | null | null | client.py | iegorman/netspeed | 6eec201791b89be69ed9d6a6563d90cf324f2f14 | [
"BSD-2-Clause"
] | null | null | null | client.py | iegorman/netspeed | 6eec201791b89be69ed9d6a6563d90cf324f2f14 | [
"BSD-2-Clause"
] | null | null | null | #!/usr/bin/python3
# Connmand line client for repeated internet speed tests.
import os
import sys
import collections
import gc
import getopt
import json
import math
import time
import traceback
import urllib.error
import urllib.request
import re
class Client(object):
"""
Python class and connmand line client ... | 41.582721 | 79 | 0.55895 |
import os
import sys
import collections
import gc
import getopt
import json
import math
import time
import traceback
import urllib.error
import urllib.request
import re
class Client(object):
defaultInterval = 3_600
initialDownloadLength = 20_000_000
initialUploadLength = 2_000_000 ... | true | true |
f72be1dc6f4fb1ba0ced9f2acbb93db31ef858b3 | 3,694 | py | Python | bin/specsim3d/spectralsim.py | LutzGross/fingal | 4b6fcc02871e7ba1a98f37ffd18f1a16a5fe6a48 | [
"Apache-2.0"
] | null | null | null | bin/specsim3d/spectralsim.py | LutzGross/fingal | 4b6fcc02871e7ba1a98f37ffd18f1a16a5fe6a48 | [
"Apache-2.0"
] | null | null | null | bin/specsim3d/spectralsim.py | LutzGross/fingal | 4b6fcc02871e7ba1a98f37ffd18f1a16a5fe6a48 | [
"Apache-2.0"
] | null | null | null | #-------------------------------------------------------------------------------
# Name: Spectralsim
# Purpose: Simulation of standard normal random fields
#
# Author: Dr.-Ing. S. Hoerning
#
# Created: 02.05.2018, Centre for Natural Gas, EAIT,
# The University of Quee... | 35.864078 | 84 | 0.538711 |
import numpy as np
from . import covariancefunction as covfun
class spectral_random_field(object):
def __init__(self,
domainsize = (100,100),
covmod = '1.0 Exp(2.)',
periodic = False,
):
self.counter = 0
... | true | true |
f72be352896b0f61ced55b6764db278e4593e15a | 387 | py | Python | sinoera/tst/solarterm/test_grainrain.py | sinotradition/sinoera | 1e93482c0a56a8917bc7ceebeef5b63b24ca3651 | [
"Apache-2.0"
] | 1 | 2015-12-14T15:14:35.000Z | 2015-12-14T15:14:35.000Z | sinoera/tst/solarterm/test_grainrain.py | sinotradition/sinoera | 1e93482c0a56a8917bc7ceebeef5b63b24ca3651 | [
"Apache-2.0"
] | null | null | null | sinoera/tst/solarterm/test_grainrain.py | sinotradition/sinoera | 1e93482c0a56a8917bc7ceebeef5b63b24ca3651 | [
"Apache-2.0"
] | null | null | null | #!/usr/bin/python
#coding=utf-8
'''This is test module
@author: sheng
@contact: sinotradition@gmail.com
@copyright: License according to the project license.
'''
import unittest
from sinoera.solarterm import grainrain
TestGrainrainFunctions(unittest.TestCase):
def setUp(self):
pass
def test_XXX(se... | 16.125 | 53 | 0.705426 |
'''This is test module
@author: sheng
@contact: sinotradition@gmail.com
@copyright: License according to the project license.
'''
import unittest
from sinoera.solarterm import grainrain
TestGrainrainFunctions(unittest.TestCase):
def setUp(self):
pass
def test_XXX(self):
pass
if __name_... | false | true |
f72be3f57c7c5d2eb4ce80ae2f2640c917c82222 | 1,598 | py | Python | salt/states/aptpkg.py | preoctopus/salt | aceaaa0e2f2f2ff29a694393bd82bba0d88fa44d | [
"Apache-2.0"
] | 3 | 2015-04-16T18:42:35.000Z | 2017-10-30T16:57:49.000Z | salt/states/aptpkg.py | preoctopus/salt | aceaaa0e2f2f2ff29a694393bd82bba0d88fa44d | [
"Apache-2.0"
] | 16 | 2015-11-18T00:44:03.000Z | 2018-10-29T20:48:27.000Z | salt/states/aptpkg.py | preoctopus/salt | aceaaa0e2f2f2ff29a694393bd82bba0d88fa44d | [
"Apache-2.0"
] | 4 | 2020-11-04T06:28:05.000Z | 2022-02-09T10:54:49.000Z | # -*- coding: utf-8 -*-
'''
Package management operations specific to APT- and DEB-based systems
====================================================================
'''
from __future__ import absolute_import
# Import python libs
import logging
# Import salt libs
import salt.utils
log = logging.getLogger(__name__)
... | 27.084746 | 76 | 0.560701 |
from __future__ import absolute_import
import logging
import salt.utils
log = logging.getLogger(__name__)
__virtualname__ = 'apt'
def __virtual__():
return (__virtualname__
if __salt__.get('pkg.get_selections', False)
else False)
def held(name):
ret = {'name': name, 'changes... | true | true |
f72be4c5cc1eeab06b7191f01eab65ac00eda171 | 605 | py | Python | lms_aaditya/ContactsModules/update_contacts.py | hcmuleva/personal-profile | 051b5a2f36b927951691f48abe584beb8bc25440 | [
"MIT"
] | null | null | null | lms_aaditya/ContactsModules/update_contacts.py | hcmuleva/personal-profile | 051b5a2f36b927951691f48abe584beb8bc25440 | [
"MIT"
] | 3 | 2020-07-13T17:46:32.000Z | 2020-07-26T10:30:59.000Z | lms_aaditya/ContactsModules/update_contacts.py | hcmuleva/personal-profile | 051b5a2f36b927951691f48abe584beb8bc25440 | [
"MIT"
] | null | null | null | from MongoConnect import ConnectModule
my_con = ConnectModule.connect()
collection = my_con.db["Contacts"]
class UpdateContact:
def __init__(self, reg_id, uname, uemail, uphone):
self.uname = uname
self.uemail = uemail
self.uphone = uphone
self.reg_id = reg_id
def update(self)... | 27.5 | 75 | 0.58843 | from MongoConnect import ConnectModule
my_con = ConnectModule.connect()
collection = my_con.db["Contacts"]
class UpdateContact:
def __init__(self, reg_id, uname, uemail, uphone):
self.uname = uname
self.uemail = uemail
self.uphone = uphone
self.reg_id = reg_id
def update(self)... | true | true |
f72be4cb8b14bc8a51522aeae3113d30c873f8c5 | 1,485 | py | Python | v1functions/timer-trigger-azuresearch-index-monitoring/function/run.py | anuragc617/azure-functions-python-samples | d39e3154a960bd10cd1be80eecf0c4a1d5ab2244 | [
"MIT"
] | 323 | 2017-01-31T03:25:33.000Z | 2022-03-30T06:06:31.000Z | v1functions/timer-trigger-azuresearch-index-monitoring/function/run.py | anuragc617/azure-functions-python-samples | d39e3154a960bd10cd1be80eecf0c4a1d5ab2244 | [
"MIT"
] | 41 | 2017-10-13T10:43:35.000Z | 2022-01-13T01:10:24.000Z | v1functions/timer-trigger-azuresearch-index-monitoring/function/run.py | anuragc617/azure-functions-python-samples | d39e3154a960bd10cd1be80eecf0c4a1d5ab2244 | [
"MIT"
] | 167 | 2017-01-31T03:25:44.000Z | 2022-03-15T16:54:54.000Z | # -*- coding: utf-8 -*-
"""
Azure Functions Timer Trigger Python Sample
- Get Azure Search Index Statistics and store them into DocumentDB
DocumentDB binding reference:
https://docs.microsoft.com/en-us/azure/azure-functions/functions-bindings-documentdb
"""
import sys, os, datetime, json
import httplib, urllib
AZ... | 30.306122 | 99 | 0.711785 |
"""
Azure Functions Timer Trigger Python Sample
- Get Azure Search Index Statistics and store them into DocumentDB
DocumentDB binding reference:
https://docs.microsoft.com/en-us/azure/azure-functions/functions-bindings-documentdb
"""
import sys, os, datetime, json
import httplib, urllib
AZURE_SEARCH_SERVICE_NAME... | false | true |
f72be53c78ed7ddbde3083e7ebead947d18b09a5 | 2,494 | py | Python | dayong/components/event_component.py | ooliver1/Dayong | 0923e0ff2a03157a51f7fae9c6056afd812c314c | [
"MIT"
] | 1 | 2021-11-04T13:20:31.000Z | 2021-11-04T13:20:31.000Z | dayong/components/event_component.py | ooliver1/Dayong | 0923e0ff2a03157a51f7fae9c6056afd812c314c | [
"MIT"
] | null | null | null | dayong/components/event_component.py | ooliver1/Dayong | 0923e0ff2a03157a51f7fae9c6056afd812c314c | [
"MIT"
] | null | null | null | """
dayong.components.event_component
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Organization of events and event listeners.
"""
from typing import Optional
import hikari
import tanjun
from dayong.configs import DayongConfig
component = tanjun.Component()
@component.with_listener(hikari.MemberCreateEvent)
async def greet_... | 30.048193 | 87 | 0.623897 | from typing import Optional
import hikari
import tanjun
from dayong.configs import DayongConfig
component = tanjun.Component()
@component.with_listener(hikari.MemberCreateEvent)
async def greet_new_member(
event: hikari.MemberCreateEvent,
config: DayongConfig = tanjun.injected(type=DayongConfig),
) -> None... | true | true |
f72be60e09156efc269b07d9431ebb692d7f5e1c | 683 | py | Python | src/test_SimulationState.py | pawel00100/Disease-Spread-Simulation | eff8b824a9205f61a4d70cd6c7613a9a786bd1eb | [
"MIT"
] | null | null | null | src/test_SimulationState.py | pawel00100/Disease-Spread-Simulation | eff8b824a9205f61a4d70cd6c7613a9a786bd1eb | [
"MIT"
] | null | null | null | src/test_SimulationState.py | pawel00100/Disease-Spread-Simulation | eff8b824a9205f61a4d70cd6c7613a9a786bd1eb | [
"MIT"
] | null | null | null | from unittest import TestCase
from Person import Person
from SimulationState import SimulationState, MapPosition
from src.Map import Map
class TestSimulationState(TestCase):
def test_find_neighbors(self):
map = Map(200, 200)
p0 = Person(MapPosition(0, 0, map), map)
p1 = Person(MapPositio... | 31.045455 | 103 | 0.676428 | from unittest import TestCase
from Person import Person
from SimulationState import SimulationState, MapPosition
from src.Map import Map
class TestSimulationState(TestCase):
def test_find_neighbors(self):
map = Map(200, 200)
p0 = Person(MapPosition(0, 0, map), map)
p1 = Person(MapPositio... | true | true |
f72be711d81d043cbb81c0c2790bd4ca458ffcbf | 3,130 | py | Python | tests/test_types.py | acarrasco/dacite | ece070cc3c25e86634086db8ee4f2e45bdfe6fe5 | [
"MIT"
] | null | null | null | tests/test_types.py | acarrasco/dacite | ece070cc3c25e86634086db8ee4f2e45bdfe6fe5 | [
"MIT"
] | 1 | 2019-03-20T17:30:34.000Z | 2019-03-20T17:30:34.000Z | tests/test_types.py | acarrasco/dacite | ece070cc3c25e86634086db8ee4f2e45bdfe6fe5 | [
"MIT"
] | null | null | null | from typing import Optional, Union, List, Any, Dict, NewType, TypeVar, Generic
import pytest
from dacite.types import (
is_optional,
extract_optional,
is_generic,
is_union,
is_generic_collection,
extract_origin_collection,
is_instance,
cast_value,
extract_generic,
is_new_type,
... | 22.517986 | 78 | 0.763259 | from typing import Optional, Union, List, Any, Dict, NewType, TypeVar, Generic
import pytest
from dacite.types import (
is_optional,
extract_optional,
is_generic,
is_union,
is_generic_collection,
extract_origin_collection,
is_instance,
cast_value,
extract_generic,
is_new_type,
... | true | true |
f72be79039a8d75fd79fb65024ecf80bebc4577e | 3,508 | py | Python | p40-49/p41.py | kbrose/project_euler | f582ef1887f44628997e05d88253adad0822d6b9 | [
"Unlicense"
] | 1 | 2015-10-11T15:53:00.000Z | 2015-10-11T15:53:00.000Z | p40-49/p41.py | kbrose/project_euler | f582ef1887f44628997e05d88253adad0822d6b9 | [
"Unlicense"
] | null | null | null | p40-49/p41.py | kbrose/project_euler | f582ef1887f44628997e05d88253adad0822d6b9 | [
"Unlicense"
] | null | null | null | from array import *
import itertools
def isprime(n):
for i in xrange(2,int(n**.5)+1):
if not (n % i):
return 0
return 1
digits = {0:'0',1:'1',2:'2',3:'3',4:'4',5:'5',6:'6',7:'7',8:'8',9:'9'}
# if the sum of the digits of a number n is divisible by three, then so is n
# due to this, only 1... | 34.732673 | 76 | 0.322406 | from array import *
import itertools
def isprime(n):
for i in xrange(2,int(n**.5)+1):
if not (n % i):
return 0
return 1
digits = {0:'0',1:'1',2:'2',3:'3',4:'4',5:'5',6:'6',7:'7',8:'8',9:'9'}
def FindPrimePan():
for a in xrange(7,0,-1):
num1 = digits[a]
digits[a] = 0... | false | true |
f72be79b665283eb1a3552b5a050e1fc7b15727e | 2,877 | py | Python | mms/context.py | andrewfayres/mxnet-model-server | ef4edfef4cfe5234887bf834ec7b82676a36ba02 | [
"Apache-2.0"
] | 1 | 2019-01-30T02:57:31.000Z | 2019-01-30T02:57:31.000Z | mms/context.py | DrSnowbird/mxnet-model-server | a0bfd712350545dceb21c8e0b0b21dfa0c9918a7 | [
"Apache-2.0"
] | null | null | null | mms/context.py | DrSnowbird/mxnet-model-server | a0bfd712350545dceb21c8e0b0b21dfa0c9918a7 | [
"Apache-2.0"
] | null | null | null | # Copyright 2018 Amazon.com, Inc. or its affiliates. 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.
# A copy of the License is located at
# http://www.apache.org/licenses/LICENSE-2.0
# or in the "license" file... | 31.271739 | 90 | 0.686827 |
class Context(object):
def __init__(self, model_name, model_dir, manifest, batch_size, gpu, mms_version):
self.model_name = model_name
self.manifest = manifest
self._system_properties = {
"model_dir": model_dir,
"gpu_id": gpu,
"batch_size": ba... | true | true |
f72be81e9dc0fedf810a47adb40ea90cbd01bd08 | 7,766 | py | Python | xos/core/dashboard/views/home.py | pan2za/xos | c2a4da2ccaa12360b2718be303b247866aefdfe6 | [
"Apache-2.0"
] | null | null | null | xos/core/dashboard/views/home.py | pan2za/xos | c2a4da2ccaa12360b2718be303b247866aefdfe6 | [
"Apache-2.0"
] | 5 | 2020-06-05T17:47:15.000Z | 2021-09-23T23:21:27.000Z | xos/core/dashboard/views/home.py | pan2za/xos | c2a4da2ccaa12360b2718be303b247866aefdfe6 | [
"Apache-2.0"
] | null | null | null | from view_common import *
from django.http import HttpResponseRedirect
import sys
def isInt(s):
try:
int(s)
return True
except ValueError:
return False
class LoggedInView(TemplateView):
def get(self, request, name="root", *args, **kwargs):
if request.user.login_page:
... | 37.882927 | 160 | 0.550992 | from view_common import *
from django.http import HttpResponseRedirect
import sys
def isInt(s):
try:
int(s)
return True
except ValueError:
return False
class LoggedInView(TemplateView):
def get(self, request, name="root", *args, **kwargs):
if request.user.login_page:
... | true | true |
f72be85a54f072db1fb3df347bed8b5574b5043c | 3,782 | py | Python | fn_task_utils/fn_task_utils/components/task_utils_close_task.py | nickpartner-goahead/resilient-community-apps | 097c0dbefddbd221b31149d82af9809420498134 | [
"MIT"
] | 65 | 2017-12-04T13:58:32.000Z | 2022-03-24T18:33:17.000Z | fn_task_utils/fn_task_utils/components/task_utils_close_task.py | nickpartner-goahead/resilient-community-apps | 097c0dbefddbd221b31149d82af9809420498134 | [
"MIT"
] | 48 | 2018-03-02T19:17:14.000Z | 2022-03-09T22:00:38.000Z | fn_task_utils/fn_task_utils/components/task_utils_close_task.py | nickpartner-goahead/resilient-community-apps | 097c0dbefddbd221b31149d82af9809420498134 | [
"MIT"
] | 95 | 2018-01-11T16:23:39.000Z | 2022-03-21T11:34:29.000Z | # -*- coding: utf-8 -*-
# Copyright © IBM Corporation 2010, 2019
# pragma pylint: disable=unused-argument, no-self-use
"""Function implementation"""
import logging
from resilient_circuits import ResilientComponent, function, handler, StatusMessage, FunctionResult, FunctionError
from resilient_lib import ResultPayload
... | 41.56044 | 119 | 0.608673 |
import logging
from resilient_circuits import ResilientComponent, function, handler, StatusMessage, FunctionResult, FunctionError
from resilient_lib import ResultPayload
from fn_task_utils.lib.task_common import find_task_by_name, get_function_input
class FunctionComponent(ResilientComponent):
def __init__(s... | true | true |
f72be963c795ad4620dda7b2f24b5d80e2f23382 | 8,139 | py | Python | tests/test_templates.py | eon01/wagtail-metadata | 583968b67157ac7944631966919b523674568141 | [
"BSD-3-Clause"
] | null | null | null | tests/test_templates.py | eon01/wagtail-metadata | 583968b67157ac7944631966919b523674568141 | [
"BSD-3-Clause"
] | null | null | null | tests/test_templates.py | eon01/wagtail-metadata | 583968b67157ac7944631966919b523674568141 | [
"BSD-3-Clause"
] | null | null | null | # -*- coding: utf-8 -*-
from django.forms.utils import flatatt
from django.template import TemplateSyntaxError, engines
from django.test import RequestFactory, TestCase, override_settings
from django.utils.html import format_html
from wagtail.core.models import Site
from wagtail.images.models import Image
from wagtai... | 34.341772 | 120 | 0.621207 |
from django.forms.utils import flatatt
from django.template import TemplateSyntaxError, engines
from django.test import RequestFactory, TestCase, override_settings
from django.utils.html import format_html
from wagtail.core.models import Site
from wagtail.images.models import Image
from wagtail.images.tests.utils im... | true | true |
f72bea5f4fd55e05a650df7818ae1a13dacf5f50 | 1,392 | py | Python | tests/z_value_test.py | daineal/Anomaly-Detection | 437b926c03b2975f87c9e182f47a84c71b4abdb0 | [
"MIT"
] | 1 | 2017-04-30T08:05:14.000Z | 2017-04-30T08:05:14.000Z | tests/z_value_test.py | daineal/BestProject | 437b926c03b2975f87c9e182f47a84c71b4abdb0 | [
"MIT"
] | null | null | null | tests/z_value_test.py | daineal/BestProject | 437b926c03b2975f87c9e182f47a84c71b4abdb0 | [
"MIT"
] | null | null | null | from unittest import TestCase
from apps.algorithms.mean import Mean
from apps.algorithms.standart_deviation import StandartDeviation
from apps.algorithms.z_value import ZValue
__author__ = 'cenk'
class ZValueTest(TestCase):
def setUp(self):
pass
def test_algorithm_with_list(self):
data_lis... | 35.692308 | 95 | 0.641523 | from unittest import TestCase
from apps.algorithms.mean import Mean
from apps.algorithms.standart_deviation import StandartDeviation
from apps.algorithms.z_value import ZValue
__author__ = 'cenk'
class ZValueTest(TestCase):
def setUp(self):
pass
def test_algorithm_with_list(self):
data_lis... | false | true |
f72beaa7ee8d91281059cff457c016f1e6f65cb3 | 3,651 | py | Python | bindings/python/ensmallen/datasets/string/candidatussericytochromatiabacteriums15bmn24raac196.py | AnacletoLAB/ensmallen_graph | b2c1b18fb1e5801712852bcc239f239e03076f09 | [
"MIT"
] | 5 | 2021-02-17T00:44:45.000Z | 2021-08-09T16:41:47.000Z | bindings/python/ensmallen/datasets/string/candidatussericytochromatiabacteriums15bmn24raac196.py | AnacletoLAB/ensmallen_graph | b2c1b18fb1e5801712852bcc239f239e03076f09 | [
"MIT"
] | 18 | 2021-01-07T16:47:39.000Z | 2021-08-12T21:51:32.000Z | bindings/python/ensmallen/datasets/string/candidatussericytochromatiabacteriums15bmn24raac196.py | AnacletoLAB/ensmallen | b2c1b18fb1e5801712852bcc239f239e03076f09 | [
"MIT"
] | 3 | 2021-01-14T02:20:59.000Z | 2021-08-04T19:09:52.000Z | """
This file offers the methods to automatically retrieve the graph Candidatus Sericytochromatia bacterium S15B-MN24 RAAC_196.
The graph is automatically retrieved from the STRING repository.
References
---------------------
Please cite the following if you use the data:
```bib
@article{szklarczyk2019string,
... | 34.771429 | 223 | 0.690222 | from typing import Dict
from ..automatic_graph_retrieval import AutomaticallyRetrievedGraph
from ...ensmallen import Graph
def CandidatusSericytochromatiaBacteriumS15bMn24Raac196(
directed: bool = False,
preprocess: bool = True,
load_nodes: bool = True,
verbose: int = 2,
cache: bool = True,
... | true | true |
f72beafa6216e6ee1923e3c7055a37cbcdd6d963 | 2,305 | py | Python | oop-intro/Game.py | emptyspace42/mycode | 834c0a2817ffffa92b90ec3bd05ef41cb73a8879 | [
"MIT"
] | 5 | 2018-05-21T18:16:13.000Z | 2018-05-22T22:41:40.000Z | oop-intro/Game.py | cazzara/mycode | 834c0a2817ffffa92b90ec3bd05ef41cb73a8879 | [
"MIT"
] | null | null | null | oop-intro/Game.py | cazzara/mycode | 834c0a2817ffffa92b90ec3bd05ef41cb73a8879 | [
"MIT"
] | null | null | null | from Player import Player
from time import sleep
from Cheater import Cheater_Loaded, Cheater_Swapper
from random import random
class Game:
def __init__(self):
self.main()
def make_player(self):
p = None
name = input("Enter your name: ")
cheat = input("Are you a cheater? (y/n)")... | 32.013889 | 98 | 0.527549 | from Player import Player
from time import sleep
from Cheater import Cheater_Loaded, Cheater_Swapper
from random import random
class Game:
def __init__(self):
self.main()
def make_player(self):
p = None
name = input("Enter your name: ")
cheat = input("Are you a cheater? (y/n)")... | true | true |
f72bebf85db3d4c69b7d19ce58388cebfef5832f | 80 | py | Python | brian2/sphinxext/__init__.py | SimonAltrogge/brian2 | 6463c368a8277041051bf5ae4816f0dd5b6e057c | [
"BSD-2-Clause"
] | 674 | 2015-01-14T11:05:39.000Z | 2022-03-29T04:53:50.000Z | brian2/sphinxext/__init__.py | JongwanKim2090/brian2 | c212a57cb992b766786b5769ebb830ff12d8a8ad | [
"BSD-2-Clause"
] | 937 | 2015-01-05T13:24:22.000Z | 2022-03-25T13:10:13.000Z | brian2/sphinxext/__init__.py | JongwanKim2090/brian2 | c212a57cb992b766786b5769ebb830ff12d8a8ad | [
"BSD-2-Clause"
] | 237 | 2015-01-05T13:54:16.000Z | 2022-03-15T22:16:32.000Z | """
Brian-specific extension to the Sphinx documentation generation system.
"""
| 20 | 71 | 0.775 | true | true | |
f72bec6eb6fe20587d73322d3bca2f73d06296e7 | 24,462 | py | Python | XET.py | mezutelni/twrp-installer-xiaomi | 62ac87f316c70089e7188fa7b7f21d234c3643cd | [
"MIT"
] | 4 | 2017-10-09T20:23:56.000Z | 2019-06-27T03:59:26.000Z | XET.py | mezutelni/twrp-installer-xiaomi | 62ac87f316c70089e7188fa7b7f21d234c3643cd | [
"MIT"
] | 1 | 2017-12-01T19:12:44.000Z | 2018-01-06T14:42:47.000Z | XET.py | mezutelni/twrp-installer-xiaomi | 62ac87f316c70089e7188fa7b7f21d234c3643cd | [
"MIT"
] | null | null | null | #!/usr/bin/python3
import os
import sys
import time
import urllib.request
import hashlib
try:
from colorama import Fore, Back, Style, init
except ModuleNotFoundError:
print ("You have no colorama installed, i will install it for you")
print
path = sys.executable
#path = path[:-11]
path = path.r... | 39.518578 | 149 | 0.539245 |
import os
import sys
import time
import urllib.request
import hashlib
try:
from colorama import Fore, Back, Style, init
except ModuleNotFoundError:
print ("You have no colorama installed, i will install it for you")
print
path = sys.executable
path = path.replace("python.exe","")
os.syste... | true | true |
f72becd780ca4f371e5aa799094ea59aac89e645 | 27,367 | py | Python | ietf/liaisons/forms.py | hassanakbar4/ietfdb | cabee059092ae776015410640226064331c293b7 | [
"BSD-3-Clause"
] | 2 | 2022-03-12T04:37:08.000Z | 2022-03-13T00:48:39.000Z | ietf/liaisons/forms.py | hassanakbar4/ietfdb | cabee059092ae776015410640226064331c293b7 | [
"BSD-3-Clause"
] | 39 | 2021-05-31T21:10:14.000Z | 2022-03-07T16:07:14.000Z | ietf/liaisons/forms.py | hassanakbar4/ietfdb | cabee059092ae776015410640226064331c293b7 | [
"BSD-3-Clause"
] | 2 | 2021-10-05T12:48:20.000Z | 2021-11-08T11:38:35.000Z | # Copyright The IETF Trust 2011-2020, All Rights Reserved
# -*- coding: utf-8 -*-
import io
import datetime, os
import operator
from typing import Union # pyflakes:ignore
from email.utils import parseaddr
from form_utils.forms import BetterModelForm
from django import forms
from django.conf import setti... | 47.512153 | 176 | 0.637227 |
import io
import datetime, os
import operator
from typing import Union
from email.utils import parseaddr
from form_utils.forms import BetterModelForm
from django import forms
from django.conf import settings
from django.core.exceptions import ObjectDoesNotExist, ValidationError
from django.db.models.... | true | true |
f72bedbab95f862cc621615212d09c74118e2e36 | 18,978 | py | Python | benchexec/tools/ultimate.py | mikhailramalho/benchexec | 5fc5180c26e0fa18e137b142c5890a3dd7cab795 | [
"Apache-2.0"
] | null | null | null | benchexec/tools/ultimate.py | mikhailramalho/benchexec | 5fc5180c26e0fa18e137b142c5890a3dd7cab795 | [
"Apache-2.0"
] | null | null | null | benchexec/tools/ultimate.py | mikhailramalho/benchexec | 5fc5180c26e0fa18e137b142c5890a3dd7cab795 | [
"Apache-2.0"
] | null | null | null | """
BenchExec is a framework for reliable benchmarking.
This file is part of BenchExec.
Copyright (C) 2015 Daniel Dietsch
All rights reserved.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
... | 37.431953 | 101 | 0.566077 |
import functools
import logging
import os
import re
import subprocess
import sys
import benchexec.result as result
import benchexec.tools.template
import benchexec.util as util
from benchexec import BenchExecException
from benchexec.model import MEMLIMIT
from benchexec.tools.template import UnsupportedFeatureExceptio... | true | true |
f72beded7ef5a032d409d3786dee6fcc951198a6 | 18,914 | py | Python | site-packages/neutronclient/osc/v2/fwaas/firewallrule.py | hariza17/freezer_libraries | e0bd890eba5e7438976fb3b4d66c41c128bab790 | [
"PSF-2.0"
] | null | null | null | site-packages/neutronclient/osc/v2/fwaas/firewallrule.py | hariza17/freezer_libraries | e0bd890eba5e7438976fb3b4d66c41c128bab790 | [
"PSF-2.0"
] | null | null | null | site-packages/neutronclient/osc/v2/fwaas/firewallrule.py | hariza17/freezer_libraries | e0bd890eba5e7438976fb3b4d66c41c128bab790 | [
"PSF-2.0"
] | null | null | null | # Copyright 2016-2017 FUJITSU LIMITED
# All Rights Reserved
#
# Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance with the License. You may obtain
# a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless requi... | 39.987315 | 79 | 0.635297 |
import copy
import logging
from cliff import columns as cliff_columns
from osc_lib.command import command
from osc_lib import exceptions
from osc_lib import utils
from osc_lib.utils import columns as column_util
from neutronclient._i18n import _
from neutronclient.common import utils as nc_utils
from n... | true | true |
f72bee82c057e8b1b9e1dcbe3c8f34b55a9c0a95 | 3,518 | py | Python | django_libs/test_email_backend.py | Reston/django-libs | 8c44a0851e3be564a100df50d257c1ce5b30dc25 | [
"MIT"
] | null | null | null | django_libs/test_email_backend.py | Reston/django-libs | 8c44a0851e3be564a100df50d257c1ce5b30dc25 | [
"MIT"
] | null | null | null | django_libs/test_email_backend.py | Reston/django-libs | 8c44a0851e3be564a100df50d257c1ce5b30dc25 | [
"MIT"
] | 1 | 2020-01-09T10:23:13.000Z | 2020-01-09T10:23:13.000Z | """Custom email backend for testing the project."""
import re
from django.core.mail.backends.smtp import EmailBackend as SmtpEmailBackend
from django.core.mail.message import sanitize_address
from . import default_settings as settings
class EmailBackend(SmtpEmailBackend):
"""
Email backend that sends all em... | 34.490196 | 79 | 0.645253 | import re
from django.core.mail.backends.smtp import EmailBackend as SmtpEmailBackend
from django.core.mail.message import sanitize_address
from . import default_settings as settings
class EmailBackend(SmtpEmailBackend):
def _send(self, email_message):
if not email_message.recipients() or \
... | true | true |
f72beeeefd11624a2d91beb7c8d8ca61bb669461 | 14,901 | py | Python | py/redrock/templates.py | echaussidon/redrock | 9a3d4f0aed8c0792f2cc731dbdf04a99018083bf | [
"BSD-3-Clause"
] | 14 | 2017-09-22T23:57:33.000Z | 2022-03-15T10:36:16.000Z | py/redrock/templates.py | echaussidon/redrock | 9a3d4f0aed8c0792f2cc731dbdf04a99018083bf | [
"BSD-3-Clause"
] | 154 | 2017-06-04T22:57:39.000Z | 2022-03-11T23:01:16.000Z | py/redrock/templates.py | echaussidon/redrock | 9a3d4f0aed8c0792f2cc731dbdf04a99018083bf | [
"BSD-3-Clause"
] | 10 | 2017-06-09T15:24:59.000Z | 2021-05-26T13:16:42.000Z | """
Classes and functions for templates.
"""
from __future__ import absolute_import, division, print_function
import sys
from glob import glob
import os
import traceback
import numpy as np
from astropy.io import fits
from .utils import native_endian, elapsed, transmission_Lyman
from .rebin import rebin_template, t... | 32.253247 | 97 | 0.587075 |
from __future__ import absolute_import, division, print_function
import sys
from glob import glob
import os
import traceback
import numpy as np
from astropy.io import fits
from .utils import native_endian, elapsed, transmission_Lyman
from .rebin import rebin_template, trapz_rebin
class Template(object):
def ... | true | true |
f72bf05616bf34cf98330d2cbaf1008bb162279a | 1,420 | py | Python | redbot/message/headers/x_cache.py | thinkbox/redbot | 90744dd971389bbf435d200483309b70b748785a | [
"Unlicense"
] | 1 | 2019-06-27T13:02:52.000Z | 2019-06-27T13:02:52.000Z | redbot/message/headers/x_cache.py | thinkbox/redbot | 90744dd971389bbf435d200483309b70b748785a | [
"Unlicense"
] | null | null | null | redbot/message/headers/x_cache.py | thinkbox/redbot | 90744dd971389bbf435d200483309b70b748785a | [
"Unlicense"
] | null | null | null | #!/usr/bin/env python
__author__ = "Mark Nottingham <mnot@mnot.net>"
__copyright__ = """\
Copyright (c) 2008-2013 Mark Nottingham
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 restricti... | 37.368421 | 77 | 0.783803 |
__author__ = "Mark Nottingham <mnot@mnot.net>"
__copyright__ = """\
Copyright (c) 2008-2013 Mark Nottingham
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... | true | true |
f72bf18fa11ed33b50a81cfc1f4e0efdcb4066ad | 8,001 | py | Python | Source/FetchData/Fetch_Data_Stock_CHN_Daily.py | guissy/StockRecommendSystem | 2e8694d0bb2ceaa42585ee7414564d921cc5a854 | [
"MIT"
] | null | null | null | Source/FetchData/Fetch_Data_Stock_CHN_Daily.py | guissy/StockRecommendSystem | 2e8694d0bb2ceaa42585ee7414564d921cc5a854 | [
"MIT"
] | null | null | null | Source/FetchData/Fetch_Data_Stock_CHN_Daily.py | guissy/StockRecommendSystem | 2e8694d0bb2ceaa42585ee7414564d921cc5a854 | [
"MIT"
] | null | null | null | import sys, os, time, datetime, warnings, configparser
import pandas as pd
import numpy as np
import tushare as ts
import concurrent.futures
from tqdm import tqdm
cur_path = os.path.dirname(os.path.abspath(__file__))
for _ in range(2):
root_path = cur_path[0:cur_path.rfind('/', 0, len(cur_path))]
cur_path = ro... | 38.282297 | 155 | 0.632921 | import sys, os, time, datetime, warnings, configparser
import pandas as pd
import numpy as np
import tushare as ts
import concurrent.futures
from tqdm import tqdm
cur_path = os.path.dirname(os.path.abspath(__file__))
for _ in range(2):
root_path = cur_path[0:cur_path.rfind('/', 0, len(cur_path))]
cur_path = ro... | true | true |
f72bf3adc21681236ec82aae83471ffedf35ef9b | 817 | py | Python | src/10-async-web/acityscape_api/app.py | NissesSenap/async-techniques-python-course | 455c7222b52e7c3aa7f4eb4b03e9b6f0a99adaef | [
"MIT"
] | 380 | 2018-09-26T17:40:52.000Z | 2022-03-29T02:38:17.000Z | src/10-async-web/acityscape_api/app.py | NissesSenap/async-techniques-python-course | 455c7222b52e7c3aa7f4eb4b03e9b6f0a99adaef | [
"MIT"
] | 13 | 2018-09-30T05:55:40.000Z | 2022-01-24T20:40:09.000Z | src/10-async-web/acityscape_api/app.py | NissesSenap/async-techniques-python-course | 455c7222b52e7c3aa7f4eb4b03e9b6f0a99adaef | [
"MIT"
] | 214 | 2018-09-26T18:53:17.000Z | 2021-12-30T16:58:27.000Z | import quart
from views import city_api
from views import home
from config import settings
import services.weather_service
import services.sun_service
import services.location_service
app = quart.Quart(__name__)
is_debug = True
app.register_blueprint(home.blueprint)
app.register_blueprint(city_api.blueprint)
def co... | 23.342857 | 75 | 0.767442 | import quart
from views import city_api
from views import home
from config import settings
import services.weather_service
import services.sun_service
import services.location_service
app = quart.Quart(__name__)
is_debug = True
app.register_blueprint(home.blueprint)
app.register_blueprint(city_api.blueprint)
def co... | true | true |
f72bf4d9ad27aa607870ea1c9ce5ee5bb7ccd384 | 1,009 | py | Python | plaid_project/contrib/sites/migrations/0003_set_site_domain_and_name.py | reetikaSR/PlaidProject | 904bd7fd3412a4b5149aae899abcf8794bebba81 | [
"MIT"
] | null | null | null | plaid_project/contrib/sites/migrations/0003_set_site_domain_and_name.py | reetikaSR/PlaidProject | 904bd7fd3412a4b5149aae899abcf8794bebba81 | [
"MIT"
] | null | null | null | plaid_project/contrib/sites/migrations/0003_set_site_domain_and_name.py | reetikaSR/PlaidProject | 904bd7fd3412a4b5149aae899abcf8794bebba81 | [
"MIT"
] | null | null | null | """
To understand why this file is here, please read:
http://cookiecutter-django.readthedocs.io/en/latest/faq.html#why-is-there-a-django-contrib-sites-directory-in-cookiecutter-django
"""
from django.conf import settings
from django.db import migrations
def update_site_forward(apps, schema_editor):
"""Set site d... | 28.828571 | 129 | 0.684836 | from django.conf import settings
from django.db import migrations
def update_site_forward(apps, schema_editor):
Site = apps.get_model("sites", "Site")
Site.objects.update_or_create(
id=settings.SITE_ID,
defaults={
"domain": "127.0.0.1",
"name": "plaid_project",
... | true | true |
f72bf52ed5ae857e2f0a8b16ca7cacfc142bfbdb | 3,895 | py | Python | utils.py | ambareeshravi/TrafficSignClassifier_API | 8628057439ee70f6d827abf931071e9b6539bd5b | [
"MIT"
] | null | null | null | utils.py | ambareeshravi/TrafficSignClassifier_API | 8628057439ee70f6d827abf931071e9b6539bd5b | [
"MIT"
] | null | null | null | utils.py | ambareeshravi/TrafficSignClassifier_API | 8628057439ee70f6d827abf931071e9b6539bd5b | [
"MIT"
] | null | null | null | '''
Author: Ambareesh Ravi
Date: Jul 31, 2021
Title: utils.py
Description:
Contains utility and helper functions for the project
'''
# Libraries imports
import numpy as np
import pandas as pd
import os
from tqdm import tqdm
from time import time
from glob import glob
from PIL import Image
import matplotlib.pyplot ... | 22.911765 | 115 | 0.558408 |
import numpy as np
import pandas as pd
import os
from tqdm import tqdm
from time import time
from glob import glob
from PIL import Image
import matplotlib.pyplot as plt
import argparse
import cv2
MANUAL_SEED = 42
np.random.seed(42)
def INFO(s):
print("-"*40)
print("INFO:", s)
print("-"*40)
def read_di... | true | true |
f72bf7299d2697d596b1a5964fe20792a37b1d6a | 14,540 | py | Python | fortiosapi/fortiosapi.py | javcasalc/fortiosapi | 5dd35b59cfa8b87aee2a10f2303595c3da2347df | [
"Apache-2.0"
] | null | null | null | fortiosapi/fortiosapi.py | javcasalc/fortiosapi | 5dd35b59cfa8b87aee2a10f2303595c3da2347df | [
"Apache-2.0"
] | null | null | null | fortiosapi/fortiosapi.py | javcasalc/fortiosapi | 5dd35b59cfa8b87aee2a10f2303595c3da2347df | [
"Apache-2.0"
] | null | null | null | #!/usr/bin/env python
# Copyright 2015 Fortinet, Inc.
#
# All Rights Reserved
#
# Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance with the License. You may obtain
# a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless require... | 39.297297 | 82 | 0.588308 |
session.headers)
return url
def mon_url(self, path, name, vdom=None, mkey=None):
url_postfix = '/api/v2/monitor/' + path + '/' + name
if mkey:
url_postfix = url_postfix + '/' + str(mkey)
if vdom:
LOG.debug("vdom is: %s", vdom)
... | true | true |
f72bf76df8d11eb6f121b20434afa79afc78b832 | 5,472 | py | Python | tests/deep_eq.py | textioHQ/PynamoDB | cc00ff616d1ff04793af2a43a68cef7611de4e85 | [
"MIT"
] | 1,586 | 2017-04-11T13:09:30.000Z | 2022-03-30T01:38:48.000Z | tests/deep_eq.py | textioHQ/PynamoDB | cc00ff616d1ff04793af2a43a68cef7611de4e85 | [
"MIT"
] | 606 | 2017-04-11T12:53:27.000Z | 2022-03-29T12:12:51.000Z | tests/deep_eq.py | textioHQ/textio-pynamodb | cc00ff616d1ff04793af2a43a68cef7611de4e85 | [
"MIT"
] | 366 | 2017-05-04T19:36:31.000Z | 2022-03-20T14:05:53.000Z | # Copyright (c) 2010-2013 Samuel Sutch [samuel.sutch@gmail.com]
#
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the "Software"), to deal
# in the Software without restriction, including without limitation the rights
# to use, copy, ... | 38.535211 | 82 | 0.561586 |
import datetime, time, functools, operator
default_fudge = datetime.timedelta(seconds=0, microseconds=0, days=0)
def deep_eq(_v1, _v2, datetime_fudge=default_fudge, _assert=False):
_deep_eq = functools.partial(deep_eq, datetime_fudge=datetime_fudge,
_assert=_a... | true | true |
f72bf78a0312644a15cd73be8689aef834f595d3 | 437 | py | Python | exe077 - COntando vogais em Tupla.py | carlosbandelli/Exercicios_em_Python | 2cd5bd837fdc51932f9605db32366ad0e3871d87 | [
"MIT"
] | null | null | null | exe077 - COntando vogais em Tupla.py | carlosbandelli/Exercicios_em_Python | 2cd5bd837fdc51932f9605db32366ad0e3871d87 | [
"MIT"
] | null | null | null | exe077 - COntando vogais em Tupla.py | carlosbandelli/Exercicios_em_Python | 2cd5bd837fdc51932f9605db32366ad0e3871d87 | [
"MIT"
] | null | null | null | palavras = ('aprender', 'programar', 'Linguagem', 'python',
'cruso', 'gratis', 'estudar', 'praticar',
'trabalhar', 'mercado', 'programador', 'futuro')
for p in palavras: # para cada palavra dentro do array de palavra
print(f'\nNa palavra {p.upper()} temos', end='')
for letra in p: # para... | 54.625 | 72 | 0.606407 | palavras = ('aprender', 'programar', 'Linguagem', 'python',
'cruso', 'gratis', 'estudar', 'praticar',
'trabalhar', 'mercado', 'programador', 'futuro')
for p in palavras:
print(f'\nNa palavra {p.upper()} temos', end='')
for letra in p:
if letra.lower() in 'aeiou':
pr... | true | true |
f72bf78b887dc5d6cf67f9a36e0f156cb0c5c2ab | 4,851 | py | Python | profiles_api/views.py | rawaihtun/profiles-rest-api | 2a810cfcf41b3fbf336956a30805492b8249d36e | [
"MIT"
] | null | null | null | profiles_api/views.py | rawaihtun/profiles-rest-api | 2a810cfcf41b3fbf336956a30805492b8249d36e | [
"MIT"
] | 4 | 2021-03-19T12:01:37.000Z | 2022-02-10T09:30:39.000Z | profiles_api/views.py | rawaihtun/profiles-rest-api | 2a810cfcf41b3fbf336956a30805492b8249d36e | [
"MIT"
] | null | null | null | from rest_framework.views import APIView
from rest_framework.response import Response
from rest_framework import status
from rest_framework import viewsets
from rest_framework.authentication import TokenAuthentication
from rest_framework import filters
from rest_framework.authtoken.views import ObtainAuthToken
from res... | 32.777027 | 84 | 0.669553 | from rest_framework.views import APIView
from rest_framework.response import Response
from rest_framework import status
from rest_framework import viewsets
from rest_framework.authentication import TokenAuthentication
from rest_framework import filters
from rest_framework.authtoken.views import ObtainAuthToken
from res... | true | true |
f72bf7f75d268ffc1761eda7cbca14afc9a54931 | 9,513 | py | Python | tests/test_v2.py | dajiaji/pyseto | 6e3f1259bd1a1671cccd75cb557bb63182f9e01a | [
"MIT"
] | 25 | 2021-09-06T08:53:45.000Z | 2022-02-19T20:17:23.000Z | tests/test_v2.py | dajiaji/pyseto | 6e3f1259bd1a1671cccd75cb557bb63182f9e01a | [
"MIT"
] | 124 | 2021-09-05T05:44:05.000Z | 2022-03-27T05:57:25.000Z | tests/test_v2.py | dajiaji/pyseto | 6e3f1259bd1a1671cccd75cb557bb63182f9e01a | [
"MIT"
] | 3 | 2021-09-11T02:37:09.000Z | 2022-01-06T10:49:14.000Z | from secrets import token_bytes
import pytest
import pyseto
from pyseto import DecryptError, EncryptError, Key, VerifyError
from pyseto.versions.v2 import V2Local, V2Public
from .utils import get_path, load_key
class TestV2Local:
"""
Tests for v2.local.
"""
@pytest.mark.parametrize(
"key, ... | 38.358871 | 89 | 0.599495 | from secrets import token_bytes
import pytest
import pyseto
from pyseto import DecryptError, EncryptError, Key, VerifyError
from pyseto.versions.v2 import V2Local, V2Public
from .utils import get_path, load_key
class TestV2Local:
@pytest.mark.parametrize(
"key, msg",
[
(b"", "key m... | true | true |
f72bfa63f1e88f5fb0116c005cf7d58d6612502d | 1,487 | py | Python | import_pictures.py | RikEnde/image-indexer | ffade3d618bb8a59d3cca676e46576d05d2bc122 | [
"Apache-2.0"
] | 2 | 2015-08-05T12:19:49.000Z | 2015-12-17T09:27:16.000Z | import_pictures.py | RikEnde/image-indexer | ffade3d618bb8a59d3cca676e46576d05d2bc122 | [
"Apache-2.0"
] | null | null | null | import_pictures.py | RikEnde/image-indexer | ffade3d618bb8a59d3cca676e46576d05d2bc122 | [
"Apache-2.0"
] | null | null | null | #!/usr/bin/env python
"""
Generate a document containing exif and file stat info of image files and persist this document
Usage:
media_indexer.py --path=/root [-v | --verbose=true] [-u | --upsert=true] [-d | --debug=true] [-h | --hashing=true]
-v, --verbose if true, print to stdout what file the indexer... | 38.128205 | 118 | 0.67115 |
"""
Generate a document containing exif and file stat info of image files and persist this document
Usage:
media_indexer.py --path=/root [-v | --verbose=true] [-u | --upsert=true] [-d | --debug=true] [-h | --hashing=true]
-v, --verbose if true, print to stdout what file the indexer is currently working... | false | true |
f72bfa6d085487f6f133c3d61b0833f55d54597a | 136 | py | Python | oandapy/entities/positions.py | gustavooferreira/oandaApi | 3c22c088e090e726cccebd201efb4254503246a0 | [
"MIT"
] | 4 | 2016-07-17T15:39:50.000Z | 2016-10-06T23:41:28.000Z | oandapy/entities/positions.py | gustavooferreira/oandaApi | 3c22c088e090e726cccebd201efb4254503246a0 | [
"MIT"
] | 1 | 2018-12-09T21:20:57.000Z | 2018-12-09T21:20:57.000Z | oandapy/entities/positions.py | gustavooferreira/oandaApi | 3c22c088e090e726cccebd201efb4254503246a0 | [
"MIT"
] | 1 | 2018-12-06T18:39:36.000Z | 2018-12-06T18:39:36.000Z | # -*- coding: utf-8 -*-
# vim:fenc=utf-8
"""
Entities for Positions
"""
def main():
pass
if __name__ == '__main__':
main()
| 9.066667 | 26 | 0.544118 |
def main():
pass
if __name__ == '__main__':
main()
| true | true |
f72bfdbd824f7c5caeb25c8512edc95565455d2e | 13,091 | py | Python | naucse/views.py | befeleme/naucse.python.cz | dee2c8cce8db90108b01b40c0981053943352d11 | [
"MIT"
] | 4 | 2019-02-14T08:02:41.000Z | 2020-10-20T10:35:55.000Z | naucse/views.py | befeleme/naucse.python.cz | dee2c8cce8db90108b01b40c0981053943352d11 | [
"MIT"
] | 71 | 2018-08-26T22:31:39.000Z | 2022-01-20T10:29:23.000Z | naucse/views.py | befeleme/naucse.python.cz | dee2c8cce8db90108b01b40c0981053943352d11 | [
"MIT"
] | 40 | 2018-08-22T14:44:59.000Z | 2021-09-20T16:11:27.000Z | import datetime
from pathlib import Path
import functools
import calendar
import os
from flask import Flask, render_template, jsonify, url_for, Response, abort, g, redirect
from flask import send_from_directory
import ics
from arca import Arca
from naucse import models
from naucse.urlconverters import register_url_co... | 30.730047 | 88 | 0.625544 | import datetime
from pathlib import Path
import functools
import calendar
import os
from flask import Flask, render_template, jsonify, url_for, Response, abort, g, redirect
from flask import send_from_directory
import ics
from arca import Arca
from naucse import models
from naucse.urlconverters import register_url_co... | true | true |
f72bfe29fee50157b229530a1755cc94f9b37546 | 23,048 | py | Python | lib/keystore.py | GetAywa/electrum-aywa | 07a548bd14cdf563da49c1f1e52644b833ca972e | [
"MIT"
] | null | null | null | lib/keystore.py | GetAywa/electrum-aywa | 07a548bd14cdf563da49c1f1e52644b833ca972e | [
"MIT"
] | null | null | null | lib/keystore.py | GetAywa/electrum-aywa | 07a548bd14cdf563da49c1f1e52644b833ca972e | [
"MIT"
] | null | null | null | #!/usr/bin/env python2
# -*- mode: python -*-
#
# Electrum - lightweight Bitcoin client
# Copyright (C) 2016 The Electrum developers
#
# 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... | 30.730667 | 95 | 0.63025 |
from unicodedata import normalize
from . import bitcoin
from .bitcoin import *
from .util import PrintError, InvalidPassword, hfu
from .mnemonic import Mnemonic, load_wordlist
from .plugins import run_hook
class KeyStore(PrintError):
def has_seed(self):
return False
def i... | true | true |
f72bffcf3e618c50ae473c4085888ea423e1b4c8 | 6,863 | py | Python | tests/system_tests_console.py | kishorkunal-raj/qpid-dispatch | f629b448dc1ae92d46c31f3c8d7bf317412b9e22 | [
"Apache-2.0"
] | 1 | 2019-07-16T10:24:40.000Z | 2019-07-16T10:24:40.000Z | tests/system_tests_console.py | kishorkunal-raj/qpid-dispatch | f629b448dc1ae92d46c31f3c8d7bf317412b9e22 | [
"Apache-2.0"
] | 121 | 2020-09-16T06:03:53.000Z | 2022-03-30T13:03:23.000Z | tests/system_tests_console.py | irinabov/debian-qpid-dispatch | 42fb2ffb65f8e8c8d616633c0b4308d6531a281d | [
"Apache-2.0"
] | null | null | null | #
# Licensed to the Apache Software Foundation (ASF) under one
# or more contributor license agreements. See the NOTICE file
# distributed with this work for additional information
# regarding copyright ownership. The ASF licenses this file
# to you under the Apache License, Version 2.0 (the
# "License"); you may not... | 32.837321 | 91 | 0.635582 |
from __future__ import unicode_literals
from __future__ import division
from __future__ import absolute_import
from __future__ import print_function
import os
import errno
import re
import time
import unittest
from subprocess import PIPE
import subprocess
from system_test import main_module, SkipIfN... | true | true |
f72bfffe1663a5030918dbba8147d3457fb5b2fd | 3,095 | py | Python | examples/basic_2.py | yoavfreund/DAPPER | c2fa5cc446a2b22a1efc174afc7e091363c9375d | [
"MIT"
] | null | null | null | examples/basic_2.py | yoavfreund/DAPPER | c2fa5cc446a2b22a1efc174afc7e091363c9375d | [
"MIT"
] | null | null | null | examples/basic_2.py | yoavfreund/DAPPER | c2fa5cc446a2b22a1efc174afc7e091363c9375d | [
"MIT"
] | null | null | null | # ## Illustrate usage of DAPPER to benchmark multiple DA methods.
# #### Imports
# <b>NB:</b> If you're on <mark><b>Gooble Colab</b></mark>,
# then replace `%matplotlib notebook` below by
# `!python -m pip install git+https://github.com/nansencenter/DAPPER.git` .
# Also note that liveplotting does not work on Colab.
... | 38.6875 | 80 | 0.51567 | ork on Colab.
# %matplotlib notebook
import dapper as dpr
import dapper.da_methods as da
# #### DA method configurations
from dapper.mods.Lorenz63.sakov2012 import HMM # Expected rmse.a:
xps = dpr.xpList()
xps += da.Climatology() # 7.6
xps += da.OptInterp() ... | true | true |
f72c023c3e475c0e66d6e44d0f104ade3ca2bea0 | 7,867 | py | Python | accelbyte_py_sdk/api/ugc/operations/public_group/get_group.py | AccelByte/accelbyte-python-sdk | dcd311fad111c59da828278975340fb92e0f26f7 | [
"MIT"
] | null | null | null | accelbyte_py_sdk/api/ugc/operations/public_group/get_group.py | AccelByte/accelbyte-python-sdk | dcd311fad111c59da828278975340fb92e0f26f7 | [
"MIT"
] | 1 | 2021-10-13T03:46:58.000Z | 2021-10-13T03:46:58.000Z | accelbyte_py_sdk/api/ugc/operations/public_group/get_group.py | AccelByte/accelbyte-python-sdk | dcd311fad111c59da828278975340fb92e0f26f7 | [
"MIT"
] | null | null | null | # Copyright (c) 2021 AccelByte Inc. All Rights Reserved.
# This is licensed software from AccelByte Inc, for limitations
# and restrictions contact your company contract manager.
#
# Code generated. DO NOT EDIT!
# template file: justice_py_sdk_codegen/__main__.py
# pylint: disable=duplicate-code
# pylint: disable=li... | 29.575188 | 164 | 0.616245 |
from __future__ import annotations
from typing import Any, Dict, List, Optional, Tuple, Union
from .....core import Operation
from .....core import HeaderStr
from .....core import HttpResponse
from ...models import ModelsCreateGroupResponse
from ...models import ResponseError
class GetGroup(... | true | true |
f72c036616f99189d65b39be5f6f951c9fd19357 | 30,886 | py | Python | tensorflow/contrib/learn/python/learn/estimators/dnn.py | kadeng/tensorflow_project_workspace | dee284fb2d1796329895130a075cd57a62ea873f | [
"Apache-2.0"
] | null | null | null | tensorflow/contrib/learn/python/learn/estimators/dnn.py | kadeng/tensorflow_project_workspace | dee284fb2d1796329895130a075cd57a62ea873f | [
"Apache-2.0"
] | null | null | null | tensorflow/contrib/learn/python/learn/estimators/dnn.py | kadeng/tensorflow_project_workspace | dee284fb2d1796329895130a075cd57a62ea873f | [
"Apache-2.0"
] | null | null | null | # Copyright 2016 The TensorFlow Authors. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applica... | 37.896933 | 102 | 0.662015 |
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
import six
from tensorflow.contrib import layers
from tensorflow.contrib.framework import deprecated
from tensorflow.contrib.framework import deprecated_arg_values
from tensorflow.contrib.framew... | true | true |
f72c0438b220afbd9e2368f18d00c300ac52ab61 | 8,977 | py | Python | precision_search/model/TEMPONet_float.py | EmbeddedML-EDAGroup/Q-PPG | ed42829d0a456db4f0b31d63ba8b22ba483c7b08 | [
"Apache-2.0"
] | 1 | 2021-12-18T21:04:29.000Z | 2021-12-18T21:04:29.000Z | precision_search/model/TEMPONet_float.py | EmbeddedML-EDAGroup/Q-PPG | ed42829d0a456db4f0b31d63ba8b22ba483c7b08 | [
"Apache-2.0"
] | null | null | null | precision_search/model/TEMPONet_float.py | EmbeddedML-EDAGroup/Q-PPG | ed42829d0a456db4f0b31d63ba8b22ba483c7b08 | [
"Apache-2.0"
] | null | null | null | #*----------------------------------------------------------------------------*
#* Copyright (C) 2021 Politecnico di Torino, Italy *
#* SPDX-License-Identifier: Apache-2.0 *
#* *
... | 28.22956 | 150 | 0.479782 |
import torch.nn as nn
import torch.nn.functional as F
from base import BaseModel
from math import ceil
import sys
sys.path.append("..")
from models import quant_module_1d as qm
__all__ = ['TempoNetfloat']
def TempoNetfloat(**kwargs):
return TEMPONet(**kwargs)
class TEMPONet(BaseModel):
... | true | true |
f72c0485c62be64f09e5a685e3cf499a790a4ccf | 13,340 | py | Python | crossmodal_embedding/tasks/crossmodal/training_star_task.py | ai-systems/crossmodal_embedding | 5c61775531fd350c48a965450ab5e99b28deec5e | [
"MIT"
] | null | null | null | crossmodal_embedding/tasks/crossmodal/training_star_task.py | ai-systems/crossmodal_embedding | 5c61775531fd350c48a965450ab5e99b28deec5e | [
"MIT"
] | null | null | null | crossmodal_embedding/tasks/crossmodal/training_star_task.py | ai-systems/crossmodal_embedding | 5c61775531fd350c48a965450ab5e99b28deec5e | [
"MIT"
] | null | null | null | from prefect import Task
from loguru import logger
from tqdm import tqdm
from crossmodal_embedding.models import CrossModalEmbedding, SiameseNet
from crossmodal_embedding.models import InputData, InputDataTest
from sklearn.metrics import precision_recall_fscore_support, f1_score
import torch.optim as optim
import torch... | 37.366947 | 88 | 0.496027 | from prefect import Task
from loguru import logger
from tqdm import tqdm
from crossmodal_embedding.models import CrossModalEmbedding, SiameseNet
from crossmodal_embedding.models import InputData, InputDataTest
from sklearn.metrics import precision_recall_fscore_support, f1_score
import torch.optim as optim
import torch... | true | true |
f72c04c1115d6d2253cc4ff13cc515e322a0dd87 | 6,763 | py | Python | config.py | YetheYe/Mask_RCNN | 6895c617af13ecbf0bb27790e29a6271725cb34f | [
"MIT"
] | null | null | null | config.py | YetheYe/Mask_RCNN | 6895c617af13ecbf0bb27790e29a6271725cb34f | [
"MIT"
] | null | null | null | config.py | YetheYe/Mask_RCNN | 6895c617af13ecbf0bb27790e29a6271725cb34f | [
"MIT"
] | null | null | null | """
Mask R-CNN
Base Configurations class.
Copyright (c) 2017 Matterport, Inc.
Licensed under the MIT License (see LICENSE for details)
Written by Waleed Abdulla
"""
import math
import numpy as np
# Base Configuration Class
# Don't use this class directly. Instead, sub-class it and override
# the configurations you ... | 36.556757 | 84 | 0.69067 |
import math
import numpy as np
# the configurations you need to change.
class Config(object):
# Name the configurations. For example, 'COCO', 'Experiment 3', ...etc.
# Useful if your code needs to do things differently depending on which
# experiment is running.
NAME = None # Override in sub-clas... | true | true |
f72c04c84917b4d25698a444e88719304b1f71e7 | 17,176 | py | Python | test/test_utils/vcfutils/test_parser.py | dylex/wecall | 35d24cefa4fba549e737cd99329ae1b17dd0156b | [
"MIT"
] | 8 | 2018-10-08T15:47:21.000Z | 2021-11-09T07:13:05.000Z | test/test_utils/vcfutils/test_parser.py | dylex/wecall | 35d24cefa4fba549e737cd99329ae1b17dd0156b | [
"MIT"
] | 4 | 2018-11-05T09:16:27.000Z | 2020-04-09T12:32:56.000Z | test/test_utils/vcfutils/test_parser.py | dylex/wecall | 35d24cefa4fba549e737cd99329ae1b17dd0156b | [
"MIT"
] | 4 | 2019-09-03T15:46:39.000Z | 2021-06-04T07:28:33.000Z | # All content Copyright (C) 2018 Genomics plc
import os
import re
import unittest
from wecall.genomics.variant import Variant
from wecall.vcfutils.genotype_call import GenotypeCall
from wecall.vcfutils.parser import VCFReader, VCFReaderContextManager, decode_VCF_string, \
parse_VCF_comma_separated_pair_value
from ... | 35.783333 | 120 | 0.615859 |
import os
import re
import unittest
from wecall.genomics.variant import Variant
from wecall.vcfutils.genotype_call import GenotypeCall
from wecall.vcfutils.parser import VCFReader, VCFReaderContextManager, decode_VCF_string, \
parse_VCF_comma_separated_pair_value
from wecall.vcfutils.schema import Schema
from wec... | true | true |
f72c05338ce0e13464f88b0d16b63a74fd9ad1e2 | 6,580 | py | Python | recognition/alexnet_PD_finetuning.py | ogrenenmakine/VCL-PL-Semi-Supervised-Learning-from-Noisy-Web-Data-with-Variational-Contrastive-Learning | baef25837ce7e073d03f69a095d1992aa18dd2d5 | [
"MIT"
] | null | null | null | recognition/alexnet_PD_finetuning.py | ogrenenmakine/VCL-PL-Semi-Supervised-Learning-from-Noisy-Web-Data-with-Variational-Contrastive-Learning | baef25837ce7e073d03f69a095d1992aa18dd2d5 | [
"MIT"
] | null | null | null | recognition/alexnet_PD_finetuning.py | ogrenenmakine/VCL-PL-Semi-Supervised-Learning-from-Noisy-Web-Data-with-Variational-Contrastive-Learning | baef25837ce7e073d03f69a095d1992aa18dd2d5 | [
"MIT"
] | null | null | null | #!/usr/bin/env python
# coding: utf-8
# In[ ]:
import math
from torch import nn
from torch.autograd import Variable
import torch
import torch.nn.functional as F
import torchvision
import torch.utils.data as data
import torchvision.transforms as transforms
import torchvision.utils as vutils
import numpy as np
from PIL... | 29.375 | 600 | 0.632827 |
import math
from torch import nn
from torch.autograd import Variable
import torch
import torch.nn.functional as F
import torchvision
import torch.utils.data as data
import torchvision.transforms as transforms
import torchvision.utils as vutils
import numpy as np
from PIL import Image
import os
import matplotlib.py... | true | true |
f72c055d3838a4636e2e7b02c3f27e7b13404fdf | 6,398 | py | Python | skyscrapers/skyscrapers.py | Adeon18/skyscrapers.py | 8dbd6e9d648a56f8dbab7de50ef6c606e4aed18e | [
"MIT"
] | null | null | null | skyscrapers/skyscrapers.py | Adeon18/skyscrapers.py | 8dbd6e9d648a56f8dbab7de50ef6c606e4aed18e | [
"MIT"
] | null | null | null | skyscrapers/skyscrapers.py | Adeon18/skyscrapers.py | 8dbd6e9d648a56f8dbab7de50ef6c606e4aed18e | [
"MIT"
] | null | null | null | """
https://github.com/Adeon18/skyscrapers
"""
def read_input(path: str) -> list:
"""
Read game board file from path.
Return list of str.
"""
with open(path, "r") as file:
output_lst = file.read().split("\n")
output_lst = output_lst[:-1]
return output_lst
def left_to_right_c... | 29.081818 | 79 | 0.557205 |
def read_input(path: str) -> list:
with open(path, "r") as file:
output_lst = file.read().split("\n")
output_lst = output_lst[:-1]
return output_lst
def left_to_right_check(input_line: str, pivot: int) -> bool:
row = input_line
max_num = 0
count = 0
for _, num in enumerate(r... | true | true |
f72c07bdf61ae06bff3821b388dc1226bbabef19 | 5,846 | py | Python | src/sage/categories/schemes.py | bopopescu/sagesmc | e8d1d31f6f598dba2d763baa2d2e804338f9e89e | [
"BSL-1.0"
] | 5 | 2015-01-04T07:15:06.000Z | 2022-03-04T15:15:18.000Z | src/sage/categories/schemes.py | bopopescu/sagesmc | e8d1d31f6f598dba2d763baa2d2e804338f9e89e | [
"BSL-1.0"
] | null | null | null | src/sage/categories/schemes.py | bopopescu/sagesmc | e8d1d31f6f598dba2d763baa2d2e804338f9e89e | [
"BSL-1.0"
] | 10 | 2016-09-28T13:12:40.000Z | 2022-02-12T09:28:34.000Z | r"""
Schemes
"""
#*****************************************************************************
# Copyright (C) 2005 David Kohel <kohel@maths.usyd.edu>
# William Stein <wstein@math.ucsd.edu>
# 2008-2009 Nicolas M. Thiery <nthiery at users.sf.net>
#
# Distributed under the ... | 28.79803 | 93 | 0.529422 | r"""
Schemes
"""
from sage.categories.category import Category, HomCategory
from sage.categories.category_types import Category_over_base
from sage.misc.cachefunc import cached_method
from sets_cat import Sets
def Schemes(X=None):
"""
Construct a category of schemes.
EXAMPLES::
sage: Sch... | false | true |
f72c08bf0eb0d7eb846f18ba055eede40647f94e | 30,345 | py | Python | sdk/python/pulumi_google_native/apigee/v1/organization.py | AaronFriel/pulumi-google-native | 75d1cda425e33d4610348972cd70bddf35f1770d | [
"Apache-2.0"
] | 44 | 2021-04-18T23:00:48.000Z | 2022-02-14T17:43:15.000Z | sdk/python/pulumi_google_native/apigee/v1/organization.py | AaronFriel/pulumi-google-native | 75d1cda425e33d4610348972cd70bddf35f1770d | [
"Apache-2.0"
] | 354 | 2021-04-16T16:48:39.000Z | 2022-03-31T17:16:39.000Z | sdk/python/pulumi_google_native/apigee/v1/organization.py | AaronFriel/pulumi-google-native | 75d1cda425e33d4610348972cd70bddf35f1770d | [
"Apache-2.0"
] | 8 | 2021-04-24T17:46:51.000Z | 2022-01-05T10:40:21.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, overload
from ... import _utilities
fro... | 52.958115 | 929 | 0.680046 |
import warnings
import pulumi
import pulumi.runtime
from typing import Any, Mapping, Optional, Sequence, Union, overload
from ... import _utilities
from . import outputs
from ._enums import *
from ._inputs import *
__all__ = ['OrganizationArgs', 'Organization']
@pulumi.input_type
class OrganizationArgs:
def _... | true | true |
f72c08e934eb334e53153f585231168d33ac7fca | 35,118 | py | Python | src/search.py | luisriverag/MagnetMagnet | 99f1805da0fa6399e4b28ab40d5784170bb91e82 | [
"MIT"
] | 44 | 2020-03-14T15:53:11.000Z | 2022-01-31T11:28:59.000Z | src/search.py | luisriverag/MagnetMagnet | 99f1805da0fa6399e4b28ab40d5784170bb91e82 | [
"MIT"
] | 6 | 2020-04-30T15:53:34.000Z | 2021-09-09T14:38:02.000Z | src/search.py | luisriverag/MagnetMagnet | 99f1805da0fa6399e4b28ab40d5784170bb91e82 | [
"MIT"
] | 16 | 2020-04-30T13:18:21.000Z | 2022-01-27T17:50:56.000Z | import math
import re
import pyperclip
import requests
from bs4 import BeautifulSoup
from PyQt5.QtCore import *
from PyQt5.QtGui import *
from PyQt5.QtWidgets import *
import src.mglobals
path = src.mglobals.base_path
class Ui_searchMainWindow(object):
def copied_success_message(self):
successMessageBo... | 44.173585 | 179 | 0.539154 | import math
import re
import pyperclip
import requests
from bs4 import BeautifulSoup
from PyQt5.QtCore import *
from PyQt5.QtGui import *
from PyQt5.QtWidgets import *
import src.mglobals
path = src.mglobals.base_path
class Ui_searchMainWindow(object):
def copied_success_message(self):
successMessageBo... | true | true |
f72c091ee41e3a1bdb0176021673692667130530 | 1,631 | py | Python | mcp/lib/Slack.py | vspeter/MCP | 1f8ee863d64a2c276c47f1f8c4803983bff88fb7 | [
"Apache-2.0"
] | null | null | null | mcp/lib/Slack.py | vspeter/MCP | 1f8ee863d64a2c276c47f1f8c4803983bff88fb7 | [
"Apache-2.0"
] | null | null | null | mcp/lib/Slack.py | vspeter/MCP | 1f8ee863d64a2c276c47f1f8c4803983bff88fb7 | [
"Apache-2.0"
] | 1 | 2021-02-24T16:51:11.000Z | 2021-02-24T16:51:11.000Z | import json
import logging
from urllib import request, parse
class Slack():
NOTSET = ':loudspeaker:'
DEBUG = ':speaker:'
INFO = ':information_source:'
WARNING = ':warning:'
ERROR = ':exclamation:'
CRITICAL = ':boom:'
SUCCESS = ':+1:'
DONE = ':checkered_flag:'
def __init__( self, proc, api_token, ch... | 28.614035 | 101 | 0.619865 | import json
import logging
from urllib import request, parse
class Slack():
NOTSET = ':loudspeaker:'
DEBUG = ':speaker:'
INFO = ':information_source:'
WARNING = ':warning:'
ERROR = ':exclamation:'
CRITICAL = ':boom:'
SUCCESS = ':+1:'
DONE = ':checkered_flag:'
def __init__( self, proc, api_token, ch... | true | true |
f72c09ac05b9052d87975715d4ccabff57f26a58 | 12,756 | py | Python | LaserRender.py | gsboylan/meerk40t | 7607b034368a428dfc5cab56629032d6074c756d | [
"MIT"
] | null | null | null | LaserRender.py | gsboylan/meerk40t | 7607b034368a428dfc5cab56629032d6074c756d | [
"MIT"
] | null | null | null | LaserRender.py | gsboylan/meerk40t | 7607b034368a428dfc5cab56629032d6074c756d | [
"MIT"
] | null | null | null | from math import floor
import wx
from PIL import Image
from ZMatrix import ZMatrix
from svgelements import *
"""
Laser Render provides GUI relevant methods of displaying the given project.
"""
DRAW_MODE_FILLS = 0x000001
DRAW_MODE_GUIDES = 0x000002
DRAW_MODE_GRID = 0x000004
DRAW_MODE_LASERPATH = 0x000... | 37.189504 | 94 | 0.541863 | from math import floor
import wx
from PIL import Image
from ZMatrix import ZMatrix
from svgelements import *
DRAW_MODE_FILLS = 0x000001
DRAW_MODE_GUIDES = 0x000002
DRAW_MODE_GRID = 0x000004
DRAW_MODE_LASERPATH = 0x000008
DRAW_MODE_RETICLE = 0x000010
DRAW_MODE_SELECTION = 0x000020
DRAW_MODE_STROKES = ... | true | true |
f72c09ef26d7bd7db7719016288f760059b46e7e | 561 | py | Python | starry_night.py | weijun-github/some-python-codes | db3d4b4ceb8b7c8ce0bd4b61da6227cd9e994718 | [
"MIT"
] | null | null | null | starry_night.py | weijun-github/some-python-codes | db3d4b4ceb8b7c8ce0bd4b61da6227cd9e994718 | [
"MIT"
] | null | null | null | starry_night.py | weijun-github/some-python-codes | db3d4b4ceb8b7c8ce0bd4b61da6227cd9e994718 | [
"MIT"
] | null | null | null | from turtle import *
from random import randint, random
def draw_star(points,size,col,x,y):
penup()
goto(x,y)
pendown()
angle = 180 - (180 / points)
color(col)
begin_fill()
for i in range(points):
forward(size)
right(angle)
end_fill()
# main code
Screen(... | 20.777778 | 39 | 0.57041 | from turtle import *
from random import randint, random
def draw_star(points,size,col,x,y):
penup()
goto(x,y)
pendown()
angle = 180 - (180 / points)
color(col)
begin_fill()
for i in range(points):
forward(size)
right(angle)
end_fill()
Screen().bgcolor("d... | true | true |
f72c09f7de9a8713a8c125758c01f1bfe2118188 | 13,359 | py | Python | fanficfare/adapters/adapter_bloodtiesfancom.py | Kolbo5/FanFicFare | cf2ae9b12631bfeeb9198ca686f9e58d4579aeb3 | [
"Apache-2.0"
] | null | null | null | fanficfare/adapters/adapter_bloodtiesfancom.py | Kolbo5/FanFicFare | cf2ae9b12631bfeeb9198ca686f9e58d4579aeb3 | [
"Apache-2.0"
] | null | null | null | fanficfare/adapters/adapter_bloodtiesfancom.py | Kolbo5/FanFicFare | cf2ae9b12631bfeeb9198ca686f9e58d4579aeb3 | [
"Apache-2.0"
] | null | null | null | # -*- coding: utf-8 -*-
# Copyright 2011 Fanficdownloader team, 2018 FanFicFare team
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Un... | 40.853211 | 157 | 0.601991 |
from __future__ import absolute_import
import logging
logger = logging.getLogger(__name__)
import re
from bs4.element import Tag
from ..htmlcleanup import stripHTML
from .. import exceptions as exceptions
from ..six import text_type as unicode
from ..six.moves.urllib.error import HTTPError
from .ba... | true | true |
f72c0a308bec3bcb670b9a62046fd98d6431cf98 | 109 | py | Python | callbacks/__init__.py | ivancreator/sgotgbot | fea3a8234610d1dee473688959167f430d43ad75 | [
"MIT"
] | null | null | null | callbacks/__init__.py | ivancreator/sgotgbot | fea3a8234610d1dee473688959167f430d43ad75 | [
"MIT"
] | null | null | null | callbacks/__init__.py | ivancreator/sgotgbot | fea3a8234610d1dee473688959167f430d43ad75 | [
"MIT"
] | null | null | null | from aiogram.utils.callback_data import CallbackData
cb_account = CallbackData('account', 'action', 'value') | 36.333333 | 55 | 0.798165 | from aiogram.utils.callback_data import CallbackData
cb_account = CallbackData('account', 'action', 'value') | true | true |
f72c0a6ac92672124a848a9846ceb3739ebe1129 | 6,194 | py | Python | module/LP.py | banboooo044/optimization | a15614b367712d6046311eac311214d27999fc7c | [
"MIT"
] | null | null | null | module/LP.py | banboooo044/optimization | a15614b367712d6046311eac311214d27999fc7c | [
"MIT"
] | null | null | null | module/LP.py | banboooo044/optimization | a15614b367712d6046311eac311214d27999fc7c | [
"MIT"
] | null | null | null | # date : 2/11/2019
# author : takeshi
import pandas as pd
import numpy as np
from IPython.display import display
def linprog(c,A,comp,b,maximize=True):
'''
Maximize(or Minimize) a linear objective function subject to linear equality and inequality constraints.
Linear Programming is intended to solve the f... | 34.99435 | 118 | 0.56474 |
import pandas as pd
import numpy as np
from IPython.display import display
def linprog(c,A,comp,b,maximize=True):
def optimize(table,target):
if not __debug__:
if target == 'w':
print("Phase 1 : find initial solution")
else:
if maximize:
... | true | true |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.