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 958k | max_line_length int64 1 987k | alphanum_fraction float64 0 1 | content_no_comment stringlengths 0 1.01M | is_comment_constant_removed bool 2
classes | is_sharp_comment_removed bool 1
class |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
f73a8894c85a2e09c6e39f338b1f124d0bad58e0 | 781 | py | Python | test/nn/conv/test_sg_conv.py | mwussow/pytorch_geometric | 01c68f9b58c94d9efd1f6e39b9c85177aae521bb | [
"MIT"
] | 9 | 2020-03-29T08:18:29.000Z | 2022-01-05T02:36:08.000Z | test/nn/conv/test_sg_conv.py | mwussow/pytorch_geometric | 01c68f9b58c94d9efd1f6e39b9c85177aae521bb | [
"MIT"
] | null | null | null | test/nn/conv/test_sg_conv.py | mwussow/pytorch_geometric | 01c68f9b58c94d9efd1f6e39b9c85177aae521bb | [
"MIT"
] | 3 | 2020-03-25T19:36:57.000Z | 2022-03-19T07:24:51.000Z | import torch
from torch_geometric.nn import SGConv
def test_sg_conv():
in_channels, out_channels = (16, 32)
edge_index = torch.tensor([[0, 0, 0, 1, 2, 3], [1, 2, 3, 0, 0, 0]])
num_nodes = edge_index.max().item() + 1
x = torch.randn((num_nodes, in_channels))
conv = SGConv(in_channels, out_channels... | 39.05 | 71 | 0.660691 | import torch
from torch_geometric.nn import SGConv
def test_sg_conv():
in_channels, out_channels = (16, 32)
edge_index = torch.tensor([[0, 0, 0, 1, 2, 3], [1, 2, 3, 0, 0, 0]])
num_nodes = edge_index.max().item() + 1
x = torch.randn((num_nodes, in_channels))
conv = SGConv(in_channels, out_channels... | true | true |
f73a89bb93e76edb90c80e3d22dfd2fd98da17c8 | 7,628 | py | Python | test_yolo_2.py | Hung-Jia-Jun/yolo_keras_camera_realtime | d74ea9a95ed625337765f4fea9e6f8881ee0a9cf | [
"MIT"
] | null | null | null | test_yolo_2.py | Hung-Jia-Jun/yolo_keras_camera_realtime | d74ea9a95ed625337765f4fea9e6f8881ee0a9cf | [
"MIT"
] | null | null | null | test_yolo_2.py | Hung-Jia-Jun/yolo_keras_camera_realtime | d74ea9a95ed625337765f4fea9e6f8881ee0a9cf | [
"MIT"
] | null | null | null | #! /usr/bin/env python
"""Run a YOLO_v2 style detection model on test images."""
import argparse
import colorsys
import imghdr
import os
import random
import numpy as np
from keras import backend as K
from keras.models import load_model
from PIL import Image, ImageDraw, ImageFont
from yad2k.models.keras_yolo import y... | 37.392157 | 79 | 0.618773 |
import argparse
import colorsys
import imghdr
import os
import random
import numpy as np
from keras import backend as K
from keras.models import load_model
from PIL import Image, ImageDraw, ImageFont
from yad2k.models.keras_yolo import yolo_eval, yolo_head
def _main():
s... | true | true |
f73a8abba459847c58bfe680ee22e895b1bcb0b4 | 921 | py | Python | libs/statsd/set.py | rbellary-vi/netuitive-statsd | bd2c1fd6a05476d432e8a584708d2bcb09350553 | [
"Apache-2.0"
] | null | null | null | libs/statsd/set.py | rbellary-vi/netuitive-statsd | bd2c1fd6a05476d432e8a584708d2bcb09350553 | [
"Apache-2.0"
] | 32 | 2016-05-09T13:05:13.000Z | 2021-02-09T12:44:47.000Z | libs/statsd/set.py | rbellary-vi/netuitive-statsd | bd2c1fd6a05476d432e8a584708d2bcb09350553 | [
"Apache-2.0"
] | 2 | 2018-10-19T03:34:17.000Z | 2021-02-08T11:24:04.000Z | import logging
from .util import get_timestamp
logger = logging.getLogger(__name__)
class Set(object):
def __init__(self, name, sparseDataStrategy='None', unit='', tags=[]):
self.name = name
self.sparseDataStrategy = sparseDataStrategy
self.unit = unit
self.tags = tags
s... | 21.928571 | 74 | 0.559175 | import logging
from .util import get_timestamp
logger = logging.getLogger(__name__)
class Set(object):
def __init__(self, name, sparseDataStrategy='None', unit='', tags=[]):
self.name = name
self.sparseDataStrategy = sparseDataStrategy
self.unit = unit
self.tags = tags
s... | true | true |
f73a8b085a753801ceb7deb600d9c5de355acfa6 | 5,961 | py | Python | gym_kuka_mujoco/controllers/impedance_controller_v2.py | leonmkim/gym-kuka-mujoco | ed45ae74d10e69f4e51439de2d1d0c0811623b6b | [
"MIT"
] | null | null | null | gym_kuka_mujoco/controllers/impedance_controller_v2.py | leonmkim/gym-kuka-mujoco | ed45ae74d10e69f4e51439de2d1d0c0811623b6b | [
"MIT"
] | null | null | null | gym_kuka_mujoco/controllers/impedance_controller_v2.py | leonmkim/gym-kuka-mujoco | ed45ae74d10e69f4e51439de2d1d0c0811623b6b | [
"MIT"
] | null | null | null | import os
import numpy as np
from gym import spaces
import mujoco_py
from gym_kuka_mujoco.envs.assets import kuka_asset_dir
from gym_kuka_mujoco.utils.quaternion import identity_quat, subQuat, quatAdd, mat2Quat
from gym_kuka_mujoco.utils.kinematics import forwardKinSite, forwardKinJacobianSite
from .base_controller i... | 39.476821 | 169 | 0.648717 | import os
import numpy as np
from gym import spaces
import mujoco_py
from gym_kuka_mujoco.envs.assets import kuka_asset_dir
from gym_kuka_mujoco.utils.quaternion import identity_quat, subQuat, quatAdd, mat2Quat
from gym_kuka_mujoco.utils.kinematics import forwardKinSite, forwardKinJacobianSite
from .base_controller i... | true | true |
f73a8d563c65119522e32835547199d5dccce95c | 1,089 | py | Python | dagger/pipeline/ios/athena_io.py | jorgetagle/dagger | dafcfb9df904e512f050aefdacf6581c571bac23 | [
"MIT"
] | 5 | 2020-09-09T11:44:49.000Z | 2021-12-31T14:07:00.000Z | dagger/pipeline/ios/athena_io.py | jorgetagle/dagger | dafcfb9df904e512f050aefdacf6581c571bac23 | [
"MIT"
] | null | null | null | dagger/pipeline/ios/athena_io.py | jorgetagle/dagger | dafcfb9df904e512f050aefdacf6581c571bac23 | [
"MIT"
] | 3 | 2021-08-31T10:14:42.000Z | 2022-02-28T17:03:39.000Z | from dagger.pipeline.io import IO
from dagger.utilities.config_validator import Attribute
class AthenaIO(IO):
ref_name = "athena"
@classmethod
def init_attributes(cls, orig_cls):
cls.add_config_attributes(
[
Attribute(
attribute_name="schema", comme... | 25.325581 | 87 | 0.606061 | from dagger.pipeline.io import IO
from dagger.utilities.config_validator import Attribute
class AthenaIO(IO):
ref_name = "athena"
@classmethod
def init_attributes(cls, orig_cls):
cls.add_config_attributes(
[
Attribute(
attribute_name="schema", comme... | true | true |
f73a8df692d91ed8b8518678673f255749f13bc4 | 10,221 | py | Python | shop/models/address.py | triggerfast/django-shop | 57f97291dbb389d833fc3e99da54cb888d3b006e | [
"BSD-3-Clause"
] | 1 | 2020-04-20T05:24:24.000Z | 2020-04-20T05:24:24.000Z | shop/models/address.py | triggerfast/django-shop | 57f97291dbb389d833fc3e99da54cb888d3b006e | [
"BSD-3-Clause"
] | null | null | null | shop/models/address.py | triggerfast/django-shop | 57f97291dbb389d833fc3e99da54cb888d3b006e | [
"BSD-3-Clause"
] | null | null | null | # -*- coding: utf-8 -*-
from __future__ import unicode_literals
"""
Holds all the information relevant to the client (addresses for instance)
"""
from six import with_metaclass
from django.db import models
from django.template.loader import select_template
from django.utils.translation import ugettext_lazy as _
from ... | 29.540462 | 94 | 0.503571 |
from __future__ import unicode_literals
from six import with_metaclass
from django.db import models
from django.template.loader import select_template
from django.utils.translation import ugettext_lazy as _
from shop import deferred
from shop.conf import app_settings
class AddressManager(models.Manager):
def g... | true | true |
f73a902eb5515661e065d028dca1ec4ee2bd174f | 933 | py | Python | testing/vcs/vtk_ui/test_vtk_ui_slider_callbacks.py | xylar/cdat | 8a5080cb18febfde365efc96147e25f51494a2bf | [
"BSD-3-Clause"
] | 62 | 2018-03-30T15:46:56.000Z | 2021-12-08T23:30:24.000Z | testing/vcs/vtk_ui/test_vtk_ui_slider_callbacks.py | xylar/cdat | 8a5080cb18febfde365efc96147e25f51494a2bf | [
"BSD-3-Clause"
] | 114 | 2018-03-21T01:12:43.000Z | 2021-07-05T12:29:54.000Z | testing/vcs/vtk_ui/test_vtk_ui_slider_callbacks.py | CDAT/uvcdat | 5133560c0c049b5c93ee321ba0af494253b44f91 | [
"BSD-3-Clause"
] | 14 | 2018-06-06T02:42:47.000Z | 2021-11-26T03:27:00.000Z | """
Test slider callbacks
"""
import vcs.vtk_ui
from vtk_ui_test import vtk_ui_test
from decimal import Decimal
class test_vtk_ui_slider_callbacks(vtk_ui_test):
def do_test(self):
self.win.SetSize(100, 100)
slider = vcs.vtk_ui.Slider(self.inter, point1=(.1, .5), point2=(.9, .5), end=self.end_callba... | 30.096774 | 132 | 0.623794 | """
Test slider callbacks
"""
import vcs.vtk_ui
from vtk_ui_test import vtk_ui_test
from decimal import Decimal
class test_vtk_ui_slider_callbacks(vtk_ui_test):
def do_test(self):
self.win.SetSize(100, 100)
slider = vcs.vtk_ui.Slider(self.inter, point1=(.1, .5), point2=(.9, .5), end=self.end_callba... | false | true |
f73a90b94e2c9835ecf7d319e48fbe2a6dee55c1 | 13,960 | py | Python | model-optimizer/mo/utils/class_registration.py | fujunwei/dldt | 09497b7724de4be92629f7799b8538b483d809a2 | [
"Apache-2.0"
] | null | null | null | model-optimizer/mo/utils/class_registration.py | fujunwei/dldt | 09497b7724de4be92629f7799b8538b483d809a2 | [
"Apache-2.0"
] | null | null | null | model-optimizer/mo/utils/class_registration.py | fujunwei/dldt | 09497b7724de4be92629f7799b8538b483d809a2 | [
"Apache-2.0"
] | null | null | null | """
Copyright (C) 2018-2020 Intel Corporation
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 i... | 41.671642 | 120 | 0.636963 | import logging as log
import networkx as nx
import os
from enum import Enum
from mo.graph.graph import Graph
from mo.middle.passes.eliminate import shape_inference
from mo.middle.pattern_match import for_graph_and_each_sub_graph_recursively
from mo.utils.error import Error, InternalError, FrameworkError
from mo.utils... | true | true |
f73a9187b5d73b951569d273ef0dcec6ecc321e2 | 106 | py | Python | trinity/enumerator/__init__.py | chyanju/Poe | 7602f413378c0c3a88a5edac8125fb4dcb17765b | [
"MIT"
] | 1 | 2021-10-30T20:30:46.000Z | 2021-10-30T20:30:46.000Z | trinity/enumerator/__init__.py | chyanju/Poe | 7602f413378c0c3a88a5edac8125fb4dcb17765b | [
"MIT"
] | null | null | null | trinity/enumerator/__init__.py | chyanju/Poe | 7602f413378c0c3a88a5edac8125fb4dcb17765b | [
"MIT"
] | null | null | null | from .enumerator import Enumerator
from .line_skeleton import LineSkeletonEnumerator, LineSkeletonIterator | 53 | 71 | 0.896226 | from .enumerator import Enumerator
from .line_skeleton import LineSkeletonEnumerator, LineSkeletonIterator | true | true |
f73a919e4a25a75653a81f6c59be073fe1b891f8 | 10,060 | py | Python | utils/utils.py | surisdi/DPC | ce6fe25938c1bebb7f654d0c8f8479bf92ab4054 | [
"MIT"
] | null | null | null | utils/utils.py | surisdi/DPC | ce6fe25938c1bebb7f654d0c8f8479bf92ab4054 | [
"MIT"
] | null | null | null | utils/utils.py | surisdi/DPC | ce6fe25938c1bebb7f654d0c8f8479bf92ab4054 | [
"MIT"
] | null | null | null | import torch
import numpy as np
import os
from datetime import datetime
import glob
import matplotlib.pyplot as plt
plt.switch_backend('agg')
from collections import deque
from torchvision import transforms
def save_checkpoint(state, is_best=0, gap=1, filename='models/checkpoint.pth.tar', keep_all=False):
torch.s... | 35.052265 | 120 | 0.544334 | import torch
import numpy as np
import os
from datetime import datetime
import glob
import matplotlib.pyplot as plt
plt.switch_backend('agg')
from collections import deque
from torchvision import transforms
def save_checkpoint(state, is_best=0, gap=1, filename='models/checkpoint.pth.tar', keep_all=False):
torch.s... | true | true |
f73a91c04d2f8f458bc742d94fe68e180a2dc473 | 24,060 | py | Python | featuretools/computational_backends/pandas_backend.py | JunweiPan3013/featuretools | b0c8478f9bf8f46217726e3a32de51e083d98351 | [
"BSD-3-Clause"
] | null | null | null | featuretools/computational_backends/pandas_backend.py | JunweiPan3013/featuretools | b0c8478f9bf8f46217726e3a32de51e083d98351 | [
"BSD-3-Clause"
] | 1 | 2019-03-22T00:30:54.000Z | 2019-03-22T00:30:54.000Z | featuretools/computational_backends/pandas_backend.py | JunweiPan3013/featuretools | b0c8478f9bf8f46217726e3a32de51e083d98351 | [
"BSD-3-Clause"
] | 1 | 2019-03-21T04:36:16.000Z | 2019-03-21T04:36:16.000Z | import cProfile
import logging
import os
import pstats
import sys
import warnings
from datetime import datetime
import numpy as np
import pandas as pd
import pandas.api.types as pdtypes
from future import standard_library
from .base_backend import ComputationalBackend
from .feature_tree import FeatureTree
from featu... | 45.140713 | 109 | 0.577764 | import cProfile
import logging
import os
import pstats
import sys
import warnings
from datetime import datetime
import numpy as np
import pandas as pd
import pandas.api.types as pdtypes
from future import standard_library
from .base_backend import ComputationalBackend
from .feature_tree import FeatureTree
from featu... | true | true |
f73a92eabd4b8f52e5bc4fd68822c6777c4d54e1 | 624 | py | Python | LeetCode/1-1000/201-300/226-250/226. Invert Binary Tree/solution-python.py | adubois85/coding_challenge_websites | 7867a05847a216661eff3b24b1cb1480fb7d3030 | [
"Apache-2.0"
] | null | null | null | LeetCode/1-1000/201-300/226-250/226. Invert Binary Tree/solution-python.py | adubois85/coding_challenge_websites | 7867a05847a216661eff3b24b1cb1480fb7d3030 | [
"Apache-2.0"
] | null | null | null | LeetCode/1-1000/201-300/226-250/226. Invert Binary Tree/solution-python.py | adubois85/coding_challenge_websites | 7867a05847a216661eff3b24b1cb1480fb7d3030 | [
"Apache-2.0"
] | null | null | null | from typing import Optional
# Definition for a binary tree node.
class TreeNode:
def __init__(self, val=0, left=None, right=None):
self.val = val
self.left = left
self.right = right
class Solution:
# recursive solution
# Depth-first search going right, then left
def invertTre... | 26 | 73 | 0.61859 | from typing import Optional
class TreeNode:
def __init__(self, val=0, left=None, right=None):
self.val = val
self.left = left
self.right = right
class Solution:
def invertTree(self, root: Optional[TreeNode]) -> Optional[TreeNode]:
if root is None:
retur... | true | true |
f73a9364534513170eb1a8a9313208ab6c8f5fa6 | 3,727 | py | Python | AcrobatLocalAutosave.py | fmoldenhauer/AcrobatLocalAutosave | e93df3147d766400e1637e905e29c0a49540f1ba | [
"MIT"
] | null | null | null | AcrobatLocalAutosave.py | fmoldenhauer/AcrobatLocalAutosave | e93df3147d766400e1637e905e29c0a49540f1ba | [
"MIT"
] | null | null | null | AcrobatLocalAutosave.py | fmoldenhauer/AcrobatLocalAutosave | e93df3147d766400e1637e905e29c0a49540f1ba | [
"MIT"
] | null | null | null | import os
import signal
import sys
import threading
import time
import traceback
from datetime import datetime
from win32com.client import constants
from win32com.client.gencache import EnsureDispatch
def getdocsfolder():
# Gets local user document folder and appends 'Autosaves'
oshell = EnsureDispatch("Wscr... | 31.058333 | 112 | 0.597532 | import os
import signal
import sys
import threading
import time
import traceback
from datetime import datetime
from win32com.client import constants
from win32com.client.gencache import EnsureDispatch
def getdocsfolder():
oshell = EnsureDispatch("Wscript.Shell")
docs = oshell.SpecialFolders("MyDocument... | true | true |
f73a9369bccd1cfb6478e9521b02649fb0d2e321 | 9,148 | py | Python | lib/utils.py | wdzhong/ASTGCN-PyTorch | 4f76d2302b6fd4227c4846e06ff11560d8a8237b | [
"MIT"
] | 17 | 2020-06-20T02:25:05.000Z | 2022-03-27T11:58:50.000Z | lib/utils.py | Neoyanghc/ASTGCN-PyTorch | 4f76d2302b6fd4227c4846e06ff11560d8a8237b | [
"MIT"
] | 1 | 2020-03-05T13:48:31.000Z | 2020-03-05T13:48:31.000Z | lib/utils.py | Neoyanghc/ASTGCN-PyTorch | 4f76d2302b6fd4227c4846e06ff11560d8a8237b | [
"MIT"
] | 8 | 2020-05-14T02:18:30.000Z | 2021-07-20T12:27:03.000Z | # -*- coding:utf-8 -*-
# pylint: disable=no-member
import csv
import numpy as np
from scipy.sparse.linalg import eigs
from .metrics import mean_absolute_error, mean_squared_error, masked_mape_np
def search_data(sequence_length, num_of_batches, label_start_idx,
num_for_predict, units, points_per_hour... | 29.04127 | 152 | 0.591167 |
import csv
import numpy as np
from scipy.sparse.linalg import eigs
from .metrics import mean_absolute_error, mean_squared_error, masked_mape_np
def search_data(sequence_length, num_of_batches, label_start_idx,
num_for_predict, units, points_per_hour):
if points_per_hour < 0:
raise Val... | true | true |
f73a93f354dbfe3d3d9dcc9e0faf39ad2e05048e | 1,939 | py | Python | sdk/resources/azure-mgmt-resource/azure/mgmt/resource/policy/v2018_05_01/models/_paged_models.py | iscai-msft/azure-sdk-for-python | 83715b95c41e519d5be7f1180195e2fba136fc0f | [
"MIT"
] | 1 | 2021-06-02T08:01:35.000Z | 2021-06-02T08:01:35.000Z | sdk/resources/azure-mgmt-resource/azure/mgmt/resource/policy/v2018_05_01/models/_paged_models.py | iscai-msft/azure-sdk-for-python | 83715b95c41e519d5be7f1180195e2fba136fc0f | [
"MIT"
] | 226 | 2019-07-24T07:57:21.000Z | 2019-10-15T01:07:24.000Z | sdk/resources/azure-mgmt-resource/azure/mgmt/resource/policy/v2018_05_01/models/_paged_models.py | iscai-msft/azure-sdk-for-python | 83715b95c41e519d5be7f1180195e2fba136fc0f | [
"MIT"
] | 2 | 2021-05-23T16:46:31.000Z | 2021-05-26T23:51:09.000Z | # coding=utf-8
# --------------------------------------------------------------------------
# Copyright (c) Microsoft Corporation. All rights reserved.
# Licensed under the MIT License. See License.txt in the project root for
# license information.
#
# Code generated by Microsoft (R) AutoRest Code Generator.
# Changes ... | 35.907407 | 155 | 0.623517 |
from msrest.paging import Paged
class PolicyAssignmentPaged(Paged):
_attribute_map = {
'next_link': {'key': 'nextLink', 'type': 'str'},
'current_page': {'key': 'value', 'type': '[PolicyAssignment]'}
}
def __init__(self, *args, **kwargs):
super(PolicyAssignmentPaged, s... | true | true |
f73a9408751376983aedf679f68c28c3da0028c9 | 140 | py | Python | config.py | bsoyka/sunset-bot | ea05000e52e1883ddba77ab754e5f733c8b3375c | [
"MIT"
] | 1 | 2021-06-21T16:58:48.000Z | 2021-06-21T16:58:48.000Z | config.py | bsoyka/sunset-bot | ea05000e52e1883ddba77ab754e5f733c8b3375c | [
"MIT"
] | 4 | 2021-08-13T16:52:51.000Z | 2021-09-01T13:05:42.000Z | config.py | sunset-vacation/bot | ea05000e52e1883ddba77ab754e5f733c8b3375c | [
"MIT"
] | 4 | 2021-06-21T22:16:12.000Z | 2021-08-11T21:01:19.000Z | from pathlib import Path
from dynamic_yaml import load
with (Path(__file__).parent / 'config.yaml').open() as f:
CONFIG = load(f)
| 23.333333 | 58 | 0.692857 | from pathlib import Path
from dynamic_yaml import load
with (Path(__file__).parent / 'config.yaml').open() as f:
CONFIG = load(f)
| true | true |
f73a94c73b0acceaa44f08e9b07ab0a550ed9eeb | 3,386 | py | Python | problem_solving/maximum_subarray_sum/code.py | Chicco94/hacker-rank-code | 998d3abd7a40d85ec3d8fc4afe600b65978984db | [
"MIT"
] | null | null | null | problem_solving/maximum_subarray_sum/code.py | Chicco94/hacker-rank-code | 998d3abd7a40d85ec3d8fc4afe600b65978984db | [
"MIT"
] | null | null | null | problem_solving/maximum_subarray_sum/code.py | Chicco94/hacker-rank-code | 998d3abd7a40d85ec3d8fc4afe600b65978984db | [
"MIT"
] | null | null | null | #!/bin/python3
import math
import os
import random
import re
import sys
from functools import cache
import time
from bisect import bisect,insort
@cache
def get_sub_sum(temp_sum,removed,added,modulo):
return (temp_sum-removed+added)%modulo
def maximumSum_iter_2(a, m, a_sum):
if len(a) == 0: return 0
if le... | 29.701754 | 90 | 0.551683 |
import math
import os
import random
import re
import sys
from functools import cache
import time
from bisect import bisect,insort
@cache
def get_sub_sum(temp_sum,removed,added,modulo):
return (temp_sum-removed+added)%modulo
def maximumSum_iter_2(a, m, a_sum):
if len(a) == 0: return 0
if len(a) == 1: ret... | true | true |
f73a952b9290dc76a7f0dc3b96e6c90358a9fc2c | 1,063 | py | Python | api/admin.py | PatrickCmd/Recipe-API-Django-GraphQL | bed1f1ebab88615ca62ea3846fbeb8e1a69c09e6 | [
"MIT"
] | null | null | null | api/admin.py | PatrickCmd/Recipe-API-Django-GraphQL | bed1f1ebab88615ca62ea3846fbeb8e1a69c09e6 | [
"MIT"
] | null | null | null | api/admin.py | PatrickCmd/Recipe-API-Django-GraphQL | bed1f1ebab88615ca62ea3846fbeb8e1a69c09e6 | [
"MIT"
] | null | null | null | from django.contrib import admin
from .models import Category, Recipe, Ingredient, RecipeVote
@admin.register(Category)
class CategoryAdmin(admin.ModelAdmin):
list_display = (
"id",
"name",
"owner",
"description",
)
search_fields = (
"name",
"owner"
)
... | 17.145161 | 60 | 0.523989 | from django.contrib import admin
from .models import Category, Recipe, Ingredient, RecipeVote
@admin.register(Category)
class CategoryAdmin(admin.ModelAdmin):
list_display = (
"id",
"name",
"owner",
"description",
)
search_fields = (
"name",
"owner"
)
... | true | true |
f73a95654fa3601d6df72f989dd2887bc9d735c2 | 1,867 | py | Python | array_queue.py | KAIKAIZHANG/Algorithm | 755547dea7f055919abfe9165279fc08e120b75d | [
"MIT"
] | 1 | 2019-03-01T09:00:40.000Z | 2019-03-01T09:00:40.000Z | array_queue.py | KAIKAIZHANG/Algorithm | 755547dea7f055919abfe9165279fc08e120b75d | [
"MIT"
] | null | null | null | array_queue.py | KAIKAIZHANG/Algorithm | 755547dea7f055919abfe9165279fc08e120b75d | [
"MIT"
] | null | null | null | # -*- coding: utf-8 -*-
"""
用数组实现队列queue:用数组实现的队列是顺序队列,主要操作有入队和出队操作。
"""
from typing import Optional
class DynamicQueue:
"""
算法步骤:
1.入队列
(1)判断尾指针大小是否位等于队列存储容量
是
(1.2)判断头指针是否位于队列开头,
是,队列已满,无法插入
否,队列未满,将队列进行前部搬移
a.数据整段往前重新复制搬移
... | 21.709302 | 86 | 0.528656 |
from typing import Optional
class DynamicQueue:
def __init__(self, capacity: int):
self._items = []
self._head = 0
self._tail = 0
self._capacity = capacity
def enqueue(self, item: str):
if self._tail == self._capacity:
if self._head == 0:
... | true | true |
f73a960f610486f84a47840f56531280ba7619ca | 34,914 | py | Python | tests/test_resources_job.py | Spredzy/tower-cli | 2c115877a36238b94fb8af1ff32915ebaf868e60 | [
"Apache-2.0"
] | 1 | 2019-03-20T20:58:23.000Z | 2019-03-20T20:58:23.000Z | tests/test_resources_job.py | Spredzy/tower-cli | 2c115877a36238b94fb8af1ff32915ebaf868e60 | [
"Apache-2.0"
] | null | null | null | tests/test_resources_job.py | Spredzy/tower-cli | 2c115877a36238b94fb8af1ff32915ebaf868e60 | [
"Apache-2.0"
] | null | null | null | # Copyright 2015, Ansible, Inc.
# Luke Sneeringer <lsneeringer@ansible.com>
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless requi... | 40.131034 | 107 | 0.525319 |
import json
import yaml
import time
from copy import copy
import click
import tower_cli
from tower_cli.api import client
from tower_cli import exceptions as exc
from tower_cli.cli.resource import ResSubcommand
from tests.compat import unittest, mock
from tower_cli.conf import settings
from tower_cli.c... | true | true |
f73a962dd32ccb6fbf113c22d0a8c223db3c7ad5 | 789 | py | Python | resetbg/resetbg.py | pzyyll/fun_tools | 1021d5d838ac2db6d051874fff548fc632c908a8 | [
"MIT"
] | null | null | null | resetbg/resetbg.py | pzyyll/fun_tools | 1021d5d838ac2db6d051874fff548fc632c908a8 | [
"MIT"
] | null | null | null | resetbg/resetbg.py | pzyyll/fun_tools | 1021d5d838ac2db6d051874fff548fc632c908a8 | [
"MIT"
] | null | null | null | """ 一个制作替换头像背景颜色的小工具(可以自制证件照~)
resetbg.py img_file color[blue|red|white]
"""
import sys
import removebg
from removebg import RemoveBg
from PIL import Image
class Color(object):
BLUE = (30, 144, 255)
RED = (255, 48, 48)
WHITE = (255, 255, 255)
@staticmethod
def getColor(color):
return {
... | 19.725 | 57 | 0.646388 |
import sys
import removebg
from removebg import RemoveBg
from PIL import Image
class Color(object):
BLUE = (30, 144, 255)
RED = (255, 48, 48)
WHITE = (255, 255, 255)
@staticmethod
def getColor(color):
return {
'blue': Color.BLUE,
'red': Color.RED
}.get(col... | true | true |
f73a970a5b30ae54b9427c6dcf06706f67d17dd6 | 2,253 | py | Python | languages/python/src/concepts/P036_Dictionaries.py | vikash-india/DeveloperNotes2Myself | fe277a3c52f73884863f2f72b237365b27a8c882 | [
"MIT"
] | 2 | 2019-05-25T10:09:00.000Z | 2022-03-11T09:06:23.000Z | languages/python/src/concepts/P036_Dictionaries.py | vikash-india/DeveloperNotes2Myself | fe277a3c52f73884863f2f72b237365b27a8c882 | [
"MIT"
] | 2 | 2020-03-31T04:30:17.000Z | 2020-10-30T07:54:28.000Z | languages/python/src/concepts/P036_Dictionaries.py | vikash-india/DeveloperNotes2Myself | fe277a3c52f73884863f2f72b237365b27a8c882 | [
"MIT"
] | 4 | 2019-07-12T13:18:56.000Z | 2021-11-17T08:04:55.000Z | # Description: Dictionaries in Python
# Note
# 1. A dictionary is an UNORDERED key: value pairs, with the requirement that the keys are unique within a dictionary.
# 2. Dictionary in other languages are also called "associative memories", "associative arrays", "hash map" etc.
# 3. Dictionary Keys
# - Dictionaries a... | 47.93617 | 120 | 0.64403 |
info = {}
info = {'AAAA': 1111, 'BBBB': 2222}
info['CCCC'] = 3333
dictionary1 = dict([('DDDD', 4444), ('EEEE', 5555)])
dictionary2 = dict(sape=4139, guido=4127, jack=4098)
... | true | true |
f73a975f0d306f0272d72f7050ec5232a8c6d8fc | 13,051 | py | Python | opal_client/client.py | MatanyaStroh/opal | 6b0c61d0bd5d08fc5291827ff6af8587d6dbc775 | [
"Apache-2.0"
] | 367 | 2021-04-11T11:58:35.000Z | 2022-02-24T15:33:54.000Z | opal_client/client.py | asafcsimpleorg/opal | 262a296e5a2d06e9d1b15fcf3cc9adf68e12fd91 | [
"Apache-2.0"
] | 63 | 2021-04-14T07:00:44.000Z | 2021-12-07T12:05:38.000Z | opal_client/client.py | asafcsimpleorg/opal | 262a296e5a2d06e9d1b15fcf3cc9adf68e12fd91 | [
"Apache-2.0"
] | 32 | 2021-04-11T12:53:53.000Z | 2021-12-04T19:57:42.000Z | from logging import disable
import os
import signal
import asyncio
import uuid
import aiohttp
import functools
from typing import List, Optional
from fastapi import FastAPI
import websockets
from opal_common.logger import logger, configure_logs
from opal_common.middleware import configure_middleware
from opal_common.... | 43.942761 | 220 | 0.689679 | from logging import disable
import os
import signal
import asyncio
import uuid
import aiohttp
import functools
from typing import List, Optional
from fastapi import FastAPI
import websockets
from opal_common.logger import logger, configure_logs
from opal_common.middleware import configure_middleware
from opal_common.... | true | true |
f73a9a422d3c323f5b13da425abee834a51ec3e8 | 441 | py | Python | reader/opinions/opinion.py | nicolay-r/RuSentRel | 4fc0df1580d3da21f0be1e832e403652f73caed1 | [
"MIT"
] | 5 | 2019-01-28T10:31:07.000Z | 2021-09-08T06:25:30.000Z | reader/opinions/opinion.py | nicolay-r/RuSentRel | 4fc0df1580d3da21f0be1e832e403652f73caed1 | [
"MIT"
] | null | null | null | reader/opinions/opinion.py | nicolay-r/RuSentRel | 4fc0df1580d3da21f0be1e832e403652f73caed1 | [
"MIT"
] | 1 | 2019-08-18T18:30:56.000Z | 2019-08-18T18:30:56.000Z | from ..common.opinions.opinion import Opinion
class RuSentRelOpinion(Opinion):
def __init__(self, value_source, value_target, sentiment):
assert(',' not in value_source)
assert(',' not in value_target)
super(RuSentRelOpinion, self).__init__(source_value=value_source,
... | 36.75 | 73 | 0.587302 | from ..common.opinions.opinion import Opinion
class RuSentRelOpinion(Opinion):
def __init__(self, value_source, value_target, sentiment):
assert(',' not in value_source)
assert(',' not in value_target)
super(RuSentRelOpinion, self).__init__(source_value=value_source,
... | true | true |
f73a9acf63d52b11022bc82165e556cf59c8bf4d | 3,768 | py | Python | pyshard/app/app.py | la9ran9e/pyshard | 99a345e01c9e949720c345ed142cae9c7d2839f7 | [
"MIT"
] | 6 | 2019-07-11T14:08:41.000Z | 2021-04-11T03:33:10.000Z | pyshard/app/app.py | la9ran9e/pyshard | 99a345e01c9e949720c345ed142cae9c7d2839f7 | [
"MIT"
] | 2 | 2019-07-19T20:07:32.000Z | 2022-02-12T10:17:52.000Z | pyshard/app/app.py | la9ran9e/pyshard | 99a345e01c9e949720c345ed142cae9c7d2839f7 | [
"MIT"
] | 1 | 2022-02-12T10:11:16.000Z | 2022-02-12T10:11:16.000Z | import abc
from typing import Union
from ..master.master import Master, _Shards
from ..master.client import MasterClient
from ..shard.client import ShardClient
from ..core.client import ClientError
from ..core.typing import Key, Doc, Hash
class AbstractResult(abc.ABC):
@abc.abstractmethod
def result(self) ->... | 27.107914 | 89 | 0.603769 | import abc
from typing import Union
from ..master.master import Master, _Shards
from ..master.client import MasterClient
from ..shard.client import ShardClient
from ..core.client import ClientError
from ..core.typing import Key, Doc, Hash
class AbstractResult(abc.ABC):
@abc.abstractmethod
def result(self) ->... | true | true |
f73a9baafa9bf7b4797f518cdcfb94577b0fdb4d | 1,856 | py | Python | top_articles/cron_articles.py | Ramesh7128/hacker-news-clone | f41cca2e2d39b7a610b6261f6f1af6ff24f0e466 | [
"MIT"
] | 1 | 2019-05-28T13:24:28.000Z | 2019-05-28T13:24:28.000Z | top_articles/cron_articles.py | Ramesh7128/hacker-news-clone | f41cca2e2d39b7a610b6261f6f1af6ff24f0e466 | [
"MIT"
] | 2 | 2020-06-05T19:48:32.000Z | 2021-06-10T21:08:21.000Z | top_articles/cron_articles.py | Ramesh7128/hacker-news-clone | f41cca2e2d39b7a610b6261f6f1af6ff24f0e466 | [
"MIT"
] | 1 | 2019-03-19T18:55:29.000Z | 2019-03-19T18:55:29.000Z |
import asyncio
import aiohttp
import requests
from top_articles.models import Story
from django.core.exceptions import ObjectDoesNotExist
def check_db_story_ids(articlesID_list):
new_articleID_list = []
for id in articlesID_list:
try:
Story.objects.get(id=id)
except ObjectDoesNotEx... | 31.457627 | 83 | 0.709591 |
import asyncio
import aiohttp
import requests
from top_articles.models import Story
from django.core.exceptions import ObjectDoesNotExist
def check_db_story_ids(articlesID_list):
new_articleID_list = []
for id in articlesID_list:
try:
Story.objects.get(id=id)
except ObjectDoesNotEx... | true | true |
f73a9bc09926655605ead8c6dbff3fb134d9c7f1 | 5,748 | py | Python | utils/utils.py | JacopoBugini/SpotMask | 0be6c35283b89d5bbddcdb2b65a67a59fac4d264 | [
"MIT"
] | 1 | 2021-08-30T13:47:19.000Z | 2021-08-30T13:47:19.000Z | utils/utils.py | JacopoBugini/SpotMask | 0be6c35283b89d5bbddcdb2b65a67a59fac4d264 | [
"MIT"
] | null | null | null | utils/utils.py | JacopoBugini/SpotMask | 0be6c35283b89d5bbddcdb2b65a67a59fac4d264 | [
"MIT"
] | null | null | null | import numpy as np
import cv2
import tensorflow.keras as keras
from tensorflow.keras.preprocessing import image
import numpy as np
# -------------------------------------------------------------------
# Load models
# -------------------------------------------------------------------
# Load the trained model
mask_net... | 34.836364 | 117 | 0.586639 | import numpy as np
import cv2
import tensorflow.keras as keras
from tensorflow.keras.preprocessing import image
import numpy as np
mask_net = keras.models.load_model('models/facemask-correctness/mask_correctness_model.h5')
print("Model Check Mask imported correctly")
detect_net = keras.models.load_model('models/... | true | true |
f73a9d4f5a6e83541ab9e6f996577af341d5b098 | 2,402 | py | Python | garage_door_opener (28mar2016)/gdo.py | jamtot/DailyChallenge | 2cb073837620ad57f064f5befca77d4994abf091 | [
"MIT"
] | null | null | null | garage_door_opener (28mar2016)/gdo.py | jamtot/DailyChallenge | 2cb073837620ad57f064f5befca77d4994abf091 | [
"MIT"
] | null | null | null | garage_door_opener (28mar2016)/gdo.py | jamtot/DailyChallenge | 2cb073837620ad57f064f5befca77d4994abf091 | [
"MIT"
] | null | null | null | input0 = """button_clicked
cycle_complete
button_clicked
button_clicked
button_clicked
button_clicked
button_clicked
cycle_complete"""
input1 = """button_clicked
cycle_complete
button_clicked
block_detected
button_clicked
cycle_complete
button_clicked
block_cleared
button_clicked
cycle_complete"""
class GarageDoor(ob... | 30.405063 | 112 | 0.639467 | input0 = """button_clicked
cycle_complete
button_clicked
button_clicked
button_clicked
button_clicked
button_clicked
cycle_complete"""
input1 = """button_clicked
cycle_complete
button_clicked
block_detected
button_clicked
cycle_complete
button_clicked
block_cleared
button_clicked
cycle_complete"""
class GarageDoor(ob... | false | true |
f73a9d6f13d293b5a4eaf1b31cd6470abcde107a | 1,280 | py | Python | dane/utils.py | CLARIAH/DANE-util | 8a3edec69be18ac3bdee476b65059409af05c1bb | [
"Apache-2.0"
] | null | null | null | dane/utils.py | CLARIAH/DANE-util | 8a3edec69be18ac3bdee476b65059409af05c1bb | [
"Apache-2.0"
] | 1 | 2019-12-11T19:46:20.000Z | 2019-12-11T21:30:38.000Z | dane/utils.py | CLARIAH/DANE-util | 8a3edec69be18ac3bdee476b65059409af05c1bb | [
"Apache-2.0"
] | null | null | null | # Copyright 2020-present, Netherlands Institute for Sound and Vision (Nanne van Noord)
#
# 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
#
#... | 33.684211 | 94 | 0.657031 | true | true | |
f73a9d79dcbad3b1c1df4232ee70738ec1694d7c | 2,125 | py | Python | optuna/visualization/_utils.py | srijan-deepsource/optuna | 2a83adf1e5104a4cde2f8f275788dc1aaf246097 | [
"MIT"
] | 2 | 2021-02-28T10:35:23.000Z | 2021-06-16T10:01:44.000Z | optuna/visualization/_utils.py | srijan-deepsource/optuna | 2a83adf1e5104a4cde2f8f275788dc1aaf246097 | [
"MIT"
] | 12 | 2021-03-28T06:50:16.000Z | 2022-03-07T15:07:23.000Z | optuna/visualization/_utils.py | crcrpar/optuna | d25c7ee8e103575207978ec09a14ad9a4fefa53d | [
"MIT"
] | 1 | 2021-03-17T04:28:42.000Z | 2021-03-17T04:28:42.000Z | from typing import Callable
from typing import List
from typing import Optional
from typing import Sequence
from typing import Union
import warnings
from optuna.distributions import CategoricalDistribution
from optuna.distributions import LogUniformDistribution
from optuna.study import Study
from optuna.trial import F... | 28.333333 | 98 | 0.686588 | from typing import Callable
from typing import List
from typing import Optional
from typing import Sequence
from typing import Union
import warnings
from optuna.distributions import CategoricalDistribution
from optuna.distributions import LogUniformDistribution
from optuna.study import Study
from optuna.trial import F... | true | true |
f73a9f7139a49cf163c274e062f1e08230a93421 | 2,353 | py | Python | tests/product/tests/test_process_kubelet_rules.py | jeniawhite/cloudbeat | 5306ef6f5750b57c8a523fd76283b22da80a140f | [
"ECL-2.0",
"Apache-2.0"
] | 1 | 2022-03-07T09:20:47.000Z | 2022-03-07T09:20:47.000Z | tests/product/tests/test_process_kubelet_rules.py | jeniawhite/cloudbeat | 5306ef6f5750b57c8a523fd76283b22da80a140f | [
"ECL-2.0",
"Apache-2.0"
] | 25 | 2022-02-22T15:16:43.000Z | 2022-03-31T15:15:56.000Z | tests/product/tests/test_process_kubelet_rules.py | jeniawhite/cloudbeat | 5306ef6f5750b57c8a523fd76283b22da80a140f | [
"ECL-2.0",
"Apache-2.0"
] | 7 | 2022-03-02T15:19:28.000Z | 2022-03-29T12:45:34.000Z | """
Kubernetes CIS rules verification.
This module verifies correctness of retrieved findings by manipulating audit and remediation actions
"""
from datetime import datetime
import pytest
import time
from commonlib.utils import get_evaluation
from product.tests.tests.process.process_test_cases import *
@pytest.mark... | 37.349206 | 115 | 0.697408 | from datetime import datetime
import pytest
import time
from commonlib.utils import get_evaluation
from product.tests.tests.process.process_test_cases import *
@pytest.mark.rules
@pytest.mark.parametrize(
("rule_tag", "dictionary", "resource", "expected"),
kubelet_rules,
)
def test_process_kubelet(config_no... | true | true |
f73aa07486f160e58c64c36fd743339e78454a80 | 888 | py | Python | setup.py | mjoblin/neotiles | f7370aefb74d4d57692d0e8a302c8c95f817a61a | [
"MIT"
] | 1 | 2021-04-25T19:27:12.000Z | 2021-04-25T19:27:12.000Z | setup.py | mjoblin/neotiles | f7370aefb74d4d57692d0e8a302c8c95f817a61a | [
"MIT"
] | 1 | 2016-12-27T00:35:51.000Z | 2017-01-02T06:30:04.000Z | setup.py | mjoblin/neotiles | f7370aefb74d4d57692d0e8a302c8c95f817a61a | [
"MIT"
] | null | null | null | #!/usr/bin/env python
from setuptools import setup, find_packages
packages = [package for package in find_packages()
if package.startswith('neotiles')]
version = '0.4.0'
install_requires = [
'wrapt',
]
setup_requires = [
'pytest-runner'
]
tests_require = [
'pytest',
'pytest-cov',
... | 18.122449 | 83 | 0.653153 |
from setuptools import setup, find_packages
packages = [package for package in find_packages()
if package.startswith('neotiles')]
version = '0.4.0'
install_requires = [
'wrapt',
]
setup_requires = [
'pytest-runner'
]
tests_require = [
'pytest',
'pytest-cov',
'pytest-sugar'
]
ext... | true | true |
f73aa12f6985d1f2e9876af55a40726426258f6e | 15,109 | py | Python | src/application.py | hiitsmeme/BookOrganizer | 666f2568a5bb89b6c6c012d4af7fd63a1f662bca | [
"MIT"
] | 1 | 2021-09-10T19:43:10.000Z | 2021-09-10T19:43:10.000Z | src/application.py | hiitsmeme/BookOrganizer | 666f2568a5bb89b6c6c012d4af7fd63a1f662bca | [
"MIT"
] | 1 | 2021-09-10T19:44:06.000Z | 2021-09-10T19:44:06.000Z | src/application.py | hiitsmeme/BookOrganizer | 666f2568a5bb89b6c6c012d4af7fd63a1f662bca | [
"MIT"
] | 1 | 2021-10-02T13:37:51.000Z | 2021-10-02T13:37:51.000Z | from flask import Flask, flash, render_template, request, session, redirect, url_for
import flask_login
from sqlalchemy import create_engine, Column, Integer, String, ForeignKey
from sqlalchemy.ext.declarative import declarative_base
from sqlalchemy.orm import Session, sessionmaker
from flask_session import Session
fro... | 38.445293 | 227 | 0.630419 | from flask import Flask, flash, render_template, request, session, redirect, url_for
import flask_login
from sqlalchemy import create_engine, Column, Integer, String, ForeignKey
from sqlalchemy.ext.declarative import declarative_base
from sqlalchemy.orm import Session, sessionmaker
from flask_session import Session
fro... | true | true |
f73aa4743bbf6e7484d7968e7f251af60f29aa80 | 2,326 | py | Python | shared/CastInPipeline.py | mssalvador/NextProject | b9e223f8f1de803fd3865c3f2148a417f88556da | [
"Apache-2.0"
] | 1 | 2017-10-10T07:00:46.000Z | 2017-10-10T07:00:46.000Z | shared/CastInPipeline.py | mssalvador/NextProject | b9e223f8f1de803fd3865c3f2148a417f88556da | [
"Apache-2.0"
] | null | null | null | shared/CastInPipeline.py | mssalvador/NextProject | b9e223f8f1de803fd3865c3f2148a417f88556da | [
"Apache-2.0"
] | 2 | 2018-11-19T09:07:49.000Z | 2018-11-28T12:54:25.000Z | '''
Created on Oct 13, 2017
@author: svanhmic
'''
from pyspark.ml.param.shared import HasInputCol, HasOutputCol
from pyspark.ml import Transformer
from pyspark.sql import functions as F
from pyspark import keyword_only
from pyspark.ml.param import Params, Param, TypeConverters
class CastInPipeline(Transformer, HasIn... | 32.305556 | 100 | 0.588134 | from pyspark.ml.param.shared import HasInputCol, HasOutputCol
from pyspark.ml import Transformer
from pyspark.sql import functions as F
from pyspark import keyword_only
from pyspark.ml.param import Params, Param, TypeConverters
class CastInPipeline(Transformer, HasInputCol):
applicable_casts = ['intstring',
... | true | true |
f73aa4a1ef8ce18a908f665a0856c28d81ed879a | 5,971 | py | Python | python/ray/tune/logger.py | visatish/ray | dc76e51a60652b3210c93f81df6dafcf461d4431 | [
"Apache-2.0"
] | 29 | 2019-05-18T12:18:34.000Z | 2022-03-30T01:46:48.000Z | python/ray/tune/logger.py | visatish/ray | dc76e51a60652b3210c93f81df6dafcf461d4431 | [
"Apache-2.0"
] | 8 | 2019-08-15T05:42:10.000Z | 2021-05-21T09:41:15.000Z | python/ray/tune/logger.py | visatish/ray | dc76e51a60652b3210c93f81df6dafcf461d4431 | [
"Apache-2.0"
] | 8 | 2019-07-15T22:36:20.000Z | 2020-08-09T07:03:26.000Z | from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
import csv
import json
import logging
import numpy as np
import os
import yaml
from ray.tune.log_sync import get_syncer
from ray.tune.result import NODE_IP, TRAINING_ITERATION, TIME_TOTAL_S, \
TIMESTEPS_TO... | 29.706468 | 79 | 0.624519 | from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
import csv
import json
import logging
import numpy as np
import os
import yaml
from ray.tune.log_sync import get_syncer
from ray.tune.result import NODE_IP, TRAINING_ITERATION, TIME_TOTAL_S, \
TIMESTEPS_TO... | true | true |
f73aa5cb46401d3cf1db1f98d7bd85961884409c | 9,349 | py | Python | app.py | shinyichen/gaia-visualization | ebbd741a9e5668df4be1f13f432855009f8bc63d | [
"MIT"
] | null | null | null | app.py | shinyichen/gaia-visualization | ebbd741a9e5668df4be1f13f432855009f8bc63d | [
"MIT"
] | 2 | 2019-03-01T00:02:54.000Z | 2019-07-24T22:54:06.000Z | app.py | shinyichen/gaia-visualization | ebbd741a9e5668df4be1f13f432855009f8bc63d | [
"MIT"
] | 2 | 2018-08-16T20:57:03.000Z | 2019-03-05T22:07:28.000Z | import os
from flask import Flask, render_template, abort, request, jsonify
# from model import get_cluster, get_cluster_list, types, recover_doc_online
from model import Model, types
# from setting import repo, port, repositories, upload_folder, import_endpoint
import setting
from setting import url_prefix
import grou... | 33.389286 | 114 | 0.609049 | import os
from flask import Flask, render_template, abort, request, jsonify
from model import Model, types
import setting
from setting import url_prefix
import groundtruth as gt
import debug
import requests
from rdflib.plugins.stores.sparqlstore import SPARQLStore
import tmp
import time_person_label
import re
app =... | true | true |
f73aa7cd50353763aebc57cd41c7030d67f336cc | 2,882 | py | Python | opennre/tests/converters/semeval2010/test_spacy_sdp_converter.py | igorvlnascimento/DeepREF | 0fed8120571e44e12ee3d1861289bc101c0a275f | [
"MIT"
] | null | null | null | opennre/tests/converters/semeval2010/test_spacy_sdp_converter.py | igorvlnascimento/DeepREF | 0fed8120571e44e12ee3d1861289bc101c0a275f | [
"MIT"
] | null | null | null | opennre/tests/converters/semeval2010/test_spacy_sdp_converter.py | igorvlnascimento/DeepREF | 0fed8120571e44e12ee3d1861289bc101c0a275f | [
"MIT"
] | null | null | null | # from opennre.dataset.converters.converter_semeval2010 import ConverterSemEval2010
# def test_should_return_correct_spacy_sdp_when_doing_sdp_preprocessing_first_example():
# p = ConverterSemEval2010("spacy", "general")
# assert p.tokenize("the most common ENTITYSTART audits ENTITYEND were about ENTITYOTHE... | 77.891892 | 387 | 0.710965 | true | true | |
f73aa83a76cae82a3526ca7dd3d012ae0fb9f86d | 1,478 | py | Python | tensorflow/compiler/mlir/tensorflow/tests/tf_saved_model/exported_python_args.py | yage99/tensorflow | c7fa71b32a3635eb25596ae80d007b41007769c4 | [
"Apache-2.0"
] | 388 | 2020-06-27T01:38:29.000Z | 2022-03-29T14:12:01.000Z | tensorflow/compiler/mlir/tensorflow/tests/tf_saved_model/exported_python_args.py | sseung0703/tensorflow | be084bd7a4dd241eb781fc704f57bcacc5c9b6dd | [
"Apache-2.0"
] | 1,056 | 2019-12-15T01:20:31.000Z | 2022-02-10T02:06:28.000Z | tensorflow/compiler/mlir/tensorflow/tests/tf_saved_model/exported_python_args.py | sseung0703/tensorflow | be084bd7a4dd241eb781fc704f57bcacc5c9b6dd | [
"Apache-2.0"
] | 75 | 2021-12-24T04:48:21.000Z | 2022-03-29T10:13:39.000Z | # Copyright 2019 The TensorFlow Authors. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applica... | 35.190476 | 83 | 0.714479 |
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
import tensorflow.compat.v2 as tf
from tensorflow.compiler.mlir.tensorflow.tests.tf_saved_model import common
class TestModule(tf.Module):
@tf.function(input_signature=[tf.TensorSpec([], ... | true | true |
f73aaaf086bdb134abb896c1768d6413a0c141df | 7,513 | py | Python | sdk/python/pulumi_sonarqube/sonar_project.py | jshield/pulumi-sonarqube | 53664a97903af3ecdf4f613117d83d0acae8e53e | [
"ECL-2.0",
"Apache-2.0"
] | null | null | null | sdk/python/pulumi_sonarqube/sonar_project.py | jshield/pulumi-sonarqube | 53664a97903af3ecdf4f613117d83d0acae8e53e | [
"ECL-2.0",
"Apache-2.0"
] | null | null | null | sdk/python/pulumi_sonarqube/sonar_project.py | jshield/pulumi-sonarqube | 53664a97903af3ecdf4f613117d83d0acae8e53e | [
"ECL-2.0",
"Apache-2.0"
] | null | null | null | # coding=utf-8
# *** WARNING: this file was generated by the Pulumi Terraform Bridge (tfgen) Tool. ***
# *** Do not edit by hand unless you're certain you know what you are doing! ***
import warnings
import pulumi
import pulumi.runtime
from typing import Any, Mapping, Optional, Sequence, Union, overload
from . import ... | 37.193069 | 134 | 0.625982 |
import warnings
import pulumi
import pulumi.runtime
from typing import Any, Mapping, Optional, Sequence, Union, overload
from . import _utilities
__all__ = ['SonarProjectArgs', 'SonarProject']
@pulumi.input_type
class SonarProjectArgs:
def __init__(__self__, *,
project: pulumi.Input[str],
... | true | true |
f73aac1e1623a1c14df2e4643c7ad48bb6c25c70 | 7,623 | py | Python | AddEPSG3857Projection101.py | usgin/AddEPSG3857PrjArcServer | a964591ee124cf6bf0b2bc42b404dad8a5bb8b9b | [
"MIT"
] | null | null | null | AddEPSG3857Projection101.py | usgin/AddEPSG3857PrjArcServer | a964591ee124cf6bf0b2bc42b404dad8a5bb8b9b | [
"MIT"
] | null | null | null | AddEPSG3857Projection101.py | usgin/AddEPSG3857PrjArcServer | a964591ee124cf6bf0b2bc42b404dad8a5bb8b9b | [
"MIT"
] | null | null | null | #ArcGIS Server 10.1 service editor
#view your service properties at: http://[your server URL]/arcgis/admin/services/
#put a ?f=json at the end of a service name to see the json properties -
#the JSON is what is being edited here
#Loops through the services in a particular folder and edits the
#listSupportedCRS property... | 40.121053 | 137 | 0.571297 |
import httplib, urllib, json
import sys
import getpass
def main(argv=None):
serverName = raw_input("Enter server name (server URL): ")
serverPort = raw_input("Enter server port (usually 6080): ")
serverFolder = raw_input("Enter folder in your service directory to edit serv... | false | true |
f73aae3f98d12580e9f23b1b54552ca9d80a12b5 | 3,113 | py | Python | hdf5_loading_three_bumps.py | h-mayorquin/time_series_basic | 654fb67ef6258b3f200c15a2b8068ab9300401d7 | [
"BSD-3-Clause"
] | null | null | null | hdf5_loading_three_bumps.py | h-mayorquin/time_series_basic | 654fb67ef6258b3f200c15a2b8068ab9300401d7 | [
"BSD-3-Clause"
] | null | null | null | hdf5_loading_three_bumps.py | h-mayorquin/time_series_basic | 654fb67ef6258b3f200c15a2b8068ab9300401d7 | [
"BSD-3-Clause"
] | null | null | null | import h5py
import numpy as np
import matplotlib.pyplot as plt
import matplotlib.gridspec as gridspec
from signals.aux_functions import gaussian_bump
import nexa.loading as load
from visualization.sensors import visualize_SLM_hdf5
from visualization.sensors import visualize_STDM_hdf5
from visualization.sensor_clusteri... | 27.069565 | 101 | 0.713138 | import h5py
import numpy as np
import matplotlib.pyplot as plt
import matplotlib.gridspec as gridspec
from signals.aux_functions import gaussian_bump
import nexa.loading as load
from visualization.sensors import visualize_SLM_hdf5
from visualization.sensors import visualize_STDM_hdf5
from visualization.sensor_clusteri... | true | true |
f73aae7e0b0a3486f44f67e82ab00863ac51f7f5 | 14,193 | py | Python | utils/ContextLogger.py | paulaWesselmann/testing_pydial | bf4fd0c99242e49d67895d92c6cfc3dc31084182 | [
"Apache-2.0"
] | 3 | 2019-09-27T06:07:12.000Z | 2020-01-06T19:00:34.000Z | utils/ContextLogger.py | paulaWesselmann/testing_pydial | bf4fd0c99242e49d67895d92c6cfc3dc31084182 | [
"Apache-2.0"
] | null | null | null | utils/ContextLogger.py | paulaWesselmann/testing_pydial | bf4fd0c99242e49d67895d92c6cfc3dc31084182 | [
"Apache-2.0"
] | 1 | 2019-11-27T09:28:10.000Z | 2019-11-27T09:28:10.000Z | ###############################################################################
# PyDial: Multi-domain Statistical Spoken Dialogue System Software
###############################################################################
#
# Copyright 2015 - 2017
# Cambridge University Engineering Department Dialogue Systems Grou... | 33.474057 | 123 | 0.585077 | true | true | |
f73aafa0e6f239adfd578b43d03bccb1270e8988 | 2,566 | py | Python | tclCommands/TclCommandIsolate.py | brownjohnf/flatcam | 17b3be3c209934e8802a41062a3120ebf479c956 | [
"MIT"
] | 4 | 2018-12-31T18:57:21.000Z | 2021-04-04T04:57:22.000Z | tclCommands/TclCommandIsolate.py | brownjohnf/flatcam | 17b3be3c209934e8802a41062a3120ebf479c956 | [
"MIT"
] | 1 | 2017-12-23T22:04:32.000Z | 2017-12-23T22:04:32.000Z | tclCommands/TclCommandIsolate.py | brownjohnf/flatcam | 17b3be3c209934e8802a41062a3120ebf479c956 | [
"MIT"
] | null | null | null | from ObjectCollection import *
import TclCommand
class TclCommandIsolate(TclCommand.TclCommandSignaled):
"""
Tcl shell command to Creates isolation routing geometry for the given Gerber.
example:
set_sys units MM
new
open_gerber tests/gerber_files/simple1.gbr -outname margin
... | 32.075 | 112 | 0.601325 | from ObjectCollection import *
import TclCommand
class TclCommandIsolate(TclCommand.TclCommandSignaled):
aliases = ['isolate']
arg_names = collections.OrderedDict([
('name', str)
])
option_types = collections.OrderedDict([
('dia', float),
('passes', int),
... | true | true |
f73aafd417b6ab1ed73ee0e3b02c5b3701a01ccc | 384 | py | Python | predictor/migrations/0003_auto_20200820_0704.py | fadilzteria/DLIR-ID-AR | a383fc7fc8a066ea8877c34df26a5829ec9c9396 | [
"MIT"
] | null | null | null | predictor/migrations/0003_auto_20200820_0704.py | fadilzteria/DLIR-ID-AR | a383fc7fc8a066ea8877c34df26a5829ec9c9396 | [
"MIT"
] | null | null | null | predictor/migrations/0003_auto_20200820_0704.py | fadilzteria/DLIR-ID-AR | a383fc7fc8a066ea8877c34df26a5829ec9c9396 | [
"MIT"
] | null | null | null | # Generated by Django 3.0.3 on 2020-08-19 23:04
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('predictor', '0002_review'),
]
operations = [
migrations.AlterField(
model_name='review',
name='dokumen_relevan',
... | 20.210526 | 49 | 0.596354 |
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('predictor', '0002_review'),
]
operations = [
migrations.AlterField(
model_name='review',
name='dokumen_relevan',
field=models.IntegerField(default=0),
... | true | true |
f73ab0995d30008dd726e836ee5323b82909d58c | 572 | py | Python | mis/wsgi.py | rcdosado/URO-MIS | 84834048ad747b4355b354d9d9ddfa814cd4365f | [
"MIT"
] | null | null | null | mis/wsgi.py | rcdosado/URO-MIS | 84834048ad747b4355b354d9d9ddfa814cd4365f | [
"MIT"
] | null | null | null | mis/wsgi.py | rcdosado/URO-MIS | 84834048ad747b4355b354d9d9ddfa814cd4365f | [
"MIT"
] | null | null | null | """
WSGI config for mis project.
It exposes the WSGI callable as a module-level variable named ``application``.
For more information on this file, see
https://docs.djangoproject.com/en/1.10/howto/deployment/wsgi/
"""
import os
from django.core.wsgi import get_wsgi_application
if os.getenv("DJANGO_MODE").lower() !... | 23.833333 | 78 | 0.744755 |
import os
from django.core.wsgi import get_wsgi_application
if os.getenv("DJANGO_MODE").lower() != 'local':
from dj_static import Cling
os.environ.setdefault("DJANGO_SETTINGS_MODULE", "mis.settings")
if os.getenv("DJANGO_MODE").lower() != 'local':
application = Cling(get_wsgi_application())
else:
appl... | true | true |
f73ab0d1a15f665a17eef5ab8b529af1a49552fc | 489 | py | Python | ws-dan/utils.py | sun-yitao/GrabAIChallenge | 05946339e5a478216d7a9234e29e9bd7af5b3492 | [
"MIT"
] | 10 | 2019-07-05T05:28:30.000Z | 2020-09-15T02:47:16.000Z | ws-dan/utils.py | sun-yitao/GrabAIChallenge | 05946339e5a478216d7a9234e29e9bd7af5b3492 | [
"MIT"
] | 6 | 2019-11-18T12:59:22.000Z | 2022-02-10T00:23:00.000Z | ws-dan/utils.py | sun-yitao/GrabAIChallenge | 05946339e5a478216d7a9234e29e9bd7af5b3492 | [
"MIT"
] | 2 | 2019-07-17T15:12:14.000Z | 2020-04-15T19:06:41.000Z | import numpy as np
def accuracy(output, target, topk=(1,)):
"""Computes the accuracy@k for the specified values of k"""
maxk = max(topk)
batch_size = target.size(0)
_, pred = output.topk(maxk, 1, True, True)
pred = pred.t()
correct = pred.eq(target.view(1, -1).expand_as(pred))
res = []
... | 25.736842 | 63 | 0.611452 | import numpy as np
def accuracy(output, target, topk=(1,)):
maxk = max(topk)
batch_size = target.size(0)
_, pred = output.topk(maxk, 1, True, True)
pred = pred.t()
correct = pred.eq(target.view(1, -1).expand_as(pred))
res = []
for k in topk:
correct_k = correct[:k].view(-1).float... | true | true |
f73ab118df9a8181f77aee3f797d22dd165e3b1e | 10,496 | py | Python | Software/interface/main.py | pet-eletrica/tur | f6c49fe15945378eacf4b4b23411d557c8e88c32 | [
"MIT"
] | 1 | 2019-09-26T04:03:51.000Z | 2019-09-26T04:03:51.000Z | main.py | TallesSilva/Sensor_Pista_TUR | 0553e60dc67d1b8006ab3cba106c4baf9056d7df | [
"Unlicense"
] | null | null | null | main.py | TallesSilva/Sensor_Pista_TUR | 0553e60dc67d1b8006ab3cba106c4baf9056d7df | [
"Unlicense"
] | null | null | null | import sys
from time import *
import serial
import serial.tools.list_ports as serial_tools
from PyQt5.QtWidgets import *
from PyQt5.QtCore import *
from PyQt5 import QtCore, QtGui, QtWidgets
import pista as base
#---------------------------- VARIAVEIS GLOBAIS
global tempo_sensor
tempo_sensor = {
'contador_do_timer' :... | 39.908745 | 262 | 0.602801 | import sys
from time import *
import serial
import serial.tools.list_ports as serial_tools
from PyQt5.QtWidgets import *
from PyQt5.QtCore import *
from PyQt5 import QtCore, QtGui, QtWidgets
import pista as base
global tempo_sensor
tempo_sensor = {
'contador_do_timer' : [0],
'A' : [0],
'B' : [0],
'C' : [0],
'D' : [0... | true | true |
f73ab2948daa58260ac313e2f31c7dce7b616281 | 6,411 | py | Python | toontown/betaevent/DistributedBetaEvent.py | LittleNed/toontown-stride | 1252a8f9a8816c1810106006d09c8bdfe6ad1e57 | [
"Apache-2.0"
] | 1 | 2018-06-16T23:06:38.000Z | 2018-06-16T23:06:38.000Z | toontown/betaevent/DistributedBetaEvent.py | NoraTT/Historical-Commits-Project-Altis-Source | fe88e6d07edf418f7de6ad5b3d9ecb3d0d285179 | [
"Apache-2.0"
] | null | null | null | toontown/betaevent/DistributedBetaEvent.py | NoraTT/Historical-Commits-Project-Altis-Source | fe88e6d07edf418f7de6ad5b3d9ecb3d0d285179 | [
"Apache-2.0"
] | 4 | 2019-06-20T23:45:23.000Z | 2020-10-14T20:30:15.000Z | from panda3d.core import Point3, VBase3, Vec3, Vec4
from toontown.betaevent.DistributedEvent import DistributedEvent
from toontown.betaevent import CogTV
from toontown.hood import ZoneUtil
from direct.fsm import ClassicFSM, State
from direct.interval.IntervalGlobal import *
from toontown.toon import Toon, ToonDNA... | 42.177632 | 130 | 0.610357 | from panda3d.core import Point3, VBase3, Vec3, Vec4
from toontown.betaevent.DistributedEvent import DistributedEvent
from toontown.betaevent import CogTV
from toontown.hood import ZoneUtil
from direct.fsm import ClassicFSM, State
from direct.interval.IntervalGlobal import *
from toontown.toon import Toon, ToonDNA... | true | true |
f73ab338ff262c2299f7e169a94f5f4c2fb66501 | 4,826 | py | Python | goldeneye/commands.py | smartpigling/goldeneye | 704ee16ca89cb0b8a9b7c23216689e04d9f07a92 | [
"BSD-3-Clause"
] | null | null | null | goldeneye/commands.py | smartpigling/goldeneye | 704ee16ca89cb0b8a9b7c23216689e04d9f07a92 | [
"BSD-3-Clause"
] | null | null | null | goldeneye/commands.py | smartpigling/goldeneye | 704ee16ca89cb0b8a9b7c23216689e04d9f07a92 | [
"BSD-3-Clause"
] | null | null | null | # -*- coding: utf-8 -*-
"""Click commands."""
import os
from glob import glob
from subprocess import call
import click
from flask import current_app
from flask.cli import with_appcontext
from werkzeug.exceptions import MethodNotAllowed, NotFound
HERE = os.path.abspath(os.path.dirname(__file__))
PROJECT_ROOT = os.path... | 32.608108 | 80 | 0.618525 |
import os
from glob import glob
from subprocess import call
import click
from flask import current_app
from flask.cli import with_appcontext
from werkzeug.exceptions import MethodNotAllowed, NotFound
HERE = os.path.abspath(os.path.dirname(__file__))
PROJECT_ROOT = os.path.join(HERE, os.pardir)
TEST_PATH = os.path.jo... | true | true |
f73ab6176ab8fe472d5242378c8bc7c181ac542c | 4,666 | py | Python | tests/test_chi_citycouncil.py | danielahuang/city-scrapers | 711d1995f59100793e771068a6f5d9149e773412 | [
"MIT"
] | null | null | null | tests/test_chi_citycouncil.py | danielahuang/city-scrapers | 711d1995f59100793e771068a6f5d9149e773412 | [
"MIT"
] | null | null | null | tests/test_chi_citycouncil.py | danielahuang/city-scrapers | 711d1995f59100793e771068a6f5d9149e773412 | [
"MIT"
] | null | null | null | import json
from datetime import date, time
from urllib.parse import parse_qs
import pytest
from freezegun import freeze_time
from tests.utils import file_response, read_test_file_content
from city_scrapers.constants import CITY_COUNCIL
from city_scrapers.spiders.chi_citycouncil import ChiCityCouncilSpider
INITIAL_R... | 30.496732 | 150 | 0.658594 | import json
from datetime import date, time
from urllib.parse import parse_qs
import pytest
from freezegun import freeze_time
from tests.utils import file_response, read_test_file_content
from city_scrapers.constants import CITY_COUNCIL
from city_scrapers.spiders.chi_citycouncil import ChiCityCouncilSpider
INITIAL_R... | true | true |
f73ab626a16c21cc6848405eb3ef504d504ce3f3 | 1,365 | py | Python | minidoc/bin.py | ihgazni2/minidoc | b2859069bad5e718692b57d5498389473c66bd2e | [
"MIT"
] | null | null | null | minidoc/bin.py | ihgazni2/minidoc | b2859069bad5e718692b57d5498389473c66bd2e | [
"MIT"
] | null | null | null | minidoc/bin.py | ihgazni2/minidoc | b2859069bad5e718692b57d5498389473c66bd2e | [
"MIT"
] | null | null | null | from minidoc import minidoc
from minidoc import tst
import argparse
from efdir import fs
parser = argparse.ArgumentParser()
parser.add_argument('-tst','--test_file', default="code.tst.py",help=".tst.py file name")
parser.add_argument('-codec','--codec', default="utf-8",help=".tst.py file codec")
parser.add_argument('-... | 39 | 102 | 0.711355 | from minidoc import minidoc
from minidoc import tst
import argparse
from efdir import fs
parser = argparse.ArgumentParser()
parser.add_argument('-tst','--test_file', default="code.tst.py",help=".tst.py file name")
parser.add_argument('-codec','--codec', default="utf-8",help=".tst.py file codec")
parser.add_argument('-... | true | true |
f73ab69d03a3a5646a5c54640110708f8c08b9f8 | 1,234 | py | Python | app.py | cinmoy98/neural-network-visualizer | bbb8a5237fe60ee552e3f343ab03707d381895dc | [
"MIT"
] | null | null | null | app.py | cinmoy98/neural-network-visualizer | bbb8a5237fe60ee552e3f343ab03707d381895dc | [
"MIT"
] | 1 | 2020-06-08T19:13:34.000Z | 2020-06-08T19:13:34.000Z | app.py | cinmoy98/neural-network-visualizer-webapp | bbb8a5237fe60ee552e3f343ab03707d381895dc | [
"MIT"
] | null | null | null |
import streamlit as st
import json
import requests
import matplotlib.pyplot as plt
import numpy as np
URI = 'http://neural-net-viz-flask.herokuapp.com'
st.title('Nural Network Visualizer')
st.sidebar.markdown('## Input Image')
if st.button('Get Random Prediction'):
response = requests.post(URI, data={})
res... | 26.255319 | 69 | 0.54376 |
import streamlit as st
import json
import requests
import matplotlib.pyplot as plt
import numpy as np
URI = 'http://neural-net-viz-flask.herokuapp.com'
st.title('Nural Network Visualizer')
st.sidebar.markdown('## Input Image')
if st.button('Get Random Prediction'):
response = requests.post(URI, data={})
res... | true | true |
f73ab6c71c82b06fc1fc4eff0a310fc869b130b2 | 336 | py | Python | shop/migrations/0003_auto_20190608_1137.py | chidibede/Django-Ecommerce-Site | c3a139ccf6e67ea90ab3879afcb16528be008548 | [
"MIT"
] | null | null | null | shop/migrations/0003_auto_20190608_1137.py | chidibede/Django-Ecommerce-Site | c3a139ccf6e67ea90ab3879afcb16528be008548 | [
"MIT"
] | null | null | null | shop/migrations/0003_auto_20190608_1137.py | chidibede/Django-Ecommerce-Site | c3a139ccf6e67ea90ab3879afcb16528be008548 | [
"MIT"
] | null | null | null | # Generated by Django 2.2 on 2019-06-08 10:37
from django.db import migrations
class Migration(migrations.Migration):
dependencies = [
('shop', '0002_auto_20190608_1135'),
]
operations = [
migrations.RenameModel(
old_name='Smart_Watch',
new_name='Smart_Watche',
... | 18.666667 | 45 | 0.604167 |
from django.db import migrations
class Migration(migrations.Migration):
dependencies = [
('shop', '0002_auto_20190608_1135'),
]
operations = [
migrations.RenameModel(
old_name='Smart_Watch',
new_name='Smart_Watche',
),
]
| true | true |
f73ab76404bc56d9e66c7d27d97571d01b26c578 | 712 | py | Python | test/__main__.py | daviddever/skybot | 1dfcd5889f1711b24098c2d6640ec47a2dbd047c | [
"Unlicense"
] | 114 | 2015-01-04T07:44:12.000Z | 2021-09-12T16:06:40.000Z | test/__main__.py | daviddever/skybot | 1dfcd5889f1711b24098c2d6640ec47a2dbd047c | [
"Unlicense"
] | 54 | 2015-01-11T21:55:59.000Z | 2021-04-24T22:19:53.000Z | test/__main__.py | daviddever/skybot | 1dfcd5889f1711b24098c2d6640ec47a2dbd047c | [
"Unlicense"
] | 84 | 2015-01-05T23:10:38.000Z | 2021-12-24T06:08:09.000Z | from os import path
from unittest import TestSuite, TestLoader, TextTestRunner
import sys
if __name__ == "__main__":
# Because the project is structured differently than
# any tooling expects, we need to modify the python
# path during runtime (or before) to get it to
# properly import plugins and othe... | 35.6 | 68 | 0.745787 | from os import path
from unittest import TestSuite, TestLoader, TextTestRunner
import sys
if __name__ == "__main__":
project_root_directory = path.dirname(path.dirname(__file__))
sys.path.append(path.join(project_root_directory, "plugins"))
sys.path.append(path.join(project_root_direct... | true | true |
f73ab7c8cbdfa2c0eea579f94eaae11d2b328bdd | 1,099 | py | Python | books/models.py | Toluwalemi/django-bookstore-app | 588d99ee9075fd7cfa9bf0d8fc251efcd3caabb2 | [
"MIT"
] | null | null | null | books/models.py | Toluwalemi/django-bookstore-app | 588d99ee9075fd7cfa9bf0d8fc251efcd3caabb2 | [
"MIT"
] | null | null | null | books/models.py | Toluwalemi/django-bookstore-app | 588d99ee9075fd7cfa9bf0d8fc251efcd3caabb2 | [
"MIT"
] | null | null | null | import uuid
from django.contrib.auth import get_user_model
from django.db import models
# Create your models here.
from django.urls import reverse
class Book(models.Model):
id = models.UUIDField(primary_key=True, default=uuid.uuid4, editable=False)
title = models.CharField(max_length=250)
author = model... | 28.179487 | 86 | 0.681529 | import uuid
from django.contrib.auth import get_user_model
from django.db import models
from django.urls import reverse
class Book(models.Model):
id = models.UUIDField(primary_key=True, default=uuid.uuid4, editable=False)
title = models.CharField(max_length=250)
author = models.CharField(max_length=250... | true | true |
f73ab7f8d73b3bd19addce32766b4de676985cec | 3,465 | py | Python | coremltools/converters/mil/backend/mil/passes/insert_image_preprocessing_op.py | odedzewi/coremltools | 055d4bf9c00dee8a38258128d6599609df9ae32c | [
"BSD-3-Clause"
] | 1 | 2022-02-10T10:54:28.000Z | 2022-02-10T10:54:28.000Z | coremltools/converters/mil/backend/mil/passes/insert_image_preprocessing_op.py | 0xgpapad/coremltools | fdd5630c423c0fc4f1a04c3f5a3c17b808a15505 | [
"BSD-3-Clause"
] | null | null | null | coremltools/converters/mil/backend/mil/passes/insert_image_preprocessing_op.py | 0xgpapad/coremltools | fdd5630c423c0fc4f1a04c3f5a3c17b808a15505 | [
"BSD-3-Clause"
] | null | null | null | # -*- coding: utf-8 -*-
# Copyright (c) 2020, Apple Inc. All rights reserved.
#
# Use of this source code is governed by a BSD-3-clause license that can be
# found in the LICENSE.txt file or at https://opensource.org/licenses/BSD-3-Clause
from coremltools.converters.mil.mil.passes.pass_registry import register_pas... | 49.5 | 119 | 0.567965 |
from coremltools.converters.mil.mil.passes.pass_registry import register_pass
from coremltools.converters.mil.mil.passes.graph_pass import AbstractGraphPass
from coremltools.converters.mil.input_types import ImageType
from coremltools.converters.mil.mil.ops import defs as _ops
from coremltools.converters.mil.mi... | true | true |
f73ab8bfb0618c9b58ff5d1b1c0a124f476c43c6 | 13,530 | py | Python | tests/consensus-validation-malicious-producers.py | nikola-tesla-448/iwill-master | e00aa1daf1fd5093a48cca4117a08f45b2e53db9 | [
"MIT"
] | null | null | null | tests/consensus-validation-malicious-producers.py | nikola-tesla-448/iwill-master | e00aa1daf1fd5093a48cca4117a08f45b2e53db9 | [
"MIT"
] | null | null | null | tests/consensus-validation-malicious-producers.py | nikola-tesla-448/iwill-master | e00aa1daf1fd5093a48cca4117a08f45b2e53db9 | [
"MIT"
] | null | null | null | #!/usr/bin/env python3
import testUtils
import argparse
import signal
from collections import namedtuple
import os
import shutil
###############################################################
# Test for validating consensus based block production. We introduce malicious producers which
# reject all transactions.
#... | 33.909774 | 165 | 0.649002 |
import testUtils
import argparse
import signal
from collections import namedtuple
import os
import shutil
in = iwillio::producer_plugin
plugin = iwillio::chain_api_plugin
plugin = iwillio::history_plugin
plugin = iwillio::history_api_plugin"""
config01="""genesis-json = ./genesis.json
block-log-dir = blocks
reado... | true | true |
f73ab8f8ffd2cdbd4147905c99511d2a61036bbd | 20,469 | py | Python | tests/test_api_endpoints/test_survey_endpoints.py | wouterpotters/castoredc_api_client | 963f793f0f747281419532242dc65a009d7cc9cd | [
"MIT"
] | null | null | null | tests/test_api_endpoints/test_survey_endpoints.py | wouterpotters/castoredc_api_client | 963f793f0f747281419532242dc65a009d7cc9cd | [
"MIT"
] | null | null | null | tests/test_api_endpoints/test_survey_endpoints.py | wouterpotters/castoredc_api_client | 963f793f0f747281419532242dc65a009d7cc9cd | [
"MIT"
] | null | null | null | # -*- coding: utf-8 -*-
"""
Testing class for survey endpoints of the Castor EDC API Wrapper.
Link: https://data.castoredc.com/api#/survey
@author: R.C.A. van Linschoten
https://orcid.org/0000-0003-3052-596X
"""
import pytest
from exceptions.exceptions import CastorException
from tests.test_api_endpoints.data_models ... | 46.626424 | 417 | 0.584542 |
import pytest
from exceptions.exceptions import CastorException
from tests.test_api_endpoints.data_models import (
survey_model,
package_model,
survey_package_instance_model,
)
def create_survey_package_instance_body(record_id, fake):
if fake:
random_package = "FAKE"
else:
random... | true | true |
f73ab90323589397a94c67f89b415f354f638968 | 1,665 | py | Python | data.py | stanford-oval/word-language-model | 3be3f65a198b518b66e22a910f28f83324db3825 | [
"BSD-3-Clause"
] | null | null | null | data.py | stanford-oval/word-language-model | 3be3f65a198b518b66e22a910f28f83324db3825 | [
"BSD-3-Clause"
] | null | null | null | data.py | stanford-oval/word-language-model | 3be3f65a198b518b66e22a910f28f83324db3825 | [
"BSD-3-Clause"
] | 2 | 2020-08-14T19:32:46.000Z | 2022-02-23T03:14:16.000Z | import os
import torch
class Dictionary(object):
"""Build word2idx and idx2word from Corpus(train/val/test)"""
def __init__(self):
self.word2idx = {} # word: index
self.idx2word = [] # position(index): word
def add_word(self, word):
"""Create/Update word2idx and idx2word"""
... | 32.019231 | 67 | 0.539339 | import os
import torch
class Dictionary(object):
def __init__(self):
self.word2idx = {}
self.idx2word = []
def add_word(self, word):
if word not in self.word2idx:
self.idx2word.append(word)
self.word2idx[word] = len(self.idx2word) - 1
return self.word2... | true | true |
f73abbb189b35907aecd60ecb4295aea42eb648b | 4,029 | py | Python | python/regvar/webapps/alignments/application.py | JohnReid/RegVar | ba48402d4ec4f3422f70410a1f4bb582f0f07d4a | [
"MIT"
] | null | null | null | python/regvar/webapps/alignments/application.py | JohnReid/RegVar | ba48402d4ec4f3422f70410a1f4bb582f0f07d4a | [
"MIT"
] | null | null | null | python/regvar/webapps/alignments/application.py | JohnReid/RegVar | ba48402d4ec4f3422f70410a1f4bb582f0f07d4a | [
"MIT"
] | null | null | null | #!/usr/bin/env python
import logging
import bx.align.maf
import cStringIO
import os
import io
import ete2
from flask import Flask, request, send_file
LOGFORMAT = '%(asctime)-15s %(name)s %(levelname)s %(message)s'
logging.basicConfig(format=LOGFORMAT, level=logging.INFO)
logger = logging.getLogger(__name__)
ENVSETTIN... | 35.654867 | 77 | 0.660213 |
import logging
import bx.align.maf
import cStringIO
import os
import io
import ete2
from flask import Flask, request, send_file
LOGFORMAT = '%(asctime)-15s %(name)s %(levelname)s %(message)s'
logging.basicConfig(format=LOGFORMAT, level=logging.INFO)
logger = logging.getLogger(__name__)
ENVSETTINGSVAR = 'ALIGNMENTS_S... | true | true |
f73abc1e615309be1749df31916bc425ccea0619 | 352 | py | Python | setup.py | Ykobe/fingerid | 9c7cbeb3f0350c64a210c262e47264246dde4997 | [
"Apache-2.0"
] | 11 | 2015-10-08T07:19:05.000Z | 2020-05-27T12:10:31.000Z | setup.py | Ykobe/fingerid | 9c7cbeb3f0350c64a210c262e47264246dde4997 | [
"Apache-2.0"
] | 7 | 2016-05-25T21:37:28.000Z | 2018-10-03T09:37:31.000Z | setup.py | Ykobe/fingerid | 9c7cbeb3f0350c64a210c262e47264246dde4997 | [
"Apache-2.0"
] | 4 | 2018-11-20T01:07:05.000Z | 2020-01-12T11:36:14.000Z |
from setuptools import setup, find_packages
config = {
'description':'fingerid-package',
'author':'Huibin Shen',
'url':'project https://github.com/icdishb/fingerid',
'author_email':'huibin.shen@aalto.fi',
'version':'1.4',
'install_requires':['nose'],
'packages':find_packages(),
'name'... | 20.705882 | 56 | 0.644886 |
from setuptools import setup, find_packages
config = {
'description':'fingerid-package',
'author':'Huibin Shen',
'url':'project https://github.com/icdishb/fingerid',
'author_email':'huibin.shen@aalto.fi',
'version':'1.4',
'install_requires':['nose'],
'packages':find_packages(),
'name'... | true | true |
f73abd597a9a5836a9e8b97a95c5dd2a0885178e | 598 | py | Python | TypesandVariableswithTextProcessing/GladiatorExpenses.py | mironmiron3/SoftuniPythonFundamentals | 4f2d968250ae5c58c2b60242da013fe319781c6b | [
"MIT"
] | null | null | null | TypesandVariableswithTextProcessing/GladiatorExpenses.py | mironmiron3/SoftuniPythonFundamentals | 4f2d968250ae5c58c2b60242da013fe319781c6b | [
"MIT"
] | null | null | null | TypesandVariableswithTextProcessing/GladiatorExpenses.py | mironmiron3/SoftuniPythonFundamentals | 4f2d968250ae5c58c2b60242da013fe319781c6b | [
"MIT"
] | null | null | null | lost_fights = int(input())
helmet_price = float(input())
sword_price = float(input())
shield_price = float(input())
armor_price = float(input())
sum = 0
shield_breaks = 0
for i in range (1, lost_fights + 1):
if i % 2 == 0:
sum += helmet_price
if i % 3 == 0:
sum += sword_price
... | 23 | 54 | 0.555184 | lost_fights = int(input())
helmet_price = float(input())
sword_price = float(input())
shield_price = float(input())
armor_price = float(input())
sum = 0
shield_breaks = 0
for i in range (1, lost_fights + 1):
if i % 2 == 0:
sum += helmet_price
if i % 3 == 0:
sum += sword_price
... | true | true |
f73abf8634e9e62a45b595822f93f50e03af4672 | 12,085 | py | Python | interfaces/acados_template/acados_template/acados_sim.py | KexianShen/acados | 2981d29dc6ecdaabdb39cd6c0d784724704afe4a | [
"BSD-2-Clause"
] | null | null | null | interfaces/acados_template/acados_template/acados_sim.py | KexianShen/acados | 2981d29dc6ecdaabdb39cd6c0d784724704afe4a | [
"BSD-2-Clause"
] | null | null | null | interfaces/acados_template/acados_template/acados_sim.py | KexianShen/acados | 2981d29dc6ecdaabdb39cd6c0d784724704afe4a | [
"BSD-2-Clause"
] | null | null | null | # -*- coding: future_fstrings -*-
#
# Copyright 2019 Gianluca Frison, Dimitris Kouzoupis, Robin Verschueren,
# Andrea Zanelli, Niels van Duijkeren, Jonathan Frey, Tommaso Sartor,
# Branimir Novoselnik, Rien Quirynen, Rezart Qelibari, Dang Doan,
# Jonas Koenemann, Yutao Chen, Tobias Schöls, Jonas Schlagenhauf, Moritz Di... | 36.182635 | 145 | 0.658833 |
import numpy as np
import casadi as ca
import os
from .acados_model import AcadosModel
from .utils import get_acados_path, get_lib_ext
class AcadosSimDims:
def __init__(self):
self.__nx = None
self.__nu = None
self.__nz = 0
self.__np = 0
@prope... | true | true |
f73abfc472e17ce4fa2f46adb85cd85b0ea94d15 | 1,811 | py | Python | test/test_team_api.py | angeiv/python-quay | 16072f87956d8f581ac9ebccc67f6563e977cf52 | [
"MIT"
] | null | null | null | test/test_team_api.py | angeiv/python-quay | 16072f87956d8f581ac9ebccc67f6563e977cf52 | [
"MIT"
] | null | null | null | test/test_team_api.py | angeiv/python-quay | 16072f87956d8f581ac9ebccc67f6563e977cf52 | [
"MIT"
] | null | null | null | # coding: utf-8
"""
Quay Frontend
This API allows you to perform many of the operations required to work with Quay repositories, users, and organizations. You can find out more at <a href=\"https://quay.io\">Quay</a>. # noqa: E501
OpenAPI spec version: v1
Contact: support@quay.io
Generated by: h... | 22.085366 | 201 | 0.663722 |
from __future__ import absolute_import
import unittest
import quay
from api.team_api import TeamApi
from quay.rest import ApiException
class TestTeamApi(unittest.TestCase):
def setUp(self):
self.api = api.team_api.TeamApi()
def tearDown(self):
pass
def test_delete_organization_... | true | true |
f73ac1a9538d78cb00c553d98f45d1bf5f55f4e6 | 1,217 | py | Python | code/utils/numerical/ssyrk.py | dmytrov/gaussianprocess | 7044bd2d66f44e10656fee17e94fdee0c24c70bb | [
"MIT"
] | null | null | null | code/utils/numerical/ssyrk.py | dmytrov/gaussianprocess | 7044bd2d66f44e10656fee17e94fdee0c24c70bb | [
"MIT"
] | null | null | null | code/utils/numerical/ssyrk.py | dmytrov/gaussianprocess | 7044bd2d66f44e10656fee17e94fdee0c24c70bb | [
"MIT"
] | null | null | null | import os
import sys
import time
import numpy
from numpy import zeros
from numpy.random import randn
from scipy.linalg import blas
def run_ssyrk(N, l):
A = randn(N, N).astype('float32', order='F')
C = zeros((N, N), dtype='float32', order='F')
start = time.time()
for i in range(0, l):
blas.ss... | 20.982759 | 70 | 0.515201 | import os
import sys
import time
import numpy
from numpy import zeros
from numpy.random import randn
from scipy.linalg import blas
def run_ssyrk(N, l):
A = randn(N, N).astype('float32', order='F')
C = zeros((N, N), dtype='float32', order='F')
start = time.time()
for i in range(0, l):
blas.ss... | true | true |
f73ac1b6436bdbc2c539fd4445e25a2425a99511 | 1,270 | py | Python | cages/.shared/config_interface_http_1.py | targeted/pythomnic3k | c59f8c11302c0a568f45ec626ec6a0065527aa79 | [
"BSD-3-Clause"
] | null | null | null | cages/.shared/config_interface_http_1.py | targeted/pythomnic3k | c59f8c11302c0a568f45ec626ec6a0065527aa79 | [
"BSD-3-Clause"
] | 7 | 2019-06-06T15:47:56.000Z | 2019-06-15T18:09:30.000Z | cages/.shared/config_interface_http_1.py | targeted/pythomnic3k | c59f8c11302c0a568f45ec626ec6a0065527aa79 | [
"BSD-3-Clause"
] | null | null | null | # configuration file for interface "http_1"
# this file exists as a reference for configuring HTTP interfaces
#
# copy this file to your own cage, possibly renaming into
# config_interface_YOUR_INTERFACE_NAME.py, then modify the copy
config = dict \
(
protocol = "http", # meta
listener_address =... | 38.484848 | 106 | 0.603937 |
config = dict \
(
protocol = "http",
listener_address = ("0.0.0.0", 80),
max_connections = 100,
ssl_key_cert_file = None,
ssl_ca_cert_file = None,
ssl_ciphers = None,
ssl_protocol = None, ... | true | true |
f73ac2d1a91f5a501e93c6d1a2da04f2a930a4fe | 91,108 | py | Python | ProgettoLube/WebInspector/venv/Lib/site-packages/tensorflow_estimator/python/estimator/canned/v1/linear_testing_utils_v1.py | Lube-Project/ProgettoLube | cbf33971e2c2e865783ec1a2302625539186a338 | [
"MIT"
] | 288 | 2018-10-10T14:35:11.000Z | 2022-03-26T14:49:13.000Z | ProgettoLube/WebInspector/venv/Lib/site-packages/tensorflow_estimator/python/estimator/canned/v1/linear_testing_utils_v1.py | Lube-Project/ProgettoLube | cbf33971e2c2e865783ec1a2302625539186a338 | [
"MIT"
] | 49 | 2018-10-19T08:49:10.000Z | 2021-11-23T02:52:04.000Z | ProgettoLube/WebInspector/venv/Lib/site-packages/tensorflow_estimator/python/estimator/canned/v1/linear_testing_utils_v1.py | Lube-Project/ProgettoLube | cbf33971e2c2e865783ec1a2302625539186a338 | [
"MIT"
] | 228 | 2018-10-10T14:41:08.000Z | 2022-03-28T10:54:05.000Z | # Copyright 2017 The TensorFlow Authors. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applica... | 37.78847 | 145 | 0.663015 |
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
import math
import os
import shutil
import tempfile
import numpy as np
import six
import tensorflow as tf
from tensorflow.core.example import example_pb2
from tensorflow.core.example import feat... | true | true |
f73ac2f2d17a0c152f0b6bf64849e9993517977a | 5,334 | py | Python | hailo_model_zoo/utils/data.py | nadaved1/hailo_model_zoo | 42b716f337dde4ec602022a34d6a07a1bbd45539 | [
"MIT"
] | 29 | 2021-07-19T13:53:18.000Z | 2022-01-26T11:20:55.000Z | hailo_model_zoo/utils/data.py | nadaved1/hailo_model_zoo | 42b716f337dde4ec602022a34d6a07a1bbd45539 | [
"MIT"
] | 1 | 2022-03-18T03:27:24.000Z | 2022-03-20T14:58:41.000Z | hailo_model_zoo/utils/data.py | nadaved1/hailo_model_zoo | 42b716f337dde4ec602022a34d6a07a1bbd45539 | [
"MIT"
] | 10 | 2021-07-20T03:19:55.000Z | 2022-02-25T13:57:30.000Z | from builtins import object
import os
import cv2
import numpy as np
import tensorflow as tf
from hailo_model_zoo.core.datasets import dataset_factory
from hailo_model_zoo.utils.video_utils import VideoCapture
def _open_image_file(img_path):
image = tf.io.read_file(img_path)
image = tf.cast(tf.image.decode_jp... | 38.934307 | 107 | 0.663105 | from builtins import object
import os
import cv2
import numpy as np
import tensorflow as tf
from hailo_model_zoo.core.datasets import dataset_factory
from hailo_model_zoo.utils.video_utils import VideoCapture
def _open_image_file(img_path):
image = tf.io.read_file(img_path)
image = tf.cast(tf.image.decode_jp... | true | true |
f73ac3dc6d5826cb29c53182ff910a6bdfb6c007 | 739 | py | Python | profiles_api/permissions.py | ndenisj/profiles-rest-api | a0c0b6d99b6dfee3121ce734615803e3ca8ca407 | [
"MIT"
] | 5 | 2019-09-26T15:51:22.000Z | 2019-09-26T15:51:41.000Z | profiles_api/permissions.py | ndenisj/profiles-rest-api | a0c0b6d99b6dfee3121ce734615803e3ca8ca407 | [
"MIT"
] | 5 | 2020-06-05T23:23:14.000Z | 2022-02-10T10:26:28.000Z | profiles_api/permissions.py | ndenisj/profiles-rest-api | a0c0b6d99b6dfee3121ce734615803e3ca8ca407 | [
"MIT"
] | null | null | null | from rest_framework import permissions
class UpdateOwnProfile(permissions.BasePermission):
"""Allow user to edit their own profile"""
def has_object_permission(self, request, view, obj):
"""Check user is trying to edit their own profile"""
if request.method in permissions.SAFE_METHODS:
... | 32.130435 | 65 | 0.692828 | from rest_framework import permissions
class UpdateOwnProfile(permissions.BasePermission):
def has_object_permission(self, request, view, obj):
if request.method in permissions.SAFE_METHODS:
return True
return obj.id == request.user.id
class UpdateOwnStatus(permissions.BasePermissi... | true | true |
f73ac4a510a486bbbf47eb04d9e45ed6f38c5453 | 6,599 | py | Python | tictactoe.py | erincase/tictactoe | b97790f58bbf8299e5c1241b7e9d3594ea3df893 | [
"MIT"
] | null | null | null | tictactoe.py | erincase/tictactoe | b97790f58bbf8299e5c1241b7e9d3594ea3df893 | [
"MIT"
] | null | null | null | tictactoe.py | erincase/tictactoe | b97790f58bbf8299e5c1241b7e9d3594ea3df893 | [
"MIT"
] | null | null | null | from copy import deepcopy
from typing import NamedTuple, Optional
import constants as c
def main():
"""
Runs a game of tic-tac-toe. Asks players "X" and "O" to alternate choosing squares of the
tic-tac-toe board to fill in. After each turn, will check the board to see if there is a winner.
If all squ... | 37.282486 | 100 | 0.661161 | from copy import deepcopy
from typing import NamedTuple, Optional
import constants as c
def main():
board_values = deepcopy(c.INITIAL_BOARD_VALUES)
print_welcome_message(board_values)
winner = None
current_player = None
while winner is None:
current_player = get_next_playe... | true | true |
f73ac57e7c2f37ec5c214035937c6687cfbde0e4 | 8,810 | py | Python | patrace/python/patracetools/patracetools/remap_egl.py | ylz-at/patrace | b42ba9189616dc6c1599e40a702a90bb974e23f7 | [
"MIT"
] | 1 | 2019-10-13T16:57:52.000Z | 2019-10-13T16:57:52.000Z | patrace/python/patracetools/patracetools/remap_egl.py | xiangruipuzhao/patrace | db444184177277b23e1de93fd320493628aae850 | [
"MIT"
] | null | null | null | patrace/python/patracetools/patracetools/remap_egl.py | xiangruipuzhao/patrace | db444184177277b23e1de93fd320493628aae850 | [
"MIT"
] | 1 | 2021-04-15T17:34:35.000Z | 2021-04-15T17:34:35.000Z | #!/usr/bin/env python2
import argparse
import json
import os
from patrace import (
InputFile,
OutputFile,
Call,
CreateInt32Value,
)
class Arg:
def __init__(self, type, name, value):
self.type = type
self.name = name
self.value = value
def get(self):
arg = self.... | 33.884615 | 185 | 0.53916 |
import argparse
import json
import os
from patrace import (
InputFile,
OutputFile,
Call,
CreateInt32Value,
)
class Arg:
def __init__(self, type, name, value):
self.type = type
self.name = name
self.value = value
def get(self):
arg = self.type(self.value)
... | false | true |
f73ac593c4c8b4927ec63131454d97584ada7dc4 | 250 | py | Python | python--exercicios/ex034.py | Eliezer2000/python | 12abb54c6536acb2f36b8f34bf51ec765857eb75 | [
"MIT"
] | null | null | null | python--exercicios/ex034.py | Eliezer2000/python | 12abb54c6536acb2f36b8f34bf51ec765857eb75 | [
"MIT"
] | null | null | null | python--exercicios/ex034.py | Eliezer2000/python | 12abb54c6536acb2f36b8f34bf51ec765857eb75 | [
"MIT"
] | null | null | null | salário = float(input('Digite o valor do seu salário: R$'))
if salário <= 1250:
novo = salário + (salário * 15 / 100)
else:
novo = salário + (salário * 10 / 100)
print('Quem ganhava R$ {:.2f} passou a ganhar R$ {:.2f}'.format(salário, novo))
| 35.714286 | 79 | 0.628 | salário = float(input('Digite o valor do seu salário: R$'))
if salário <= 1250:
novo = salário + (salário * 15 / 100)
else:
novo = salário + (salário * 10 / 100)
print('Quem ganhava R$ {:.2f} passou a ganhar R$ {:.2f}'.format(salário, novo))
| true | true |
f73ac64c9ba336d2b40baf7c8d91aeeb100b3ed3 | 4,531 | py | Python | AxxellClient/models/data_point.py | cinaq/axxell-client-python | a862dd36552ef8149517c5d5034a52a37abc2d33 | [
"Apache-2.0"
] | null | null | null | AxxellClient/models/data_point.py | cinaq/axxell-client-python | a862dd36552ef8149517c5d5034a52a37abc2d33 | [
"Apache-2.0"
] | null | null | null | AxxellClient/models/data_point.py | cinaq/axxell-client-python | a862dd36552ef8149517c5d5034a52a37abc2d33 | [
"Apache-2.0"
] | null | null | null | # coding: utf-8
"""
axxell-api
No description provided (generated by Swagger Codegen https://github.com/swagger-api/swagger-codegen)
OpenAPI spec version: 1.0.0
Generated by: https://github.com/swagger-api/swagger-codegen.git
Licensed under the Apache License, Version 2.0 (the "License");
... | 25.312849 | 105 | 0.557051 |
from pprint import pformat
from six import iteritems
import re
class DataPoint(object):
def __init__(self, creation_time=None, label=None, value=None):
self.swagger_types = {
'creation_time': 'str',
'label': 'str',
'value': 'float'
}
self.attribute_m... | true | true |
f73ac79184edf7e3eabd0dc8ef2b2b487ecbbd5f | 56,828 | py | Python | Lib/tkinter/test/test_ttk/test_widgets.py | adamwen829/cpython | 0f1c7c760c6b2804f5d05cae9ca045d1fdf3d667 | [
"PSF-2.0"
] | 2 | 2017-05-05T02:07:59.000Z | 2017-08-18T09:24:48.000Z | Lib/tkinter/test/test_ttk/test_widgets.py | adamwen829/cpython | 0f1c7c760c6b2804f5d05cae9ca045d1fdf3d667 | [
"PSF-2.0"
] | null | null | null | Lib/tkinter/test/test_ttk/test_widgets.py | adamwen829/cpython | 0f1c7c760c6b2804f5d05cae9ca045d1fdf3d667 | [
"PSF-2.0"
] | 3 | 2016-04-21T07:58:27.000Z | 2016-05-06T21:34:44.000Z | import unittest
import tkinter
from tkinter import ttk
from test.support import requires
import sys
from tkinter.test.test_ttk.test_functions import MockTclObj
from tkinter.test.support import (AbstractTkTest, tcl_version, get_tk_patchlevel,
simulate_mouse_click)
from tkinter.test.wid... | 35.539712 | 87 | 0.595305 | import unittest
import tkinter
from tkinter import ttk
from test.support import requires
import sys
from tkinter.test.test_ttk.test_functions import MockTclObj
from tkinter.test.support import (AbstractTkTest, tcl_version, get_tk_patchlevel,
simulate_mouse_click)
from tkinter.test.wid... | true | true |
f73ac8609b8137487212517fbab17c08f75429cc | 3,366 | py | Python | logpuzzle/logpuzzle_try2.py | mkoundo/google_python_class | 45aa226586970b0077dde52a7b5a3c84dee2be15 | [
"Apache-2.0"
] | null | null | null | logpuzzle/logpuzzle_try2.py | mkoundo/google_python_class | 45aa226586970b0077dde52a7b5a3c84dee2be15 | [
"Apache-2.0"
] | null | null | null | logpuzzle/logpuzzle_try2.py | mkoundo/google_python_class | 45aa226586970b0077dde52a7b5a3c84dee2be15 | [
"Apache-2.0"
] | null | null | null | #!/usr/bin/python
# Copyright 2010 Google Inc.
# Licensed under the Apache License, Version 2.0
# http://www.apache.org/licenses/LICENSE-2.0
# Google's Python Class
# http://code.google.com/edu/languages/google-python-class/
import os
import re
import sys
import urllib
"""Logpuzzle exercise
Given an apache logfile, ... | 28.285714 | 192 | 0.681521 |
# http://code.google.com/edu/languages/google-python-class/
import os
import re
import sys
import urllib
"""Logpuzzle exercise
Given an apache logfile, find the puzzle urls and download the images.
Here's what a puzzle url looks like:
10.254.254.28 - - [06/Aug/2007:00:13:48 -0700] "GET /~foo/puzzle-bar-aaab.jp... | false | true |
f73ac8992dda1543526d61357ec581788457a368 | 1,499 | py | Python | blog/bills/forms.py | sivatoms/Blog_Posts | 28944c66efb7a296a662d3b81bdaf65b153c995c | [
"bzip2-1.0.6"
] | null | null | null | blog/bills/forms.py | sivatoms/Blog_Posts | 28944c66efb7a296a662d3b81bdaf65b153c995c | [
"bzip2-1.0.6"
] | 4 | 2020-04-09T18:28:58.000Z | 2021-06-10T18:51:22.000Z | blog/bills/forms.py | sivatoms/Blog_posts | 28944c66efb7a296a662d3b81bdaf65b153c995c | [
"bzip2-1.0.6"
] | null | null | null | from django import forms
from .models import Transactions, GroupMembers,Group
class Bill_CreateForm(forms.ModelForm):
def __init__(self, user_list, *args, **kwargs):
super(Bill_CreateForm, self).__init__(*args, **kwargs)
self.fields['share_with'] = forms.MultipleChoiceField(widget=form... | 32.586957 | 158 | 0.6004 | from django import forms
from .models import Transactions, GroupMembers,Group
class Bill_CreateForm(forms.ModelForm):
def __init__(self, user_list, *args, **kwargs):
super(Bill_CreateForm, self).__init__(*args, **kwargs)
self.fields['share_with'] = forms.MultipleChoiceField(widget=form... | true | true |
f73ac96f95aedad32c337d17a7c0091a32952e8f | 3,772 | py | Python | contrib/macdeploy/custom_dsstore.py | cobrabytes/cobrax | d57cbace735ce1f0ffae7e866428358dc475714d | [
"MIT"
] | 3 | 2019-04-02T14:58:30.000Z | 2020-04-03T14:29:55.000Z | contrib/macdeploy/custom_dsstore.py | cobrabytes/cobrax | d57cbace735ce1f0ffae7e866428358dc475714d | [
"MIT"
] | null | null | null | contrib/macdeploy/custom_dsstore.py | cobrabytes/cobrax | d57cbace735ce1f0ffae7e866428358dc475714d | [
"MIT"
] | 1 | 2020-04-06T05:09:56.000Z | 2020-04-06T05:09:56.000Z | #!/usr/bin/env python
# Copyright (c) 2013-2016 The Bitcoin Core developers
# Distributed under the MIT software license, see the accompanying
# file COPYING or http://www.opensource.org/licenses/mit-license.php.
from __future__ import division,print_function,unicode_literals
import biplist
from ds_store import DSStore... | 62.866667 | 1,817 | 0.727466 |
from __future__ import division,print_function,unicode_literals
import biplist
from ds_store import DSStore
from mac_alias import Alias
import sys
output_file = sys.argv[1]
package_name_ns = sys.argv[2]
ds = DSStore.open(output_file, 'w+')
ds['.']['bwsp'] = {
'ShowStatusBar': False,
'WindowBounds': b'{{30... | true | true |
f73ac9be001c59c31029b8768a02d9bf6ee25a79 | 350 | py | Python | package/ml/regression/logistic.py | xenron/coco | e318d534127b769612716c05d40e3d5b090eb5a3 | [
"MIT"
] | null | null | null | package/ml/regression/logistic.py | xenron/coco | e318d534127b769612716c05d40e3d5b090eb5a3 | [
"MIT"
] | null | null | null | package/ml/regression/logistic.py | xenron/coco | e318d534127b769612716c05d40e3d5b090eb5a3 | [
"MIT"
] | null | null | null | from sklearn import linear_model
from ml.regression.base import Regression
class LogisticRegression(Regression):
def __init__(self):
Regression.__init__(self)
self._name = "Logistic"
self._model = linear_model.LogisticRegression(C=1e5)
def predict_proba(self, data):
return se... | 25 | 60 | 0.722857 | from sklearn import linear_model
from ml.regression.base import Regression
class LogisticRegression(Regression):
def __init__(self):
Regression.__init__(self)
self._name = "Logistic"
self._model = linear_model.LogisticRegression(C=1e5)
def predict_proba(self, data):
return se... | true | true |
f73acca3571b8aea34d7e9fe1577667e41ffb1da | 1,036 | py | Python | geometric_primitives/rules/rules_mixed_22_12.py | POSTECH-CVLab/Geometric-Primitives | e4b16d8930f4a9d1c906d06255988d02f54a6deb | [
"MIT"
] | 1 | 2022-03-16T13:01:33.000Z | 2022-03-16T13:01:33.000Z | geometric_primitives/rules/rules_mixed_22_12.py | POSTECH-CVLab/Geometric-Primitives | e4b16d8930f4a9d1c906d06255988d02f54a6deb | [
"MIT"
] | null | null | null | geometric_primitives/rules/rules_mixed_22_12.py | POSTECH-CVLab/Geometric-Primitives | e4b16d8930f4a9d1c906d06255988d02f54a6deb | [
"MIT"
] | null | null | null | import numpy as np
PROBS_CONTACTS = np.array([4.0, 2.0, 4.0, 2.0])
PROBS_CONTACTS /= np.sum(PROBS_CONTACTS)
RULE_CONTACTS = [
# [0.5, 1.0] -> 4
{
'num_contacts': 1,
'translations': [[0.5, 1.0], [-0.5, 1.0], [0.5, -1.0], [-0.5, -1.0]],
'direction': 0
},
# [0.5, 0.0] -> 2
{
... | 23.022222 | 77 | 0.485521 | import numpy as np
PROBS_CONTACTS = np.array([4.0, 2.0, 4.0, 2.0])
PROBS_CONTACTS /= np.sum(PROBS_CONTACTS)
RULE_CONTACTS = [
{
'num_contacts': 1,
'translations': [[0.5, 1.0], [-0.5, 1.0], [0.5, -1.0], [-0.5, -1.0]],
'direction': 0
},
{
'num_contacts': 2,
... | true | true |
f73accc173ad73d9a58a5324465c80f5c599d226 | 650 | py | Python | src/lithopscloud/modules/gen2/ray/endpoint.py | Cohen-J-Omer/lithopscloud | bc897ae3952e0faca42581846a8b3169a0b5b49f | [
"Apache-2.0"
] | 2 | 2021-08-22T04:36:34.000Z | 2021-11-08T16:02:57.000Z | src/lithopscloud/modules/gen2/ray/endpoint.py | Cohen-J-Omer/lithopscloud | bc897ae3952e0faca42581846a8b3169a0b5b49f | [
"Apache-2.0"
] | null | null | null | src/lithopscloud/modules/gen2/ray/endpoint.py | Cohen-J-Omer/lithopscloud | bc897ae3952e0faca42581846a8b3169a0b5b49f | [
"Apache-2.0"
] | 1 | 2021-08-22T08:45:19.000Z | 2021-08-22T08:45:19.000Z | from lithopscloud.modules.gen2.endpoint import EndpointConfig
from typing import Any, Dict
from lithopscloud.modules.utils import get_region_by_endpoint
class RayEndpointConfig(EndpointConfig):
def __init__(self, base_config: Dict[str, Any]) -> None:
super().__init__(base_config)
base_endpoin... | 40.625 | 98 | 0.743077 | from lithopscloud.modules.gen2.endpoint import EndpointConfig
from typing import Any, Dict
from lithopscloud.modules.utils import get_region_by_endpoint
class RayEndpointConfig(EndpointConfig):
def __init__(self, base_config: Dict[str, Any]) -> None:
super().__init__(base_config)
base_endpoin... | true | true |
f73acd35f78e02cd3c56065883d4d1c64b0b4deb | 2,619 | py | Python | plugins/module_utils/storage.py | krestomatio/ansible-collection-k8s | 895f3d1358ca1cdcea2c559cb31f9ff20b868192 | [
"Apache-2.0"
] | 1 | 2021-07-02T18:52:44.000Z | 2021-07-02T18:52:44.000Z | plugins/module_utils/storage.py | krestomatio/ansible-collection-k8s | 895f3d1358ca1cdcea2c559cb31f9ff20b868192 | [
"Apache-2.0"
] | 89 | 2021-06-27T00:37:30.000Z | 2022-03-23T03:23:33.000Z | plugins/module_utils/storage.py | krestomatio/ansible-collection-k8s | 895f3d1358ca1cdcea2c559cb31f9ff20b868192 | [
"Apache-2.0"
] | null | null | null | from __future__ import absolute_import, division, print_function
__metaclass__ = type
import math
from ansible.module_utils.facts.hardware import linux
from ansible.module_utils.facts.utils import get_mount_size
def get_mount_info(module):
lh = linux.LinuxHardware(module)
bind_mounts = lh._find_bind_mounts()... | 30.103448 | 85 | 0.668194 | from __future__ import absolute_import, division, print_function
__metaclass__ = type
import math
from ansible.module_utils.facts.hardware import linux
from ansible.module_utils.facts.utils import get_mount_size
def get_mount_info(module):
lh = linux.LinuxHardware(module)
bind_mounts = lh._find_bind_mounts()... | true | true |
f73ace1ba171ba4daa91c9c9f9fc822852b22115 | 1,753 | py | Python | Medium/230.py | Hellofafar/Leetcode | 7a459e9742958e63be8886874904e5ab2489411a | [
"CNRI-Python"
] | 6 | 2017-09-25T18:05:50.000Z | 2019-03-27T00:23:15.000Z | Medium/230.py | Hellofafar/Leetcode | 7a459e9742958e63be8886874904e5ab2489411a | [
"CNRI-Python"
] | 1 | 2017-10-29T12:04:41.000Z | 2018-08-16T18:00:37.000Z | Medium/230.py | Hellofafar/Leetcode | 7a459e9742958e63be8886874904e5ab2489411a | [
"CNRI-Python"
] | null | null | null | # ------------------------------
# 230. Kth Smallest Element in a BST
#
# Description:
# Given a binary search tree, write a function kthSmallest to find the kth smallest element in it.
# Note:
# You may assume k is always valid, 1 ≤ k ≤ BST's total elements.
#
# Example 1:
# Input: root = [3,1,4,null,2], k = 1
# ... | 25.042857 | 169 | 0.563035 |
#
# Example 1:
# Input: root = [3,1,4,null,2], k = 1
# 3
# / \
# 1 4
# \
# 2
# Output: 1
#
# Example 2:
# Input: root = [5,3,6,2,4,null,null,1], k = 3
# 5
# / \
# 3 6
# / \
# 2 4
# /
# 1
# Output: 3
#
# Follow up:
# What if the BST is modified (insert/delete operat... | true | true |
f73ace623db2f5593d9d8d6027b84f567eab2154 | 364 | py | Python | a-aulas/exe-004 comandos primitivos.py | solito83/aprendendo-programar-em-python | af5bce7efa2ffa4d081c015830e3710044899924 | [
"MIT"
] | null | null | null | a-aulas/exe-004 comandos primitivos.py | solito83/aprendendo-programar-em-python | af5bce7efa2ffa4d081c015830e3710044899924 | [
"MIT"
] | null | null | null | a-aulas/exe-004 comandos primitivos.py | solito83/aprendendo-programar-em-python | af5bce7efa2ffa4d081c015830e3710044899924 | [
"MIT"
] | null | null | null | print('exe-004 comandos primitivos')
print('Tipos primitivos de comandos -int = inteiro- floot')
num1=int(input('Digite um número '))
num2=int(input('Digite outro número '))
soma=num1+num2
fim = 'The End'
#print('A soma de',num1, 'e',num2, 'é',soma)
print('A soma entre {} e {} vale {}'.format(num1, num2, soma))
prin... | 24.266667 | 62 | 0.678571 | print('exe-004 comandos primitivos')
print('Tipos primitivos de comandos -int = inteiro- floot')
num1=int(input('Digite um número '))
num2=int(input('Digite outro número '))
soma=num1+num2
fim = 'The End'
print('A soma entre {} e {} vale {}'.format(num1, num2, soma))
print('Classe de num1',type(num1))
print (fim)
| true | true |
f73acf03fc294d4ef378ddb86acfe81f9b48c3d1 | 2,115 | py | Python | backend/server/apps/endpoints/views.py | muhammedfasal/my_ml_service | 64a6a77f8a8c66fc2cef433927e953e28f09301f | [
"MIT"
] | null | null | null | backend/server/apps/endpoints/views.py | muhammedfasal/my_ml_service | 64a6a77f8a8c66fc2cef433927e953e28f09301f | [
"MIT"
] | null | null | null | backend/server/apps/endpoints/views.py | muhammedfasal/my_ml_service | 64a6a77f8a8c66fc2cef433927e953e28f09301f | [
"MIT"
] | null | null | null | from rest_framework import viewsets
from rest_framework import mixins
from apps.endpoints.models import Endpoint
from apps.endpoints.serializers import EndpointSerializer
from apps.endpoints.models import MLAlgorithm
from apps.endpoints.serializers import MLAlgorithmSerializer
from apps.endpoints.models import MLAlg... | 33.046875 | 99 | 0.740898 | from rest_framework import viewsets
from rest_framework import mixins
from apps.endpoints.models import Endpoint
from apps.endpoints.serializers import EndpointSerializer
from apps.endpoints.models import MLAlgorithm
from apps.endpoints.serializers import MLAlgorithmSerializer
from apps.endpoints.models import MLAlg... | true | true |
f73acff10ef7c7399aa9b1fef305aa3e19118980 | 2,113 | py | Python | pyiArduinoI2Crelay/examples/detectionModule.py | tremaru/Py_iarduino_I2C_Relay | a2caefb84dc52f97c72b7c71dd7abf8e2f63c800 | [
"MIT"
] | null | null | null | pyiArduinoI2Crelay/examples/detectionModule.py | tremaru/Py_iarduino_I2C_Relay | a2caefb84dc52f97c72b7c71dd7abf8e2f63c800 | [
"MIT"
] | null | null | null | pyiArduinoI2Crelay/examples/detectionModule.py | tremaru/Py_iarduino_I2C_Relay | a2caefb84dc52f97c72b7c71dd7abf8e2f63c800 | [
"MIT"
] | 1 | 2021-11-09T13:16:14.000Z | 2021-11-09T13:16:14.000Z | #encoding=utf-8
#Данный пример определяет тип модуля реле или силового ключа подключённого к шине I2C.
from pyiArduinoI2Crelay import * # Подключаем библиотеку для работы с реле
pwrfet = pyiArduinoI2Crelay() # Объявляем объект pwrfet
... | 62.147059 | 219 | 0.549929 |
from pyiArduinoI2Crelay import *
pwrfet = pyiArduinoI2Crelay()
print("На шине I2C", end=' ')
if pwrfet.begin(): ... | true | true |
f73ad088db78196f2b4ffe622164e8a5f8894d3e | 1,351 | py | Python | Lista2_24.py | NormanDeveloper/Lista2_Python | 232c80b59c98023ee8a7844e2097cb102ed61261 | [
"MIT"
] | 1 | 2018-08-24T15:52:13.000Z | 2018-08-24T15:52:13.000Z | Lista2_24.py | NormanDeveloper/Lista2_Python | 232c80b59c98023ee8a7844e2097cb102ed61261 | [
"MIT"
] | null | null | null | Lista2_24.py | NormanDeveloper/Lista2_Python | 232c80b59c98023ee8a7844e2097cb102ed61261 | [
"MIT"
] | 1 | 2018-09-11T17:37:54.000Z | 2018-09-11T17:37:54.000Z | '''
Faça um Programa que leia 2 números e em seguida pergunte ao usuário qual operação ele deseja realizar. O resultado da operação deve ser acompanhado de uma frase que diga se o número é:
par ou ímpar;
positivo ou negativo;
inteiro ou decimal.
'''
numero1 = float(input("Digite o número 1: "))
numero2 = float... | 29.369565 | 186 | 0.606958 |
numero1 = float(input("Digite o número 1: "))
numero2 = float(input("Digite o número 2: "))
operacao = input("Digite a operação que deseja realizar: [+, -, /, *]: ")
def checar():
if (resultado_operacao // 1 == resultado_operacao):
print("Inteiro")
if resultado_operacao % 2 == 0:
... | true | true |
f73ad0b4850aad3ec1aa2eec3a277fc53686f12e | 3,758 | py | Python | examples/modify_convnet.py | leimao/ONNX-Python-Examples | a70108116a5856b920b641002b32776edd0e91c6 | [
"MIT"
] | 6 | 2021-07-22T18:46:20.000Z | 2022-01-19T16:07:16.000Z | examples/modify_convnet.py | leimao/ONNX-Python-Examples | a70108116a5856b920b641002b32776edd0e91c6 | [
"MIT"
] | null | null | null | examples/modify_convnet.py | leimao/ONNX-Python-Examples | a70108116a5856b920b641002b32776edd0e91c6 | [
"MIT"
] | 1 | 2021-11-03T08:09:03.000Z | 2021-11-03T08:09:03.000Z | import onnx
from typing import Iterable
def print_tensor_data(initializer: onnx.TensorProto) -> None:
if initializer.data_type == onnx.TensorProto.DataType.FLOAT:
print(initializer.float_data)
elif initializer.data_type == onnx.TensorProto.DataType.INT32:
print(initializer.int32_data)
eli... | 32.964912 | 138 | 0.640766 | import onnx
from typing import Iterable
def print_tensor_data(initializer: onnx.TensorProto) -> None:
if initializer.data_type == onnx.TensorProto.DataType.FLOAT:
print(initializer.float_data)
elif initializer.data_type == onnx.TensorProto.DataType.INT32:
print(initializer.int32_data)
eli... | true | true |
f73ad0bd123a4882951231708e68f80c96935bd9 | 3,387 | py | Python | main.py | meshy/wolves | 2ba863e3fbcf4693aceb796a03ad06325895039c | [
"MIT"
] | null | null | null | main.py | meshy/wolves | 2ba863e3fbcf4693aceb796a03ad06325895039c | [
"MIT"
] | null | null | null | main.py | meshy/wolves | 2ba863e3fbcf4693aceb796a03ad06325895039c | [
"MIT"
] | null | null | null | import random
import time
from functools import partial
from itertools import product
from blessings import Terminal
term = Terminal()
WINDOW_WIDTH = term.width // 2
WINDOW_HEIGHT = term.height - 1
WOLF = 'W'
RABBIT = 'R'
EMPTY = ' '
RABBIT_SURVIVAL = 60
WOLF_SURVIVAL = 80
WOLF_BREED = 80
def random_animal():
... | 25.276119 | 83 | 0.641571 | import random
import time
from functools import partial
from itertools import product
from blessings import Terminal
term = Terminal()
WINDOW_WIDTH = term.width // 2
WINDOW_HEIGHT = term.height - 1
WOLF = 'W'
RABBIT = 'R'
EMPTY = ' '
RABBIT_SURVIVAL = 60
WOLF_SURVIVAL = 80
WOLF_BREED = 80
def random_animal():
... | true | true |
f73ad104d4d077b3f743260bae881c70d73ca3d9 | 474 | py | Python | examples/rename_all.py | tardyp/pyserde | 2bef77d9888ffcc650f031f0e883cb2ff08cbf60 | [
"MIT"
] | null | null | null | examples/rename_all.py | tardyp/pyserde | 2bef77d9888ffcc650f031f0e883cb2ff08cbf60 | [
"MIT"
] | null | null | null | examples/rename_all.py | tardyp/pyserde | 2bef77d9888ffcc650f031f0e883cb2ff08cbf60 | [
"MIT"
] | null | null | null | """
rename_all.py
Usage:
$ poetry install
$ poetry run python rename_all.py
"""
from typing import Optional
from serde import serde
from serde.json import from_json, to_json
@serde(rename_all='pascalcase')
class Foo:
name: str
no: Optional[int] = None
def main():
f = Foo('Pikachu')
print(... | 15.290323 | 44 | 0.628692 | from typing import Optional
from serde import serde
from serde.json import from_json, to_json
@serde(rename_all='pascalcase')
class Foo:
name: str
no: Optional[int] = None
def main():
f = Foo('Pikachu')
print(f"Into Json: {to_json(f)}")
s = '{"Name": "Pikachu", "No": 25}'
print(f"From Json... | true | true |
f73ad178b57b6abb868e94e2878b8fe9ffc502b7 | 332 | py | Python | examples/redirect_example.py | Varriount/sanic | 55c36e0240dfeb03deccdeb5a53ca7fcfa728bff | [
"MIT"
] | 4,959 | 2018-09-13T08:42:51.000Z | 2021-01-05T07:01:44.000Z | examples/redirect_example.py | Varriount/sanic | 55c36e0240dfeb03deccdeb5a53ca7fcfa728bff | [
"MIT"
] | 864 | 2018-09-13T20:48:04.000Z | 2021-01-05T07:33:30.000Z | examples/redirect_example.py | Varriount/sanic | 55c36e0240dfeb03deccdeb5a53ca7fcfa728bff | [
"MIT"
] | 612 | 2018-09-13T21:10:04.000Z | 2020-12-30T12:16:36.000Z | from sanic import Sanic
from sanic import response
app = Sanic(__name__)
@app.route('/')
def handle_request(request):
return response.redirect('/redirect')
@app.route('/redirect')
async def test(request):
return response.json({"Redirected": True})
if __name__ == '__main__':
app.run(host="0.0.0.0"... | 18.444444 | 46 | 0.686747 | from sanic import Sanic
from sanic import response
app = Sanic(__name__)
@app.route('/')
def handle_request(request):
return response.redirect('/redirect')
@app.route('/redirect')
async def test(request):
return response.json({"Redirected": True})
if __name__ == '__main__':
app.run(host="0.0.0.0"... | true | true |
f73ad1edeeb3bfe7e4f5b2dbc7711529091366e9 | 21,563 | py | Python | tests/test_graphqlview.py | mazvv/aiohttp-graphql | 21a10f20524ab365669b9495fc5952c184b1004b | [
"MIT"
] | null | null | null | tests/test_graphqlview.py | mazvv/aiohttp-graphql | 21a10f20524ab365669b9495fc5952c184b1004b | [
"MIT"
] | null | null | null | tests/test_graphqlview.py | mazvv/aiohttp-graphql | 21a10f20524ab365669b9495fc5952c184b1004b | [
"MIT"
] | null | null | null | import json
from urllib.parse import urlencode
import pytest
from aiohttp import FormData
from graphql.execution.executors.asyncio import AsyncioExecutor
from graphql.execution.executors.sync import SyncExecutor
from aiohttp_graphql import GraphQLView
from .schema import Schema, AsyncSchema
# pylint: disable=inva... | 30.285112 | 111 | 0.593702 | import json
from urllib.parse import urlencode
import pytest
from aiohttp import FormData
from graphql.execution.executors.asyncio import AsyncioExecutor
from graphql.execution.executors.sync import SyncExecutor
from aiohttp_graphql import GraphQLView
from .schema import Schema, AsyncSchema
@pytest.fixture
de... | true | true |
f73ad21d6443342dd519e264d972ec7dd8c1fc31 | 695 | py | Python | setup.py | qiuqiangkong/autoth | 42a8017b71a98441c557ed9768e427c5f627249f | [
"MIT"
] | 7 | 2020-03-06T10:25:59.000Z | 2022-01-26T11:24:42.000Z | setup.py | qiuqiangkong/autoth | 42a8017b71a98441c557ed9768e427c5f627249f | [
"MIT"
] | null | null | null | setup.py | qiuqiangkong/autoth | 42a8017b71a98441c557ed9768e427c5f627249f | [
"MIT"
] | null | null | null | import setuptools
with open("README.md", "r") as fh:
long_description = fh.read()
setuptools.setup(
name="autoth-qiuqiangkong", # Replace with your own username
version="0.0.3",
author="Qiuqiang Kong",
author_email="qiuqiangkong@gmail.com",
description="Automatic threshold optimization",
l... | 30.217391 | 64 | 0.679137 | import setuptools
with open("README.md", "r") as fh:
long_description = fh.read()
setuptools.setup(
name="autoth-qiuqiangkong",
version="0.0.3",
author="Qiuqiang Kong",
author_email="qiuqiangkong@gmail.com",
description="Automatic threshold optimization",
long_description=long_description... | true | true |
f73ad2395f0b8f744c03fc1b619590f37365d42c | 5,565 | py | Python | src/lecture9/solver.py | wakky927/Computational-Engineering-B | 3720d96668a32dc73f38ed0bc8afe4705452de9e | [
"MIT"
] | 1 | 2021-05-03T09:11:35.000Z | 2021-05-03T09:11:35.000Z | src/lecture9/solver.py | wakky927/Computational-Engineering-B | 3720d96668a32dc73f38ed0bc8afe4705452de9e | [
"MIT"
] | null | null | null | src/lecture9/solver.py | wakky927/Computational-Engineering-B | 3720d96668a32dc73f38ed0bc8afe4705452de9e | [
"MIT"
] | null | null | null | import numpy as np
import condition
def solve_matrix(p, Ap, Ae, Aw, An, As, bb, m, n):
md = 101
nd = 101
p_old = np.zeros((md, nd))
''' SOR algorithm '''
iter_max = 300 # SOR max iteration steps
relax_factor = 1.8 # SOR relaxation factor
for iter_i in range(1, iter_max):
erro... | 36.136364 | 79 | 0.369093 | import numpy as np
import condition
def solve_matrix(p, Ap, Ae, Aw, An, As, bb, m, n):
md = 101
nd = 101
p_old = np.zeros((md, nd))
iter_max = 300
relax_factor = 1.8
for iter_i in range(1, iter_max):
error = 0.0
for i in range(1, m + 1):
for j in range(1, n... | true | true |
f73ad329bb4172d093abf1fe9ec9be88b5e09fbb | 12,651 | py | Python | python/protectWindowsV2/protectWindowsV2.py | ped998/scripts | 0dcaaf47f9676210e1c972a5d59d8d0de82a1d93 | [
"Apache-2.0"
] | null | null | null | python/protectWindowsV2/protectWindowsV2.py | ped998/scripts | 0dcaaf47f9676210e1c972a5d59d8d0de82a1d93 | [
"Apache-2.0"
] | null | null | null | python/protectWindowsV2/protectWindowsV2.py | ped998/scripts | 0dcaaf47f9676210e1c972a5d59d8d0de82a1d93 | [
"Apache-2.0"
] | null | null | null | #!/usr/bin/env python
"""Add Physical Linux Servers to File-based Protection Job Using Python"""
### usage: ./protectLinux.py -v mycluster \
# -u myuser \
# -d mydomain.net \
# -j 'My Backup Job' \
# -s myserver... | 41.343137 | 192 | 0.550866 |
r, required=True)
parser.add_argument('-d', '--domain', type=str, default='local')
parser.add_argument('-k', '--useApiKey', action='store_true')
parser.add_argument('-pwd', '--password', type=str, default=None)
parser.add_argument('-s', '--servername', action='append', type=str)
parser.add_argument('-l', '--serverlis... | true | true |
f73ad353955ca9131653cb4bc8f38ffb029b4f76 | 509 | py | Python | Back-End/Python/Basics/Part -1 - Functional/03 - Function Parameters/05list_recursive.py | ASHISHKUMAR2411/Programming-CookBook | 9c60655d64d21985ccb4196360858d98344701f9 | [
"MIT"
] | 25 | 2021-04-28T02:51:26.000Z | 2022-03-24T13:58:04.000Z | Back-End/Python/Basics/Part -1 - Functional/03 - Function Parameters/05list_recursive.py | ASHISHKUMAR2411/Programming-CookBook | 9c60655d64d21985ccb4196360858d98344701f9 | [
"MIT"
] | 1 | 2022-03-03T23:33:41.000Z | 2022-03-03T23:35:41.000Z | Back-End/Python/Basics/Part -1 - Functional/03 - Function Parameters/05list_recursive.py | ASHISHKUMAR2411/Programming-CookBook | 9c60655d64d21985ccb4196360858d98344701f9 | [
"MIT"
] | 15 | 2021-05-30T01:35:20.000Z | 2022-03-25T12:38:25.000Z | def list_sum_recursive(input_list):
# Base Case
if not input_list:
return 0
# Recursive case
# Decompose the original problem into simpler instances of the same problem
# by making use of the fact that the input is a recursive data structure
# and can be defined in terms of a smaller ver... | 29.941176 | 79 | 0.685658 | def list_sum_recursive(input_list):
if not input_list:
return 0
else:
head = input_list[0]
smaller_list = input_list[1:]
return head + list_sum_recursive(smaller_list)
print(list_sum_recursive([1, 2, 3]))
| true | true |
f73ad36434fd68c44e28df3b136a2eabbbf6104d | 27,929 | py | Python | saas/api/metrics.py | naqibhakimi/djaodjin-saas | c5b9337b21782f62ef1a5e1bbe9c6421a2dcd2df | [
"BSD-2-Clause"
] | null | null | null | saas/api/metrics.py | naqibhakimi/djaodjin-saas | c5b9337b21782f62ef1a5e1bbe9c6421a2dcd2df | [
"BSD-2-Clause"
] | null | null | null | saas/api/metrics.py | naqibhakimi/djaodjin-saas | c5b9337b21782f62ef1a5e1bbe9c6421a2dcd2df | [
"BSD-2-Clause"
] | null | null | null | # Copyright (c) 2021, DjaoDjin inc.
# All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions are met:
#
# 1. Redistributions of source code must retain the above copyright notice,
# this list of conditions and t... | 37.041114 | 87 | 0.45766 |
import logging
from django.utils.translation import ugettext_lazy as _
from rest_framework.generics import GenericAPIView, ListAPIView
from rest_framework.response import Response
from .serializers import CartItemSerializer, LifetimeSerializer, MetricsSerializer
from .. import settings
from ..... | true | true |
f73ad38bc8446f1b20b10c876e10ac9ac4a364a9 | 2,700 | py | Python | old/PhasedHaplotypeParser.py | orionzhou/biolib | 940fb66f1b2608d34a2d00ebdf41dc84c6381f42 | [
"BSD-2-Clause"
] | 3 | 2019-02-22T20:35:23.000Z | 2021-11-25T10:01:50.000Z | old/PhasedHaplotypeParser.py | orionzhou/biolib | 940fb66f1b2608d34a2d00ebdf41dc84c6381f42 | [
"BSD-2-Clause"
] | null | null | null | old/PhasedHaplotypeParser.py | orionzhou/biolib | 940fb66f1b2608d34a2d00ebdf41dc84c6381f42 | [
"BSD-2-Clause"
] | 1 | 2021-02-19T03:10:14.000Z | 2021-02-19T03:10:14.000Z | '''
@author: Roman Briskine, University of Minnesota
'''
import os.path;
import re;
F_VARIANT = 1;
F_CLASS = 2;
F_POS = 3;
F_REF_ALLELE = 4;
F_VAR_ALLELE = 5;
F_EXON = 9;
F_ACC_OFFSET = 13;
class PhasedHaplotypeParser():
def __init__(self, accessionN = 3, accessionColN = 7, delim = '\t'):
self.accessionN = acces... | 31.395349 | 100 | 0.646296 |
import os.path;
import re;
F_VARIANT = 1;
F_CLASS = 2;
F_POS = 3;
F_REF_ALLELE = 4;
F_VAR_ALLELE = 5;
F_EXON = 9;
F_ACC_OFFSET = 13;
class PhasedHaplotypeParser():
def __init__(self, accessionN = 3, accessionColN = 7, delim = '\t'):
self.accessionN = accessionN;
self.accessionColN = accessionColN;
self.delim... | true | true |
f73ad42ed25fbd1c28e831c19a3c55a7c358296f | 487 | py | Python | fatf/metrics/fairness.py | mattclifford1/fat-forensics | bc838d0a9005935095e0a3d060404b917301f98e | [
"BSD-3-Clause"
] | null | null | null | fatf/metrics/fairness.py | mattclifford1/fat-forensics | bc838d0a9005935095e0a3d060404b917301f98e | [
"BSD-3-Clause"
] | null | null | null | fatf/metrics/fairness.py | mattclifford1/fat-forensics | bc838d0a9005935095e0a3d060404b917301f98e | [
"BSD-3-Clause"
] | null | null | null | """Fairness metrics.
This module gathers various metrics to assess fairness of a machine learning
pipeline.
TODO: Implement:
* duplicated rows with different protected attributes and classes,
* sample size disparity (for data and features),
* disparate impact, and
* disparate treatment.
"""
# Author:... | 25.631579 | 76 | 0.767967 |
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
| true | true |
f73ad4cf43fd3d5ae96459fb690bab7d3ac0b79f | 1,177 | py | Python | pyRMSD/benchmark/BenchmarkOpenMPScalability.py | LongxingCao/pyRMSD | 856b72a0dddd579430b2e87bdb026d71fbf9d250 | [
"MIT"
] | null | null | null | pyRMSD/benchmark/BenchmarkOpenMPScalability.py | LongxingCao/pyRMSD | 856b72a0dddd579430b2e87bdb026d71fbf9d250 | [
"MIT"
] | null | null | null | pyRMSD/benchmark/BenchmarkOpenMPScalability.py | LongxingCao/pyRMSD | 856b72a0dddd579430b2e87bdb026d71fbf9d250 | [
"MIT"
] | null | null | null | """
Created on 14/11/2012
@author: victor
"""
import pyRMSD.RMSDCalculator
import time
import numpy
import sys
#With OpenMP and amber_5k.pdb it took: 2.5554060936 [ 0.0 ]
if __name__ == '__main__':
coordsets = numpy.load("data/amber_30k.npy")
number_of_conformations = coordsets.shape[0]
number_of_atoms ... | 34.617647 | 97 | 0.604078 | """
Created on 14/11/2012
@author: victor
"""
import pyRMSD.RMSDCalculator
import time
import numpy
import sys
if __name__ == '__main__':
coordsets = numpy.load("data/amber_30k.npy")
number_of_conformations = coordsets.shape[0]
number_of_atoms = coordsets.shape[1]
print "Coordsets read"
sys.stdou... | false | true |
f73ad4dd5bb0da402a5bb5bd8ee893dd4dab918f | 2,765 | py | Python | app/core/tests/test_models.py | eitan-lukin/recipe-app-api | 13a2781c66bd329748786ba4cc7b380ed8a505c0 | [
"MIT"
] | null | null | null | app/core/tests/test_models.py | eitan-lukin/recipe-app-api | 13a2781c66bd329748786ba4cc7b380ed8a505c0 | [
"MIT"
] | null | null | null | app/core/tests/test_models.py | eitan-lukin/recipe-app-api | 13a2781c66bd329748786ba4cc7b380ed8a505c0 | [
"MIT"
] | null | null | null | from unittest.mock import patch
from django.test import TestCase
from django.contrib.auth import get_user_model
from core import models
def sample_user(email='test@stuffedpenguinstudio.com', password='testpass'):
"""Create sample user"""
return get_user_model().objects.create_user(email, password)
class Mo... | 32.151163 | 76 | 0.645931 | from unittest.mock import patch
from django.test import TestCase
from django.contrib.auth import get_user_model
from core import models
def sample_user(email='test@stuffedpenguinstudio.com', password='testpass'):
return get_user_model().objects.create_user(email, password)
class ModelTests(TestCase):
def ... | true | true |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.