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 |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
1c22a95c230cc0e1d78e38a0c432fc4b5a2993fd | 3,489 | py | Python | bin/vertretung.py | SteffenDE/monitornjus-classic | 62ae69169621036bea19d39cb44e6966a3fa7356 | [
"MIT"
] | null | null | null | bin/vertretung.py | SteffenDE/monitornjus-classic | 62ae69169621036bea19d39cb44e6966a3fa7356 | [
"MIT"
] | null | null | null | bin/vertretung.py | SteffenDE/monitornjus-classic | 62ae69169621036bea19d39cb44e6966a3fa7356 | [
"MIT"
] | null | null | null | #!/usr/bin/env python
# -*- coding: UTF-8 -*-
#
# Copyright (c) 2015 Steffen Deusch
# Licensed under the MIT license
# Beilage zu MonitorNjus, 14.09.2015 (Version 0.9.3)
import sys
reload(sys)
sys.setdefaultencoding('utf-8')
######### Settings #########
path = "sync/heute_und_morgen/"
name_heute = "subst_001.htm"
na... | 34.205882 | 171 | 0.63084 |
import sys
reload(sys)
sys.setdefaultencoding('utf-8')
'--><table class="mon_list" >')\
.replace('<p>\r\n<font size="3" face="Arial"', '<!--<font size="3" face="Arial"')\
.replace('<font size="3" face="Arial"','<!--<font size="3" face="Arial"')\
.replace("</body>","--></body>")\
.replace("iso-8859-1","... | false | true |
1c22aa2904b1eca7d1cce6daa36df3d2514f1b16 | 27,136 | py | Python | sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2018_07_01_preview/operations/_deny_assignments_operations.py | rsdoherty/azure-sdk-for-python | 6bba5326677468e6660845a703686327178bb7b1 | [
"MIT"
] | 2,728 | 2015-01-09T10:19:32.000Z | 2022-03-31T14:50:33.000Z | sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2018_07_01_preview/operations/_deny_assignments_operations.py | rsdoherty/azure-sdk-for-python | 6bba5326677468e6660845a703686327178bb7b1 | [
"MIT"
] | 17,773 | 2015-01-05T15:57:17.000Z | 2022-03-31T23:50:25.000Z | sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2018_07_01_preview/operations/_deny_assignments_operations.py | rsdoherty/azure-sdk-for-python | 6bba5326677468e6660845a703686327178bb7b1 | [
"MIT"
] | 1,916 | 2015-01-19T05:05:41.000Z | 2022-03-31T19:36:44.000Z | # coding=utf-8
# --------------------------------------------------------------------------
# Copyright (c) Microsoft Corporation. All rights reserved.
# Licensed under the MIT License. See License.txt in the project root for license information.
# Code generated by Microsoft (R) AutoRest Code Generator.
# Changes may ... | 52.184615 | 265 | 0.661372 |
from typing import TYPE_CHECKING
import warnings
from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error
from azure.core.paging import ItemPaged
from azure.core.pipeline import PipelineResponse
from azure.core.pipeline.transport impor... | true | true |
1c22aa3c67031745800fec79f57ef904110537e8 | 2,839 | py | Python | lectures/TrajectoryGenerator/helpers.py | zhouwubai/CarND-Term3 | 096f11903ba15fac2cf1dd26984d20a672c8360c | [
"MIT"
] | null | null | null | lectures/TrajectoryGenerator/helpers.py | zhouwubai/CarND-Term3 | 096f11903ba15fac2cf1dd26984d20a672c8360c | [
"MIT"
] | null | null | null | lectures/TrajectoryGenerator/helpers.py | zhouwubai/CarND-Term3 | 096f11903ba15fac2cf1dd26984d20a672c8360c | [
"MIT"
] | null | null | null | from math import sqrt, exp
from matplotlib import pyplot as plt
class Vehicle(object):
"""
Helper class. Non-ego vehicles move w/ constant acceleration
"""
def __init__(self, start):
self.start_state = start
def state_in(self, t):
s = self.start_state[:3]
d = self.start_st... | 24.264957 | 77 | 0.545967 | from math import sqrt, exp
from matplotlib import pyplot as plt
class Vehicle(object):
def __init__(self, start):
self.start_state = start
def state_in(self, t):
s = self.start_state[:3]
d = self.start_state[3:]
state = [
s[0] + (s[1] * t) + s[2] * t**2 / 2.0,
... | true | true |
1c22ab1ac9d72f5c2bcefed1fd77a5fb2c6d976e | 782 | py | Python | tests/test_ratelimit.py | prorevizor/noc | 37e44b8afc64318b10699c06a1138eee9e7d6a4e | [
"BSD-3-Clause"
] | 84 | 2017-10-22T11:01:39.000Z | 2022-02-27T03:43:48.000Z | tests/test_ratelimit.py | prorevizor/noc | 37e44b8afc64318b10699c06a1138eee9e7d6a4e | [
"BSD-3-Clause"
] | 22 | 2017-12-11T07:21:56.000Z | 2021-09-23T02:53:50.000Z | tests/test_ratelimit.py | prorevizor/noc | 37e44b8afc64318b10699c06a1138eee9e7d6a4e | [
"BSD-3-Clause"
] | 23 | 2017-12-06T06:59:52.000Z | 2022-02-24T00:02:25.000Z | # ----------------------------------------------------------------------
# noc.core.ratelimit test
# ----------------------------------------------------------------------
# Copyright (C) 2007-2020 The NOC Project
# See LICENSE for details
# ----------------------------------------------------------------------
# Pyth... | 27.928571 | 72 | 0.497442 |
from time import perf_counter_ns
from noc.core.ratelimit.sync import SyncRateLimit
RATE = 10
TRIES = 2 * RATE
NS = 1_000_000_000
def test_sync_rate_limit():
limit = SyncRateLimit(float(RATE))
t0 = perf_counter_ns()
for i in range(TRIES):
limit.wait()
delta = perf_counter_ns() - t0
... | true | true |
1c22ab2737aa174e2e508b2997b44f46c2404a46 | 1,280 | py | Python | chef/tools/make_password_hash.py | 1dustindavis/IT-CPE | bf7c097cb0c3749a533799e1ceeb60eebc658f10 | [
"BSD-3-Clause"
] | 1 | 2020-08-13T07:56:12.000Z | 2020-08-13T07:56:12.000Z | chef/tools/make_password_hash.py | 1dustindavis/IT-CPE | bf7c097cb0c3749a533799e1ceeb60eebc658f10 | [
"BSD-3-Clause"
] | null | null | null | chef/tools/make_password_hash.py | 1dustindavis/IT-CPE | bf7c097cb0c3749a533799e1ceeb60eebc658f10 | [
"BSD-3-Clause"
] | null | null | null | #!/usr/bin/env python
#
# Copyright (c) 2016-present, Facebook, Inc.
# All rights reserved.
#
# This source code is licensed under the BSD-style license found in the
# LICENSE file in the root directory of this source tree. An additional grant
# of patent rights can be found in the PATENTS file in the same directory.
#... | 29.090909 | 100 | 0.748438 |
import hashlib
import binascii
import os
import getpass
import random
import sys
password = getpass.getpass()
if not password:
print("You must provide a password to hash!")
sys.exit()
password_literal = b'{}'.format(password)
salt = os.urandom(32)
chef_salt = binascii.hexlify(salt)
base_iterati... | true | true |
1c22ab93bed6dd6b111ed93feaa6d499f4015f89 | 6,312 | py | Python | mojo/public/tools/bindings/pylib/parse/mojo_parser_unittest.py | Acidburn0zzz/chromium-1 | 4c08f442d2588a2c7cfaa117a55bd87d2ac32f9a | [
"BSD-3-Clause-No-Nuclear-License-2014",
"BSD-3-Clause"
] | null | null | null | mojo/public/tools/bindings/pylib/parse/mojo_parser_unittest.py | Acidburn0zzz/chromium-1 | 4c08f442d2588a2c7cfaa117a55bd87d2ac32f9a | [
"BSD-3-Clause-No-Nuclear-License-2014",
"BSD-3-Clause"
] | null | null | null | mojo/public/tools/bindings/pylib/parse/mojo_parser_unittest.py | Acidburn0zzz/chromium-1 | 4c08f442d2588a2c7cfaa117a55bd87d2ac32f9a | [
"BSD-3-Clause-No-Nuclear-License-2014",
"BSD-3-Clause"
] | null | null | null | # Copyright 2014 The Chromium Authors. All rights reserved.
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
import mojo_lexer
import mojo_parser
import unittest
class MojoParserTest(unittest.TestCase):
"""Tests mojo_parser (in particular, Parse())."""
def te... | 27.206897 | 78 | 0.586027 |
import mojo_lexer
import mojo_parser
import unittest
class MojoParserTest(unittest.TestCase):
def testTrivialValidSource(self):
source = """\
// This is a comment.
module my_module {
}
"""
self.assertEquals(mojo_parser.Parse(source, "my_file.mojom"),
[("MODULE", "my_module", None... | true | true |
1c22ac18bc547059e594ce8bf313720a79759695 | 219 | py | Python | frappe/desk/doctype/tag_link/test_tag_link.py | chentaoz/frappe | ee3c4943bf6177ad3b410cdb0d802af486751a65 | [
"MIT"
] | 3 | 2017-12-09T22:05:11.000Z | 2019-10-22T12:03:43.000Z | frappe/desk/doctype/tag_link/test_tag_link.py | chentaoz/frappe | ee3c4943bf6177ad3b410cdb0d802af486751a65 | [
"MIT"
] | 212 | 2017-08-16T13:03:18.000Z | 2020-10-06T12:26:21.000Z | frappe/desk/doctype/tag_link/test_tag_link.py | chentaoz/frappe | ee3c4943bf6177ad3b410cdb0d802af486751a65 | [
"MIT"
] | 14 | 2020-11-04T11:22:44.000Z | 2022-02-01T20:59:37.000Z | # -*- coding: utf-8 -*-
# Copyright (c) 2019, Frappe Technologies and Contributors
# See license.txt
from __future__ import unicode_literals
# import frappe
import unittest
class TestTagLink(unittest.TestCase):
pass
| 19.909091 | 58 | 0.767123 |
from __future__ import unicode_literals
import unittest
class TestTagLink(unittest.TestCase):
pass
| true | true |
1c22ac307d2a018185d08bc985bdcb9ed5aa276f | 673 | py | Python | tests/app/models.py | eon01/wagtail-metadata | 583968b67157ac7944631966919b523674568141 | [
"BSD-3-Clause"
] | null | null | null | tests/app/models.py | eon01/wagtail-metadata | 583968b67157ac7944631966919b523674568141 | [
"BSD-3-Clause"
] | null | null | null | tests/app/models.py | eon01/wagtail-metadata | 583968b67157ac7944631966919b523674568141 | [
"BSD-3-Clause"
] | null | null | null | from django.db import models
from wagtail.core.models import Page
from wagtailmetadata.models import MetadataMixin, MetadataPageMixin
class TestPageBase(type(Page)):
"""See https://code.djangoproject.com/ticket/27337"""
pass
class TestPage(MetadataPageMixin, Page, metaclass=TestPageBase):
pass
class ... | 24.035714 | 82 | 0.723626 | from django.db import models
from wagtail.core.models import Page
from wagtailmetadata.models import MetadataMixin, MetadataPageMixin
class TestPageBase(type(Page)):
pass
class TestPage(MetadataPageMixin, Page, metaclass=TestPageBase):
pass
class TestModel(MetadataMixin, models.Model):
def get_meta_u... | true | true |
1c22ada83d88acd3eea663257332d2021272cf3a | 214 | py | Python | api/blueprints/alert.py | atkinsonbg/docker-secure-containers | ab19eb3fb1ff415ee2ee00717516c6b8612e8b92 | [
"MIT"
] | 1 | 2021-01-09T15:29:35.000Z | 2021-01-09T15:29:35.000Z | api/blueprints/alert.py | atkinsonbg/docker-secure-containers | ab19eb3fb1ff415ee2ee00717516c6b8612e8b92 | [
"MIT"
] | null | null | null | api/blueprints/alert.py | atkinsonbg/docker-secure-containers | ab19eb3fb1ff415ee2ee00717516c6b8612e8b92 | [
"MIT"
] | null | null | null | from flask import Blueprint
bp = Blueprint('alert', __name__, url_prefix='/alert')
@bp.route('', methods=['GET'])
def log_alert():
print('Alert logged, someone launched a Bash shell...')
return 'OK', 200 | 23.777778 | 59 | 0.672897 | from flask import Blueprint
bp = Blueprint('alert', __name__, url_prefix='/alert')
@bp.route('', methods=['GET'])
def log_alert():
print('Alert logged, someone launched a Bash shell...')
return 'OK', 200 | true | true |
1c22ade10973c4d31a4802ef2de4292286b50f32 | 96,361 | py | Python | vspk/v5_0/nuvcentervrsconfig.py | axxyhtrx/vspk-python | 4495882c6bcbb1ef51b14b9f4dc7efe46476ff50 | [
"BSD-3-Clause"
] | 19 | 2016-03-07T12:34:22.000Z | 2020-06-11T11:09:02.000Z | vspk/v5_0/nuvcentervrsconfig.py | axxyhtrx/vspk-python | 4495882c6bcbb1ef51b14b9f4dc7efe46476ff50 | [
"BSD-3-Clause"
] | 40 | 2016-06-13T15:36:54.000Z | 2020-11-10T18:14:43.000Z | vspk/v5_0/nuvcentervrsconfig.py | axxyhtrx/vspk-python | 4495882c6bcbb1ef51b14b9f4dc7efe46476ff50 | [
"BSD-3-Clause"
] | 15 | 2016-06-10T22:06:01.000Z | 2020-12-15T18:37:42.000Z | # -*- coding: utf-8 -*-
#
# Copyright (c) 2015, Alcatel-Lucent Inc, 2017 Nokia
# All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions are met:
# * Redistributions of source code must retain the above copyrigh... | 32.088245 | 313 | 0.612302 |
from .fetchers import NUMetadatasFetcher
from .fetchers import NUGlobalMetadatasFetcher
from .fetchers import NUVRSAddressRangesFetcher
from .fetchers import NUVRSRedeploymentpoliciesFetcher
from bambou import NURESTObject
class NUVCenterVRSConfig(NURESTObject):
__rest_name__... | true | true |
1c22ae11d3504a75e93c06361cae652b9c98de09 | 2,698 | py | Python | mmcls/models/heads/vision_transformer_head.py | zhaoxin111/mmclassification | a0308064678c69035cf9a02b949c2f7a31dcb18b | [
"Apache-2.0"
] | 2 | 2021-05-07T21:39:56.000Z | 2021-06-19T15:15:24.000Z | mmcls/models/heads/vision_transformer_head.py | RangiLyu/mmclassification | 75b087f27eed3125cb879d2b8bde10f5e371fbb3 | [
"Apache-2.0"
] | null | null | null | mmcls/models/heads/vision_transformer_head.py | RangiLyu/mmclassification | 75b087f27eed3125cb879d2b8bde10f5e371fbb3 | [
"Apache-2.0"
] | null | null | null | # Copyright (c) OpenMMLab. All rights reserved.
from collections import OrderedDict
import torch.nn as nn
import torch.nn.functional as F
from mmcv.cnn import build_activation_layer, constant_init, kaiming_init
from ..builder import HEADS
from .cls_head import ClsHead
@HEADS.register_module()
class VisionTransforme... | 34.589744 | 78 | 0.622683 |
from collections import OrderedDict
import torch.nn as nn
import torch.nn.functional as F
from mmcv.cnn import build_activation_layer, constant_init, kaiming_init
from ..builder import HEADS
from .cls_head import ClsHead
@HEADS.register_module()
class VisionTransformerClsHead(ClsHead):
def __init__(self,
... | true | true |
1c22ae8625254ac778e012178722eb066cf58175 | 5,408 | py | Python | task.py | maxst1/FormalLanguages | 7a6c5884d83c624a1b243a2fd0261994fe482396 | [
"MIT"
] | null | null | null | task.py | maxst1/FormalLanguages | 7a6c5884d83c624a1b243a2fd0261994fe482396 | [
"MIT"
] | null | null | null | task.py | maxst1/FormalLanguages | 7a6c5884d83c624a1b243a2fd0261994fe482396 | [
"MIT"
] | null | null | null | import math
operators = ['.', '*', '+']
class Token:
def __init__(self):
self.value = 0
self.open = False
self.canBeEmpty = False
def solveReg(regular_value_, letter_, stack_, start):
regular_value = regular_value_
letter = letter_
stack = stack_
for i in... | 28.463158 | 75 | 0.372781 | import math
operators = ['.', '*', '+']
class Token:
def __init__(self):
self.value = 0
self.open = False
self.canBeEmpty = False
def solveReg(regular_value_, letter_, stack_, start):
regular_value = regular_value_
letter = letter_
stack = stack_
for i in... | true | true |
1c22b0b4cebfa1bdcc6b8c5cc1754925a01999c0 | 17,016 | py | Python | note_seq/chords_lib.py | MizoTake/note-seq | ad820cc59832f3e59c2d68a8d4d027baabcd4b2d | [
"Apache-2.0"
] | 1 | 2021-03-11T21:13:30.000Z | 2021-03-11T21:13:30.000Z | note_seq/chords_lib.py | MizoTake/note-seq | ad820cc59832f3e59c2d68a8d4d027baabcd4b2d | [
"Apache-2.0"
] | null | null | null | note_seq/chords_lib.py | MizoTake/note-seq | ad820cc59832f3e59c2d68a8d4d027baabcd4b2d | [
"Apache-2.0"
] | null | null | null | # Copyright 2020 The Magenta Authors.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in ... | 35.97463 | 80 | 0.698695 |
import abc
import bisect
from note_seq import chord_symbols_lib
from note_seq import constants
from note_seq import events_lib
from note_seq import sequences_lib
from note_seq.protobuf import music_pb2
STANDARD_PPQ = constants.STANDARD_PPQ
NOTES_PER_OCTAVE = constants.NOTES_PER_OCTAVE
NO_CHORD = consta... | true | true |
1c22b24411a116be3d4bc9e5b435e09c10f5fa06 | 4,236 | py | Python | tests/components/meraki/test_device_tracker.py | basicpail/core | 5cc54618c5af3f75c08314bf2375cc7ac40d2b7e | [
"Apache-2.0"
] | 11 | 2018-02-16T15:35:47.000Z | 2020-01-14T15:20:00.000Z | tests/components/meraki/test_device_tracker.py | jagadeeshvenkatesh/core | 1bd982668449815fee2105478569f8e4b5670add | [
"Apache-2.0"
] | 87 | 2020-07-06T22:22:54.000Z | 2022-03-31T06:01:46.000Z | tests/components/meraki/test_device_tracker.py | jagadeeshvenkatesh/core | 1bd982668449815fee2105478569f8e4b5670add | [
"Apache-2.0"
] | 11 | 2020-12-16T13:48:14.000Z | 2022-02-01T00:28:05.000Z | """The tests the for Meraki device tracker."""
import json
import pytest
import homeassistant.components.device_tracker as device_tracker
from homeassistant.components.meraki.device_tracker import (
CONF_SECRET,
CONF_VALIDATOR,
URL,
)
from homeassistant.const import CONF_PLATFORM
from homeassistant.setup ... | 31.61194 | 81 | 0.521483 | import json
import pytest
import homeassistant.components.device_tracker as device_tracker
from homeassistant.components.meraki.device_tracker import (
CONF_SECRET,
CONF_VALIDATOR,
URL,
)
from homeassistant.const import CONF_PLATFORM
from homeassistant.setup import async_setup_component
@pytest.fixture
... | true | true |
1c22b2c3fe6edd77cbd00dc22714a0dc8c7a0d03 | 2,330 | py | Python | lms/api/serializers.py | julia-shenshina/LMS | 110364bb5c59055d584c314fd5c04158c637d0e6 | [
"MIT"
] | null | null | null | lms/api/serializers.py | julia-shenshina/LMS | 110364bb5c59055d584c314fd5c04158c637d0e6 | [
"MIT"
] | 4 | 2018-12-18T19:03:36.000Z | 2018-12-20T21:07:02.000Z | lms/api/serializers.py | julia-shenshina/LMS | 110364bb5c59055d584c314fd5c04158c637d0e6 | [
"MIT"
] | null | null | null | from rest_framework import serializers
from lms.models.models import Student, Professor, Course, Group, Faculty, Task, Solution, Material
class RegistrationSerializer(serializers.Serializer):
token = serializers.CharField()
email = serializers.CharField()
password = serializers.CharField()
class LoginSe... | 28.765432 | 121 | 0.664378 | from rest_framework import serializers
from lms.models.models import Student, Professor, Course, Group, Faculty, Task, Solution, Material
class RegistrationSerializer(serializers.Serializer):
token = serializers.CharField()
email = serializers.CharField()
password = serializers.CharField()
class LoginSe... | true | true |
1c22b41ce86af759b2749cfa330bc4a0131f99fa | 17,327 | py | Python | homeassistant/components/zha/core/device.py | alemuro/home-assistant | 9b1315d8e55f0ca906c4c8a1b2ae8c2ea511dc90 | [
"Apache-2.0"
] | 2 | 2019-10-19T15:07:32.000Z | 2022-01-29T10:33:20.000Z | homeassistant/components/zha/core/device.py | alemuro/home-assistant | 9b1315d8e55f0ca906c4c8a1b2ae8c2ea511dc90 | [
"Apache-2.0"
] | 4 | 2021-02-08T21:05:14.000Z | 2021-09-08T02:57:03.000Z | homeassistant/components/zha/core/device.py | alemuro/home-assistant | 9b1315d8e55f0ca906c4c8a1b2ae8c2ea511dc90 | [
"Apache-2.0"
] | 1 | 2019-10-04T13:26:54.000Z | 2019-10-04T13:26:54.000Z | """
Device for Zigbee Home Automation.
For more details about this component, please refer to the documentation at
https://home-assistant.io/components/zha/
"""
import asyncio
from datetime import timedelta
from enum import Enum
import logging
import time
from homeassistant.core import callback
from homeassistant.hel... | 33.908023 | 87 | 0.611127 | import asyncio
from datetime import timedelta
from enum import Enum
import logging
import time
from homeassistant.core import callback
from homeassistant.helpers.dispatcher import (
async_dispatcher_connect,
async_dispatcher_send,
)
from homeassistant.helpers.event import async_track_time_interval
from .chann... | true | true |
1c22b4a82d71fc2977931771b9431ae20ad8bc27 | 3,130 | py | Python | reval/probing_tasks/sent_length.py | laksh-ag/685Project | dcc182ef6200b80726a395662eeece0a0e9cd371 | [
"MIT"
] | 13 | 2020-04-21T19:04:48.000Z | 2022-01-24T10:19:03.000Z | reval/probing_tasks/sent_length.py | laksh-ag/685Project | dcc182ef6200b80726a395662eeece0a0e9cd371 | [
"MIT"
] | null | null | null | reval/probing_tasks/sent_length.py | laksh-ag/685Project | dcc182ef6200b80726a395662eeece0a0e9cd371 | [
"MIT"
] | 4 | 2020-10-04T08:40:38.000Z | 2020-12-05T05:58:16.000Z | from typing import List, Dict, Any, Optional, Tuple
import logging
from reval.dataset_utils import train_val_split
from reval.probing_task_example import ProbingTaskExample
logger = logging.getLogger(__name__)
# default buckets as used in Adi et al. 2016
# DEFAULT_BUCKETS = [
# (5, 8),
# (9, 12),
# (13,... | 27.699115 | 82 | 0.620447 | from typing import List, Dict, Any, Optional, Tuple
import logging
from reval.dataset_utils import train_val_split
from reval.probing_task_example import ProbingTaskExample
logger = logging.getLogger(__name__)
DEFAULT_BUCKETS = [
(4, 15),
(16, 23),
(24, 27),
(28, 31),
(32, 35),
(... | true | true |
1c22b4ae5971c3ab1f960e41a60cb8b8dcb89129 | 13,675 | py | Python | yt/geometry/coordinates/spherical_coordinates.py | lconaboy/yt | d97c3cf6d7911cd12b8337784d3232068ebc59f6 | [
"BSD-3-Clause-Clear"
] | null | null | null | yt/geometry/coordinates/spherical_coordinates.py | lconaboy/yt | d97c3cf6d7911cd12b8337784d3232068ebc59f6 | [
"BSD-3-Clause-Clear"
] | null | null | null | yt/geometry/coordinates/spherical_coordinates.py | lconaboy/yt | d97c3cf6d7911cd12b8337784d3232068ebc59f6 | [
"BSD-3-Clause-Clear"
] | null | null | null | import sys
import numpy as np
from yt.utilities.lib.pixelization_routines import pixelize_aitoff, pixelize_cylinder
from .coordinate_handler import (
CoordinateHandler,
_get_coord_fields,
_get_polar_bounds,
_setup_dummy_cartesian_coords_and_widths,
_setup_polar_coordinates,
)
if sys.version_info... | 34.974425 | 117 | 0.544936 | import sys
import numpy as np
from yt.utilities.lib.pixelization_routines import pixelize_aitoff, pixelize_cylinder
from .coordinate_handler import (
CoordinateHandler,
_get_coord_fields,
_get_polar_bounds,
_setup_dummy_cartesian_coords_and_widths,
_setup_polar_coordinates,
)
if sys.version_info... | true | true |
1c22b61143fe5bc640e0334f13a06901ea427b55 | 19,555 | py | Python | mvm_gui/gui/mainwindow.py | nlourie/vent-flowmeter | 7aa6e3814a7bf8a7da4d81eb80da69ceb5e8da80 | [
"MIT"
] | 2 | 2020-04-13T19:22:45.000Z | 2020-04-14T17:17:12.000Z | mvm_gui/gui/mainwindow.py | nlourie/vent-flowmeter | 7aa6e3814a7bf8a7da4d81eb80da69ceb5e8da80 | [
"MIT"
] | null | null | null | mvm_gui/gui/mainwindow.py | nlourie/vent-flowmeter | 7aa6e3814a7bf8a7da4d81eb80da69ceb5e8da80 | [
"MIT"
] | null | null | null | #!/usr/bin/env python3
"""
This module handles the main window.
"""
from PyQt5 import QtWidgets, uic
#from maindisplay.maindisplay import MainDisplay
from settings.settings import Settings
from settings.settingsfile import SettingsFile
#from toolbar.toolbar import Toolbar
#from menu.menu import Menu
#from settings.s... | 35.361664 | 98 | 0.650064 |
from PyQt5 import QtWidgets, uic
from settings.settings import Settings
from settings.settingsfile import SettingsFile
from alarms.guialarms import GuiAlarms
from monitor.monitor import Monitor
from data_filler import DataFiller
from data_handler import DataHandler
from start_stop_worker import StartStopWo... | true | true |
1c22b634d2779509dcb07227ad59a6181f32023a | 29,852 | py | Python | virt/ansible-2.7.0/lib/python2.7/site-packages/ansible/plugins/loader.py | lakhlaifi/RedHat-Ansible | 27c5077cced9d416081fcd5d69ea44bca0317fa4 | [
"Apache-2.0"
] | null | null | null | virt/ansible-2.7.0/lib/python2.7/site-packages/ansible/plugins/loader.py | lakhlaifi/RedHat-Ansible | 27c5077cced9d416081fcd5d69ea44bca0317fa4 | [
"Apache-2.0"
] | null | null | null | virt/ansible-2.7.0/lib/python2.7/site-packages/ansible/plugins/loader.py | lakhlaifi/RedHat-Ansible | 27c5077cced9d416081fcd5d69ea44bca0317fa4 | [
"Apache-2.0"
] | 1 | 2020-02-13T14:24:57.000Z | 2020-02-13T14:24:57.000Z | # (c) 2012, Daniel Hokka Zakrisson <daniel@hozac.com>
# (c) 2012-2014, Michael DeHaan <michael.dehaan@gmail.com> and others
# (c) 2017, Toshio Kuratomi <tkuratomi@ansible.com>
# (c) 2017 Ansible Project
# GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt)
from __future__ import ... | 38.51871 | 146 | 0.631616 |
from __future__ import (absolute_import, division, print_function)
__metaclass__ = type
import glob
import imp
import os
import os.path
import sys
import warnings
from collections import defaultdict
from ansible import constants as C
from ansible.errors import AnsibleError
from ansible.module_utils._text impor... | true | true |
1c22b68a70d184b2d888783763f6c25aaf6e5f3d | 10,036 | py | Python | pyzscaler/zia/locations.py | daxm/pyZscaler | 7a1fe13973d75f04d7b69df020f9be6343abe216 | [
"MIT"
] | null | null | null | pyzscaler/zia/locations.py | daxm/pyZscaler | 7a1fe13973d75f04d7b69df020f9be6343abe216 | [
"MIT"
] | null | null | null | pyzscaler/zia/locations.py | daxm/pyZscaler | 7a1fe13973d75f04d7b69df020f9be6343abe216 | [
"MIT"
] | null | null | null | from restfly.endpoint import APIEndpoint
from pyzscaler.utils import Iterator, snake_to_camel
class LocationsAPI(APIEndpoint):
def list_locations(self, **kwargs):
"""
Returns a list of locations.
Keyword Args:
**auth_required (bool, optional):
Filter based on ... | 37.871698 | 113 | 0.589079 | from restfly.endpoint import APIEndpoint
from pyzscaler.utils import Iterator, snake_to_camel
class LocationsAPI(APIEndpoint):
def list_locations(self, **kwargs):
return list(Iterator(self._api, "locations", **kwargs))
def add_location(self, name: str, **kwargs):
payload = {
"nam... | true | true |
1c22b80d6344c57d9d25ec42598a8359600d6f78 | 3,744 | py | Python | tests/data/samplers/max_tokens_batch_sampler_test.py | Crissman/allennlp | 2012fea98bfbb1b60980cdd2760fdf56ae352006 | [
"Apache-2.0"
] | 1 | 2021-06-12T22:01:10.000Z | 2021-06-12T22:01:10.000Z | tests/data/samplers/max_tokens_batch_sampler_test.py | ZhaofengWu/allennlp | 91d0fa1a51485c4118e48426d76328acd8049587 | [
"Apache-2.0"
] | null | null | null | tests/data/samplers/max_tokens_batch_sampler_test.py | ZhaofengWu/allennlp | 91d0fa1a51485c4118e48426d76328acd8049587 | [
"Apache-2.0"
] | null | null | null | from allennlp.common import Params
from allennlp.data import Instance, Token
from allennlp.data.batch import Batch
from allennlp.data.fields import TextField
from allennlp.data.samplers import MaxTokensBatchSampler
from allennlp.data.dataset_readers.dataset_reader import AllennlpDataset
from allennlp.data.dataloader im... | 39 | 96 | 0.627938 | from allennlp.common import Params
from allennlp.data import Instance, Token
from allennlp.data.batch import Batch
from allennlp.data.fields import TextField
from allennlp.data.samplers import MaxTokensBatchSampler
from allennlp.data.dataset_readers.dataset_reader import AllennlpDataset
from allennlp.data.dataloader im... | true | true |
1c22b8d25d5574696deb8bb6e4636b2486d3a18e | 5,624 | py | Python | kafka-proxy/web.py | py-paulo/analyzer | da4978a792a0e64a819d3db5d6c30f9e0c4f114d | [
"Apache-2.0"
] | 2 | 2021-04-17T20:00:15.000Z | 2021-04-17T23:55:17.000Z | kafka-proxy/web.py | py-paulo/proxy-analyzer | da4978a792a0e64a819d3db5d6c30f9e0c4f114d | [
"Apache-2.0"
] | null | null | null | kafka-proxy/web.py | py-paulo/proxy-analyzer | da4978a792a0e64a819d3db5d6c30f9e0c4f114d | [
"Apache-2.0"
] | null | null | null | import socket
import threading
import queue
import time
import re
import json
import sys
import kafka
from loguru import logger
from rich.console import Console
from kafka import KafkaProducer
console = Console()
config = {
"handlers": [
{"sink": sys.stdout, "level": "INFO"} # , format="{time:YYYY-MM-D... | 31.071823 | 112 | 0.509246 | import socket
import threading
import queue
import time
import re
import json
import sys
import kafka
from loguru import logger
from rich.console import Console
from kafka import KafkaProducer
console = Console()
config = {
"handlers": [
{"sink": sys.stdout, "level": "INFO"}
]
}
logger.configure(*... | true | true |
1c22b8fbf1c6845826060f9c8efcdd91398166f7 | 66,625 | py | Python | dulwich/client.py | pixelb/dulwich | 5274f14d48d9215ea40ad2d6e18e30c0007b3a2c | [
"Apache-2.0"
] | 1 | 2021-03-25T07:01:55.000Z | 2021-03-25T07:01:55.000Z | dulwich/client.py | pixelb/dulwich | 5274f14d48d9215ea40ad2d6e18e30c0007b3a2c | [
"Apache-2.0"
] | null | null | null | dulwich/client.py | pixelb/dulwich | 5274f14d48d9215ea40ad2d6e18e30c0007b3a2c | [
"Apache-2.0"
] | null | null | null | # client.py -- Implementation of the client side git protocols
# Copyright (C) 2008-2013 Jelmer Vernooij <jelmer@jelmer.uk>
#
# Dulwich is dual-licensed under the Apache License, Version 2.0 and the GNU
# General Public License as public by the Free Software Foundation; version 2.0
# or (at your option) any later versi... | 35.685592 | 79 | 0.591235 |
from contextlib import closing
from io import BytesIO, BufferedReader
import select
import socket
import subprocess
import sys
try:
from urllib import quote as urlquote
from urllib import unquote as urlunquote
except ImportError:
from urllib.parse import quote as urlquote
from urll... | true | true |
1c22b9112c93f4816cb746e3505dfddf99afb8e2 | 428 | py | Python | json_gtfs_realtime.py | harrytruong/gtfs_realtime_json | a95c339eeb2487131b0af141aca13c81cb26796c | [
"MIT"
] | 39 | 2015-02-25T17:36:33.000Z | 2021-07-17T17:44:32.000Z | json_gtfs_realtime.py | harrytruong/gtfs_realtime_json | a95c339eeb2487131b0af141aca13c81cb26796c | [
"MIT"
] | 3 | 2016-09-16T19:57:06.000Z | 2018-01-09T16:09:49.000Z | json_gtfs_realtime.py | harrytruong/gtfs_realtime_json | a95c339eeb2487131b0af141aca13c81cb26796c | [
"MIT"
] | 8 | 2015-11-23T01:41:40.000Z | 2022-02-20T11:28:03.000Z | #!/usr/bin/env python
from google.protobuf import json_format
import sys, urllib2
import gtfs_realtime_pb2
import json
def main():
json_rt = json.load(urllib2.urlopen(sys.argv[1]))
gtfs_realtime = gtfs_realtime_pb2.FeedMessage()
json_format.ParseDict(json_rt, gtfs_realtime)
with open(sys.argv[2], 'wb')... | 25.176471 | 53 | 0.721963 |
from google.protobuf import json_format
import sys, urllib2
import gtfs_realtime_pb2
import json
def main():
json_rt = json.load(urllib2.urlopen(sys.argv[1]))
gtfs_realtime = gtfs_realtime_pb2.FeedMessage()
json_format.ParseDict(json_rt, gtfs_realtime)
with open(sys.argv[2], 'wb') as f:
f.writ... | true | true |
1c22b94df19b28852ec5d96506a984887d838e37 | 6,431 | py | Python | keystone/tests/unit/protection/v3/test_service_providers.py | pritha-srivastava/keystone | 69abe058328954becdea13cc245459f2ba2342fc | [
"Apache-2.0"
] | null | null | null | keystone/tests/unit/protection/v3/test_service_providers.py | pritha-srivastava/keystone | 69abe058328954becdea13cc245459f2ba2342fc | [
"Apache-2.0"
] | null | null | null | keystone/tests/unit/protection/v3/test_service_providers.py | pritha-srivastava/keystone | 69abe058328954becdea13cc245459f2ba2342fc | [
"Apache-2.0"
] | null | null | null | # Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance with the License. You may obtain
# a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# d... | 36.539773 | 78 | 0.636604 |
import uuid
from six.moves import http_client
from keystone.common import provider_api
import keystone.conf
from keystone.tests.common import auth as common_auth
from keystone.tests import unit
from keystone.tests.unit import base_classes
from keystone.tests.unit import ksfixtures
CONF = keystone.conf.CO... | true | true |
1c22b9fe43d08c75e61b9b68e66563bd076ea0b1 | 367 | py | Python | examples/basic/func1.py | sflinter/hypergraph | c3108ee51361d2e4b8ddc7eced1953f1548ce8d8 | [
"Apache-2.0"
] | 1 | 2020-12-17T11:17:56.000Z | 2020-12-17T11:17:56.000Z | examples/basic/func1.py | sflinter/hypergraph | c3108ee51361d2e4b8ddc7eced1953f1548ce8d8 | [
"Apache-2.0"
] | null | null | null | examples/basic/func1.py | sflinter/hypergraph | c3108ee51361d2e4b8ddc7eced1953f1548ce8d8 | [
"Apache-2.0"
] | null | null | null | import hypergraph as hg
def test1(x, y):
return x+y
graph1 = hg.Graph()
with graph1.as_default():
# Note: the dictionary items are automatically mapped to the arguments
hg.output() << (hg.call(test1) << {'x': 2, 'y': 3}) # another possibility is passing arg by position: [2, 3]
print(graph1())
print... | 22.9375 | 116 | 0.673025 | import hypergraph as hg
def test1(x, y):
return x+y
graph1 = hg.Graph()
with graph1.as_default():
hg.output() << (hg.call(test1) << {'x': 2, 'y': 3})
print(graph1())
print(graph1())
hg.ExecutionContext.reset_default()
| true | true |
1c22bad77786724f7d43684c824f7f8ee5ae9413 | 423 | py | Python | user_satisfaction_prediction/machine_learning_model/Train.py | wanlingcai1997/umap_2020_code | 1d875523b9944583fab87e581b234af2c92ef2b0 | [
"MIT"
] | 2 | 2022-03-04T06:00:17.000Z | 2022-03-13T13:28:21.000Z | user_satisfaction_prediction/machine_learning_model/Train.py | wanlingcai1997/umap_2020_code | 1d875523b9944583fab87e581b234af2c92ef2b0 | [
"MIT"
] | null | null | null | user_satisfaction_prediction/machine_learning_model/Train.py | wanlingcai1997/umap_2020_code | 1d875523b9944583fab87e581b234af2c92ef2b0 | [
"MIT"
] | null | null | null | # Train.py
import numpy as np
import pandas as pandas
from Data import Data
import sklearn_model
class Train():
@staticmethod
def train():
sklearn_model.model_train_and_evaluate(Data.model_name, Data.feature_vector, Data.conversation_labels, Data.cross_validation)
# sklearn_model.model... | 21.15 | 134 | 0.718676 |
import numpy as np
import pandas as pandas
from Data import Data
import sklearn_model
class Train():
@staticmethod
def train():
sklearn_model.model_train_and_evaluate(Data.model_name, Data.feature_vector, Data.conversation_labels, Data.cross_validation)
| true | true |
1c22baf72a01495ba84016c1894dcb9c0b81eb9e | 3,041 | py | Python | tests/test_docs.py | wikimedia/operations-debs-python-confluent-kafka | 0af5127f8c54f6e26a1a0ed8ecc08e7f1266461e | [
"Apache-2.0"
] | null | null | null | tests/test_docs.py | wikimedia/operations-debs-python-confluent-kafka | 0af5127f8c54f6e26a1a0ed8ecc08e7f1266461e | [
"Apache-2.0"
] | null | null | null | tests/test_docs.py | wikimedia/operations-debs-python-confluent-kafka | 0af5127f8c54f6e26a1a0ed8ecc08e7f1266461e | [
"Apache-2.0"
] | 2 | 2017-04-20T06:59:23.000Z | 2022-02-03T17:06:33.000Z | #!/usr/bin/env python
import re
import sys
from collections import defaultdict
from types import ModuleType
import confluent_kafka
def build_doctree (tree, prefix, parent):
""" Build doctree dict with format:
dict key = full class/type name (e.g, "confluent_kafka.Message.timestamp")
value = ... | 32.698925 | 96 | 0.536994 |
import re
import sys
from collections import defaultdict
from types import ModuleType
import confluent_kafka
def build_doctree (tree, prefix, parent):
for n in dir(parent):
if n.startswith('__') or n == 'cimpl':
continue
o = parent.__dict__.get(n)
... | true | true |
1c22bbd69d53ef0e2a2ae64c871e7d9226d06682 | 700 | py | Python | django_pds/core/pds/generic/upsert.py | knroy/django-pds | 75f192eb38acf1ae98cba7034e8768750848e639 | [
"MIT"
] | 1 | 2020-08-25T15:20:06.000Z | 2020-08-25T15:20:06.000Z | django_pds/core/pds/generic/upsert.py | knroy/django-pds | 75f192eb38acf1ae98cba7034e8768750848e639 | [
"MIT"
] | null | null | null | django_pds/core/pds/generic/upsert.py | knroy/django-pds | 75f192eb38acf1ae98cba7034e8768750848e639 | [
"MIT"
] | null | null | null | from django_pds.core.managers import GenericInsertCommandManager
from .update import data_update
from .write import data_insert
def data_upsert(document_name, data, user_id=None, ignore_security=False, force_upsert=False, track_error=False):
try:
insert_ctrl = GenericInsertCommandManager()
already... | 38.888889 | 113 | 0.745714 | from django_pds.core.managers import GenericInsertCommandManager
from .update import data_update
from .write import data_insert
def data_upsert(document_name, data, user_id=None, ignore_security=False, force_upsert=False, track_error=False):
try:
insert_ctrl = GenericInsertCommandManager()
already... | true | true |
1c22bbf694a80fd4fe62a6e5e661fbcac419c7ec | 2,486 | py | Python | tests/test_locode.py | flaxandteal/tablespy | 4918e7673802d15373b324ec719179f8565717e7 | [
"MIT"
] | 1 | 2020-04-29T06:53:32.000Z | 2020-04-29T06:53:32.000Z | tests/test_locode.py | flaxandteal/tablespy | 4918e7673802d15373b324ec719179f8565717e7 | [
"MIT"
] | null | null | null | tests/test_locode.py | flaxandteal/tablespy | 4918e7673802d15373b324ec719179f8565717e7 | [
"MIT"
] | null | null | null | import pytest
import pandas as pd
from tablespy.inspector import Inspector
BLANK_COLS = 500
BLANK_ROWS = 500
@pytest.fixture
def blank_data():
return [
[''] * BLANK_COLS
] * BLANK_ROWS
@pytest.fixture
def basic_df(blank_data):
df = pd.DataFrame(blank_data)
df.iloc[3, 11] = "Test Title"
d... | 34.527778 | 103 | 0.625905 | import pytest
import pandas as pd
from tablespy.inspector import Inspector
BLANK_COLS = 500
BLANK_ROWS = 500
@pytest.fixture
def blank_data():
return [
[''] * BLANK_COLS
] * BLANK_ROWS
@pytest.fixture
def basic_df(blank_data):
df = pd.DataFrame(blank_data)
df.iloc[3, 11] = "Test Title"
d... | true | true |
1c22bc98b0315d82d3c6602de9572b8ab21b5504 | 5,506 | py | Python | rdmfs/node.py | RCOSDP/CS-rdmfs | 4821a5edbe5851cd8aad6f057348b8e5711b5047 | [
"BSD-3-Clause"
] | null | null | null | rdmfs/node.py | RCOSDP/CS-rdmfs | 4821a5edbe5851cd8aad6f057348b8e5711b5047 | [
"BSD-3-Clause"
] | null | null | null | rdmfs/node.py | RCOSDP/CS-rdmfs | 4821a5edbe5851cd8aad6f057348b8e5711b5047 | [
"BSD-3-Clause"
] | null | null | null | import io
import logging
import os
import tempfile
import pyfuse3
from aiofile import AIOFile, Reader
log = logging.getLogger(__name__)
def flags_can_write(flags):
if flags & 0x03 == os.O_RDWR:
return True
if flags & 0x03 == os.O_WRONLY:
return True
return False
class BaseFileContext:
... | 29.602151 | 76 | 0.598801 | import io
import logging
import os
import tempfile
import pyfuse3
from aiofile import AIOFile, Reader
log = logging.getLogger(__name__)
def flags_can_write(flags):
if flags & 0x03 == os.O_RDWR:
return True
if flags & 0x03 == os.O_WRONLY:
return True
return False
class BaseFileContext:
... | true | true |
1c22be8c58910b0430d27d02df5859a9cce09d27 | 28,955 | py | Python | src/sage/functions/special.py | fredstro/sage | c936d2cda81ec7ec3552a3bdb29c994b40d1bb24 | [
"BSL-1.0"
] | null | null | null | src/sage/functions/special.py | fredstro/sage | c936d2cda81ec7ec3552a3bdb29c994b40d1bb24 | [
"BSL-1.0"
] | null | null | null | src/sage/functions/special.py | fredstro/sage | c936d2cda81ec7ec3552a3bdb29c994b40d1bb24 | [
"BSL-1.0"
] | null | null | null | r"""
Miscellaneous Special Functions
AUTHORS:
- David Joyner (2006-13-06): initial version
- David Joyner (2006-30-10): bug fixes to pari wrappers of Bessel
functions, hypergeometric_U
- William Stein (2008-02): Impose some sanity checks.
- David Joyner (2008-04-23): addition of elliptic integrals
This module p... | 29.188508 | 311 | 0.578346 |
from sage.rings.real_mpfr import RealField
from sage.rings.complex_field import ComplexField
from sage.misc.latex import latex
from sage.rings.all import ZZ, RR, RDF, CDF
from sage.structure.parent import Parent
from sage.functions.other import log_gamma
from sage.symbolic.function import BuiltinFuncti... | true | true |
1c22bf8cd912ba6d1bfa0e8efc21a9e34069984c | 2,864 | py | Python | Analytics/resources/login.py | thanosbnt/SharingCitiesDashboard | 5d123691d1f25d0b85e20e4e8293266bf23c9f8a | [
"Apache-2.0"
] | 4 | 2018-11-21T14:42:18.000Z | 2020-05-11T10:52:59.000Z | Analytics/resources/login.py | thanosbnt/SharingCitiesDashboard | 5d123691d1f25d0b85e20e4e8293266bf23c9f8a | [
"Apache-2.0"
] | 60 | 2018-11-21T15:11:59.000Z | 2019-12-02T10:46:44.000Z | Analytics/resources/login.py | thanosbnt/SharingCitiesDashboard | 5d123691d1f25d0b85e20e4e8293266bf23c9f8a | [
"Apache-2.0"
] | 7 | 2018-11-21T14:42:44.000Z | 2019-11-28T16:24:14.000Z | from datetime import timedelta
from flask_restful import Resource, reqparse, inputs
from flask_jwt_extended import (create_access_token, create_refresh_token, jwt_required, get_jwt_identity,get_jwt_claims)
from db import db
from models.users import Users
class Login(Resource):
"""
API that grants users access to ... | 30.795699 | 121 | 0.728352 | from datetime import timedelta
from flask_restful import Resource, reqparse, inputs
from flask_jwt_extended import (create_access_token, create_refresh_token, jwt_required, get_jwt_identity,get_jwt_claims)
from db import db
from models.users import Users
class Login(Resource):
parser = reqparse.RequestParser()
pa... | true | true |
1c22bf9de15fd92beba184ff01d241dafc267063 | 1,269 | py | Python | setup.py | dumbPy/layout-parser | d7d646cd2056c38f6c360050cec644577fa292a5 | [
"Apache-2.0"
] | null | null | null | setup.py | dumbPy/layout-parser | d7d646cd2056c38f6c360050cec644577fa292a5 | [
"Apache-2.0"
] | null | null | null | setup.py | dumbPy/layout-parser | d7d646cd2056c38f6c360050cec644577fa292a5 | [
"Apache-2.0"
] | null | null | null | from setuptools import setup, find_packages
import os
# A trick from https://github.com/jina-ai/jina/blob/79b302c93b01689e82cf4b52f46522eb7497c404/setup.py#L20
pkg_name = 'layoutparser'
libinfo_py = os.path.join('src', pkg_name, '__init__.py')
libinfo_content = open(libinfo_py, 'r', encoding='utf8').readlines()
versi... | 33.394737 | 105 | 0.598897 | from setuptools import setup, find_packages
import os
_name = 'layoutparser'
libinfo_py = os.path.join('src', pkg_name, '__init__.py')
libinfo_content = open(libinfo_py, 'r', encoding='utf8').readlines()
version_line = [l.strip() for l in libinfo_content if l.startswith('__version__')][0]
exec(version_line)
setup(... | true | true |
1c22bfa8985f51ae509e788b31542a6ea029f293 | 1,092 | py | Python | none/default_config.py | yucongo/none-bot | 3f66c14241115ec2136d7891210368910081375f | [
"MIT"
] | null | null | null | none/default_config.py | yucongo/none-bot | 3f66c14241115ec2136d7891210368910081375f | [
"MIT"
] | null | null | null | none/default_config.py | yucongo/none-bot | 3f66c14241115ec2136d7891210368910081375f | [
"MIT"
] | null | null | null | """
Default configurations.
Any derived configurations must import everything from this module
at the very beginning of their code, and then set their own value
to override the default one.
For example:
>>> from none.default_config import *
>>> PORT = 9090
>>> DEBUG = False
>>> SUPERUSERS.add(123456)
>>> NICKNAME = ... | 26.634146 | 75 | 0.720696 |
from datetime import timedelta
from typing import Container, Union, Iterable, Pattern, Optional, Dict, Any
from .expression import Expression_T
API_ROOT: str = ''
ACCESS_TOKEN: str = ''
SECRET: str = ''
HOST: str = '127.0.0.1'
PORT: int = 8080
DEBUG: bool = True
SUPERUSERS: Container[int] = set()
NICKNAME: Union[st... | true | true |
1c22c03f48214d9906b35e421b83f52d678e7720 | 5,718 | py | Python | experiments/driver.py | jl3953/cockroach2.0 | 4ff60d78e365bded2b91b8d75ff35a74801ff07e | [
"MIT",
"BSD-3-Clause"
] | null | null | null | experiments/driver.py | jl3953/cockroach2.0 | 4ff60d78e365bded2b91b8d75ff35a74801ff07e | [
"MIT",
"BSD-3-Clause"
] | 2 | 2021-05-09T02:22:47.000Z | 2022-03-02T09:32:25.000Z | experiments/driver.py | jl3953/cockroach2.0 | 4ff60d78e365bded2b91b8d75ff35a74801ff07e | [
"MIT",
"BSD-3-Clause"
] | null | null | null | #!/usr/bin/env python3
import argparse
import configparser
import os
import exp_lib
import lib
import plotlib
FPATH = os.path.dirname(os.path.realpath(__file__))
CONFIG_LIST = [
# "new_zipfian_read95.ini",
# "new_zipfian_write.ini"
# "new_zipfian_overload.ini"
# "baseline.ini",
# "read100.ini",
"beep.ini... | 32.305085 | 113 | 0.698496 |
import argparse
import configparser
import os
import exp_lib
import lib
import plotlib
FPATH = os.path.dirname(os.path.realpath(__file__))
CONFIG_LIST = [
"beep.ini",
]
EXP, SKEWS = exp_lib.create_experiment(FPATH, CONFIG_LIST[0])
DB_QUERY_NODE = "192.168.1.2"
def gather_statistics(exp, skews, co... | true | true |
1c22c058a37f6088364753f7fbbb3e3cab463ab0 | 11,143 | py | Python | mlflow/projects/_project_spec.py | adamreeve/mlflow | d0d307f7f7b49f013727191a672ae2139bf37343 | [
"Apache-2.0"
] | null | null | null | mlflow/projects/_project_spec.py | adamreeve/mlflow | d0d307f7f7b49f013727191a672ae2139bf37343 | [
"Apache-2.0"
] | null | null | null | mlflow/projects/_project_spec.py | adamreeve/mlflow | d0d307f7f7b49f013727191a672ae2139bf37343 | [
"Apache-2.0"
] | null | null | null | """Internal utilities for parsing MLproject YAML files."""
import os
from shlex import quote
import yaml
from mlflow import data
from mlflow.exceptions import ExecutionException
from mlflow.tracking import artifact_utils
from mlflow.utils.file_utils import get_local_path_or_none
from mlflow.utils.string_utils import ... | 40.227437 | 100 | 0.632325 |
import os
from shlex import quote
import yaml
from mlflow import data
from mlflow.exceptions import ExecutionException
from mlflow.tracking import artifact_utils
from mlflow.utils.file_utils import get_local_path_or_none
from mlflow.utils.string_utils import is_string_type
from mlflow.projects import env_type
MLPROJ... | true | true |
1c22c1d34fa9bc3ee60209a325455ed407c72e98 | 4,658 | py | Python | features/non_classic_features.py | RobertInjac/Master-thesis | 313b64806870d771ed4c161d7a76c3d3acda3795 | [
"MIT"
] | 1 | 2021-04-22T14:50:25.000Z | 2021-04-22T14:50:25.000Z | features/non_classic_features.py | rinjac/predicting-text-readability | 313b64806870d771ed4c161d7a76c3d3acda3795 | [
"MIT"
] | null | null | null | features/non_classic_features.py | rinjac/predicting-text-readability | 313b64806870d771ed4c161d7a76c3d3acda3795 | [
"MIT"
] | 1 | 2020-07-07T09:44:26.000Z | 2020-07-07T09:44:26.000Z | """
Functions for creation non-classic text readability features.
Non-classic features are features which use more complex NLP techniques like parse trees.
All functions take a pandas dataframe as an input. The dataframe contains texts in the Text column.
The functions will calculate the features for every text in the... | 30.246753 | 115 | 0.698368 | from collections import Counter, defaultdict
import pandas as pd
import spacy
from benepar.spacy_plugin import BeneparComponent
SPACY_MODEL = "en_core_web_sm"
BENEPAR_MODEL = "benepar_en_small"
def _parse_tree_height(sent):
children = list(sent._.children)
if not children:
return 0
else:
... | true | true |
1c22c205a37c6009f0e5022523eb93b327ca7892 | 1,422 | py | Python | examples/fieldsets/forms.py | fpoulain/django-tapeforms | 701a7272cb4c4957d5cf18be7821b2e8c784437b | [
"MIT"
] | 1 | 2019-01-28T10:59:55.000Z | 2019-01-28T10:59:55.000Z | examples/fieldsets/forms.py | fpoulain/django-tapeforms | 701a7272cb4c4957d5cf18be7821b2e8c784437b | [
"MIT"
] | 23 | 2018-08-26T09:30:57.000Z | 2022-02-10T10:43:14.000Z | examples/fieldsets/forms.py | fpoulain/django-tapeforms | 701a7272cb4c4957d5cf18be7821b2e8c784437b | [
"MIT"
] | 4 | 2018-08-26T09:00:46.000Z | 2021-03-13T13:24:26.000Z | from django import forms
from tapeforms.fieldsets import TapeformFieldset, TapeformFieldsetsMixin
from tapeforms.mixins import TapeformMixin
class LargeForm(TapeformMixin, forms.Form):
first_name = forms.CharField(label='First name')
last_name = forms.CharField(label='Last name', help_text='Some hints')
... | 30.913043 | 79 | 0.646273 | from django import forms
from tapeforms.fieldsets import TapeformFieldset, TapeformFieldsetsMixin
from tapeforms.mixins import TapeformMixin
class LargeForm(TapeformMixin, forms.Form):
first_name = forms.CharField(label='First name')
last_name = forms.CharField(label='Last name', help_text='Some hints')
... | true | true |
1c22c37518a529b20094da514c51130d8ca35ce2 | 31,376 | py | Python | src/ahip/connectionpool.py | shuckc/hip | bf64a3d74976153b103bdd903fa8061160862346 | [
"Apache-2.0",
"MIT"
] | 70 | 2019-11-25T23:18:20.000Z | 2022-02-09T17:04:30.000Z | src/ahip/connectionpool.py | shuckc/hip | bf64a3d74976153b103bdd903fa8061160862346 | [
"Apache-2.0",
"MIT"
] | 125 | 2018-04-02T09:28:22.000Z | 2019-11-25T18:56:25.000Z | src/ahip/connectionpool.py | shuckc/hip | bf64a3d74976153b103bdd903fa8061160862346 | [
"Apache-2.0",
"MIT"
] | 13 | 2019-11-26T15:38:44.000Z | 2022-01-05T19:35:32.000Z | from __future__ import absolute_import
import errno
import logging
import sys
import warnings
from socket import error as SocketError, timeout as SocketTimeout
import socket
import h11
from .base import Request, DEFAULT_PORTS
from .exceptions import (
ClosedPoolError,
ProtocolError,
EmptyPoolError,
... | 33.272534 | 99 | 0.607088 | from __future__ import absolute_import
import errno
import logging
import sys
import warnings
from socket import error as SocketError, timeout as SocketTimeout
import socket
import h11
from .base import Request, DEFAULT_PORTS
from .exceptions import (
ClosedPoolError,
ProtocolError,
EmptyPoolError,
... | true | true |
1c22c396803c178271de9440333f5c8cd3fd9eb2 | 2,049 | py | Python | simulator/Tests/KitchenTestPlannerTest.py | ciarakamahele/sasy | fd0d50785561f188c5e9b6fa5e928673457be772 | [
"Apache-2.0"
] | null | null | null | simulator/Tests/KitchenTestPlannerTest.py | ciarakamahele/sasy | fd0d50785561f188c5e9b6fa5e928673457be772 | [
"Apache-2.0"
] | null | null | null | simulator/Tests/KitchenTestPlannerTest.py | ciarakamahele/sasy | fd0d50785561f188c5e9b6fa5e928673457be772 | [
"Apache-2.0"
] | null | null | null | # Copyright 2015 Ciara Kamahele-Sanfratello
#
# 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... | 31.523077 | 84 | 0.694973 |
from Primitives.KitchenPrimitives import *
from Planners.KitchenTestPlanner import *
numLocs = 3
numObjs = 2
stoveLoc = 0
move_info = (1, 1, 0)
pick_info = (1, 1, 0)
place_info = (1, 1, 0)
cook_info = (1, 1, 0)
look_info = (1, 0)
robotLoc = [1, 0, 0]
objLocs = [[1, 0, 0], [0, 0, 1]]
freeLocs = [0, 1, 0... | false | true |
1c22c4517a341995370fe7f027301a814292328e | 710 | py | Python | tests/ui/test_install.py | gijsk/addons-server | 7c38f379e3a0b4a5ca231f98ac0c049450c224bd | [
"BSD-3-Clause"
] | null | null | null | tests/ui/test_install.py | gijsk/addons-server | 7c38f379e3a0b4a5ca231f98ac0c049450c224bd | [
"BSD-3-Clause"
] | null | null | null | tests/ui/test_install.py | gijsk/addons-server | 7c38f379e3a0b4a5ca231f98ac0c049450c224bd | [
"BSD-3-Clause"
] | null | null | null | import pytest
from pages.desktop.details import Detail
@pytest.mark.nondestructive
def test_addon_install(
base_url, selenium, firefox, firefox_notifications):
"""Test that navigates to an addon and installs it."""
selenium.get('{}/addon/ui-test-install'.format(base_url))
addon = Detail(selenium... | 33.809524 | 65 | 0.75493 | import pytest
from pages.desktop.details import Detail
@pytest.mark.nondestructive
def test_addon_install(
base_url, selenium, firefox, firefox_notifications):
selenium.get('{}/addon/ui-test-install'.format(base_url))
addon = Detail(selenium, base_url)
assert 'Ui-Addon-Install' in addon.name
... | true | true |
1c22c4d857f6ea76821b5656c7a1c77d70c68b67 | 250 | py | Python | Codes_Archive/prime_number.py | mingzhangyang/learning_pandas | 6ec0ef09839d87a28dbf3beaa7c61e89f4346a36 | [
"Apache-2.0"
] | null | null | null | Codes_Archive/prime_number.py | mingzhangyang/learning_pandas | 6ec0ef09839d87a28dbf3beaa7c61e89f4346a36 | [
"Apache-2.0"
] | null | null | null | Codes_Archive/prime_number.py | mingzhangyang/learning_pandas | 6ec0ef09839d87a28dbf3beaa7c61e89f4346a36 | [
"Apache-2.0"
] | 1 | 2017-10-10T15:09:38.000Z | 2017-10-10T15:09:38.000Z | #!/usr/bin/python
#coding:utf8
l = []
for n in range(2, 1000):
for x in range(2, n):
if n % x == 0:
print n, 'euqals', x, '*', n/x
break
else:
l.append(n)
print n, 'is a prime number.'
print l
| 17.857143 | 42 | 0.46 |
l = []
for n in range(2, 1000):
for x in range(2, n):
if n % x == 0:
print n, 'euqals', x, '*', n/x
break
else:
l.append(n)
print n, 'is a prime number.'
print l
| false | true |
1c22c515d7ceeace44eb592b0b68352522180862 | 670 | py | Python | src/pytk/handlers.py | bigblindbais/pytk | 7e21604ba9b4fc869949d3d7da845d98c480d872 | [
"MIT"
] | null | null | null | src/pytk/handlers.py | bigblindbais/pytk | 7e21604ba9b4fc869949d3d7da845d98c480d872 | [
"MIT"
] | null | null | null | src/pytk/handlers.py | bigblindbais/pytk | 7e21604ba9b4fc869949d3d7da845d98c480d872 | [
"MIT"
] | null | null | null | import signal
class GracefulHandler(object):
def __init__(self, sig=signal.SIGINT):
self.sig = sig
def __enter__(self):
self.interrupted = False
self.released = False
def handler(signum, frame):
self.release()
self.interrupted = True
self.ori... | 20.9375 | 58 | 0.598507 | import signal
class GracefulHandler(object):
def __init__(self, sig=signal.SIGINT):
self.sig = sig
def __enter__(self):
self.interrupted = False
self.released = False
def handler(signum, frame):
self.release()
self.interrupted = True
self.ori... | true | true |
1c22c59d1abb804311f144e43bfd49a613e084de | 1,676 | py | Python | Detection/FasterRCNN/install_data_and_model.py | mohabouje/cntk-hotel-pictures-classificator | a5b37dd90f5e7abf0c752b55b9b06951e4ffc4d1 | [
"MIT"
] | 28 | 2018-09-02T09:01:20.000Z | 2022-01-20T12:55:49.000Z | Detection/FasterRCNN/install_data_and_model.py | mohabouje/cntk-hotel-pictures-classificator | a5b37dd90f5e7abf0c752b55b9b06951e4ffc4d1 | [
"MIT"
] | 6 | 2018-01-24T10:21:00.000Z | 2018-04-17T17:39:17.000Z | Detection/FasterRCNN/install_data_and_model.py | karolzak/cntk-hotel-pictures-classificator | a5b37dd90f5e7abf0c752b55b9b06951e4ffc4d1 | [
"MIT"
] | 13 | 2018-09-02T09:01:23.000Z | 2020-11-20T23:00:29.000Z | # Copyright (c) Microsoft. All rights reserved.
# Licensed under the MIT license. See LICENSE.md file in the project root
# for full license information.
# ==============================================================================
from __future__ import print_function
import zipfile
import os, sys
from config imp... | 39.904762 | 96 | 0.71778 |
from __future__ import print_function
import zipfile
import os, sys
from config import cfg
def create_mappings(folder_path):
sys.path.append(os.path.join(folder_path, "..", "..", "Detection", "utils", "annotations"))
from annotations_helper import create_class_dict, create_map_files
abs_path = os.... | true | true |
1c22c682a2922c724ba22cc78cf3724042959038 | 672 | py | Python | qiskit/extensions/__init__.py | lerongil/qiskit-terra | a25af2a2378bc3d4f5ec73b948d048d1b707454c | [
"Apache-2.0"
] | 1 | 2019-10-14T00:59:19.000Z | 2019-10-14T00:59:19.000Z | qiskit/extensions/__init__.py | lerongil/qiskit-terra | a25af2a2378bc3d4f5ec73b948d048d1b707454c | [
"Apache-2.0"
] | null | null | null | qiskit/extensions/__init__.py | lerongil/qiskit-terra | a25af2a2378bc3d4f5ec73b948d048d1b707454c | [
"Apache-2.0"
] | null | null | null | # -*- coding: utf-8 -*-
# This code is part of Qiskit.
#
# (C) Copyright IBM 2017.
#
# This code is licensed under the Apache License, Version 2.0. You may
# obtain a copy of this license in the LICENSE.txt file in the root directory
# of this source tree or at http://www.apache.org/licenses/LICENSE-2.0.
#
# Any modif... | 33.6 | 77 | 0.760417 |
from qiskit.extensions.quantum_initializer.initializer import Initialize
from .standard import *
from .unitary import UnitaryGate
| true | true |
1c22c800da2f1847adb935fa38305f786d87dce6 | 3,284 | py | Python | basicWebScrapping/stateFarm/stateFarm/spiders/sfarms.py | SurendraTamang/Web-Scrapping | 2bb60cce9010b4b68f5c11bf295940832bb5df50 | [
"MIT"
] | null | null | null | basicWebScrapping/stateFarm/stateFarm/spiders/sfarms.py | SurendraTamang/Web-Scrapping | 2bb60cce9010b4b68f5c11bf295940832bb5df50 | [
"MIT"
] | null | null | null | basicWebScrapping/stateFarm/stateFarm/spiders/sfarms.py | SurendraTamang/Web-Scrapping | 2bb60cce9010b4b68f5c11bf295940832bb5df50 | [
"MIT"
] | 1 | 2022-01-18T17:15:51.000Z | 2022-01-18T17:15:51.000Z | # -*- coding: utf-8 -*-
import scrapy
from scrapy.linkextractors import LinkExtractor
from scrapy.spiders import CrawlSpider, Rule
class SfarmsSpider(CrawlSpider):
name = 'sfarms'
start_urls = ['https://www.statefarm.com/agent/us']
rules = (
Rule(LinkExtractor(restrict_xpaths="//div[@class='sfx-t... | 61.962264 | 419 | 0.592266 |
import scrapy
from scrapy.linkextractors import LinkExtractor
from scrapy.spiders import CrawlSpider, Rule
class SfarmsSpider(CrawlSpider):
name = 'sfarms'
start_urls = ['https://www.statefarm.com/agent/us']
rules = (
Rule(LinkExtractor(restrict_xpaths="//div[@class='sfx-text ']/a")),
Ru... | true | true |
1c22c8ebab30c4c0d09dcf0caede8c3e69346766 | 1,607 | py | Python | ResampleAndInterpolate.py | demmojo/ResampleAndInterpolate | c7730cf42b6dd55cb5cef331885d9adeae91c500 | [
"Apache-2.0"
] | null | null | null | ResampleAndInterpolate.py | demmojo/ResampleAndInterpolate | c7730cf42b6dd55cb5cef331885d9adeae91c500 | [
"Apache-2.0"
] | null | null | null | ResampleAndInterpolate.py | demmojo/ResampleAndInterpolate | c7730cf42b6dd55cb5cef331885d9adeae91c500 | [
"Apache-2.0"
] | null | null | null | # Copyright 2019 Blok-Z
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, soft... | 34.934783 | 120 | 0.761668 |
import pandas as pd
file = 'original.xlsx'
xl = pd.ExcelFile(file)
index = pd.date_range('2018-10-01', periods=17, freq='H')
original_data = xl.parse(xl.sheet_names[0], usecols=['Value'])
original_data.index = index
original_data.index.name = 'Date (Year-Month-Day Hour:Minute:Second'
interp... | true | true |
1c22c929cd67598c2ce82befddc5b65a6745d8b7 | 8,508 | py | Python | modules/TMC4671_TMC6100_TOSV_REF.py | trinamic/TOSV-UserInterface | 75c834bf0c059002900bc72153689d8a7e01e7d6 | [
"MIT"
] | 2 | 2020-05-06T11:44:10.000Z | 2020-12-16T10:02:04.000Z | modules/TMC4671_TMC6100_TOSV_REF.py | trinamic/TOSV-UserInterface | 75c834bf0c059002900bc72153689d8a7e01e7d6 | [
"MIT"
] | null | null | null | modules/TMC4671_TMC6100_TOSV_REF.py | trinamic/TOSV-UserInterface | 75c834bf0c059002900bc72153689d8a7e01e7d6 | [
"MIT"
] | null | null | null | '''
Created on 09.04.2020
@author: ED
'''
from PyTrinamic.helpers import TMC_helpers
class TMC4671_TMC6100_TOSV_REF(object):
def __init__(self, connection):
self.connection = connection
self.GPs = _GPs
self.APs = _APs
self.ENUMs = _ENUMs
self.motor = 0
def showChi... | 37.813333 | 132 | 0.561589 | from PyTrinamic.helpers import TMC_helpers
class TMC4671_TMC6100_TOSV_REF(object):
def __init__(self, connection):
self.connection = connection
self.GPs = _GPs
self.APs = _APs
self.ENUMs = _ENUMs
self.motor = 0
def showChipInfo(self):
print("TMC4671-TMC6100... | true | true |
1c22c94980cadd575a3a56a4aa695e7d25d94e73 | 7,877 | py | Python | model.py | ishine/AttEncDecRNN | 0225a964a55728afc0c30fe76d196dfa69ac11e1 | [
"MIT"
] | 3 | 2019-12-04T04:53:53.000Z | 2020-01-04T14:02:05.000Z | model.py | ishine/AttEncDecRNN | 0225a964a55728afc0c30fe76d196dfa69ac11e1 | [
"MIT"
] | 1 | 2022-01-11T16:35:47.000Z | 2022-01-11T16:35:47.000Z | model.py | P3n9W31/AttentionRNN | d64e3e294cd8ccfc1118b8e607955019a61e0628 | [
"MIT"
] | 2 | 2019-12-04T05:19:44.000Z | 2020-03-22T02:54:02.000Z | import torch
import torch.nn as nn
import torch.nn.functional as F
from beam import Beam
class EncoderRNN(nn.Module):
""""encode the input sequence with Bi-GRU"""
def __init__(self, num_input, num_hidden, num_token, padding_idx, emb_dropout, hid_dropout):
super(EncoderRNN, self).__init__()
s... | 38.802956 | 99 | 0.613939 | import torch
import torch.nn as nn
import torch.nn.functional as F
from beam import Beam
class EncoderRNN(nn.Module):
def __init__(self, num_input, num_hidden, num_token, padding_idx, emb_dropout, hid_dropout):
super(EncoderRNN, self).__init__()
self.num_hidden = num_hidden
self.emb = nn... | true | true |
1c22c95b30afae8fedbefced396250e42e32bb2d | 2,636 | py | Python | app.py | yasiwang0315/backend-example | 8394686bd849be94afcff4e2c2b4342b1c6abff9 | [
"MIT"
] | null | null | null | app.py | yasiwang0315/backend-example | 8394686bd849be94afcff4e2c2b4342b1c6abff9 | [
"MIT"
] | null | null | null | app.py | yasiwang0315/backend-example | 8394686bd849be94afcff4e2c2b4342b1c6abff9 | [
"MIT"
] | null | null | null | from flask import Flask, jsonify, request
import json
import os
import time
from flask_pymongo import PyMongo
from flask_cors import CORS
import dns
import pymongo
# create the app
app = Flask(__name__)
app.config["MONGO_URI"] = "mongodb+srv://maizie:qwertyuiop123@gene.njw4a.mongodb.net/Gene?retryWrites=true&w=majo... | 30.298851 | 134 | 0.52352 | from flask import Flask, jsonify, request
import json
import os
import time
from flask_pymongo import PyMongo
from flask_cors import CORS
import dns
import pymongo
app = Flask(__name__)
app.config["MONGO_URI"] = "mongodb+srv://maizie:qwertyuiop123@gene.njw4a.mongodb.net/Gene?retryWrites=true&w=majority"
CORS(app)
... | true | true |
1c22ca44d5b45ca6ae69c885b65a9ca9cfa6604a | 187 | py | Python | notebooks/readme.py | cmx/cmx-python | 02d2b71ac3d7d640764c8b0778018468d8abe337 | [
"MIT"
] | 1 | 2021-07-27T13:25:14.000Z | 2021-07-27T13:25:14.000Z | notebooks/readme.py | cmx/cmx-python | 02d2b71ac3d7d640764c8b0778018468d8abe337 | [
"MIT"
] | null | null | null | notebooks/readme.py | cmx/cmx-python | 02d2b71ac3d7d640764c8b0778018468d8abe337 | [
"MIT"
] | null | null | null | """
# Introducing CMX, using Python Scripts as live documents.
## CMX-python In Action
"""
from cmx import doc
doc.video(url="https://")
if __name__ == '__main__':
print(__doc__) | 14.384615 | 58 | 0.673797 | from cmx import doc
doc.video(url="https://")
if __name__ == '__main__':
print(__doc__) | true | true |
1c22ca4ba437fd766d0d7d6da18a8e810c47b05a | 1,605 | py | Python | src/Guidance_system/guidance_sys/camera.py | Joseph-tsai415/Msc-All-Terrain-Robot | 40973b8d1b088d37efc372f6313ee58d18792c02 | [
"MIT"
] | null | null | null | src/Guidance_system/guidance_sys/camera.py | Joseph-tsai415/Msc-All-Terrain-Robot | 40973b8d1b088d37efc372f6313ee58d18792c02 | [
"MIT"
] | null | null | null | src/Guidance_system/guidance_sys/camera.py | Joseph-tsai415/Msc-All-Terrain-Robot | 40973b8d1b088d37efc372f6313ee58d18792c02 | [
"MIT"
] | null | null | null |
import numpy as np
import cv2, os
from cv2 import aruco
from picamera.array import PiRGBArray
from picamera import PiCamera
import time
class camera():
"""
The class called camera is initialised with constants appropriate
for the given target Calibration
"""
def __init__(self,w=640,h=480,frame... | 25.078125 | 97 | 0.585047 |
import numpy as np
import cv2, os
from cv2 import aruco
from picamera.array import PiRGBArray
from picamera import PiCamera
import time
class camera():
def __init__(self,w=640,h=480,framerate=32,frame=None):
self.w = w
self.h = h
self.framerate = framerate
self.setup_cam()
... | true | true |
1c22ca612c7f00fc6694b97e0e614dfba32ca0b5 | 8,563 | py | Python | fullsimple/test.py | habibutsu/tapl-py | 8c33255cd1995b75ee006c91e2a6179429843339 | [
"MIT"
] | null | null | null | fullsimple/test.py | habibutsu/tapl-py | 8c33255cd1995b75ee006c91e2a6179429843339 | [
"MIT"
] | null | null | null | fullsimple/test.py | habibutsu/tapl-py | 8c33255cd1995b75ee006c91e2a6179429843339 | [
"MIT"
] | null | null | null | import unittest
from parser import Parser
from lexer import Lexer
import syntax
import core
class LexerTestCase(unittest.TestCase):
def setUp(self):
self.lexer = Lexer()
def lexer_tokens(self, input):
self.lexer.lexer.input(input)
tokens = []
while True:
tok = self... | 32.313208 | 86 | 0.564639 | import unittest
from parser import Parser
from lexer import Lexer
import syntax
import core
class LexerTestCase(unittest.TestCase):
def setUp(self):
self.lexer = Lexer()
def lexer_tokens(self, input):
self.lexer.lexer.input(input)
tokens = []
while True:
tok = self... | true | true |
1c22cbe98cf40ff56c44ffb2077fc3239b9f6668 | 112,994 | py | Python | python/cuml/_thirdparty/sklearn/preprocessing/_data.py | tzemicheal/cuml | 377f3c2773e3fc64d93d3d64a3f2fcd6c8759044 | [
"Apache-2.0"
] | 1 | 2021-01-01T10:52:18.000Z | 2021-01-01T10:52:18.000Z | python/cuml/_thirdparty/sklearn/preprocessing/_data.py | tzemicheal/cuml | 377f3c2773e3fc64d93d3d64a3f2fcd6c8759044 | [
"Apache-2.0"
] | null | null | null | python/cuml/_thirdparty/sklearn/preprocessing/_data.py | tzemicheal/cuml | 377f3c2773e3fc64d93d3d64a3f2fcd6c8759044 | [
"Apache-2.0"
] | null | null | null | # Original authors from Sckit-Learn:
# Alexandre Gramfort <alexandre.gramfort@inria.fr>
# Mathieu Blondel <mathieu@mblondel.org>
# Olivier Grisel <olivier.grisel@ensta.org>
# Andreas Mueller <amueller@ais.uni-bonn.de>
# Eric Martin <eric@ericmart.in>
# Giorgio Patri... | 36.379266 | 84 | 0.590562 |
from itertools import chain, combinations
import numbers
import warnings
from itertools import combinations_with_replacement as combinations_w_r
import cupy as np
from cupy import sparse
from scipy import stats
from scipy import optimize
from scipy.special import boxcox
from ..utils.skl_dependencies ... | true | true |
1c22cc1eca35ddb9c6ad55e0fd594d5dc507b939 | 104 | py | Python | src/utils/info_path.py | DoraemonShare/yuqing4test | 6dc840c645532b98bedc889458d93da286076edc | [
"BSD-3-Clause"
] | 1 | 2017-07-27T03:09:16.000Z | 2017-07-27T03:09:16.000Z | src/utils/info_path.py | DoraemonShare/yuqing | 01a1a904c3c2efe447b2e212958e0a7112482439 | [
"BSD-3-Clause"
] | null | null | null | src/utils/info_path.py | DoraemonShare/yuqing | 01a1a904c3c2efe447b2e212958e0a7112482439 | [
"BSD-3-Clause"
] | null | null | null | #-*-coding:utf-8 -*-
local_data_prefix = '/media/zgy/NoUSB/extra_project/python/yuqing_pipeline/data/' | 26 | 81 | 0.75 |
local_data_prefix = '/media/zgy/NoUSB/extra_project/python/yuqing_pipeline/data/' | true | true |
1c22cc90a624eb390ef6dbb8780ef48e80a26d96 | 1,600 | py | Python | cmsplugin_cascade/generic/simple_wrapper.py | aDENTinTIME/djangocms-cascade | c38c1c5ad052dbe233b50fb833ad8e9a919014f2 | [
"MIT"
] | null | null | null | cmsplugin_cascade/generic/simple_wrapper.py | aDENTinTIME/djangocms-cascade | c38c1c5ad052dbe233b50fb833ad8e9a919014f2 | [
"MIT"
] | null | null | null | cmsplugin_cascade/generic/simple_wrapper.py | aDENTinTIME/djangocms-cascade | c38c1c5ad052dbe233b50fb833ad8e9a919014f2 | [
"MIT"
] | null | null | null | from django.forms import ChoiceField
from django.utils.html import format_html
from django.utils.translation import ugettext_lazy as _
from cms.plugin_pool import plugin_pool
from entangled.forms import EntangledModelFormMixin
from cmsplugin_cascade.plugin_base import CascadePluginBase, TransparentContainer
class Si... | 34.782609 | 111 | 0.705625 | from django.forms import ChoiceField
from django.utils.html import format_html
from django.utils.translation import ugettext_lazy as _
from cms.plugin_pool import plugin_pool
from entangled.forms import EntangledModelFormMixin
from cmsplugin_cascade.plugin_base import CascadePluginBase, TransparentContainer
class Si... | true | true |
1c22ccb8779f7f6bcff943d316db2de4f3ed1685 | 627 | py | Python | regexlib/2021-5-15/python_re2_test_file/regexlib_1225.py | yetingli/ReDoS-Benchmarks | f5b5094d835649e957bf3fec6b8bd4f6efdb35fc | [
"MIT"
] | 1 | 2022-01-24T14:43:23.000Z | 2022-01-24T14:43:23.000Z | regexlib/2021-5-15/python_re2_test_file/regexlib_1225.py | yetingli/ReDoS-Benchmarks | f5b5094d835649e957bf3fec6b8bd4f6efdb35fc | [
"MIT"
] | null | null | null | regexlib/2021-5-15/python_re2_test_file/regexlib_1225.py | yetingli/ReDoS-Benchmarks | f5b5094d835649e957bf3fec6b8bd4f6efdb35fc | [
"MIT"
] | null | null | null | # 1225
# ^([a-zA-Z0-9]+)([\._-]?[a-zA-Z0-9]+)*@([a-zA-Z0-9]+)([\._-]?[a-zA-Z0-9]+)*([\.]{1}[a-zA-Z0-9]{2,})+$
# EXPONENT
# nums:5
# EXPONENT AttackString:"a"+"0"*32+"!1 __NQ"
import re2 as re
from time import perf_counter
regex = """^([a-zA-Z0-9]+)([\._-]?[a-zA-Z0-9]+)*@([a-zA-Z0-9]+)([\._-]?[a-zA-Z0-9]+)*([\.]{1}[a-... | 33 | 114 | 0.519936 |
import re2 as re
from time import perf_counter
regex = """^([a-zA-Z0-9]+)([\._-]?[a-zA-Z0-9]+)*@([a-zA-Z0-9]+)([\._-]?[a-zA-Z0-9]+)*([\.]{1}[a-zA-Z0-9]{2,})+$"""
REGEX = re.compile(regex)
for i in range(0, 150000):
ATTACK = "a" + "0" * i * 1 + "!1 __NQ"
LEN = len(ATTACK)
BEGIN = perf_counter()
m ... | true | true |
1c22ccc5d66c4b2b570bde85cd23cc3698f35d77 | 742 | py | Python | ipt/sorting/bulles.py | lucas8/MPSI | edefa2155071910d95633acf87b9f3a9d34f67d3 | [
"MIT"
] | null | null | null | ipt/sorting/bulles.py | lucas8/MPSI | edefa2155071910d95633acf87b9f3a9d34f67d3 | [
"MIT"
] | null | null | null | ipt/sorting/bulles.py | lucas8/MPSI | edefa2155071910d95633acf87b9f3a9d34f67d3 | [
"MIT"
] | null | null | null | #!/usr/bin/python3
from random import shuffle, randint
nb = 5000
def swap_if(a, i):
if a[i] > a[i+1]:
a[i], a[i+1] = a[i+1], a[i]
return 1
else:
return 0
def sort_pass(a):
swaps = 0
for i in range(len(a) - 1):
swaps += swap_if(a, i)
if swaps == 0:
return Fa... | 19.526316 | 78 | 0.498652 |
from random import shuffle, randint
nb = 5000
def swap_if(a, i):
if a[i] > a[i+1]:
a[i], a[i+1] = a[i+1], a[i]
return 1
else:
return 0
def sort_pass(a):
swaps = 0
for i in range(len(a) - 1):
swaps += swap_if(a, i)
if swaps == 0:
return False
else:
... | true | true |
1c22cd983d579f097afc09fb2ad4ead8a1a84222 | 1,491 | py | Python | learning_transforms/speed_training_plot.py | sfox14/butterfly | 13cc15cee5bdb7adaf376219aaf20fab0459e9ef | [
"Apache-2.0"
] | 52 | 2020-08-05T08:32:24.000Z | 2022-03-27T21:56:34.000Z | learning_transforms/speed_training_plot.py | sfox14/butterfly | 13cc15cee5bdb7adaf376219aaf20fab0459e9ef | [
"Apache-2.0"
] | 13 | 2020-09-14T23:34:32.000Z | 2022-02-15T10:51:03.000Z | learning_transforms/speed_training_plot.py | sfox14/butterfly | 13cc15cee5bdb7adaf376219aaf20fab0459e9ef | [
"Apache-2.0"
] | 11 | 2020-10-15T07:03:25.000Z | 2022-03-25T12:03:49.000Z | import pickle
import numpy as np
import matplotlib.pyplot as plt
plt.switch_backend('agg')
import matplotlib.patches as mpatches
plt.rcParams['font.family'] = 'serif'
rs = [1]
markers = ['o', 'v', 'D', 'p', 's', '>']
loc = 'speed_training_data.pkl'
data = pickle.load(open(loc,'rb'))
colors = ['red', 'orange', 'green'... | 31.723404 | 125 | 0.716298 | import pickle
import numpy as np
import matplotlib.pyplot as plt
plt.switch_backend('agg')
import matplotlib.patches as mpatches
plt.rcParams['font.family'] = 'serif'
rs = [1]
markers = ['o', 'v', 'D', 'p', 's', '>']
loc = 'speed_training_data.pkl'
data = pickle.load(open(loc,'rb'))
colors = ['red', 'orange', 'green'... | true | true |
1c22cde5ec327145b3d4793e5e7515237652ffc3 | 3,397 | py | Python | pyts/datasets/tests/test_make.py | Pandinosaurus/pyts | 1e584877bc3f06194ceb530a156d8a10e32c12a5 | [
"BSD-3-Clause"
] | 1,217 | 2017-08-15T09:50:11.000Z | 2022-03-28T23:45:58.000Z | pyts/datasets/tests/test_make.py | bassemfg/pyts | 1e584877bc3f06194ceb530a156d8a10e32c12a5 | [
"BSD-3-Clause"
] | 113 | 2018-01-11T06:29:18.000Z | 2022-03-02T00:00:28.000Z | pyts/datasets/tests/test_make.py | bassemfg/pyts | 1e584877bc3f06194ceb530a156d8a10e32c12a5 | [
"BSD-3-Clause"
] | 138 | 2017-11-23T14:11:33.000Z | 2022-03-29T12:41:18.000Z | """Testing for datatset generation."""
# Author: Johann Faouzi <johann.faouzi@gmail.com>
# License: BSD-3-Clause
import numpy as np
import pytest
import re
from pyts.datasets import make_cylinder_bell_funnel
@pytest.mark.parametrize(
'params, error, err_msg',
[({'n_samples': '3'}, TypeError, "'n_samples' mu... | 39.045977 | 79 | 0.622314 |
import numpy as np
import pytest
import re
from pyts.datasets import make_cylinder_bell_funnel
@pytest.mark.parametrize(
'params, error, err_msg',
[({'n_samples': '3'}, TypeError, "'n_samples' must be an integer."),
({'n_samples': -1}, ValueError,
"'n_samples' must be a positive integer."),
... | true | true |
1c22cdf9db9d0225b1be8526850b9566303b9d27 | 6,401 | py | Python | cms/middleware/toolbar.py | USGM/django-cms-new | 27b0dc4a505377962174b9a2fefb02635f896ea1 | [
"BSD-3-Clause"
] | null | null | null | cms/middleware/toolbar.py | USGM/django-cms-new | 27b0dc4a505377962174b9a2fefb02635f896ea1 | [
"BSD-3-Clause"
] | null | null | null | cms/middleware/toolbar.py | USGM/django-cms-new | 27b0dc4a505377962174b9a2fefb02635f896ea1 | [
"BSD-3-Clause"
] | 1 | 2018-12-10T13:34:52.000Z | 2018-12-10T13:34:52.000Z | # -*- coding: utf-8 -*-
"""
Edit Toolbar middleware
"""
from classytags.utils import flatten_context
from django.contrib.admin.models import LogEntry, ADDITION, CHANGE
from django.core.urlresolvers import resolve
from django.http import HttpResponse
from django.template.loader import render_to_string
from cms.toolbar.... | 41.836601 | 108 | 0.643493 |
from classytags.utils import flatten_context
from django.contrib.admin.models import LogEntry, ADDITION, CHANGE
from django.core.urlresolvers import resolve
from django.http import HttpResponse
from django.template.loader import render_to_string
from cms.toolbar.toolbar import CMSToolbar
from cms.utils.conf import ge... | true | true |
1c22ce79293a285e577b8cfaa10fafd800ae3005 | 2,590 | py | Python | Server/CPU_Monitor/app.py | laplacetw/flask-cpu-monitor | 4ed851ad72f71bcae9fa6c65b60d328c4d11f053 | [
"MIT"
] | 4 | 2020-12-07T14:21:12.000Z | 2022-01-06T11:51:17.000Z | Server/CPU_Monitor/app.py | laplacetw/flask-cpu-monitor | 4ed851ad72f71bcae9fa6c65b60d328c4d11f053 | [
"MIT"
] | null | null | null | Server/CPU_Monitor/app.py | laplacetw/flask-cpu-monitor | 4ed851ad72f71bcae9fa6c65b60d328c4d11f053 | [
"MIT"
] | 1 | 2020-04-16T17:00:46.000Z | 2020-04-16T17:00:46.000Z | #!/usr/bin/env python3
# coding:utf-8
import atexit, psutil, time, logging
from logging.handlers import RotatingFileHandler
from flask import Flask, jsonify, request, render_template
from apscheduler.schedulers.background import BackgroundScheduler
from sqlite import *
app = Flask(__name__)
real_time = {}... | 33.205128 | 105 | 0.609266 |
import atexit, psutil, time, logging
from logging.handlers import RotatingFileHandler
from flask import Flask, jsonify, request, render_template
from apscheduler.schedulers.background import BackgroundScheduler
from sqlite import *
app = Flask(__name__)
real_time = {}
conn = connect()
scheduler = Backg... | true | true |
1c22d05d34dee67c1e1e6b61be7aede642fee6a0 | 208 | py | Python | home/views.py | wdamon/tenants_talk | f5ccd85bc0b3a987c3f9183e47658ab20e70ca67 | [
"MIT"
] | 2 | 2017-05-13T19:24:39.000Z | 2020-04-19T17:34:28.000Z | home/views.py | wdamon/tenants_talk | f5ccd85bc0b3a987c3f9183e47658ab20e70ca67 | [
"MIT"
] | null | null | null | home/views.py | wdamon/tenants_talk | f5ccd85bc0b3a987c3f9183e47658ab20e70ca67 | [
"MIT"
] | null | null | null | from django.shortcuts import render
from django.template import RequestContext
def home(request):
return render(request, 'home/index.html')
def about(request):
return render(request, 'home/about.html') | 26 | 45 | 0.778846 | from django.shortcuts import render
from django.template import RequestContext
def home(request):
return render(request, 'home/index.html')
def about(request):
return render(request, 'home/about.html') | true | true |
1c22d22dd8f02feb3353f8c76ad4d4594d162168 | 3,345 | py | Python | experiments/ashvin/icml2020/hand/pen/phases/sac_bc2.py | Asap7772/railrl_evalsawyer | baba8ce634d32a48c7dfe4dc03b123e18e96e0a3 | [
"MIT"
] | null | null | null | experiments/ashvin/icml2020/hand/pen/phases/sac_bc2.py | Asap7772/railrl_evalsawyer | baba8ce634d32a48c7dfe4dc03b123e18e96e0a3 | [
"MIT"
] | null | null | null | experiments/ashvin/icml2020/hand/pen/phases/sac_bc2.py | Asap7772/railrl_evalsawyer | baba8ce634d32a48c7dfe4dc03b123e18e96e0a3 | [
"MIT"
] | null | null | null | """
AWR + SAC from demo experiment
"""
from rlkit.demos.source.dict_to_mdp_path_loader import DictToMDPPathLoader
from rlkit.launchers.experiments.awac.awac_rl import experiment
import rlkit.misc.hyperparameter as hyp
from rlkit.launchers.arglauncher import run_variants
if __name__ == "__main__":
variant = dict(... | 28.589744 | 74 | 0.571001 |
from rlkit.demos.source.dict_to_mdp_path_loader import DictToMDPPathLoader
from rlkit.launchers.experiments.awac.awac_rl import experiment
import rlkit.misc.hyperparameter as hyp
from rlkit.launchers.arglauncher import run_variants
if __name__ == "__main__":
variant = dict(
num_epochs=1001,
num_e... | true | true |
1c22d2c0aff59ae4f4dfc4bed4d9382021148fdc | 2,922 | py | Python | python/pip_install/pip_compile.py | reiyw/rules_python | c6970fc44877dbbbce84d17845d9bc797aefe299 | [
"Apache-2.0"
] | 1 | 2020-09-23T17:26:48.000Z | 2020-09-23T17:26:48.000Z | python/pip_install/pip_compile.py | reiyw/rules_python | c6970fc44877dbbbce84d17845d9bc797aefe299 | [
"Apache-2.0"
] | 1 | 2020-05-07T07:13:41.000Z | 2020-05-07T07:13:41.000Z | python/pip_install/pip_compile.py | reiyw/rules_python | c6970fc44877dbbbce84d17845d9bc797aefe299 | [
"Apache-2.0"
] | 1 | 2020-10-06T17:06:32.000Z | 2020-10-06T17:06:32.000Z | "Set defaults for the pip-compile command to run it under Bazel"
import os
import sys
from shutil import copyfile
from piptools.scripts.compile import cli
if len(sys.argv) < 4:
print(
"Expected at least two arguments: requirements_in requirements_out",
file=sys.stderr,
)
sys.exit(1)
requ... | 32.466667 | 117 | 0.673854 |
import os
import sys
from shutil import copyfile
from piptools.scripts.compile import cli
if len(sys.argv) < 4:
print(
"Expected at least two arguments: requirements_in requirements_out",
file=sys.stderr,
)
sys.exit(1)
requirements_in = os.path.relpath(sys.argv.pop(1))
requirements_txt =... | true | true |
1c22d4cde55a9575cb808a60f39f562dc53e1ad7 | 10,834 | py | Python | third_party/blink/tools/blinkpy/common/system/profiler.py | Ron423c/chromium | 2edf7b980065b648f8b2a6e52193d83832fe36b7 | [
"BSD-3-Clause-No-Nuclear-License-2014",
"BSD-3-Clause"
] | 575 | 2015-06-18T23:58:20.000Z | 2022-03-23T09:32:39.000Z | third_party/blink/tools/blinkpy/common/system/profiler.py | Ron423c/chromium | 2edf7b980065b648f8b2a6e52193d83832fe36b7 | [
"BSD-3-Clause-No-Nuclear-License-2014",
"BSD-3-Clause"
] | 113 | 2015-05-04T09:58:14.000Z | 2022-01-31T19:35:03.000Z | third_party/blink/tools/blinkpy/common/system/profiler.py | DamieFC/chromium | 54ce2d3c77723697efd22cfdb02aea38f9dfa25c | [
"BSD-3-Clause-No-Nuclear-License-2014",
"BSD-3-Clause"
] | 52 | 2015-07-14T10:40:50.000Z | 2022-03-15T01:11:49.000Z | # Copyright (C) 2012 Google 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:
#
# * Redistributions of source code must retain the above copyright
# notice, this list of conditions and the ... | 40.729323 | 119 | 0.635869 |
import re
import itertools
class ProfilerFactory(object):
@classmethod
def create_profiler(cls,
host,
executable_path,
output_dir,
profiler_name=None,
identifier=... | true | true |
1c22d51b80613df3984bc1df2479a96d5e019278 | 2,205 | py | Python | Probability-of-the-Loan-Defaulters/code.py | GitPrakhar112/dsmp-pre-work | 6056e5d4b3c6efc84d0f14b57a595528f4e30fe5 | [
"MIT"
] | 3 | 2020-04-30T05:07:43.000Z | 2020-05-23T12:33:00.000Z | Probability-of-the-Loan-Defaulters/code.py | GitPrakhar112/dsmp-pre-work | 6056e5d4b3c6efc84d0f14b57a595528f4e30fe5 | [
"MIT"
] | null | null | null | Probability-of-the-Loan-Defaulters/code.py | GitPrakhar112/dsmp-pre-work | 6056e5d4b3c6efc84d0f14b57a595528f4e30fe5 | [
"MIT"
] | 2 | 2020-04-30T06:09:06.000Z | 2020-05-23T14:59:27.000Z | # --------------
import numpy as np
import pandas as pd
import matplotlib.pyplot as plt
# Load the dataframe
df = pd.read_csv(path)
# probability of fico score greater than 700
p_a = df[df['fico'].astype(float) >700].shape[0]/df.shape[0]
print(p_a)
# probability of purpose == debt_consolidation
p_b = df[df['purpo... | 23.967391 | 80 | 0.689796 |
import numpy as np
import pandas as pd
import matplotlib.pyplot as plt
df = pd.read_csv(path)
p_a = df[df['fico'].astype(float) >700].shape[0]/df.shape[0]
print(p_a)
p_b = df[df['purpose']== 'debt_consolidation'].shape[0]/df.shape[0]
print(p_b)
df1 = df[df['purpose']== 'debt_consolidation']
p_a_b = df1[df1... | true | true |
1c22d5d06c18beca4e74fda4bce7cde14ca6f82a | 924 | py | Python | lintcode/NineChapters/03/binary-tree-preorder-traversal.py | shootsoft/practice | 49f28c2e0240de61d00e4e0291b3c5edd930e345 | [
"Apache-2.0"
] | null | null | null | lintcode/NineChapters/03/binary-tree-preorder-traversal.py | shootsoft/practice | 49f28c2e0240de61d00e4e0291b3c5edd930e345 | [
"Apache-2.0"
] | null | null | null | lintcode/NineChapters/03/binary-tree-preorder-traversal.py | shootsoft/practice | 49f28c2e0240de61d00e4e0291b3c5edd930e345 | [
"Apache-2.0"
] | null | null | null | __author__ = 'yinjun'
"""
Definition of TreeNode:
class TreeNode:
def __init__(self, val):
this.val = val
this.left, this.right = None, None
"""
class Solution:
"""
@param root: The root of binary tree.
@return: Preorder in ArrayList which contains node values.
"""
def preorde... | 19.659574 | 62 | 0.424242 | __author__ = 'yinjun'
class Solution:
def preorderTraversal(self, root):
stack = []
result = []
if root == None:
return result
stack.append(root)
l = 1
while l>0:
p = stack.pop()
... | true | true |
1c22d618703de53b3b68b01f73555dfe3df57298 | 8,568 | py | Python | heron/tools/tracker/src/python/handlers/basehandler.py | zhengyangtean/CG4001_Heron_ElasticBolt | e471593c265088996d485e2dd11c9f2484876568 | [
"Apache-2.0"
] | 1 | 2017-11-06T08:23:43.000Z | 2017-11-06T08:23:43.000Z | heron/tools/tracker/src/python/handlers/basehandler.py | zhengyangtean/CG4001_Heron_ElasticBolt | e471593c265088996d485e2dd11c9f2484876568 | [
"Apache-2.0"
] | null | null | null | heron/tools/tracker/src/python/handlers/basehandler.py | zhengyangtean/CG4001_Heron_ElasticBolt | e471593c265088996d485e2dd11c9f2484876568 | [
"Apache-2.0"
] | null | null | null | # Copyright 2016 Twitter. All rights reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agree... | 32.089888 | 87 | 0.715453 |
import time
import tornado.escape
import tornado.web
from heron.tools.tracker.src.python import constants
class BaseHandler(tornado.web.RequestHandler):
def set_default_headers(self):
self.set_header("Access-Control-Allow-Origin", "*")
def prepare(self):
self.basehandler_starttime = ti... | true | true |
1c22d9e7f5c98371190b06d58ff6a04972e0b388 | 5,733 | py | Python | tests/test_cli.py | GeoffRichards/pyjwt | ec17f67c54d2d6c91def8ced366a88a8c797b110 | [
"MIT"
] | null | null | null | tests/test_cli.py | GeoffRichards/pyjwt | ec17f67c54d2d6c91def8ced366a88a8c797b110 | [
"MIT"
] | null | null | null | tests/test_cli.py | GeoffRichards/pyjwt | ec17f67c54d2d6c91def8ced366a88a8c797b110 | [
"MIT"
] | null | null | null | import argparse
import json
import sys
import pytest
import jwt
from jwt.__main__ import build_argparser, decode_payload, encode_payload, main
class TestCli:
def test_build_argparse(self):
args = ["--key", "1234", "encode", "name=Vader"]
parser = build_argparser()
parsed_args = parser.pa... | 32.207865 | 79 | 0.586604 | import argparse
import json
import sys
import pytest
import jwt
from jwt.__main__ import build_argparser, decode_payload, encode_payload, main
class TestCli:
def test_build_argparse(self):
args = ["--key", "1234", "encode", "name=Vader"]
parser = build_argparser()
parsed_args = parser.pa... | true | true |
1c22da7f2e838cd626b53239a722593c85810f16 | 140 | py | Python | whyme?/whynot/love/apps.py | supergidii/blogpro | 6fa1600042ffccaf25fde6a8963916369e932521 | [
"MIT"
] | null | null | null | whyme?/whynot/love/apps.py | supergidii/blogpro | 6fa1600042ffccaf25fde6a8963916369e932521 | [
"MIT"
] | null | null | null | whyme?/whynot/love/apps.py | supergidii/blogpro | 6fa1600042ffccaf25fde6a8963916369e932521 | [
"MIT"
] | null | null | null | from django.apps import AppConfig
class LoveConfig(AppConfig):
default_auto_field = 'django.db.models.BigAutoField'
name = 'love'
| 20 | 56 | 0.75 | from django.apps import AppConfig
class LoveConfig(AppConfig):
default_auto_field = 'django.db.models.BigAutoField'
name = 'love'
| true | true |
1c22dbe3bbe8360cc623fef407d07eacffe1cd54 | 13,875 | py | Python | env/lib/python2.7/site-packages/grpc/beta/_server_adaptations.py | husky-parul/SheHacks | 19383029947f50ebaf07232c9b2ee76c75d8ada6 | [
"Apache-2.0"
] | 2 | 2018-02-01T06:30:24.000Z | 2018-04-12T15:39:56.000Z | env/lib/python2.7/site-packages/grpc/beta/_server_adaptations.py | husky-parul/SheHacks | 19383029947f50ebaf07232c9b2ee76c75d8ada6 | [
"Apache-2.0"
] | null | null | null | env/lib/python2.7/site-packages/grpc/beta/_server_adaptations.py | husky-parul/SheHacks | 19383029947f50ebaf07232c9b2ee76c75d8ada6 | [
"Apache-2.0"
] | null | null | null | # Copyright 2016 gRPC authors.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing... | 36.417323 | 82 | 0.667676 |
import collections
import threading
import grpc
from grpc import _common
from grpc.beta import _metadata
from grpc.beta import interfaces
from grpc.framework.common import cardinality
from grpc.framework.common import style
from grpc.framework.foundation import abandonment
from grpc.framework.foundation ... | true | true |
1c22dc0b406f40dc1a6cd2c6f29546cf1a130dc6 | 1,328 | py | Python | snackbot/discord_client/cogs/rng.py | bmize/snackbot | 2d91d22e077a33c9bae25d261675477874b80b05 | [
"MIT"
] | null | null | null | snackbot/discord_client/cogs/rng.py | bmize/snackbot | 2d91d22e077a33c9bae25d261675477874b80b05 | [
"MIT"
] | null | null | null | snackbot/discord_client/cogs/rng.py | bmize/snackbot | 2d91d22e077a33c9bae25d261675477874b80b05 | [
"MIT"
] | null | null | null | """ rng.py
Bot commands involving random chance
"""
from collections import namedtuple
import random
from discord.ext import commands
from discord_client.utils import dnd
class RNG(commands.Cog):
def __init__(self, bot):
self.bot = bot
"""
@commands.group(pass_context=True)
async def rng(se... | 28.255319 | 84 | 0.53991 |
from collections import namedtuple
import random
from discord.ext import commands
from discord_client.utils import dnd
class RNG(commands.Cog):
def __init__(self, bot):
self.bot = bot
@commands.command()
async def lenny(self, ctx):
lenny = random.choice([
"( ͡° ͜ʖ ͡°)", "( ͠... | true | true |
1c22dc264214076116a13351dfafa933011fee26 | 19,050 | py | Python | koi_imaging.py | timothydmorton/fpp-old | 6a2175d4bd9648b61c244c7463148632f36de631 | [
"MIT"
] | null | null | null | koi_imaging.py | timothydmorton/fpp-old | 6a2175d4bd9648b61c244c7463148632f36de631 | [
"MIT"
] | null | null | null | koi_imaging.py | timothydmorton/fpp-old | 6a2175d4bd9648b61c244c7463148632f36de631 | [
"MIT"
] | null | null | null | import numpy as np
import re,os,os.path,glob,sys
import pandas as pd
import matplotlib.pyplot as plt
import transitFPP as fpp
import koiutils as ku
import plotutils as plu
IMAGINGDIR = '%s/data/imaging' % os.environ['KEPLERDIR']
CFOPDIR = '{}/cfop'.format(IMAGINGDIR)
#CIARDIDIR = '%s/ciardi' % IMAGINGDIR
ROBOAO_TAR... | 33.83659 | 106 | 0.50063 | import numpy as np
import re,os,os.path,glob,sys
import pandas as pd
import matplotlib.pyplot as plt
import transitFPP as fpp
import koiutils as ku
import plotutils as plu
IMAGINGDIR = '%s/data/imaging' % os.environ['KEPLERDIR']
CFOPDIR = '{}/cfop'.format(IMAGINGDIR)
ROBOAO_TARGETFILE = '%s/RoboAO_y1.txt' % IMAGIN... | false | true |
1c22dc7f63e837ebda13b8345d9e0802ff2ea94f | 4,853 | py | Python | pydocmd/imp.py | Pandinosaurus/pydoc-markdown | 38a6b48edfc132586aef7b5a71c5fccce62a9518 | [
"MIT"
] | null | null | null | pydocmd/imp.py | Pandinosaurus/pydoc-markdown | 38a6b48edfc132586aef7b5a71c5fccce62a9518 | [
"MIT"
] | null | null | null | pydocmd/imp.py | Pandinosaurus/pydoc-markdown | 38a6b48edfc132586aef7b5a71c5fccce62a9518 | [
"MIT"
] | null | null | null | # Copyright (c) 2017 Niklas Rosenstein
#
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the "Software"), to deal
# in the Software without restriction, including without limitation the rights
# to use, copy, modify, merge, publish, ... | 33.937063 | 99 | 0.699773 |
import types
import inspect
def import_module(name):
return __import__(name, fromlist=[''])
def import_object(name):
return import_object_with_scope(name)[0]
def import_object_with_scope(name):
parts = name.split('.')
current_name = parts[0]
obj = import_module(current... | true | true |
1c22dd2569f7f7b036916984530a8a5b70b22735 | 13,017 | py | Python | selfdrive/car/gm/values.py | envy0416/yangmin080 | bcee0d4df9ca0290a6c36e0c2b7fc987651879ce | [
"MIT"
] | 1 | 2020-05-22T10:40:38.000Z | 2020-05-22T10:40:38.000Z | selfdrive/car/gm/values.py | envy0416/yangmin080 | bcee0d4df9ca0290a6c36e0c2b7fc987651879ce | [
"MIT"
] | null | null | null | selfdrive/car/gm/values.py | envy0416/yangmin080 | bcee0d4df9ca0290a6c36e0c2b7fc987651879ce | [
"MIT"
] | 1 | 2020-07-21T08:52:20.000Z | 2020-07-21T08:52:20.000Z | from cereal import car
from selfdrive.car import dbc_dict
Ecu = car.CarParams.Ecu
class CAR:
HOLDEN_ASTRA = "HOLDEN ASTRA RS-V BK 2017"
VOLT = "CHEVROLET VOLT PREMIER 2017"
CADILLAC_ATS = "CADILLAC ATS Premium Performance 2018"
MALIBU = "CHEVROLET MALIBU PREMIER 2017"
ACADIA = "GMC ACADIA DENALI 2018"
BUIC... | 127.617647 | 1,265 | 0.546209 | from cereal import car
from selfdrive.car import dbc_dict
Ecu = car.CarParams.Ecu
class CAR:
HOLDEN_ASTRA = "HOLDEN ASTRA RS-V BK 2017"
VOLT = "CHEVROLET VOLT PREMIER 2017"
CADILLAC_ATS = "CADILLAC ATS Premium Performance 2018"
MALIBU = "CHEVROLET MALIBU PREMIER 2017"
ACADIA = "GMC ACADIA DENALI 2018"
BUIC... | true | true |
1c22ddaeef496695098bc84b935ddce15ee42803 | 2,823 | py | Python | iceworm/trees/nodes/exprs.py | wrmsr0/iceworm | 09431bb3cdc4f6796aafca41e37d42ebe0ddfeef | [
"BSD-3-Clause"
] | null | null | null | iceworm/trees/nodes/exprs.py | wrmsr0/iceworm | 09431bb3cdc4f6796aafca41e37d42ebe0ddfeef | [
"BSD-3-Clause"
] | 1 | 2021-01-19T14:29:19.000Z | 2021-01-19T14:34:27.000Z | iceworm/trees/nodes/exprs.py | wrmsr0/iceworm | 09431bb3cdc4f6796aafca41e37d42ebe0ddfeef | [
"BSD-3-Clause"
] | 1 | 2020-12-31T22:29:52.000Z | 2020-12-31T22:29:52.000Z | import enum
import typing as ta
from omnibus import collections as col
from omnibus import dataclasses as dc
from ...utils import build_enum_value_map
from .base import Expr
from .base import Identifier
from .base import Node
from .base import String
from .base import TypeSpec
class BinaryOp(enum.Enum):
AND = '... | 15.77095 | 85 | 0.632306 | import enum
import typing as ta
from omnibus import collections as col
from omnibus import dataclasses as dc
from ...utils import build_enum_value_map
from .base import Expr
from .base import Identifier
from .base import Node
from .base import String
from .base import TypeSpec
class BinaryOp(enum.Enum):
AND = '... | true | true |
1c22dec921b092e18c6803905344648d570e1023 | 13,325 | py | Python | sphinx/ext/imgmath.py | tttapa/sphinx | 481d9ff04987557d6f3eb72bf10edb4fd0e8e05e | [
"BSD-2-Clause"
] | 2 | 2015-02-05T13:09:34.000Z | 2015-06-24T19:39:03.000Z | sphinx/ext/imgmath.py | tttapa/sphinx | 481d9ff04987557d6f3eb72bf10edb4fd0e8e05e | [
"BSD-2-Clause"
] | 5 | 2016-01-18T09:25:50.000Z | 2021-01-19T17:16:45.000Z | sphinx/ext/imgmath.py | tttapa/sphinx | 481d9ff04987557d6f3eb72bf10edb4fd0e8e05e | [
"BSD-2-Clause"
] | 1 | 2021-10-03T04:54:43.000Z | 2021-10-03T04:54:43.000Z | """
sphinx.ext.imgmath
~~~~~~~~~~~~~~~~~~
Render math in HTML via dvipng or dvisvgm.
:copyright: Copyright 2007-2021 by the Sphinx team, see AUTHORS.
:license: BSD, see LICENSE for details.
"""
import posixpath
import re
import shutil
import subprocess
import tempfile
from os import path
from sub... | 36.506849 | 93 | 0.640826 |
import posixpath
import re
import shutil
import subprocess
import tempfile
from os import path
from subprocess import PIPE, CalledProcessError
from typing import Any, Dict, List, Tuple
from docutils import nodes
from docutils.nodes import Element
import sphinx
from sphinx import package_dir
from sphinx.application i... | true | true |
1c22dfbf8f2af4a121ca054fa835bd157f898d9e | 942 | py | Python | util/netbase.py | foolcatcora/tushare | 44b51564942386658cab6b111929495c85ad25cc | [
"BSD-3-Clause"
] | 2 | 2018-10-04T08:04:24.000Z | 2021-01-21T06:58:30.000Z | util/netbase.py | foolcatcora/tushare | 44b51564942386658cab6b111929495c85ad25cc | [
"BSD-3-Clause"
] | 1 | 2020-04-21T02:42:32.000Z | 2020-04-21T02:42:32.000Z | util/netbase.py | foolcatcora/tushare | 44b51564942386658cab6b111929495c85ad25cc | [
"BSD-3-Clause"
] | 1 | 2018-10-20T09:39:50.000Z | 2018-10-20T09:39:50.000Z | # -*- coding:utf-8 -*-
try:
from urllib.request import urlopen, Request
except ImportError:
from urllib2 import urlopen, Request
class Client(object):
def __init__(self, url=None, ref=None, cookie=None):
self._ref = ref
self._cookie = cookie
self._url = url
s... | 32.482759 | 110 | 0.600849 |
try:
from urllib.request import urlopen, Request
except ImportError:
from urllib2 import urlopen, Request
class Client(object):
def __init__(self, url=None, ref=None, cookie=None):
self._ref = ref
self._cookie = cookie
self._url = url
self._setOpener()
... | true | true |
1c22e15581e352ce2acb4079217e44d03c901a66 | 8,541 | py | Python | c3/optimizers/optimizer.py | flo-maier/c3 | 6bfd72d49fbe47c33038a73436f51f4e454f5ccb | [
"Apache-2.0"
] | null | null | null | c3/optimizers/optimizer.py | flo-maier/c3 | 6bfd72d49fbe47c33038a73436f51f4e454f5ccb | [
"Apache-2.0"
] | null | null | null | c3/optimizers/optimizer.py | flo-maier/c3 | 6bfd72d49fbe47c33038a73436f51f4e454f5ccb | [
"Apache-2.0"
] | null | null | null | """Optimizer object, where the optimal control is done."""
import os
import time
from typing import Callable, Union
import numpy as np
import tensorflow as tf
import json
import c3.libraries.algorithms as algorithms
from c3.experiment import Experiment
class Optimizer:
"""
General optimizer class from which ... | 31.516605 | 87 | 0.565508 |
import os
import time
from typing import Callable, Union
import numpy as np
import tensorflow as tf
import json
import c3.libraries.algorithms as algorithms
from c3.experiment import Experiment
class Optimizer:
def __init__(
self,
pmap,
algorithm=None,
store_unitaries=False,
... | true | true |
1c22e22b603d1a0c17a03ec796596554ef97c811 | 50,995 | py | Python | sympy/core/tests/test_function.py | dyc3/sympy | b2ff075530e1340425e1edd203aeb53c081bf9af | [
"BSD-3-Clause"
] | null | null | null | sympy/core/tests/test_function.py | dyc3/sympy | b2ff075530e1340425e1edd203aeb53c081bf9af | [
"BSD-3-Clause"
] | null | null | null | sympy/core/tests/test_function.py | dyc3/sympy | b2ff075530e1340425e1edd203aeb53c081bf9af | [
"BSD-3-Clause"
] | null | null | null | from sympy.concrete.summations import Sum
from sympy.core.basic import Basic, _aresame
from sympy.core.cache import clear_cache
from sympy.core.containers import Dict, Tuple
from sympy.core.expr import Expr, unchanged
from sympy.core.function import (Subs, Function, diff, Lambda, expand,
nfloat, Derivative)
from sy... | 35.685794 | 106 | 0.546661 | from sympy.concrete.summations import Sum
from sympy.core.basic import Basic, _aresame
from sympy.core.cache import clear_cache
from sympy.core.containers import Dict, Tuple
from sympy.core.expr import Expr, unchanged
from sympy.core.function import (Subs, Function, diff, Lambda, expand,
nfloat, Derivative)
from sy... | true | true |
1c22e2da7df3fe426b21cfd84f77c95885cc79b0 | 10,739 | py | Python | preprocess_mb.py | darthsuogles/mc-cnn | f2c8aa67391ab9fbdae1102afbd1cb20f634d02c | [
"BSD-2-Clause"
] | 1 | 2019-10-29T00:13:25.000Z | 2019-10-29T00:13:25.000Z | preprocess_mb.py | darthsuogles/mc-cnn | f2c8aa67391ab9fbdae1102afbd1cb20f634d02c | [
"BSD-2-Clause"
] | 1 | 2018-03-12T05:01:18.000Z | 2018-03-12T05:01:18.000Z | preprocess_mb.py | darthsuogles/mc-cnn | f2c8aa67391ab9fbdae1102afbd1cb20f634d02c | [
"BSD-2-Clause"
] | null | null | null | #! /usr/bin/env python2
# wget -r -np -A png,pfm,pgm,txt http://vision.middlebury.edu/stereo/data/scenes2014/datasets/
# wget -r -np -A png,pfm,pgm,txt http://vision.middlebury.edu/stereo/data/scenes2006/FullSize/
import os
import re
import sys
import subprocess
import numpy as np
import cv2
def load_pfm(fname, down... | 34.530547 | 113 | 0.584971 |
import os
import re
import sys
import subprocess
import numpy as np
import cv2
def load_pfm(fname, downsample):
if downsample:
if not os.path.isfile(fname + '.H.pfm'):
x, scale = load_pfm(fname, False)
x = x / 2
x_ = np.zeros((x.shape[0] // 2, x.shape[1] // 2), dtype=... | true | true |
1c22e49e32b6b58e69d994fa952caa4c08a7f77f | 16,267 | py | Python | src/pe_parser.py | kamidipreetham/generic-parser | 49e2c3fd72121bc67c3c09275f9e9ad6a638de88 | [
"MIT"
] | 19 | 2018-07-09T13:31:15.000Z | 2021-12-21T11:58:56.000Z | src/pe_parser.py | kamidipreetham/generic-parser | 49e2c3fd72121bc67c3c09275f9e9ad6a638de88 | [
"MIT"
] | null | null | null | src/pe_parser.py | kamidipreetham/generic-parser | 49e2c3fd72121bc67c3c09275f9e9ad6a638de88 | [
"MIT"
] | 6 | 2018-07-14T00:30:25.000Z | 2020-08-20T11:42:28.000Z | #!/usr/bin/python
import pefile
import logging
import sys
import hashlib
import json
import datetime
logger = logging.getLogger(__name__)
logger.setLevel(logging.INFO)
handler = logging.FileHandler('logs/generic.log')
handler.setLevel(logging.INFO)
formatter = logging.Formatter('%(asctime)s - %(name)s - %(levelname)s ... | 50.834375 | 245 | 0.649966 |
import pefile
import logging
import sys
import hashlib
import json
import datetime
logger = logging.getLogger(__name__)
logger.setLevel(logging.INFO)
handler = logging.FileHandler('logs/generic.log')
handler.setLevel(logging.INFO)
formatter = logging.Formatter('%(asctime)s - %(name)s - %(levelname)s - %(message)s')
h... | false | true |
1c22e4fcf050801ca47d6f074e158390f9d30040 | 6,755 | py | Python | versatileimagefield/widgets.py | buyceps/django-versatileimagefield | d5f8e21597da16b7c69d7056995f48471ab517f8 | [
"MIT"
] | 1 | 2021-02-25T19:29:10.000Z | 2021-02-25T19:29:10.000Z | versatileimagefield/widgets.py | buyceps/django-versatileimagefield | d5f8e21597da16b7c69d7056995f48471ab517f8 | [
"MIT"
] | null | null | null | versatileimagefield/widgets.py | buyceps/django-versatileimagefield | d5f8e21597da16b7c69d7056995f48471ab517f8 | [
"MIT"
] | null | null | null | import django
from django.forms.widgets import ClearableFileInput, HiddenInput, MultiWidget, Select
from django.template.loader import render_to_string
from django.utils.safestring import mark_safe
CENTERPOINT_CHOICES = (
("0.0x0.0", "Top Left"),
("0.0x0.5", "Top Center"),
("0.0x1.0", "Top Right"),
("0... | 36.711957 | 114 | 0.62117 | import django
from django.forms.widgets import ClearableFileInput, HiddenInput, MultiWidget, Select
from django.template.loader import render_to_string
from django.utils.safestring import mark_safe
CENTERPOINT_CHOICES = (
("0.0x0.0", "Top Left"),
("0.0x0.5", "Top Center"),
("0.0x1.0", "Top Right"),
("0... | true | true |
1c22e565082415987759053e22d468b4ef615df6 | 1,700 | py | Python | nmtpytorch/layers/pw/max_margin.py | toshohirasawa/nmtpytorch-emb-pred | 3b2d60990967c391aa32ce1e1a9e5cef6229c705 | [
"MIT"
] | 4 | 2019-05-22T00:17:28.000Z | 2020-08-26T02:03:33.000Z | nmtpytorch/layers/pw/max_margin.py | toshohirasawa/nmtpytorch-emb-pred | 3b2d60990967c391aa32ce1e1a9e5cef6229c705 | [
"MIT"
] | 3 | 2019-07-14T09:17:11.000Z | 2022-01-13T01:15:10.000Z | nmtpytorch/layers/pw/max_margin.py | toshohirasawa/nmtpytorch-emb-pred | 3b2d60990967c391aa32ce1e1a9e5cef6229c705 | [
"MIT"
] | null | null | null | from torch import nn
class MaxMarginLoss(nn.Module):
def __init__(self, margin=0.5, constrastive_type='intruder'):
super().__init__()
self.constrastive_type = constrastive_type.lower()
assert margin > 0., "margin must be positive"
assert self.constrastive_type in ('all', 'intruder... | 34.693878 | 124 | 0.595882 | from torch import nn
class MaxMarginLoss(nn.Module):
def __init__(self, margin=0.5, constrastive_type='intruder'):
super().__init__()
self.constrastive_type = constrastive_type.lower()
assert margin > 0., "margin must be positive"
assert self.constrastive_type in ('all', 'intruder... | true | true |
1c22e6a9e5318c3350e1066442f23badad22ba36 | 21 | py | Python | Ghidora/__init__.py | RankJay/Ghidora | abcae21f2bbb8316093c26cc0298c2f0634beea6 | [
"MIT"
] | null | null | null | Ghidora/__init__.py | RankJay/Ghidora | abcae21f2bbb8316093c26cc0298c2f0634beea6 | [
"MIT"
] | null | null | null | Ghidora/__init__.py | RankJay/Ghidora | abcae21f2bbb8316093c26cc0298c2f0634beea6 | [
"MIT"
] | null | null | null | from Ghidora import * | 21 | 21 | 0.809524 | from Ghidora import * | true | true |
1c22e766b49cf385080a98e8c9e33c1e462f7eca | 173 | py | Python | styczen/blad3.py | angelm1974/Bydgoszcz_2_spotkanie | 377eab44cd7d39aa23c83762c2dc2514d8a1edd8 | [
"MIT"
] | null | null | null | styczen/blad3.py | angelm1974/Bydgoszcz_2_spotkanie | 377eab44cd7d39aa23c83762c2dc2514d8a1edd8 | [
"MIT"
] | null | null | null | styczen/blad3.py | angelm1974/Bydgoszcz_2_spotkanie | 377eab44cd7d39aa23c83762c2dc2514d8a1edd8 | [
"MIT"
] | null | null | null | _lista = [1, 2, 3, 4, 5]
ix = 0
dzialaj=True
while dzialaj:
try:
print(_lista[ix])
ix+=1
except IndexError:
dzialaj=False
print('Zrobione') | 14.416667 | 25 | 0.560694 | _lista = [1, 2, 3, 4, 5]
ix = 0
dzialaj=True
while dzialaj:
try:
print(_lista[ix])
ix+=1
except IndexError:
dzialaj=False
print('Zrobione') | true | true |
1c22e87569ddc41732ff8dea0f5b5df0d3f9d9b9 | 409 | py | Python | jobcardProject/accounts/urls.py | alvaroqueiroz/JobProject | 11e3785f452d88a7a4cd4640bdcf4dbe7b3ffa2e | [
"MIT"
] | null | null | null | jobcardProject/accounts/urls.py | alvaroqueiroz/JobProject | 11e3785f452d88a7a4cd4640bdcf4dbe7b3ffa2e | [
"MIT"
] | 5 | 2020-02-12T00:26:15.000Z | 2021-05-08T23:09:43.000Z | jobcardProject/accounts/urls.py | alvaroqueiroz/JobProject | 11e3785f452d88a7a4cd4640bdcf4dbe7b3ffa2e | [
"MIT"
] | null | null | null |
from django.urls import path, include
from .api import RegisterAPI, LoginAPI, UserAPI
from knox import views as knox_views
urlpatterns = [
path('api/auth', include('knox.urls')),
path('api/auth/register', RegisterAPI.as_view()),
path('api/auth/login', LoginAPI.as_view()),
path('api/auth/user', UserAPI.as_... | 34.083333 | 78 | 0.718826 |
from django.urls import path, include
from .api import RegisterAPI, LoginAPI, UserAPI
from knox import views as knox_views
urlpatterns = [
path('api/auth', include('knox.urls')),
path('api/auth/register', RegisterAPI.as_view()),
path('api/auth/login', LoginAPI.as_view()),
path('api/auth/user', UserAPI.as_... | true | true |
1c22e8cd6bd5417f14f3c2846f0b6c88a6c0f338 | 11,437 | py | Python | rllib/agents/impala/vtrace_policy.py | tmorgan4/ray | bc9f040aa002a5223cd86d647a13bd9135a892a8 | [
"Apache-2.0"
] | null | null | null | rllib/agents/impala/vtrace_policy.py | tmorgan4/ray | bc9f040aa002a5223cd86d647a13bd9135a892a8 | [
"Apache-2.0"
] | null | null | null | rllib/agents/impala/vtrace_policy.py | tmorgan4/ray | bc9f040aa002a5223cd86d647a13bd9135a892a8 | [
"Apache-2.0"
] | null | null | null | """Adapted from A3CTFPolicy to add V-trace.
Keep in sync with changes to A3CTFPolicy and VtraceSurrogatePolicy."""
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
import numpy as np
import logging
import gym
import ray
from ray.rllib.agents.impala import ... | 37.254072 | 79 | 0.643176 |
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
import numpy as np
import logging
import gym
import ray
from ray.rllib.agents.impala import vtrace
from ray.rllib.models.tf.tf_action_dist import Categorical
from ray.rllib.policy.sample_batch import SampleBa... | true | true |
1c22ea0098022aa4fd4c4565a720b77a35a1e4cc | 771 | py | Python | chapter3/online-grader/lessons.py | sernamar/python3-oop-book | 02f5aed671e50849b1f3b06f07b7a4834163aae5 | [
"MIT"
] | null | null | null | chapter3/online-grader/lessons.py | sernamar/python3-oop-book | 02f5aed671e50849b1f3b06f07b7a4834163aae5 | [
"MIT"
] | 4 | 2021-04-24T17:20:26.000Z | 2021-04-25T06:53:24.000Z | chapter3/online-grader/lessons.py | sernamar/python3-oop-book | 02f5aed671e50849b1f3b06f07b7a4834163aae5 | [
"MIT"
] | null | null | null | from grader import Assignment
class IntroToPython:
def lesson(self):
return f"""Hello, {self.student}. Define two variables: an integer
named a with value 1 and a string named b with value 'hello'."""
def check(self, code):
return code == "a = 1\nb = 'hello'"
class Statistics(Assign... | 27.535714 | 78 | 0.612192 | from grader import Assignment
class IntroToPython:
def lesson(self):
return f"""Hello, {self.student}. Define two variables: an integer
named a with value 1 and a string named b with value 'hello'."""
def check(self, code):
return code == "a = 1\nb = 'hello'"
class Statistics(Assign... | true | true |
1c22ebd6f14a6ee64c18dec578fd385263970bae | 9,153 | py | Python | espnet/lm/lm_utils.py | szmmm/speechchain | 909724c6f305588a52958f64f584ad21696b5173 | [
"Apache-2.0"
] | 3 | 2019-10-11T11:41:27.000Z | 2020-05-21T09:08:44.000Z | espnet/lm/lm_utils.py | szmmm/speechchain | 909724c6f305588a52958f64f584ad21696b5173 | [
"Apache-2.0"
] | null | null | null | espnet/lm/lm_utils.py | szmmm/speechchain | 909724c6f305588a52958f64f584ad21696b5173 | [
"Apache-2.0"
] | 2 | 2019-03-27T04:34:33.000Z | 2019-04-12T17:30:18.000Z | #!/usr/bin/env python
# Copyright 2017 Johns Hopkins University (Shinji Watanabe)
# Apache 2.0 (http://www.apache.org/licenses/LICENSE-2.0)
# This code is ported from the following implementation written in Torch.
# https://github.com/chainer/chainer/blob/master/examples/ptb/train_ptb_custom_loop.py
from __future_... | 37.979253 | 108 | 0.607233 |
from __future__ import division
from __future__ import print_function
import chainer
import logging
import numpy as np
import os
import random
import six
from chainer.training import extension
def read_tokens(filename, label_dict):
data = []
for ln in open(filename, 'rb').readlines():
data.... | true | true |
1c22ec0a1f73496d647f98347877afd52107daac | 70,598 | py | Python | discord/ext/commands/core.py | telugu-boy/discord.py-self | 8e6b76068dadc8b09635fb9d967d2cb7b44dd5da | [
"MIT"
] | 175 | 2021-05-09T22:49:53.000Z | 2022-03-30T17:50:37.000Z | discord/ext/commands/core.py | telugu-boy/discord.py-self | 8e6b76068dadc8b09635fb9d967d2cb7b44dd5da | [
"MIT"
] | 112 | 2021-05-11T15:49:22.000Z | 2022-03-31T13:46:00.000Z | discord/ext/commands/core.py | telugu-boy/discord.py-self | 8e6b76068dadc8b09635fb9d967d2cb7b44dd5da | [
"MIT"
] | 68 | 2021-05-11T12:32:39.000Z | 2022-03-27T17:52:33.000Z | # -*- coding: utf-8 -*-
"""
The MIT License (MIT)
Copyright (c) 2015-present Rapptz
Permission is hereby granted, free of charge, to any person obtaining a
copy of this software and associated documentation files (the "Software"),
to deal in the Software without restriction, including without limitation
the rights t... | 34.088846 | 122 | 0.609196 |
import asyncio
import functools
import inspect
import typing
import datetime
import discord
from .errors import *
from .cooldowns import Cooldown, BucketType, CooldownMapping, MaxConcurrency
from . import converter as converters
from ._types import _BaseCommand
from .cog import Cog
__all__ = (
'Command',
... | true | true |
1c22ec0ff513978b2e2ebb3fbece6c595b56eab7 | 131,718 | py | Python | tests/blockchain/test_blockchain.py | zcomputerwiz/silicoin-light-wallet | 1cdc3784effec229cc841a04655078b1d9913d33 | [
"Apache-2.0"
] | null | null | null | tests/blockchain/test_blockchain.py | zcomputerwiz/silicoin-light-wallet | 1cdc3784effec229cc841a04655078b1d9913d33 | [
"Apache-2.0"
] | null | null | null | tests/blockchain/test_blockchain.py | zcomputerwiz/silicoin-light-wallet | 1cdc3784effec229cc841a04655078b1d9913d33 | [
"Apache-2.0"
] | null | null | null | # flake8: noqa: F811, F401
import asyncio
import logging
import multiprocessing
import time
from dataclasses import replace
from secrets import token_bytes
from typing import Optional
import pytest
from blspy import AugSchemeMPL, G2Element
from clvm.casts import int_to_bytes
from silicoin.consensus.block_rewards impo... | 47.914878 | 120 | 0.651316 |
import asyncio
import logging
import multiprocessing
import time
from dataclasses import replace
from secrets import token_bytes
from typing import Optional
import pytest
from blspy import AugSchemeMPL, G2Element
from clvm.casts import int_to_bytes
from silicoin.consensus.block_rewards import calculate_base_farmer_r... | true | true |
1c22ec4a77ca0e0de021be4a8b69679bb31f8a18 | 27,168 | py | Python | pods/mocap.py | lawrennd/ods | 16b5b577cfa6bbae52afac29f14083eadc963687 | [
"BSD-3-Clause"
] | 28 | 2015-07-15T06:44:55.000Z | 2022-03-01T19:08:56.000Z | pods/mocap.py | lawrennd/ods | 16b5b577cfa6bbae52afac29f14083eadc963687 | [
"BSD-3-Clause"
] | 13 | 2015-03-25T11:53:36.000Z | 2021-06-17T23:41:22.000Z | pods/mocap.py | lawrennd/ods | 16b5b577cfa6bbae52afac29f14083eadc963687 | [
"BSD-3-Clause"
] | 17 | 2015-01-06T01:49:02.000Z | 2021-12-20T19:25:32.000Z | # Copyright 2014 Open Data Science Initiative and other authors. See AUTHORS.txt
# Licensed under the BSD 3-clause license (see LICENSE.txt)
import os
import sys
import numpy as np
import math
class vertex:
def __init__(self, name, id, parents=[], children=[], meta={}):
self.name = name
self.id =... | 35.467363 | 155 | 0.495804 |
import os
import sys
import numpy as np
import math
class vertex:
def __init__(self, name, id, parents=[], children=[], meta={}):
self.name = name
self.id = id
self.parents = parents
self.children = children
self.meta = meta
def __str__(self):
return self.na... | true | true |
1c22ec7b3639ddcb1bcb1a407923f8ba741be403 | 5,415 | py | Python | docs/conf.py | subos2008/security-token | 40b03757951444ce2db4873ceaeb96bd6221850d | [
"Apache-2.0"
] | 3 | 2020-12-10T06:33:27.000Z | 2021-09-29T17:16:24.000Z | docs/conf.py | subos2008/security-token | 40b03757951444ce2db4873ceaeb96bd6221850d | [
"Apache-2.0"
] | null | null | null | docs/conf.py | subos2008/security-token | 40b03757951444ce2db4873ceaeb96bd6221850d | [
"Apache-2.0"
] | 3 | 2019-01-16T07:04:12.000Z | 2021-12-11T11:04:47.000Z | # -*- coding: utf-8 -*-
#
# Configuration file for the Sphinx documentation builder.
#
# This file does only contain a selection of the most common options. For a
# full list see the documentation:
# http://www.sphinx-doc.org/en/master/config
# -- Path setup ------------------------------------------------------------... | 30.421348 | 79 | 0.660942 |
def setup(sphinx):
from pygments_lexer_solidity import SolidityLexer
sphinx.add_lexer('Solidity', SolidityLexer())
project = u'SFT Protocol'
copyright = u'2018 Benjamin Hauser, Alex Firmani (HyperLink Capital)'
author = u'Benjamin Hauser, Alex Firmani'
version = u''
release = u''
... | true | true |
1c22ed284b1e265af348cbbbaf531717603867e1 | 8,697 | py | Python | keras/layers/normalization.py | ypxie/keras-1 | f1ed8d63faa26ce6180faa685839aa32217211c6 | [
"MIT"
] | null | null | null | keras/layers/normalization.py | ypxie/keras-1 | f1ed8d63faa26ce6180faa685839aa32217211c6 | [
"MIT"
] | null | null | null | keras/layers/normalization.py | ypxie/keras-1 | f1ed8d63faa26ce6180faa685839aa32217211c6 | [
"MIT"
] | null | null | null | from ..engine import Layer, InputSpec
from .. import initializations, regularizers
from .. import backend as K
class LocalResponseNorm(Layer):
'''local response normalization layer'''
def __init__(self, alpha = 1e-4, k = 2, beta=0.75, n =5, **kwargs):
self.alpha = alpha
self.k = k
self... | 50.859649 | 156 | 0.595838 | from ..engine import Layer, InputSpec
from .. import initializations, regularizers
from .. import backend as K
class LocalResponseNorm(Layer):
def __init__(self, alpha = 1e-4, k = 2, beta=0.75, n =5, **kwargs):
self.alpha = alpha
self.k = k
self.beta = beta
self.n = n
asser... | true | true |
1c22ed45e08e9bc2f131d5d472147d9a83ad7351 | 1,090 | py | Python | farmacia/migrations/0005_auto_20210605_2037.py | Italo-Carvalho/farmacia | db4cab3e024b73286107f1f742d407ccf939dcb0 | [
"MIT"
] | null | null | null | farmacia/migrations/0005_auto_20210605_2037.py | Italo-Carvalho/farmacia | db4cab3e024b73286107f1f742d407ccf939dcb0 | [
"MIT"
] | null | null | null | farmacia/migrations/0005_auto_20210605_2037.py | Italo-Carvalho/farmacia | db4cab3e024b73286107f1f742d407ccf939dcb0 | [
"MIT"
] | null | null | null | # Generated by Django 3.2.4 on 2021-06-05 23:37
from django.conf import settings
from django.db import migrations, models
import django.db.models.deletion
class Migration(migrations.Migration):
dependencies = [
migrations.swappable_dependency(settings.AUTH_USER_MODEL),
('farmacia', '0004_auto_20... | 34.0625 | 123 | 0.618349 |
from django.conf import settings
from django.db import migrations, models
import django.db.models.deletion
class Migration(migrations.Migration):
dependencies = [
migrations.swappable_dependency(settings.AUTH_USER_MODEL),
('farmacia', '0004_auto_20210605_1659'),
]
operations = [
... | true | true |
1c22ed6d9c03a80465a342b8c94bd93e575fb1fc | 608 | py | Python | ACME/math/quat_eye.py | mauriziokovacic/ACME | 2615b66dd4addfd5c03d9d91a24c7da414294308 | [
"MIT"
] | 3 | 2019-10-23T23:10:55.000Z | 2021-09-01T07:30:14.000Z | ACME/math/quat_eye.py | mauriziokovacic/ACME-Python | 2615b66dd4addfd5c03d9d91a24c7da414294308 | [
"MIT"
] | null | null | null | ACME/math/quat_eye.py | mauriziokovacic/ACME-Python | 2615b66dd4addfd5c03d9d91a24c7da414294308 | [
"MIT"
] | 1 | 2020-07-11T11:35:43.000Z | 2020-07-11T11:35:43.000Z | import torch
def quat_eye(n=1, dtype=torch.float, device='cuda:0'):
"""
Returns n identity quaternions
Parameters
----------
n : int (optional)
the number of quaternion to return (default is 1)
dtype : type (optional)
the data type of the output tensor (default is torch.float)... | 26.434783 | 88 | 0.606908 | import torch
def quat_eye(n=1, dtype=torch.float, device='cuda:0'):
return torch.tensor([1, 0, 0, 0], dtype=dtype, device=device).repeat(n, 1).squeeze()
| true | true |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.