hexsha stringlengths 40 40 | size int64 2 1.02M | ext stringclasses 10
values | lang stringclasses 1
value | max_stars_repo_path stringlengths 4 245 | max_stars_repo_name stringlengths 6 130 | max_stars_repo_head_hexsha stringlengths 40 40 | max_stars_repo_licenses listlengths 1 10 | max_stars_count int64 1 191k ⌀ | max_stars_repo_stars_event_min_datetime stringlengths 24 24 ⌀ | max_stars_repo_stars_event_max_datetime stringlengths 24 24 ⌀ | max_issues_repo_path stringlengths 4 245 | max_issues_repo_name stringlengths 6 130 | max_issues_repo_head_hexsha stringlengths 40 40 | max_issues_repo_licenses listlengths 1 10 | max_issues_count int64 1 67k ⌀ | max_issues_repo_issues_event_min_datetime stringlengths 24 24 ⌀ | max_issues_repo_issues_event_max_datetime stringlengths 24 24 ⌀ | max_forks_repo_path stringlengths 4 245 | max_forks_repo_name stringlengths 6 130 | max_forks_repo_head_hexsha stringlengths 40 40 | max_forks_repo_licenses listlengths 1 10 | max_forks_count int64 1 105k ⌀ | max_forks_repo_forks_event_min_datetime stringlengths 24 24 ⌀ | max_forks_repo_forks_event_max_datetime stringlengths 24 24 ⌀ | content stringlengths 2 1.02M | avg_line_length float64 1 417k | max_line_length int64 1 987k | alphanum_fraction float64 0 1 | content_no_comment stringlengths 0 1.01M | is_comment_constant_removed bool 1
class | is_sharp_comment_removed bool 1
class |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
f72d97b65416bedcb025aa3932d05d4b6dca345b | 8,906 | py | Python | tensorflow/contrib/distributions/python/ops/inverse_gamma.py | bhbai/tensorflow | d4b5c606fc9fbd1a20b5b113b4bc831f31d889a3 | [
"Apache-2.0"
] | 65 | 2016-09-26T01:30:40.000Z | 2021-08-11T17:00:41.000Z | tensorflow/contrib/distributions/python/ops/inverse_gamma.py | bhbai/tensorflow | d4b5c606fc9fbd1a20b5b113b4bc831f31d889a3 | [
"Apache-2.0"
] | 5 | 2017-02-21T08:37:52.000Z | 2017-03-29T05:46:05.000Z | tensorflow/contrib/distributions/python/ops/inverse_gamma.py | bhbai/tensorflow | d4b5c606fc9fbd1a20b5b113b4bc831f31d889a3 | [
"Apache-2.0"
] | 11 | 2017-09-10T16:22:21.000Z | 2021-08-09T09:24:50.000Z | # 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... | 36.954357 | 80 | 0.656861 |
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
import numpy as np
from tensorflow.contrib.distributions.python.ops import distribution
from tensorflow.contrib.distributions.python.ops import distribution_util
from tensorflow.python.framework import consta... | true | true |
f72d97d1ff332aa397f3106364df1be3656a74db | 7,814 | py | Python | make_prg/subcommands/update.py | leoisl/make_prg | 9204cb8a60d8fae0985b4eb464c5dd99c1338d45 | [
"MIT"
] | 1 | 2021-05-07T02:04:07.000Z | 2021-05-07T02:04:07.000Z | make_prg/subcommands/update.py | leoisl/make_prg | 9204cb8a60d8fae0985b4eb464c5dd99c1338d45 | [
"MIT"
] | 9 | 2021-03-22T12:28:06.000Z | 2021-12-17T06:46:51.000Z | make_prg/subcommands/update.py | leoisl/make_prg | 9204cb8a60d8fae0985b4eb464c5dd99c1338d45 | [
"MIT"
] | 2 | 2021-06-29T04:54:22.000Z | 2022-01-03T12:19:59.000Z | import multiprocessing
import os
import shutil
from pathlib import Path
from loguru import logger
from make_prg import io_utils
from make_prg.denovo_paths_reader import DenovoPathsDB
from make_prg.prg_builder import PrgBuilderCollection, PrgBuilder, LeafNotFoundException
from make_prg.utils import output_files_alread... | 35.680365 | 110 | 0.677374 | import multiprocessing
import os
import shutil
from pathlib import Path
from loguru import logger
from make_prg import io_utils
from make_prg.denovo_paths_reader import DenovoPathsDB
from make_prg.prg_builder import PrgBuilderCollection, PrgBuilder, LeafNotFoundException
from make_prg.utils import output_files_alread... | true | true |
f72d9834477d0704ff5a7f19701aa575f0729d88 | 9,096 | py | Python | tests/contrib/sensors/test_hdfs_sensor.py | tekn0ir/incubator-airflow | 7df4405aa5a0c99e51722321caa7af660d35794b | [
"Apache-2.0"
] | 4 | 2019-01-17T06:21:45.000Z | 2020-06-20T01:59:57.000Z | tests/contrib/sensors/test_hdfs_sensor.py | tekn0ir/incubator-airflow | 7df4405aa5a0c99e51722321caa7af660d35794b | [
"Apache-2.0"
] | 14 | 2018-10-24T03:15:11.000Z | 2019-01-02T19:02:58.000Z | tests/contrib/sensors/test_hdfs_sensor.py | tekn0ir/incubator-airflow | 7df4405aa5a0c99e51722321caa7af660d35794b | [
"Apache-2.0"
] | 6 | 2020-06-09T02:16:58.000Z | 2021-12-27T15:46:32.000Z | # -*- coding: utf-8 -*-
#
# Licensed to the Apache Software Foundation (ASF) under one
# or more contributor license agreements. See the NOTICE file
# distributed with this work for additional information
# regarding copyright ownership. The ASF licenses this file
# to you under the Apache License, Version 2.0 (the
#... | 35.811024 | 81 | 0.523637 | import logging
import unittest
import re
from datetime import timedelta
from airflow.contrib.sensors.hdfs_sensor import HdfsSensorFolder, HdfsSensorRegex
from airflow.exceptions import AirflowSensorTimeout
class HdfsSensorFolderTests(unittest.TestCase):
def setUp(self):
from tests.core import FakeHDFSHo... | true | true |
f72d98fe41914415c21b32188f41c6849b2a500f | 6,359 | py | Python | Game_2048.py | Sandro-Tan/Game-2048 | dce87c1791f4fb1cd993089bd042f803c98e0d65 | [
"MIT"
] | null | null | null | Game_2048.py | Sandro-Tan/Game-2048 | dce87c1791f4fb1cd993089bd042f803c98e0d65 | [
"MIT"
] | null | null | null | Game_2048.py | Sandro-Tan/Game-2048 | dce87c1791f4fb1cd993089bd042f803c98e0d65 | [
"MIT"
] | null | null | null | """
2048 game
Move and merge squares using arrow keys
Get a 2048-value tile to win
Author: Sandro Tan
Date: Aug 2019
Version: 1.0
"""
import GUI_2048
import random
import SimpleGUICS2Pygame.simpleguics2pygame as simplegui
# Directions, DO NOT MODIFY
UP = 1
DOWN = 2
LEFT = 3
RIGHT = 4
# Offsets f... | 30.425837 | 105 | 0.545841 |
import GUI_2048
import random
import SimpleGUICS2Pygame.simpleguics2pygame as simplegui
UP = 1
DOWN = 2
LEFT = 3
RIGHT = 4
OFFSETS = {UP: (1, 0),
DOWN: (-1, 0),
LEFT: (0, 1),
RIGHT: (0, -1)}
def merge(line):
newlist = []
output = []
for item in li... | true | true |
f72d99157240f89ff49e8a9ea4de3274257776d1 | 4,869 | py | Python | evaluation/plot_WDS_topo_with_sensitivity.py | BME-SmartLab/GraphConvWat | 6cdcb3cb1bd22eb274c19ad4a45a78e334462e44 | [
"MIT"
] | null | null | null | evaluation/plot_WDS_topo_with_sensitivity.py | BME-SmartLab/GraphConvWat | 6cdcb3cb1bd22eb274c19ad4a45a78e334462e44 | [
"MIT"
] | null | null | null | evaluation/plot_WDS_topo_with_sensitivity.py | BME-SmartLab/GraphConvWat | 6cdcb3cb1bd22eb274c19ad4a45a78e334462e44 | [
"MIT"
] | 5 | 2021-05-05T12:35:14.000Z | 2022-03-23T14:20:38.000Z | # -*- coding: utf-8 -*-
import argparse
import os
import sys
import numpy as np
import pandas as pd
import seaborn as sns
from matplotlib import collections as mc
import matplotlib.pyplot as plt
from epynet import Network
sys.path.insert(0, os.path.join('..'))
from utils.graph_utils import get_nx_graph, get_sensitiv... | 31.616883 | 100 | 0.589443 | import argparse
import os
import sys
import numpy as np
import pandas as pd
import seaborn as sns
from matplotlib import collections as mc
import matplotlib.pyplot as plt
from epynet import Network
sys.path.insert(0, os.path.join('..'))
from utils.graph_utils import get_nx_graph, get_sensitivity_matrix
from utils.Se... | true | true |
f72d997030ed151a6efe6095e41b32f999a086f1 | 1,132 | py | Python | src/homework/tests/cross_check/tests_question_crosscheck_dispatcher.py | denkasyanov/education-backend | c796b6f2f1cc1cd09f83cab2ca0cc45344906ef5 | [
"MIT"
] | 151 | 2020-04-21T09:58:57.000Z | 2021-09-12T09:01:21.000Z | src/homework/tests/cross_check/tests_question_crosscheck_dispatcher.py | denkasyanov/education-backend | c796b6f2f1cc1cd09f83cab2ca0cc45344906ef5 | [
"MIT"
] | 163 | 2020-05-29T20:52:00.000Z | 2021-09-11T12:44:56.000Z | src/homework/tests/cross_check/tests_question_crosscheck_dispatcher.py | boochamoocha/education-backend | c6ffb0c00bc066c8f1e0a8c0ffe4d0215c7c416a | [
"MIT"
] | 39 | 2020-04-21T12:28:16.000Z | 2021-09-12T15:33:47.000Z | import pytest
from homework import tasks
from homework.models import AnswerCrossCheck
pytestmark = [pytest.mark.django_db]
def test_crosschecks_are_created(question_dispatcher):
question_dispatcher()
assert AnswerCrossCheck.objects.count() == 2
def test_question_method_does_the_same(question):
questi... | 24.608696 | 80 | 0.630742 | import pytest
from homework import tasks
from homework.models import AnswerCrossCheck
pytestmark = [pytest.mark.django_db]
def test_crosschecks_are_created(question_dispatcher):
question_dispatcher()
assert AnswerCrossCheck.objects.count() == 2
def test_question_method_does_the_same(question):
questi... | true | true |
f72d9972f9f6432ea86db5aa71f6ae923c068235 | 38,676 | py | Python | boilerpy3/filters.py | anwala/BoilerPy3 | f45cd9c2e846b4e5a804df5826e01cd2a5260a51 | [
"Apache-2.0"
] | 1 | 2021-02-25T10:21:58.000Z | 2021-02-25T10:21:58.000Z | boilerpy3/filters.py | gongmusian/BoilerPy3 | 7d4cad1eeae7bd9976c4bb68511b15fefc640a60 | [
"Apache-2.0"
] | null | null | null | boilerpy3/filters.py | gongmusian/BoilerPy3 | 7d4cad1eeae7bd9976c4bb68511b15fefc640a60 | [
"Apache-2.0"
] | null | null | null | """
This file is licensed under the terms of the Apache License, Version 2.0. See the LICENSE file in the root of this
repository for complete details.
"""
# -----------------------------------------------------------------------
# FILTER MANIFEST
# -------------------------------------------... | 37.117083 | 120 | 0.589797 |
import re
from typing import List, Pattern, Union
from boilerpy3.document import DefaultLabels, TextBlock, TextDocument
class BoilerpipeFilter:
def process(self, doc: TextDocument) -> bool:
pass
def subtract_blocks(self, block_arr: List[TextBlock], blocks_to_remove: List[TextBlock]) -> L... | true | true |
f72d9a61e10ccaed81de8d86da78582e8ecd06cd | 272 | py | Python | mindhome_alpha/erpnext/accounts/doctype/pos_closing_entry_taxes/pos_closing_entry_taxes.py | Mindhome/field_service | 3aea428815147903eb9af1d0c1b4b9fc7faed057 | [
"MIT"
] | 1 | 2021-04-29T14:55:29.000Z | 2021-04-29T14:55:29.000Z | mindhome_alpha/erpnext/accounts/doctype/pos_closing_entry_taxes/pos_closing_entry_taxes.py | Mindhome/field_service | 3aea428815147903eb9af1d0c1b4b9fc7faed057 | [
"MIT"
] | null | null | null | mindhome_alpha/erpnext/accounts/doctype/pos_closing_entry_taxes/pos_closing_entry_taxes.py | Mindhome/field_service | 3aea428815147903eb9af1d0c1b4b9fc7faed057 | [
"MIT"
] | 1 | 2021-04-29T14:39:01.000Z | 2021-04-29T14:39:01.000Z | # -*- coding: utf-8 -*-
# Copyright (c) 2018, Frappe Technologies Pvt. Ltd. and contributors
# For license information, please see license.txt
from __future__ import unicode_literals
from frappe.model.document import Document
class POSClosingEntryTaxes(Document):
pass
| 27.2 | 68 | 0.783088 |
from __future__ import unicode_literals
from frappe.model.document import Document
class POSClosingEntryTaxes(Document):
pass
| true | true |
f72d9a83a7754fc68372926e669955113ee0529a | 498 | py | Python | env/Lib/site-packages/plotly/validators/histogram2d/colorbar/title/_side.py | andresgreen-byte/Laboratorio-1--Inversion-de-Capital | 8a4707301d19c3826c31026c4077930bcd6a8182 | [
"MIT"
] | 11,750 | 2015-10-12T07:03:39.000Z | 2022-03-31T20:43:15.000Z | env/Lib/site-packages/plotly/validators/histogram2d/colorbar/title/_side.py | andresgreen-byte/Laboratorio-1--Inversion-de-Capital | 8a4707301d19c3826c31026c4077930bcd6a8182 | [
"MIT"
] | 2,951 | 2015-10-12T00:41:25.000Z | 2022-03-31T22:19:26.000Z | env/Lib/site-packages/plotly/validators/histogram2d/colorbar/title/_side.py | andresgreen-byte/Laboratorio-1--Inversion-de-Capital | 8a4707301d19c3826c31026c4077930bcd6a8182 | [
"MIT"
] | 2,623 | 2015-10-15T14:40:27.000Z | 2022-03-28T16:05:50.000Z | import _plotly_utils.basevalidators
class SideValidator(_plotly_utils.basevalidators.EnumeratedValidator):
def __init__(
self, plotly_name="side", parent_name="histogram2d.colorbar.title", **kwargs
):
super(SideValidator, self).__init__(
plotly_name=plotly_name,
parent_... | 33.2 | 84 | 0.640562 | import _plotly_utils.basevalidators
class SideValidator(_plotly_utils.basevalidators.EnumeratedValidator):
def __init__(
self, plotly_name="side", parent_name="histogram2d.colorbar.title", **kwargs
):
super(SideValidator, self).__init__(
plotly_name=plotly_name,
parent_... | true | true |
f72d9a8c9454e3853ac6f075276e317d79d1bf42 | 275 | py | Python | gunicorn.py | Frederick-S/one-mark | b2a85dce82f56fc0d08df7519178b4a7e4f89b70 | [
"MIT"
] | 8 | 2018-07-12T02:33:04.000Z | 2020-11-12T20:28:49.000Z | gunicorn.py | Frederick-S/one-mark | b2a85dce82f56fc0d08df7519178b4a7e4f89b70 | [
"MIT"
] | 353 | 2018-05-21T03:34:36.000Z | 2022-03-28T21:06:43.000Z | gunicorn.py | Frederick-S/one-mark | b2a85dce82f56fc0d08df7519178b4a7e4f89b70 | [
"MIT"
] | 2 | 2019-08-04T23:39:09.000Z | 2020-04-14T12:22:20.000Z | import os
bind = '0.0.0.0:5000'
accesslog = 'app.log'
access_log_format = \
'%(h)s %(l)s %(u)s %(t)s "%(r)s" %(s)s %(b)s "%(f)s" "%(a)s"'
raw_env = [
'GRAPH_CLIENT_ID=' + os.getenv('GRAPH_CLIENT_ID'),
'GRAPH_CLIENT_SECRET=' + os.getenv('GRAPH_CLIENT_SECRET')
]
| 22.916667 | 65 | 0.585455 | import os
bind = '0.0.0.0:5000'
accesslog = 'app.log'
access_log_format = \
'%(h)s %(l)s %(u)s %(t)s "%(r)s" %(s)s %(b)s "%(f)s" "%(a)s"'
raw_env = [
'GRAPH_CLIENT_ID=' + os.getenv('GRAPH_CLIENT_ID'),
'GRAPH_CLIENT_SECRET=' + os.getenv('GRAPH_CLIENT_SECRET')
]
| true | true |
f72d9bfbd3fe8904996d342401e1c556009901cd | 12,498 | py | Python | jina/logging/profile.py | arijitdas123student/jina | 54d916e362bde0391b0af0f12241d531b8453247 | [
"Apache-2.0"
] | 2 | 2021-10-18T04:43:27.000Z | 2021-10-18T04:43:47.000Z | jina/logging/profile.py | arijitdas123student/jina | 54d916e362bde0391b0af0f12241d531b8453247 | [
"Apache-2.0"
] | null | null | null | jina/logging/profile.py | arijitdas123student/jina | 54d916e362bde0391b0af0f12241d531b8453247 | [
"Apache-2.0"
] | null | null | null | import datetime
import itertools
import math
import sys
import threading
import time
from collections import defaultdict
from functools import wraps
from typing import Optional, Union, Callable
from jina.enums import ProgressBarStatus
from .logger import JinaLogger
from .. import __windows__
from ..helper import color... | 33.063492 | 136 | 0.589774 | import datetime
import itertools
import math
import sys
import threading
import time
from collections import defaultdict
from functools import wraps
from typing import Optional, Union, Callable
from jina.enums import ProgressBarStatus
from .logger import JinaLogger
from .. import __windows__
from ..helper import color... | true | true |
f72d9c8b3378c16b14842c4efffd09d4801f1f6c | 3,611 | py | Python | bin/EnhancedScrapy/spider/middlewares.py | LABZHG/IHPACrawler | b68101364b0e3fff69283d23b2be46f61e8dc853 | [
"MIT"
] | null | null | null | bin/EnhancedScrapy/spider/middlewares.py | LABZHG/IHPACrawler | b68101364b0e3fff69283d23b2be46f61e8dc853 | [
"MIT"
] | null | null | null | bin/EnhancedScrapy/spider/middlewares.py | LABZHG/IHPACrawler | b68101364b0e3fff69283d23b2be46f61e8dc853 | [
"MIT"
] | null | null | null | # -*- coding: utf-8 -*-
# Define here the models for your spider middleware
#
# See documentation in:
# https://docs.scrapy.org/en/latest/topics/spider-middleware.html
from scrapy import signals
class EnhancedspiderSpiderMiddleware(object):
# Not all methods need to be defined. If a method is not defined,
#... | 34.721154 | 78 | 0.667405 |
from scrapy import signals
class EnhancedspiderSpiderMiddleware(object):
@classmethod
def from_crawler(cls, crawler):
s = cls()
crawler.signals.connect(s.spider_opened, signal=signals.spider_opened)
return s
def process_spider_input(self, response, spider):
... | true | true |
f72d9e5657caeeace2c74e9759c3b45caf7c913b | 283 | py | Python | src/052.py | mackorone/euler | 1b0c2271690d1598d2643e75b7e1f693b4155f49 | [
"MIT"
] | null | null | null | src/052.py | mackorone/euler | 1b0c2271690d1598d2643e75b7e1f693b4155f49 | [
"MIT"
] | null | null | null | src/052.py | mackorone/euler | 1b0c2271690d1598d2643e75b7e1f693b4155f49 | [
"MIT"
] | null | null | null | def helper(num):
return ''.join(sorted(str(num)))
def ans():
num = 100000
while True:
string = helper(num)
if all(helper(num * i) == string for i in range(2, 7)):
return num
num += 1
if __name__ == '__main__':
print(ans())
| 17.6875 | 63 | 0.515901 | def helper(num):
return ''.join(sorted(str(num)))
def ans():
num = 100000
while True:
string = helper(num)
if all(helper(num * i) == string for i in range(2, 7)):
return num
num += 1
if __name__ == '__main__':
print(ans())
| true | true |
f72da0db59ad5454e517786cd1bc98eb3f7fd29f | 5,772 | py | Python | srcOld/loss.py | OphirGenomica/proteinFolding | b4b6ea19307e176e58aa9d39ae161003c340416d | [
"MIT"
] | null | null | null | srcOld/loss.py | OphirGenomica/proteinFolding | b4b6ea19307e176e58aa9d39ae161003c340416d | [
"MIT"
] | null | null | null | srcOld/loss.py | OphirGenomica/proteinFolding | b4b6ea19307e176e58aa9d39ae161003c340416d | [
"MIT"
] | null | null | null | import time
import matplotlib
import numpy as np
matplotlib.use('Agg')
import torch
import torch.nn as nn
class LossMultiTargets(nn.Module):
def __init__(self,loss_fnc=torch.nn.CrossEntropyLoss()):
super(LossMultiTargets, self).__init__()
self.loss = loss_fnc
def forward(self, inputs,target... | 33.754386 | 321 | 0.584546 | import time
import matplotlib
import numpy as np
matplotlib.use('Agg')
import torch
import torch.nn as nn
class LossMultiTargets(nn.Module):
def __init__(self,loss_fnc=torch.nn.CrossEntropyLoss()):
super(LossMultiTargets, self).__init__()
self.loss = loss_fnc
def forward(self, inputs,target... | true | true |
f72da1a3a3f39b2fcdbc9ceed248e3c2cc93b562 | 3,547 | py | Python | tutorials/02-intermediate/recurrent_neural_network/main.py | johnwu0604/pytorch-tutorial | bdbc283a0b79620d9b582f1c4d2c2220a853b856 | [
"MIT"
] | null | null | null | tutorials/02-intermediate/recurrent_neural_network/main.py | johnwu0604/pytorch-tutorial | bdbc283a0b79620d9b582f1c4d2c2220a853b856 | [
"MIT"
] | null | null | null | tutorials/02-intermediate/recurrent_neural_network/main.py | johnwu0604/pytorch-tutorial | bdbc283a0b79620d9b582f1c4d2c2220a853b856 | [
"MIT"
] | null | null | null | import torch
import torch.nn as nn
import torchvision
import torchvision.transforms as transforms
# Device configuration
device = torch.device('cuda' if torch.cuda.is_available() else 'cpu')
# Hyper-parameters
sequence_length = 28
input_size = 28
hidden_size = 128
num_layers = 2
num_classes = 10
batch_size = 100
nu... | 34.105769 | 101 | 0.592895 | import torch
import torch.nn as nn
import torchvision
import torchvision.transforms as transforms
device = torch.device('cuda' if torch.cuda.is_available() else 'cpu')
sequence_length = 28
input_size = 28
hidden_size = 128
num_layers = 2
num_classes = 10
batch_size = 100
num_epochs = 2
learning_rate = 0.01
train_d... | true | true |
f72da28d39719cdb80464e715e1aa7f0c2b6a6be | 3,760 | py | Python | qa/rpc-tests/maxblocksinflight.py | OwenRay/zeroonecoin | c1cda5840196746a508de702e4c28fe8f017453b | [
"MIT"
] | 13 | 2018-03-25T20:35:46.000Z | 2021-02-15T14:33:40.000Z | qa/rpc-tests/maxblocksinflight.py | OwenRay/zeroonecoin | c1cda5840196746a508de702e4c28fe8f017453b | [
"MIT"
] | 21 | 2018-03-30T21:57:01.000Z | 2020-08-05T23:06:41.000Z | qa/rpc-tests/maxblocksinflight.py | OwenRay/zeroonecoin | c1cda5840196746a508de702e4c28fe8f017453b | [
"MIT"
] | 15 | 2018-03-29T13:40:27.000Z | 2021-12-25T18:08:54.000Z | #!/usr/bin/env python3
# Copyright (c) 2015-2016 The Bitcoin Core developers
# Distributed under the MIT software license, see the accompanying
# file COPYING or http://www.opensource.org/licenses/mit-license.php.
from test_framework.mininode import *
from test_framework.test_framework import BitcoinTestFramework
from... | 38.762887 | 110 | 0.629255 |
from test_framework.mininode import *
from test_framework.test_framework import BitcoinTestFramework
from test_framework.util import *
import logging
MAX_REQUESTS = 128
class TestManager(NodeConnCB):
def on_getdata(self, conn, message):
self.log.debug("got getdata %s" % repr(message))
... | true | true |
f72da2d3b8872a2e49703402ba8c673ea736d87a | 782 | py | Python | pilot/perception/object_detection/load_label_map.py | yanbarurobotics/PythonPilot | eb07c620320c90ba85941041d08678a6142f988f | [
"Apache-2.0"
] | 129 | 2019-05-21T09:15:12.000Z | 2022-03-03T15:14:32.000Z | pilot/perception/object_detection/load_label_map.py | yanbarurobotics/PythonPilot | eb07c620320c90ba85941041d08678a6142f988f | [
"Apache-2.0"
] | 1 | 2022-03-28T04:21:54.000Z | 2022-03-28T04:21:54.000Z | pilot/perception/object_detection/load_label_map.py | yanbarurobotics/PythonPilot | eb07c620320c90ba85941041d08678a6142f988f | [
"Apache-2.0"
] | 31 | 2019-05-21T23:31:24.000Z | 2022-03-21T19:22:40.000Z | #!/usr/bin/python3
# -*- coding: utf-8 -*-
from object_detection.tf_utils import label_map_util
class LoadLabelMap():
def __init__(self):
return
def load_label_map(self, cfg):
"""
LOAD LABEL MAP
"""
print('Loading label map')
LABEL_PATH = cfg['la... | 28.962963 | 134 | 0.626598 |
from object_detection.tf_utils import label_map_util
class LoadLabelMap():
def __init__(self):
return
def load_label_map(self, cfg):
print('Loading label map')
LABEL_PATH = cfg['label_path']
NUM_CLASSES = cfg['num_classes']
try:
labe... | true | true |
f72da46334b99da9f99dcbbd2bb1d806a0260194 | 152 | py | Python | piu/__init__.py | Krazylee/piu | d1ac6c90d45af0a87b162b9b4bc882536dab04aa | [
"BSD-3-Clause"
] | 1 | 2015-06-15T15:26:12.000Z | 2015-06-15T15:26:12.000Z | piu/__init__.py | Krazylee/piu | d1ac6c90d45af0a87b162b9b4bc882536dab04aa | [
"BSD-3-Clause"
] | null | null | null | piu/__init__.py | Krazylee/piu | d1ac6c90d45af0a87b162b9b4bc882536dab04aa | [
"BSD-3-Clause"
] | null | null | null | #!/usr/bin/env python
# -*- coding: utf-8 -*-
__author__ = 'Krazy Lee'
__email__ = 'lixiangstar@gmail.com'
__version__ = '0.1.0'
from .piu import Piu
| 16.888889 | 35 | 0.664474 |
__author__ = 'Krazy Lee'
__email__ = 'lixiangstar@gmail.com'
__version__ = '0.1.0'
from .piu import Piu
| true | true |
f72da61a7319bfedd1000e77309afca39803be65 | 37,507 | py | Python | src/sixtypical/compiler.py | catseye/SixtyPical | 075ba9ff2a9a171e8fcc6682d5374fc61f20e6c6 | [
"Unlicense"
] | 28 | 2015-06-13T16:38:52.000Z | 2021-09-06T16:47:09.000Z | src/sixtypical/compiler.py | catseye/SixtyPical | 075ba9ff2a9a171e8fcc6682d5374fc61f20e6c6 | [
"Unlicense"
] | null | null | null | src/sixtypical/compiler.py | catseye/SixtyPical | 075ba9ff2a9a171e8fcc6682d5374fc61f20e6c6 | [
"Unlicense"
] | 3 | 2019-10-11T07:22:02.000Z | 2020-10-19T15:23:05.000Z | # encoding: UTF-8
from sixtypical.ast import (
Program, Routine, Block, SingleOp, Reset, Call, GoTo, If, Repeat, For, WithInterruptsOff, Save, PointInto
)
from sixtypical.model import (
ConstantRef, LocationRef, IndexedRef, IndirectRef,
TYPE_BIT, TYPE_BYTE, TYPE_WORD,
TableType, PointerType, RoutineTyp... | 47.840561 | 204 | 0.584691 |
from sixtypical.ast import (
Program, Routine, Block, SingleOp, Reset, Call, GoTo, If, Repeat, For, WithInterruptsOff, Save, PointInto
)
from sixtypical.model import (
ConstantRef, LocationRef, IndexedRef, IndirectRef,
TYPE_BIT, TYPE_BYTE, TYPE_WORD,
TableType, PointerType, RoutineType, VectorType,
... | true | true |
f72da63ad73723e98b0413706ba25b4c48abe99e | 4,370 | py | Python | gestaoemp/lib/python3.6/site-packages/pysignfe/nfe/manual_300/soap_100.py | jasonrosa92/gestaoempresa | c942c7cb5ff3bd299da94df11eab49b7dd0c7d71 | [
"MIT"
] | null | null | null | gestaoemp/lib/python3.6/site-packages/pysignfe/nfe/manual_300/soap_100.py | jasonrosa92/gestaoempresa | c942c7cb5ff3bd299da94df11eab49b7dd0c7d71 | [
"MIT"
] | null | null | null | gestaoemp/lib/python3.6/site-packages/pysignfe/nfe/manual_300/soap_100.py | jasonrosa92/gestaoempresa | c942c7cb5ff3bd299da94df11eab49b7dd0c7d71 | [
"MIT"
] | 1 | 2020-11-04T08:45:57.000Z | 2020-11-04T08:45:57.000Z | # -*- coding: utf-8 -*-
from pysignfe.xml_sped import *
from pysignfe.nfe.manual_300 import ESQUEMA_ATUAL
import os
DIRNAME = os.path.dirname(__file__)
class CabecMsg(XMLNFe):
def __init__(self):
super(CabecMsg, self).__init__()
self.versao = TagDecimal(nome=u'cabecMsg' , codigo=u'' , ... | 30.347222 | 156 | 0.579634 |
from pysignfe.xml_sped import *
from pysignfe.nfe.manual_300 import ESQUEMA_ATUAL
import os
DIRNAME = os.path.dirname(__file__)
class CabecMsg(XMLNFe):
def __init__(self):
super(CabecMsg, self).__init__()
self.versao = TagDecimal(nome=u'cabecMsg' , codigo=u'' , propriedade=u'versao', n... | true | true |
f72da63b1dcdd6bb6f1aa453dd36c56867d4b5bb | 1,786 | py | Python | Conteudo das Aulas/048/Cifra de Cesar - Gabarito.py | cerberus707/lab-python | ebba3c9cde873d70d4bb61084f79ce30b7f9e047 | [
"Apache-2.0"
] | null | null | null | Conteudo das Aulas/048/Cifra de Cesar - Gabarito.py | cerberus707/lab-python | ebba3c9cde873d70d4bb61084f79ce30b7f9e047 | [
"Apache-2.0"
] | null | null | null | Conteudo das Aulas/048/Cifra de Cesar - Gabarito.py | cerberus707/lab-python | ebba3c9cde873d70d4bb61084f79ce30b7f9e047 | [
"Apache-2.0"
] | null | null | null | TAM_MAX_CH = 26
def recebeModo():
"""
Função que pergunta se o usuário quer criptografar ou
decriptografar e garante que uma entrada válida foi recebida
"""
while True:
modo = input("Você deseja criptografar ou decriptografar?\n").lower()
if modo in 'criptografar c decriptografar d... | 24.135135 | 77 | 0.526876 | TAM_MAX_CH = 26
def recebeModo():
while True:
modo = input("Você deseja criptografar ou decriptografar?\n").lower()
if modo in 'criptografar c decriptografar d'.split():
return modo
else:
print("Entre 'criptografar' ou 'c' ou 'decriptografar' ou 'd'.")
def recebeCh... | true | true |
f72da7ef4747c1b5ac0fd719ff237ee623ce1a9b | 260 | py | Python | dj/blog/polls/views.py | jaysys/pystep | 7c58598b19474597de70963801bf5179afd04ce2 | [
"MIT"
] | null | null | null | dj/blog/polls/views.py | jaysys/pystep | 7c58598b19474597de70963801bf5179afd04ce2 | [
"MIT"
] | null | null | null | dj/blog/polls/views.py | jaysys/pystep | 7c58598b19474597de70963801bf5179afd04ce2 | [
"MIT"
] | null | null | null | # -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.shortcuts import render
# Create your views here.
from django.http import HttpResponse
def index(request):
return HttpResponse("Hello, JooWorld. You're at the j-polls index.")
| 21.666667 | 72 | 0.75 | from __future__ import unicode_literals
from django.shortcuts import render
from django.http import HttpResponse
def index(request):
return HttpResponse("Hello, JooWorld. You're at the j-polls index.")
| true | true |
f72daaceac15280ca2f5821e19aa6c09c0d6f4d5 | 2,035 | py | Python | sdks/python/apache_beam/examples/complete/game/user_score_test.py | eyal0/beam | 9c6922976cc2a5c6a2ef836c1986ff769cda99a5 | [
"Apache-2.0"
] | 35 | 2016-09-22T22:53:14.000Z | 2020-02-13T15:12:21.000Z | sdks/python/apache_beam/examples/complete/game/user_score_test.py | eyal0/beam | 9c6922976cc2a5c6a2ef836c1986ff769cda99a5 | [
"Apache-2.0"
] | 80 | 2020-01-16T09:55:09.000Z | 2020-10-03T13:43:07.000Z | sdks/python/apache_beam/examples/complete/game/user_score_test.py | eyal0/beam | 9c6922976cc2a5c6a2ef836c1986ff769cda99a5 | [
"Apache-2.0"
] | 88 | 2016-11-27T02:16:11.000Z | 2020-02-28T05:10:26.000Z | #
# Licensed to the Apache Software Foundation (ASF) under one or more
# contributor license agreements. See the NOTICE file distributed with
# this work for additional information regarding copyright ownership.
# The ASF licenses this file to You under the Apache License, Version 2.0
# (the "License"); you may not us... | 35.086207 | 80 | 0.732187 |
from __future__ import absolute_import
import logging
import unittest
import apache_beam as beam
from apache_beam.examples.complete.game import user_score
from apache_beam.testing.test_pipeline import TestPipeline
from apache_beam.testing.util import assert_that
from apache_beam.testing.util import equal_to
clas... | true | true |
f72daaf11e6fe72370b0058b84751cc12565a7e9 | 445 | py | Python | data/scripts/templates/object/tangible/loot/misc/shared_mystical_orb.py | obi-two/GameServer | 7d37024e2291a97d49522610cd8f1dbe5666afc2 | [
"MIT"
] | 20 | 2015-02-23T15:11:56.000Z | 2022-03-18T20:56:48.000Z | data/scripts/templates/object/tangible/loot/misc/shared_mystical_orb.py | apathyboy/swganh | 665128efe9154611dec4cb5efc61d246dd095984 | [
"MIT"
] | null | null | null | data/scripts/templates/object/tangible/loot/misc/shared_mystical_orb.py | apathyboy/swganh | 665128efe9154611dec4cb5efc61d246dd095984 | [
"MIT"
] | 20 | 2015-04-04T16:35:59.000Z | 2022-03-24T14:54:37.000Z | #### NOTICE: THIS FILE IS AUTOGENERATED
#### MODIFICATIONS MAY BE LOST IF DONE IMPROPERLY
#### PLEASE SEE THE ONLINE DOCUMENTATION FOR EXAMPLES
from swgpy.object import *
def create(kernel):
result = Tangible()
result.template = "object/tangible/loot/misc/shared_mystical_orb.iff"
result.attribute_template_id = -... | 26.176471 | 70 | 0.723596 |
from swgpy.object import *
def create(kernel):
result = Tangible()
result.template = "object/tangible/loot/misc/shared_mystical_orb.iff"
result.attribute_template_id = -1
result.stfName("item_n","mystical_orb")
return result | true | true |
f72dab1cc5ec45ec2f055c9305443861b75f89b5 | 3,181 | py | Python | Summarize/solution_timeseries_EVAL.py | JoseHernandez9094/CohortLexicase | 5179a3c0db6dcf0c2cae79fcfd08b4b919c9269d | [
"MIT"
] | null | null | null | Summarize/solution_timeseries_EVAL.py | JoseHernandez9094/CohortLexicase | 5179a3c0db6dcf0c2cae79fcfd08b4b919c9269d | [
"MIT"
] | null | null | null | Summarize/solution_timeseries_EVAL.py | JoseHernandez9094/CohortLexicase | 5179a3c0db6dcf0c2cae79fcfd08b4b919c9269d | [
"MIT"
] | null | null | null | #python3
#This script will make csv so that graph_timeseries.py can create plots with them!
import pandas as p
MAX_EVAL = 512*512*1000
df = p.read_csv('../Data/Raw/min_programs__eval_262144000.csv')
treat = {}
TREATMENT = 'treatment'
FOUND = 'solution_found'
UPDATE = 'update_found'
EVAL = 'evaluation_found... | 34.204301 | 83 | 0.565545 |
import pandas as p
MAX_EVAL = 512*512*1000
df = p.read_csv('../Data/Raw/min_programs__eval_262144000.csv')
treat = {}
TREATMENT = 'treatment'
FOUND = 'solution_found'
UPDATE = 'update_found'
EVAL = 'evaluation_found'
POS_UPDATE = 0
POS_EVAL = 1
for i,row in df.iterrows():
if row[TREATMENT] in t... | true | true |
f72dad363ea7d388f7f367a338f861969e70adc2 | 4,856 | py | Python | onlinecourse/models.py | rabih96/final_template | 692c1b967bd089c6f265f9f22db2f8f2ed72f12b | [
"Apache-2.0"
] | null | null | null | onlinecourse/models.py | rabih96/final_template | 692c1b967bd089c6f265f9f22db2f8f2ed72f12b | [
"Apache-2.0"
] | null | null | null | onlinecourse/models.py | rabih96/final_template | 692c1b967bd089c6f265f9f22db2f8f2ed72f12b | [
"Apache-2.0"
] | null | null | null | import sys
from django.utils.timezone import now
try:
from django.db import models
except Exception:
print("There was an error loading django modules. Do you have django installed?")
sys.exit()
from django.conf import settings
import uuid
# Instructor model
class Instructor(models.Model):
user = mode... | 34.197183 | 104 | 0.702636 | import sys
from django.utils.timezone import now
try:
from django.db import models
except Exception:
print("There was an error loading django modules. Do you have django installed?")
sys.exit()
from django.conf import settings
import uuid
class Instructor(models.Model):
user = models.ForeignKey(
... | true | true |
f72dad48dd10fce6afcd1cb15ac7ff2dc551c9de | 11,159 | py | Python | catalog/models.py | gengzhao2020/django_local_library | 2854531940cf813f669198f5a49d7b4946fa0f49 | [
"MIT"
] | null | null | null | catalog/models.py | gengzhao2020/django_local_library | 2854531940cf813f669198f5a49d7b4946fa0f49 | [
"MIT"
] | 16 | 2021-06-30T14:57:44.000Z | 2021-07-05T23:40:45.000Z | catalog/models.py | gengzhao2020/django_local_library | 2854531940cf813f669198f5a49d7b4946fa0f49 | [
"MIT"
] | null | null | null | from django.db import models
# Create your models here.
"""
Genre model
This model is used to store information about the book category — for example whether it is fiction or non-fiction,
romance or military history, etc.
The model has a single CharField field (name), which is used to describe the genre (this is li... | 46.302905 | 120 | 0.700332 | from django.db import models
class Genre(models.Model):
name = models.CharField(max_length=200, help_text="Enter a book genre (e.g. Science Fiction, French Poetry etc.)")
class Meta:
ordering = ['name']
permissions = (
('can_create_genre', 'Create genre'),
('can_updat... | true | true |
f72dae3fa0d68f4a0c07bb213ee6a4a1705d1c25 | 5,575 | py | Python | deeplookup/env.py | ybubnov/dnsthreat | 75a3298379c8b48aeea6bae6c5c31a7d5e9fe315 | [
"Apache-2.0"
] | 10 | 2021-07-29T10:02:09.000Z | 2022-01-18T10:03:10.000Z | deeplookup/env.py | ybubnov/dnsthreat | 75a3298379c8b48aeea6bae6c5c31a7d5e9fe315 | [
"Apache-2.0"
] | null | null | null | deeplookup/env.py | ybubnov/dnsthreat | 75a3298379c8b48aeea6bae6c5c31a7d5e9fe315 | [
"Apache-2.0"
] | null | null | null | from enum import Enum
import gym
import numpy as np
from gym import spaces
from gym.utils import seeding
class Action(Enum):
decrease_attention = 0
increase_attention = 1
access_detector = 2
isolate_node = 3
forget_node = 4
class State(Enum):
healthy = 0
infected = 1
class MalwareEnv(... | 33.584337 | 87 | 0.609507 | from enum import Enum
import gym
import numpy as np
from gym import spaces
from gym.utils import seeding
class Action(Enum):
decrease_attention = 0
increase_attention = 1
access_detector = 2
isolate_node = 3
forget_node = 4
class State(Enum):
healthy = 0
infected = 1
class MalwareEnv(... | true | true |
f72daf46254df0d6c88e364ddd25c09ced7b0cae | 1,415 | py | Python | src/migrations/versions/7b0843b4944f_.py | colinnewell/Adventure-Insecure | 46717dd14d88887559bb3a392c67b534c294edaa | [
"MIT"
] | 4 | 2016-09-24T19:46:12.000Z | 2017-07-08T02:17:06.000Z | src/migrations/versions/7b0843b4944f_.py | colinnewell/Adventure-Insecure | 46717dd14d88887559bb3a392c67b534c294edaa | [
"MIT"
] | null | null | null | src/migrations/versions/7b0843b4944f_.py | colinnewell/Adventure-Insecure | 46717dd14d88887559bb3a392c67b534c294edaa | [
"MIT"
] | null | null | null | """empty message
Revision ID: 7b0843b4944f
Revises: a83fe752a741
Create Date: 2016-08-08 23:12:27.138166
"""
# revision identifiers, used by Alembic.
revision = '7b0843b4944f'
down_revision = 'a83fe752a741'
from alembic import op
import sqlalchemy as sa
def upgrade():
### commands auto generated by Alembic - ... | 31.444444 | 85 | 0.677739 |
revision = '7b0843b4944f'
down_revision = 'a83fe752a741'
from alembic import op
import sqlalchemy as sa
def upgrade():
op.create_table('order_header',
sa.Column('id', sa.Integer(), nullable=False),
sa.Column('date_created', sa.DateTime(), nullable=True),
sa.Column('date_modified', sa.DateTime(),... | true | true |
f72db0772a914856e4cccbef369f54251e89d2f9 | 1,043 | py | Python | app/core/migrations/0004_recipe.py | kyla-m/recipe-app-api | 8fcd7bcee0075c2399204af98afff8c4ddc2cde1 | [
"MIT"
] | null | null | null | app/core/migrations/0004_recipe.py | kyla-m/recipe-app-api | 8fcd7bcee0075c2399204af98afff8c4ddc2cde1 | [
"MIT"
] | null | null | null | app/core/migrations/0004_recipe.py | kyla-m/recipe-app-api | 8fcd7bcee0075c2399204af98afff8c4ddc2cde1 | [
"MIT"
] | null | null | null | # Generated by Django 2.1.15 on 2021-06-30 17:50
from django.conf import settings
from django.db import migrations, models
import django.db.models.deletion
class Migration(migrations.Migration):
dependencies = [
('core', '0003_ingredient'),
]
operations = [
migrations.CreateModel(
... | 35.965517 | 118 | 0.604027 |
from django.conf import settings
from django.db import migrations, models
import django.db.models.deletion
class Migration(migrations.Migration):
dependencies = [
('core', '0003_ingredient'),
]
operations = [
migrations.CreateModel(
name='Recipe',
fields=[
... | true | true |
f72db08facbd9830410347ef99c14ccf4da7bba4 | 3,878 | py | Python | catalyst/contrib/dl/runner/alchemy.py | asmekal/catalyst | e11365c0a9812649ceaef14e53061cd5117d8684 | [
"MIT"
] | null | null | null | catalyst/contrib/dl/runner/alchemy.py | asmekal/catalyst | e11365c0a9812649ceaef14e53061cd5117d8684 | [
"MIT"
] | null | null | null | catalyst/contrib/dl/runner/alchemy.py | asmekal/catalyst | e11365c0a9812649ceaef14e53061cd5117d8684 | [
"MIT"
] | null | null | null | from typing import Dict # isort:skip
from alchemy import Logger
from catalyst.dl import utils
from catalyst.dl.core import Experiment, Runner
from catalyst.dl.runner import SupervisedRunner
class AlchemyRunner(Runner):
"""
Runner wrapper with Alchemy integration hooks.
Read about Alchemy here https://a... | 32.864407 | 76 | 0.612171 | from typing import Dict
from alchemy import Logger
from catalyst.dl import utils
from catalyst.dl.core import Experiment, Runner
from catalyst.dl.runner import SupervisedRunner
class AlchemyRunner(Runner):
def _init(
self,
log_on_batch_end: bool = False,
log_on_epoch_end: bool = True,
... | true | true |
f72db0ea58b82317604e179be05a4bcd2493f975 | 39,757 | py | Python | plasmapy/formulary/tests/test_parameters.py | RAJAGOPALAN-GANGADHARAN/PlasmaPy | 6df9583cc47375687a07300c0aa11ba31634d770 | [
"BSD-2-Clause",
"MIT",
"BSD-2-Clause-Patent",
"BSD-1-Clause",
"BSD-3-Clause"
] | 2 | 2020-09-16T08:53:45.000Z | 2022-01-29T18:00:10.000Z | plasmapy/formulary/tests/test_parameters.py | RAJAGOPALAN-GANGADHARAN/PlasmaPy | 6df9583cc47375687a07300c0aa11ba31634d770 | [
"BSD-2-Clause",
"MIT",
"BSD-2-Clause-Patent",
"BSD-1-Clause",
"BSD-3-Clause"
] | null | null | null | plasmapy/formulary/tests/test_parameters.py | RAJAGOPALAN-GANGADHARAN/PlasmaPy | 6df9583cc47375687a07300c0aa11ba31634d770 | [
"BSD-2-Clause",
"MIT",
"BSD-2-Clause-Patent",
"BSD-1-Clause",
"BSD-3-Clause"
] | null | null | null | """Tests for functions that calculate plasma parameters."""
import numpy as np
import pytest
from astropy import units as u
from astropy.constants import m_e, m_p
from astropy.tests.helper import assert_quantity_allclose
from plasmapy.formulary.parameters import (
Alfven_speed,
betaH_,
Bohm_diffusion,
... | 33.692373 | 96 | 0.525014 |
import numpy as np
import pytest
from astropy import units as u
from astropy.constants import m_e, m_p
from astropy.tests.helper import assert_quantity_allclose
from plasmapy.formulary.parameters import (
Alfven_speed,
betaH_,
Bohm_diffusion,
cs_,
cwp_,
DB_,
Debye_length,
Debye_number... | true | true |
f72db11b2f7cbd06b26d3936d52ef5ae13ca8cca | 3,415 | py | Python | test/programytest/oob/defaults/test_email.py | cdoebler1/AIML2 | ee692ec5ea3794cd1bc4cc8ec2a6b5e5c20a0d6a | [
"MIT"
] | 345 | 2016-11-23T22:37:04.000Z | 2022-03-30T20:44:44.000Z | test/programytest/oob/defaults/test_email.py | MikeyBeez/program-y | 00d7a0c7d50062f18f0ab6f4a041068e119ef7f0 | [
"MIT"
] | 275 | 2016-12-07T10:30:28.000Z | 2022-02-08T21:28:33.000Z | test/programytest/oob/defaults/test_email.py | VProgramMist/modified-program-y | f32efcafafd773683b3fe30054d5485fe9002b7d | [
"MIT"
] | 159 | 2016-11-28T18:59:30.000Z | 2022-03-20T18:02:44.000Z | import unittest
import unittest.mock
import xml.etree.ElementTree as ET
from programy.oob.callmom.email import EmailOutOfBandProcessor
from programytest.client import TestClient
class EmailOutOfBandProcessorTests(unittest.TestCase):
def setUp(self):
client = TestClient()
self._client_context = c... | 32.216981 | 117 | 0.654173 | import unittest
import unittest.mock
import xml.etree.ElementTree as ET
from programy.oob.callmom.email import EmailOutOfBandProcessor
from programytest.client import TestClient
class EmailOutOfBandProcessorTests(unittest.TestCase):
def setUp(self):
client = TestClient()
self._client_context = c... | true | true |
f72db15d88506aca4c050bef3ef999424a0aa8af | 6,927 | py | Python | scrum/migrations/0002_rename_section_to_story.py | OpenSourceSag/django-dash2013 | 5646d3123547732507c9b83a55cfe54dcead9eef | [
"BSD-3-Clause"
] | 1 | 2016-01-09T03:14:43.000Z | 2016-01-09T03:14:43.000Z | scrum/migrations/0002_rename_section_to_story.py | OpenSourceSag/django-dash2013 | 5646d3123547732507c9b83a55cfe54dcead9eef | [
"BSD-3-Clause"
] | null | null | null | scrum/migrations/0002_rename_section_to_story.py | OpenSourceSag/django-dash2013 | 5646d3123547732507c9b83a55cfe54dcead9eef | [
"BSD-3-Clause"
] | null | null | null | # -*- coding: utf-8 -*-
import datetime
from south.db import db
from south.v2 import SchemaMigration
from django.db import models
class Migration(SchemaMigration):
def forwards(self, orm):
db.rename_table('scrum_section', 'scrum_story')
def backwards(self, orm):
db.rename_table('scrum_story'... | 72.915789 | 203 | 0.560993 | import datetime
from south.db import db
from south.v2 import SchemaMigration
from django.db import models
class Migration(SchemaMigration):
def forwards(self, orm):
db.rename_table('scrum_section', 'scrum_story')
def backwards(self, orm):
db.rename_table('scrum_story', 'scrum_section')
... | true | true |
f72db2150e33c99d77c2b2f4a04aba4277c87834 | 689 | py | Python | easy/ugly number/solution.py | i-redbyte/leetcode | b1569b06dd219495e7db9a8122f839bcaf9f6024 | [
"MIT"
] | 4 | 2021-06-03T22:19:13.000Z | 2021-10-05T18:14:12.000Z | easy/ugly number/solution.py | i-redbyte/leetcode | b1569b06dd219495e7db9a8122f839bcaf9f6024 | [
"MIT"
] | null | null | null | easy/ugly number/solution.py | i-redbyte/leetcode | b1569b06dd219495e7db9a8122f839bcaf9f6024 | [
"MIT"
] | null | null | null | class Solution:
def maxDiv(self, a: int, b: int) -> int:
while a % b == 0:
a = a / b
return a
def isUgly2(self, n: int) -> bool:
n = self.maxDiv(n, 2)
n = self.maxDiv(n, 3)
n = self.maxDiv(n, 5)
return n == 1
def isUgly(self, n: int) -> bool:
... | 20.264706 | 44 | 0.454282 | class Solution:
def maxDiv(self, a: int, b: int) -> int:
while a % b == 0:
a = a / b
return a
def isUgly2(self, n: int) -> bool:
n = self.maxDiv(n, 2)
n = self.maxDiv(n, 3)
n = self.maxDiv(n, 5)
return n == 1
def isUgly(self, n: int) -> bool:
... | true | true |
f72db2685b749298afabe9cef2e6ca318e0fa3f5 | 4,526 | py | Python | plenum/test/nodestack/test_resend_stashed_msgs.py | anikitinDSR/indy-plenum | f2a03344cdff4edbe0bf3528a8ddf34a8b1c6b85 | [
"Apache-2.0"
] | null | null | null | plenum/test/nodestack/test_resend_stashed_msgs.py | anikitinDSR/indy-plenum | f2a03344cdff4edbe0bf3528a8ddf34a8b1c6b85 | [
"Apache-2.0"
] | null | null | null | plenum/test/nodestack/test_resend_stashed_msgs.py | anikitinDSR/indy-plenum | f2a03344cdff4edbe0bf3528a8ddf34a8b1c6b85 | [
"Apache-2.0"
] | null | null | null | from copy import copy
import pytest
from stp_core.loop.eventually import eventually
from plenum.common.constants import OP_FIELD_NAME, BATCH
from plenum.common.messages.node_messages import Batch
from plenum.common.stacks import nodeStackClass
from plenum.common.types import f
from stp_core.network.auth_mode import A... | 32.328571 | 113 | 0.643394 | from copy import copy
import pytest
from stp_core.loop.eventually import eventually
from plenum.common.constants import OP_FIELD_NAME, BATCH
from plenum.common.messages.node_messages import Batch
from plenum.common.stacks import nodeStackClass
from plenum.common.types import f
from stp_core.network.auth_mode import A... | true | true |
f72db2f84a2d185ab76ee58dd425a4bf305847e5 | 1,628 | py | Python | src/secondaires/auberge/masques/__init__.py | stormi/tsunami | bdc853229834b52b2ee8ed54a3161a1a3133d926 | [
"BSD-3-Clause"
] | null | null | null | src/secondaires/auberge/masques/__init__.py | stormi/tsunami | bdc853229834b52b2ee8ed54a3161a1a3133d926 | [
"BSD-3-Clause"
] | null | null | null | src/secondaires/auberge/masques/__init__.py | stormi/tsunami | bdc853229834b52b2ee8ed54a3161a1a3133d926 | [
"BSD-3-Clause"
] | null | null | null | # -*-coding:Utf-8 -*
# Copyright (c) 2010 LE GOFF Vincent
# All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions are met:
#
# * Redistributions of source code must retain the above copyright notice, this
# lis... | 47.882353 | 79 | 0.778256 |
from . import chambre
| true | true |
f72db4a9438ec86a8a7ddb3a4b730c35c957db51 | 4,189 | py | Python | elvis/modeling/meta_arch/vl_pretrainer.py | seo-95/elvis | a89c759acdf6ce64c7e6863aeb68dc0ba3293fed | [
"Apache-2.0"
] | 1 | 2021-08-01T13:55:27.000Z | 2021-08-01T13:55:27.000Z | elvis/modeling/meta_arch/vl_pretrainer.py | seo-95/elvis | a89c759acdf6ce64c7e6863aeb68dc0ba3293fed | [
"Apache-2.0"
] | null | null | null | elvis/modeling/meta_arch/vl_pretrainer.py | seo-95/elvis | a89c759acdf6ce64c7e6863aeb68dc0ba3293fed | [
"Apache-2.0"
] | null | null | null | import copy
import os
import pdb
import random
from typing import Dict, List, Text, TypeVar
import torch
import torch.nn as nn
import torch.nn.functional as F
from elvis.modeling.models import build_net
from elvis.modeling.models.layers import FC, MLP
from elvis.utils.vlp_objectives import optimal_transport_dist
from... | 41.475248 | 130 | 0.603008 | import copy
import os
import pdb
import random
from typing import Dict, List, Text, TypeVar
import torch
import torch.nn as nn
import torch.nn.functional as F
from elvis.modeling.models import build_net
from elvis.modeling.models.layers import FC, MLP
from elvis.utils.vlp_objectives import optimal_transport_dist
from... | true | true |
f72db4fe126c81c8a809a327d8b91edb1269602b | 5,434 | py | Python | tests/portfolio/test_portfolio.py | keisuke-umezawa/backlight | db49a966fdb38de693bb8157cec88d98620f9946 | [
"MIT"
] | 8 | 2018-11-06T16:48:45.000Z | 2021-02-14T18:02:27.000Z | tests/portfolio/test_portfolio.py | keisuke-umezawa/backlight | db49a966fdb38de693bb8157cec88d98620f9946 | [
"MIT"
] | 36 | 2018-11-02T23:21:59.000Z | 2021-02-08T10:27:29.000Z | tests/portfolio/test_portfolio.py | keisuke-umezawa/backlight | db49a966fdb38de693bb8157cec88d98620f9946 | [
"MIT"
] | 5 | 2018-11-07T06:05:24.000Z | 2021-11-20T08:57:39.000Z | import pytest
import pandas as pd
import numpy as np
import backlight
from backlight.portfolio.portfolio import create_portfolio as module
from backlight.portfolio.portfolio import _fusion_positions
import backlight.positions.positions
from backlight.trades.trades import make_trades
from backlight.asset.currency impor... | 26.507317 | 87 | 0.550423 | import pytest
import pandas as pd
import numpy as np
import backlight
from backlight.portfolio.portfolio import create_portfolio as module
from backlight.portfolio.portfolio import _fusion_positions
import backlight.positions.positions
from backlight.trades.trades import make_trades
from backlight.asset.currency impor... | true | true |
f72db51aa93fbd1cba44def9ee99ae95419c4210 | 4,932 | py | Python | deeppavlov/models/slotfill/slotfill.py | xbodx/DeepPavlov | 4b60bf162df4294b8b0db3b72786cdd699c674fa | [
"Apache-2.0"
] | 1 | 2020-12-20T19:56:52.000Z | 2020-12-20T19:56:52.000Z | deeppavlov/models/slotfill/slotfill.py | xbodx/DeepPavlov | 4b60bf162df4294b8b0db3b72786cdd699c674fa | [
"Apache-2.0"
] | 1 | 2020-06-15T19:58:25.000Z | 2020-06-17T17:48:49.000Z | deeppavlov/models/slotfill/slotfill.py | xbodx/DeepPavlov | 4b60bf162df4294b8b0db3b72786cdd699c674fa | [
"Apache-2.0"
] | 1 | 2020-08-14T05:01:50.000Z | 2020-08-14T05:01:50.000Z | # Copyright 2017 Neural Networks and Deep Learning lab, MIPT
#
# 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 applicab... | 38.232558 | 97 | 0.618005 |
import json
from logging import getLogger
from rapidfuzz import process
from overrides import overrides
from deeppavlov.core.common.registry import register
from deeppavlov.core.data.utils import download
from deeppavlov.core.models.component import Component
from deeppavlov.core.models.serializable import Serializa... | true | true |
f72db855da14e3dfcd6bb920a64df7a3b7b4b780 | 22,456 | py | Python | BigGAN-PyTorch/BigGAN_remove_condbn+++++.py | twice154/Spatial-Self-modulation-on-BigGAN | 6ca691231bf7e8fd388a08b5ce6b4e30a50dd57b | [
"ECL-2.0"
] | null | null | null | BigGAN-PyTorch/BigGAN_remove_condbn+++++.py | twice154/Spatial-Self-modulation-on-BigGAN | 6ca691231bf7e8fd388a08b5ce6b4e30a50dd57b | [
"ECL-2.0"
] | null | null | null | BigGAN-PyTorch/BigGAN_remove_condbn+++++.py | twice154/Spatial-Self-modulation-on-BigGAN | 6ca691231bf7e8fd388a08b5ce6b4e30a50dd57b | [
"ECL-2.0"
] | null | null | null | import numpy as np
import math
import functools
import torch
import torch.nn as nn
from torch.nn import init
import torch.optim as optim
import torch.nn.functional as F
from torch.nn import Parameter as P
import layers
from sync_batchnorm import SynchronizedBatchNorm2d as SyncBatchNorm2d
# Architectures for G
# Att... | 44.822355 | 123 | 0.59316 | import numpy as np
import math
import functools
import torch
import torch.nn as nn
from torch.nn import init
import torch.optim as optim
import torch.nn.functional as F
from torch.nn import Parameter as P
import layers
from sync_batchnorm import SynchronizedBatchNorm2d as SyncBatchNorm2d
def G_arch(ch=64, attention... | true | true |
f72db881c82bb2d2eb69127cc586e7b8a820eb99 | 1,374 | py | Python | thym/timer.py | apgeorg/thyme | 47bf312c27f76c6392370a499a23738dcae6ad17 | [
"MIT"
] | 2 | 2018-12-10T11:31:50.000Z | 2018-12-10T14:44:14.000Z | thym/timer.py | apgeorg/thyme | 47bf312c27f76c6392370a499a23738dcae6ad17 | [
"MIT"
] | 1 | 2019-06-25T09:05:32.000Z | 2019-06-25T09:05:32.000Z | thym/timer.py | apgeorg/thyme | 47bf312c27f76c6392370a499a23738dcae6ad17 | [
"MIT"
] | null | null | null | import threading
import time
class Timer(object):
def __init__(self, interval, callback_func, oneshot=False, args=None, kwargs=None):
self._interval = interval
self._oneshot = oneshot
self._f = callback_func
self._args = args if args is not None else []
self._kwargs = kwar... | 28.040816 | 87 | 0.61936 | import threading
import time
class Timer(object):
def __init__(self, interval, callback_func, oneshot=False, args=None, kwargs=None):
self._interval = interval
self._oneshot = oneshot
self._f = callback_func
self._args = args if args is not None else []
self._kwargs = kwar... | true | true |
f72dba625d6c9634543fe15a9ee5be84ebf0ba31 | 22,250 | py | Python | basic_samples/SDS/Python/SDSPy/Python3/program.py | hanhossain/OCS-Samples | 6f0f7878e6d9bccc32b6d663446678e070859d14 | [
"Apache-2.0"
] | null | null | null | basic_samples/SDS/Python/SDSPy/Python3/program.py | hanhossain/OCS-Samples | 6f0f7878e6d9bccc32b6d663446678e070859d14 | [
"Apache-2.0"
] | null | null | null | basic_samples/SDS/Python/SDSPy/Python3/program.py | hanhossain/OCS-Samples | 6f0f7878e6d9bccc32b6d663446678e070859d14 | [
"Apache-2.0"
] | null | null | null | # program.py
#
# Copyright (C) 2018 OSIsoft, LLC. All rights reserved.
#
# THIS SOFTWARE CONTAINS CONFIDENTIAL INFORMATION AND TRADE SECRETS OF
# OSIsoft, LLC. USE, DISCLOSURE, OR REPRODUCTION IS PROHIBITED WITHOUT
# THE PRIOR EXPRESS WRITTEN PERMISSION OF OSIsoft, LLC.
#
# RESTRICTED RIGHTS LEGEND
# Use, duplication,... | 40.307971 | 177 | 0.639011 |
from sdspy import *
import configparser
import datetime
import time
import math
import inspect
import collections
def getWaveDataType(sampleTypeId):
if sampleTypeId is None or not isinstance(sampleTypeId, str):
raise TypeError("sampleTypeId is not an instantiated string")
intType = SdsType()
intT... | true | true |
f72dbb4b96808df2eff7d41ab6472c83c46f6b78 | 1,483 | py | Python | scripts/one-time/migrate_dynamo_to_pg.py | AndrewLorente/catsnap | 57427b8f61ef5185a41e49d55ffd7dd328777834 | [
"MIT"
] | 5 | 2015-11-23T18:40:00.000Z | 2019-03-22T06:54:04.000Z | scripts/one-time/migrate_dynamo_to_pg.py | AndrewLorente/catsnap | 57427b8f61ef5185a41e49d55ffd7dd328777834 | [
"MIT"
] | 5 | 2016-04-07T15:35:53.000Z | 2019-02-10T23:00:32.000Z | scripts/one-time/migrate_dynamo_to_pg.py | AndrewLorente/catsnap | 57427b8f61ef5185a41e49d55ffd7dd328777834 | [
"MIT"
] | 2 | 2015-12-02T16:44:05.000Z | 2017-09-29T23:17:33.000Z | #!/usr/bin/env python
import json
from sqlalchemy import Table, Column, String, MetaData
from catsnap import Client
from catsnap.table.tag import Tag
from catsnap.table.image import Image
from catsnap.table.image_tag import ImageTag
tags = []
images = []
image_tags = []
tag_table = Client().table('tag')
for item in ... | 25.135593 | 66 | 0.67296 |
import json
from sqlalchemy import Table, Column, String, MetaData
from catsnap import Client
from catsnap.table.tag import Tag
from catsnap.table.image import Image
from catsnap.table.image_tag import ImageTag
tags = []
images = []
image_tags = []
tag_table = Client().table('tag')
for item in tag_table.scan():
... | true | true |
f72dbbd37d6df2e935c448ffbc4add7814f020a9 | 750 | py | Python | altdeutsch/tests/test_reader.py | clemsciences/old_high_german_texts | 1fe458613da5f13760d743cee99fc2eaceb59298 | [
"MIT"
] | null | null | null | altdeutsch/tests/test_reader.py | clemsciences/old_high_german_texts | 1fe458613da5f13760d743cee99fc2eaceb59298 | [
"MIT"
] | null | null | null | altdeutsch/tests/test_reader.py | clemsciences/old_high_german_texts | 1fe458613da5f13760d743cee99fc2eaceb59298 | [
"MIT"
] | null | null | null | """
"""
import os
import unittest
from altdeutsch import PACKDIR
from altdeutsch.reader import read_export
__author__ = ["Clément Besnier <clemsciences@aol.com>", ]
class UnitTest(unittest.TestCase):
def test_hildebrandslied(self):
res = read_export(os.path.join(PACKDIR, "tests", "data", "hildebrands... | 30 | 119 | 0.594667 |
import os
import unittest
from altdeutsch import PACKDIR
from altdeutsch.reader import read_export
__author__ = ["Clément Besnier <clemsciences@aol.com>", ]
class UnitTest(unittest.TestCase):
def test_hildebrandslied(self):
res = read_export(os.path.join(PACKDIR, "tests", "data", "hildebrandslied.txt"... | true | true |
f72dbcea00d85fb6260c29c8f4cc837758fb55d5 | 8,118 | py | Python | rlkit/core/eval_util.py | Ericonaldo/ILSwiss | efd25d457fd1578005c6fbc45cae29e9ab64a99d | [
"MIT"
] | 46 | 2021-07-28T03:15:23.000Z | 2022-03-31T22:19:22.000Z | rlkit/core/eval_util.py | Ericonaldo/ILSwiss | efd25d457fd1578005c6fbc45cae29e9ab64a99d | [
"MIT"
] | 3 | 2021-07-30T09:55:01.000Z | 2022-03-17T17:21:26.000Z | rlkit/core/eval_util.py | Ericonaldo/ILSwiss | efd25d457fd1578005c6fbc45cae29e9ab64a99d | [
"MIT"
] | 5 | 2021-07-28T16:45:14.000Z | 2022-03-11T01:39:19.000Z | """
Common evaluation utilities.
"""
from collections import OrderedDict
from numbers import Number
import os
import json
import numpy as np
from rlkit.core.vistools import plot_returns_on_same_plot, save_plot
def get_generic_path_information(paths, stat_prefix=""):
"""
Get an OrderedDict with a bunch of s... | 32.214286 | 110 | 0.54607 |
from collections import OrderedDict
from numbers import Number
import os
import json
import numpy as np
from rlkit.core.vistools import plot_returns_on_same_plot, save_plot
def get_generic_path_information(paths, stat_prefix=""):
statistics = OrderedDict()
returns = [sum(path["rewards"]) for path in paths]... | true | true |
f72dbcf7ce7f36619bc491a433758075f439932e | 3,873 | py | Python | model/nlp/topic.py | shelleyHLX/ai-server | 12c4a654a686462b8b725fa0641cc967d2f80e14 | [
"Apache-2.0"
] | 1 | 2021-11-09T08:02:01.000Z | 2021-11-09T08:02:01.000Z | model/nlp/topic.py | shelleyHLX/ai-server | 12c4a654a686462b8b725fa0641cc967d2f80e14 | [
"Apache-2.0"
] | null | null | null | model/nlp/topic.py | shelleyHLX/ai-server | 12c4a654a686462b8b725fa0641cc967d2f80e14 | [
"Apache-2.0"
] | 1 | 2021-11-09T08:02:03.000Z | 2021-11-09T08:02:03.000Z | # -*- coding: utf-8 -*-
# Author: XuMing <xuming624@qq.com>
# Brief:
import operator
import os
import tensorflow as tf
from keras.models import load_model
from model.nlp.keras_data_reader import load_dict
from model.nlp.keras_data_reader import pad_sequence
from model.nlp.keras_data_reader import vectorize_words
fro... | 32.008264 | 95 | 0.52001 | import operator
import os
import tensorflow as tf
from keras.models import load_model
from model.nlp.keras_data_reader import load_dict
from model.nlp.keras_data_reader import pad_sequence
from model.nlp.keras_data_reader import vectorize_words
from utils.io_util import get_logger
logger = get_logger(__file__)
labe... | true | true |
f72dbd21266974dd5071e253cb4ab05797c2c1b1 | 146,647 | py | Python | test/test_fx.py | jiyuanzFB/pytorch | d047e475f830631d8fcc877ea17eac8fb34748d7 | [
"Intel"
] | 1 | 2022-03-08T14:43:39.000Z | 2022-03-08T14:43:39.000Z | test/test_fx.py | jiyuanzFB/pytorch | d047e475f830631d8fcc877ea17eac8fb34748d7 | [
"Intel"
] | null | null | null | test/test_fx.py | jiyuanzFB/pytorch | d047e475f830631d8fcc877ea17eac8fb34748d7 | [
"Intel"
] | null | null | null | # Owner(s): ["oncall: fx"]
import builtins
import contextlib
import copy
import functools
import inspect
import math
import numbers
import operator
import os
import pickle
import sys
import torch
import traceback
import typing
import types
import warnings
import unittest
from math import sqrt
from torch.multiprocessin... | 36.643428 | 128 | 0.585269 |
import builtins
import contextlib
import copy
import functools
import inspect
import math
import numbers
import operator
import os
import pickle
import sys
import torch
import traceback
import typing
import types
import warnings
import unittest
from math import sqrt
from torch.multiprocessing import Process
from torch... | true | true |
f72dbe45902a8df7047b55fff39c740679077883 | 2,057 | py | Python | tests/st/ops/cpu/test_smooth_l1_loss_grad_op.py | GuoSuiming/mindspore | 48afc4cfa53d970c0b20eedfb46e039db2a133d5 | [
"Apache-2.0"
] | 55 | 2020-12-17T10:26:06.000Z | 2022-03-28T07:18:26.000Z | tests/st/ops/cpu/test_smooth_l1_loss_grad_op.py | forwhat461/mindspore | 59a277756eb4faad9ac9afcc7fd526e8277d4994 | [
"Apache-2.0"
] | null | null | null | tests/st/ops/cpu/test_smooth_l1_loss_grad_op.py | forwhat461/mindspore | 59a277756eb4faad9ac9afcc7fd526e8277d4994 | [
"Apache-2.0"
] | 14 | 2021-01-29T02:39:47.000Z | 2022-03-23T05:00:26.000Z | # Copyright 2020 Huawei Technologies Co., Ltd
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to... | 33.177419 | 78 | 0.665046 |
import numpy as np
import pytest
import mindspore.context as context
import mindspore.nn as nn
from mindspore import Tensor
from mindspore.ops import operations as P
from mindspore.ops.composite import GradOperation
context.set_context(mode=context.GRAPH_MODE, device_target="CPU")
class Net(nn.Cell):
def __ini... | true | true |
f72dbe61d537c913f6fac5a7bb4dfb15ab49600c | 693 | py | Python | everyday_wechat/control/onewords/acib.py | youcailize/EverydayWechat | 59f0b1185ad1f84480bd1f2540e18271cc3d9185 | [
"MIT"
] | 1 | 2019-07-15T12:56:11.000Z | 2019-07-15T12:56:11.000Z | everyday_wechat/control/onewords/acib.py | youcailize/EverydayWechat | 59f0b1185ad1f84480bd1f2540e18271cc3d9185 | [
"MIT"
] | null | null | null | everyday_wechat/control/onewords/acib.py | youcailize/EverydayWechat | 59f0b1185ad1f84480bd1f2540e18271cc3d9185 | [
"MIT"
] | null | null | null | # coding=utf-8
"""
从词霸中获取每日一句,带英文。
"""
import requests
from everyday_wechat.utils.common import (
is_json
)
def get_acib_info():
"""
从词霸中获取每日一句,带英文。
:return:str ,返回每日一句(双语)
"""
print('获取格言信息(双语)...')
try:
resp = requests.get('http://open.iciba.com/dsapi')
if resp.status_co... | 21.65625 | 61 | 0.608947 |
import requests
from everyday_wechat.utils.common import (
is_json
)
def get_acib_info():
print('获取格言信息(双语)...')
try:
resp = requests.get('http://open.iciba.com/dsapi')
if resp.status_code == 200 and is_json(resp):
content_dict = resp.json()
content = content_dict.... | true | true |
f72dbf2909a71f1c80158d7c3570317e8c6a98fc | 1,132 | py | Python | examples/javascript/force.py | KmolYuan/networkx | 6bdcdcf07b9d84911697012a2c5833c62fa25992 | [
"BSD-3-Clause"
] | null | null | null | examples/javascript/force.py | KmolYuan/networkx | 6bdcdcf07b9d84911697012a2c5833c62fa25992 | [
"BSD-3-Clause"
] | null | null | null | examples/javascript/force.py | KmolYuan/networkx | 6bdcdcf07b9d84911697012a2c5833c62fa25992 | [
"BSD-3-Clause"
] | null | null | null | """
==========
Javascript
==========
Example of writing JSON format graph data and using the D3 Javascript library to produce an HTML/Javascript drawing.
"""
# Author: Aric Hagberg <aric.hagberg@gmail.com>
# Copyright (C) 2011-2018 by
# Aric Hagberg <hagberg@lanl.gov>
# Dan Schult <dschult@colgate.edu>
# ... | 26.952381 | 116 | 0.711131 |
import json
import flask
import networkx as nx
from networkx.readwrite import json_graph
G = nx.barbell_graph(6, 3)
for n in G:
G.nodes[n]['name'] = n
d = json_graph.node_link_data(G) json.dump(d, open('force/force.json', 'w'))
print('Wrote node-link JSON data to force/force.json')
app = flask.Flask(__name__, ... | true | true |
f72dbf9e2aef9ed659858bbdb150d757a67b6d8a | 1,648 | py | Python | config/wsgi.py | sahilpysquad/SMT | b03d5d2e32fcda26cdbae35588cfd0f785c02d3a | [
"MIT"
] | null | null | null | config/wsgi.py | sahilpysquad/SMT | b03d5d2e32fcda26cdbae35588cfd0f785c02d3a | [
"MIT"
] | 1 | 2022-03-30T20:23:58.000Z | 2022-03-30T20:23:58.000Z | config/wsgi.py | sahilpysquad/SMT | b03d5d2e32fcda26cdbae35588cfd0f785c02d3a | [
"MIT"
] | null | null | null | """
WSGI config for SMT project.
This module contains the WSGI application used by Django's development server
and any production WSGI deployments. It should expose a module-level variable
named ``application``. Django's ``runserver`` and ``runfcgi`` commands discover
this application via the ``WSGI_APPLICATION`` sett... | 42.25641 | 79 | 0.800971 | import os
import sys
from pathlib import Path
from django.core.wsgi import get_wsgi_application
ROOT_DIR = Path(__file__).resolve(strict=True).parent.parent
sys.path.append(str(ROOT_DIR / "smt"))
os.environ.setdefault("DJANGO_SETTINGS_MODULE", "config.settings.production")
# setting points here.
application = get_ws... | true | true |
f72dc035759b2fe9fbacf17e53f4c080e1eee636 | 277 | py | Python | swd_bot/editor/sprites/wonder_sprite.py | dfomin/7wd-bot | a152229a1758cab90d70fe893e2978516a38bacd | [
"MIT"
] | null | null | null | swd_bot/editor/sprites/wonder_sprite.py | dfomin/7wd-bot | a152229a1758cab90d70fe893e2978516a38bacd | [
"MIT"
] | null | null | null | swd_bot/editor/sprites/wonder_sprite.py | dfomin/7wd-bot | a152229a1758cab90d70fe893e2978516a38bacd | [
"MIT"
] | null | null | null | from pyglet.sprite import Sprite
from swd_bot.editor.sprite_loader import SpriteLoader
class WonderSprite(Sprite):
def __init__(self, wonder_id: int):
super().__init__(SpriteLoader.wonder(wonder_id))
self.scale = 0.5
self.wonder_id = wonder_id
| 21.307692 | 56 | 0.718412 | from pyglet.sprite import Sprite
from swd_bot.editor.sprite_loader import SpriteLoader
class WonderSprite(Sprite):
def __init__(self, wonder_id: int):
super().__init__(SpriteLoader.wonder(wonder_id))
self.scale = 0.5
self.wonder_id = wonder_id
| true | true |
f72dc0cd9eb65702353e75aef2a7ffc49d8d868f | 3,613 | py | Python | scrape_mars.py | skohtz1/web-scrapingHW | 11cf4686286a4fa51ef23a9e0afc5adca21f40c1 | [
"MIT"
] | null | null | null | scrape_mars.py | skohtz1/web-scrapingHW | 11cf4686286a4fa51ef23a9e0afc5adca21f40c1 | [
"MIT"
] | null | null | null | scrape_mars.py | skohtz1/web-scrapingHW | 11cf4686286a4fa51ef23a9e0afc5adca21f40c1 | [
"MIT"
] | null | null | null | from bs4 import BeautifulSoup
import requests
from splinter import Browser
import pandas as pd
import time
def init_browser():
# @NOTE: Replace the path with your actual path to the chromedriver
executable_path = {"executable_path": "./chromedriver"}
return Browser("chrome", **executable_path, headless=Fal... | 34.409524 | 205 | 0.673678 | from bs4 import BeautifulSoup
import requests
from splinter import Browser
import pandas as pd
import time
def init_browser():
executable_path = {"executable_path": "./chromedriver"}
return Browser("chrome", **executable_path, headless=False)
def scrape():
browser = init_browser()
url_nasa = "htt... | true | true |
f72dc0e9d331a618fb5b836f132c29eba750b4fb | 2,331 | py | Python | tests/smee/test_smee.py | andrew-mcgrath/zeroae-goblet | 711fb5f63714525bf20f98b2092ca89c77eb6c9a | [
"Apache-2.0"
] | 1 | 2021-03-11T23:04:21.000Z | 2021-03-11T23:04:21.000Z | tests/smee/test_smee.py | andrew-mcgrath/zeroae-goblet | 711fb5f63714525bf20f98b2092ca89c77eb6c9a | [
"Apache-2.0"
] | 12 | 2020-03-31T00:43:22.000Z | 2020-05-01T22:35:07.000Z | tests/smee/test_smee.py | andrew-mcgrath/zeroae-goblet | 711fb5f63714525bf20f98b2092ca89c77eb6c9a | [
"Apache-2.0"
] | null | null | null | # ------------------------------------------------------------------------------
# Copyright (c) 2020 Zero A.E., LLC.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.a... | 30.671053 | 87 | 0.597169 | import pytest
from click.testing import CliRunner
from zeroae.smee import cli
@pytest.fixture()
def smee_server_mock(requests_mock):
url = "mock://smee.io/new"
requests_mock.get(
url,
text="\n".join(
[
"event:ready\ndata:{}\n",
"event:ping\ndata:{}\... | true | true |
f72dc0f385c5eddcac7526a8a648ad7ab027af1b | 319 | py | Python | src/rtdb/admin.py | UNINETT/django-rtdb | a8af13c1756581fee0a02a9da9cbb4d252d77dab | [
"MIT"
] | null | null | null | src/rtdb/admin.py | UNINETT/django-rtdb | a8af13c1756581fee0a02a9da9cbb4d252d77dab | [
"MIT"
] | null | null | null | src/rtdb/admin.py | UNINETT/django-rtdb | a8af13c1756581fee0a02a9da9cbb4d252d77dab | [
"MIT"
] | null | null | null | from django.contrib import admin
from .models import (
Customfield,
CustomfieldValue,
Queue,
TicketCustomfieldValue,
Ticket,
)
admin.site.register(Customfield)
admin.site.register(CustomfieldValue)
admin.site.register(Queue)
admin.site.register(TicketCustomfieldValue)
admin.site.register(Ticket)
| 19.9375 | 43 | 0.780564 | from django.contrib import admin
from .models import (
Customfield,
CustomfieldValue,
Queue,
TicketCustomfieldValue,
Ticket,
)
admin.site.register(Customfield)
admin.site.register(CustomfieldValue)
admin.site.register(Queue)
admin.site.register(TicketCustomfieldValue)
admin.site.register(Ticket)
| true | true |
f72dc137ecb61c7cbc3546578c7ef0aae7aa9729 | 779 | py | Python | deps/src/boost_1_65_1/libs/parameter/test/python_test.py | shreyasvj25/turicreate | 32e84ca16aef8d04aff3d49ae9984bd49326bffd | [
"BSD-3-Clause"
] | 11,356 | 2017-12-08T19:42:32.000Z | 2022-03-31T16:55:25.000Z | deps/src/boost_1_65_1/libs/parameter/test/python_test.py | shreyasvj25/turicreate | 32e84ca16aef8d04aff3d49ae9984bd49326bffd | [
"BSD-3-Clause"
] | 2,402 | 2017-12-08T22:31:01.000Z | 2022-03-28T19:25:52.000Z | deps/src/boost_1_65_1/libs/parameter/test/python_test.py | shreyasvj25/turicreate | 32e84ca16aef8d04aff3d49ae9984bd49326bffd | [
"BSD-3-Clause"
] | 1,343 | 2017-12-08T19:47:19.000Z | 2022-03-26T11:31:36.000Z | # Copyright Daniel Wallin 2006. Distributed under the
# Boost Software License, Version 1.0. (See accompanying file
# LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
'''
>>> from python_test_ext import X
>>> x = X(y = 'baz')
>>> x.value
'foobaz'
>>> x.f(1,2)
3
>>> x.f(1,2,3)
6
>>> x.f(1,2, z = 3)
6
>>... | 18.547619 | 66 | 0.557125 |
def run(args = None):
if args is not None:
import sys
sys.argv = args
import doctest, python_test
return doctest.testmod(python_test)
if __name__ == '__main__':
import sys
sys.exit(run()[0])
| true | true |
f72dc1c2dc76d85adb0735b6801cc6df39987105 | 734 | py | Python | 11/test_cells.py | euribates/advent_of_code_2018 | 133fac9b01cf46edf9ec8c6ad9cef785d6858c70 | [
"MIT"
] | null | null | null | 11/test_cells.py | euribates/advent_of_code_2018 | 133fac9b01cf46edf9ec8c6ad9cef785d6858c70 | [
"MIT"
] | null | null | null | 11/test_cells.py | euribates/advent_of_code_2018 | 133fac9b01cf46edf9ec8c6ad9cef785d6858c70 | [
"MIT"
] | null | null | null | #!/usr/bin/env python3
import pytest
from tools import Cell
class Sample:
def __init__(self, serial, x, y, target):
self.serial = serial
self.x = x
self.y = y
self.target = target
def __str__(self):
return f'Cell at {self.x}x{self.y}, ' \
f'grid seri... | 19.315789 | 54 | 0.572207 |
import pytest
from tools import Cell
class Sample:
def __init__(self, serial, x, y, target):
self.serial = serial
self.x = x
self.y = y
self.target = target
def __str__(self):
return f'Cell at {self.x}x{self.y}, ' \
f'grid serial number {self.serial}... | true | true |
f72dc2158c5a2554b93e37af62704d6600ade621 | 7,011 | py | Python | Class Projects/CS545(MachineLearning)/qLearning/qlearn.py | Zosit/Useful-Reusable-Code | e5eab12f1ebcc6f16e456a7515ff8cc068b5ab16 | [
"MIT"
] | null | null | null | Class Projects/CS545(MachineLearning)/qLearning/qlearn.py | Zosit/Useful-Reusable-Code | e5eab12f1ebcc6f16e456a7515ff8cc068b5ab16 | [
"MIT"
] | null | null | null | Class Projects/CS545(MachineLearning)/qLearning/qlearn.py | Zosit/Useful-Reusable-Code | e5eab12f1ebcc6f16e456a7515ff8cc068b5ab16 | [
"MIT"
] | 1 | 2020-06-07T15:37:57.000Z | 2020-06-07T15:37:57.000Z | print(__doc__)
import matplotlib
# Force matplotlib to not use any Xwindows backend.
matplotlib.use('Agg')
import math
from decimal import *
import numpy as np
import matplotlib.pyplot as plt
from itertools import cycle
import pandas as pd
from matplotlib.backends.backend_pdf import PdfPages
import csv
from random... | 28.616327 | 305 | 0.602482 | print(__doc__)
import matplotlib
matplotlib.use('Agg')
import math
from decimal import *
import numpy as np
import matplotlib.pyplot as plt
from itertools import cycle
import pandas as pd
from matplotlib.backends.backend_pdf import PdfPages
import csv
from random import randint
EPISODE_COUNT = 5000
ACTION_COUNT... | true | true |
f72dc348256276279d0b58d7bb73672d0b303c5a | 99 | py | Python | releasenotes_project/releasenotes/apps.py | ajduncan/releasenotes | 9c97222a554f01c253e1ba07b3dbd67382edd5a9 | [
"MIT"
] | null | null | null | releasenotes_project/releasenotes/apps.py | ajduncan/releasenotes | 9c97222a554f01c253e1ba07b3dbd67382edd5a9 | [
"MIT"
] | null | null | null | releasenotes_project/releasenotes/apps.py | ajduncan/releasenotes | 9c97222a554f01c253e1ba07b3dbd67382edd5a9 | [
"MIT"
] | null | null | null | from django.apps import AppConfig
class ReleasenotesConfig(AppConfig):
name = 'releasenotes'
| 16.5 | 36 | 0.777778 | from django.apps import AppConfig
class ReleasenotesConfig(AppConfig):
name = 'releasenotes'
| true | true |
f72dc3ca8aa596b8bc7e93a42cd965a4678d9bb0 | 1,626 | py | Python | rates_classify/rdf.py | xhades/rates_classify | 225627dad22c162023bc6b5e4d8f5881c5a6f354 | [
"MIT"
] | 7 | 2017-12-23T05:34:01.000Z | 2021-01-03T10:10:03.000Z | rates_classify/rdf.py | xhades/rates_classify | 225627dad22c162023bc6b5e4d8f5881c5a6f354 | [
"MIT"
] | null | null | null | rates_classify/rdf.py | xhades/rates_classify | 225627dad22c162023bc6b5e4d8f5881c5a6f354 | [
"MIT"
] | 3 | 2019-05-23T20:15:44.000Z | 2020-01-14T07:27:58.000Z | # !/usr/bin/env python
# -*-coding:utf-8-*-
"""
@author: xhades
@Date: 2017/12/28
"""
# 随机森林分类器
import numpy as np
from numpy import *
from numpy import array, argmax
from sklearn.model_selection import train_test_split
from sklearn.preprocessing import LabelEncoder
import pickle
from sklearn.ensemble import Random... | 25.015385 | 114 | 0.673432 |
import numpy as np
from numpy import *
from numpy import array, argmax
from sklearn.model_selection import train_test_split
from sklearn.preprocessing import LabelEncoder
import pickle
from sklearn.ensemble import RandomForestClassifier as RDF
np.set_printoptions(threshold=np.inf)
def train(xFile, yFile):
wi... | true | true |
f72dc43a5ca4a9318d7545458b4eef42123d8e82 | 1,647 | py | Python | test/test_static_user_group.py | jensenbox/python-jamf | 85213085b1064a00375a7aa7df5e33c19f5178eb | [
"RSA-MD"
] | 1 | 2021-04-20T15:28:57.000Z | 2021-04-20T15:28:57.000Z | test/test_static_user_group.py | jensenbox/python-jamf | 85213085b1064a00375a7aa7df5e33c19f5178eb | [
"RSA-MD"
] | null | null | null | test/test_static_user_group.py | jensenbox/python-jamf | 85213085b1064a00375a7aa7df5e33c19f5178eb | [
"RSA-MD"
] | null | null | null | # coding: utf-8
"""
Jamf Pro API
## Overview This is a sample Jamf Pro server which allows for usage without any authentication. The Jamf Pro environment which supports the Try it Out functionality does not run the current beta version of Jamf Pro, thus any newly added endpoints will result in an error and sh... | 30.5 | 342 | 0.681846 |
from __future__ import absolute_import
import unittest
import datetime
import jamf
from jamf.models.static_user_group import StaticUserGroup from jamf.rest import ApiException
class TestStaticUserGroup(unittest.TestCase):
def setUp(self):
pass
def tearDown(self):
pass
def make_inst... | true | true |
f72dc5b5a14de2068f7204af961ecf443feaa41d | 2,652 | py | Python | IMLearn/learners/regressors/linear_regression.py | TomeRozen/IML.HUJI | 84b0d835a2a4dd4f52ea415e36382cb25a9eebdc | [
"MIT"
] | null | null | null | IMLearn/learners/regressors/linear_regression.py | TomeRozen/IML.HUJI | 84b0d835a2a4dd4f52ea415e36382cb25a9eebdc | [
"MIT"
] | null | null | null | IMLearn/learners/regressors/linear_regression.py | TomeRozen/IML.HUJI | 84b0d835a2a4dd4f52ea415e36382cb25a9eebdc | [
"MIT"
] | null | null | null | from __future__ import annotations
from typing import NoReturn
from ...base import BaseEstimator
import numpy as np
from numpy.linalg import pinv
class LinearRegression(BaseEstimator):
"""
Linear Regression Estimator
Solving Ordinary Least Squares optimization problem
"""
def __init__(self, inclu... | 29.142857 | 95 | 0.585596 | from __future__ import annotations
from typing import NoReturn
from ...base import BaseEstimator
import numpy as np
from numpy.linalg import pinv
class LinearRegression(BaseEstimator):
def __init__(self, include_intercept: bool = True) -> LinearRegression:
super().__init__()
self.include_intercept... | true | true |
f72dc75f35b28a2c6889223dac8aa63a7be15727 | 2,462 | py | Python | functional_tests/test_all_users.py | davidwurster/taskbuster_project | c9d624ac6cae20d2cd1dedec0236731a2c9e1822 | [
"MIT"
] | null | null | null | functional_tests/test_all_users.py | davidwurster/taskbuster_project | c9d624ac6cae20d2cd1dedec0236731a2c9e1822 | [
"MIT"
] | null | null | null | functional_tests/test_all_users.py | davidwurster/taskbuster_project | c9d624ac6cae20d2cd1dedec0236731a2c9e1822 | [
"MIT"
] | null | null | null | # -*- coding: utf-8 -*-
from datetime import date
from selenium import webdriver
from django.urls import reverse
from django.contrib.staticfiles.testing import StaticLiveServerTestCase
from django.utils.translation import activate
from django.utils import formats
class HomeNewVisitorTest(StaticLiveServerTestCase):
... | 38.46875 | 88 | 0.652315 | from datetime import date
from selenium import webdriver
from django.urls import reverse
from django.contrib.staticfiles.testing import StaticLiveServerTestCase
from django.utils.translation import activate
from django.utils import formats
class HomeNewVisitorTest(StaticLiveServerTestCase):
def setUp(self):
... | true | true |
f72dc763ddb11135ead84d926783faef8b242635 | 1,318 | py | Python | sleepless/tests/test_sleepless.py | Shagrat/eye-of-sauron | a80072f7af0fd6d324532eb405e831e34267d797 | [
"MIT"
] | null | null | null | sleepless/tests/test_sleepless.py | Shagrat/eye-of-sauron | a80072f7af0fd6d324532eb405e831e34267d797 | [
"MIT"
] | null | null | null | sleepless/tests/test_sleepless.py | Shagrat/eye-of-sauron | a80072f7af0fd6d324532eb405e831e34267d797 | [
"MIT"
] | null | null | null | import pytest
import os
from app import create_app
@pytest.fixture
def app(monkeypatch):
app = create_app()
monkeypatch.setenv('DATA_PATH', os.path.join(os.path.dirname(os.path.abspath(__file__)), 'sites.yml'))
app.config.update(
DATA_PATH=os.path.join(os.path.dirname(os.path.abspath(__file__)), '... | 25.346154 | 106 | 0.649469 | import pytest
import os
from app import create_app
@pytest.fixture
def app(monkeypatch):
app = create_app()
monkeypatch.setenv('DATA_PATH', os.path.join(os.path.dirname(os.path.abspath(__file__)), 'sites.yml'))
app.config.update(
DATA_PATH=os.path.join(os.path.dirname(os.path.abspath(__file__)), '... | true | true |
f72dc7d80a31456b6dd4baa949bea3ba0088d9b2 | 1,913 | py | Python | task_templates/pipelines/python3_calibrated_anomaly_detection/custom.py | amperie/user-models | 5236c50d0f20a7bac81acc5d1936a3502de2f5f3 | [
"Apache-2.0"
] | null | null | null | task_templates/pipelines/python3_calibrated_anomaly_detection/custom.py | amperie/user-models | 5236c50d0f20a7bac81acc5d1936a3502de2f5f3 | [
"Apache-2.0"
] | 9 | 2021-11-10T20:16:41.000Z | 2022-03-12T00:59:05.000Z | task_templates/pipelines/python3_calibrated_anomaly_detection/custom.py | amperie/user-models | 5236c50d0f20a7bac81acc5d1936a3502de2f5f3 | [
"Apache-2.0"
] | 1 | 2021-06-17T22:05:33.000Z | 2021-06-17T22:05:33.000Z | import pickle
from build_pipeline import make_anomaly
def fit(
X, output_dir, class_order=None, row_weights=None, **kwargs,
):
"""
This hook must be implemented with your fitting code, for running drum in the fit mode.
This hook MUST ALWAYS be implemented for custom tasks.
For inference models, t... | 46.658537 | 100 | 0.719289 | import pickle
from build_pipeline import make_anomaly
def fit(
X, output_dir, class_order=None, row_weights=None, **kwargs,
):
estimator = make_anomaly()
estimator.fit(X)
with open("{}/artifact.pkl".format(output_dir), "wb") as fp:
pickle.dump(estimator, fp)
| true | true |
f72dc8316a82c5f73e59a6498145758dff2e6fa1 | 345 | py | Python | python/ABC/2020-07-25_m-solutions2020/c.py | KATO-Hiro/atcoder-1 | c2cbfcfd5c3d46ac9810ba330a37d437aa2839c2 | [
"MIT"
] | null | null | null | python/ABC/2020-07-25_m-solutions2020/c.py | KATO-Hiro/atcoder-1 | c2cbfcfd5c3d46ac9810ba330a37d437aa2839c2 | [
"MIT"
] | null | null | null | python/ABC/2020-07-25_m-solutions2020/c.py | KATO-Hiro/atcoder-1 | c2cbfcfd5c3d46ac9810ba330a37d437aa2839c2 | [
"MIT"
] | null | null | null | import sys
input = sys.stdin.readline
def main():
N, K = map(int, input().split())
A = tuple(map(int, input().split()))
ans = [0] * (N - K)
for i in range(N - K):
if A[i] < A[K + i]:
ans[i] = "Yes"
else:
ans[i] = "No"
print("\n".join(ans))
if __name__ =... | 15.681818 | 40 | 0.449275 | import sys
input = sys.stdin.readline
def main():
N, K = map(int, input().split())
A = tuple(map(int, input().split()))
ans = [0] * (N - K)
for i in range(N - K):
if A[i] < A[K + i]:
ans[i] = "Yes"
else:
ans[i] = "No"
print("\n".join(ans))
if __name__ =... | true | true |
f72dc8a228a12c422d1e6298dc6947ac192397d0 | 1,682 | py | Python | idpay.py | amirhossein4778/idPay-python | f98ce8fb11c5e6d4a9f657032c98a4124106afc6 | [
"MIT"
] | 1 | 2021-01-18T10:22:27.000Z | 2021-01-18T10:22:27.000Z | idpay.py | amirhossein4778/idPay-python | f98ce8fb11c5e6d4a9f657032c98a4124106afc6 | [
"MIT"
] | null | null | null | idpay.py | amirhossein4778/idPay-python | f98ce8fb11c5e6d4a9f657032c98a4124106afc6 | [
"MIT"
] | null | null | null | import requests
import json
APIURL = "https://api.idpay.ir/v1.1/"
# You can get your Token from this url => https://idpay.ir/dashboard/web-services
TOKEN = "Your Token Here"
SANDBOX = str(1) # 1 or 0
Headers = {
"Content-Type": "application/json",
"X-SANDBOX":SANDBOX,
"X-API-KEY":TOKEN
}
... | 23.361111 | 93 | 0.565398 | import requests
import json
APIURL = "https://api.idpay.ir/v1.1/"
TOKEN = "Your Token Here"
SANDBOX = str(1)
Headers = {
"Content-Type": "application/json",
"X-SANDBOX":SANDBOX,
"X-API-KEY":TOKEN
}
def Payment(OrderId, Amount, Callback, Name = "", Mail="", Phone = "", Description=""):
... | true | true |
f72dc9fdc54892421b383d5dd9ff38be42fc2864 | 741 | py | Python | leadreader/db.py | raindrift/leadreader | c360630a75a149e20c9cf64bcb2c14646effb9ae | [
"MIT"
] | null | null | null | leadreader/db.py | raindrift/leadreader | c360630a75a149e20c9cf64bcb2c14646effb9ae | [
"MIT"
] | null | null | null | leadreader/db.py | raindrift/leadreader | c360630a75a149e20c9cf64bcb2c14646effb9ae | [
"MIT"
] | null | null | null | """
db.py
"""
from pymongo import MongoClient
class Db: # pylint: disable=too-few-public-methods
"""
Database.
Singleton pattern, from Bruce Eckel
"""
class __Db: # pylint: disable=invalid-name
def __init__(self, dbname):
self.val = dbname
self.client = MongoClien... | 23.903226 | 67 | 0.588394 | from pymongo import MongoClient
class Db: class __Db: def __init__(self, dbname):
self.val = dbname
self.client = MongoClient('mongodb://localhost:27017/')
self.conn = self.client['leadreader_' + dbname]
def __str__(self):
return repr(self) + self... | true | true |
f72dcb234b3e5c6c2045220639db1c2f9a81206a | 4,633 | py | Python | userbot/plugins/mega_downloader.py | staxx1/TurhanUser | 555e7e7a781104981b92e33bb9ad583b062bc14d | [
"MIT"
] | 5 | 2020-08-17T08:05:53.000Z | 2020-09-11T18:27:41.000Z | userbot/plugins/mega_downloader.py | staxx1/TurhanUser | 555e7e7a781104981b92e33bb9ad583b062bc14d | [
"MIT"
] | null | null | null | userbot/plugins/mega_downloader.py | staxx1/TurhanUser | 555e7e7a781104981b92e33bb9ad583b062bc14d | [
"MIT"
] | null | null | null | # Copyright (C) 2020 Adek Maulana.
# All rights reserved.
import json
import logging
import os
import re
import time
from os.path import exists
from subprocess import PIPE, Popen
from urllib.error import HTTPError
from pySmartDL import SmartDL
from uniborg.util import admin_cmd, humanbytes
logging.basicConfig(format... | 35.638462 | 81 | 0.575221 |
import json
import logging
import os
import re
import time
from os.path import exists
from subprocess import PIPE, Popen
from urllib.error import HTTPError
from pySmartDL import SmartDL
from uniborg.util import admin_cmd, humanbytes
logging.basicConfig(format='[%(levelname) 5s/%(asctime)s] %(name)s: %(message)s',
... | true | true |
f72dcb4220e85fb412fc4977dc976eacf47d6db8 | 2,737 | py | Python | tx_salaries/utils/transformers/beaumont_isd.py | texastribune/tx_salaries | 197d8da4e1783216830b8d0a5adb23c0200fd3e8 | [
"Apache-2.0"
] | 6 | 2016-05-18T05:53:44.000Z | 2019-06-13T18:27:50.000Z | tx_salaries/utils/transformers/beaumont_isd.py | texastribune/tx_salaries | 197d8da4e1783216830b8d0a5adb23c0200fd3e8 | [
"Apache-2.0"
] | 64 | 2015-02-13T18:29:04.000Z | 2018-06-15T19:48:56.000Z | tx_salaries/utils/transformers/beaumont_isd.py | texastribune/tx_salaries | 197d8da4e1783216830b8d0a5adb23c0200fd3e8 | [
"Apache-2.0"
] | 2 | 2015-05-08T19:22:12.000Z | 2016-07-11T16:57:49.000Z | from . import base
from . import mixins
from datetime import date
class TransformedRecord(
mixins.GenericCompensationMixin,
mixins.GenericDepartmentMixin, mixins.GenericIdentifierMixin,
mixins.GenericJobTitleMixin, mixins.GenericPersonMixin,
mixins.MembershipMixin, mixins.Organization... | 26.317308 | 106 | 0.606503 | from . import base
from . import mixins
from datetime import date
class TransformedRecord(
mixins.GenericCompensationMixin,
mixins.GenericDepartmentMixin, mixins.GenericIdentifierMixin,
mixins.GenericJobTitleMixin, mixins.GenericPersonMixin,
mixins.MembershipMixin, mixins.Organization... | true | true |
f72dcb7858ad4a4c4164a23285c83061503d7a74 | 15,494 | py | Python | plenum/test/consensus/order_service/test_ordering_service_on_view_change.py | jandayanan/indy-plenum | 2815e994404c77ad87eddcfd09062d5fe6efc1c5 | [
"Apache-2.0"
] | null | null | null | plenum/test/consensus/order_service/test_ordering_service_on_view_change.py | jandayanan/indy-plenum | 2815e994404c77ad87eddcfd09062d5fe6efc1c5 | [
"Apache-2.0"
] | null | null | null | plenum/test/consensus/order_service/test_ordering_service_on_view_change.py | jandayanan/indy-plenum | 2815e994404c77ad87eddcfd09062d5fe6efc1c5 | [
"Apache-2.0"
] | null | null | null | import pytest
from plenum.common.messages.internal_messages import ViewChangeStarted, NewViewAccepted, NewViewCheckpointsApplied
from plenum.common.messages.node_messages import OldViewPrePrepareRequest, OldViewPrePrepareReply
from plenum.common.util import updateNamedTuple
from plenum.server.consensus.batch_id import... | 46.528529 | 119 | 0.692526 | import pytest
from plenum.common.messages.internal_messages import ViewChangeStarted, NewViewAccepted, NewViewCheckpointsApplied
from plenum.common.messages.node_messages import OldViewPrePrepareRequest, OldViewPrePrepareReply
from plenum.common.util import updateNamedTuple
from plenum.server.consensus.batch_id import... | true | true |
f72dcdf889578279b6860c581fa614da112b719a | 8,112 | py | Python | fromage/utils/run_sequence.py | Yulin832/fromage | f6c84d5684ca5abfcc979540bb97cc8f105f963d | [
"MIT"
] | 14 | 2018-11-19T09:36:59.000Z | 2021-05-12T13:46:20.000Z | fromage/utils/run_sequence.py | Yulin832/fromage | f6c84d5684ca5abfcc979540bb97cc8f105f963d | [
"MIT"
] | 3 | 2020-01-22T17:26:38.000Z | 2020-07-21T14:23:52.000Z | fromage/utils/run_sequence.py | Yulin832/fromage | f6c84d5684ca5abfcc979540bb97cc8f105f963d | [
"MIT"
] | 9 | 2019-04-22T14:56:08.000Z | 2022-02-02T13:30:58.000Z | """Defines the Ewa object which interfaces with Ewald"""
import os
import subprocess
import time
import sys
import fromage.io.edit_file as ef
import fromage.io.read_file as rf
from fromage.scripts.fro_assign_charges import assign_charges
class RunSeq(object):
"""
Class which sets up the order of operations f... | 37.382488 | 147 | 0.608358 | import os
import subprocess
import time
import sys
import fromage.io.edit_file as ef
import fromage.io.read_file as rf
from fromage.scripts.fro_assign_charges import assign_charges
class RunSeq(object):
def __init__(self, region_1, cell, inputs):
self.region_1 = region_1
self.cell = cell
... | true | true |
f72dcefb884ae7a37171f07d40e607e0a565ea72 | 803 | py | Python | HW6/VeronyWise/task6.2.py | kolyasalubov/Lv-677.PythonCore | c9f9107c734a61e398154a90b8a3e249276c2704 | [
"MIT"
] | null | null | null | HW6/VeronyWise/task6.2.py | kolyasalubov/Lv-677.PythonCore | c9f9107c734a61e398154a90b8a3e249276c2704 | [
"MIT"
] | null | null | null | HW6/VeronyWise/task6.2.py | kolyasalubov/Lv-677.PythonCore | c9f9107c734a61e398154a90b8a3e249276c2704 | [
"MIT"
] | 6 | 2022-02-22T22:30:49.000Z | 2022-03-28T12:51:19.000Z | PI = 3.14
def rectangle_funk():
a = float(input("Please, enter first side of rectangle: "))
b = float(input("Please, enter second side of rectangle: "))
return a * b
def triangle_funk():
a = float(input("Please, enter side of triangle: "))
h = float(input("Please, enter height of triangle: "))... | 30.884615 | 80 | 0.622665 | PI = 3.14
def rectangle_funk():
a = float(input("Please, enter first side of rectangle: "))
b = float(input("Please, enter second side of rectangle: "))
return a * b
def triangle_funk():
a = float(input("Please, enter side of triangle: "))
h = float(input("Please, enter height of triangle: "))... | true | true |
f72dcf7abb7904d8b177a84c9aed4d7d56af6ce1 | 2,746 | py | Python | tests/test_vizplugin.py | dummyindex/viztracer | 73d7b9a1cdcd8f91ad6ef9dd522b6be94de22b4d | [
"Apache-2.0"
] | 1,798 | 2020-08-13T05:10:54.000Z | 2022-03-31T16:43:17.000Z | tests/test_vizplugin.py | dummyindex/viztracer | 73d7b9a1cdcd8f91ad6ef9dd522b6be94de22b4d | [
"Apache-2.0"
] | 185 | 2020-08-15T15:37:42.000Z | 2022-03-31T19:31:23.000Z | tests/test_vizplugin.py | dummyindex/viztracer | 73d7b9a1cdcd8f91ad6ef9dd522b6be94de22b4d | [
"Apache-2.0"
] | 100 | 2020-08-20T06:11:20.000Z | 2022-03-29T03:29:00.000Z | # Licensed under the Apache License: http://www.apache.org/licenses/LICENSE-2.0
# For details: https://github.com/gaogaotiantian/viztracer/blob/master/NOTICE.txt
from contextlib import redirect_stdout
import io
from .cmdline_tmpl import CmdlineTmpl
from viztracer import VizTracer
from viztracer.vizplugin import VizPl... | 31.204545 | 127 | 0.616533 |
from contextlib import redirect_stdout
import io
from .cmdline_tmpl import CmdlineTmpl
from viztracer import VizTracer
from viztracer.vizplugin import VizPluginBase, VizPluginError
class MyPlugin(VizPluginBase):
def __init__(self, terminate_well=True):
self.event_counter = 0
self.handler_trigger... | true | true |
f72dd1d6165a3a3ef372a83b1913c16b5e3470a6 | 3,636 | py | Python | pdm/models/caches.py | pohlt/pdm | f39be04b876f1fae572df33990a9325c79d8679f | [
"MIT"
] | null | null | null | pdm/models/caches.py | pohlt/pdm | f39be04b876f1fae572df33990a9325c79d8679f | [
"MIT"
] | null | null | null | pdm/models/caches.py | pohlt/pdm | f39be04b876f1fae572df33990a9325c79d8679f | [
"MIT"
] | null | null | null | import hashlib
import json
from pathlib import Path
from typing import TYPE_CHECKING, Dict, Optional
from pdm._types import CandidateInfo
from pdm.exceptions import CorruptedCacheError
from pdm.models import pip_shims
from pdm.utils import open_file
if TYPE_CHECKING:
from pip._vendor import requests
from pdm... | 33.357798 | 87 | 0.621837 | import hashlib
import json
from pathlib import Path
from typing import TYPE_CHECKING, Dict, Optional
from pdm._types import CandidateInfo
from pdm.exceptions import CorruptedCacheError
from pdm.models import pip_shims
from pdm.utils import open_file
if TYPE_CHECKING:
from pip._vendor import requests
from pdm... | true | true |
f72dd40cd6572923ea57e8bfdaec31d5b10e268a | 1,581 | py | Python | taskdo/urls.py | reven-tang/ITMP | 8d6686edb19fcc26c9cf1f7e14037f9d38a6e702 | [
"BSD-2-Clause"
] | null | null | null | taskdo/urls.py | reven-tang/ITMP | 8d6686edb19fcc26c9cf1f7e14037f9d38a6e702 | [
"BSD-2-Clause"
] | 11 | 2020-06-05T19:40:52.000Z | 2022-03-11T23:38:17.000Z | taskdo/urls.py | reven-tang/ITMP | 8d6686edb19fcc26c9cf1f7e14037f9d38a6e702 | [
"BSD-2-Clause"
] | null | null | null | """mysite URL Configuration
The `urlpatterns` list routes URLs to views. For more information please see:
https://docs.djangoproject.com/en/2.0/topics/http/urls/
Examples:
Function views
1. Add an import: from my_app import views
2. Add a URL to urlpatterns: path('', views.home, name='home')
Class-based ... | 43.916667 | 79 | 0.693865 | from django.conf.urls import url
from . import views
from django.conf.urls.static import static
from django.conf import settings
from mysite.utils.uploadfile import upload_file
app_name = 'taskdo'
urlpatterns = [
url(r'^$', views.taskdo, name='taskdo'),
url(r'^deploy', views.deploy, name='deploy'),
url(r'^... | true | true |
f72dd5d068e536c1623eb55e84023e8a824941d4 | 686 | py | Python | app/core/migrations/0003_ingredient.py | kyuds/recipe-app | b697b4d471d5352144e0b2549904c09ea125e47e | [
"MIT"
] | null | null | null | app/core/migrations/0003_ingredient.py | kyuds/recipe-app | b697b4d471d5352144e0b2549904c09ea125e47e | [
"MIT"
] | null | null | null | app/core/migrations/0003_ingredient.py | kyuds/recipe-app | b697b4d471d5352144e0b2549904c09ea125e47e | [
"MIT"
] | null | null | null | # Generated by Django 2.1.15 on 2022-01-18 04:15
from django.conf import settings
from django.db import migrations, models
import django.db.models.deletion
class Migration(migrations.Migration):
dependencies = [
('core', '0002_tag'),
]
operations = [
migrations.CreateModel(
... | 28.583333 | 118 | 0.618076 |
from django.conf import settings
from django.db import migrations, models
import django.db.models.deletion
class Migration(migrations.Migration):
dependencies = [
('core', '0002_tag'),
]
operations = [
migrations.CreateModel(
name='Ingredient',
fields=[
... | true | true |
f72dd6a26dd85a10f064ecb0503c18adbf76e449 | 12,860 | py | Python | src/awsstepfuncs/choice.py | suzil/awsstepfuncs | dd195b54bf8eaa381ea07244b276db6a1e82007b | [
"MIT"
] | 3 | 2020-11-29T18:31:50.000Z | 2021-01-14T07:46:40.000Z | src/awsstepfuncs/choice.py | suzil/aws-step-functions | dd195b54bf8eaa381ea07244b276db6a1e82007b | [
"MIT"
] | 54 | 2020-10-17T13:30:05.000Z | 2020-10-28T01:46:59.000Z | src/awsstepfuncs/choice.py | suzil/aws-step-functions | dd195b54bf8eaa381ea07244b276db6a1e82007b | [
"MIT"
] | 1 | 2021-08-04T04:40:27.000Z | 2021-08-04T04:40:27.000Z | from __future__ import annotations
from abc import ABC
from enum import Enum
from typing import Any, List, Union
from awsstepfuncs.abstract_state import AbstractState
from awsstepfuncs.errors import AWSStepFuncsValueError
from awsstepfuncs.reference_path import ReferencePath
class DataTestExpressionType(Enum):
... | 36.742857 | 137 | 0.676594 | from __future__ import annotations
from abc import ABC
from enum import Enum
from typing import Any, List, Union
from awsstepfuncs.abstract_state import AbstractState
from awsstepfuncs.errors import AWSStepFuncsValueError
from awsstepfuncs.reference_path import ReferencePath
class DataTestExpressionType(Enum):
... | true | true |
f72dd6ad9f38ef2c2c9a2d3c9ba175b13446494f | 296 | py | Python | app/user/urls.py | sadijrp/recipe-api | 015b47850e351d932737b16158fda38e5b4f97a0 | [
"MIT"
] | null | null | null | app/user/urls.py | sadijrp/recipe-api | 015b47850e351d932737b16158fda38e5b4f97a0 | [
"MIT"
] | null | null | null | app/user/urls.py | sadijrp/recipe-api | 015b47850e351d932737b16158fda38e5b4f97a0 | [
"MIT"
] | null | null | null | from django.urls import path
from . import views
app_name = 'user'
urlpatterns = [
path('create/', views.CreateUserView.as_view(), name='create'),
path('token/', views.CreateTokenView.as_view(), name='token'),
path('me/', views.ManageUserView.as_view(), name='me'),
]
| 22.769231 | 68 | 0.64527 | from django.urls import path
from . import views
app_name = 'user'
urlpatterns = [
path('create/', views.CreateUserView.as_view(), name='create'),
path('token/', views.CreateTokenView.as_view(), name='token'),
path('me/', views.ManageUserView.as_view(), name='me'),
]
| true | true |
f72dd71c29167635a4412fa663eb4990775e416a | 25,028 | py | Python | packages/Qpyl/core/qtopology.py | mpurg/qtools | 48fed120449b2cb288a55489313ab2d13bc28b57 | [
"MIT"
] | 14 | 2017-03-14T10:44:07.000Z | 2022-03-08T14:27:39.000Z | packages/Qpyl/core/qtopology.py | mpurg/qtools | 48fed120449b2cb288a55489313ab2d13bc28b57 | [
"MIT"
] | 26 | 2017-03-10T12:34:03.000Z | 2020-09-15T13:46:58.000Z | packages/Qpyl/core/qtopology.py | mpurg/qtools | 48fed120449b2cb288a55489313ab2d13bc28b57 | [
"MIT"
] | 9 | 2017-05-20T04:53:53.000Z | 2021-11-04T01:13:22.000Z | #!/usr/bin/env python
# -*- coding: utf-8 -*-
#
# MIT License
#
# Copyright (c) 2018 Miha Purg <miha.purg@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, in... | 37.63609 | 89 | 0.51798 |
from __future__ import absolute_import, unicode_literals, division
from Qpyl.core import qlibrary
from Qpyl.core import qparameter
from Qpyl.core import qstructure
from Qpyl.core import qpotential
from six.moves import range
class QTopologyError(Exception):
pass
class QTopology(object):
def __init__(self, q... | true | true |
f72dd7ee45a1a5417dd550741777c145ca6add1c | 5,936 | py | Python | isensus/.warnings/warnings.py | MPI-IS/isensus | 23171afc7f5b1d2b322a4ab2ef274d5bd3457fdc | [
"BSD-3-Clause"
] | null | null | null | isensus/.warnings/warnings.py | MPI-IS/isensus | 23171afc7f5b1d2b322a4ab2ef274d5bd3457fdc | [
"BSD-3-Clause"
] | null | null | null | isensus/.warnings/warnings.py | MPI-IS/isensus | 23171afc7f5b1d2b322a4ab2ef274d5bd3457fdc | [
"BSD-3-Clause"
] | null | null | null | import inspect
class Warnings:
def __init__(self, config, user_data):
self._config = config
self._user_data = user_data
def _get_warnings(warnings_instance):
"""
returns a list of the returned value of
all private functions of warnings_instance
"""
# all functions of this cla... | 29.386139 | 84 | 0.626179 | import inspect
class Warnings:
def __init__(self, config, user_data):
self._config = config
self._user_data = user_data
def _get_warnings(warnings_instance):
warning_functions = inspect.getmembers(
warnings_instance.__class__, predicate=inspect.isfunction
)
warnin... | true | true |
f72dd948e5a154151ffe73b2af697605d2a92f7f | 61,972 | py | Python | mmdet3d/datasets/pipelines/transforms_3d.py | xizaoqu/mmdetection3d | 1809f9650de95d7bc80035787b09e3b69390b702 | [
"Apache-2.0"
] | null | null | null | mmdet3d/datasets/pipelines/transforms_3d.py | xizaoqu/mmdetection3d | 1809f9650de95d7bc80035787b09e3b69390b702 | [
"Apache-2.0"
] | null | null | null | mmdet3d/datasets/pipelines/transforms_3d.py | xizaoqu/mmdetection3d | 1809f9650de95d7bc80035787b09e3b69390b702 | [
"Apache-2.0"
] | null | null | null | # Copyright (c) OpenMMLab. All rights reserved.
import numpy as np
import warnings
from mmcv import is_tuple_of
from mmcv.utils import build_from_cfg
from mmdet3d.core import VoxelGenerator
from mmdet3d.core.bbox import (CameraInstance3DBoxes, DepthInstance3DBoxes,
LiDARInstance3DBoxes, ... | 39.522959 | 79 | 0.613793 | import numpy as np
import warnings
from mmcv import is_tuple_of
from mmcv.utils import build_from_cfg
from mmdet3d.core import VoxelGenerator
from mmdet3d.core.bbox import (CameraInstance3DBoxes, DepthInstance3DBoxes,
LiDARInstance3DBoxes, box_np_ops)
from mmdet.datasets.builder import P... | true | true |
f72dd94c7d1ce9df355532696ed084fa0a0a4f4d | 3,081 | py | Python | src/opencv_backend/ui.py | AidenPearce7/python-tictactoe | 1f5aaaca87bfb8487a1366b4bc2bd567df8feb5e | [
"Apache-1.1"
] | null | null | null | src/opencv_backend/ui.py | AidenPearce7/python-tictactoe | 1f5aaaca87bfb8487a1366b4bc2bd567df8feb5e | [
"Apache-1.1"
] | 8 | 2021-05-14T10:24:43.000Z | 2021-07-04T21:40:03.000Z | src/opencv_backend/ui.py | AidenPearce7/python-tictactoe | 1f5aaaca87bfb8487a1366b4bc2bd567df8feb5e | [
"Apache-1.1"
] | 2 | 2021-05-27T16:59:57.000Z | 2021-06-07T11:03:30.000Z | """UI class"""
import cv2 as cv
import numpy as np
class UI:
"""Handles UI drawing and managing"""
def __init__(self, frame):
height, width, channels = frame.shape
self.width = width
self.height = height
self.separators = {
"y": (0, height // 3, 2 * height // 3),
... | 41.08 | 87 | 0.576761 | import cv2 as cv
import numpy as np
class UI:
def __init__(self, frame):
height, width, channels = frame.shape
self.width = width
self.height = height
self.separators = {
"y": (0, height // 3, 2 * height // 3),
"x": (0, width // 3, 2 * width // 3),
... | true | true |
f72dda423a62d469f02bca3f143c9ab93ba3aec2 | 3,558 | py | Python | src/qna.py | ithaaswin/TeachersPetBot | e826083b64ea6ab78a223635fcb1d7881ba8b082 | [
"MIT"
] | null | null | null | src/qna.py | ithaaswin/TeachersPetBot | e826083b64ea6ab78a223635fcb1d7881ba8b082 | [
"MIT"
] | 57 | 2021-10-31T23:15:20.000Z | 2021-11-15T18:10:41.000Z | src/qna.py | chandur626/TeachersPetBot | ad1fd36be5bd3690949d0e3a6e29c9100bf43e15 | [
"MIT"
] | 5 | 2021-11-17T23:21:01.000Z | 2021-11-30T03:44:05.000Z | ###########################
# Implements Q and A functionality
###########################
from discord import NotFound
import db
# keep track of next question number
QUESTION_NUMBER = 1
# dictionary of questions with answers
QNA = {}
###########################
# Class: QuestionsAnswers
# Description: object with q... | 29.89916 | 82 | 0.59837 | from discord import NotFound
import db
QUESTION_NUMBER = 1
QNA = {}
class QuestionsAnswers:
def __init__(self, qs, number, message, ans):
self.question = qs
self.number = number
self.msg = message
self.answer = ans
async def question(ctx, qs):
global QUESTION_NUMBER
... | true | true |
f72ddac9ba01a301e98f3c344bf12ac75b9ae4c9 | 5,610 | py | Python | gammapy/astro/population/tests/test_simulate.py | gabemery/gammapy | 99e5c5d38e4920dddd7bca41fb1539ccda8bea2d | [
"BSD-3-Clause"
] | null | null | null | gammapy/astro/population/tests/test_simulate.py | gabemery/gammapy | 99e5c5d38e4920dddd7bca41fb1539ccda8bea2d | [
"BSD-3-Clause"
] | null | null | null | gammapy/astro/population/tests/test_simulate.py | gabemery/gammapy | 99e5c5d38e4920dddd7bca41fb1539ccda8bea2d | [
"BSD-3-Clause"
] | null | null | null | # Licensed under a 3-clause BSD style license - see LICENSE.rst
from __future__ import absolute_import, division, print_function, unicode_literals
from numpy.testing import assert_allclose
from astropy.table import Table
import astropy.units as u
from ....utils.testing import requires_dependency
from ...population impo... | 35.732484 | 83 | 0.694474 | from __future__ import absolute_import, division, print_function, unicode_literals
from numpy.testing import assert_allclose
from astropy.table import Table
import astropy.units as u
from ....utils.testing import requires_dependency
from ...population import (
make_base_catalog_galactic,
make_catalog_random_pos... | true | true |
f72ddb30bb43ae6eef900ba6d2bac985e88bdce3 | 329 | py | Python | Courses/100 Days of Code The Complete Python Pro Bootcamp/Day 6/Hurdle 4.py | edaaydinea/365-days-of-coding-challenge | baf06a9bef75ff45194e57357e20085b9cde2498 | [
"MIT"
] | 4 | 2022-01-05T12:14:13.000Z | 2022-01-08T16:03:32.000Z | Courses/100 Days of Code The Complete Python Pro Bootcamp/Day 6/Hurdle 4.py | edaaydinea/365-days-of-code | baf06a9bef75ff45194e57357e20085b9cde2498 | [
"MIT"
] | null | null | null | Courses/100 Days of Code The Complete Python Pro Bootcamp/Day 6/Hurdle 4.py | edaaydinea/365-days-of-code | baf06a9bef75ff45194e57357e20085b9cde2498 | [
"MIT"
] | null | null | null | def turn_right():
turn_left()
turn_left()
turn_left()
def jump():
turn_left()
while wall_on_right():
move()
turn_right()
move()
turn_right()
while front_is_clear():
move()
turn_left()
while not at_goal():
if wall_in_front():
jump()
else:
... | 13.708333 | 27 | 0.534954 | def turn_right():
turn_left()
turn_left()
turn_left()
def jump():
turn_left()
while wall_on_right():
move()
turn_right()
move()
turn_right()
while front_is_clear():
move()
turn_left()
while not at_goal():
if wall_in_front():
jump()
else:
... | true | true |
f72ddc020a4220657c0534fd213d5960651ecb30 | 1,367 | py | Python | prismriver/plugin/lyrster.py | anlar/prismriver-lyrics | b9adb7f860fc5bf0fc41029a8e9e472aa262a0f4 | [
"MIT"
] | 16 | 2016-11-08T03:31:37.000Z | 2021-11-17T20:00:56.000Z | prismriver/plugin/lyrster.py | odrling/prismriver-lyrics | 995b687b1e795298ce5e31348120c510f99a378f | [
"MIT"
] | 5 | 2016-06-14T19:59:57.000Z | 2021-01-24T10:35:43.000Z | prismriver/plugin/lyrster.py | odrling/prismriver-lyrics | 995b687b1e795298ce5e31348120c510f99a378f | [
"MIT"
] | 5 | 2016-06-14T18:01:20.000Z | 2021-02-24T05:52:31.000Z | from prismriver.plugin.common import Plugin
from prismriver.struct import Song
class LyrsterPlugin(Plugin):
ID = 'lyrster'
def __init__(self, config):
super(LyrsterPlugin, self).__init__('Lyrster', config)
def search_song(self, artist, title):
to_delete = ["'", '!', '(', ')', '[', ']']
... | 35.973684 | 114 | 0.588881 | from prismriver.plugin.common import Plugin
from prismriver.struct import Song
class LyrsterPlugin(Plugin):
ID = 'lyrster'
def __init__(self, config):
super(LyrsterPlugin, self).__init__('Lyrster', config)
def search_song(self, artist, title):
to_delete = ["'", '!', '(', ')', '[', ']']
... | true | true |
f72ddc8c25b9c4148bc113d6447b20acd94bf3ee | 100,225 | py | Python | manila/tests/db/migrations/alembic/migrations_data_checks.py | inspur-storage/manila | 0f8cc58e9454643b492b18c6284f6b0bc4aa311b | [
"Apache-2.0"
] | 3 | 2016-06-06T13:05:00.000Z | 2021-05-05T04:29:24.000Z | manila/tests/db/migrations/alembic/migrations_data_checks.py | ljzjohnson/manila | 7f990ffa16117769f7616779dd94f81c8d676511 | [
"Apache-2.0"
] | null | null | null | manila/tests/db/migrations/alembic/migrations_data_checks.py | ljzjohnson/manila | 7f990ffa16117769f7616779dd94f81c8d676511 | [
"Apache-2.0"
] | null | null | null | # Copyright 2015 Mirantis inc.
# All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance with the License. You may obtain
# a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by... | 39.074074 | 79 | 0.606835 |
import abc
import datetime
from oslo_db import exception as oslo_db_exc
from oslo_utils import uuidutils
import six
from sqlalchemy import exc as sa_exc
from manila.common import constants
from manila.db.migrations import utils
class DbMigrationsData(object):
migration_mappings = {}
methods_mapping = {
... | true | true |
f72ddd7241194452b55a3968e1f8f4807cdc48eb | 1,166 | py | Python | pact/test/test_constants.py | dwang7/pact-python | da03551e812508652e062fc4ba6071f1119e5bf2 | [
"MIT"
] | null | null | null | pact/test/test_constants.py | dwang7/pact-python | da03551e812508652e062fc4ba6071f1119e5bf2 | [
"MIT"
] | null | null | null | pact/test/test_constants.py | dwang7/pact-python | da03551e812508652e062fc4ba6071f1119e5bf2 | [
"MIT"
] | null | null | null | from unittest import TestCase
from mock import patch
from .. import constants
class mock_service_exeTestCase(TestCase):
def setUp(self):
super(mock_service_exeTestCase, self).setUp()
self.addCleanup(patch.stopall)
self.mock_os = patch.object(constants, 'os', autospec=True).start()
d... | 30.684211 | 79 | 0.679245 | from unittest import TestCase
from mock import patch
from .. import constants
class mock_service_exeTestCase(TestCase):
def setUp(self):
super(mock_service_exeTestCase, self).setUp()
self.addCleanup(patch.stopall)
self.mock_os = patch.object(constants, 'os', autospec=True).start()
d... | true | true |
f72de033c98b828eeb36b1cc7ae17401f85d1ae6 | 2,806 | py | Python | pygext/taskmanager.py | chandler14362/pygext | b90b4c5727d2b6ac98fcbc096159050c266f105e | [
"MIT"
] | 1 | 2018-03-09T12:09:55.000Z | 2018-03-09T12:09:55.000Z | pygext/taskmanager.py | chandler14362/pygext | b90b4c5727d2b6ac98fcbc096159050c266f105e | [
"MIT"
] | 1 | 2015-03-14T00:50:30.000Z | 2015-03-14T00:50:30.000Z | pygext/taskmanager.py | chandler14362/pygext | b90b4c5727d2b6ac98fcbc096159050c266f105e | [
"MIT"
] | null | null | null | __author__ = 'stowellc17'
from twisted.internet.error import AlreadyCalled
from twisted.internet.task import LoopingCall
from twisted.internet import reactor
from pygext.notifier import global_notify
TASK_DONE = 0
TASK_AGAIN = 1
class Task:
notify = global_notify.new_category('Task')
def __init__(self, ... | 25.053571 | 99 | 0.59052 | __author__ = 'stowellc17'
from twisted.internet.error import AlreadyCalled
from twisted.internet.task import LoopingCall
from twisted.internet import reactor
from pygext.notifier import global_notify
TASK_DONE = 0
TASK_AGAIN = 1
class Task:
notify = global_notify.new_category('Task')
def __init__(self, ... | true | true |
f72de052359df817fc0ec946f2134f2ca26b6137 | 436 | py | Python | storage/database-cookbook/relational/sqlite/connection_sqlite.py | brunocampos01/job-challenges | 62cb3b63bec1659fe3dbb9c68afa9a0e19bdebcc | [
"MIT"
] | 1 | 2022-01-09T03:18:45.000Z | 2022-01-09T03:18:45.000Z | storage/database-cookbook/relational/sqlite/connection_sqlite.py | brunocampos01/job-challenges | 62cb3b63bec1659fe3dbb9c68afa9a0e19bdebcc | [
"MIT"
] | null | null | null | storage/database-cookbook/relational/sqlite/connection_sqlite.py | brunocampos01/job-challenges | 62cb3b63bec1659fe3dbb9c68afa9a0e19bdebcc | [
"MIT"
] | 1 | 2022-01-07T21:04:45.000Z | 2022-01-07T21:04:45.000Z | import sqlite3
conn = sqlite3.connect("users.db")
# You can also supply the special name :memory: to create a temporary database in RAM
# conn = sqlite3.connect(':memory:')
c = conn.cursor()
c.execute("CREATE TABLE user (name text, age integer)")
c.execute("INSERT INTO user VALUES ('User A', 42)")
c.execute("INSER... | 22.947368 | 85 | 0.701835 | import sqlite3
conn = sqlite3.connect("users.db")
c = conn.cursor()
c.execute("CREATE TABLE user (name text, age integer)")
c.execute("INSERT INTO user VALUES ('User A', 42)")
c.execute("INSERT INTO user VALUES ('User B', 43)")
conn.commit()
c.execute("SELECT * FROM user")
print(c.fetchall())
conn.close()
| true | true |
f72de06c4b741bccbe2f6e564e84f5ba0d6b7d31 | 845 | py | Python | scisalt/matplotlib/plot.py | joelfrederico/mytools | 7bf57c49c7dde0a8b0aa337fbd2fbd527ce7a67f | [
"MIT"
] | 1 | 2021-03-31T23:27:09.000Z | 2021-03-31T23:27:09.000Z | scisalt/matplotlib/plot.py | joelfrederico/mytools | 7bf57c49c7dde0a8b0aa337fbd2fbd527ce7a67f | [
"MIT"
] | null | null | null | scisalt/matplotlib/plot.py | joelfrederico/mytools | 7bf57c49c7dde0a8b0aa337fbd2fbd527ce7a67f | [
"MIT"
] | null | null | null | import os as _os
_on_rtd = _os.environ.get('READTHEDOCS', None) == 'True'
if not _on_rtd:
import matplotlib.pyplot as _plt
import numpy as _np
from .setup_axes import setup_axes as _setup_axes
def plot(*args, ax=None, **kwargs):
"""
Plots but automatically resizes x axis.
.. versionadded:: 1.4
... | 22.236842 | 56 | 0.584615 | import os as _os
_on_rtd = _os.environ.get('READTHEDOCS', None) == 'True'
if not _on_rtd:
import matplotlib.pyplot as _plt
import numpy as _np
from .setup_axes import setup_axes as _setup_axes
def plot(*args, ax=None, **kwargs):
if ax is None:
fig, ax = _setup_axes()
pl = ax.plot(*args, **kw... | true | true |
f72de0ea6a751f43e43a7090b6c6bc5b3a4e04ab | 19,297 | py | Python | da/compiler/ui.py | edgarsit/distalgo | 87a53b537c2ae9d974fb2f5f7ba95eaa92a9806e | [
"MIT"
] | 76 | 2015-05-27T01:22:38.000Z | 2022-02-28T18:38:55.000Z | da/compiler/ui.py | edgarsit/distalgo | 87a53b537c2ae9d974fb2f5f7ba95eaa92a9806e | [
"MIT"
] | 32 | 2015-09-19T01:37:36.000Z | 2021-02-17T03:04:56.000Z | da/compiler/ui.py | edgarsit/distalgo | 87a53b537c2ae9d974fb2f5f7ba95eaa92a9806e | [
"MIT"
] | 55 | 2015-08-10T01:42:16.000Z | 2021-11-15T10:37:32.000Z | # Copyright (c) 2010-2017 Bo Lin
# Copyright (c) 2010-2017 Yanhong Annie Liu
# Copyright (c) 2010-2017 Stony Brook University
# Copyright (c) 2010-2017 The Research Foundation of SUNY
#
# Permission is hereby granted, free of charge, to any person
# obtaining a copy of this software and associated documentation files
#... | 40.202083 | 84 | 0.630513 |
import os
import os.path
import ast
import sys
import time
import argparse
from .. import __version__
from ..importer import da_cache_from_source
from .utils import is_valid_debug_level, set_debug_level, to_source, to_file
from .parser import daast_from_file
from .parser import daast_from_str
from .pygen import Pytho... | true | true |
f72de425aeaa5252f36d4ae7e4afd2f59fe3e6a5 | 17,897 | py | Python | eve/io/base.py | mdhaman/eve | 646ad5713b7baaffd0daee25a724edb722cc7a91 | [
"BSD-3-Clause"
] | 1 | 2017-10-31T17:36:58.000Z | 2017-10-31T17:36:58.000Z | eve/io/base.py | nitecoder/eve | d859e60b41a4e95f9b7b8606e173790b7b8d0bc6 | [
"BSD-3-Clause"
] | null | null | null | eve/io/base.py | nitecoder/eve | d859e60b41a4e95f9b7b8606e173790b7b8d0bc6 | [
"BSD-3-Clause"
] | null | null | null | # -*- coding: utf-8 -*-
"""
eve.io.base
~~~~~~~~~~~
Standard interface implemented by Eve data layers.
:copyright: (c) 2014 by Nicola Iarocci.
:license: BSD, see LICENSE for more details.
"""
import datetime
import simplejson as json
from copy import copy
from flask import request, abort
from eve... | 40.767654 | 79 | 0.605073 |
import datetime
import simplejson as json
from copy import copy
from flask import request, abort
from eve.utils import date_to_str
from eve.auth import auth_field_and_value
from eve.utils import config, debug_error_message, auto_fields
class BaseJSONEncoder(json.JSONEncoder):
def default(self, obj):
if i... | true | true |
f72de4edec828d37bb804254c422746c7c0e35f7 | 5,502 | py | Python | allennlp/data/fields/sequence_label_field.py | purnendu91/allennlp | 7bdc142f3fba9b4b751be4de51299858613f134f | [
"Apache-2.0"
] | null | null | null | allennlp/data/fields/sequence_label_field.py | purnendu91/allennlp | 7bdc142f3fba9b4b751be4de51299858613f134f | [
"Apache-2.0"
] | null | null | null | allennlp/data/fields/sequence_label_field.py | purnendu91/allennlp | 7bdc142f3fba9b4b751be4de51299858613f134f | [
"Apache-2.0"
] | null | null | null | from typing import Dict, List, Union, Set
import logging
from overrides import overrides
import torch
from torch.autograd import Variable
from allennlp.common.checks import ConfigurationError
from allennlp.common.util import pad_sequence_to_length
from allennlp.data.fields.field import Field
from allennlp.data.fields... | 50.018182 | 112 | 0.661032 | from typing import Dict, List, Union, Set
import logging
from overrides import overrides
import torch
from torch.autograd import Variable
from allennlp.common.checks import ConfigurationError
from allennlp.common.util import pad_sequence_to_length
from allennlp.data.fields.field import Field
from allennlp.data.fields... | true | true |
f72de5318f9d64110e0d3a420ec657838b3aa7e8 | 1,502 | py | Python | networks/60lines.py | eym55/power_grid_sim | 35822a2d2f09c00a38841e0bf3395bc5ea0ddbaa | [
"MIT"
] | 1 | 2022-01-26T15:19:15.000Z | 2022-01-26T15:19:15.000Z | networks/60lines.py | eym55/power_grid_sim | 35822a2d2f09c00a38841e0bf3395bc5ea0ddbaa | [
"MIT"
] | null | null | null | networks/60lines.py | eym55/power_grid_sim | 35822a2d2f09c00a38841e0bf3395bc5ea0ddbaa | [
"MIT"
] | null | null | null | import pypsa
import numpy as np
import random
import matplotlib.pyplot as plt
random.seed(69)
network = pypsa.Network()
for i in range(30):
network.add("Bus","Bus {}".format(i))
for i in range(30):
network.buses.at[network.buses.index[i], 'x'] = random.randint(0,100)
network.buses.at[network.buses.index[i... | 35.761905 | 92 | 0.496671 | import pypsa
import numpy as np
import random
import matplotlib.pyplot as plt
random.seed(69)
network = pypsa.Network()
for i in range(30):
network.add("Bus","Bus {}".format(i))
for i in range(30):
network.buses.at[network.buses.index[i], 'x'] = random.randint(0,100)
network.buses.at[network.buses.index[i... | true | true |
f72de71bd4141843c398b8f069d0199f6aefb8dd | 37 | py | Python | DaysOfCode/__main__.py | PeterMcD/100-Days-Of-Code-Cli-Tool | cea1be23cd314a5421a3c9ae4587769d6bb75e77 | [
"MIT"
] | null | null | null | DaysOfCode/__main__.py | PeterMcD/100-Days-Of-Code-Cli-Tool | cea1be23cd314a5421a3c9ae4587769d6bb75e77 | [
"MIT"
] | 4 | 2019-01-04T01:49:17.000Z | 2019-01-11T18:22:58.000Z | DaysOfCode/__main__.py | petermcd/100-Days-Of-Code-Cli-Tool | cea1be23cd314a5421a3c9ae4587769d6bb75e77 | [
"MIT"
] | null | null | null | from .bootstrap import main
main()
| 7.4 | 27 | 0.72973 | from .bootstrap import main
main()
| true | true |
f72de7d26b34833391adceb3f86898a1586662a4 | 468 | py | Python | Project_google_task_usage/task_uasge_500_preprocess/data_inverse.py | sssssch/jupyter-examples | cf9e26e22dcfa263bcd26323527911cdbcc2cd61 | [
"MIT"
] | 2 | 2020-07-29T13:07:52.000Z | 2021-01-15T09:22:07.000Z | Project_google_task_usage/task_uasge_500_preprocess/data_inverse.py | sssssch/jupyter-examples | cf9e26e22dcfa263bcd26323527911cdbcc2cd61 | [
"MIT"
] | null | null | null | Project_google_task_usage/task_uasge_500_preprocess/data_inverse.py | sssssch/jupyter-examples | cf9e26e22dcfa263bcd26323527911cdbcc2cd61 | [
"MIT"
] | null | null | null | # -*-coding:utf-8-*-
import pandas as pd
from numpy import *
dataset = pd.read_csv(
'test_data.csv', header=None)
dataset = round(dataset, 8)
List_data = mat(dataset)
Inverse = List_data.T
print(Inverse)
name = [
'cpu',
'cmui',
'amui',
'upcmui',
'tpcmui',
'mmui',
'mditi',
'mldsui',
... | 18 | 73 | 0.628205 | import pandas as pd
from numpy import *
dataset = pd.read_csv(
'test_data.csv', header=None)
dataset = round(dataset, 8)
List_data = mat(dataset)
Inverse = List_data.T
print(Inverse)
name = [
'cpu',
'cmui',
'amui',
'upcmui',
'tpcmui',
'mmui',
'mditi',
'mldsui',
'mcui',
'scui... | true | true |
f72de8042318229e69f952746599a95b600e0bd4 | 464 | py | Python | python__advanced/02.lists_as_stacks_and_queues_exercise/08.balanced_parentheses.py | EmilianStoyanov/Projects-in-SoftUni | e83996670fe00424a158905d537a7bbbeee8fb59 | [
"MIT"
] | 1 | 2020-07-14T12:32:47.000Z | 2020-07-14T12:32:47.000Z | python__advanced/02.lists_as_stacks_and_queues_exercise/08.balanced_parentheses.py | EmilianStoyanov/Projects-in-SoftUni | e83996670fe00424a158905d537a7bbbeee8fb59 | [
"MIT"
] | null | null | null | python__advanced/02.lists_as_stacks_and_queues_exercise/08.balanced_parentheses.py | EmilianStoyanov/Projects-in-SoftUni | e83996670fe00424a158905d537a7bbbeee8fb59 | [
"MIT"
] | null | null | null | text = input()
save = []
pairs = {
"{": "}",
"[": "]",
"(": ")"}
valid = True
for el in text:
if el in "({[":
save.append(el)
elif el in ")}]":
if save:
current = save[-1]
if pairs[current] == el:
save.pop()
else:
... | 16 | 36 | 0.364224 | text = input()
save = []
pairs = {
"{": "}",
"[": "]",
"(": ")"}
valid = True
for el in text:
if el in "({[":
save.append(el)
elif el in ")}]":
if save:
current = save[-1]
if pairs[current] == el:
save.pop()
else:
... | true | true |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.