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 |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
f74d9ab812b6dd82ce33cb3c55073c7417f4fd5a | 6,863 | py | Python | src/fbp/flow.py | swcmdb/pyflow | 16f4e4fac74001a4b0761e14335dc84817ad0b45 | [
"MIT"
] | null | null | null | src/fbp/flow.py | swcmdb/pyflow | 16f4e4fac74001a4b0761e14335dc84817ad0b45 | [
"MIT"
] | null | null | null | src/fbp/flow.py | swcmdb/pyflow | 16f4e4fac74001a4b0761e14335dc84817ad0b45 | [
"MIT"
] | null | null | null | """Core Class for Flow."""
from multiprocessing import Process, Manager
from multiprocessing.managers import BaseManager
import sys
import json
from node import Node
EXEC_MODE_BATCH = "batch"
EXEC_MODE_STREAMING = "streaming"
class Path(object):
def __init__(self, source_node, source_port, target_node, target_p... | 31.195455 | 91 | 0.602506 | from multiprocessing import Process, Manager
from multiprocessing.managers import BaseManager
import sys
import json
from node import Node
EXEC_MODE_BATCH = "batch"
EXEC_MODE_STREAMING = "streaming"
class Path(object):
def __init__(self, source_node, source_port, target_node, target_port):
self._name = ... | true | true |
f74d9b2b35390c85a10d985db50bd9c283dd3fba | 3,963 | py | Python | parser.py | LudeeD/prandium | 2b56007772acb76453f7344f9fcf8471d8424889 | [
"MIT"
] | null | null | null | parser.py | LudeeD/prandium | 2b56007772acb76453f7344f9fcf8471d8424889 | [
"MIT"
] | null | null | null | parser.py | LudeeD/prandium | 2b56007772acb76453f7344f9fcf8471d8424889 | [
"MIT"
] | null | null | null | import sqlite3
con = sqlite3.connect('./public/index.db')
import os
def recipe_already_indexed(name):
cur = con.cursor()
cur.execute("SELECT * FROM recipes_info WHERE path=?", (name,))
rows = cur.fetchall()
for r in rows: print(r)
return len(rows) > 0
def add_tag(name, recipe_id):
print(name... | 27.331034 | 97 | 0.538229 | import sqlite3
con = sqlite3.connect('./public/index.db')
import os
def recipe_already_indexed(name):
cur = con.cursor()
cur.execute("SELECT * FROM recipes_info WHERE path=?", (name,))
rows = cur.fetchall()
for r in rows: print(r)
return len(rows) > 0
def add_tag(name, recipe_id):
print(name... | true | true |
f74d9b509d7a7a2b9d6b76e31d14b66e5f43fd6b | 2,694 | py | Python | examples/distributed_data_parallel.py | izumiya-keisuke/mmle | 43dbe281ee591a2d7f7cc1e5386ed04651930205 | [
"Apache-2.0"
] | null | null | null | examples/distributed_data_parallel.py | izumiya-keisuke/mmle | 43dbe281ee591a2d7f7cc1e5386ed04651930205 | [
"Apache-2.0"
] | null | null | null | examples/distributed_data_parallel.py | izumiya-keisuke/mmle | 43dbe281ee591a2d7f7cc1e5386ed04651930205 | [
"Apache-2.0"
] | null | null | null | """
Copyright 2021 Keisuke Izumiya
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, softwar... | 27.489796 | 89 | 0.675204 |
import torch
import torch.distributed as distd
import torch.nn as nn
import torch.nn.functional as F
import torch.optim as optim
from torch.utils.data import DataLoader
from torch.utils.data.distributed import DistributedSampler
import mmle.distributed as mdistd
import mmle.nn as mnn
from mmle.utils.manager import Ma... | true | true |
f74d9be72e2f3579bdbf5c4ba4317c7b1a589cf7 | 641 | py | Python | zeus/networks/pytorch/necks/__init__.py | georgefang/vega | 977054e12dd3bc1c96bbe35f18d5db4bc82d0522 | [
"MIT"
] | null | null | null | zeus/networks/pytorch/necks/__init__.py | georgefang/vega | 977054e12dd3bc1c96bbe35f18d5db4bc82d0522 | [
"MIT"
] | null | null | null | zeus/networks/pytorch/necks/__init__.py | georgefang/vega | 977054e12dd3bc1c96bbe35f18d5db4bc82d0522 | [
"MIT"
] | null | null | null | # -*- coding:utf-8 -*-
# Copyright (C) 2020. Huawei Technologies Co., Ltd. All rights reserved.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the MIT License.
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the ... | 32.05 | 72 | 0.736349 |
from zeus.common.class_factory import ClassFactory
ClassFactory.lazy_register("zeus.networks.pytorch.necks", {
"ffm": ["network:FeatureFusionModule"],
"fpn": ["FPN"]
})
| true | true |
f74d9c76a6809f98cb53b3fefa4957cbddb4775a | 1,007 | py | Python | movieverse/public_datasets.py | KoenBaak/movieverse | 2337a7338e350ebb59dec3119bd5ee4235268fc0 | [
"MIT"
] | null | null | null | movieverse/public_datasets.py | KoenBaak/movieverse | 2337a7338e350ebb59dec3119bd5ee4235268fc0 | [
"MIT"
] | null | null | null | movieverse/public_datasets.py | KoenBaak/movieverse | 2337a7338e350ebb59dec3119bd5ee4235268fc0 | [
"MIT"
] | null | null | null | # ------ Python standard library imports ---------------------------------------
from typing import Optional
import os
# ------ External imports ------------------------------------------------------
# ------ Imports from own package or module ------------------------------------
from movieverse.movieverse import Movie... | 33.566667 | 80 | 0.522344 |
from typing import Optional
import os
from movieverse.movieverse import Movieverse
from movieverse.metadatalib import MetaDataLib
def _dataset_directory():
fallback = os.path.join(os.path.expanduser("~"), ".movieverse_data")
dir_ = os.environ.get("MOVIEVERSE_DATASET_DIR", fallback)
if not os.path.exi... | true | true |
f74d9e14e33b1af180a24d77b31fb7a693160458 | 1,679 | py | Python | SRTpy/utils.py | ChangWanHong/SRTpy | 25813926dd62353a4b4991220c06ef6b3e6dac25 | [
"BSD-3-Clause"
] | 1 | 2019-09-15T09:03:04.000Z | 2019-09-15T09:03:04.000Z | SRTpy/utils.py | bluesid/SRTpy | 25813926dd62353a4b4991220c06ef6b3e6dac25 | [
"BSD-3-Clause"
] | null | null | null | SRTpy/utils.py | bluesid/SRTpy | 25813926dd62353a4b4991220c06ef6b3e6dac25 | [
"BSD-3-Clause"
] | 1 | 2019-09-15T04:20:14.000Z | 2019-09-15T04:20:14.000Z | """
SRTpy -- SRT (https://etk.srail.co.kr) wrapper for Python.
==========================================================
: copyright: (c) 2017 by Heena Kwag.
: URL: <http://github.com/dotaitch/SRTpy>
: license: BSD, see LICENSE for more details.
"""
import random
import requests
from xml.etree im... | 26.234375 | 69 | 0.589637 |
import random
import requests
from xml.etree import ElementTree as ET
from .constants import *
def get_key_by_value(value, data):
for k, v in data.items():
if v == value:
return k
def get_key_by_value_list(value, data):
for k, v in data.items():
if value in v:
return ... | true | true |
f74d9e2c563453f7df1f35841574b2f4c2fba50c | 2,225 | py | Python | wenshu/wenshu/spiders/wenshu_spider.py | SCUTJcfeng/ScrapyProjects | ddfceef66ebf7a9d693276249abf6bb84238e2c2 | [
"MIT"
] | 2 | 2019-01-11T17:35:26.000Z | 2019-04-17T14:28:04.000Z | wenshu/wenshu/spiders/wenshu_spider.py | SCUTJcfeng/ScrapyProjects | ddfceef66ebf7a9d693276249abf6bb84238e2c2 | [
"MIT"
] | null | null | null | wenshu/wenshu/spiders/wenshu_spider.py | SCUTJcfeng/ScrapyProjects | ddfceef66ebf7a9d693276249abf6bb84238e2c2 | [
"MIT"
] | null | null | null | from scrapy import Spider
import requests
import redis
class WenshuSpider(Spider):
name = 'wenshu'
def __init__(self):
super().__init__()
self.r = redis.Redis(host='47.106.136.136', port=6388, password='qazwsx12!@')
self.start_urls = [
''
]
def get_code(self,... | 32.720588 | 118 | 0.501573 | from scrapy import Spider
import requests
import redis
class WenshuSpider(Spider):
name = 'wenshu'
def __init__(self):
super().__init__()
self.r = redis.Redis(host='47.106.136.136', port=6388, password='qazwsx12!@')
self.start_urls = [
''
]
def get_code(self,... | true | true |
f74d9e3a487d04986c010faeb7cc71b05fcd3d06 | 775 | py | Python | IO/Exodus/Testing/Python/TestExodusWithNaN.py | satya-arjunan/vtk8 | ee7ced57de6d382a2d12693c01e2fcdac350b25f | [
"BSD-3-Clause"
] | 1,755 | 2015-01-03T06:55:00.000Z | 2022-03-29T05:23:26.000Z | IO/Exodus/Testing/Python/TestExodusWithNaN.py | satya-arjunan/vtk8 | ee7ced57de6d382a2d12693c01e2fcdac350b25f | [
"BSD-3-Clause"
] | 29 | 2015-04-23T20:58:30.000Z | 2022-03-02T16:16:42.000Z | IO/Exodus/Testing/Python/TestExodusWithNaN.py | satya-arjunan/vtk8 | ee7ced57de6d382a2d12693c01e2fcdac350b25f | [
"BSD-3-Clause"
] | 1,044 | 2015-01-05T22:48:27.000Z | 2022-03-31T02:38:26.000Z | #!/usr/bin/env python
# This test loads an Exodus file with NaNs and we test that the vtkDataArray
# returns a correct range for the array with NaNs i.e. not including the NaN.
from vtk import *
from vtk.util.misc import vtkGetDataRoot
VTK_DATA_ROOT = vtkGetDataRoot()
rdr = vtkExodusIIReader()
rdr.SetFileName(str(VTK_... | 36.904762 | 79 | 0.745806 |
from vtk import *
from vtk.util.misc import vtkGetDataRoot
VTK_DATA_ROOT = vtkGetDataRoot()
rdr = vtkExodusIIReader()
rdr.SetFileName(str(VTK_DATA_ROOT) + "/Data/cyl_with_NaN.g")
rdr.UpdateInformation()
rdr.SetPointResultArrayStatus("dist_from_origin", 1);
rdr.Update()
data = rdr.GetOutput().GetBlock(0).GetBlock(0... | true | true |
f74da1b0b8d2fad4fb76e3d20b4d531592888653 | 1,924 | py | Python | lib/setup.py | AlphaJia/faster-rcnn.pytorch | b79a83c84f083495e2edb1a55a970946cb59add2 | [
"MIT"
] | null | null | null | lib/setup.py | AlphaJia/faster-rcnn.pytorch | b79a83c84f083495e2edb1a55a970946cb59add2 | [
"MIT"
] | null | null | null | lib/setup.py | AlphaJia/faster-rcnn.pytorch | b79a83c84f083495e2edb1a55a970946cb59add2 | [
"MIT"
] | null | null | null | # Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved.
# !/usr/bin/env python
import glob
import os
import torch
from setuptools import find_packages
from setuptools import setup
from torch.utils.cpp_extension import CUDAExtension
from torch.utils.cpp_extension import CUDA_HOME
from torch.utils.cpp_e... | 28.294118 | 73 | 0.669958 |
import glob
import os
import torch
from setuptools import find_packages
from setuptools import setup
from torch.utils.cpp_extension import CUDAExtension
from torch.utils.cpp_extension import CUDA_HOME
from torch.utils.cpp_extension import CppExtension
requirements = ["torch", "torchvision"]
def get_extensions():... | true | true |
f74da1b8a50d2df6d94fca70f6942d23f054ad0d | 22,720 | py | Python | superset/app.py | IronOnet/incubator-superset | 2a447ff46619d5193cde6f1eb1acc6781dcee056 | [
"Apache-2.0"
] | 2 | 2021-10-31T01:05:28.000Z | 2021-11-08T09:43:27.000Z | superset/app.py | IronOnet/incubator-superset | 2a447ff46619d5193cde6f1eb1acc6781dcee056 | [
"Apache-2.0"
] | null | null | null | superset/app.py | IronOnet/incubator-superset | 2a447ff46619d5193cde6f1eb1acc6781dcee056 | [
"Apache-2.0"
] | null | null | null | # Licensed to the Apache Software Foundation (ASF) under one
# or more contributor license agreements. See the NOTICE file
# distributed with this work for additional information
# regarding copyright ownership. The ASF licenses this file
# to you under the Apache License, Version 2.0 (the
# "License"); you may not u... | 34.846626 | 88 | 0.594674 |
import logging
import os
from typing import Any, Callable, Dict
import wtforms_json
from flask import Flask, redirect
from flask_appbuilder import expose, IndexView
from flask_babel import gettext as __, lazy_gettext as _
from flask_compress import Compress
from superset.connectors.connector_registry... | true | true |
f74da1bafcc1a43d9c99e681731c4296fafbefbb | 189 | py | Python | openwisp_ipam/management/commands/export_subnet.py | nepython/openwisp-ipam | 43a6fd6c710ef5be3b324412bb9a479572f0d5d4 | [
"BSD-3-Clause"
] | 1 | 2021-07-20T22:27:21.000Z | 2021-07-20T22:27:21.000Z | openwisp_ipam/management/commands/export_subnet.py | nepython/openwisp-ipam | 43a6fd6c710ef5be3b324412bb9a479572f0d5d4 | [
"BSD-3-Clause"
] | null | null | null | openwisp_ipam/management/commands/export_subnet.py | nepython/openwisp-ipam | 43a6fd6c710ef5be3b324412bb9a479572f0d5d4 | [
"BSD-3-Clause"
] | null | null | null | import swapper
from django_ipam.management.commands import BaseExportSubnetCommand
class Command(BaseExportSubnetCommand):
subnet_model = swapper.load_model('django_ipam', 'Subnet')
| 23.625 | 67 | 0.825397 | import swapper
from django_ipam.management.commands import BaseExportSubnetCommand
class Command(BaseExportSubnetCommand):
subnet_model = swapper.load_model('django_ipam', 'Subnet')
| true | true |
f74da265d5cd073f205281459307f62f20819494 | 4,173 | py | Python | conanfile.py | n-bes/daggy | 5e6f4603eb78fc518166e3559bfc05b6a70d5946 | [
"MIT"
] | null | null | null | conanfile.py | n-bes/daggy | 5e6f4603eb78fc518166e3559bfc05b6a70d5946 | [
"MIT"
] | null | null | null | conanfile.py | n-bes/daggy | 5e6f4603eb78fc518166e3559bfc05b6a70d5946 | [
"MIT"
] | null | null | null | '''
MIT License
Copyright (c) 2020 Mikhail Milovidov
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publ... | 37.258929 | 105 | 0.653007 |
from conans import ConanFile, CMake
from git_version import GitVersion
class DaggyConan(ConanFile):
name = "daggy"
license = "MIT"
url = "https://daggy.dev"
description = "Data Aggregation Utilty - aggregation and stream data via remote and local processes."
settings = "os", "compiler", "build_typ... | true | true |
f74da4b55b586ce2c760fb0f26e872cc72b50873 | 26,581 | py | Python | DOE_functions.py | danielaeblancoj/Design-of-experiment-Python | 541c00a96fad4a9ef074c4fb4dde9c65a5deb20d | [
"MIT"
] | 179 | 2018-06-30T00:58:43.000Z | 2022-03-04T02:32:22.000Z | DOE_functions.py | danielaeblancoj/Design-of-experiment-Python | 541c00a96fad4a9ef074c4fb4dde9c65a5deb20d | [
"MIT"
] | 6 | 2018-11-10T18:50:39.000Z | 2020-11-11T21:11:01.000Z | DOE_functions.py | danielaeblancoj/Design-of-experiment-Python | 541c00a96fad4a9ef074c4fb4dde9c65a5deb20d | [
"MIT"
] | 77 | 2018-07-02T03:00:18.000Z | 2022-03-24T01:36:12.000Z | #====================
# Essential imports
#====================
from pyDOE import *
from pyDOE_corrected import *
from diversipy import *
import pandas as pd
import numpy as np
# ===========================================================================================================
# Function for constructing a Da... | 48.505474 | 448 | 0.633686 |
from pyDOE import *
from pyDOE_corrected import *
from diversipy import *
import pandas as pd
import numpy as np
def construct_df(x,r):
df=pd.DataFrame(data=x,dtype='float32')
for i in df.index:
for j in range(len(list(df.iloc[i]))):
df.iloc[i][j]=r[j][int(df.iloc[i][j])]
return ... | true | true |
f74da55840e6d8bba82a3c587516e4c8096c51c1 | 819 | py | Python | app/core/tests/test_commands.py | jingr1986/recipie-app-api | 74e9b7efb52ddda97bd3f3af715f024ebbe403ad | [
"MIT"
] | null | null | null | app/core/tests/test_commands.py | jingr1986/recipie-app-api | 74e9b7efb52ddda97bd3f3af715f024ebbe403ad | [
"MIT"
] | null | null | null | app/core/tests/test_commands.py | jingr1986/recipie-app-api | 74e9b7efb52ddda97bd3f3af715f024ebbe403ad | [
"MIT"
] | null | null | null | from unittest.mock import patch
from django.core.management import call_command
from django.db.utils import OperationalError
from django.test import TestCase
class CommandTest(TestCase):
def test_wait_for_db_ready(self):
"""test waiting for db when db is available"""
with patch('django.db.utils.... | 34.125 | 74 | 0.677656 | from unittest.mock import patch
from django.core.management import call_command
from django.db.utils import OperationalError
from django.test import TestCase
class CommandTest(TestCase):
def test_wait_for_db_ready(self):
with patch('django.db.utils.ConnectionHandler.__getitem__') as gi:
gi.r... | true | true |
f74da583b4800e330a945d2a628f16bafed862c3 | 771 | py | Python | docker-python3-flask-ml-app/app/keras_mnist/kerasPredict.py | kidakoji/ImgRecogRecipe | 7082f95f61205a2bb23110e2924bcdba1695bf1c | [
"MIT"
] | 30 | 2019-06-06T11:20:27.000Z | 2022-01-11T05:58:14.000Z | app/keras_mnist/kerasPredict.py | kawashimaken/docker-python3-flask-ml-app | 14b9dec4d581c0109539f96072d883ec4f9d64a1 | [
"MIT"
] | 3 | 2020-09-29T10:15:06.000Z | 2021-06-09T03:09:24.000Z | app/keras_mnist/kerasPredict.py | kawashimaken/docker-python3-flask-ml-app | 14b9dec4d581c0109539f96072d883ec4f9d64a1 | [
"MIT"
] | 27 | 2019-07-27T12:54:28.000Z | 2022-01-09T12:25:22.000Z | # -*- coding: utf-8 -*-
# -----------------------------------------------------------------------------
#
#
import os
import numpy as np
from keras import backend as Keras
from keras.models import load_model
# -----------------------------------------------------------------------------
#
Keras.clear_session()
# 学習済み... | 27.535714 | 79 | 0.590143 |
import os
import numpy as np
from keras import backend as Keras
from keras.models import load_model
Keras.clear_session()
keras_mnist_model = load_model(
os.path.abspath(os.path.dirname(__file__)) + '/keras-mnist-model.h5')
keras_mnist_model._make_predict_function()
keras_mnist_model.summary()
print('Kera... | true | true |
f74da5d5eab831d4a81b00a89e2df1e0179341b2 | 1,370 | py | Python | plugins/rapid7_intsights/icon_rapid7_intsights/actions/takedown_request/schema.py | lukaszlaszuk/insightconnect-plugins | 8c6ce323bfbb12c55f8b5a9c08975d25eb9f8892 | [
"MIT"
] | null | null | null | plugins/rapid7_intsights/icon_rapid7_intsights/actions/takedown_request/schema.py | lukaszlaszuk/insightconnect-plugins | 8c6ce323bfbb12c55f8b5a9c08975d25eb9f8892 | [
"MIT"
] | null | null | null | plugins/rapid7_intsights/icon_rapid7_intsights/actions/takedown_request/schema.py | lukaszlaszuk/insightconnect-plugins | 8c6ce323bfbb12c55f8b5a9c08975d25eb9f8892 | [
"MIT"
] | null | null | null | # GENERATED BY KOMAND SDK - DO NOT EDIT
import insightconnect_plugin_runtime
import json
class Component:
DESCRIPTION = "Request a takedown for a given alert in IntSights"
class Input:
ALERT_ID = "alert_id"
TARGET = "target"
class Output:
STATUS = "status"
class TakedownRequestInput(insi... | 18.266667 | 69 | 0.562044 |
import insightconnect_plugin_runtime
import json
class Component:
DESCRIPTION = "Request a takedown for a given alert in IntSights"
class Input:
ALERT_ID = "alert_id"
TARGET = "target"
class Output:
STATUS = "status"
class TakedownRequestInput(insightconnect_plugin_runtime.Input):
s... | true | true |
f74da76c22d73d62a803d1639e2af3706b0b18c8 | 8,173 | py | Python | spacy_pytorch_transformers/language.py | kormilitzin/spacy-pytorch-transformers | c5bf20ab502abc585e6963793baccf2a0804e435 | [
"MIT"
] | null | null | null | spacy_pytorch_transformers/language.py | kormilitzin/spacy-pytorch-transformers | c5bf20ab502abc585e6963793baccf2a0804e435 | [
"MIT"
] | null | null | null | spacy_pytorch_transformers/language.py | kormilitzin/spacy-pytorch-transformers | c5bf20ab502abc585e6963793baccf2a0804e435 | [
"MIT"
] | 1 | 2022-02-15T10:37:17.000Z | 2022-02-15T10:37:17.000Z | from spacy.language import Language
from spacy.tokens import Doc, Span, Token
from spacy.util import get_lang_class
from spacy.gold import GoldParse
from .util import is_special_token
from . import about
class PyTT_Language(Language):
"""A subclass of spacy.Language that holds a PyTorch-Transformer (PyTT) pipeli... | 36.815315 | 90 | 0.635018 | from spacy.language import Language
from spacy.tokens import Doc, Span, Token
from spacy.util import get_lang_class
from spacy.gold import GoldParse
from .util import is_special_token
from . import about
class PyTT_Language(Language):
lang_factory_name = "pytt"
@staticmethod
def install_extensions():
... | true | true |
f74da7be8f04d9df50a6d4d87b56df52ebc47ee9 | 1,299 | py | Python | 2016/22.py | bernikr/advent-of-code | 331e5257b9f812776d0723c7cdec349770498d34 | [
"MIT"
] | 1 | 2020-12-06T13:07:55.000Z | 2020-12-06T13:07:55.000Z | 2016/22.py | bernikr/advent-of-code | 331e5257b9f812776d0723c7cdec349770498d34 | [
"MIT"
] | null | null | null | 2016/22.py | bernikr/advent-of-code | 331e5257b9f812776d0723c7cdec349770498d34 | [
"MIT"
] | null | null | null | import re
from itertools import product, count
from aoc_utils import Vec, dirs4
from aocd import get_data
def part1(inp):
return sum(c1 != c2 and u1 != 0 and u1 <= a2 for (c1, (u1, a1)), (c2, (u2, a2)) in product(inp.items(), repeat=2))
def part2(inp):
mapp = inp.copy()
hole, holecap = next((c, a) for ... | 31.682927 | 118 | 0.455735 | import re
from itertools import product, count
from aoc_utils import Vec, dirs4
from aocd import get_data
def part1(inp):
return sum(c1 != c2 and u1 != 0 and u1 <= a2 for (c1, (u1, a1)), (c2, (u2, a2)) in product(inp.items(), repeat=2))
def part2(inp):
mapp = inp.copy()
hole, holecap = next((c, a) for ... | true | true |
f74da80022086e2e3046d153df52948995258561 | 311 | py | Python | alpyro_msgs/rospy_tutorials/floats.py | rho2/alpyro_msgs | b5a680976c40c83df70d61bb2db1de32a1cde8d3 | [
"MIT"
] | 1 | 2020-12-13T13:07:10.000Z | 2020-12-13T13:07:10.000Z | alpyro_msgs/rospy_tutorials/floats.py | rho2/alpyro_msgs | b5a680976c40c83df70d61bb2db1de32a1cde8d3 | [
"MIT"
] | null | null | null | alpyro_msgs/rospy_tutorials/floats.py | rho2/alpyro_msgs | b5a680976c40c83df70d61bb2db1de32a1cde8d3 | [
"MIT"
] | null | null | null | from typing import List
from typing_extensions import Annotated
from alpyro_msgs import RosMessage, float32
class Floats(RosMessage):
__msg_typ__ = "rospy_tutorials/Floats"
__msg_def__ = "ZmxvYXQzMltdIGRhdGEKCg=="
__md5_sum__ = "420cd38b6b071cd49f2970c3e2cee511"
data: Annotated[List[float32], 0, 0]
| 25.916667 | 50 | 0.800643 | from typing import List
from typing_extensions import Annotated
from alpyro_msgs import RosMessage, float32
class Floats(RosMessage):
__msg_typ__ = "rospy_tutorials/Floats"
__msg_def__ = "ZmxvYXQzMltdIGRhdGEKCg=="
__md5_sum__ = "420cd38b6b071cd49f2970c3e2cee511"
data: Annotated[List[float32], 0, 0]
| true | true |
f74da863b2dfad99e38dafb6ff0c767d21cb6c82 | 5,194 | py | Python | tests/class/test_class.py | AntoniosHadji/pylox | 906338bf44de92e66c4e7805059ad060dfd52ff3 | [
"MIT"
] | null | null | null | tests/class/test_class.py | AntoniosHadji/pylox | 906338bf44de92e66c4e7805059ad060dfd52ff3 | [
"MIT"
] | null | null | null | tests/class/test_class.py | AntoniosHadji/pylox | 906338bf44de92e66c4e7805059ad060dfd52ff3 | [
"MIT"
] | null | null | null | import subprocess
EXPECT_FAIL_65 = [
'prefix_operator',
'grouping',
'infix_operator',
'to_this',
'inherit_self',
'local_inherit_self',
'return_value',
'parenthesized_superclass',
'missing_argument',
'var_in_body',
'fun_in_body',
'class_in_body',
'trailing_dot',
'... | 31.670732 | 116 | 0.702349 | import subprocess
EXPECT_FAIL_65 = [
'prefix_operator',
'grouping',
'infix_operator',
'to_this',
'inherit_self',
'local_inherit_self',
'return_value',
'parenthesized_superclass',
'missing_argument',
'var_in_body',
'fun_in_body',
'class_in_body',
'trailing_dot',
'... | true | true |
f74daacbbafff8ca7db1d9ff53041d2a7501831c | 1,191 | py | Python | htag/runners/__init__.py | manatlan/thag | 0c57a103a8dbdbf9e1f09c759f1c35c1c3eff359 | [
"MIT"
] | 1 | 2022-03-12T09:42:13.000Z | 2022-03-12T09:42:13.000Z | htag/runners/__init__.py | manatlan/thag | 0c57a103a8dbdbf9e1f09c759f1c35c1c3eff359 | [
"MIT"
] | null | null | null | htag/runners/__init__.py | manatlan/thag | 0c57a103a8dbdbf9e1f09c759f1c35c1c3eff359 | [
"MIT"
] | null | null | null | # -*- coding: utf-8 -*-
# #############################################################################
# Copyright (C) 2022 manatlan manatlan[at]gmail(dot)com
#
# MIT licence
#
# https://github.com/manatlan/htag
# #############################################################################
# mono instance
from .brow... | 31.342105 | 171 | 0.633921 | true | true | |
f74dab577042e68b31ea2e93553c8adf6ffc5042 | 74 | py | Python | medgpc/visualization/__init__.py | bee-hive/MedGP | 596a24ca519900507cce42cb4e2061319cef801e | [
"BSD-3-Clause"
] | 25 | 2018-03-18T18:09:03.000Z | 2022-02-24T07:47:33.000Z | medgpc/visualization/__init__.py | bee-hive/MedGP | 596a24ca519900507cce42cb4e2061319cef801e | [
"BSD-3-Clause"
] | 3 | 2021-04-12T16:11:00.000Z | 2021-04-12T16:26:17.000Z | medgpc/visualization/__init__.py | bee-hive/MedGP | 596a24ca519900507cce42cb4e2061319cef801e | [
"BSD-3-Clause"
] | 4 | 2019-04-27T23:18:26.000Z | 2021-12-03T20:19:09.000Z | from . import fastkernel
from . import vizkernel
from . import printkernel | 24.666667 | 25 | 0.810811 | from . import fastkernel
from . import vizkernel
from . import printkernel | true | true |
f74dab8eed49925367d25354ef9ec895cdce0fc7 | 849 | py | Python | pymarkdownlint/tests/test_lint.py | atraining/pymarkdownlint | c1044e25e18afd78b3fda8fd9b00a4f67cfbbc65 | [
"MIT"
] | 8 | 2016-01-26T10:48:46.000Z | 2020-07-16T08:15:33.000Z | pymarkdownlint/tests/test_lint.py | atraining/pymarkdownlint | c1044e25e18afd78b3fda8fd9b00a4f67cfbbc65 | [
"MIT"
] | 5 | 2016-04-11T13:53:09.000Z | 2021-04-30T06:58:03.000Z | pymarkdownlint/tests/test_lint.py | atraining/pymarkdownlint | c1044e25e18afd78b3fda8fd9b00a4f67cfbbc65 | [
"MIT"
] | 10 | 2016-09-14T15:01:54.000Z | 2021-11-10T16:55:42.000Z | from pymarkdownlint.tests.base import BaseTestCase
from pymarkdownlint.lint import MarkdownLinter
from pymarkdownlint.rules import RuleViolation
from pymarkdownlint.config import LintConfig
class RuleOptionTests(BaseTestCase):
def test_lint(self):
linter = MarkdownLinter(LintConfig())
sample = se... | 44.684211 | 97 | 0.639576 | from pymarkdownlint.tests.base import BaseTestCase
from pymarkdownlint.lint import MarkdownLinter
from pymarkdownlint.rules import RuleViolation
from pymarkdownlint.config import LintConfig
class RuleOptionTests(BaseTestCase):
def test_lint(self):
linter = MarkdownLinter(LintConfig())
sample = se... | true | true |
f74dabc2db9458544686c9fcdca34b2b268d7e9e | 80,315 | py | Python | Lib/test/test_asyncio/test_base_events.py | shawwn/cpython | 0ff8a3b374286d2218fc18f47556a5ace202dad3 | [
"0BSD"
] | 27 | 2020-10-06T14:38:02.000Z | 2022-03-14T22:52:07.000Z | Lib/test/test_asyncio/test_base_events.py | shawwn/cpython | 0ff8a3b374286d2218fc18f47556a5ace202dad3 | [
"0BSD"
] | 17 | 2018-01-26T13:23:58.000Z | 2022-03-01T13:44:36.000Z | Lib/test/test_asyncio/test_base_events.py | shawwn/cpython | 0ff8a3b374286d2218fc18f47556a5ace202dad3 | [
"0BSD"
] | 8 | 2020-10-06T14:38:08.000Z | 2022-01-12T14:29:46.000Z | """Tests for base_events.py"""
import concurrent.futures
import errno
import math
import socket
import sys
import threading
import time
import unittest
from unittest import mock
import asyncio
from asyncio import base_events
from asyncio import constants
from test.test_asyncio import utils as test_utils
from test imp... | 37.131299 | 91 | 0.612538 |
import concurrent.futures
import errno
import math
import socket
import sys
import threading
import time
import unittest
from unittest import mock
import asyncio
from asyncio import base_events
from asyncio import constants
from test.test_asyncio import utils as test_utils
from test import support
from test.support.s... | true | true |
f74dac4b9692d49d454cf8ebd5b56e63d89ba6b0 | 226 | py | Python | Jumpscale/clients/google_compute/GoogleComputeFactory.py | threefoldtech/JumpscaleX | 5fb073a82aeb0e66fc7d9660c45a1e31bc094bfa | [
"Apache-2.0"
] | 2 | 2019-05-09T07:21:25.000Z | 2019-08-05T06:37:53.000Z | Jumpscale/clients/google_compute/GoogleComputeFactory.py | threefoldtech/JumpscaleX | 5fb073a82aeb0e66fc7d9660c45a1e31bc094bfa | [
"Apache-2.0"
] | 664 | 2018-12-19T12:43:44.000Z | 2019-08-23T04:24:42.000Z | Jumpscale/clients/google_compute/GoogleComputeFactory.py | threefoldtech/jumpscale10 | 5fb073a82aeb0e66fc7d9660c45a1e31bc094bfa | [
"Apache-2.0"
] | 7 | 2019-05-03T07:14:37.000Z | 2019-08-05T12:36:52.000Z | from .GoogleCompute import GoogleCompute
from Jumpscale import j
JSBASE = j.application.JSFactoryBaseClass
class GoogleComputeFactory(JSBASE):
__jslocation__ = "j.clients.google_compute"
_CHILDCLASS = GoogleCompute
| 22.6 | 47 | 0.809735 | from .GoogleCompute import GoogleCompute
from Jumpscale import j
JSBASE = j.application.JSFactoryBaseClass
class GoogleComputeFactory(JSBASE):
__jslocation__ = "j.clients.google_compute"
_CHILDCLASS = GoogleCompute
| true | true |
f74dac69f5537f2ec412c155c1e1864b599b088d | 66,791 | py | Python | cinder/tests/unit/test_netapp_nfs.py | overcastcloud/cinder | ad977d456c5d50e992eee95ea40f4e3dd21981dc | [
"Apache-2.0"
] | null | null | null | cinder/tests/unit/test_netapp_nfs.py | overcastcloud/cinder | ad977d456c5d50e992eee95ea40f4e3dd21981dc | [
"Apache-2.0"
] | null | null | null | cinder/tests/unit/test_netapp_nfs.py | overcastcloud/cinder | ad977d456c5d50e992eee95ea40f4e3dd21981dc | [
"Apache-2.0"
] | null | null | null | # Copyright (c) 2012 NetApp, 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... | 42.406984 | 79 | 0.636478 |
import itertools
import os
import shutil
import unittest
from lxml import etree
import mock
from mox3 import mox as mox_lib
from oslo_log import log as logging
import six
from cinder import exception
from cinder.i18n import _LW
from cinder.image import image_utils
from cinder import test
from cinder im... | true | true |
f74dac726ade849bc8e291db31f2161f9fb881ae | 13,185 | py | Python | opts.py | sidsachan/PDVC | c7a1dae011a915b84ec634ce204b6464ec5d7176 | [
"MIT"
] | null | null | null | opts.py | sidsachan/PDVC | c7a1dae011a915b84ec634ce204b6464ec5d7176 | [
"MIT"
] | null | null | null | opts.py | sidsachan/PDVC | c7a1dae011a915b84ec634ce204b6464ec5d7176 | [
"MIT"
] | null | null | null | import argparse
import time
import yaml
import os
import numpy as np
def parse_opts():
parser = argparse.ArgumentParser()
# configure of this run
parser.add_argument('--cfg_path', type=str, required=True, help='config file')
parser.add_argument('--id', type=str, default='', help='id of this run. Resul... | 58.861607 | 202 | 0.654835 | import argparse
import time
import yaml
import os
import numpy as np
def parse_opts():
parser = argparse.ArgumentParser()
parser.add_argument('--cfg_path', type=str, required=True, help='config file')
parser.add_argument('--id', type=str, default='', help='id of this run. Results and logs will saved ... | true | true |
f74dad4f7209e1695d047761d0ee365e6f130992 | 1,053 | py | Python | learning_python/lesson2/exercise4.py | fallenfuzz/pynet | 9624d83cca160fd325a34e838e4474c9b80fe2ab | [
"Apache-2.0"
] | 528 | 2015-01-07T15:28:51.000Z | 2022-03-27T09:45:37.000Z | learning_python/lesson2/exercise4.py | fallenfuzz/pynet | 9624d83cca160fd325a34e838e4474c9b80fe2ab | [
"Apache-2.0"
] | 19 | 2015-07-01T23:52:27.000Z | 2021-09-22T04:30:34.000Z | learning_python/lesson2/exercise4.py | fallenfuzz/pynet | 9624d83cca160fd325a34e838e4474c9b80fe2ab | [
"Apache-2.0"
] | 555 | 2015-01-18T07:21:43.000Z | 2022-03-20T21:25:22.000Z | #!/usr/bin/env python
"""Read in the "show_ip_int_brief.txt" file into your program using the
.readlines() method.
Obtain the list entry associated with the FastEthernet4 interface. You can
just hard-code the index at this point since we haven't covered for-loops
or regular expressions:
Use the string .split() method... | 30.085714 | 79 | 0.773029 |
from __future__ import print_function, unicode_literals
with open("show_ip_int_brief.txt") as f:
show_ip_int_brief = f.readlines()
fa4_ip = show_ip_int_brief[5].strip()
fields = fa4_ip.split()
intf = fields[0]
ip_address = fields[1]
my_results = (intf, ip_address)
print(my_results)
| true | true |
f74dad801f9b275a6164dd1a488efbaf9f19d59c | 68 | py | Python | src/lib/lib2to3/pgen2/__init__.py | timmartin/skulpt | 2e3a3fbbaccc12baa29094a717ceec491a8a6750 | [
"MIT"
] | 10 | 2015-11-13T17:02:40.000Z | 2021-02-09T23:21:05.000Z | src/lib/lib2to3/pgen2/__init__.py | timmartin/skulpt | 2e3a3fbbaccc12baa29094a717ceec491a8a6750 | [
"MIT"
] | 43 | 2015-06-03T17:59:23.000Z | 2021-09-17T10:45:21.000Z | src/lib/lib2to3/pgen2/__init__.py | timmartin/skulpt | 2e3a3fbbaccc12baa29094a717ceec491a8a6750 | [
"MIT"
] | 13 | 2017-07-02T03:16:46.000Z | 2021-07-05T14:53:56.000Z | raise NotImplementedError("pgen2 is not yet implemented in Skulpt")
| 34 | 67 | 0.823529 | raise NotImplementedError("pgen2 is not yet implemented in Skulpt")
| true | true |
f74daee8002f6239f1bbdedb0e4a71faa668b036 | 4,455 | py | Python | koodikoulu/settings.py | codeschule/koodikoulu-site | dde9932564f36dce6f4dbfd31e7923f1bae83293 | [
"MIT"
] | 5 | 2015-09-16T10:50:53.000Z | 2016-01-16T09:10:37.000Z | koodikoulu/settings.py | codeschule/koodikoulu-site | dde9932564f36dce6f4dbfd31e7923f1bae83293 | [
"MIT"
] | 10 | 2015-09-07T05:58:03.000Z | 2019-02-15T10:36:48.000Z | koodikoulu/settings.py | codeschule/koodikoulu-site | dde9932564f36dce6f4dbfd31e7923f1bae83293 | [
"MIT"
] | 6 | 2015-09-06T19:42:46.000Z | 2019-12-29T21:31:07.000Z | """
Django settings for koodikoulu project.
Generated by 'django-admin startproject' using Django 1.8.3.
For more information on this file, see
https://docs.djangoproject.com/en/1.8/topics/settings/
For the full list of settings and their values, see
https://docs.djangoproject.com/en/1.8/ref/settings/
"""
# Build p... | 25.751445 | 90 | 0.654994 |
import os
BASE_DIR = os.path.dirname(os.path.dirname(os.path.abspath(__file__)))
SECRET_KEY = os.getenv('SECRET_KEY', '!5qr)bf6lc&-6-zh-@baepxqyy9qohph%as#ea&5o11!l4skwx')
DEBUG = True
ALLOWED_HOSTS = []
# Application definition
INSTALLED_APPS = (
'django.contrib.admin',
'django.contrib.auth',
... | true | true |
f74db12354e7f30a7726a87b90f35c052b0866ec | 3,042 | py | Python | scripts/geodata/addresses/po_boxes.py | Fillr/libpostal | bce153188aff9fbe65aef12c3c639d8069e707fc | [
"MIT"
] | 3,489 | 2015-03-03T00:21:38.000Z | 2022-03-29T09:03:05.000Z | scripts/geodata/addresses/po_boxes.py | StephenHildebrand/libpostal | d8c9847c5686a1b66056e65128e1774f060ff36f | [
"MIT"
] | 488 | 2015-05-29T23:04:28.000Z | 2022-03-29T11:20:24.000Z | scripts/geodata/addresses/po_boxes.py | StephenHildebrand/libpostal | d8c9847c5686a1b66056e65128e1774f060ff36f | [
"MIT"
] | 419 | 2015-11-24T16:53:07.000Z | 2022-03-27T06:51:28.000Z | import random
import six
from geodata.addresses.config import address_config
from geodata.addresses.numbering import NumberedComponent, Digits, sample_alphabet, latin_alphabet
from geodata.encoding import safe_decode
from geodata.math.sampling import cdf, weighted_choice
class POBox(NumberedComponent):
@classmet... | 39.506494 | 132 | 0.649244 | import random
import six
from geodata.addresses.config import address_config
from geodata.addresses.numbering import NumberedComponent, Digits, sample_alphabet, latin_alphabet
from geodata.encoding import safe_decode
from geodata.math.sampling import cdf, weighted_choice
class POBox(NumberedComponent):
@classmet... | true | true |
f74db304101d652c64a47651c51ea89f1ee0d820 | 1,027 | py | Python | mylittlefacewhen/scripts/old/reprocess.py | luckydonald/memes.pony.style | 993b007c05e02d5ba8638180936f7c833707694a | [
"0BSD"
] | 3 | 2020-04-20T16:38:28.000Z | 2021-06-24T11:40:53.000Z | mylittlefacewhen/scripts/old/reprocess.py | luckydonald/memes.pony.style | 993b007c05e02d5ba8638180936f7c833707694a | [
"0BSD"
] | 13 | 2020-02-12T00:55:59.000Z | 2022-03-11T23:52:34.000Z | mylittlefacewhen/scripts/old/reprocess.py | luckydonald/memes.pony.style | 993b007c05e02d5ba8638180936f7c833707694a | [
"0BSD"
] | null | null | null | from viewer.models import Face
import os
import shutil
SIZES = (120, 160, 320, 640, 1000)
SIZENAMES = ("thumb", "small", "medium", "large", "huge")
for face in Face.objects.filter(id__gte=1536):
# if not face.image.name.startswith("f/img/mlfw"):
print(str(face.id) + ": " + face.image.name)
#namepart = fac... | 27.756757 | 58 | 0.5852 | from viewer.models import Face
import os
import shutil
SIZES = (120, 160, 320, 640, 1000)
SIZENAMES = ("thumb", "small", "medium", "large", "huge")
for face in Face.objects.filter(id__gte=1536):
print(str(face.id) + ": " + face.image.name)
if face.tags.filter(n... | true | true |
f74db3de9fd6c38cc63b365a59a1903fd78b51c5 | 777 | py | Python | apps/pl_users/filters.py | PremierLangage/platon_assets | 52369067cae9d3969091bb691e0fe7cfb9d10b96 | [
"CECILL-B"
] | null | null | null | apps/pl_users/filters.py | PremierLangage/platon_assets | 52369067cae9d3969091bb691e0fe7cfb9d10b96 | [
"CECILL-B"
] | 10 | 2020-10-07T12:25:03.000Z | 2021-09-13T20:33:36.000Z | apps/pl_users/filters.py | PremierLangage/platon_assets | 52369067cae9d3969091bb691e0fe7cfb9d10b96 | [
"CECILL-B"
] | null | null | null | #!/usr/bin/env python
# -*- coding: utf-8 -*-
#
# filters.py
#
# Authors:
# - Mamadou CISSE <mciissee.@gmail.com>
#
from django.contrib.auth import get_user_model
from django_filters import rest_framework as filters
from django.db.models import Q
User = get_user_model()
class UserFilter(filters.FilterSet):... | 22.2 | 77 | 0.612613 |
from django.contrib.auth import get_user_model
from django_filters import rest_framework as filters
from django.db.models import Q
User = get_user_model()
class UserFilter(filters.FilterSet):
is_admin = filters.BooleanFilter(label='Admin', method='filter_is_admin')
class Meta:
model = User... | true | true |
f74db4d98995f1b0448f9e76c940cc31031b46ff | 4,926 | py | Python | venv/Lib/site-packages/pymsgbox/_native_win.py | SteevenBrunner/gmail-generator | 0ab6f047faad48c388c6d7d2b887f33b6839b6f9 | [
"MIT"
] | 49 | 2015-05-21T08:32:30.000Z | 2022-02-21T04:56:13.000Z | venv/Lib/site-packages/pymsgbox/_native_win.py | AsterLaoWhy/Navi | 819e4cc9e70721d65da5979e0c7a6fead9eb9d6e | [
"MIT"
] | 9 | 2021-08-14T01:27:36.000Z | 2021-08-24T18:10:18.000Z | venv/Lib/site-packages/pymsgbox/_native_win.py | AsterLaoWhy/Navi | 819e4cc9e70721d65da5979e0c7a6fead9eb9d6e | [
"MIT"
] | 15 | 2015-04-09T19:26:33.000Z | 2022-02-16T19:02:42.000Z | # This module contains all the Windows-specific code to create native
# message boxes using the winapi.
# If you'd like to learn more about calling the winapi functions from
# Python, you can check out my other module "nicewin" to see nicely-documented
# examples. It is at https://github.com/asweigart/nicewin
# The d... | 31.987013 | 161 | 0.670727 |
# Python, you can check out my other module "nicewin" to see nicely-documented
# examples. It is at https://github.com/asweigart/nicewin
# The documentation for the MessageBox winapi is at:
# https://docs.microsoft.com/en-us/windows/desktop/api/winuser/nf-winuser-messagebox
import sys, ctypes
import pymsgbox
MB_... | true | true |
f74db61db061c119102d3c94cf111945daffd07a | 8,467 | py | Python | decisiveml/montecarlo.py | avielfedida/DecisiveML | cf0feceeda0fc4abd4af6cc766c7c14ee655b576 | [
"BSD-3-Clause"
] | 78 | 2020-04-13T13:21:25.000Z | 2022-03-22T12:47:49.000Z | decisiveml/montecarlo.py | avielfedida/DecisiveML | cf0feceeda0fc4abd4af6cc766c7c14ee655b576 | [
"BSD-3-Clause"
] | 2 | 2020-10-30T22:32:09.000Z | 2021-03-13T17:51:12.000Z | decisiveml/montecarlo.py | avielfedida/DecisiveML | cf0feceeda0fc4abd4af6cc766c7c14ee655b576 | [
"BSD-3-Clause"
] | 21 | 2020-04-13T21:19:25.000Z | 2022-01-22T14:48:36.000Z | import pandas as pd
import random
import statistics
import logging
logger = logging.getLogger(__name__)
# MonkeyPatch Python 3.6 choices into random 3.5.5
import bisect as _bisect
import itertools as _itertools
def choices(population, weights=None, cum_weights=None, k=1):
"""Return a k sized list of population ... | 34.559184 | 123 | 0.606827 | import pandas as pd
import random
import statistics
import logging
logger = logging.getLogger(__name__)
import bisect as _bisect
import itertools as _itertools
def choices(population, weights=None, cum_weights=None, k=1):
if cum_weights is None:
if weights is None:
total = len(population)
... | true | true |
f74db77c8b97bf1a0471a13410eadbfd45cebddc | 789 | py | Python | code/misc/shellcode/encoders/insertion/insertion-encoder.py | rbctee/MalwareDevelopment | 115cc5a7f2a0d42a6e7b6ae81b2b07ea514537e2 | [
"BSD-3-Clause"
] | null | null | null | code/misc/shellcode/encoders/insertion/insertion-encoder.py | rbctee/MalwareDevelopment | 115cc5a7f2a0d42a6e7b6ae81b2b07ea514537e2 | [
"BSD-3-Clause"
] | null | null | null | code/misc/shellcode/encoders/insertion/insertion-encoder.py | rbctee/MalwareDevelopment | 115cc5a7f2a0d42a6e7b6ae81b2b07ea514537e2 | [
"BSD-3-Clause"
] | null | null | null | import sys
try:
data = sys.argv[1].replace(r'\x', '')
except:
print(f"[+] Enter you shellcode as the first argument")
print(f"[+] Example:")
print("\t" + r'python3 ./script.py "\xeb\x1a\x31\xc0\x31\xdb\x5e\x88\x46\x07\x89\x46\x08\x89\x46\x0c\x89\xf3\xb0\x0b\x8d..."')
sys.exit(1)
data = bytes.fromh... | 23.205882 | 130 | 0.598226 | import sys
try:
data = sys.argv[1].replace(r'\x', '')
except:
print(f"[+] Enter you shellcode as the first argument")
print(f"[+] Example:")
print("\t" + r'python3 ./script.py "\xeb\x1a\x31\xc0\x31\xdb\x5e\x88\x46\x07\x89\x46\x08\x89\x46\x0c\x89\xf3\xb0\x0b\x8d..."')
sys.exit(1)
data = bytes.fromh... | true | true |
f74db77d4e75ad1dd6391bd7f2216e1c5a91ea0f | 7,604 | py | Python | tools/Slicer.py | rshariffdeen/PatchWeave | e41da9e506be8497da2ec9acacd327b8c942f7c8 | [
"MIT"
] | 5 | 2021-02-23T00:50:21.000Z | 2022-03-22T21:23:39.000Z | tools/Slicer.py | rshariffdeen/PatchWeave | e41da9e506be8497da2ec9acacd327b8c942f7c8 | [
"MIT"
] | null | null | null | tools/Slicer.py | rshariffdeen/PatchWeave | e41da9e506be8497da2ec9acacd327b8c942f7c8 | [
"MIT"
] | 1 | 2019-08-14T08:50:48.000Z | 2019-08-14T08:50:48.000Z | #! /usr/bin/env python3
# -*- coding: utf-8 -*-
import sys
from common.Utilities import get_code, error_exit
from ast import ASTGenerator
import Extractor
import Oracle
import Logger
import Filter
import Emitter
def slice_code_from_trace(diff_info, trace_list, path_a, path_b):
Logger.trace(__name__ + ":" + sys.... | 44.467836 | 93 | 0.547607 |
import sys
from common.Utilities import get_code, error_exit
from ast import ASTGenerator
import Extractor
import Oracle
import Logger
import Filter
import Emitter
def slice_code_from_trace(diff_info, trace_list, path_a, path_b):
Logger.trace(__name__ + ":" + sys._getframe().f_code.co_name, locals())
... | true | true |
f74db77fb5c040bbaf0c2ea054d56ccca4b33ede | 84,510 | py | Python | tests/schema/tests.py | ioinfinity/django | b6a0ab523751c13ae3eaec102de70f58f73a0d94 | [
"PSF-2.0",
"BSD-3-Clause"
] | null | null | null | tests/schema/tests.py | ioinfinity/django | b6a0ab523751c13ae3eaec102de70f58f73a0d94 | [
"PSF-2.0",
"BSD-3-Clause"
] | 1 | 2020-07-02T21:10:44.000Z | 2020-07-02T21:11:21.000Z | tests/schema/tests.py | ioinfinity/django | b6a0ab523751c13ae3eaec102de70f58f73a0d94 | [
"PSF-2.0",
"BSD-3-Clause"
] | 1 | 2020-08-11T18:46:32.000Z | 2020-08-11T18:46:32.000Z | import datetime
import itertools
import unittest
from copy import copy
from django.db import (
DatabaseError, IntegrityError, OperationalError, connection,
)
from django.db.models import Model
from django.db.models.deletion import CASCADE
from django.db.models.fields import (
AutoField, BigIntegerField, Binary... | 43.584322 | 114 | 0.643592 | import datetime
import itertools
import unittest
from copy import copy
from django.db import (
DatabaseError, IntegrityError, OperationalError, connection,
)
from django.db.models import Model
from django.db.models.deletion import CASCADE
from django.db.models.fields import (
AutoField, BigIntegerField, Binary... | true | true |
f74db84803583237b646326868702690d742bdbc | 313 | py | Python | tests/test_utils.py | logicalclocks/keras-autodoc | 0d7d1cde3bb4cd8020afd53385d33b34454bc4e6 | [
"Apache-2.0"
] | 34 | 2019-10-08T02:12:57.000Z | 2022-01-12T16:43:44.000Z | tests/test_utils.py | logicalclocks/keras-autodoc | 0d7d1cde3bb4cd8020afd53385d33b34454bc4e6 | [
"Apache-2.0"
] | 26 | 2019-10-21T19:41:14.000Z | 2021-11-17T17:37:23.000Z | tests/test_utils.py | logicalclocks/keras-autodoc | 0d7d1cde3bb4cd8020afd53385d33b34454bc4e6 | [
"Apache-2.0"
] | 22 | 2019-10-09T14:00:14.000Z | 2021-07-28T15:07:11.000Z | import os
import io
from keras_autodoc import utils
from . import dummy_package
def test_import_object():
assert os.path.join == utils.import_object('os.path.join')
assert io.BytesIO.flush == utils.import_object('io.BytesIO.flush')
assert dummy_package == utils.import_object('tests.dummy_package')
| 28.454545 | 70 | 0.763578 | import os
import io
from keras_autodoc import utils
from . import dummy_package
def test_import_object():
assert os.path.join == utils.import_object('os.path.join')
assert io.BytesIO.flush == utils.import_object('io.BytesIO.flush')
assert dummy_package == utils.import_object('tests.dummy_package')
| true | true |
f74db966a9a070b976ae93a0c881eec7726bdabb | 2,435 | py | Python | python3/koans/about_control_statements.py | myraileen/python_koans | c65f9469ac86873f209ea72c7c9f9163a84b2884 | [
"MIT"
] | null | null | null | python3/koans/about_control_statements.py | myraileen/python_koans | c65f9469ac86873f209ea72c7c9f9163a84b2884 | [
"MIT"
] | null | null | null | python3/koans/about_control_statements.py | myraileen/python_koans | c65f9469ac86873f209ea72c7c9f9163a84b2884 | [
"MIT"
] | null | null | null | #!/usr/bin/env python
# -*- coding: utf-8 -*-
from runner.koan import *
class AboutControlStatements(Koan):
def test_if_then_else_statements(self):
if True:
result = 'true value'
else:
result = 'false value'
self.assertEqual('true value', result)
def test_if_t... | 30.061728 | 248 | 0.537577 |
from runner.koan import *
class AboutControlStatements(Koan):
def test_if_then_else_statements(self):
if True:
result = 'true value'
else:
result = 'false value'
self.assertEqual('true value', result)
def test_if_then_statements(self):
result = 'defa... | true | true |
f74dba2019fdd03217369cfb350a527039fbd352 | 257 | py | Python | openmixup/models/semisup/__init__.py | Westlake-AI/openmixup | ea81250819e740dd823e30cb7ce382d14a3c1b91 | [
"Apache-2.0"
] | 10 | 2021-12-30T10:22:27.000Z | 2022-03-30T02:31:38.000Z | openmixup/models/semisup/__init__.py | Westlake-AI/openmixup | ea81250819e740dd823e30cb7ce382d14a3c1b91 | [
"Apache-2.0"
] | 3 | 2022-01-20T21:02:48.000Z | 2022-03-19T13:49:45.000Z | openmixup/models/semisup/__init__.py | Westlake-AI/openmixup | ea81250819e740dd823e30cb7ce382d14a3c1b91 | [
"Apache-2.0"
] | null | null | null | from .dmixmatch import DMixMatch
from .dmix_tuning import DMixTuning
from .fine_tuning import FineTuning
from .fixmatch import FixMatch
from .self_tuning import SelfTuning
__all__ = [
'DMixMatch', 'FixMatch', 'FineTuning', 'DMixTuning', 'SelfTuning'
]
| 25.7 | 69 | 0.782101 | from .dmixmatch import DMixMatch
from .dmix_tuning import DMixTuning
from .fine_tuning import FineTuning
from .fixmatch import FixMatch
from .self_tuning import SelfTuning
__all__ = [
'DMixMatch', 'FixMatch', 'FineTuning', 'DMixTuning', 'SelfTuning'
]
| true | true |
f74dbb92b0bc717c6b46937cc79987deca6bed43 | 9,126 | py | Python | src/App.py | deeplearningunb/NextValue | 50c04ea55fa3141009d1f018197e02344fdda327 | [
"MIT"
] | null | null | null | src/App.py | deeplearningunb/NextValue | 50c04ea55fa3141009d1f018197e02344fdda327 | [
"MIT"
] | 9 | 2021-04-10T22:33:36.000Z | 2021-05-13T01:47:04.000Z | src/App.py | deeplearningunb/NextValue | 50c04ea55fa3141009d1f018197e02344fdda327 | [
"MIT"
] | null | null | null | import tkinter as tk
from os import listdir
from os.path import isfile, join
from pages.StartPage import StartPage
from pages.ConfigurationPage import ConfigurationPage
from pages.TrainingPage import TrainingPage
from pages.ResultPage import ResultPage
from pages.ChooseDatePage import ChooseDatePage
from pages.ChooseIn... | 36.358566 | 143 | 0.635328 | import tkinter as tk
from os import listdir
from os.path import isfile, join
from pages.StartPage import StartPage
from pages.ConfigurationPage import ConfigurationPage
from pages.TrainingPage import TrainingPage
from pages.ResultPage import ResultPage
from pages.ChooseDatePage import ChooseDatePage
from pages.ChooseIn... | true | true |
f74dbc02065307cb05c9e6eae9e13ab4ac6fe3d0 | 12,597 | py | Python | models/networks_graphx_refine_no_img_encoder.py | brian220/Sketch2PointCloud | 65ce7b9921a7bef9f21ca2fc72820ca7f6fd6648 | [
"MIT"
] | 3 | 2022-03-28T02:37:05.000Z | 2022-03-31T05:51:12.000Z | models/networks_graphx_refine_no_img_encoder.py | brian220/sketch_part_rec | 17e8657ffc6605804ab4f1da89f446ea4d37665c | [
"MIT"
] | null | null | null | models/networks_graphx_refine_no_img_encoder.py | brian220/sketch_part_rec | 17e8657ffc6605804ab4f1da89f446ea4d37665c | [
"MIT"
] | 1 | 2022-03-30T04:51:39.000Z | 2022-03-30T04:51:39.000Z | import torch.nn as nn
import torch
import torch.nn.functional as F
import torchvision.models
import os
import utils.network_utils
from utils.pointnet2_utils import PointNetSetAbstraction,PointNetFeaturePropagation
import cuda.emd.emd_module as emd
# Set the path for pretrain weight
os.environ['TORCH_HOME'] = '/media... | 36.941349 | 139 | 0.606891 | import torch.nn as nn
import torch
import torch.nn.functional as F
import torchvision.models
import os
import utils.network_utils
from utils.pointnet2_utils import PointNetSetAbstraction,PointNetFeaturePropagation
import cuda.emd.emd_module as emd
os.environ['TORCH_HOME'] = '/media/caig/FECA2C89CA2C406F/sketch3D/pr... | true | true |
f74dbc0e6c8d8c7b0435332cca337bc6e6c0c52c | 662 | py | Python | examples/ssa_example.py | SMAT-Lab/Scalpel | 1022200043f2d9e8c24256821b863997ab34dd49 | [
"Apache-2.0"
] | 102 | 2021-12-15T09:08:48.000Z | 2022-03-24T15:15:25.000Z | examples/ssa_example.py | StarWatch27/Scalpel | 8853e6e84f318f3cfeda0e03d274748b2fbe30fa | [
"Apache-2.0"
] | 11 | 2021-12-04T11:48:31.000Z | 2022-03-21T09:21:45.000Z | examples/ssa_example.py | StarWatch27/Scalpel | 8853e6e84f318f3cfeda0e03d274748b2fbe30fa | [
"Apache-2.0"
] | 11 | 2021-12-04T11:47:41.000Z | 2022-02-06T09:04:39.000Z | import os
import sys
import ast
import astor
import unittest
from scalpel.core.mnode import MNode
from scalpel.SSA.const import SSA
code_str = """
b = 10
if b>0:
a = a+b
else:
a = 10
print(a)
"""
def main():
mnode = MNode("local")
mnode.source = code_str
mnode.gen_ast()
cfg = mnode.gen_cfg()
... | 19.470588 | 64 | 0.654079 | import os
import sys
import ast
import astor
import unittest
from scalpel.core.mnode import MNode
from scalpel.SSA.const import SSA
code_str = """
b = 10
if b>0:
a = a+b
else:
a = 10
print(a)
"""
def main():
mnode = MNode("local")
mnode.source = code_str
mnode.gen_ast()
cfg = mnode.gen_cfg()
... | true | true |
f74dbc0edbbc975785b88e27d1296ba416992478 | 287 | py | Python | awswrangler/__metadata__.py | Kyruski/aws-data-wrangler | 2c240e398bef06d00a69ac690c23ffb50666df69 | [
"Apache-2.0"
] | null | null | null | awswrangler/__metadata__.py | Kyruski/aws-data-wrangler | 2c240e398bef06d00a69ac690c23ffb50666df69 | [
"Apache-2.0"
] | 56 | 2021-06-04T13:41:52.000Z | 2022-03-28T08:53:21.000Z | awswrangler/__metadata__.py | Kyruski/aws-data-wrangler | 2c240e398bef06d00a69ac690c23ffb50666df69 | [
"Apache-2.0"
] | 1 | 2022-02-06T02:04:32.000Z | 2022-02-06T02:04:32.000Z | """Metadata Module.
Source repository: https://github.com/awslabs/aws-data-wrangler
Documentation: https://aws-data-wrangler.readthedocs.io/
"""
__title__: str = "awswrangler"
__description__: str = "Pandas on AWS."
__version__: str = "2.12.1"
__license__: str = "Apache License 2.0"
| 23.916667 | 63 | 0.735192 |
__title__: str = "awswrangler"
__description__: str = "Pandas on AWS."
__version__: str = "2.12.1"
__license__: str = "Apache License 2.0"
| true | true |
f74dbc1b58777aad5c58bb6eb65101e341616870 | 805 | py | Python | lona/shell/commands/lona_connections.py | korantu/lona | 5039fa59f37cc32b9c789753af2ed8a8670ab611 | [
"MIT"
] | 155 | 2020-09-12T21:54:10.000Z | 2021-08-15T15:12:40.000Z | lona/shell/commands/lona_connections.py | korantu/lona | 5039fa59f37cc32b9c789753af2ed8a8670ab611 | [
"MIT"
] | 9 | 2020-09-30T19:34:07.000Z | 2021-08-15T17:20:14.000Z | lona/shell/commands/lona_connections.py | korantu/lona | 5039fa59f37cc32b9c789753af2ed8a8670ab611 | [
"MIT"
] | 9 | 2020-09-30T19:28:41.000Z | 2021-08-14T15:39:39.000Z | from rlpython.utils.argument_parser import ReplArgumentParser
from rlpython.utils.table import write_table
class LonaConnectionsCommand:
"""
List all current connections to Lona
"""
NAME = 'lona_connections'
def __init__(self, repl):
self.repl = repl
def run(self, argv):
# p... | 24.393939 | 74 | 0.632298 | from rlpython.utils.argument_parser import ReplArgumentParser
from rlpython.utils.table import write_table
class LonaConnectionsCommand:
NAME = 'lona_connections'
def __init__(self, repl):
self.repl = repl
def run(self, argv):
argument_parser = ReplArgumentParser(
r... | true | true |
f74dbc61b0ec900aecf1955c749cfc34b0eb57af | 672 | py | Python | app/logger.py | japinol7/music-lib-explorer | 65323bfe7ce7355222bd35ebad8a9240bdfd8cec | [
"MIT"
] | 1 | 2021-08-03T15:01:49.000Z | 2021-08-03T15:01:49.000Z | app/logger.py | japinol7/music-lib-explorer | 65323bfe7ce7355222bd35ebad8a9240bdfd8cec | [
"MIT"
] | null | null | null | app/logger.py | japinol7/music-lib-explorer | 65323bfe7ce7355222bd35ebad8a9240bdfd8cec | [
"MIT"
] | null | null | null | import os
import sys
import logging
from app.config import config
logging.basicConfig(format=config.LOGGER_FORMAT)
def get_level(level):
return {
'CRITICAL': logging.CRITICAL,
'DEBUG': logging.DEBUG,
'ERROR': logging.ERROR,
'FATAL': logging.FATAL,
'INFO': logging.INFO,
... | 21 | 48 | 0.68006 | import os
import sys
import logging
from app.config import config
logging.basicConfig(format=config.LOGGER_FORMAT)
def get_level(level):
return {
'CRITICAL': logging.CRITICAL,
'DEBUG': logging.DEBUG,
'ERROR': logging.ERROR,
'FATAL': logging.FATAL,
'INFO': logging.INFO,
... | true | true |
f74dbcee306ee920bd26d1653bb95b82f51df0a1 | 1,105 | py | Python | setup.py | jsoa/django-tabbed-admin | 64e4c0694834af85594c6509b100a89a2fce2ad1 | [
"BSD-3-Clause"
] | 1 | 2020-05-19T07:48:08.000Z | 2020-05-19T07:48:08.000Z | setup.py | jsoa/django-tabbed-admin | 64e4c0694834af85594c6509b100a89a2fce2ad1 | [
"BSD-3-Clause"
] | null | null | null | setup.py | jsoa/django-tabbed-admin | 64e4c0694834af85594c6509b100a89a2fce2ad1 | [
"BSD-3-Clause"
] | 5 | 2017-03-30T20:29:19.000Z | 2020-03-26T21:14:32.000Z | #! /usr/bin/env python
from distutils.core import setup
from setuptools import find_packages
import sys
# python2 and python3 support
try:
reload
except NameError:
# py3k has unicode by default
pass
else:
reload(sys).setdefaultencoding('utf-8')
setup(
name='django-tabbed-admin',
version='1.0.... | 27.625 | 57 | 0.651584 |
from distutils.core import setup
from setuptools import find_packages
import sys
try:
reload
except NameError:
pass
else:
reload(sys).setdefaultencoding('utf-8')
setup(
name='django-tabbed-admin',
version='1.0.1',
author='Guillaume Pousseo',
author_email='guillaumepousseo@revsquare... | true | true |
f74dbcfc5d08a83441eb27b2b95e8a7c6c96d589 | 8,396 | py | Python | tests/command_line/test_merge.py | graeme-winter/dials | 78a696a6591e224e73204846f39771ebac0c2668 | [
"BSD-3-Clause"
] | null | null | null | tests/command_line/test_merge.py | graeme-winter/dials | 78a696a6591e224e73204846f39771ebac0c2668 | [
"BSD-3-Clause"
] | null | null | null | tests/command_line/test_merge.py | graeme-winter/dials | 78a696a6591e224e73204846f39771ebac0c2668 | [
"BSD-3-Clause"
] | null | null | null | """Tests for dials.merge command line program."""
import procrunner
import pytest
from cctbx import uctbx
from dxtbx.model.experiment_list import ExperimentListFactory
from iotbx import mtz
from dials.array_family import flex
def validate_mtz(mtz_file, expected_labels, unexpected_labels=None):
assert mtz_file... | 33.31746 | 84 | 0.665317 |
import procrunner
import pytest
from cctbx import uctbx
from dxtbx.model.experiment_list import ExperimentListFactory
from iotbx import mtz
from dials.array_family import flex
def validate_mtz(mtz_file, expected_labels, unexpected_labels=None):
assert mtz_file.check()
m = mtz.object(mtz_file.strpath)
... | true | true |
f74dbd875164eed8065447bd131b31d823e95d53 | 329 | py | Python | Arays/AlgoExpert/easy/1_validate_subsequence.py | sounak95/100_days_of_code | 50fbf088ce6ab2137aa216a30e3b3f828b278a22 | [
"Apache-2.0"
] | null | null | null | Arays/AlgoExpert/easy/1_validate_subsequence.py | sounak95/100_days_of_code | 50fbf088ce6ab2137aa216a30e3b3f828b278a22 | [
"Apache-2.0"
] | null | null | null | Arays/AlgoExpert/easy/1_validate_subsequence.py | sounak95/100_days_of_code | 50fbf088ce6ab2137aa216a30e3b3f828b278a22 | [
"Apache-2.0"
] | null | null | null |
def validate_subseuence(arr, seq):
arr_idx=0
seq_idx=0
while(arr_idx<len(arr) and seq_idx<len(seq)):
if arr[arr_idx]== seq[seq_idx]:
seq_idx+=1
arr_idx+=1
return seq_idx==len(seq)
print(validate_subseuence([1,2,3,4,5,6], [2,4,6]))
print(validate_subseuence([1,2,3,4,5,6], [... | 23.5 | 50 | 0.610942 |
def validate_subseuence(arr, seq):
arr_idx=0
seq_idx=0
while(arr_idx<len(arr) and seq_idx<len(seq)):
if arr[arr_idx]== seq[seq_idx]:
seq_idx+=1
arr_idx+=1
return seq_idx==len(seq)
print(validate_subseuence([1,2,3,4,5,6], [2,4,6]))
print(validate_subseuence([1,2,3,4,5,6], [... | true | true |
f74dbf3bfd075d0354c04bc14ad9c22ffe030746 | 839 | py | Python | policy.py | escribano89/cartpole-REINFORCE | e2d79ce721a50feea783c368a66c6f80631cdf26 | [
"CC0-1.0"
] | null | null | null | policy.py | escribano89/cartpole-REINFORCE | e2d79ce721a50feea783c368a66c6f80631cdf26 | [
"CC0-1.0"
] | null | null | null | policy.py | escribano89/cartpole-REINFORCE | e2d79ce721a50feea783c368a66c6f80631cdf26 | [
"CC0-1.0"
] | null | null | null | import torch
import torch.nn as nn
import torch.nn.functional as F
from torch.distributions import Categorical
class Policy(nn.Module):
def __init__(self, s_size=4, h_size=8, a_size=2):
super(Policy, self).__init__()
self.fc1 = nn.Linear(s_size, h_size)
self.fc2 = nn.Linear(h_size,... | 33.56 | 71 | 0.595948 | import torch
import torch.nn as nn
import torch.nn.functional as F
from torch.distributions import Categorical
class Policy(nn.Module):
def __init__(self, s_size=4, h_size=8, a_size=2):
super(Policy, self).__init__()
self.fc1 = nn.Linear(s_size, h_size)
self.fc2 = nn.Linear(h_size,... | true | true |
f74dbf6594a34f35dbc0137ca84a9b43431b4b50 | 20,495 | py | Python | octavia/tests/unit/amphorae/backends/agent/api_server/test_amphora_info.py | anqili426/LBEvents | 58a4490bbf44df30bcf1c38adfedf1923fdbaeeb | [
"Apache-2.0"
] | null | null | null | octavia/tests/unit/amphorae/backends/agent/api_server/test_amphora_info.py | anqili426/LBEvents | 58a4490bbf44df30bcf1c38adfedf1923fdbaeeb | [
"Apache-2.0"
] | null | null | null | octavia/tests/unit/amphorae/backends/agent/api_server/test_amphora_info.py | anqili426/LBEvents | 58a4490bbf44df30bcf1c38adfedf1923fdbaeeb | [
"Apache-2.0"
] | null | null | null | # Copyright 2017 Rackspace US, Inc.
#
# Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance with the License. You may obtain
# a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writin... | 49.86618 | 79 | 0.525055 |
import random
import mock
from oslo_utils import uuidutils
from octavia.amphorae.backends.agent import api_server
from octavia.amphorae.backends.agent.api_server import amphora_info
from octavia.tests.common import utils as test_utils
import octavia.tests.unit.base as base
class TestAmphoraInfo(base.T... | true | true |
f74dbf76f7d7bc9080059d3ab1350725c1f3f0cd | 1,700 | py | Python | sri/maxpathsum_in_binary_tree.py | ravichalla/wallbreaker | 0d587f12c60df5e4bca47f9183484a69d284d1f5 | [
"MIT"
] | null | null | null | sri/maxpathsum_in_binary_tree.py | ravichalla/wallbreaker | 0d587f12c60df5e4bca47f9183484a69d284d1f5 | [
"MIT"
] | null | null | null | sri/maxpathsum_in_binary_tree.py | ravichalla/wallbreaker | 0d587f12c60df5e4bca47f9183484a69d284d1f5 | [
"MIT"
] | null | null | null | class TreeNode:
def __init__(self, x):
self.val = x
self.left = None
self.right = None
# O(n) time | O(Log(n)) space
def maxPathSum(tree):
_, maxSum =findMaxSum(tree)
return maxSum
def findMaxSum(tree):
if tree is None:
return (0, 0)
leftMaxSumAsBranch, leftMax... | 28.333333 | 76 | 0.621765 | class TreeNode:
def __init__(self, x):
self.val = x
self.left = None
self.right = None
def maxPathSum(tree):
_, maxSum =findMaxSum(tree)
return maxSum
def findMaxSum(tree):
if tree is None:
return (0, 0)
leftMaxSumAsBranch, leftMaxPathSum = findMaxSum(tree.lef... | true | true |
f74dc0583b765ed097d12b201fadc0abfbf3a6a4 | 649 | py | Python | server/manage.py | dmt0768/Synthesizer_upd | 66ee7830bb14f097fe9013d69a2f89cd893f18f0 | [
"MIT"
] | null | null | null | server/manage.py | dmt0768/Synthesizer_upd | 66ee7830bb14f097fe9013d69a2f89cd893f18f0 | [
"MIT"
] | null | null | null | server/manage.py | dmt0768/Synthesizer_upd | 66ee7830bb14f097fe9013d69a2f89cd893f18f0 | [
"MIT"
] | null | null | null | #!/home/debian/server_synth/venv/bin/python3
"""Django's command-line utility for administrative tasks."""
import os
import sys
def main():
os.environ.setdefault('DJANGO_SETTINGS_MODULE', 'server.settings')
try:
from django.core.management import execute_from_command_line
except ImportError as exc... | 29.5 | 73 | 0.690293 |
import os
import sys
def main():
os.environ.setdefault('DJANGO_SETTINGS_MODULE', 'server.settings')
try:
from django.core.management import execute_from_command_line
except ImportError as exc:
raise ImportError(
"Couldn't import Django. Are you sure it's installed and "
... | true | true |
f74dc0bf0c01c4ace46b3d74caf0620cd43d9476 | 15,667 | py | Python | utils/reprocessing.py | dpton/tensorflow-attention-rnn | a1b8884640ca49d6fdebc7df2167e4353364a243 | [
"Apache-2.0"
] | 2 | 2017-11-20T14:02:07.000Z | 2018-11-16T08:32:48.000Z | utils/reprocessing.py | dpton/tensorflow-attention-rnn | a1b8884640ca49d6fdebc7df2167e4353364a243 | [
"Apache-2.0"
] | null | null | null | utils/reprocessing.py | dpton/tensorflow-attention-rnn | a1b8884640ca49d6fdebc7df2167e4353364a243 | [
"Apache-2.0"
] | 1 | 2018-10-16T03:10:39.000Z | 2018-10-16T03:10:39.000Z | # _*_ coding:utf-8 _*_
# !/usr/bin/env python
from __future__ import absolute_import, division, print_function, unicode_literals
import numpy as np
import logging
import nltk
from nltk.corpus import stopwords
from gensim.models.wrappers import FastText
from gensim.models import Word2Vec
import random
import threading
i... | 38.305623 | 148 | 0.631136 |
from __future__ import absolute_import, division, print_function, unicode_literals
import numpy as np
import logging
import nltk
from nltk.corpus import stopwords
from gensim.models.wrappers import FastText
from gensim.models import Word2Vec
import random
import threading
import tensorflow as tf
import re
import u... | true | true |
f74dc1489938cb9c9910f2d25543a58672b8e7cb | 17,716 | py | Python | Lib/test/test_posixpath.py | rbuzatu90/hyperv-python | 82bf5a72b4d956ea05affe1644b47e378dec0f4e | [
"bzip2-1.0.6"
] | 2,151 | 2020-04-18T07:31:17.000Z | 2022-03-31T08:39:18.000Z | Lib/test/test_posixpath.py | odsod/cpython-internals-course | 55fffca28e83ac0f30029c60113a3110451dfa08 | [
"PSF-2.0"
] | 395 | 2020-04-18T08:22:18.000Z | 2021-12-08T13:04:49.000Z | Lib/test/test_posixpath.py | odsod/cpython-internals-course | 55fffca28e83ac0f30029c60113a3110451dfa08 | [
"PSF-2.0"
] | 338 | 2020-04-18T08:03:10.000Z | 2022-03-29T12:33:22.000Z | import unittest
from test import test_support, test_genericpath
import posixpath, os
from posixpath import realpath, abspath, dirname, basename
# An absolute path to a temporary filename for testing. We can't rely on TESTFN
# being an absolute path, so we need this.
ABSTFN = abspath(test_support.TESTFN)
def skip_if... | 41.783019 | 97 | 0.518853 | import unittest
from test import test_support, test_genericpath
import posixpath, os
from posixpath import realpath, abspath, dirname, basename
# being an absolute path, so we need this.
ABSTFN = abspath(test_support.TESTFN)
def skip_if_ABSTFN_contains_backslash(test):
found_backslash = '\\' in ABSTFN
msg ... | true | true |
f74dc20833b654bf80c427a1d599653403c8f428 | 9,599 | py | Python | plugins/keepkey/clientbase.py | futuro-coin/electrum-futuro | 04910904a6d4d330f202daf0c1975b8296ad8e5d | [
"MIT"
] | 4 | 2019-01-16T14:30:39.000Z | 2021-10-21T04:21:45.000Z | plugins/keepkey/clientbase.py | futuro-coin/electrum-futuro | 04910904a6d4d330f202daf0c1975b8296ad8e5d | [
"MIT"
] | 1 | 2021-11-15T17:47:31.000Z | 2021-11-15T17:47:31.000Z | plugins/keepkey/clientbase.py | futuro-coin/electrum-futuro | 04910904a6d4d330f202daf0c1975b8296ad8e5d | [
"MIT"
] | 2 | 2018-12-18T17:32:46.000Z | 2019-01-16T14:30:42.000Z | import time
from struct import pack
from electrum.i18n import _
from electrum.util import PrintError, UserCancelled
from electrum.keystore import bip39_normalize_passphrase
from electrum.bitcoin import serialize_xpub
class GuiMixin(object):
# Requires: self.proto, self.device
messages = {
3: _("Conf... | 38.243028 | 136 | 0.612043 | import time
from struct import pack
from electrum.i18n import _
from electrum.util import PrintError, UserCancelled
from electrum.keystore import bip39_normalize_passphrase
from electrum.bitcoin import serialize_xpub
class GuiMixin(object):
messages = {
3: _("Confirm the transaction output on your ... | true | true |
f74dc38c10e2c7c599684c61ab8cc06a08570ff9 | 9,246 | py | Python | kedro/extras/datasets/pickle/pickle_dataset.py | csaranbalaji/kedro | 8968f95bf22322c19f8ddc8838589a2d1384b01c | [
"Apache-2.0"
] | 1 | 2020-09-07T17:12:22.000Z | 2020-09-07T17:12:22.000Z | kedro/extras/datasets/pickle/pickle_dataset.py | csaranbalaji/kedro | 8968f95bf22322c19f8ddc8838589a2d1384b01c | [
"Apache-2.0"
] | null | null | null | kedro/extras/datasets/pickle/pickle_dataset.py | csaranbalaji/kedro | 8968f95bf22322c19f8ddc8838589a2d1384b01c | [
"Apache-2.0"
] | null | null | null | # Copyright 2020 QuantumBlack Visual Analytics Limited
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# THE SOFTWARE IS PROVIDED "AS IS",... | 41.461883 | 109 | 0.63833 |
import pickle
from copy import deepcopy
from pathlib import PurePosixPath
from typing import Any, Dict
import fsspec
from kedro.io.core import (
AbstractVersionedDataSet,
DataSetError,
Version,
get_filepath_str,
get_protocol_and_path,
)
try:
import joblib
except Im... | true | true |
f74dc4ce5d93b4b2744c184f87e8d95ffff94fae | 4,556 | py | Python | hpccm/templates/git.py | brisbane/hpc-container-maker | 29c675d62651c6dde566b699ad85f794114a94c4 | [
"Apache-2.0"
] | null | null | null | hpccm/templates/git.py | brisbane/hpc-container-maker | 29c675d62651c6dde566b699ad85f794114a94c4 | [
"Apache-2.0"
] | null | null | null | hpccm/templates/git.py | brisbane/hpc-container-maker | 29c675d62651c6dde566b699ad85f794114a94c4 | [
"Apache-2.0"
] | null | null | null | # Copyright (c) 2018, NVIDIA CORPORATION. All rights reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by appli... | 34.778626 | 92 | 0.588455 |
from __future__ import absolute_import
from __future__ import unicode_literals
from __future__ import print_function
import logging
import os
import posixpath
import re
import subprocess
import hpccm.base_object
class git(hpccm.base_object):
def __init__(self, **kwargs):
super(git, se... | true | true |
f74dc688b3d7be87c7f3eb7142ffd8da0721b455 | 24,346 | py | Python | venv/lib/python3.8/site-packages/django/contrib/gis/gdal/geometries.py | Joshua-Barawa/My-Photos | adcaea48149c6b31e9559b045709d538d0b749bc | [
"PostgreSQL",
"Unlicense"
] | 16 | 2019-08-10T12:24:06.000Z | 2020-05-21T09:11:14.000Z | venv/lib/python3.8/site-packages/django/contrib/gis/gdal/geometries.py | Joshua-Barawa/My-Photos | adcaea48149c6b31e9559b045709d538d0b749bc | [
"PostgreSQL",
"Unlicense"
] | 12 | 2019-08-10T11:55:29.000Z | 2020-05-21T04:46:30.000Z | venv/lib/python3.8/site-packages/django/contrib/gis/gdal/geometries.py | Joshua-Barawa/My-Photos | adcaea48149c6b31e9559b045709d538d0b749bc | [
"PostgreSQL",
"Unlicense"
] | 4 | 2022-03-12T10:17:00.000Z | 2022-03-26T08:40:43.000Z | """
The OGRGeometry is a wrapper for using the OGR Geometry class
(see https://gdal.org/api/ogrgeometry_cpp.html#_CPPv411OGRGeometry).
OGRGeometry may be instantiated when reading geometries from OGR Data Sources
(e.g. SHP files), or when given OGC WKT (a string).
While the 'full' API is not present yet, the API ... | 32.723118 | 88 | 0.622648 | import sys
from binascii import b2a_hex
from ctypes import byref, c_char_p, c_double, c_ubyte, c_void_p, string_at
from django.contrib.gis.gdal.base import GDALBase
from django.contrib.gis.gdal.envelope import Envelope, OGREnvelope
from django.contrib.gis.gdal.error import GDALException, SRSException
from django.contr... | true | true |
f74dc7690ca163b0c3ffed75e506208a222f0701 | 4,284 | py | Python | homeassistant/components/fail2ban/sensor.py | MrDelik/core | 93a66cc357b226389967668441000498a10453bb | [
"Apache-2.0"
] | 30,023 | 2016-04-13T10:17:53.000Z | 2020-03-02T12:56:31.000Z | homeassistant/components/fail2ban/sensor.py | MrDelik/core | 93a66cc357b226389967668441000498a10453bb | [
"Apache-2.0"
] | 24,710 | 2016-04-13T08:27:26.000Z | 2020-03-02T12:59:13.000Z | homeassistant/components/fail2ban/sensor.py | MrDelik/core | 93a66cc357b226389967668441000498a10453bb | [
"Apache-2.0"
] | 11,956 | 2016-04-13T18:42:31.000Z | 2020-03-02T09:32:12.000Z | """Support for displaying IPs banned by fail2ban."""
from __future__ import annotations
from datetime import timedelta
import logging
import os
import re
import voluptuous as vol
from homeassistant.components.sensor import PLATFORM_SCHEMA, SensorEntity
from homeassistant.const import CONF_FILE_PATH, CONF_NAME
from h... | 32.210526 | 85 | 0.645658 | from __future__ import annotations
from datetime import timedelta
import logging
import os
import re
import voluptuous as vol
from homeassistant.components.sensor import PLATFORM_SCHEMA, SensorEntity
from homeassistant.const import CONF_FILE_PATH, CONF_NAME
from homeassistant.core import HomeAssistant
import homeass... | true | true |
f74dc94409af598c9ae22618267d5c054f1dfda3 | 30,000 | py | Python | efficientdet/inference.py | zzm422/automl | 38d6623e0983d6ee1d16bb5b1db5c6b2ccbb3ecf | [
"Apache-2.0"
] | null | null | null | efficientdet/inference.py | zzm422/automl | 38d6623e0983d6ee1d16bb5b1db5c6b2ccbb3ecf | [
"Apache-2.0"
] | null | null | null | efficientdet/inference.py | zzm422/automl | 38d6623e0983d6ee1d16bb5b1db5c6b2ccbb3ecf | [
"Apache-2.0"
] | 1 | 2020-08-30T13:52:35.000Z | 2020-08-30T13:52:35.000Z | # Copyright 2020 Google Research. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law... | 37.174721 | 119 | 0.662367 |
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
import copy
import functools
import os
import time
from absl import logging
import numpy as np
from PIL import Image
import tensorflow.compat.v1 as tf
from typing import Text, Dict, Any, List, ... | true | true |
f74dc9c1edd0105eb5f0634515271a31a8a028da | 6,089 | py | Python | basicsr/ops/upfirdn2d/upfirdn2d.py | marcelodiaz558/BasicSR | 1d5138ed567e966965fd1540838d27e6f5082b70 | [
"Apache-2.0",
"MIT"
] | 1 | 2021-12-14T10:06:12.000Z | 2021-12-14T10:06:12.000Z | basicsr/ops/upfirdn2d/upfirdn2d.py | marcelodiaz558/BasicSR | 1d5138ed567e966965fd1540838d27e6f5082b70 | [
"Apache-2.0",
"MIT"
] | null | null | null | basicsr/ops/upfirdn2d/upfirdn2d.py | marcelodiaz558/BasicSR | 1d5138ed567e966965fd1540838d27e6f5082b70 | [
"Apache-2.0",
"MIT"
] | null | null | null | # modify from https://github.com/rosinality/stylegan2-pytorch/blob/master/op/upfirdn2d.py # noqa:E501
import os
import torch
from torch.autograd import Function
from torch.nn import functional as F
BASICSR_JIT = os.getenv('BASICSR_JIT')
if BASICSR_JIT == 'True':
from torch.utils.cpp_extension import load
mod... | 31.549223 | 117 | 0.572344 |
import torch
from torch.autograd import Function
from torch.nn import functional as F
BASICSR_JIT = os.getenv('BASICSR_JIT')
if BASICSR_JIT == 'True':
from torch.utils.cpp_extension import load
module_path = os.path.dirname(__file__)
upfirdn2d_ext = load(
'upfirdn2d',
sources=[
... | true | true |
f74dc9ecb093044dac44b4cd0ccae489bc5f31b1 | 573 | py | Python | monkeygod/forms.py | Nonse/monkeys | 93681edf18126cc49858992f80df25a7cff931e8 | [
"MIT"
] | null | null | null | monkeygod/forms.py | Nonse/monkeys | 93681edf18126cc49858992f80df25a7cff931e8 | [
"MIT"
] | null | null | null | monkeygod/forms.py | Nonse/monkeys | 93681edf18126cc49858992f80df25a7cff931e8 | [
"MIT"
] | null | null | null | from flask_wtf import Form
from wtforms import StringField, IntegerField
from wtforms.fields.html5 import EmailField
from wtforms.validators import *
class CreateMonkeyForm(Form):
name = StringField('name', validators=[DataRequired()])
age = IntegerField('age', validators=[DataRequired()])
email = EmailFi... | 33.705882 | 61 | 0.73822 | from flask_wtf import Form
from wtforms import StringField, IntegerField
from wtforms.fields.html5 import EmailField
from wtforms.validators import *
class CreateMonkeyForm(Form):
name = StringField('name', validators=[DataRequired()])
age = IntegerField('age', validators=[DataRequired()])
email = EmailFi... | true | true |
f74dcaab5a3652889a05f85b43b185e95c4a9aae | 770 | py | Python | software/GTac_Hand/draw_bubbles_py_finger.py | roobooot/GTac_ | 94dc67668f87cfd17575033fc880ea7e4327e6ef | [
"MIT"
] | null | null | null | software/GTac_Hand/draw_bubbles_py_finger.py | roobooot/GTac_ | 94dc67668f87cfd17575033fc880ea7e4327e6ef | [
"MIT"
] | null | null | null | software/GTac_Hand/draw_bubbles_py_finger.py | roobooot/GTac_ | 94dc67668f87cfd17575033fc880ea7e4327e6ef | [
"MIT"
] | null | null | null | # -*- coding: utf-8 -*-
"""
Created on Fri Apr 9 09:50:42 2021
@author: Zeyu
"""
import serial
import time
from data_gen import data_checkout,raw_data_checkout
if __name__ == '__main__':
try:
ser = serial.Serial('COM12', 115200)
except:
print('Serial Connection Failed, Will Try Again in 3 SE... | 25.666667 | 70 | 0.548052 |
import serial
import time
from data_gen import data_checkout,raw_data_checkout
if __name__ == '__main__':
try:
ser = serial.Serial('COM12', 115200)
except:
print('Serial Connection Failed, Will Try Again in 3 SECONDS')
time.sleep(3)
else:
if ser.is_open:
print(... | true | true |
f74dcbce2752edbbb1db23c98280a95f8f8c497b | 839 | py | Python | api/schemas/airplane.py | ascii-dev/flight-booking | 3a64951f91d0254402bc5c14e5ef6d1bd2cf372e | [
"MIT"
] | null | null | null | api/schemas/airplane.py | ascii-dev/flight-booking | 3a64951f91d0254402bc5c14e5ef6d1bd2cf372e | [
"MIT"
] | 30 | 2019-05-26T09:39:12.000Z | 2021-06-02T00:16:58.000Z | api/schemas/airplane.py | ascii-dev/flight-booking | 3a64951f91d0254402bc5c14e5ef6d1bd2cf372e | [
"MIT"
] | null | null | null | """Module for airplane schema"""
from marshmallow import fields
from .base.base_schema import BaseSchema
from ..utilities.helpers.common_schema_args import common_schema_args
from ..utilities.validators.string_length_validator import \
string_length_validator, empty_string_validator
from ..utilities.validators.n... | 31.074074 | 69 | 0.713945 | from marshmallow import fields
from .base.base_schema import BaseSchema
from ..utilities.helpers.common_schema_args import common_schema_args
from ..utilities.validators.string_length_validator import \
string_length_validator, empty_string_validator
from ..utilities.validators.name_validator import name_validat... | true | true |
f74dcc7b527e602a89975763744611a138460b1d | 7,403 | py | Python | unittests/properties_test.py | engeg/recipes-py | 9dac536b55887262b4ce846f3db7a7f596542e5e | [
"Apache-2.0"
] | 23 | 2016-01-20T00:45:26.000Z | 2022-02-26T04:25:30.000Z | unittests/properties_test.py | engeg/recipes-py | 9dac536b55887262b4ce846f3db7a7f596542e5e | [
"Apache-2.0"
] | 8 | 2016-01-15T19:00:38.000Z | 2018-03-06T00:15:24.000Z | unittests/properties_test.py | engeg/recipes-py | 9dac536b55887262b4ce846f3db7a7f596542e5e | [
"Apache-2.0"
] | 13 | 2015-09-05T05:52:43.000Z | 2019-07-08T17:34:27.000Z | #!/usr/bin/env vpython
# Copyright 2015 The LUCI Authors. All rights reserved.
# Use of this source code is governed under the Apache License, Version 2.0
# that can be found in the LICENSE file.
import test_env
from recipe_engine import recipe_api, config
RECIPE_PROPERTY = recipe_api.BoundProperty.RECIPE_PROPERTY
... | 34.755869 | 88 | 0.639606 |
import test_env
from recipe_engine import recipe_api, config
RECIPE_PROPERTY = recipe_api.BoundProperty.RECIPE_PROPERTY
MODULE_PROPERTY = recipe_api.BoundProperty.MODULE_PROPERTY
def make_prop(**kwargs):
name = kwargs.pop('name', 'dumb_name')
return recipe_api.Property(**kwargs).bind(
name, RECIPE_PRO... | true | true |
f74dccdec58cd4914c6a800b558f844912c359ce | 1,458 | py | Python | utils/ucf10/video_jpg_ucf101_hmdb51.py | sakshikakde/interpretability_of_lstm | 241166b91a5f4be733807c38d905946136a066fd | [
"MIT"
] | 2 | 2022-01-13T16:49:24.000Z | 2022-01-24T00:59:54.000Z | utils/ucf10/video_jpg_ucf101_hmdb51.py | sakshikakde/interpretability_of_lstm | 241166b91a5f4be733807c38d905946136a066fd | [
"MIT"
] | null | null | null | utils/ucf10/video_jpg_ucf101_hmdb51.py | sakshikakde/interpretability_of_lstm | 241166b91a5f4be733807c38d905946136a066fd | [
"MIT"
] | null | null | null | from __future__ import print_function, division
import os
import sys
import subprocess
def class_process(dir_path, dst_dir_path, class_name):
class_path = os.path.join(dir_path, class_name)
if not os.path.isdir(class_path):
return
dst_class_path = os.path.join(dst_dir_path, class_name)
if not os.path.exis... | 31.021277 | 111 | 0.689986 | from __future__ import print_function, division
import os
import sys
import subprocess
def class_process(dir_path, dst_dir_path, class_name):
class_path = os.path.join(dir_path, class_name)
if not os.path.isdir(class_path):
return
dst_class_path = os.path.join(dst_dir_path, class_name)
if not os.path.exis... | true | true |
f74dcd7dd1b925a0a8000af109ee319c3b0e23c1 | 270 | py | Python | stratascratch/Pandas-Solution/Ranking Most Active Guests.py | CAG9/SQL-Interview-Questions | 79d0855a7cab28abd8b6462273aacaf38b5d8448 | [
"MIT"
] | null | null | null | stratascratch/Pandas-Solution/Ranking Most Active Guests.py | CAG9/SQL-Interview-Questions | 79d0855a7cab28abd8b6462273aacaf38b5d8448 | [
"MIT"
] | null | null | null | stratascratch/Pandas-Solution/Ranking Most Active Guests.py | CAG9/SQL-Interview-Questions | 79d0855a7cab28abd8b6462273aacaf38b5d8448 | [
"MIT"
] | null | null | null | # Import your libraries
import pandas as pd
# Start writing code
Grouped = airbnb_contacts.groupby('id_guest').sum().reset_index().sort_values(by=['n_messages'], ascending =False)
Grouped['ranking'] = Grouped['n_messages'].rank(method='dense',ascending =False)
Grouped
| 33.75 | 114 | 0.762963 |
import pandas as pd
Grouped = airbnb_contacts.groupby('id_guest').sum().reset_index().sort_values(by=['n_messages'], ascending =False)
Grouped['ranking'] = Grouped['n_messages'].rank(method='dense',ascending =False)
Grouped
| true | true |
f74dceee6280c78b32b80421136a825d72ab3640 | 2,716 | py | Python | package/crud/abc/watcher.py | derekmerck/pycrud | 065edd4f3ec1fda906772de7a20e8df16e31bfb2 | [
"MIT"
] | 15 | 2019-02-12T23:26:09.000Z | 2021-12-21T08:53:58.000Z | package/crud/abc/watcher.py | derekmerck/pycrud | 065edd4f3ec1fda906772de7a20e8df16e31bfb2 | [
"MIT"
] | 2 | 2019-01-23T21:13:12.000Z | 2019-06-28T15:45:51.000Z | package/crud/abc/watcher.py | derekmerck/pycrud | 065edd4f3ec1fda906772de7a20e8df16e31bfb2 | [
"MIT"
] | 6 | 2019-01-23T20:22:50.000Z | 2022-02-03T03:27:04.000Z | import logging, time
from abc import ABC
from itertools import count
from enum import Enum
from datetime import datetime, timedelta
from typing import Callable
import attr
from .observable import ObservableMixin, Event
@attr.s
class Trigger(object):
n_items = count(0)
tgid = attr.ib(init=False, factory=n_item... | 30.516854 | 89 | 0.571429 | import logging, time
from abc import ABC
from itertools import count
from enum import Enum
from datetime import datetime, timedelta
from typing import Callable
import attr
from .observable import ObservableMixin, Event
@attr.s
class Trigger(object):
n_items = count(0)
tgid = attr.ib(init=False, factory=n_item... | true | true |
f74dd1703d6c0295f1226dcc794b02eaa666430e | 2,472 | py | Python | tensorforce/core/policies/policy.py | JNC96/tensorforce | f691d1b5cc4a328f18712a14105fd90335bd3d3c | [
"Apache-2.0"
] | 1 | 2019-09-23T18:39:57.000Z | 2019-09-23T18:39:57.000Z | tensorforce/core/policies/policy.py | VonRosenchild/tensorforce | 92c987424c89e96238a3689aa4018df0d9d40504 | [
"Apache-2.0"
] | null | null | null | tensorforce/core/policies/policy.py | VonRosenchild/tensorforce | 92c987424c89e96238a3689aa4018df0d9d40504 | [
"Apache-2.0"
] | 1 | 2019-09-23T18:40:00.000Z | 2019-09-23T18:40:00.000Z | # Copyright 2018 Tensorforce Team. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable la... | 38.030769 | 96 | 0.658576 |
import tensorflow as tf
from tensorforce import util
from tensorforce.core import Module
class Policy(Module):
def __init__(
self, name, states_spec, actions_spec, device=None, summary_labels=None,
l2_regularization=None
):
super().__init__(
name=name, devi... | true | true |
f74dd1802d94ba5408a59c8d7fdea98540079241 | 11,754 | py | Python | testing/distributions/gp/cond_gp_test.py | tdiethe/MXFusion | fbdba79ca85cb5a9760722ffd932b9ec4c401745 | [
"Apache-2.0"
] | null | null | null | testing/distributions/gp/cond_gp_test.py | tdiethe/MXFusion | fbdba79ca85cb5a9760722ffd932b9ec4c401745 | [
"Apache-2.0"
] | null | null | null | testing/distributions/gp/cond_gp_test.py | tdiethe/MXFusion | fbdba79ca85cb5a9760722ffd932b9ec4c401745 | [
"Apache-2.0"
] | null | null | null | import pytest
import mxnet as mx
import numpy as np
from mxfusion.models import Model
from mxfusion.components.variables.runtime_variable import is_sampled_array, get_num_samples
from mxfusion.components.distributions import ConditionalGaussianProcess
from mxfusion.components.distributions.gp.kernels import RBF
from mx... | 62.521277 | 220 | 0.68181 | import pytest
import mxnet as mx
import numpy as np
from mxfusion.models import Model
from mxfusion.components.variables.runtime_variable import is_sampled_array, get_num_samples
from mxfusion.components.distributions import ConditionalGaussianProcess
from mxfusion.components.distributions.gp.kernels import RBF
from mx... | true | true |
f74dd24d0cd28a51b15ef9abaaca70baaa282110 | 1,617 | py | Python | src/python/test/pn2json_test.py | orbea/procyon | 469d94427d3b6e7cc2ab93606bdf968717a49150 | [
"Apache-2.0"
] | null | null | null | src/python/test/pn2json_test.py | orbea/procyon | 469d94427d3b6e7cc2ab93606bdf968717a49150 | [
"Apache-2.0"
] | null | null | null | src/python/test/pn2json_test.py | orbea/procyon | 469d94427d3b6e7cc2ab93606bdf968717a49150 | [
"Apache-2.0"
] | null | null | null | #!/usr/bin/env python3
# -*- coding: utf-8 -*-
#
# Copyright 2017 The Procyon Authors
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Un... | 26.95 | 82 | 0.727273 |
from __future__ import absolute_import, division, print_function, unicode_literals
import io
import json
import math
import os
import procyon
import procyon.lex
import procyon.pn2json
import re
import subprocess
import sys
from .context import procyon, pntest
def jsonify(source):
try:
re... | true | true |
f74dd27cc7ff6b0d432d4a5efea90bf6babe4f79 | 1,613 | py | Python | calc/managers.py | BAcode-X/webCalc | c673855bfd56dd1a07687c9bcb5048b7389ddf57 | [
"MIT"
] | 1 | 2022-02-06T13:26:30.000Z | 2022-02-06T13:26:30.000Z | calc/managers.py | BAcode-X/webCalc | c673855bfd56dd1a07687c9bcb5048b7389ddf57 | [
"MIT"
] | 2 | 2021-08-23T14:38:41.000Z | 2021-08-23T19:38:18.000Z | calc/managers.py | BAcode-X/webCalc | c673855bfd56dd1a07687c9bcb5048b7389ddf57 | [
"MIT"
] | null | null | null | from django.contrib.auth.base_user import BaseUserManager
from django.utils.translation import ugettext_lazy as _
class CustomUserManager(BaseUserManager):
def create_user(self, nick, email, password, first_name, last_name, **extra_fields):
"""
Create and save a User with the given nickname, email... | 39.341463 | 109 | 0.66026 | from django.contrib.auth.base_user import BaseUserManager
from django.utils.translation import ugettext_lazy as _
class CustomUserManager(BaseUserManager):
def create_user(self, nick, email, password, first_name, last_name, **extra_fields):
if not nick:
raise ValueError(_('The Nickname must be... | true | true |
f74dd2e51283db2e9edf4a0c6df8da5e7dee6f8d | 10,493 | py | Python | neo4j/conf.py | neo4j/neo4j-python-driver | 1c009476710ab451e55e75d28d372664253fda4e | [
"Apache-2.0"
] | 739 | 2015-05-29T21:53:27.000Z | 2022-03-24T00:13:53.000Z | DoctorAI_Lambda_Main/neo4j/conf.py | dgg32/doctorai_walkthrough | f05ba98ee4d16c6bdf826ae209c84a69c76a8654 | [
"MIT"
] | 264 | 2015-08-26T13:45:33.000Z | 2022-03-17T17:26:50.000Z | neo4j/conf.py | neo4j/neo4j-python-driver | 1c009476710ab451e55e75d28d372664253fda4e | [
"Apache-2.0"
] | 178 | 2015-05-21T08:10:54.000Z | 2022-03-31T11:49:08.000Z | #!/usr/bin/env python
# -*- encoding: utf-8 -*-
# Copyright (c) "Neo4j"
# Neo4j Sweden AB [http://neo4j.com]
#
# This file is part of Neo4j.
#
# 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
#... | 31.605422 | 123 | 0.645287 |
from abc import ABCMeta
from collections.abc import Mapping
from warnings import warn
from neo4j.meta import get_user_agent
from neo4j.api import (
TRUST_SYSTEM_CA_SIGNED_CERTIFICATES,
TRUST_ALL_CERTIFICATES,
WRITE_ACCESS,
DEFAULT_DATABASE,
)
from neo4j.exceptions import (
Con... | true | true |
f74dd367954ac59f8d6c1b21eb961277cfb231f1 | 6,310 | py | Python | tests/unit/test_models_wheel.py | Cactusmachete/pip | e9f461241032dbd540fb6271f1dbbb29a6a0db82 | [
"MIT"
] | null | null | null | tests/unit/test_models_wheel.py | Cactusmachete/pip | e9f461241032dbd540fb6271f1dbbb29a6a0db82 | [
"MIT"
] | null | null | null | tests/unit/test_models_wheel.py | Cactusmachete/pip | e9f461241032dbd540fb6271f1dbbb29a6a0db82 | [
"MIT"
] | null | null | null | import pytest
from pip._vendor.packaging.tags import Tag
from pip._internal import pep425tags
from pip._internal.exceptions import InvalidWheelFilename
from pip._internal.models.wheel import Wheel
class TestWheelFile(object):
def test_std_wheel_pattern(self):
w = Wheel('simple-1.1.1-py2-none-any.whl')
... | 34.861878 | 78 | 0.59683 | import pytest
from pip._vendor.packaging.tags import Tag
from pip._internal import pep425tags
from pip._internal.exceptions import InvalidWheelFilename
from pip._internal.models.wheel import Wheel
class TestWheelFile(object):
def test_std_wheel_pattern(self):
w = Wheel('simple-1.1.1-py2-none-any.whl')
... | true | true |
f74dd36a3236777e8c1ee85e0e89d8234ed93481 | 2,610 | py | Python | modules/pytket-aqt/tests/convert_test.py | irfankhan10/pytket-extensions | 8ab33c1dcff91dfc50d471fbc160277e82d2492b | [
"Apache-2.0"
] | 22 | 2021-03-02T15:17:22.000Z | 2022-03-20T21:17:10.000Z | modules/pytket-aqt/tests/convert_test.py | irfankhan10/pytket-extensions | 8ab33c1dcff91dfc50d471fbc160277e82d2492b | [
"Apache-2.0"
] | 132 | 2021-03-03T08:30:05.000Z | 2022-03-31T21:11:58.000Z | modules/pytket-aqt/tests/convert_test.py | irfankhan10/pytket-extensions | 8ab33c1dcff91dfc50d471fbc160277e82d2492b | [
"Apache-2.0"
] | 13 | 2021-03-05T17:01:19.000Z | 2022-03-17T15:38:02.000Z | # Copyright 2020-2021 Cambridge Quantum Computing
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or a... | 28.064516 | 87 | 0.678927 |
from typing import Tuple, List
import json
import os
import numpy as np
import pytest
from pytket.circuit import Circuit, OpType
from pytket.extensions.aqt.backends.aqt import _translate_aqt, AQTBackend, _aqt_rebase
skip_remote_tests: bool = os.getenv("PYTKET_RUN_REMOTE_TESTS") is None
REASON = "PYTKET... | true | true |
f74dd3faeba7ace6e5b971cc6d1e32bf5ffbf597 | 2,161 | py | Python | q44.py | kylepw/ctci | 7e2fcc6775db3789d0e425f4fb969acf6c44aad5 | [
"MIT"
] | null | null | null | q44.py | kylepw/ctci | 7e2fcc6775db3789d0e425f4fb969acf6c44aad5 | [
"MIT"
] | null | null | null | q44.py | kylepw/ctci | 7e2fcc6775db3789d0e425f4fb969acf6c44aad5 | [
"MIT"
] | null | null | null | """
q44.py
~~~~~~
Check Balanced: Implement a function to check if a binary tree is balanced. For
the purposes of this question, a balanced tree is defined to be a tree such that
the heights of the two subtrees of any node never differ by more than one.
Hints: #21, #33, #49, #105, #124
"""
impo... | 30.013889 | 234 | 0.601111 | import unittest
class Node:
def __init__(self, value):
self.left = None
self.right = None
self.value = value
def __repr__(self):
return f'Node ({self.value})'
def array_to_binary(array, start=None, end=None):
start = 0 if start is None else start
end = len(array) - 1... | true | true |
f74dd43f7f25aee6abb1ef96f5623bb0c8999057 | 2,908 | py | Python | influxdb_client/domain/flux_response.py | kelseiv/influxdb-client-python | 9a0d2d659157cca96f6a04818fdeb215d699bdd7 | [
"MIT"
] | 1 | 2021-06-06T10:39:47.000Z | 2021-06-06T10:39:47.000Z | influxdb_client/domain/flux_response.py | kelseiv/influxdb-client-python | 9a0d2d659157cca96f6a04818fdeb215d699bdd7 | [
"MIT"
] | null | null | null | influxdb_client/domain/flux_response.py | kelseiv/influxdb-client-python | 9a0d2d659157cca96f6a04818fdeb215d699bdd7 | [
"MIT"
] | null | null | null | # coding: utf-8
"""
Influx API Service
No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) # noqa: E501
OpenAPI spec version: 0.1.0
Generated by: https://openapi-generator.tech
"""
import pprint
import re # noqa: F401
import six
class Flux... | 25.734513 | 124 | 0.547455 |
import pprint
import re
import six
class FluxResponse(object):
openapi_types = {
'flux': 'str'
}
attribute_map = {
'flux': 'flux'
}
def __init__(self, flux=None):
self._flux = None
self.discriminator = None
if flux is not None:
self... | true | true |
f74dd447a00d1b13ea654c3f4582371ce253c0ab | 43,676 | py | Python | pyvcloud/vcd/utils.py | lrivallain/pyvcloud | 0ae305c7d83c7c4e370428ab4ee1070edfb3fe1e | [
"Apache-2.0"
] | 168 | 2015-01-01T07:15:03.000Z | 2022-01-27T00:27:49.000Z | pyvcloud/vcd/utils.py | lrivallain/pyvcloud | 0ae305c7d83c7c4e370428ab4ee1070edfb3fe1e | [
"Apache-2.0"
] | 392 | 2015-01-08T10:03:01.000Z | 2022-03-28T02:12:02.000Z | pyvcloud/vcd/utils.py | lrivallain/pyvcloud | 0ae305c7d83c7c4e370428ab4ee1070edfb3fe1e | [
"Apache-2.0"
] | 246 | 2015-01-13T01:52:58.000Z | 2022-03-28T09:34:47.000Z | # VMware vCloud Python SDK
# Copyright (c) 2014-2018 VMware, Inc. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# U... | 39.206463 | 121 | 0.6284 |
from ipaddress import IPv4Network
from os.path import abspath
from os.path import dirname
from os.path import join as joinpath
from os.path import realpath
import humanfriendly
from lxml import etree
from lxml.objectify import NoneElement
from pygments import formatters
from pygments import highlight
fr... | true | true |
f74dd45fbaf427f6dd3db15a5c5ffa191f9757f1 | 947 | py | Python | posts/management/commands/cleanup_post_views.py | NakolenkeDevelopment/rustockholm.club | 1b347180d58e63a11c9d3c05fea9f10d753b7732 | [
"MIT"
] | 496 | 2020-04-24T04:20:32.000Z | 2022-03-31T21:55:57.000Z | posts/management/commands/cleanup_post_views.py | NakolenkeDevelopment/rustockholm.club | 1b347180d58e63a11c9d3c05fea9f10d753b7732 | [
"MIT"
] | 642 | 2020-04-24T11:54:13.000Z | 2022-03-26T15:41:06.000Z | posts/management/commands/cleanup_post_views.py | NakolenkeDevelopment/rustockholm.club | 1b347180d58e63a11c9d3c05fea9f10d753b7732 | [
"MIT"
] | 243 | 2020-04-24T11:49:11.000Z | 2022-03-24T18:38:48.000Z | import logging
from django.core.management import BaseCommand
from django.db import connection
log = logging.getLogger(__name__)
class Command(BaseCommand):
help = "Cleans up old and useless post views and history to save DB space"
def handle(self, *args, **options):
# cleanup anonymous post_views ... | 32.655172 | 105 | 0.61774 | import logging
from django.core.management import BaseCommand
from django.db import connection
log = logging.getLogger(__name__)
class Command(BaseCommand):
help = "Cleans up old and useless post views and history to save DB space"
def handle(self, *args, **options):
with connection.cursor... | true | true |
f74dd498dec3eef1d0924469950e6fd9c7859abb | 2,076 | py | Python | app/extension/logging/customizeLogger.py | Alex4386/XenXenXenSe | c60e50f26a7c3b306ee3cbb140b3ad7f39c21d93 | [
"MIT"
] | 1 | 2021-04-23T08:56:05.000Z | 2021-04-23T08:56:05.000Z | app/extension/logging/customizeLogger.py | Alex4386/XenXenXenSe | c60e50f26a7c3b306ee3cbb140b3ad7f39c21d93 | [
"MIT"
] | null | null | null | app/extension/logging/customizeLogger.py | Alex4386/XenXenXenSe | c60e50f26a7c3b306ee3cbb140b3ad7f39c21d93 | [
"MIT"
] | null | null | null | import logging
import sys
from pathlib import Path
import ujson
from loguru import logger
from app.extension.logging.interceptHandler import InterceptHandler
class CustomizeLogger:
@classmethod
def make_logger(cls):
config_path = "logging_config.json"
config = cls.load_logging_config(config_... | 27.315789 | 75 | 0.586224 | import logging
import sys
from pathlib import Path
import ujson
from loguru import logger
from app.extension.logging.interceptHandler import InterceptHandler
class CustomizeLogger:
@classmethod
def make_logger(cls):
config_path = "logging_config.json"
config = cls.load_logging_config(config_... | true | true |
f74dd49a021129437f6b37eb43a0a853ac7298d6 | 1,274 | py | Python | az_ykan_v1.0.1/Arduino-master/tests/device/test_WiFiServer/test_WiFiServer.py | angelbarusta/ind-matageyco | 08be088f2178312e9bac94b9604bacd5223f4b53 | [
"Apache-2.0"
] | null | null | null | az_ykan_v1.0.1/Arduino-master/tests/device/test_WiFiServer/test_WiFiServer.py | angelbarusta/ind-matageyco | 08be088f2178312e9bac94b9604bacd5223f4b53 | [
"Apache-2.0"
] | null | null | null | az_ykan_v1.0.1/Arduino-master/tests/device/test_WiFiServer/test_WiFiServer.py | angelbarusta/ind-matageyco | 08be088f2178312e9bac94b9604bacd5223f4b53 | [
"Apache-2.0"
] | 1 | 2018-03-29T14:05:48.000Z | 2018-03-29T14:05:48.000Z | from mock_decorators import setup, teardown
from threading import Thread
import socket
import time
stop_client_thread = False
client_thread = None
@setup('Simple echo server')
def setup_echo_server(e):
global stop_client_thread
global client_thread
def echo_client_thread():
server_address = socket... | 29.627907 | 71 | 0.621664 | from mock_decorators import setup, teardown
from threading import Thread
import socket
import time
stop_client_thread = False
client_thread = None
@setup('Simple echo server')
def setup_echo_server(e):
global stop_client_thread
global client_thread
def echo_client_thread():
server_address = socket... | true | true |
f74dd56ec850661152c4c4f5933bf785cbe641e3 | 1,118 | py | Python | tests/project/test_brownie_mix.py | palkeo/brownie | 25fb857b40ef69e30665640873d72be2ec3ab483 | [
"MIT"
] | 1 | 2021-07-07T12:27:19.000Z | 2021-07-07T12:27:19.000Z | tests/project/test_brownie_mix.py | dmuhs/brownie | e245ca1854e32cd8c9678f7ebc7a4ec63dde0074 | [
"MIT"
] | null | null | null | tests/project/test_brownie_mix.py | dmuhs/brownie | e245ca1854e32cd8c9678f7ebc7a4ec63dde0074 | [
"MIT"
] | 1 | 2020-06-28T22:02:33.000Z | 2020-06-28T22:02:33.000Z | #!/usr/bin/python3
import os
from pathlib import Path
import pytest
from brownie.project.scripts import run
# browniemix is parametrized with every mix repo from https://www.github.com/brownie-mix/
def test_mixes(plugintesterbase, project, tmp_path, rpc, browniemix):
path = Path(project.from_brownie_mix(browni... | 29.421053 | 89 | 0.708408 |
import os
from pathlib import Path
import pytest
from brownie.project.scripts import run
def test_mixes(plugintesterbase, project, tmp_path, rpc, browniemix):
path = Path(project.from_brownie_mix(browniemix, tmp_path.joinpath("testmix")))
os.chdir(path)
result = plugintesterbase.runpytest("-C")... | true | true |
f74dd617c0b11ef46904a3180e30869e7caf06c4 | 2,507 | py | Python | examples/walk_integration.py | Ipuch/Humanoid2D | 3afd3926b9fb2ddc39be9bef99b89f864f41dcb7 | [
"MIT"
] | null | null | null | examples/walk_integration.py | Ipuch/Humanoid2D | 3afd3926b9fb2ddc39be9bef99b89f864f41dcb7 | [
"MIT"
] | null | null | null | examples/walk_integration.py | Ipuch/Humanoid2D | 3afd3926b9fb2ddc39be9bef99b89f864f41dcb7 | [
"MIT"
] | null | null | null | import biorbd
import numpy as np
from bioptim import OdeSolver, CostType, RigidBodyDynamics
from bioptim import Solver, DefectType
from humanoid_2d import Humanoid2D, Integration, add_custom_plots, HumanoidOcp, HumanoidOcpMultiPhase
def torque_driven_dynamics(model: biorbd.Model, states: np.array, controls: np.arra... | 27.25 | 119 | 0.676506 | import biorbd
import numpy as np
from bioptim import OdeSolver, CostType, RigidBodyDynamics
from bioptim import Solver, DefectType
from humanoid_2d import Humanoid2D, Integration, add_custom_plots, HumanoidOcp, HumanoidOcpMultiPhase
def torque_driven_dynamics(model: biorbd.Model, states: np.array, controls: np.arra... | true | true |
f74dd6aaa3cd5c16ef46a5e76f2fb84dbdb9ddf6 | 7,784 | py | Python | components/python/mail_utils.py | SylvanasSun/code-snippets | 8a393c50955a6a1ad0ca9809f3f7501faae52c51 | [
"MIT"
] | 1 | 2018-01-31T03:43:08.000Z | 2018-01-31T03:43:08.000Z | components/python/mail_utils.py | SylvanasSun/code-snippets | 8a393c50955a6a1ad0ca9809f3f7501faae52c51 | [
"MIT"
] | null | null | null | components/python/mail_utils.py | SylvanasSun/code-snippets | 8a393c50955a6a1ad0ca9809f3f7501faae52c51 | [
"MIT"
] | null | null | null | import smtplib
from email import encoders
from email.header import Header
from email.mime.base import MIMEBase
from email.mime.multipart import MIMEMultipart
from email.mime.text import MIMEText
from email.utils import parseaddr, formataddr
class SmtpKeys(object):
SMTP_HOST = 'smtp_host'
SMTP_PORT = 'smtp_por... | 38.156863 | 101 | 0.63592 | import smtplib
from email import encoders
from email.header import Header
from email.mime.base import MIMEBase
from email.mime.multipart import MIMEMultipart
from email.mime.text import MIMEText
from email.utils import parseaddr, formataddr
class SmtpKeys(object):
SMTP_HOST = 'smtp_host'
SMTP_PORT = 'smtp_por... | true | true |
f74dd71ca127e88b891ed75ab980109e1b1cf85b | 461 | py | Python | tests/test_cli.py | GuerrillaAnalytics/made-cli | ee81e8293d23f50a377fd177efa05dd46d9de751 | [
"MIT"
] | 1 | 2017-09-03T16:30:26.000Z | 2017-09-03T16:30:26.000Z | tests/test_cli.py | GuerrillaAnalytics/made-cli | ee81e8293d23f50a377fd177efa05dd46d9de751 | [
"MIT"
] | null | null | null | tests/test_cli.py | GuerrillaAnalytics/made-cli | ee81e8293d23f50a377fd177efa05dd46d9de751 | [
"MIT"
] | null | null | null | # -*- coding: utf-8 -*-
"""Tests for the Config class."""
from click.testing import CliRunner
from made import cli
import pytest
@pytest.fixture
def runner():
"""TODO."""
return CliRunner()
def test_cli(runner):
"""Tests that the cli can be launched."""
result = runner.invoke(cli.cli)
assert ... | 19.208333 | 53 | 0.657267 |
from click.testing import CliRunner
from made import cli
import pytest
@pytest.fixture
def runner():
return CliRunner()
def test_cli(runner):
result = runner.invoke(cli.cli)
assert result.exit_code == 0
assert not result.exception
print(result.output.strip())
| true | true |
f74dd73fd1a8c40cdfe95ae0bad1597f00cb8bd1 | 30,878 | py | Python | Lib/defcon/objects/info.py | Space0726/defcon | a1b0155d7a1708ea4edce7930572e06896020343 | [
"MIT"
] | 25 | 2015-03-05T13:56:01.000Z | 2019-01-15T08:33:07.000Z | Lib/defcon/objects/info.py | Space0726/defcon | a1b0155d7a1708ea4edce7930572e06896020343 | [
"MIT"
] | 154 | 2015-07-05T15:55:47.000Z | 2018-12-23T22:04:00.000Z | Lib/defcon/objects/info.py | Space0726/defcon | a1b0155d7a1708ea4edce7930572e06896020343 | [
"MIT"
] | 22 | 2015-09-09T01:55:39.000Z | 2018-03-20T20:33:33.000Z | from __future__ import absolute_import
# this file was generated by infoObjectGenerator.py.
# this file should not be edited by hand.
import weakref
from warnings import warn
from fontTools import ufoLib
from defcon.objects.base import BaseObject
from copy import copy
from functools import partial
def _guidelineDepre... | 101.907591 | 474 | 0.726828 | from __future__ import absolute_import
import weakref
from warnings import warn
from fontTools import ufoLib
from defcon.objects.base import BaseObject
from copy import copy
from functools import partial
def _guidelineDeprecation(message=None):
msg = "Font level guidelines are now handled in the Font object."
... | true | true |
f74dd77ccfb26fe1b5a5810a0f7277b1ffb3ddc3 | 549 | py | Python | db/pandas.py | NovaSBE-DSKC/retention-evaluation | 5b68b9282f0b5479a9dc5238faef68067c76b861 | [
"MIT"
] | null | null | null | db/pandas.py | NovaSBE-DSKC/retention-evaluation | 5b68b9282f0b5479a9dc5238faef68067c76b861 | [
"MIT"
] | null | null | null | db/pandas.py | NovaSBE-DSKC/retention-evaluation | 5b68b9282f0b5479a9dc5238faef68067c76b861 | [
"MIT"
] | null | null | null | from . import get_connector, get_engine
import pandas as pd
def get_dataframe(table_name, limit=None):
# limit query
limit_query=""
if limit:
limit_query="limit {}".format(limit)
# create query
query = "SELECT * FROM {} {}".format(table_name, limit_query)
# get dataframe from sql qu... | 21.96 | 65 | 0.632058 | from . import get_connector, get_engine
import pandas as pd
def get_dataframe(table_name, limit=None):
limit_query=""
if limit:
limit_query="limit {}".format(limit)
query = "SELECT * FROM {} {}".format(table_name, limit_query)
df = pd.read_sql(query, con=get_connector())
... | true | true |
f74dd7d0693f08976d5b18f84361cea11b05afcf | 5,337 | py | Python | UltronRoBo/modules/gtranslator.py | UltronRoBo/UltronRoBoAssistant | 874dcf725d453ffabd85543533d2a07676af4d65 | [
"MIT"
] | null | null | null | UltronRoBo/modules/gtranslator.py | UltronRoBo/UltronRoBoAssistant | 874dcf725d453ffabd85543533d2a07676af4d65 | [
"MIT"
] | null | null | null | UltronRoBo/modules/gtranslator.py | UltronRoBo/UltronRoBoAssistant | 874dcf725d453ffabd85543533d2a07676af4d65 | [
"MIT"
] | null | null | null | """
MIT License
Copyright (c) 2021 UltronRoBo
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, di... | 38.673913 | 119 | 0.640809 |
from emoji import UNICODE_EMOJI
from google_trans_new import LANGUAGES, google_translator
from telegram import ParseMode, Update
from telegram.ext import CallbackContext, run_async
from UltronRoBo import dispatcher
from UltronRoBo.modules.disable import DisableAbleCommandHandler
@run_async
def totranslate(update: U... | true | true |
f74dd7e7248eace73f553897f6f43e0564658d63 | 3,192 | py | Python | website/rate/views.py | MattJamesChampion/mince-pie-rate | f2c346e2c312e80f779f48bc7b3ae6348ace2344 | [
"MIT"
] | null | null | null | website/rate/views.py | MattJamesChampion/mince-pie-rate | f2c346e2c312e80f779f48bc7b3ae6348ace2344 | [
"MIT"
] | 9 | 2018-10-02T11:34:36.000Z | 2021-06-10T17:39:31.000Z | website/rate/views.py | MattJamesChampion/mince-pie-rate | f2c346e2c312e80f779f48bc7b3ae6348ace2344 | [
"MIT"
] | null | null | null | from django.http import HttpResponseRedirect
from django.shortcuts import render, get_object_or_404
from django.urls import reverse
from django.core.files.storage import FileSystemStorage
from django.contrib.auth.decorators import login_required
from .models import MincePie, Review
from .forms import MincePieForm, Rev... | 40.405063 | 144 | 0.66886 | from django.http import HttpResponseRedirect
from django.shortcuts import render, get_object_or_404
from django.urls import reverse
from django.core.files.storage import FileSystemStorage
from django.contrib.auth.decorators import login_required
from .models import MincePie, Review
from .forms import MincePieForm, Rev... | true | true |
f74dd89b6848435110a041c4eea4c98b95f4e1a3 | 793 | py | Python | doc/CyberSecurity/Classic_Cryptography/code/LetterFrequency.py | tanducmai/.dotfiles | 13cad9bc7fcecff6108eb5df34635d4748712532 | [
"Unlicense"
] | null | null | null | doc/CyberSecurity/Classic_Cryptography/code/LetterFrequency.py | tanducmai/.dotfiles | 13cad9bc7fcecff6108eb5df34635d4748712532 | [
"Unlicense"
] | null | null | null | doc/CyberSecurity/Classic_Cryptography/code/LetterFrequency.py | tanducmai/.dotfiles | 13cad9bc7fcecff6108eb5df34635d4748712532 | [
"Unlicense"
] | null | null | null | #LetterFrequency.py
#This program will create a CSV file of frequencies based on a text file.
#Use Excel or similar spreadsheet software to visualize the frequencies of the CSV file.
import os
def countLetters(message):
dir_path = os.path.dirname(os.path.realpath(__file__))
os.chdir(dir_path)
alpha = "AB... | 22.657143 | 88 | 0.617907 |
import os
def countLetters(message):
dir_path = os.path.dirname(os.path.realpath(__file__))
os.chdir(dir_path)
alpha = "ABCDEFGHIJKLMNOPQRSTUVWXYZ"
message = message.upper()
freq = [0] * 26
for letter in message:
spot = alpha.find(letter)
if spot >= 0:
freq[sp... | true | true |
f74dd89d0a7c7ccd10ba82d3c13b52603f940de8 | 1,316 | py | Python | periodic_table.py | mkirby1995/PyISRU | 46338999e70308604692bbd3c20b4f770c27dc6d | [
"MIT"
] | null | null | null | periodic_table.py | mkirby1995/PyISRU | 46338999e70308604692bbd3c20b4f770c27dc6d | [
"MIT"
] | null | null | null | periodic_table.py | mkirby1995/PyISRU | 46338999e70308604692bbd3c20b4f770c27dc6d | [
"MIT"
] | null | null | null | import pandas as pd
import json
class Element:
def __init__(self, name, abrivation, atomic_number,
atomic_mass, period, group):
self.name = name
self.abrivation = abrivation
self.atomic_number = atomic_number
self.atomic_mass = atomic_mass
self.period = period #row
self.gro... | 26.857143 | 73 | 0.582827 | import pandas as pd
import json
class Element:
def __init__(self, name, abrivation, atomic_number,
atomic_mass, period, group):
self.name = name
self.abrivation = abrivation
self.atomic_number = atomic_number
self.atomic_mass = atomic_mass
self.period = period
self.group =... | true | true |
f74dd987ed2b5939b07943c6fac65134b2236048 | 20,443 | py | Python | wechatpy/events.py | maodei/wechatpy | a53bae5a87d933dd5be248ac97736f172a474f5b | [
"MIT"
] | null | null | null | wechatpy/events.py | maodei/wechatpy | a53bae5a87d933dd5be248ac97736f172a474f5b | [
"MIT"
] | null | null | null | wechatpy/events.py | maodei/wechatpy | a53bae5a87d933dd5be248ac97736f172a474f5b | [
"MIT"
] | null | null | null | # -*- coding: utf-8 -*-
"""
wechatpy.events
~~~~~~~~~~~~~~~~
This module contains all the events WeChat callback uses.
:copyright: (c) 2014 by messense.
:license: MIT, see LICENSE for more details.
"""
from __future__ import absolute_import, unicode_literals
from wechatpy.fields import (
Stri... | 24.51199 | 111 | 0.679255 |
from __future__ import absolute_import, unicode_literals
from wechatpy.fields import (
StringField,
FloatField,
IntegerField,
BaseField,
Base64DecodeField,
DateTimeField
)
from wechatpy.messages import BaseMessage
EVENT_TYPES = {}
def register_event(event_type):
def register(cls):
... | true | true |
f74dda8f1b55fdf7ebda449ed4e3c90aa3625184 | 7,335 | py | Python | three_body_2d.py | dan3dewey/Pythonista-bagatelles | 8c2e1d061d76184490605e2a5d52fb236931cba7 | [
"MIT"
] | null | null | null | three_body_2d.py | dan3dewey/Pythonista-bagatelles | 8c2e1d061d76184490605e2a5d52fb236931cba7 | [
"MIT"
] | null | null | null | three_body_2d.py | dan3dewey/Pythonista-bagatelles | 8c2e1d061d76184490605e2a5d52fb236931cba7 | [
"MIT"
] | null | null | null | # coding: utf-8
# three_body_2d.py
""" Use Docstrings like this so that help() can give useful output.
These can be multi-line, that's nice ;-)
Simple 3-body simulation constrained to 2D """
# run it at os command line:
# osprompt> py three_body_2d.py
# v8 - adjusted to run in pythonista
# v7 - put previous ... | 36.133005 | 98 | 0.590184 |
from mpl_toolkits.mplot3d import Axes3D
import numpy as np
import matplotlib as mpl
import matplotlib.pyplot as plt
tmax = 6.0
dt = 0.001
epsilon = 1.0e-4
grav = 0.8
b1x = 1.0
b1y = 0.0
b1vx = 0.0
b1vy = 0.5
b1m = 3.0
b2x = -0.5
b2y = 0.86
b2vx = 0.5
b2vy = 0.0
b2m = 4.1
b3x = -0.5
b3y = -0.86
b3vx... | true | true |
f74ddb93841154bf3d19bc5ec50aaf2d36313ecf | 739 | py | Python | setup.py | amansrivastava17/xlnet | 87904c1b244a7e65b787c9a99a6c1ceca75e3bbd | [
"Apache-2.0"
] | null | null | null | setup.py | amansrivastava17/xlnet | 87904c1b244a7e65b787c9a99a6c1ceca75e3bbd | [
"Apache-2.0"
] | null | null | null | setup.py | amansrivastava17/xlnet | 87904c1b244a7e65b787c9a99a6c1ceca75e3bbd | [
"Apache-2.0"
] | null | null | null | import setuptools
with open("README.md", "r") as fh:
long_description = fh.read()
setuptools.setup(
name="xlnet",
version="0.0.1",
author="zihangdai",
author_email="zander.dai@gmail.com",
description="XLNet: Generalized Autoregressive Pretraining for Language Understanding",
long_descripti... | 28.423077 | 91 | 0.671177 | import setuptools
with open("README.md", "r") as fh:
long_description = fh.read()
setuptools.setup(
name="xlnet",
version="0.0.1",
author="zihangdai",
author_email="zander.dai@gmail.com",
description="XLNet: Generalized Autoregressive Pretraining for Language Understanding",
long_descripti... | true | true |
f74ddbac02d0faa9b74d747f6bfbe64b67be0174 | 5,884 | py | Python | pywikibot/families/wiktionary_family.py | planetmaker/pywikibot | acfa697250092f69bdd338057eccdc119f7d0fcf | [
"MIT"
] | null | null | null | pywikibot/families/wiktionary_family.py | planetmaker/pywikibot | acfa697250092f69bdd338057eccdc119f7d0fcf | [
"MIT"
] | null | null | null | pywikibot/families/wiktionary_family.py | planetmaker/pywikibot | acfa697250092f69bdd338057eccdc119f7d0fcf | [
"MIT"
] | null | null | null | # -*- coding: utf-8 -*-
"""Family module for Wiktionary."""
#
# (C) Pywikibot team, 2005-2020
#
# Distributed under the terms of the MIT license.
#
from __future__ import absolute_import, division, unicode_literals
from pywikibot import family
from pywikibot.tools import classproperty
# The Wikimedia family that is ... | 43.585185 | 94 | 0.444256 |
from __future__ import absolute_import, division, unicode_literals
from pywikibot import family
from pywikibot.tools import classproperty
class Family(family.SubdomainFamily, family.WikimediaFamily):
name = 'wiktionary'
closed_wikis = [
'aa', 'ab', 'ak', 'als', 'as', 'av', 'ba', 'bh', 'b... | true | true |
f74ddbd66a67805d2640789041a7577e9645bf73 | 167 | py | Python | lw301_server_app/handler/__init__.py | SergeyZh/lw301_server | 6efd5dc74f1df9ab0d51f5e66b5237ad35f8fda6 | [
"Apache-2.0"
] | 2 | 2018-07-23T20:22:55.000Z | 2019-01-27T21:47:40.000Z | lw301_server_app/handler/__init__.py | SergeyZh/lw301_server | 6efd5dc74f1df9ab0d51f5e66b5237ad35f8fda6 | [
"Apache-2.0"
] | 4 | 2018-07-23T19:20:00.000Z | 2018-11-21T07:45:53.000Z | lw301_server_app/handler/__init__.py | SergeyZh/lw301_server | 6efd5dc74f1df9ab0d51f5e66b5237ad35f8fda6 | [
"Apache-2.0"
] | 2 | 2019-01-28T07:39:06.000Z | 2020-05-15T21:32:58.000Z | # coding: utf-8
from tornado.web import RequestHandler
class Base(RequestHandler):
def initialize(self):
self.log = self.application.settings['logger']
| 18.555556 | 54 | 0.718563 |
from tornado.web import RequestHandler
class Base(RequestHandler):
def initialize(self):
self.log = self.application.settings['logger']
| true | true |
f74ddd0e270265ee12475857505232e145f6e150 | 996 | py | Python | azure_monitor/python_logger_opencensus_azure/monitoring/examples/api_2.py | jchomarat/azure-monitor-opencensus-python | ab843291677896026aa60af3368d878ac453b0f3 | [
"MIT"
] | 14 | 2020-05-04T15:11:42.000Z | 2022-03-17T11:04:41.000Z | azure_monitor/python_logger_opencensus_azure/monitoring/examples/api_2.py | jchomarat/azure-monitor-opencensus-python | ab843291677896026aa60af3368d878ac453b0f3 | [
"MIT"
] | 4 | 2020-04-18T22:41:34.000Z | 2021-11-15T14:12:14.000Z | azure_monitor/python_logger_opencensus_azure/monitoring/examples/api_2.py | jchomarat/azure-monitor-opencensus-python | ab843291677896026aa60af3368d878ac453b0f3 | [
"MIT"
] | 14 | 2020-02-21T19:55:51.000Z | 2022-02-10T08:59:52.000Z | """REST API Module using AppLogger"""
import json
import logging
from flask import Flask, jsonify
import sys
import os
sys.path.append(os.path.join(os.getcwd(),'monitoring'))
from src.logger import AppLogger
component_name ="API_2"
app = Flask(component_name)
logging_config_file_path = os.path.join(os.getcwd(),'mon... | 29.294118 | 98 | 0.746988 |
import json
import logging
from flask import Flask, jsonify
import sys
import os
sys.path.append(os.path.join(os.getcwd(),'monitoring'))
from src.logger import AppLogger
component_name ="API_2"
app = Flask(component_name)
logging_config_file_path = os.path.join(os.getcwd(),'monitoring',"examples","logging_config.js... | true | true |
f74dddb623802bfec005ee2278984e1f83501161 | 1,360 | py | Python | problems/exercism/clock/clock.py | JayMonari/py-personal | ef16d030cc7fe2266d661e1378d95f588229b746 | [
"MIT"
] | null | null | null | problems/exercism/clock/clock.py | JayMonari/py-personal | ef16d030cc7fe2266d661e1378d95f588229b746 | [
"MIT"
] | null | null | null | problems/exercism/clock/clock.py | JayMonari/py-personal | ef16d030cc7fe2266d661e1378d95f588229b746 | [
"MIT"
] | null | null | null | from typing import Tuple
class Clock:
MINS_PER_HOUR = 60
HOURS_PER_DAY = 24
def __init__(self, hour: int, minute: int) -> None:
nhours, nmins = self.__normalize(hour, minute, self.MINS_PER_HOUR)
_, nhours = self.__normalize(0, nhours, self.HOURS_PER_DAY)
self.hours = nhours
... | 32.380952 | 75 | 0.575 | from typing import Tuple
class Clock:
MINS_PER_HOUR = 60
HOURS_PER_DAY = 24
def __init__(self, hour: int, minute: int) -> None:
nhours, nmins = self.__normalize(hour, minute, self.MINS_PER_HOUR)
_, nhours = self.__normalize(0, nhours, self.HOURS_PER_DAY)
self.hours = nhours
... | true | true |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.