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 |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
f76562ca22d829bd3e475e9859470b3eb44356f1 | 1,456 | py | Python | app/test3.py | defparam/BAR-Tender | 0ace6b36cda4e572a7b3a7dd062c517528bffd14 | [
"MIT"
] | 49 | 2018-06-28T20:29:00.000Z | 2022-03-07T18:04:44.000Z | app/test3.py | defparam/BAR-Tender | 0ace6b36cda4e572a7b3a7dd062c517528bffd14 | [
"MIT"
] | null | null | null | app/test3.py | defparam/BAR-Tender | 0ace6b36cda4e572a7b3a7dd062c517528bffd14 | [
"MIT"
] | 9 | 2018-08-01T13:01:24.000Z | 2021-04-28T07:05:27.000Z | from sys import stdout
from os import getpid
from BARTender import *
from ctypes import *
def show(ptr):
for i in range(32):
if ((i%4) == 0):
stdout.write('\n')
stdout.write("%s"%ptr[i])
stdout.write(' ')
stdout.write('\n')
x = BARTender()
print ("Test 3: Allocate 2 pages of memory and swap their PTEs")
... | 21.411765 | 64 | 0.671703 | from sys import stdout
from os import getpid
from BARTender import *
from ctypes import *
def show(ptr):
for i in range(32):
if ((i%4) == 0):
stdout.write('\n')
stdout.write("%s"%ptr[i])
stdout.write(' ')
stdout.write('\n')
x = BARTender()
print ("Test 3: Allocate 2 pages of memory and swap their PTEs")
... | true | true |
f765630d3e8f0b52bb0c2c6b25034e6988b36264 | 10,538 | py | Python | grid_feats/roi_heads.py | a7532ariel/grid-feats-vqa | 907828898457cfbd099dff347b58488c1642986b | [
"Apache-2.0"
] | null | null | null | grid_feats/roi_heads.py | a7532ariel/grid-feats-vqa | 907828898457cfbd099dff347b58488c1642986b | [
"Apache-2.0"
] | null | null | null | grid_feats/roi_heads.py | a7532ariel/grid-feats-vqa | 907828898457cfbd099dff347b58488c1642986b | [
"Apache-2.0"
] | null | null | null | # Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved
import torch
from torch import nn
from torch.nn import functional as F
from detectron2.layers import ShapeSpec
from detectron2.modeling.roi_heads import (
build_box_head,
build_mask_head,
select_foreground_proposals,
ROI_HEADS_REGIS... | 40.375479 | 100 | 0.65278 | import torch
from torch import nn
from torch.nn import functional as F
from detectron2.layers import ShapeSpec
from detectron2.modeling.roi_heads import (
build_box_head,
build_mask_head,
select_foreground_proposals,
ROI_HEADS_REGISTRY,
ROIHeads,
Res5ROIHeads,
StandardROIHeads,
)
from detec... | true | true |
f7656630769fbab1fcb3f09d6654c4846d2f728f | 1,426 | tac | Python | docs/conch/examples/telnet_echo.tac | neberej/twisted | 242dcc2a8a2d6005a5389c8e65cbeb7716048c05 | [
"MIT",
"Unlicense"
] | 1 | 2019-02-08T18:37:42.000Z | 2019-02-08T18:37:42.000Z | docs/conch/examples/telnet_echo.tac | neberej/twisted | 242dcc2a8a2d6005a5389c8e65cbeb7716048c05 | [
"MIT",
"Unlicense"
] | 5 | 2020-06-05T18:16:39.000Z | 2022-01-13T00:45:49.000Z | docs/conch/examples/telnet_echo.tac | neberej/twisted | 242dcc2a8a2d6005a5389c8e65cbeb7716048c05 | [
"MIT",
"Unlicense"
] | 1 | 2019-01-25T18:08:19.000Z | 2019-01-25T18:08:19.000Z | # Copyright (c) Twisted Matrix Laboratories.
# See LICENSE for details.
"""
Simple echo server that echoes back client input.
You can run this .tac file directly with:
twistd -ny telnet_echo.tac
This demo sets up a listening port on 6023 which accepts telnet connections.
No login for the telnet server is require... | 29.708333 | 108 | 0.7223 |
from twisted.conch.telnet import TelnetTransport, TelnetProtocol
from twisted.internet.protocol import ServerFactory
from twisted.application.internet import TCPServer
from twisted.application.service import Application
class TelnetEcho(TelnetProtocol):
def enableRemote(self, option):
self.transport.writ... | true | true |
f765663e20019acfc0366c944d0a625471f2aaf3 | 1,676 | py | Python | magnum/conf/cinder.py | mail2nsrajesh/magnum | 2e7e5a77967028c961337177ce577eb936c3845c | [
"Apache-2.0"
] | null | null | null | magnum/conf/cinder.py | mail2nsrajesh/magnum | 2e7e5a77967028c961337177ce577eb936c3845c | [
"Apache-2.0"
] | null | null | null | magnum/conf/cinder.py | mail2nsrajesh/magnum | 2e7e5a77967028c961337177ce577eb936c3845c | [
"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
# distributed under the... | 33.52 | 77 | 0.699284 |
from oslo_config import cfg
from magnum.i18n import _
cinder_group = cfg.OptGroup(
name='cinder',
title='Options for the Cinder configuration')
cinder_client_group = cfg.OptGroup(
name='cinder_client',
title='Options for the Cinder client')
cinder_opts = [
cfg.StrOpt('default_docker_volume_type... | true | true |
f7656644475b401291743813879ef9e29765c757 | 21,698 | py | Python | tests/functional/testplan/runnable/interactive/test_interactive.py | dobragab/testplan | 407ac1dfd33d19753e41235a1f576aeb06118840 | [
"Apache-2.0"
] | null | null | null | tests/functional/testplan/runnable/interactive/test_interactive.py | dobragab/testplan | 407ac1dfd33d19753e41235a1f576aeb06118840 | [
"Apache-2.0"
] | null | null | null | tests/functional/testplan/runnable/interactive/test_interactive.py | dobragab/testplan | 407ac1dfd33d19753e41235a1f576aeb06118840 | [
"Apache-2.0"
] | null | null | null | """Interactive mode tests."""
from __future__ import print_function
from __future__ import division
from __future__ import absolute_import
from builtins import range
from builtins import next
from future import standard_library
standard_library.install_aliases()
import os
import re
import pytest
import six
import req... | 38 | 87 | 0.598903 | from __future__ import print_function
from __future__ import division
from __future__ import absolute_import
from builtins import range
from builtins import next
from future import standard_library
standard_library.install_aliases()
import os
import re
import pytest
import six
import requests
import pytest
from test... | true | true |
f765667d730dd1642849b114d46802873e613bf7 | 3,767 | py | Python | google/appengine/_internal/django/core/serializers/__init__.py | vladushakov987/appengine_python3 | 0dd481c73e2537a50ee10f1b79cd65938087e555 | [
"Apache-2.0"
] | null | null | null | google/appengine/_internal/django/core/serializers/__init__.py | vladushakov987/appengine_python3 | 0dd481c73e2537a50ee10f1b79cd65938087e555 | [
"Apache-2.0"
] | null | null | null | google/appengine/_internal/django/core/serializers/__init__.py | vladushakov987/appengine_python3 | 0dd481c73e2537a50ee10f1b79cd65938087e555 | [
"Apache-2.0"
] | null | null | null | """
Interfaces for serializing Django objects.
Usage::
from google.appengine._internal.django.core import serializers
json = serializers.serialize("json", some_query_set)
objects = list(serializers.deserialize("json", json))
To add your own serializers, use the SERIALIZATION_MODULES setting::
SERIAL... | 31.391667 | 92 | 0.715689 |
from google.appengine._internal.django.conf import settings
from google.appengine._internal.django.utils import importlib
import six
BUILTIN_SERIALIZERS = {
"xml" : "django.core.serializers.xml_serializer",
"python" : "django.core.serializers.python",
"json" : "django.core.serializers.json",
}
try:... | true | true |
f76566d1eec05826f17f2fb7d4e28a754e16fbfc | 512 | py | Python | AtCoder/ABC134/C.py | takaaki82/Java-Lessons | c4f11462bf84c091527dde5f25068498bfb2cc49 | [
"MIT"
] | 1 | 2018-11-25T04:15:45.000Z | 2018-11-25T04:15:45.000Z | AtCoder/ABC134/C.py | takaaki82/Java-Lessons | c4f11462bf84c091527dde5f25068498bfb2cc49 | [
"MIT"
] | null | null | null | AtCoder/ABC134/C.py | takaaki82/Java-Lessons | c4f11462bf84c091527dde5f25068498bfb2cc49 | [
"MIT"
] | 2 | 2018-08-08T13:01:14.000Z | 2018-11-25T12:38:36.000Z | N = int(input())
a_list = [int(input()) for _ in range(N)]
b_list = a_list.copy()
b_list.sort(reverse=True)
max_num = max(b_list)
for i in range(N):
a = a_list[i]
if a != max_num:
print(max_num)
else:
f = True
cnt = 0
for b in b_list:
if a != b:
... | 18.285714 | 41 | 0.398438 | N = int(input())
a_list = [int(input()) for _ in range(N)]
b_list = a_list.copy()
b_list.sort(reverse=True)
max_num = max(b_list)
for i in range(N):
a = a_list[i]
if a != max_num:
print(max_num)
else:
f = True
cnt = 0
for b in b_list:
if a != b:
... | true | true |
f76567315cfa48659bfeab08e5336aff94a255bb | 6,183 | py | Python | asposewordscloud/models/requests/delete_comment_request.py | aspose-words-cloud/aspose-words-cloud-python | 65c7b55fa4aac69b60d41e7f54aed231df285479 | [
"MIT"
] | 14 | 2018-07-15T17:01:52.000Z | 2018-11-29T06:15:33.000Z | asposewordscloud/models/requests/delete_comment_request.py | aspose-words-cloud/aspose-words-cloud-python | 65c7b55fa4aac69b60d41e7f54aed231df285479 | [
"MIT"
] | 1 | 2018-09-28T12:59:34.000Z | 2019-10-08T08:42:59.000Z | asposewordscloud/models/requests/delete_comment_request.py | aspose-words-cloud/aspose-words-cloud-python | 65c7b55fa4aac69b60d41e7f54aed231df285479 | [
"MIT"
] | 2 | 2020-12-21T07:59:17.000Z | 2022-02-16T21:41:25.000Z | # coding: utf-8
# -----------------------------------------------------------------------------------
# <copyright company="Aspose" file="delete_comment_request.py">
# Copyright (c) 2021 Aspose.Words for Cloud
# </copyright>
# <summary>
# Permission is hereby granted, free of charge, to any person obtaining a copy
... | 47.198473 | 255 | 0.658095 | import json
from six.moves.urllib.parse import quote
from asposewordscloud import *
from asposewordscloud.models import *
from asposewordscloud.models.requests import *
from asposewordscloud.models.responses import *
class DeleteCommentRequest(BaseRequestObject):
def __init__(self, name, comment_index, folder=No... | true | true |
f765673243f683dcda2b87d5d67537148eb34f68 | 23,332 | py | Python | tensorflow/compiler/xla/python/xla_client.py | Stevanus-Christian/tensorflow | d44afcf5ca16c5d704c66f891b99eac804e7cd14 | [
"Apache-2.0"
] | null | null | null | tensorflow/compiler/xla/python/xla_client.py | Stevanus-Christian/tensorflow | d44afcf5ca16c5d704c66f891b99eac804e7cd14 | [
"Apache-2.0"
] | null | null | null | tensorflow/compiler/xla/python/xla_client.py | Stevanus-Christian/tensorflow | d44afcf5ca16c5d704c66f891b99eac804e7cd14 | [
"Apache-2.0"
] | null | null | null | # Copyright 2017 The TensorFlow Authors. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applica... | 34.823881 | 80 | 0.724199 |
import atexit
import contextlib
import enum import gzip
import inspect
import os
from typing import List, Sequence, Tuple, Union
from . import xla_extension as _xla
import numpy as np
ops = _xla.ops
profiler = _xla.profiler
_version = 69
mlir_api_version = 18
xla_platform_names = {
'cpu': 'Host',
'gp... | true | true |
f765676cb93f562c637ee4340c817d795be1de33 | 1,158 | py | Python | pyvisdk/do/vm_guest_reboot_event.py | Infinidat/pyvisdk | f2f4e5f50da16f659ccc1d84b6a00f397fa997f8 | [
"MIT"
] | null | null | null | pyvisdk/do/vm_guest_reboot_event.py | Infinidat/pyvisdk | f2f4e5f50da16f659ccc1d84b6a00f397fa997f8 | [
"MIT"
] | null | null | null | pyvisdk/do/vm_guest_reboot_event.py | Infinidat/pyvisdk | f2f4e5f50da16f659ccc1d84b6a00f397fa997f8 | [
"MIT"
] | null | null | null |
import logging
from pyvisdk.exceptions import InvalidArgumentError
########################################
# Automatically generated, do not edit.
########################################
log = logging.getLogger(__name__)
def VmGuestRebootEvent(vim, *args, **kwargs):
'''This is a virtual machine guest reboot r... | 34.058824 | 124 | 0.604491 |
import logging
from pyvisdk.exceptions import InvalidArgumentError
log = logging.getLogger(__name__)
def VmGuestRebootEvent(vim, *args, **kwargs):
obj = vim.client.factory.create('{urn:vim25}VmGuestRebootEvent')
if (len(args) + len(kwargs)) < 5:
raise IndexError('Expected at least 6 arguments ... | true | true |
f765677dd0ef2627fc83c9057dd4b27b93767864 | 138 | py | Python | realtime_app/views.py | techacademypython/django_channels | 29433ff2bddd5e34ff40e436a29e9007aba139ad | [
"MIT"
] | 3 | 2020-05-29T09:30:54.000Z | 2020-06-21T16:55:54.000Z | realtime_app/views.py | techacademypython/django_channels | 29433ff2bddd5e34ff40e436a29e9007aba139ad | [
"MIT"
] | 11 | 2020-06-05T22:59:47.000Z | 2022-02-10T12:49:38.000Z | realtime_app/views.py | techacademypython/django_channels | 29433ff2bddd5e34ff40e436a29e9007aba139ad | [
"MIT"
] | 1 | 2019-10-12T13:58:58.000Z | 2019-10-12T13:58:58.000Z | from django.views import generic
# Create your views here.
class RealtimeIndex(generic.TemplateView):
template_name = "index.html"
| 17.25 | 42 | 0.768116 | from django.views import generic
class RealtimeIndex(generic.TemplateView):
template_name = "index.html"
| true | true |
f76567849e8612746e91a3eaf11b25a07d298168 | 426 | py | Python | tests/test_basic_str.py | SaveTheRbtz/h3-py | f59a1eafed8915d4c35417bf60a6a2f169ea9f23 | [
"Apache-2.0"
] | 498 | 2018-07-30T22:45:48.000Z | 2022-03-30T13:59:45.000Z | tests/test_basic_str.py | SaveTheRbtz/h3-py | f59a1eafed8915d4c35417bf60a6a2f169ea9f23 | [
"Apache-2.0"
] | 199 | 2018-07-31T16:55:23.000Z | 2022-03-29T16:45:44.000Z | tests/test_basic_str.py | SaveTheRbtz/h3-py | f59a1eafed8915d4c35417bf60a6a2f169ea9f23 | [
"Apache-2.0"
] | 107 | 2018-07-30T21:09:24.000Z | 2022-01-30T22:58:44.000Z | import h3.api.basic_str as h3
def test1():
assert h3.geo_to_h3(37.7752702151959, -122.418307270836, 9) == '8928308280fffff'
def test5():
expected = {
'89283082873ffff',
'89283082877ffff',
'8928308283bffff',
'89283082807ffff',
'8928308280bffff',
'8928308280ffff... | 20.285714 | 84 | 0.610329 | import h3.api.basic_str as h3
def test1():
assert h3.geo_to_h3(37.7752702151959, -122.418307270836, 9) == '8928308280fffff'
def test5():
expected = {
'89283082873ffff',
'89283082877ffff',
'8928308283bffff',
'89283082807ffff',
'8928308280bffff',
'8928308280ffff... | true | true |
f76568454b7ac65b970b05442ae8fa713fbd4002 | 40,454 | py | Python | pytorch_lightning/trainer/training_loop.py | simran2905/pytorch-lightning | 024cf23c67fb92fabb2d238bd33d73b24aafa7a9 | [
"Apache-2.0"
] | 1 | 2022-01-08T14:06:36.000Z | 2022-01-08T14:06:36.000Z | pytorch_lightning/trainer/training_loop.py | simran2905/pytorch-lightning | 024cf23c67fb92fabb2d238bd33d73b24aafa7a9 | [
"Apache-2.0"
] | null | null | null | pytorch_lightning/trainer/training_loop.py | simran2905/pytorch-lightning | 024cf23c67fb92fabb2d238bd33d73b24aafa7a9 | [
"Apache-2.0"
] | 1 | 2022-01-08T14:06:27.000Z | 2022-01-08T14:06:27.000Z | # Copyright The PyTorch Lightning team.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to i... | 43.781385 | 119 | 0.662258 |
from collections import OrderedDict
from contextlib import contextmanager, suppress
from functools import partial, update_wrapper
from typing import Any, Callable, Dict, List, Mapping, Optional, Tuple, Union
import numpy as np
import torch
from torch.optim import Optimizer
from pytorch_lightning.core.optimizer impor... | true | true |
f7656a67b8f3bee9a911038d2ceab56d8fba9360 | 698 | py | Python | irc/rfc.py | EliotNapa/slack_irc_rt_gate | 84fac9f78bfa7ea9157031a17515000a78af3e86 | [
"MIT"
] | null | null | null | irc/rfc.py | EliotNapa/slack_irc_rt_gate | 84fac9f78bfa7ea9157031a17515000a78af3e86 | [
"MIT"
] | null | null | null | irc/rfc.py | EliotNapa/slack_irc_rt_gate | 84fac9f78bfa7ea9157031a17515000a78af3e86 | [
"MIT"
] | null | null | null | from __future__ import absolute_import
import re
def get_pages(filename):
with open(filename) as f:
data = f.read()
return data.split('\x0c')
header_pattern = re.compile(r'^RFC \d+\s+.*\s+(\w+ \d{4})$', re.M)
footer_pattern = re.compile(r'^\w+\s+\w+\s+\[Page \d+\]$', re.M)
def remove_header(page):
page = he... | 18.864865 | 72 | 0.666189 | from __future__ import absolute_import
import re
def get_pages(filename):
with open(filename) as f:
data = f.read()
return data.split('\x0c')
header_pattern = re.compile(r'^RFC \d+\s+.*\s+(\w+ \d{4})$', re.M)
footer_pattern = re.compile(r'^\w+\s+\w+\s+\[Page \d+\]$', re.M)
def remove_header(page):
page = he... | true | true |
f7656b7af61b61eb778772a533c25ce97395fa02 | 1,524 | py | Python | examples/prompts/rprompt.py | gousaiyang/python-prompt-toolkit | 6237764658214af4c24633795d2571d2bd03375d | [
"BSD-3-Clause"
] | 4,028 | 2015-01-02T16:31:38.000Z | 2018-10-25T14:51:02.000Z | examples/prompts/rprompt.py | gousaiyang/python-prompt-toolkit | 6237764658214af4c24633795d2571d2bd03375d | [
"BSD-3-Clause"
] | 709 | 2018-10-25T22:36:52.000Z | 2022-03-28T18:34:35.000Z | examples/prompts/rprompt.py | gousaiyang/python-prompt-toolkit | 6237764658214af4c24633795d2571d2bd03375d | [
"BSD-3-Clause"
] | 399 | 2018-10-26T18:08:46.000Z | 2022-03-28T16:09:41.000Z | #!/usr/bin/env python
"""
Example of a right prompt. This is an additional prompt that is displayed on
the right side of the terminal. It will be hidden automatically when the input
is long enough to cover the right side of the terminal.
This is similar to RPROMPT is Zsh.
"""
from prompt_toolkit import prompt
from pro... | 28.222222 | 88 | 0.62336 | from prompt_toolkit import prompt
from prompt_toolkit.formatted_text import ANSI, HTML
from prompt_toolkit.styles import Style
example_style = Style.from_dict(
{
"rprompt": "bg:#ff0066 #ffffff",
}
)
def get_rprompt_text():
return [
("", " "),
("underline", "<rpromp... | true | true |
f7656d119243362691c348da79c7ea6bd3bcc101 | 2,990 | py | Python | monosi/config/project.py | annamarieweber/monosi | fec3d863e0557778d451366384d568a2515312a8 | [
"Apache-2.0"
] | null | null | null | monosi/config/project.py | annamarieweber/monosi | fec3d863e0557778d451366384d568a2515312a8 | [
"Apache-2.0"
] | null | null | null | monosi/config/project.py | annamarieweber/monosi | fec3d863e0557778d451366384d568a2515312a8 | [
"Apache-2.0"
] | null | null | null | from dataclasses import dataclass, field
import os
import glob
from typing import Any, Dict, List, Optional
from monosi.reporter import Reporter
import monosi.utils.yaml as yaml
@dataclass
class ProjectConfigurationDefaults:
version: str = '0.0.1' # TODO: Update to automatic
collection_name: Optional[str] = ... | 29.029126 | 83 | 0.646823 | from dataclasses import dataclass, field
import os
import glob
from typing import Any, Dict, List, Optional
from monosi.reporter import Reporter
import monosi.utils.yaml as yaml
@dataclass
class ProjectConfigurationDefaults:
version: str = '0.0.1' collection_name: Optional[str] = None
source_name: Option... | true | true |
f7656ddba22f26e98bba2ef87eb6ddd195a86362 | 3,192 | py | Python | simulacra/utils/memoizers.py | JoshKarpel/simulacra | e5770ced1bef860caec25ce8c77a61ff0bb78907 | [
"MIT"
] | 1 | 2018-05-24T08:01:26.000Z | 2018-05-24T08:01:26.000Z | simulacra/utils/memoizers.py | JoshKarpel/simulacra | e5770ced1bef860caec25ce8c77a61ff0bb78907 | [
"MIT"
] | 1 | 2019-10-08T21:03:46.000Z | 2019-10-08T21:03:46.000Z | simulacra/utils/memoizers.py | JoshKarpel/simulacra | e5770ced1bef860caec25ce8c77a61ff0bb78907 | [
"MIT"
] | 2 | 2017-07-03T18:33:16.000Z | 2018-10-16T01:52:57.000Z | import logging
from typing import Callable, Any, Dict
import functools
import numpy as np
logger = logging.getLogger(__name__)
logger.setLevel(logging.DEBUG)
class cached_property:
"""
A property that is only computed once per instance and then replaces itself
with an ordinary attribute. Deleting the a... | 28 | 94 | 0.614662 | import logging
from typing import Callable, Any, Dict
import functools
import numpy as np
logger = logging.getLogger(__name__)
logger.setLevel(logging.DEBUG)
class cached_property:
def __init__(self, func):
self.__doc__ = getattr(func, "__doc__")
self.func = func
def __get__(self, obj, cl... | true | true |
f7656dfb707399cabcad677f966864c909e212d4 | 2,293 | py | Python | codes/tomography/shadow_tomography251.py | vutuanhai237/QuantumTomography | 52916096482d7e7cd29782c049478bbba901d9bd | [
"MIT"
] | 2 | 2021-12-11T07:49:46.000Z | 2022-03-04T07:11:30.000Z | codes/tomography/shadow_tomography251.py | vutuanhai237/QuantumTomography | 52916096482d7e7cd29782c049478bbba901d9bd | [
"MIT"
] | null | null | null | codes/tomography/shadow_tomography251.py | vutuanhai237/QuantumTomography | 52916096482d7e7cd29782c049478bbba901d9bd | [
"MIT"
] | null | null | null |
import sys
from itertools import combinations
import qiskit
import numpy as np
import tqix
sys.path.insert(1, '../')
import qtm.base
import qtm.nqubit
import qtm.fubini_study
def self_tensor(matrix, n):
product = matrix
for i in range(1, n):
product = np.kron(product, matrix)
return product
... | 32.295775 | 112 | 0.663323 |
import sys
from itertools import combinations
import qiskit
import numpy as np
import tqix
sys.path.insert(1, '../')
import qtm.base
import qtm.nqubit
import qtm.fubini_study
def self_tensor(matrix, n):
product = matrix
for i in range(1, n):
product = np.kron(product, matrix)
return product
... | true | true |
f7656f89b73f4768e0dc66e93b0f5597c4a566d2 | 16,126 | py | Python | sdk/storage/azure-storage-queue/azure/storage/queue/_shared/base_client.py | LianwMS/azure-sdk-for-python | 612d7bca9de86ee1bd1fa59291d7bf897ba9213f | [
"MIT"
] | null | null | null | sdk/storage/azure-storage-queue/azure/storage/queue/_shared/base_client.py | LianwMS/azure-sdk-for-python | 612d7bca9de86ee1bd1fa59291d7bf897ba9213f | [
"MIT"
] | 2 | 2020-07-17T13:57:08.000Z | 2020-07-21T18:30:37.000Z | sdk/storage/azure-storage-queue/azure/storage/queue/_shared/base_client.py | LianwMS/azure-sdk-for-python | 612d7bca9de86ee1bd1fa59291d7bf897ba9213f | [
"MIT"
] | 1 | 2020-07-31T16:33:36.000Z | 2020-07-31T16:33:36.000Z | # -------------------------------------------------------------------------
# Copyright (c) Microsoft Corporation. All rights reserved.
# Licensed under the MIT License. See License.txt in the project root for
# license information.
# --------------------------------------------------------------------------
from typi... | 37.242494 | 115 | 0.64672 |
from typing import ( Union,
Optional,
Any,
Iterable,
Dict,
List,
Type,
Tuple,
TYPE_CHECKING,
)
import logging
try:
from urllib.parse import parse_qs, quote
except ImportError:
from urlparse import parse_qs from urllib2 import quote
import six
from azure.core.config... | true | true |
f76570165097f185ebacdc8d26fcf9a73a4fbc64 | 2,046 | py | Python | src/ml/Univariate_Time_Series/Exponenial_Univariate_Forecasting.py | Hakan-er/utma | f7cd6253ec894047b460d4df9b43eeb9b109bae2 | [
"MIT"
] | 1 | 2022-02-02T20:36:27.000Z | 2022-02-02T20:36:27.000Z | src/ml/Univariate_Time_Series/Exponenial_Univariate_Forecasting.py | Hakan-er/utma | f7cd6253ec894047b460d4df9b43eeb9b109bae2 | [
"MIT"
] | null | null | null | src/ml/Univariate_Time_Series/Exponenial_Univariate_Forecasting.py | Hakan-er/utma | f7cd6253ec894047b460d4df9b43eeb9b109bae2 | [
"MIT"
] | 1 | 2021-06-17T20:50:41.000Z | 2021-06-17T20:50:41.000Z | from Load_And_Visualize_Time_Data import Load_and_Visualize_Time_Data
import sys
import pandas as pd
import numpy as np
from sktime.forecasting.model_selection import temporal_train_test_split
from sktime.forecasting.exp_smoothing import ExponentialSmoothing
from sktime.utils.plotting import plot_series
from sktime.per... | 41.755102 | 101 | 0.69697 | from Load_And_Visualize_Time_Data import Load_and_Visualize_Time_Data
import sys
import pandas as pd
import numpy as np
from sktime.forecasting.model_selection import temporal_train_test_split
from sktime.forecasting.exp_smoothing import ExponentialSmoothing
from sktime.utils.plotting import plot_series
from sktime.per... | true | true |
f765709420478b7480522e1303206ac85b83dc02 | 535 | py | Python | rest-apis/test/api_test.py | fishermano/QShield | 745da3870240e0cab6ab75deebd128eb08b45bac | [
"Apache-2.0"
] | 2 | 2021-09-17T11:04:01.000Z | 2021-09-17T11:04:03.000Z | rest-apis/test/api_test.py | fishermano/qshield | 745da3870240e0cab6ab75deebd128eb08b45bac | [
"Apache-2.0"
] | null | null | null | rest-apis/test/api_test.py | fishermano/qshield | 745da3870240e0cab6ab75deebd128eb08b45bac | [
"Apache-2.0"
] | null | null | null | #!/usr/bin/env python3
# -*- coding: utf-8 -*-
__author__ = 'CYX'
import aiohttp, asyncio
HOST = 'localhost'
async def url_access(session, url):
async with session.get(url) as response:
return await response.read()
async def main(url):
async with aiohttp.ClientSession() as sess:
res = await... | 22.291667 | 58 | 0.674766 |
__author__ = 'CYX'
import aiohttp, asyncio
HOST = 'localhost'
async def url_access(session, url):
async with session.get(url) as response:
return await response.read()
async def main(url):
async with aiohttp.ClientSession() as sess:
res = await url_access(sess, url)
print(res)
loop... | true | true |
f7657133dfdd2cd9139c1f7814b75379ec56d66f | 2,178 | py | Python | server/endpoints/stats.py | mscherer/clc | 51e31301e78fdafc0126e482d777be0db1b38f46 | [
"Apache-2.0"
] | 5 | 2021-05-25T15:56:26.000Z | 2021-09-13T17:45:30.000Z | server/endpoints/stats.py | mscherer/clc | 51e31301e78fdafc0126e482d777be0db1b38f46 | [
"Apache-2.0"
] | 45 | 2021-06-04T03:02:46.000Z | 2022-02-01T15:05:42.000Z | server/endpoints/stats.py | mscherer/clc | 51e31301e78fdafc0126e482d777be0db1b38f46 | [
"Apache-2.0"
] | 8 | 2021-05-21T11:35:58.000Z | 2022-01-31T16:18:44.000Z | #!/usr/bin/env python3
# -*- coding: utf-8 -*-
# Licensed to the Apache Software Foundation (ASF) under one or more
# contributor license agreements. See the NOTICE file distributed with
# this work for additional information regarding copyright ownership.
# The ASF licenses this file to You under the Apache License, ... | 36.915254 | 114 | 0.673095 |
import plugins.basetypes
import plugins.session
import os
import yaml
import typing
async def process(server: plugins.basetypes.Server, session: plugins.session.SessionObject, indata: dict) -> dict:
out = {}
repos = []
for repo in os.listdir(server.config.dirs.scratch):
if repo in server.data.pr... | true | true |
f76571ee289e888ccadec0ab82fd4f85f6d8b86f | 12,953 | py | Python | tutorials/stats-sensor-space/75_cluster_ftest_spatiotemporal.py | lokinou/mne-python | f4aa12bc9118d0739ca05c5ed5a4fba7ae71138b | [
"BSD-3-Clause"
] | null | null | null | tutorials/stats-sensor-space/75_cluster_ftest_spatiotemporal.py | lokinou/mne-python | f4aa12bc9118d0739ca05c5ed5a4fba7ae71138b | [
"BSD-3-Clause"
] | null | null | null | tutorials/stats-sensor-space/75_cluster_ftest_spatiotemporal.py | lokinou/mne-python | f4aa12bc9118d0739ca05c5ed5a4fba7ae71138b | [
"BSD-3-Clause"
] | null | null | null | # -*- coding: utf-8 -*-
"""
.. _tut-cluster-spatiotemporal-sensor:
=====================================================
Spatiotemporal permutation F-test on full sensor data
=====================================================
Tests for differential evoked responses in at least
one condition using a permutation clu... | 38.322485 | 79 | 0.683085 |
import numpy as np
import matplotlib.pyplot as plt
from mpl_toolkits.axes_grid1 import make_axes_locatable
import mne
from mne.stats import spatio_temporal_cluster_test, combine_adjacency
from mne.datasets import sample
from mne.channels import find_ch_adjacency
from mne.viz import plot_compare_evokeds
from mne.time... | true | true |
f76571f1c2e3352c85c3e8a4b461a855412a145e | 167 | py | Python | create_derivatives/apps.py | RockefellerArchiveCenter/pictor | 244b1a2016664974f38885d0ab2e6ac472306a85 | [
"MIT"
] | null | null | null | create_derivatives/apps.py | RockefellerArchiveCenter/pictor | 244b1a2016664974f38885d0ab2e6ac472306a85 | [
"MIT"
] | 88 | 2021-07-21T15:14:40.000Z | 2022-03-10T20:11:40.000Z | create_derivatives/apps.py | RockefellerArchiveCenter/pictor | 244b1a2016664974f38885d0ab2e6ac472306a85 | [
"MIT"
] | null | null | null | from django.apps import AppConfig
class CreateDerivativesConfig(AppConfig):
default_auto_field = 'django.db.models.BigAutoField'
name = 'create_derivatives'
| 23.857143 | 56 | 0.790419 | from django.apps import AppConfig
class CreateDerivativesConfig(AppConfig):
default_auto_field = 'django.db.models.BigAutoField'
name = 'create_derivatives'
| true | true |
f7657280da03896a35ffc14c139cc3343729e5c8 | 2,024 | py | Python | kinto/core/decorators.py | taus-semmle/kinto | a4cd7c6413d1d7809fe02670c0224959390dc25d | [
"Apache-2.0"
] | null | null | null | kinto/core/decorators.py | taus-semmle/kinto | a4cd7c6413d1d7809fe02670c0224959390dc25d | [
"Apache-2.0"
] | null | null | null | kinto/core/decorators.py | taus-semmle/kinto | a4cd7c6413d1d7809fe02670c0224959390dc25d | [
"Apache-2.0"
] | null | null | null | import threading
import warnings
from functools import wraps, update_wrapper
from pyramid.response import Response
class cache_forever:
def __init__(self, wrapped):
self.wrapped = wrapped
self.saved = None
update_wrapper(self, wrapped)
def __call__(self, request, *args, **kwargs):
... | 28.111111 | 117 | 0.610672 | import threading
import warnings
from functools import wraps, update_wrapper
from pyramid.response import Response
class cache_forever:
def __init__(self, wrapped):
self.wrapped = wrapped
self.saved = None
update_wrapper(self, wrapped)
def __call__(self, request, *args, **kwargs):
... | true | true |
f7657361b1b8661b81b5d1a91c2da965ec270853 | 3,186 | py | Python | BERT-keras-master/BERT-keras-master/transformer/embedding.py | yyht/bert | 480c909e0835a455606e829310ff949c9dd23549 | [
"Apache-2.0"
] | 34 | 2018-12-19T01:00:57.000Z | 2021-03-26T09:36:37.000Z | BERT-keras-master/BERT-keras-master/transformer/embedding.py | yyht/bert | 480c909e0835a455606e829310ff949c9dd23549 | [
"Apache-2.0"
] | 11 | 2018-12-25T03:37:59.000Z | 2021-08-25T14:43:58.000Z | BERT-keras-master/BERT-keras-master/transformer/embedding.py | yyht/bert | 480c909e0835a455606e829310ff949c9dd23549 | [
"Apache-2.0"
] | 9 | 2018-12-27T08:00:44.000Z | 2020-06-08T03:05:14.000Z | import keras
import numpy as np
from data.vocab import TextEncoder
def _get_pos_encoding_matrix(max_len: int, d_emb: int) -> np.array:
pos_enc = np.array(
[[pos / np.power(10000, 2 * (j // 2) / d_emb) for j in range(d_emb)] if pos != 0 else np.zeros(d_emb) for pos in
range(max_len)], dtype=np.flo... | 49.78125 | 120 | 0.645009 | import keras
import numpy as np
from data.vocab import TextEncoder
def _get_pos_encoding_matrix(max_len: int, d_emb: int) -> np.array:
pos_enc = np.array(
[[pos / np.power(10000, 2 * (j // 2) / d_emb) for j in range(d_emb)] if pos != 0 else np.zeros(d_emb) for pos in
range(max_len)], dtype=np.flo... | true | true |
f7657505c01c70532f8e8b72eb34d3fffff6565c | 18,666 | py | Python | src/m1r_patterns_for_sequences.py | wolfead/16-SequencesAndMutation | 44b27f5dd9e27e1481612e6b1877d671677b8c56 | [
"MIT"
] | null | null | null | src/m1r_patterns_for_sequences.py | wolfead/16-SequencesAndMutation | 44b27f5dd9e27e1481612e6b1877d671677b8c56 | [
"MIT"
] | null | null | null | src/m1r_patterns_for_sequences.py | wolfead/16-SequencesAndMutation | 44b27f5dd9e27e1481612e6b1877d671677b8c56 | [
"MIT"
] | null | null | null | """
This module demonstrates various patterns
for ITERATING through SEQUENCES, including:
-- Beginning to end
-- Other ranges (e.g., backwards and every-3rd-item)
-- The COUNT/SUM/etc pattern
-- The FIND pattern (via LINEAR SEARCH)
-- The MAX/MIN pattern
-- Looking two places in the sequence at once
-- Lo... | 37.332 | 72 | 0.472142 |
import math
def main():
print()
print('-----------------------------------------------------------')
print('Demonstrating the BEGINNING-TO-END pattern,')
print(' along with the COUNTING pattern:')
print('-----------------------------------------------------------')
seq... | true | true |
f765758ef4f7cc57b5a3fbc3dcab7037370bc390 | 390 | py | Python | user_auth/models.py | ploggingdev/boredhackers | e0740a6df2e8b30279f06a9ebfe11f748ca90b9b | [
"MIT"
] | 1 | 2018-01-03T01:40:43.000Z | 2018-01-03T01:40:43.000Z | user_auth/models.py | ploggingdev/boredhackers | e0740a6df2e8b30279f06a9ebfe11f748ca90b9b | [
"MIT"
] | 7 | 2018-01-03T01:44:00.000Z | 2022-02-11T03:39:02.000Z | user_auth/models.py | ploggingdev/boredhackers | e0740a6df2e8b30279f06a9ebfe11f748ca90b9b | [
"MIT"
] | null | null | null | from django.db import models
from django.contrib.auth.models import User
class UserProfile(models.Model):
user = models.OneToOneField(User, on_delete=models.CASCADE)
about = models.CharField(max_length=1000, default="[empty]")
to_review = models.BooleanField(default=False)
created = models.DateTimeFiel... | 43.333333 | 64 | 0.774359 | from django.db import models
from django.contrib.auth.models import User
class UserProfile(models.Model):
user = models.OneToOneField(User, on_delete=models.CASCADE)
about = models.CharField(max_length=1000, default="[empty]")
to_review = models.BooleanField(default=False)
created = models.DateTimeFiel... | true | true |
f76577248ad7dda723f217a9cb97dcb0deb455b8 | 4,860 | py | Python | CTFd/api/v1/user_rights.py | ldecoster/Plateforme-CTF | 5ff3a5b64167919712584461433f872044366c62 | [
"Apache-2.0"
] | null | null | null | CTFd/api/v1/user_rights.py | ldecoster/Plateforme-CTF | 5ff3a5b64167919712584461433f872044366c62 | [
"Apache-2.0"
] | 2 | 2020-11-02T16:51:42.000Z | 2021-02-12T15:18:47.000Z | CTFd/api/v1/user_rights.py | ldecoster/Plateforme-CTF | 5ff3a5b64167919712584461433f872044366c62 | [
"Apache-2.0"
] | null | null | null | from typing import List
from flask import request
from flask_restx import Namespace, Resource
from CTFd.api.v1.helpers.request import validate_args
from CTFd.api.v1.helpers.schemas import sqlalchemy_to_pydantic
from CTFd.api.v1.schemas import APIDetailedSuccessResponse, APIListSuccessResponse
from CTFd.constants impo... | 33.517241 | 107 | 0.648765 | from typing import List
from flask import request
from flask_restx import Namespace, Resource
from CTFd.api.v1.helpers.request import validate_args
from CTFd.api.v1.helpers.schemas import sqlalchemy_to_pydantic
from CTFd.api.v1.schemas import APIDetailedSuccessResponse, APIListSuccessResponse
from CTFd.constants impo... | true | true |
f76578cec446aca5eb4783699b82f53321303855 | 3,993 | py | Python | tests/inferbeddings/adversarial/closedform/test_lifted_simple_transe_unit_sphere.py | issca/inferbeddings | 80492a7aebcdcac21e758514c8af403d77e8594a | [
"MIT"
] | 33 | 2017-07-25T14:31:00.000Z | 2019-03-06T09:18:00.000Z | tests/inferbeddings/adversarial/closedform/test_lifted_simple_transe_unit_sphere.py | issca/inferbeddings | 80492a7aebcdcac21e758514c8af403d77e8594a | [
"MIT"
] | 1 | 2017-08-22T13:49:30.000Z | 2017-08-22T13:49:30.000Z | tests/inferbeddings/adversarial/closedform/test_lifted_simple_transe_unit_sphere.py | issca/inferbeddings | 80492a7aebcdcac21e758514c8af403d77e8594a | [
"MIT"
] | 9 | 2017-10-05T08:50:45.000Z | 2019-04-18T12:40:56.000Z | # -*- coding: utf-8 -*-
import numpy as np
import tensorflow as tf
from inferbeddings.models import base as models
from inferbeddings.models import similarities
from inferbeddings.knowledgebase import Fact, KnowledgeBaseParser
from inferbeddings.parse import parse_clause
from inferbeddings.models.training import cons... | 37.317757 | 116 | 0.646882 |
import numpy as np
import tensorflow as tf
from inferbeddings.models import base as models
from inferbeddings.models import similarities
from inferbeddings.knowledgebase import Fact, KnowledgeBaseParser
from inferbeddings.parse import parse_clause
from inferbeddings.models.training import constraints
from inferbeddi... | true | true |
f76579bc92054f8d86affb6ec4f30976849cb9cb | 755 | py | Python | multimeter/temperatur.py | tropi-frutti/facharbeit-fhg | e162014a9d12e60c616d78c14166c75414acda7b | [
"MIT"
] | null | null | null | multimeter/temperatur.py | tropi-frutti/facharbeit-fhg | e162014a9d12e60c616d78c14166c75414acda7b | [
"MIT"
] | null | null | null | multimeter/temperatur.py | tropi-frutti/facharbeit-fhg | e162014a9d12e60c616d78c14166c75414acda7b | [
"MIT"
] | null | null | null | import read_arduino
import math
import globvar
def temperatur():
read_arduino.read()
#Berechnung des Widerstandswert vom NTC
tempOhmREF =1100
Measure0=float(globvar.measure0)
tempSPAN =Measure0*4.86/1023 #umwandeln von 8 bit in spannungswert
#anwenden von u/(r1+r2)= u2/r2 umgewandelt zu r1=((u*... | 24.354839 | 71 | 0.74702 | import read_arduino
import math
import globvar
def temperatur():
read_arduino.read()
tempOhmREF =1100
Measure0=float(globvar.measure0)
tempSPAN =Measure0*4.86/1023 tempZS1 =5*tempOhmREF
tempZS2 =tempZS1/tempSPAN
tempNTCohm =tempZS2-tempOhmREF
ntczs1=tempNTCohm/10000
ntczs2=math.lo... | true | true |
f7657ab68bab6dd2e4fafac911483ac31b25b920 | 11,501 | py | Python | Exp3C-metusalem2012_Reservoir50.py | nicolas-lair/DiscourseOverrule | 48c64db5d84b3fbc72f59a1a7ebe416fdc7f9ac1 | [
"CC0-1.0"
] | 1 | 2022-03-15T16:26:35.000Z | 2022-03-15T16:26:35.000Z | Exp3C-metusalem2012_Reservoir50.py | nicolas-lair/DiscourseOverrule | 48c64db5d84b3fbc72f59a1a7ebe416fdc7f9ac1 | [
"CC0-1.0"
] | 1 | 2021-02-03T19:48:11.000Z | 2021-02-03T19:48:11.000Z | Exp3C-metusalem2012_Reservoir50.py | nicolas-lair/DiscourseOverrule | 48c64db5d84b3fbc72f59a1a7ebe416fdc7f9ac1 | [
"CC0-1.0"
] | 1 | 2020-06-16T18:16:26.000Z | 2020-06-16T18:16:26.000Z | from wikipedia2vec import Wikipedia2Vec
import numpy as np
import matplotlib.pyplot as plt
import nltk
nltk.download('stopwords')
from nltk.corpus import stopwords
import csv
import scipy
from scipy import stats
from easyesn.optimizers import GradientOptimizer
from easyesn import PredictionESN
from easye... | 38.464883 | 340 | 0.696896 | from wikipedia2vec import Wikipedia2Vec
import numpy as np
import matplotlib.pyplot as plt
import nltk
nltk.download('stopwords')
from nltk.corpus import stopwords
import csv
import scipy
from scipy import stats
from easyesn.optimizers import GradientOptimizer
from easyesn import PredictionESN
from easye... | true | true |
f7657ad64ba002ab5fa62567592a504e47aebba6 | 2,985 | py | Python | tests/test_signal_handlers.py | Varriount/sanic | 55c36e0240dfeb03deccdeb5a53ca7fcfa728bff | [
"MIT"
] | 4,959 | 2018-09-13T08:42:51.000Z | 2021-01-05T07:01:44.000Z | tests/test_signal_handlers.py | Varriount/sanic | 55c36e0240dfeb03deccdeb5a53ca7fcfa728bff | [
"MIT"
] | 864 | 2018-09-13T20:48:04.000Z | 2021-01-05T07:33:30.000Z | tests/test_signal_handlers.py | Varriount/sanic | 55c36e0240dfeb03deccdeb5a53ca7fcfa728bff | [
"MIT"
] | 612 | 2018-09-13T21:10:04.000Z | 2020-12-30T12:16:36.000Z | import asyncio
import os
import signal
from queue import Queue
from unittest.mock import MagicMock
import pytest
from sanic_testing.testing import HOST, PORT
from sanic.compat import ctrlc_workaround_for_windows
from sanic.response import HTTPResponse
async def stop(app, loop):
await asyncio.sleep(0.1)
ap... | 26.891892 | 78 | 0.663987 | import asyncio
import os
import signal
from queue import Queue
from unittest.mock import MagicMock
import pytest
from sanic_testing.testing import HOST, PORT
from sanic.compat import ctrlc_workaround_for_windows
from sanic.response import HTTPResponse
async def stop(app, loop):
await asyncio.sleep(0.1)
ap... | true | true |
f7657b02885af0ef788994fa4e4bd72c0d943442 | 2,886 | py | Python | anchore_engine/services/policy_engine/api/controllers/feeds.py | sunnysharmagts/anchore-engine | 3c81404ef1cefc9e03dc33476ef8cd0fa115a58e | [
"Apache-2.0"
] | null | null | null | anchore_engine/services/policy_engine/api/controllers/feeds.py | sunnysharmagts/anchore-engine | 3c81404ef1cefc9e03dc33476ef8cd0fa115a58e | [
"Apache-2.0"
] | null | null | null | anchore_engine/services/policy_engine/api/controllers/feeds.py | sunnysharmagts/anchore-engine | 3c81404ef1cefc9e03dc33476ef8cd0fa115a58e | [
"Apache-2.0"
] | null | null | null | from flask import jsonify
from anchore_engine.apis.authorization import get_authorizer, INTERNAL_SERVICE_ALLOWED
from anchore_engine.clients.services.simplequeue import LeaseAcquisitionFailedError
from anchore_engine.common.helpers import make_response_error
from anchore_engine.services.policy_engine.api.models import... | 37.973684 | 130 | 0.690922 | from flask import jsonify
from anchore_engine.apis.authorization import get_authorizer, INTERNAL_SERVICE_ALLOWED
from anchore_engine.clients.services.simplequeue import LeaseAcquisitionFailedError
from anchore_engine.common.helpers import make_response_error
from anchore_engine.services.policy_engine.api.models import... | true | true |
f7657b3680b4d848e26cec2509ac532266726e9d | 345 | py | Python | FastAPI/my_jinja.py | med-cab-bw-team/DS | 0c0cd2f9696ae85827ed1dec8aab85bc24ec1cf8 | [
"MIT"
] | null | null | null | FastAPI/my_jinja.py | med-cab-bw-team/DS | 0c0cd2f9696ae85827ed1dec8aab85bc24ec1cf8 | [
"MIT"
] | null | null | null | FastAPI/my_jinja.py | med-cab-bw-team/DS | 0c0cd2f9696ae85827ed1dec8aab85bc24ec1cf8 | [
"MIT"
] | 2 | 2020-10-14T02:55:42.000Z | 2021-06-11T01:56:16.000Z | from fastapi.responses import HTMLResponse
from fastapi.staticfiles import StaticFiles
from fastapi.templating import Jinja2Templates
def mount_static_directory(api):
api.mount(
"/static",
StaticFiles(directory="FastAPI/static"),
name="static")
templates = Jinja2Templates(
directory=... | 23 | 48 | 0.733333 | from fastapi.responses import HTMLResponse
from fastapi.staticfiles import StaticFiles
from fastapi.templating import Jinja2Templates
def mount_static_directory(api):
api.mount(
"/static",
StaticFiles(directory="FastAPI/static"),
name="static")
templates = Jinja2Templates(
directory=... | true | true |
f7657b632d598f050c0e697ad61aa0f1b331f616 | 2,635 | py | Python | section1/task1/task1.py | owen633/caw-quant-training | e333d38cf05483434300f55740b541f57e707d4e | [
"MIT"
] | null | null | null | section1/task1/task1.py | owen633/caw-quant-training | e333d38cf05483434300f55740b541f57e707d4e | [
"MIT"
] | null | null | null | section1/task1/task1.py | owen633/caw-quant-training | e333d38cf05483434300f55740b541f57e707d4e | [
"MIT"
] | null | null | null | # Task1 Get hourly candle data from CryptoCompare
## 1. Explore CryptoCompare Data API
### Required
#### 1. **Write a function** to download histohour data, parameters:
# fsym: BTC, tsym: USDT, start_time="2017-04-01", end_time="2020-04-01", e='binance'
# import libraries
import requests
import pandas as pd
import tim... | 32.134146 | 108 | 0.663757 |
import requests
import pandas as pd
import time
import dateparser
import pytz
from datetime import datetime
def date_to_seconds(date_str):
epoch = datetime.utcfromtimestamp(0).replace(tzinfo=pytz.utc)
d = dateparser.parse(date_str)
if d.tzinfo is None or d.tzinfo.utcoffset(d) is None:
d = d.repl... | true | true |
f7657c28adaacba1c308f8f9f834d0d44cd91f6b | 8,023 | py | Python | tests/test_integration/test_py_imports.py | AndresBena19/pydep-ast | c90fa29b3c5133cc936a2fa5cd6b0f76a924f97e | [
"MIT"
] | null | null | null | tests/test_integration/test_py_imports.py | AndresBena19/pydep-ast | c90fa29b3c5133cc936a2fa5cd6b0f76a924f97e | [
"MIT"
] | 2 | 2021-11-13T17:31:09.000Z | 2021-11-13T20:28:30.000Z | tests/test_integration/test_py_imports.py | AndresBena19/pydep-ast | c90fa29b3c5133cc936a2fa5cd6b0f76a924f97e | [
"MIT"
] | null | null | null | """Integration test cases to validate the properly parse of python imports"""
import ast
from typing import Callable, List, Tuple
from py_imports.base.models import ImportStatement
from py_imports.manager import PyImports
class TestPyImports:
"""
Test cases to validate the properly parse of imports in .py fi... | 35.977578 | 89 | 0.599651 | import ast
from typing import Callable, List, Tuple
from py_imports.base.models import ImportStatement
from py_imports.manager import PyImports
class TestPyImports:
entry_point = PyImports
def test_get_absolute_import_in_a_local_file(
self,
set_up_file: Callable,
) -> None:
file... | true | true |
f7657d7c02fb5a129cb98258611c58a29f90e5fa | 238 | py | Python | njunmt/decoders/__init__.py | whr94621/NJUNMT-tf | 29e0b0c577ea7c81acdc80e7a94a1c4dfb85c118 | [
"Apache-2.0"
] | 111 | 2017-12-29T12:48:02.000Z | 2022-03-15T00:47:13.000Z | njunmt/decoders/__init__.py | whr94621/NJUNMT-tf | 29e0b0c577ea7c81acdc80e7a94a1c4dfb85c118 | [
"Apache-2.0"
] | 3 | 2018-01-27T13:54:42.000Z | 2020-03-02T03:07:19.000Z | njunmt/decoders/__init__.py | whr94621/NJUNMT-tf | 29e0b0c577ea7c81acdc80e7a94a1c4dfb85c118 | [
"Apache-2.0"
] | 44 | 2017-12-29T12:49:57.000Z | 2022-02-02T13:25:28.000Z | from njunmt.decoders.rnn_decoder import AttentionDecoder
from njunmt.decoders.rnn_decoder import CondAttentionDecoder
from njunmt.decoders.rnn_decoder import SimpleDecoder
from njunmt.decoders.transformer_decoder import TransformerDecoder | 59.5 | 66 | 0.903361 | from njunmt.decoders.rnn_decoder import AttentionDecoder
from njunmt.decoders.rnn_decoder import CondAttentionDecoder
from njunmt.decoders.rnn_decoder import SimpleDecoder
from njunmt.decoders.transformer_decoder import TransformerDecoder | true | true |
f7657ff2b597015cda241f2f697cdce9355b04fe | 1,534 | py | Python | axiom/test/newapp.py | hawkowl/axiom | 8636e29aa224d05388a0f58106dc29f895b82209 | [
"MIT"
] | 23 | 2015-01-08T07:29:32.000Z | 2021-11-03T11:27:48.000Z | axiom/test/newapp.py | hawkowl/axiom | 8636e29aa224d05388a0f58106dc29f895b82209 | [
"MIT"
] | 109 | 2015-01-08T05:54:56.000Z | 2022-03-02T04:06:40.000Z | axiom/test/newapp.py | hawkowl/axiom | 8636e29aa224d05388a0f58106dc29f895b82209 | [
"MIT"
] | 16 | 2015-01-08T07:08:43.000Z | 2021-07-28T02:53:17.000Z | # -*- test-case-name: axiom.test.test_upgrading -*-
from axiom.item import Item
from axiom.attributes import text, integer, reference, inmemory
from axiom.upgrade import registerUpgrader
class ActivateHelper:
activated = 0
def activate(self):
self.activated += 1
class Adventurer(ActivateHelper, Ite... | 25.566667 | 78 | 0.707953 |
from axiom.item import Item
from axiom.attributes import text, integer, reference, inmemory
from axiom.upgrade import registerUpgrader
class ActivateHelper:
activated = 0
def activate(self):
self.activated += 1
class Adventurer(ActivateHelper, Item):
typeName = 'test_app_player'
schemaVersi... | true | true |
f76581db1f2da49c9e5a742958d722059e2d7a2d | 541 | py | Python | django_mri/models/outputs/__init__.py | GalBenZvi/django_mri | 558e9187a6ba18b7ba69aced919a6f94d066a2fc | [
"Apache-2.0"
] | 4 | 2020-07-27T20:33:54.000Z | 2022-01-11T20:24:03.000Z | django_mri/models/outputs/__init__.py | GalBenZvi/django_mri | 558e9187a6ba18b7ba69aced919a6f94d066a2fc | [
"Apache-2.0"
] | 107 | 2019-09-04T11:38:46.000Z | 2022-03-04T13:59:51.000Z | django_mri/models/outputs/__init__.py | GalBenZvi/django_mri | 558e9187a6ba18b7ba69aced919a6f94d066a2fc | [
"Apache-2.0"
] | 2 | 2020-05-24T06:35:33.000Z | 2020-06-14T13:15:32.000Z | """
Custom :class:`~django_analyses.models.output.output.Output` and
:class:`~django_analyses.models.output.definitions.OutputDefinition` subclasses.
These models expand upon django_analyses_\'
:mod:`~django_analyses.models.output` module to facilitate integration with the
various analysis interfaces.
.. _django_anal... | 33.8125 | 80 | 0.822551 |
from django_mri.models.outputs.nifti_output import NiftiOutput
from django_mri.models.outputs.nifti_output_definition import \
NiftiOutputDefinition
| true | true |
f76581ec542fe0d0491509e3218d522ee78a499f | 4,321 | py | Python | libras_myo/plotpandas.py | pernambucano/myo_libras | 8909a43f8d455cc63215843ece7128704fab13b3 | [
"MIT"
] | null | null | null | libras_myo/plotpandas.py | pernambucano/myo_libras | 8909a43f8d455cc63215843ece7128704fab13b3 | [
"MIT"
] | null | null | null | libras_myo/plotpandas.py | pernambucano/myo_libras | 8909a43f8d455cc63215843ece7128704fab13b3 | [
"MIT"
] | null | null | null | #!/usr/local/bin/python
# -*- coding: utf-8 -*-
import pandas as pd
import numpy as np
import matplotlib.pyplot as plt
from sklearn.ensemble import RandomForestClassifier, AdaBoostClassifier, BaggingClassifier
def plotSensores():
### Letra A
df_a = pd.read_csv("data/bernardo/bernardo-A-3-emg.csv")
df_a_... | 38.238938 | 107 | 0.620227 |
import pandas as pd
import numpy as np
import matplotlib.pyplot as plt
from sklearn.ensemble import RandomForestClassifier, AdaBoostClassifier, BaggingClassifier
def plotSensores():
df_a = pd.read_csv("data/bernardo/bernardo-A-3-emg.csv")
df_a_avg = np.genfromtxt("data/bernardo/bernardo-A-3-avg.csv", de... | true | true |
f76582e66d4e1308214525f8e2902c9fbebad766 | 1,313 | py | Python | nitorch/nn/losses/base.py | balbasty/nitorch | d30c3125a8a66ea1434f2b39ed03338afd9724b4 | [
"MIT"
] | 46 | 2020-07-31T10:14:05.000Z | 2022-03-24T12:51:46.000Z | nitorch/nn/losses/base.py | balbasty/nitorch | d30c3125a8a66ea1434f2b39ed03338afd9724b4 | [
"MIT"
] | 36 | 2020-10-06T19:01:38.000Z | 2022-02-03T18:07:35.000Z | nitorch/nn/losses/base.py | balbasty/nitorch | d30c3125a8a66ea1434f2b39ed03338afd9724b4 | [
"MIT"
] | 6 | 2021-01-05T14:59:05.000Z | 2021-11-18T18:26:45.000Z | """
Base class for losses.
Reduction mecanisms are implemented here.
"""
import torch.nn as tnn
from nitorch.core.math import nansum, nanmean, sum, mean
class Loss(tnn.Module):
"""Base class for losses."""
def __init__(self, reduction='mean'):
"""
Parameters
----------
redu... | 26.26 | 74 | 0.517898 |
import torch.nn as tnn
from nitorch.core.math import nansum, nanmean, sum, mean
class Loss(tnn.Module):
def __init__(self, reduction='mean'):
super().__init__()
self.reduction = reduction or 'none'
def reduce(self, x):
reduction = self.reduction
if reduction is None:
... | true | true |
f76583369b0f86dce82f8c0f174f5aeff290b93d | 54,023 | py | Python | SCRAPE/Lib/site-packages/twisted/python/filepath.py | Chinmoy-Prasad-Dutta/scrapy_scraper | 09f6abfc3bcf10ee28f486d83b450c89a07e066e | [
"MIT"
] | 4,612 | 2015-01-01T12:57:23.000Z | 2022-03-30T01:08:23.000Z | SCRAPE/Lib/site-packages/twisted/python/filepath.py | Chinmoy-Prasad-Dutta/scrapy_scraper | 09f6abfc3bcf10ee28f486d83b450c89a07e066e | [
"MIT"
] | 1,243 | 2015-01-23T17:23:59.000Z | 2022-03-28T13:46:17.000Z | SCRAPE/Lib/site-packages/twisted/python/filepath.py | Chinmoy-Prasad-Dutta/scrapy_scraper | 09f6abfc3bcf10ee28f486d83b450c89a07e066e | [
"MIT"
] | 1,236 | 2015-01-13T14:41:26.000Z | 2022-03-17T07:12:36.000Z | # -*- test-case-name: twisted.test.test_paths -*-
# Copyright (c) Twisted Matrix Laboratories.
# See LICENSE for details.
"""
Object-oriented filesystem path representation.
"""
import base64
import errno
import os
import sys
from os import listdir, stat, utime
from os.path import (
abspath,
basename,
di... | 33.554658 | 88 | 0.602817 |
import base64
import errno
import os
import sys
from os import listdir, stat, utime
from os.path import (
abspath,
basename,
dirname,
exists,
isabs,
join as joinpath,
normpath,
splitext,
)
from stat import (
S_IMODE,
S_IRGRP,
S_IROTH,
S_IRUSR,
S_ISBLK,
S_ISDIR,... | true | true |
f765834cff0cefe4f568c5e74255b26cb857e21d | 258 | py | Python | NLP_Flask/app/process_manage_api/__init__.py | Gxy-2001/NLPPlat | f339c1a7452b979b413919cf4bc128bf45af52ef | [
"MIT"
] | null | null | null | NLP_Flask/app/process_manage_api/__init__.py | Gxy-2001/NLPPlat | f339c1a7452b979b413919cf4bc128bf45af52ef | [
"MIT"
] | null | null | null | NLP_Flask/app/process_manage_api/__init__.py | Gxy-2001/NLPPlat | f339c1a7452b979b413919cf4bc128bf45af52ef | [
"MIT"
] | null | null | null | from flask import Blueprint
api = Blueprint("process_manage_api", __name__)
from . import data_upload
from . import data_set
from . import annotation
from . import pre_process
from . import model_train
from . import task_manage
from . import batch_process
| 21.5 | 47 | 0.802326 | from flask import Blueprint
api = Blueprint("process_manage_api", __name__)
from . import data_upload
from . import data_set
from . import annotation
from . import pre_process
from . import model_train
from . import task_manage
from . import batch_process
| true | true |
f765834fb28bff34227bb1ad0344d37d41cd18e5 | 477 | py | Python | python-ffmpeg/batch_rename_empty_space.py | sciple/neurobau | b54e24ad0f717b7506cc948876cba47f6768318c | [
"MIT"
] | 2 | 2020-05-29T02:14:40.000Z | 2020-11-20T18:06:42.000Z | python-ffmpeg/batch_rename_empty_space.py | sciple/neurobau | b54e24ad0f717b7506cc948876cba47f6768318c | [
"MIT"
] | null | null | null | python-ffmpeg/batch_rename_empty_space.py | sciple/neurobau | b54e24ad0f717b7506cc948876cba47f6768318c | [
"MIT"
] | null | null | null | import os
import glob
ROOT_DIR = '/Volumes/NEUROBAU/PUBLIC/MM/Salvatore/jaws_loom_video_ethovision/'
FILE_EXTENSION = 'mpg'
CHARACTER_TO_REMOVE = ' '
for old_file_name in glob.iglob(ROOT_DIR + '*.' + FILE_EXTENSION):
# print(old_file_name)
# print("_".join(old_file_name.split(CHARACTER_TO_REMOVE)))
new_fi... | 36.692308 | 78 | 0.750524 | import os
import glob
ROOT_DIR = '/Volumes/NEUROBAU/PUBLIC/MM/Salvatore/jaws_loom_video_ethovision/'
FILE_EXTENSION = 'mpg'
CHARACTER_TO_REMOVE = ' '
for old_file_name in glob.iglob(ROOT_DIR + '*.' + FILE_EXTENSION):
new_file_name = "_".join(old_file_name.split(CHARACTER_TO_REMOVE))
print('new file na... | true | true |
f76584eb49c3bd506f06c92f4a558d2aab97d383 | 726 | py | Python | skl2onnx/operator_converters/id_op.py | elcolie/sklearn-onnx | 004fa39cb995ada0cde232ae8e30341018f450ac | [
"MIT"
] | null | null | null | skl2onnx/operator_converters/id_op.py | elcolie/sklearn-onnx | 004fa39cb995ada0cde232ae8e30341018f450ac | [
"MIT"
] | null | null | null | skl2onnx/operator_converters/id_op.py | elcolie/sklearn-onnx | 004fa39cb995ada0cde232ae8e30341018f450ac | [
"MIT"
] | null | null | null | # -------------------------------------------------------------------------
# Copyright (c) Microsoft Corporation. All rights reserved.
# Licensed under the MIT License. See License.txt in the project root for
# license information.
# --------------------------------------------------------------------------
from ..co... | 38.210526 | 76 | 0.619835 |
from ..common._apply_operation import apply_identity
from ..common._registration import register_converter
def convert_sklearn_identity(scope, operator, container):
apply_identity(
scope, operator.inputs[0].full_name,
operator.outputs[0].full_name, container,
operator_name=scope.get_uniqu... | true | true |
f7658895343d9d395032c9dabdbabb0e34c0acfb | 12,918 | py | Python | nova/virt/libvirt/volume/remotefs.py | arvindn05/nova | 1d335b333245198dbf39841eedd221377beb58c2 | [
"Apache-2.0"
] | 2 | 2021-10-11T04:56:25.000Z | 2022-02-16T08:49:29.000Z | nova/virt/libvirt/volume/remotefs.py | ljzjohnson/nova | 87e1951a1b8c03b9ecdf8f75610d14690b61f272 | [
"Apache-2.0"
] | 132 | 2017-03-27T11:31:52.000Z | 2022-03-30T08:45:02.000Z | nova/virt/libvirt/volume/remotefs.py | ljzjohnson/nova | 87e1951a1b8c03b9ecdf8f75610d14690b61f272 | [
"Apache-2.0"
] | 8 | 2017-03-27T07:50:38.000Z | 2020-02-14T16:55:56.000Z | # Copyright 2014 Cloudbase Solutions Srl
# 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 r... | 41.941558 | 78 | 0.615343 |
import abc
import os
from oslo_concurrency import processutils
from oslo_log import log as logging
from oslo_utils import fileutils
from oslo_utils import importutils
import six
import nova.conf
from nova.i18n import _
import nova.privsep.fs
from nova import utils
LOG = logging.getLogger(__name__)
CONF = nova.conf... | true | true |
f765891b61deb8078efa440a484be9703a76cfc4 | 989 | py | Python | setup.py | vongostev/lightprop2d | c693daa9f688f2c801fe094a85dfc48fbde42134 | [
"MIT"
] | 2 | 2021-11-20T17:00:15.000Z | 2022-01-14T07:22:38.000Z | setup.py | vongostev/lightprop2d | c693daa9f688f2c801fe094a85dfc48fbde42134 | [
"MIT"
] | null | null | null | setup.py | vongostev/lightprop2d | c693daa9f688f2c801fe094a85dfc48fbde42134 | [
"MIT"
] | null | null | null | # -*- coding: utf-8 -*-
"""
Created on Sat Jun 5 01:09:24 2021
@author: Pavel Gostev
"""
import setuptools
with open("README.md", "r", encoding="utf-8") as fh:
long_description = fh.read()
setuptools.setup(
name="lightprop2d",
version="1.0.1",
author="Pavel Gostev",
author_email="gostev.pavel@ph... | 26.026316 | 73 | 0.632963 | import setuptools
with open("README.md", "r", encoding="utf-8") as fh:
long_description = fh.read()
setuptools.setup(
name="lightprop2d",
version="1.0.1",
author="Pavel Gostev",
author_email="gostev.pavel@physics.msu.ru",
description="Light propagation in free space with fourier transform",
... | true | true |
f76589f04923eb5739aebb68be8289d12bdf234a | 2,122 | py | Python | plugins/neighbors/neighbors.py | amr390/spoony | c5f506ad4ec45ecae81824023bd19430f89b1bea | [
"MIT"
] | null | null | null | plugins/neighbors/neighbors.py | amr390/spoony | c5f506ad4ec45ecae81824023bd19430f89b1bea | [
"MIT"
] | null | null | null | plugins/neighbors/neighbors.py | amr390/spoony | c5f506ad4ec45ecae81824023bd19430f89b1bea | [
"MIT"
] | null | null | null | # -*- coding: utf-8 -*-
"""
Neighbor Articles Plugin for Pelican
====================================
This plugin adds ``next_article`` (newer) and ``prev_article`` (older)
variables to the article's context
"""
from pelican import signals
def iter3(seq):
"""Generate one triplet per element in 'seq' following PE... | 31.671642 | 77 | 0.630066 | from pelican import signals
def iter3(seq):
nxt, cur = None, None
for prv in seq:
if cur:
yield nxt, cur, prv
nxt, cur = cur, prv
if cur:
# Yield last element in seq (also if len(seq) == 1)
yield nxt, cur, None
def get_translation(article, prefered_languag... | true | true |
f7658a4f3dee1e99e6b9296a4913be7c2538f555 | 631 | py | Python | examples/get_albums.py | mateuuszzzzz/applemusicpy | 2cfb8e5ff79587c938d09969f2839a0e8b061dda | [
"MIT"
] | null | null | null | examples/get_albums.py | mateuuszzzzz/applemusicpy | 2cfb8e5ff79587c938d09969f2839a0e8b061dda | [
"MIT"
] | null | null | null | examples/get_albums.py | mateuuszzzzz/applemusicpy | 2cfb8e5ff79587c938d09969f2839a0e8b061dda | [
"MIT"
] | null | null | null | import applemusicpy
from applemusicpy.client import ResourceType
team_id = 'team_id'
key_id = 'key_id'
secret_file = 'AuthKey_' + key_id + '.p8'
with open(secret_file,'r') as f:
secret_key = f.read()
auth = applemusicpy.Auth(secret_key=secret_key, key_id=key_id, team_id=team_id)
client = applemusicpy.Client(auth... | 23.37037 | 83 | 0.73851 | import applemusicpy
from applemusicpy.client import ResourceType
team_id = 'team_id'
key_id = 'key_id'
secret_file = 'AuthKey_' + key_id + '.p8'
with open(secret_file,'r') as f:
secret_key = f.read()
auth = applemusicpy.Auth(secret_key=secret_key, key_id=key_id, team_id=team_id)
client = applemusicpy.Client(auth... | true | true |
f7658ab0cf9dd2582d5243c2f635774f42d1fa38 | 2,007 | py | Python | chatbot/botui.py | fercook/alone_chat | 2e9fd992acabeb41163ed7c1917e0a380ebeaf2e | [
"Apache-2.0"
] | null | null | null | chatbot/botui.py | fercook/alone_chat | 2e9fd992acabeb41163ed7c1917e0a380ebeaf2e | [
"Apache-2.0"
] | null | null | null | chatbot/botui.py | fercook/alone_chat | 2e9fd992acabeb41163ed7c1917e0a380ebeaf2e | [
"Apache-2.0"
] | null | null | null | # Copyright 2017 Bo Shao. 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 agre... | 35.210526 | 80 | 0.643747 | from __future__ import print_function
import os
import sys
import tensorflow as tf
from settings import PROJECT_ROOT
from chatbot.botpredictor import BotPredictor
os.environ['TF_CPP_MIN_LOG_LEVEL'] = '3'
def bot_ui():
corp_dir = os.path.join(PROJECT_ROOT, 'Data', 'Corpus')
knbs_dir = os.path.join(PROJECT_... | true | true |
f7658b4937abe8b772bc140700667f982af9f64f | 3,594 | py | Python | cogs/automod.py | Saz4nd0ra/Ro | 49a40bec65d9e24720150b875348c70f05d390c2 | [
"MIT"
] | null | null | null | cogs/automod.py | Saz4nd0ra/Ro | 49a40bec65d9e24720150b875348c70f05d390c2 | [
"MIT"
] | null | null | null | cogs/automod.py | Saz4nd0ra/Ro | 49a40bec65d9e24720150b875348c70f05d390c2 | [
"MIT"
] | null | null | null | from os import stat
from .utils.context import Context
from discord.ext import commands
import discord
import logging
from .utils.config import Config
from .utils.db import RoDBClient
from .utils.api import RedditAPI
from .utils import static
log = logging.getLogger("cogs.automod")
REDDIT_DOMAINS = [
"reddit.com"... | 34.228571 | 153 | 0.590707 | from os import stat
from .utils.context import Context
from discord.ext import commands
import discord
import logging
from .utils.config import Config
from .utils.db import RoDBClient
from .utils.api import RedditAPI
from .utils import static
log = logging.getLogger("cogs.automod")
REDDIT_DOMAINS = [
"reddit.com"... | true | true |
f7658b4e4c813ded3c024966001da887893ce1e2 | 299 | py | Python | filter/filter_low_quality/main.py | ege-del/sayfa_dev | adc135e05c9a6550ad0cf44e7922fd22b809cdc9 | [
"Unlicense"
] | null | null | null | filter/filter_low_quality/main.py | ege-del/sayfa_dev | adc135e05c9a6550ad0cf44e7922fd22b809cdc9 | [
"Unlicense"
] | null | null | null | filter/filter_low_quality/main.py | ege-del/sayfa_dev | adc135e05c9a6550ad0cf44e7922fd22b809cdc9 | [
"Unlicense"
] | null | null | null | # binary filter
# to complement ranker
import random
def title_filter(data) -> int:
#mockup
return random.randint(0,1)
def _filter(category: str,data: list) -> list:
for i in data:
i['filter_name'] = "low_quality"
i['filter'] = title_filter(i['title'])
return data | 21.357143 | 46 | 0.64214 | import random
def title_filter(data) -> int:
return random.randint(0,1)
def _filter(category: str,data: list) -> list:
for i in data:
i['filter_name'] = "low_quality"
i['filter'] = title_filter(i['title'])
return data | true | true |
f7658c97b0364bbf95c119c2675b5f68dd03ee53 | 2,627 | py | Python | matplotlib-3.4.3/matplotlib-3.4.3/examples/lines_bars_and_markers/hat_graph.py | JohnLauFoo/clc_packages_Yu | 259f01d9b5c02154ce258734d519ae8995cd0991 | [
"MIT"
] | 1 | 2021-11-13T17:21:44.000Z | 2021-11-13T17:21:44.000Z | matplotlib-3.4.3/matplotlib-3.4.3/examples/lines_bars_and_markers/hat_graph.py | JohnLauFoo/clc_packages_Yu | 259f01d9b5c02154ce258734d519ae8995cd0991 | [
"MIT"
] | null | null | null | matplotlib-3.4.3/matplotlib-3.4.3/examples/lines_bars_and_markers/hat_graph.py | JohnLauFoo/clc_packages_Yu | 259f01d9b5c02154ce258734d519ae8995cd0991 | [
"MIT"
] | null | null | null | """
=========
Hat graph
=========
This example shows how to create a `hat graph`_ and how to annotate it with
labels.
.. _hat graph: https://doi.org/10.1186/s41235-019-0182-3
"""
import numpy as np
import matplotlib.pyplot as plt
def hat_graph(ax, xlabels, values, group_labels):
"""
Create a hat graph.
... | 32.036585 | 78 | 0.594595 | import numpy as np
import matplotlib.pyplot as plt
def hat_graph(ax, xlabels, values, group_labels):
def label_bars(heights, rects):
for height, rect in zip(heights, rects):
ax.annotate(f'{height}',
xy=(rect.get_x() + rect.get_width() / 2, height),
... | true | true |
f7658db9067c802c7cce5e6ac067db9ebb8fdff3 | 1,460 | py | Python | forge/lib/shapefile_utils.py | Pandinosaurus/3d-forge | d631e14a9351911c3e5612c73c1608d97ed547d2 | [
"BSD-3-Clause"
] | 31 | 2015-07-13T15:36:50.000Z | 2022-02-07T21:37:51.000Z | forge/lib/shapefile_utils.py | Pandinosaurus/3d-forge | d631e14a9351911c3e5612c73c1608d97ed547d2 | [
"BSD-3-Clause"
] | 109 | 2015-04-24T10:03:24.000Z | 2019-04-12T13:34:01.000Z | forge/lib/shapefile_utils.py | Pandinosaurus/3d-forge | d631e14a9351911c3e5612c73c1608d97ed547d2 | [
"BSD-3-Clause"
] | 16 | 2015-10-03T06:03:22.000Z | 2022-03-31T08:24:37.000Z | # -*- coding: utf-8 -*-
import re
from osgeo import ogr
class ShpToGDALFeatures(object):
def __init__(self, shpFilePath=None):
if shpFilePath is None:
raise Exception('No shapefile path provided')
if re.search(r'(\.shp)$', shpFilePath) is None:
raise TypeError(
... | 31.73913 | 81 | 0.615068 |
import re
from osgeo import ogr
class ShpToGDALFeatures(object):
def __init__(self, shpFilePath=None):
if shpFilePath is None:
raise Exception('No shapefile path provided')
if re.search(r'(\.shp)$', shpFilePath) is None:
raise TypeError(
'Only shapefiles a... | true | true |
f7658dd968cb93884c22572095634be51abd8f94 | 4,861 | py | Python | azure-kusto-ingest/azure/kusto/ingest/_status_q.py | jonathanyip/azure-kusto-python | 54875b16f160ce9a64e86dc7aa12ec208dd369fe | [
"MIT"
] | null | null | null | azure-kusto-ingest/azure/kusto/ingest/_status_q.py | jonathanyip/azure-kusto-python | 54875b16f160ce9a64e86dc7aa12ec208dd369fe | [
"MIT"
] | null | null | null | azure-kusto-ingest/azure/kusto/ingest/_status_q.py | jonathanyip/azure-kusto-python | 54875b16f160ce9a64e86dc7aa12ec208dd369fe | [
"MIT"
] | null | null | null | # Copyright (c) Microsoft Corporation.
# Licensed under the MIT License
import random
from typing import List, Callable
from azure.kusto.ingest._resource_manager import _ResourceUri
from azure.storage.queue import QueueServiceClient, QueueClient, QueueMessage, TextBase64EncodePolicy, TextBase64DecodePolicy
class Qu... | 35.481752 | 131 | 0.598848 | import random
from typing import List, Callable
from azure.kusto.ingest._resource_manager import _ResourceUri
from azure.storage.queue import QueueServiceClient, QueueClient, QueueMessage, TextBase64EncodePolicy, TextBase64DecodePolicy
class QueueDetails:
def __init__(self, name, service):
self.name = n... | true | true |
f7658e2ecf15fd5eb884a7af83a43a4754d18595 | 1,669 | py | Python | functions/electricity/datalogger_connecter.py | FrancescoRisso/Domotico-casa | ff0c5d757c15074a2069a1e16eb41680bef2389a | [
"Apache-2.0"
] | null | null | null | functions/electricity/datalogger_connecter.py | FrancescoRisso/Domotico-casa | ff0c5d757c15074a2069a1e16eb41680bef2389a | [
"Apache-2.0"
] | null | null | null | functions/electricity/datalogger_connecter.py | FrancescoRisso/Domotico-casa | ff0c5d757c15074a2069a1e16eb41680bef2389a | [
"Apache-2.0"
] | 1 | 2019-04-09T06:50:06.000Z | 2019-04-09T06:50:06.000Z | import xml.etree.ElementTree as ET
import requests
import random
from functions.config import config
def dl_connect():
configuration = config()
link = configuration['Datalogger']['ip'] + configuration['Datalogger']['key']
try:
# When the session is expired, this link returns an error
# ... | 22.554054 | 114 | 0.517076 | import xml.etree.ElementTree as ET
import requests
import random
from functions.config import config
def dl_connect():
configuration = config()
link = configuration['Datalogger']['ip'] + configuration['Datalogger']['key']
try:
conn = requests.get(link)
except Excepti... | true | true |
f7658e77606ea79208b1abfb79f90727f3a50961 | 5,647 | py | Python | open_sea_v1/endpoints/assets.py | MyNameIsBondJamesBond/opensea-python-wrapper | a9d1cf492f5e4a278de88cfcce7b02f0a049eb4c | [
"MIT"
] | 14 | 2021-08-01T10:17:00.000Z | 2022-03-07T21:19:50.000Z | open_sea_v1/endpoints/assets.py | MyNameIsBondJamesBond/opensea-python-wrapper | a9d1cf492f5e4a278de88cfcce7b02f0a049eb4c | [
"MIT"
] | 1 | 2021-11-18T12:16:13.000Z | 2021-11-20T22:40:12.000Z | open_sea_v1/endpoints/assets.py | MyNameIsBondJamesBond/opensea-python-wrapper | a9d1cf492f5e4a278de88cfcce7b02f0a049eb4c | [
"MIT"
] | 3 | 2021-09-04T16:10:37.000Z | 2021-10-20T17:56:32.000Z | from dataclasses import dataclass
from enum import Enum
from typing import Optional
from open_sea_v1.endpoints.abc import BaseEndpoint
from open_sea_v1.endpoints.client import BaseClient, ClientParams
from open_sea_v1.endpoints.urls import EndpointURLS
from open_sea_v1.responses.asset import AssetResponse
class Asse... | 38.155405 | 328 | 0.67983 | from dataclasses import dataclass
from enum import Enum
from typing import Optional
from open_sea_v1.endpoints.abc import BaseEndpoint
from open_sea_v1.endpoints.client import BaseClient, ClientParams
from open_sea_v1.endpoints.urls import EndpointURLS
from open_sea_v1.responses.asset import AssetResponse
class Asse... | true | true |
f7658ea7a91b9293b1d4743adccc419ff3adf3ee | 769 | py | Python | maps/views.py | junanote/test_django | a95fdbea2f54820ad73fb1d301935936a3ee120f | [
"Apache-2.0"
] | null | null | null | maps/views.py | junanote/test_django | a95fdbea2f54820ad73fb1d301935936a3ee120f | [
"Apache-2.0"
] | null | null | null | maps/views.py | junanote/test_django | a95fdbea2f54820ad73fb1d301935936a3ee120f | [
"Apache-2.0"
] | null | null | null | from django.shortcuts import render
# Create your views here.
import folium
def home(request):
mf = folium.Map([35.3369, 127.7306], zoom_start=10)
mf = mf._repr_html_()
first ='juna'
result ={'mapfolium': mf, 'fo1':first}
return render(request, template_name='maps/home.html', context=result)
de... | 28.481481 | 76 | 0.648895 | from django.shortcuts import render
import folium
def home(request):
mf = folium.Map([35.3369, 127.7306], zoom_start=10)
mf = mf._repr_html_()
first ='juna'
result ={'mapfolium': mf, 'fo1':first}
return render(request, template_name='maps/home.html', context=result)
def plotly(request):
xAr... | true | true |
f765920cdfc2c43c3d361b62757686fd20538664 | 550 | py | Python | zom/bonbon/migrations/0007_auto_20191014_1550.py | Neha-Prabhu/Zomato-clone | 4d57f784c6de91780a171fe4e2853ccb20c8e8ca | [
"MIT"
] | null | null | null | zom/bonbon/migrations/0007_auto_20191014_1550.py | Neha-Prabhu/Zomato-clone | 4d57f784c6de91780a171fe4e2853ccb20c8e8ca | [
"MIT"
] | null | null | null | zom/bonbon/migrations/0007_auto_20191014_1550.py | Neha-Prabhu/Zomato-clone | 4d57f784c6de91780a171fe4e2853ccb20c8e8ca | [
"MIT"
] | 1 | 2020-08-09T11:54:26.000Z | 2020-08-09T11:54:26.000Z | # Generated by Django 2.2.4 on 2019-10-14 10:20
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('bonbon', '0006_auto_20191013_0512'),
]
operations = [
migrations.AddField(
model_name='res',
name='cate',
... | 22.916667 | 62 | 0.570909 |
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('bonbon', '0006_auto_20191013_0512'),
]
operations = [
migrations.AddField(
model_name='res',
name='cate',
field=models.CharField(max_length=300, null=Tr... | true | true |
f765932772fbd4e63fbd89b43a478d77abfbefb3 | 128 | py | Python | MouseLogger_example.py | ArmenG888/PyLogger | 1ac3c551f8831259ceabf8a9ee8270658cc2df60 | [
"MIT"
] | 1 | 2021-11-19T01:09:00.000Z | 2021-11-19T01:09:00.000Z | MouseLogger_example.py | ArmenG888/PyLogger | 1ac3c551f8831259ceabf8a9ee8270658cc2df60 | [
"MIT"
] | 1 | 2021-09-06T15:00:46.000Z | 2021-09-06T15:00:46.000Z | MouseLogger_example.py | ArmenG888/PyLogger | 1ac3c551f8831259ceabf8a9ee8270658cc2df60 | [
"MIT"
] | 2 | 2021-09-06T01:42:04.000Z | 2021-09-06T01:50:35.000Z | import main as Logger # import PyLogger.main as Logger
logger = Logger.MouseLogger("Logs/mouselog.txt")
logger.init_logging()
| 21.333333 | 54 | 0.78125 | import main as Logger
logger = Logger.MouseLogger("Logs/mouselog.txt")
logger.init_logging()
| true | true |
f76594329f7ba73952e6ecb6653f1371488367a2 | 726 | py | Python | modules/Stage.py | slyviacassell/Multi-taks-UNITE | a010a92c94c0ee0f1ffed27df6d89da58d6d34c5 | [
"MIT"
] | null | null | null | modules/Stage.py | slyviacassell/Multi-taks-UNITE | a010a92c94c0ee0f1ffed27df6d89da58d6d34c5 | [
"MIT"
] | null | null | null | modules/Stage.py | slyviacassell/Multi-taks-UNITE | a010a92c94c0ee0f1ffed27df6d89da58d6d34c5 | [
"MIT"
] | null | null | null | # coding=utf-8
'''
Created: 2021/3/12
@author: Slyviacassell@github.com
'''
import torch
import torch.nn as nn
from memonger import SublinearSequential
class Stage(nn.Module):
def __init__(self, out_channels, layers):
super(Stage, self).__init__()
if isinstance(layers, (nn.Sequential, Sublinear... | 25.034483 | 68 | 0.630854 |
import torch
import torch.nn as nn
from memonger import SublinearSequential
class Stage(nn.Module):
def __init__(self, out_channels, layers):
super(Stage, self).__init__()
if isinstance(layers, (nn.Sequential, SublinearSequential)):
self.feature = layers
else:
se... | true | true |
f765949f2cfea26f960a1e73a9b6ea104cc14fa0 | 7,315 | py | Python | lib/django/core/servers/basehttp.py | bretlowery/snakr | eee58a18df2e194b72b5dc07cc5a27856f49593c | [
"BSD-3-Clause"
] | 1 | 2016-11-27T23:31:33.000Z | 2016-11-27T23:31:33.000Z | lib/django/core/servers/basehttp.py | bretlowery/snakr | eee58a18df2e194b72b5dc07cc5a27856f49593c | [
"BSD-3-Clause"
] | null | null | null | lib/django/core/servers/basehttp.py | bretlowery/snakr | eee58a18df2e194b72b5dc07cc5a27856f49593c | [
"BSD-3-Clause"
] | null | null | null | """
HTTP server that implements the Python WSGI protocol (PEP 333, rev 1.21).
Based on wsgiref.simple_server which is part of the standard library since 2.5.
This is a simple server for use in testing or debugging Django apps. It hasn't
been reviewed for security issues. DON'T USE IT FOR PRODUCTION USE!
"""
from __f... | 36.758794 | 90 | 0.649897 |
from __future__ import unicode_literals
import socket
import sys
from wsgiref import simple_server
from django.core.exceptions import ImproperlyConfigured
from django.core.handlers.wsgi import ISO_8859_1, UTF_8
from django.core.management.color import color_style
from django.core.wsgi import get_wsgi_application
fro... | true | true |
f76596ab17f9e85b9bfa9b30ce0accaa9645cdd4 | 1,923 | py | Python | torch_kalman/state_belief/utils.py | Suhwan-Dev/torch-kalman | f310c42e264d1642819e4c49a8b0212209a18a85 | [
"MIT"
] | null | null | null | torch_kalman/state_belief/utils.py | Suhwan-Dev/torch-kalman | f310c42e264d1642819e4c49a8b0212209a18a85 | [
"MIT"
] | null | null | null | torch_kalman/state_belief/utils.py | Suhwan-Dev/torch-kalman | f310c42e264d1642819e4c49a8b0212209a18a85 | [
"MIT"
] | null | null | null | from typing import Tuple, Optional
from torch import Tensor
from torch.distributions import MultivariateNormal
import numpy as np
from torch.distributions.multivariate_normal import _batch_mv
from torch.distributions.utils import _standard_normal
def bmat_idx(*args) -> Tuple:
"""
Create indices for tensor a... | 42.733333 | 119 | 0.690588 | from typing import Tuple, Optional
from torch import Tensor
from torch.distributions import MultivariateNormal
import numpy as np
from torch.distributions.multivariate_normal import _batch_mv
from torch.distributions.utils import _standard_normal
def bmat_idx(*args) -> Tuple:
if len(args) == 0:
return ... | true | true |
f76596c825b7ea59d7fd33d29f622f895bb460c9 | 766 | py | Python | ultron/actions/twitter/followuser.py | Prakash2403/ultron | 7d1067eb98ef52f6a88299534ea204e7ae45d7a7 | [
"MIT"
] | 13 | 2017-08-15T15:50:13.000Z | 2019-06-03T10:24:50.000Z | ultron/actions/twitter/followuser.py | Prakash2403/ultron | 7d1067eb98ef52f6a88299534ea204e7ae45d7a7 | [
"MIT"
] | 3 | 2017-08-29T16:35:04.000Z | 2021-06-01T23:49:16.000Z | ultron/actions/twitter/followuser.py | Prakash2403/ultron | 7d1067eb98ef52f6a88299534ea204e7ae45d7a7 | [
"MIT"
] | 4 | 2017-08-16T09:33:59.000Z | 2019-06-05T07:25:30.000Z | from tweepy import TweepError
from ultron.actions import Action
from ultron.exception.twitterexceptions import InvalidUserException
from ultron.helpers.twitter_helper import load_api
class FollowUser(Action):
def __init__(self, screen_name):
self.api = load_api()
self.follow_status = False
... | 26.413793 | 68 | 0.663185 | from tweepy import TweepError
from ultron.actions import Action
from ultron.exception.twitterexceptions import InvalidUserException
from ultron.helpers.twitter_helper import load_api
class FollowUser(Action):
def __init__(self, screen_name):
self.api = load_api()
self.follow_status = False
... | true | true |
f76596d80736ff9fbcaf4c3bcf56d5deb5c02d0b | 16,488 | py | Python | exporter/opentelemetry-exporter-prometheus-remote-write/tests/test_prometheus_remote_write_exporter.py | wangzlei/opentelemetry-python-contrib | 9926b35ac3ffc80520900729779926a6bd1af998 | [
"Apache-2.0",
"BSD-3-Clause"
] | null | null | null | exporter/opentelemetry-exporter-prometheus-remote-write/tests/test_prometheus_remote_write_exporter.py | wangzlei/opentelemetry-python-contrib | 9926b35ac3ffc80520900729779926a6bd1af998 | [
"Apache-2.0",
"BSD-3-Clause"
] | null | null | null | exporter/opentelemetry-exporter-prometheus-remote-write/tests/test_prometheus_remote_write_exporter.py | wangzlei/opentelemetry-python-contrib | 9926b35ac3ffc80520900729779926a6bd1af998 | [
"Apache-2.0",
"BSD-3-Clause"
] | null | null | null | # Copyright The OpenTelemetry 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 ... | 39.73012 | 84 | 0.655204 |
import unittest
from unittest.mock import patch
from opentelemetry.exporter.prometheus_remote_write import (
PrometheusRemoteWriteMetricsExporter,
)
from opentelemetry.exporter.prometheus_remote_write.gen.types_pb2 import (
Label,
TimeSeries,
)
from opentelemetry.sdk.metrics import Counter
from openteleme... | true | true |
f765976cfe29012a195e1f76f585291cfabf6730 | 394 | py | Python | tbx/wsgi.py | arush15june/wagtail-torchbox | c4d06e096c72bd8007975dc016133024f9d27fab | [
"MIT"
] | 103 | 2015-02-24T17:58:21.000Z | 2022-03-23T08:08:58.000Z | tbx/wsgi.py | arush15june/wagtail-torchbox | c4d06e096c72bd8007975dc016133024f9d27fab | [
"MIT"
] | 145 | 2015-01-13T17:13:43.000Z | 2022-03-29T12:56:20.000Z | tbx/wsgi.py | arush15june/wagtail-torchbox | c4d06e096c72bd8007975dc016133024f9d27fab | [
"MIT"
] | 57 | 2015-01-03T12:00:37.000Z | 2022-02-09T13:11:30.000Z | """
WSGI config for tbx project.
It exposes the WSGI callable as a module-level variable named ``application``.
For more information on this file, see
https://docs.djangoproject.com/en/1.8/howto/deployment/wsgi/
"""
import os
from django.core.wsgi import get_wsgi_application
os.environ.setdefault("DJANGO_SETTINGS_... | 23.176471 | 78 | 0.784264 |
import os
from django.core.wsgi import get_wsgi_application
os.environ.setdefault("DJANGO_SETTINGS_MODULE", "tbx.settings.production")
application = get_wsgi_application()
| true | true |
f765978585af00d7d34a336569dfdad6065a8a27 | 10,795 | py | Python | redash/query_runner/big_query.py | upman/redash | 8df2391a775204131fe1eb21df95bd9d4f9ae6b3 | [
"BSD-2-Clause"
] | 4 | 2018-07-31T09:39:33.000Z | 2019-05-22T23:56:18.000Z | redash/query_runner/big_query.py | upman/redash | 8df2391a775204131fe1eb21df95bd9d4f9ae6b3 | [
"BSD-2-Clause"
] | 60 | 2019-05-31T06:11:35.000Z | 2021-06-25T15:20:33.000Z | redash/query_runner/big_query.py | hackebrot/redash | 3f3a86eac324ee6c03450b8e3eb9e8fbe1e58a38 | [
"BSD-2-Clause"
] | 2 | 2018-07-06T23:48:38.000Z | 2018-07-11T01:21:05.000Z | import datetime
import json
import logging
import sys
import time
from base64 import b64decode
import httplib2
import requests
from redash import settings
from redash.query_runner import *
from redash.utils import JSONEncoder
logger = logging.getLogger(__name__)
try:
import apiclient.errors
from apiclient.d... | 33.524845 | 167 | 0.565262 | import datetime
import json
import logging
import sys
import time
from base64 import b64decode
import httplib2
import requests
from redash import settings
from redash.query_runner import *
from redash.utils import JSONEncoder
logger = logging.getLogger(__name__)
try:
import apiclient.errors
from apiclient.d... | false | true |
f76598553aa8a1a407308bcda49fec0a737f721f | 5,950 | py | Python | infra/libs/git.py | allaparthi/monorail | e18645fc1b952a5a6ff5f06e0c740d75f1904473 | [
"BSD-3-Clause"
] | 2 | 2021-04-13T21:22:18.000Z | 2021-09-07T02:11:57.000Z | infra/libs/git.py | allaparthi/monorail | e18645fc1b952a5a6ff5f06e0c740d75f1904473 | [
"BSD-3-Clause"
] | 21 | 2020-09-06T02:41:05.000Z | 2022-03-02T04:40:01.000Z | infra/libs/git.py | allaparthi/monorail | e18645fc1b952a5a6ff5f06e0c740d75f1904473 | [
"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.
"""Utility for dealing with Git repositories."""
import logging
import os
import shutil
import stat
import subprocess
import sys
import tempfile
import time... | 30.670103 | 79 | 0.647731 |
import logging
import os
import shutil
import stat
import subprocess
import sys
import tempfile
import time
from types import MethodType
LOGGER = logging.getLogger(__name__)
class GitException(UserWarning):
pass
class Git(object):
def __init__(self, path): self.path = os.path.abspath(path)
def __c... | true | true |
f7659c99e76f7787dd9aa1b2df00aaa2ee984e44 | 333 | py | Python | Matura/Python/src/Search.py | harutekku/Matura | 2a77818cb148cc94337f08129502c88ec355ec6b | [
"MIT"
] | null | null | null | Matura/Python/src/Search.py | harutekku/Matura | 2a77818cb148cc94337f08129502c88ec355ec6b | [
"MIT"
] | null | null | null | Matura/Python/src/Search.py | harutekku/Matura | 2a77818cb148cc94337f08129502c88ec355ec6b | [
"MIT"
] | null | null | null | def BinarySearch(Array, LowerBound, UpperBound, What):
while LowerBound != UpperBound:
mid = (LowerBound + UpperBound) // 2
if Array[mid] < What:
LowerBound = mid
elif Array[mid] > What:
UpperBound = mid - 1
else:
return mid
re... | 23.785714 | 55 | 0.51952 | def BinarySearch(Array, LowerBound, UpperBound, What):
while LowerBound != UpperBound:
mid = (LowerBound + UpperBound) // 2
if Array[mid] < What:
LowerBound = mid
elif Array[mid] > What:
UpperBound = mid - 1
else:
return mid
re... | true | true |
f7659cd7ada36d73f4a1f3265d8873c42b9289c8 | 3,359 | py | Python | nextdl/extractor/varzesh3.py | devenu85/nextdl | 0b458f556e2e0be80cb94bd9a9b1405ad2e9182d | [
"MIT"
] | 1 | 2021-12-19T13:55:20.000Z | 2021-12-19T13:55:20.000Z | nextdl/extractor/varzesh3.py | devenu85/nextdl | 0b458f556e2e0be80cb94bd9a9b1405ad2e9182d | [
"MIT"
] | null | null | null | nextdl/extractor/varzesh3.py | devenu85/nextdl | 0b458f556e2e0be80cb94bd9a9b1405ad2e9182d | [
"MIT"
] | null | null | null | # coding: utf-8
from __future__ import unicode_literals
from ..compat import compat_parse_qs, compat_urllib_parse_urlparse
from ..utils import clean_html, remove_start
from .common import InfoExtractor
class Varzesh3IE(InfoExtractor):
_VALID_URL = r"https?://(?:www\.)?video\.varzesh3\.com/(?:[^/]+/)+(?P<id>[^/]+... | 38.170455 | 265 | 0.525752 | from __future__ import unicode_literals
from ..compat import compat_parse_qs, compat_urllib_parse_urlparse
from ..utils import clean_html, remove_start
from .common import InfoExtractor
class Varzesh3IE(InfoExtractor):
_VALID_URL = r"https?://(?:www\.)?video\.varzesh3\.com/(?:[^/]+/)+(?P<id>[^/]+)/?"
_TESTS ... | true | true |
f7659d28ab65965a96c4819bd16e81ed69bab052 | 83 | py | Python | tests/test_private.py | tombulled/visibility | 6c24bc6f325ba9612ab26db2f11fc62a6ba225a8 | [
"MIT"
] | null | null | null | tests/test_private.py | tombulled/visibility | 6c24bc6f325ba9612ab26db2f11fc62a6ba225a8 | [
"MIT"
] | 1 | 2022-02-16T22:24:03.000Z | 2022-02-16T22:27:16.000Z | tests/test_private.py | tombulled/export | 6c24bc6f325ba9612ab26db2f11fc62a6ba225a8 | [
"MIT"
] | null | null | null | import private
def test_exports() -> None:
assert private.__all__ == ["foo"]
| 13.833333 | 37 | 0.662651 | import private
def test_exports() -> None:
assert private.__all__ == ["foo"]
| true | true |
f7659dce9e9faecfc762d98c38b028c75fefa576 | 911 | py | Python | demos/4-12/fizz_buzz.py | maetshju/Ling471 | 82111b50c6eea35a04339d5a69f866ee85237f35 | [
"MIT"
] | null | null | null | demos/4-12/fizz_buzz.py | maetshju/Ling471 | 82111b50c6eea35a04339d5a69f866ee85237f35 | [
"MIT"
] | null | null | null | demos/4-12/fizz_buzz.py | maetshju/Ling471 | 82111b50c6eea35a04339d5a69f866ee85237f35 | [
"MIT"
] | null | null | null | if __name__ == '__main__':
# Fill in the code to do the following
# 1. Set x to be a non-negative integer (no decimals, no negatives)
# 2. If x is divisible by 3, print 'Fizz'
# 3. If x is divisible by 5, print 'Buzz'
# 4. If x is divisible by both 3 and 5, print 'FizzBuzz'
# 5. If x is divisib... | 41.409091 | 77 | 0.639956 | if __name__ == '__main__':
x = 1
| true | true |
f7659ea5e6a198ee244a820f2951d78fac21714a | 5,382 | py | Python | dev/src/load/external_data.py | iamjli/AnswerALS_QTL | 0adf7bb8747730dd23d8669b6cd5d27e20a4743f | [
"MIT"
] | null | null | null | dev/src/load/external_data.py | iamjli/AnswerALS_QTL | 0adf7bb8747730dd23d8669b6cd5d27e20a4743f | [
"MIT"
] | null | null | null | dev/src/load/external_data.py | iamjli/AnswerALS_QTL | 0adf7bb8747730dd23d8669b6cd5d27e20a4743f | [
"MIT"
] | null | null | null | #!/usr/bin/env python3
from pathlib import Path
import pandas as pd
from src import base_dir, logger
_external_data_paths = {
# "rsid": base_dir / "tensorqtl_runs/genomes_210409/snp_list.biallelic_known_snps.harmonized.VQSR_filtered_99.rsID.GT_only.pkl",
"rsid": base_dir / "tensorqtl_runs/genomes_210409/snp_posi... | 33.018405 | 135 | 0.68599 |
from pathlib import Path
import pandas as pd
from src import base_dir, logger
_external_data_paths = {
"rsid": base_dir / "tensorqtl_runs/genomes_210409/snp_positions.biallelic_known_snps.harmonized.VQSR_filtered_99.rsID.GT_only.pickle",
"ensg": base_dir / "data/external/ENSG_to_symbol.tsv",
"snp2tf": base_di... | true | true |
f7659ed05d83253e8127d9550f824400e8c0ed27 | 2,660 | py | Python | webapp/graphite/finders/ceres.py | TimWhalen/graphite-web | e150af45e01d01141a8767ec0597e218105b9914 | [
"Apache-2.0"
] | 1 | 2021-01-16T20:10:45.000Z | 2021-01-16T20:10:45.000Z | webapp/graphite/finders/ceres.py | TimWhalen/graphite-web | e150af45e01d01141a8767ec0597e218105b9914 | [
"Apache-2.0"
] | null | null | null | webapp/graphite/finders/ceres.py | TimWhalen/graphite-web | e150af45e01d01141a8767ec0597e218105b9914 | [
"Apache-2.0"
] | null | null | null | from __future__ import absolute_import
import os.path
# Use the built-in version of walk if possible, otherwise
# use the scandir module version
try:
from os import walk
except ImportError:
from scandir import walk
from glob import glob
from ceres import CeresTree, CeresNode
from django.conf import settings
... | 37.464789 | 99 | 0.628195 | from __future__ import absolute_import
import os.path
try:
from os import walk
except ImportError:
from scandir import walk
from glob import glob
from ceres import CeresTree, CeresNode
from django.conf import settings
from graphite.node import BranchNode, LeafNode
from graphite.readers import CeresReader
fro... | true | true |
f7659fc390efd68c9afb42f976afedbdce9aeef9 | 10,110 | py | Python | get_data.py | berntsendavid/obj-c-static-analyzer | b84b34c062aa6965299744484ae43161ff13bfe9 | [
"MIT"
] | 1 | 2018-07-02T06:48:46.000Z | 2018-07-02T06:48:46.000Z | get_data.py | berntsendavid/obj-c-static-analyzer | b84b34c062aa6965299744484ae43161ff13bfe9 | [
"MIT"
] | null | null | null | get_data.py | berntsendavid/obj-c-static-analyzer | b84b34c062aa6965299744484ae43161ff13bfe9 | [
"MIT"
] | null | null | null | #!/usr/local/bin/python
import re
import sh
import sys
import os
#####################
# Comment functions #
#####################
def find_substring(substring, string):
indices = []
index = -1 # Begin at -1 so index + 1 is 0
while True:
# Find next index of substring, by starting search from ind... | 32.197452 | 172 | 0.611375 |
import re
import sh
import sys
import os
def find_substring(substring, string):
indices = []
index = -1 while True:
index = string.find(substring, index + 1)
if index == -1:
break indices.append(index)
return len(indices)
def find_multiline_comments(strin... | true | true |
f765a20c71ea75fb7b9f20f261b51865cc23fe74 | 14,144 | py | Python | src/pretix/base/services/invoices.py | ahus1/pretix | ae9b8bafb8829acbeccd9faa7f3ffe203198a10c | [
"ECL-2.0",
"Apache-2.0"
] | null | null | null | src/pretix/base/services/invoices.py | ahus1/pretix | ae9b8bafb8829acbeccd9faa7f3ffe203198a10c | [
"ECL-2.0",
"Apache-2.0"
] | null | null | null | src/pretix/base/services/invoices.py | ahus1/pretix | ae9b8bafb8829acbeccd9faa7f3ffe203198a10c | [
"ECL-2.0",
"Apache-2.0"
] | null | null | null | import json
import logging
import urllib.error
from datetime import date, timedelta
from decimal import ROUND_HALF_UP, Decimal
import vat_moss.exchange_rates
from django.conf import settings
from django.core.files.base import ContentFile
from django.core.serializers.json import DjangoJSONEncoder
from django.db import ... | 40.181818 | 119 | 0.652715 | import json
import logging
import urllib.error
from datetime import date, timedelta
from decimal import ROUND_HALF_UP, Decimal
import vat_moss.exchange_rates
from django.conf import settings
from django.core.files.base import ContentFile
from django.core.serializers.json import DjangoJSONEncoder
from django.db import ... | true | true |
f765a23d2a0b581bb6b11698079d4fe3fcdd40c5 | 1,921 | py | Python | gaphor/RAAML/fta/transferout.py | Texopolis/gaphor | 3b190620075fd413258af1e7a007b4b2167a7564 | [
"Apache-2.0"
] | 1 | 2022-01-30T15:33:53.000Z | 2022-01-30T15:33:53.000Z | gaphor/RAAML/fta/transferout.py | burakozturk16/gaphor | 86267a5200ac4439626d35d306dbb376c3800107 | [
"Apache-2.0"
] | null | null | null | gaphor/RAAML/fta/transferout.py | burakozturk16/gaphor | 86267a5200ac4439626d35d306dbb376c3800107 | [
"Apache-2.0"
] | 1 | 2022-01-23T18:36:27.000Z | 2022-01-23T18:36:27.000Z | """Transfer Out item definition."""
from gaphas.geometry import Rectangle
from gaphor.core import gettext
from gaphor.core.modeling import DrawContext
from gaphor.diagram.presentation import (
Classified,
ElementPresentation,
from_package_str,
)
from gaphor.diagram.shapes import Box, IconBox, Text, stroke... | 32.559322 | 88 | 0.642894 |
from gaphas.geometry import Rectangle
from gaphor.core import gettext
from gaphor.core.modeling import DrawContext
from gaphor.diagram.presentation import (
Classified,
ElementPresentation,
from_package_str,
)
from gaphor.diagram.shapes import Box, IconBox, Text, stroke
from gaphor.diagram.support import ... | true | true |
f765a25afb2238be8704e1d7c54e625c217446e3 | 427 | py | Python | kubernetes_typed/client/models/v1_custom_resource_definition_names.py | nikhiljha/kubernetes-typed | 4f4b969aa400c88306f92560e56bda6d19b2a895 | [
"Apache-2.0"
] | 22 | 2020-12-10T13:06:02.000Z | 2022-02-13T21:58:15.000Z | kubernetes_typed/client/models/v1_custom_resource_definition_names.py | nikhiljha/kubernetes-typed | 4f4b969aa400c88306f92560e56bda6d19b2a895 | [
"Apache-2.0"
] | 4 | 2021-03-08T07:06:12.000Z | 2022-03-29T23:41:45.000Z | kubernetes_typed/client/models/v1_custom_resource_definition_names.py | nikhiljha/kubernetes-typed | 4f4b969aa400c88306f92560e56bda6d19b2a895 | [
"Apache-2.0"
] | 2 | 2021-09-05T19:18:28.000Z | 2022-03-14T02:56:17.000Z | # Code generated by `typeddictgen`. DO NOT EDIT.
"""V1CustomResourceDefinitionNamesDict generated type."""
from typing import TypedDict, List
V1CustomResourceDefinitionNamesDict = TypedDict(
"V1CustomResourceDefinitionNamesDict",
{
"categories": List[str],
"kind": str,
"listKind": str,
... | 25.117647 | 57 | 0.641686 | from typing import TypedDict, List
V1CustomResourceDefinitionNamesDict = TypedDict(
"V1CustomResourceDefinitionNamesDict",
{
"categories": List[str],
"kind": str,
"listKind": str,
"plural": str,
"shortNames": List[str],
"singular": str,
},
total=False,
)
| true | true |
f765a294522964f8d9f0eb7746ec91d821a40a14 | 709 | py | Python | run.py | smirnovich/ofd | 9144c4c7f49af0704c0ed59b6139736385ab5d48 | [
"MIT"
] | 4 | 2020-11-09T10:20:39.000Z | 2022-02-26T23:10:31.000Z | run.py | smirnovich/ofd | 9144c4c7f49af0704c0ed59b6139736385ab5d48 | [
"MIT"
] | 1 | 2020-11-09T14:05:01.000Z | 2020-11-09T14:05:01.000Z | run.py | smirnovich/ofd | 9144c4c7f49af0704c0ed59b6139736385ab5d48 | [
"MIT"
] | 4 | 2020-11-09T10:20:53.000Z | 2021-09-03T09:17:55.000Z | from pathlib import Path
from vunit.verilog import VUnit
VU = VUnit.from_argv()
p = Path(__file__).parent
print(p)
lib = VU.add_library("lib")
lib.add_source_files(p / "example/*.sv", allow_empty=True)
lib.add_source_files(p / "ofd/example/*.sv", allow_empty=True)
lib.add_source_files(p / "*.sv", allow_empty=True)
lib... | 39.388889 | 91 | 0.747532 | from pathlib import Path
from vunit.verilog import VUnit
VU = VUnit.from_argv()
p = Path(__file__).parent
print(p)
lib = VU.add_library("lib")
lib.add_source_files(p / "example/*.sv", allow_empty=True)
lib.add_source_files(p / "ofd/example/*.sv", allow_empty=True)
lib.add_source_files(p / "*.sv", allow_empty=True)
lib... | true | true |
f765a315dd00a1e5aad298a66418b4f66102be3b | 3,559 | py | Python | item_functions.py | sbackus/RogueLike | 75d535b2f28c548edc4e0a26c31282a6aed90307 | [
"MIT"
] | 1 | 2021-11-17T05:32:43.000Z | 2021-11-17T05:32:43.000Z | item_functions.py | sbackus/RogueLike | 75d535b2f28c548edc4e0a26c31282a6aed90307 | [
"MIT"
] | 33 | 2019-10-06T15:12:11.000Z | 2019-10-09T00:41:44.000Z | item_functions.py | sbackus/RogueLike | 75d535b2f28c548edc4e0a26c31282a6aed90307 | [
"MIT"
] | 2 | 2019-10-07T00:10:06.000Z | 2019-10-07T13:08:58.000Z | import tcod as libtcod
from components.ai import ConfusedMonster
from game_messages import Message
def heal(*args, **kwargs):
entity = args[0]
amount = kwargs.get('amount')
results = []
if entity.fighter.hp == entity.fighter.max_hp:
results.append({'consumed': False, 'message': Message('You... | 35.59 | 182 | 0.660579 | import tcod as libtcod
from components.ai import ConfusedMonster
from game_messages import Message
def heal(*args, **kwargs):
entity = args[0]
amount = kwargs.get('amount')
results = []
if entity.fighter.hp == entity.fighter.max_hp:
results.append({'consumed': False, 'message': Message('You... | true | true |
f765a3a69cc68b569e5393ebad78709e6ec9319f | 481 | py | Python | static_server.py | bdon/80s.nyc | e4c84e7e2756f33d71cc6f300d46ee11ff5f5a92 | [
"BSD-2-Clause"
] | 50 | 2017-09-15T16:08:37.000Z | 2022-02-05T00:47:59.000Z | static_server.py | josephmisiti/80s.nyc | ed06a2d661f61780e1aa5a5c5e69b4e29100c6d8 | [
"MIT"
] | 9 | 2017-09-16T03:57:34.000Z | 2020-12-11T19:05:30.000Z | static_server.py | josephmisiti/80s.nyc | ed06a2d661f61780e1aa5a5c5e69b4e29100c6d8 | [
"MIT"
] | 3 | 2017-09-16T03:50:44.000Z | 2018-09-26T06:36:23.000Z | #!/usr/bin/env python
import SimpleHTTPServer
class MyHTTPRequestHandler(SimpleHTTPServer.SimpleHTTPRequestHandler):
def end_headers(self):
self.send_my_headers()
SimpleHTTPServer.SimpleHTTPRequestHandler.end_headers(self)
def send_my_headers(self):
self.send_header("Access-Control-Al... | 28.294118 | 70 | 0.746362 | import SimpleHTTPServer
class MyHTTPRequestHandler(SimpleHTTPServer.SimpleHTTPRequestHandler):
def end_headers(self):
self.send_my_headers()
SimpleHTTPServer.SimpleHTTPRequestHandler.end_headers(self)
def send_my_headers(self):
self.send_header("Access-Control-Allow-Origin", "*")
... | true | true |
f765a51b6d18edfd93a7d34550c576b6550d48e6 | 677 | py | Python | ring7.py | Driftwood2D/blue | 02b5bd3dbbc8fe2836f88c8beaa0955344cc7998 | [
"MIT"
] | null | null | null | ring7.py | Driftwood2D/blue | 02b5bd3dbbc8fe2836f88c8beaa0955344cc7998 | [
"MIT"
] | null | null | null | ring7.py | Driftwood2D/blue | 02b5bd3dbbc8fe2836f88c8beaa0955344cc7998 | [
"MIT"
] | null | null | null | def kill_door():
Driftwood.script["rumble.py"].end_rumble()
Driftwood.tick.register(kill_door_callback1, once=True, delay=1.0)
Driftwood.tick.register(kill_door_callback2, once=True, delay=2.0)
Driftwood.tick.register(kill_door_callback3, once=True, delay=3.0)
def kill_door_callback1(seconds_past):
... | 30.772727 | 70 | 0.753323 | def kill_door():
Driftwood.script["rumble.py"].end_rumble()
Driftwood.tick.register(kill_door_callback1, once=True, delay=1.0)
Driftwood.tick.register(kill_door_callback2, once=True, delay=2.0)
Driftwood.tick.register(kill_door_callback3, once=True, delay=3.0)
def kill_door_callback1(seconds_past):
... | true | true |
f765a52c08e6ed894d274301000941c558d662a9 | 4,445 | py | Python | python/2019_09_1.py | wensby/advent-of-code | 50cd7fa2d35674d868a79ac8c75be24a43267e2b | [
"MIT"
] | null | null | null | python/2019_09_1.py | wensby/advent-of-code | 50cd7fa2d35674d868a79ac8c75be24a43267e2b | [
"MIT"
] | null | null | null | python/2019_09_1.py | wensby/advent-of-code | 50cd7fa2d35674d868a79ac8c75be24a43267e2b | [
"MIT"
] | null | null | null | import sys
class Process:
def __init__(self, program, input, output):
self._program = program.copy()
self._input = input
self._output = output
self._heap = {}
self._wait_input = False
self._halted = False
self._instruction_ptr = 0
self._relative_base = 0
def run(self):
self._w... | 26.301775 | 66 | 0.655793 | import sys
class Process:
def __init__(self, program, input, output):
self._program = program.copy()
self._input = input
self._output = output
self._heap = {}
self._wait_input = False
self._halted = False
self._instruction_ptr = 0
self._relative_base = 0
def run(self):
self._w... | true | true |
f765a663740c4ae4eab7f882c892c142b5370b63 | 6,260 | py | Python | tests/unit/objects/test_tree.py | steph-en-m/dvc | 13238e97168007cb5ba21966368457776274b9ca | [
"Apache-2.0"
] | 1 | 2022-03-16T13:27:40.000Z | 2022-03-16T13:27:40.000Z | tests/unit/objects/test_tree.py | steph-en-m/dvc | 13238e97168007cb5ba21966368457776274b9ca | [
"Apache-2.0"
] | 41 | 2021-11-16T15:38:50.000Z | 2022-03-30T10:32:14.000Z | tests/unit/objects/test_tree.py | steph-en-m/dvc | 13238e97168007cb5ba21966368457776274b9ca | [
"Apache-2.0"
] | null | null | null | from operator import itemgetter
import pytest
from dvc.data.meta import Meta
from dvc.data.tree import Tree, _merge
from dvc.hash_info import HashInfo
@pytest.mark.parametrize(
"lst, trie_dict",
[
([], {}),
(
[
{"md5": "def", "relpath": "zzz"},
{"m... | 31.144279 | 71 | 0.351278 | from operator import itemgetter
import pytest
from dvc.data.meta import Meta
from dvc.data.tree import Tree, _merge
from dvc.hash_info import HashInfo
@pytest.mark.parametrize(
"lst, trie_dict",
[
([], {}),
(
[
{"md5": "def", "relpath": "zzz"},
{"m... | true | true |
f765a86733ecf32a801a777cf191cce747388a5a | 491 | py | Python | app/main.py | shambarick/mogship-leveling | b12e24cc45c30011f977b6840d7abdf3fa454b55 | [
"MIT"
] | 1 | 2020-11-25T10:32:25.000Z | 2020-11-25T10:32:25.000Z | app/main.py | shambarick/mogship-leveling | b12e24cc45c30011f977b6840d7abdf3fa454b55 | [
"MIT"
] | null | null | null | app/main.py | shambarick/mogship-leveling | b12e24cc45c30011f977b6840d7abdf3fa454b55 | [
"MIT"
] | null | null | null | from fastapi import FastAPI
import uvicorn
from app.api.api_v1.api import api_router
from app.core import elasticsearch as es
from app.core.logging import init_logging
init_logging()
def create_app() -> FastAPI:
app = FastAPI()
app.add_event_handler("startup", es.connect_to_es)
app.add_event_handler("sh... | 21.347826 | 61 | 0.747454 | from fastapi import FastAPI
import uvicorn
from app.api.api_v1.api import api_router
from app.core import elasticsearch as es
from app.core.logging import init_logging
init_logging()
def create_app() -> FastAPI:
app = FastAPI()
app.add_event_handler("startup", es.connect_to_es)
app.add_event_handler("sh... | true | true |
f765abb32b4dc003439593a432c8c8569be6a36f | 7,216 | py | Python | nova/tests/virt/xenapi/image/test_glance.py | bopopescu/nova-40 | d8d5e4c4e30d0e605001ebab9f19005d2ea96f99 | [
"Apache-2.0"
] | null | null | null | nova/tests/virt/xenapi/image/test_glance.py | bopopescu/nova-40 | d8d5e4c4e30d0e605001ebab9f19005d2ea96f99 | [
"Apache-2.0"
] | null | null | null | nova/tests/virt/xenapi/image/test_glance.py | bopopescu/nova-40 | d8d5e4c4e30d0e605001ebab9f19005d2ea96f99 | [
"Apache-2.0"
] | 1 | 2020-07-24T09:44:17.000Z | 2020-07-24T09:44:17.000Z | # vim: tabstop=4 shiftwidth=4 softtabstop=4
# Copyright 2013 OpenStack Foundation
# 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.apach... | 40.768362 | 79 | 0.594512 |
import time
from nova import context
from nova import exception
from nova.tests.virt.xenapi import stubs
from nova.virt.xenapi import driver as xenapi_conn
from nova.virt.xenapi import fake
from nova.virt.xenapi.image import glance
from nova.virt.xenapi import vm_utils
class TestGlanceStore(stubs.XenAPITestBase):
... | true | true |
f765ad334ac141f67e781b26c7e6095a804be8d9 | 741 | py | Python | src/clients/musixmatch/models.py | juanitodread/gorrion | 1f2c16b7402c237dfb4b47f0fa0afeb3bff7bd19 | [
"Apache-2.0"
] | 1 | 2020-09-18T17:53:03.000Z | 2020-09-18T17:53:03.000Z | src/clients/musixmatch/models.py | juanitodread/gorrion | 1f2c16b7402c237dfb4b47f0fa0afeb3bff7bd19 | [
"Apache-2.0"
] | 6 | 2020-10-27T03:31:41.000Z | 2021-09-16T18:58:44.000Z | src/clients/musixmatch/models.py | juanitodread/gorrion | 1f2c16b7402c237dfb4b47f0fa0afeb3bff7bd19 | [
"Apache-2.0"
] | null | null | null | from dataclasses import dataclass
@dataclass
class Lyric:
id_: str
track_id: str
common_track_id: str
content: list
@dataclass
class Track:
id_: str
common_id: str
name: str
instrumental: int
explicit: int
artist: str
album: str
@dataclass
class Song:
name: str
... | 19 | 74 | 0.636977 | from dataclasses import dataclass
@dataclass
class Lyric:
id_: str
track_id: str
common_track_id: str
content: list
@dataclass
class Track:
id_: str
common_id: str
name: str
instrumental: int
explicit: int
artist: str
album: str
@dataclass
class Song:
name: str
... | true | true |
f765ae46927236e933b440d9b8f66246c72cba90 | 9,244 | py | Python | resnet_full_cifar10.py | Ophir-Gal/ssl-descent | 3bff63a3d00cd2d63c549551c1a086f689a94ed6 | [
"MIT"
] | null | null | null | resnet_full_cifar10.py | Ophir-Gal/ssl-descent | 3bff63a3d00cd2d63c549551c1a086f689a94ed6 | [
"MIT"
] | null | null | null | resnet_full_cifar10.py | Ophir-Gal/ssl-descent | 3bff63a3d00cd2d63c549551c1a086f689a94ed6 | [
"MIT"
] | null | null | null | # -*- coding: utf-8 -*-
"""Resnet_Full_CIFAR10
Automatically generated by Colaboratory.
Original file is located at
https://colab.research.google.com/drive/1MnKg-EW7K410GxNk-I8ibQExcN1mpmcb
"""
!nvidia-smi
# Mount google drive
from google.colab import drive
drive.mount('/content/drive')
import os
import numpy... | 33.737226 | 98 | 0.650476 | """Resnet_Full_CIFAR10
Automatically generated by Colaboratory.
Original file is located at
https://colab.research.google.com/drive/1MnKg-EW7K410GxNk-I8ibQExcN1mpmcb
"""
!nvidia-smi
from google.colab import drive
drive.mount('/content/drive')
import os
import numpy as np
import torch
import torch.nn as nn
imp... | false | true |
f765aea81568f24166fc28390e05bcd3064087a8 | 16,768 | py | Python | tests/serializers/tests.py | JBKahn/django | 32265361279b3316f5bce8efa71f2049409461e3 | [
"PSF-2.0",
"BSD-3-Clause"
] | 5,079 | 2015-01-01T03:39:46.000Z | 2022-03-31T07:38:22.000Z | tests/serializers/tests.py | 287977288/test | 142e3626ab3c676574631383ae6b5a4eced5a10e | [
"PSF-2.0",
"BSD-3-Clause"
] | 1,623 | 2015-01-01T08:06:24.000Z | 2022-03-30T19:48:52.000Z | tests/serializers/tests.py | 287977288/test | 142e3626ab3c676574631383ae6b5a4eced5a10e | [
"PSF-2.0",
"BSD-3-Clause"
] | 2,033 | 2015-01-04T07:18:02.000Z | 2022-03-28T19:55:47.000Z | # -*- coding: utf-8 -*-
from __future__ import unicode_literals
from datetime import datetime
from django.core import serializers
from django.core.serializers import SerializerDoesNotExist
from django.core.serializers.base import ProgressBar
from django.db import connection, transaction
from django.http import HttpRe... | 40.600484 | 114 | 0.673664 | from __future__ import unicode_literals
from datetime import datetime
from django.core import serializers
from django.core.serializers import SerializerDoesNotExist
from django.core.serializers.base import ProgressBar
from django.db import connection, transaction
from django.http import HttpResponse
from django.test ... | true | true |
f765aedfc426faa7dff90967eb18b91c5f4f731b | 3,421 | py | Python | py/desispec/scripts/mergebundles.py | sdss/lvmspec | befd6991537c4947fdf63ca262937f2bb845148f | [
"BSD-3-Clause"
] | null | null | null | py/desispec/scripts/mergebundles.py | sdss/lvmspec | befd6991537c4947fdf63ca262937f2bb845148f | [
"BSD-3-Clause"
] | null | null | null | py/desispec/scripts/mergebundles.py | sdss/lvmspec | befd6991537c4947fdf63ca262937f2bb845148f | [
"BSD-3-Clause"
] | null | null | null |
"""
exspec extracts individual bundles of spectra with one bundle per output file.
This script merges them back together into a single file combining all
bundles.
This workflow is hacky. Release early, release often, but also refactor often.
Stephen Bailey, LBL
March 2014
"""
from __future__ import absolute_import... | 28.272727 | 98 | 0.622917 |
from __future__ import absolute_import, division, print_function
import sys
import os
import numpy as np
from astropy.io import fits
from desispec.frame import Frame
import desispec.io
from desiutil.log import get_logger
import argparse
def parse(options=None):
parser = argparse.ArgumentParser(description="M... | true | true |
f765af412ccdbd10e5b0cfcb1ebc5aadccb46897 | 1,990 | py | Python | plugins/rapid7_insightappsec/komand_rapid7_insightappsec/actions/get_scans/action.py | lukaszlaszuk/insightconnect-plugins | 8c6ce323bfbb12c55f8b5a9c08975d25eb9f8892 | [
"MIT"
] | 46 | 2019-06-05T20:47:58.000Z | 2022-03-29T10:18:01.000Z | plugins/rapid7_insightappsec/komand_rapid7_insightappsec/actions/get_scans/action.py | lukaszlaszuk/insightconnect-plugins | 8c6ce323bfbb12c55f8b5a9c08975d25eb9f8892 | [
"MIT"
] | 386 | 2019-06-07T20:20:39.000Z | 2022-03-30T17:35:01.000Z | plugins/rapid7_insightappsec/komand_rapid7_insightappsec/actions/get_scans/action.py | lukaszlaszuk/insightconnect-plugins | 8c6ce323bfbb12c55f8b5a9c08975d25eb9f8892 | [
"MIT"
] | 43 | 2019-07-09T14:13:58.000Z | 2022-03-28T12:04:46.000Z | import insightconnect_plugin_runtime
from .schema import GetScansInput, GetScansOutput, Input, Output
# Custom imports below
from komand_rapid7_insightappsec.util.endpoints import Scans
from komand_rapid7_insightappsec.util.resource_helper import ResourceHelper
import json
class GetScans(insightconnect_plugin_runtim... | 36.851852 | 99 | 0.590452 | import insightconnect_plugin_runtime
from .schema import GetScansInput, GetScansOutput, Input, Output
from komand_rapid7_insightappsec.util.endpoints import Scans
from komand_rapid7_insightappsec.util.resource_helper import ResourceHelper
import json
class GetScans(insightconnect_plugin_runtime.Action):
def __in... | true | true |
f765afd7951b8f9fb57b01e66142172eea75a1dc | 481 | py | Python | Hackerrank/Python/07 - Collections/07 - Word Order.py | Next-Gen-UI/Code-Dynamics | a9b9d5e3f27e870b3e030c75a1060d88292de01c | [
"MIT"
] | null | null | null | Hackerrank/Python/07 - Collections/07 - Word Order.py | Next-Gen-UI/Code-Dynamics | a9b9d5e3f27e870b3e030c75a1060d88292de01c | [
"MIT"
] | null | null | null | Hackerrank/Python/07 - Collections/07 - Word Order.py | Next-Gen-UI/Code-Dynamics | a9b9d5e3f27e870b3e030c75a1060d88292de01c | [
"MIT"
] | null | null | null | # ========================
# Information
# ========================
# Direct Link: https://www.hackerrank.com/challenges/word-order/problem
# Difficulty: Medium
# Max Score: 50
# Language: Python
# ========================
# Solution
# ========================
from collections import Count... | 18.5 | 72 | 0.486486 |
from collections import Counter
N = int(input())
LIST = []
for i in range(N):
LIST.append(input().strip())
COUNT = Counter(LIST)
print(len(COUNT))
print(*COUNT.values())
| true | true |
f765afe0479071378e9283944e902ac057720fad | 77 | py | Python | src/__init__.py | llefebure/un-general-debates | 3507cb5ebedb3bfab9e99ead0218be8b1f439ec6 | [
"MIT"
] | 34 | 2018-12-31T09:36:47.000Z | 2022-03-12T05:50:03.000Z | src/__init__.py | llefebure/un-general-debates | 3507cb5ebedb3bfab9e99ead0218be8b1f439ec6 | [
"MIT"
] | null | null | null | src/__init__.py | llefebure/un-general-debates | 3507cb5ebedb3bfab9e99ead0218be8b1f439ec6 | [
"MIT"
] | 10 | 2019-07-10T05:20:44.000Z | 2021-06-21T12:06:45.000Z | from pathlib import Path
HOME_DIR = str(Path(__file__).resolve().parents[1])
| 25.666667 | 51 | 0.766234 | from pathlib import Path
HOME_DIR = str(Path(__file__).resolve().parents[1])
| true | true |
f765b023e920363b269389ab52d24e4deeb3663e | 1,679 | py | Python | samples/python/tutorial_code/video/meanshift/meanshift.py | thisisgopalmandal/opencv | 4e2ef8c8f57644ccb8e762a37f70a61007c6be1c | [
"BSD-3-Clause"
] | 82 | 2015-08-15T05:18:30.000Z | 2019-04-11T15:18:06.000Z | samples/python/tutorial_code/video/meanshift/meanshift.py | thisisgopalmandal/opencv | 4e2ef8c8f57644ccb8e762a37f70a61007c6be1c | [
"BSD-3-Clause"
] | 362 | 2017-06-05T02:34:37.000Z | 2021-12-10T03:26:23.000Z | samples/python/tutorial_code/video/meanshift/meanshift.py | thisisgopalmandal/opencv | 4e2ef8c8f57644ccb8e762a37f70a61007c6be1c | [
"BSD-3-Clause"
] | 86 | 2015-08-08T08:28:34.000Z | 2019-04-18T08:27:22.000Z | import numpy as np
import cv2 as cv
import argparse
parser = argparse.ArgumentParser(description='This sample demonstrates the meanshift algorithm. \
The example file can be downloaded from: \
https://www.bogotobogo.com/python/... | 33.58 | 145 | 0.635497 | import numpy as np
import cv2 as cv
import argparse
parser = argparse.ArgumentParser(description='This sample demonstrates the meanshift algorithm. \
The example file can be downloaded from: \
https://www.bogotobogo.com/python/... | true | true |
f765b0b70d9d6ce7bbb6aa11381c7c0c2fcc4ac6 | 28,734 | py | Python | pyzoo/zoo/examples/orca/learn/tf2/yolov3/yoloV3.py | cabuliwallah/analytics-zoo | 5e662bd01c5fc7eed412973119594cf2ecea8b11 | [
"Apache-2.0"
] | 1 | 2021-06-16T11:42:32.000Z | 2021-06-16T11:42:32.000Z | pyzoo/zoo/examples/orca/learn/tf2/yolov3/yoloV3.py | cabuliwallah/analytics-zoo | 5e662bd01c5fc7eed412973119594cf2ecea8b11 | [
"Apache-2.0"
] | null | null | null | pyzoo/zoo/examples/orca/learn/tf2/yolov3/yoloV3.py | cabuliwallah/analytics-zoo | 5e662bd01c5fc7eed412973119594cf2ecea8b11 | [
"Apache-2.0"
] | null | null | null | #
# Copyright 2018 Analytics Zoo 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... | 41.947445 | 99 | 0.610392 |
import tensorflow as tf
from tensorflow.keras.callbacks import ReduceLROnPlateau, EarlyStopping, \
ModelCheckpoint, TensorBoard
from tensorflow.keras import Model
from tensorflow.keras.layers import Add, Concatenate, Conv2D, Input, Lambda, \
LeakyReLU, MaxPool2D, UpSampling2D, ZeroPadding2D, BatchNormalization... | true | true |
f765b166c9838fb75889caa54006525f5c4fb5aa | 7,858 | py | Python | test/aqua/test_qgan.py | ThatFrankGuy/qiskit-aqua | daf58fa9aabecca82982bf612be0cc4f7d7bdc66 | [
"Apache-2.0"
] | null | null | null | test/aqua/test_qgan.py | ThatFrankGuy/qiskit-aqua | daf58fa9aabecca82982bf612be0cc4f7d7bdc66 | [
"Apache-2.0"
] | null | null | null | test/aqua/test_qgan.py | ThatFrankGuy/qiskit-aqua | daf58fa9aabecca82982bf612be0cc4f7d7bdc66 | [
"Apache-2.0"
] | null | null | null | # -*- coding: utf-8 -*-
# This code is part of Qiskit.
#
# (C) Copyright IBM 2019.
#
# 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... | 53.821918 | 120 | 0.573556 |
import unittest
import numpy as np
from qiskit import QuantumCircuit, QuantumRegister
from qiskit.aqua.components.uncertainty_models import UniformDistribution, UnivariateVariationalDistribution
from qiskit.aqua.components.variational_forms import RY
from qiskit.aqua.algorithms.adaptive.qgan.qgan import QGAN
from ... | true | true |
f765b167f1934f71cbb3f70c2384f3d1fb43b6ac | 5,880 | py | Python | ModelGCN4.py | shiqitao/AutoGraph | 41f5956c859ff0fb6f87109d5f8731276bdcc2ef | [
"MIT"
] | null | null | null | ModelGCN4.py | shiqitao/AutoGraph | 41f5956c859ff0fb6f87109d5f8731276bdcc2ef | [
"MIT"
] | null | null | null | ModelGCN4.py | shiqitao/AutoGraph | 41f5956c859ff0fb6f87109d5f8731276bdcc2ef | [
"MIT"
] | null | null | null | import torch
from sklearn.metrics import accuracy_score
from torch.nn import Linear
from torch.nn.functional import relu, dropout, log_softmax, nll_loss, leaky_relu
from torch_geometric.nn import GCNConv, JumpingKnowledge
from torch_geometric.utils.num_nodes import maybe_num_nodes
from torch_sparse import coalesce
fro... | 38.431373 | 111 | 0.614966 | import torch
from sklearn.metrics import accuracy_score
from torch.nn import Linear
from torch.nn.functional import relu, dropout, log_softmax, nll_loss, leaky_relu
from torch_geometric.nn import GCNConv, JumpingKnowledge
from torch_geometric.utils.num_nodes import maybe_num_nodes
from torch_sparse import coalesce
fro... | true | true |
f765b25e1511e08907d7c565f44aa509230e94cd | 494 | py | Python | stardate/migrations/0002_auto_20151031_1551.py | blturner/django-stardate | d3edf99aafd2233a13cd3b86bae3628803eb64ff | [
"BSD-3-Clause"
] | null | null | null | stardate/migrations/0002_auto_20151031_1551.py | blturner/django-stardate | d3edf99aafd2233a13cd3b86bae3628803eb64ff | [
"BSD-3-Clause"
] | 9 | 2016-01-06T02:10:28.000Z | 2021-03-07T00:04:08.000Z | stardate/migrations/0002_auto_20151031_1551.py | blturner/django-stardate | d3edf99aafd2233a13cd3b86bae3628803eb64ff | [
"BSD-3-Clause"
] | null | null | null | # -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.db import migrations, models
from django.conf import settings
class Migration(migrations.Migration):
dependencies = [
('stardate', '0001_initial'),
]
operations = [
migrations.AlterField(
model_name=... | 23.52381 | 120 | 0.649798 | from __future__ import unicode_literals
from django.db import migrations, models
from django.conf import settings
class Migration(migrations.Migration):
dependencies = [
('stardate', '0001_initial'),
]
operations = [
migrations.AlterField(
model_name='post',
name... | true | true |
f765b27f14c7d9183771d6d8754e460a201f612c | 9,834 | py | Python | apps/calculator/__init__.py | mcecchi/PythonOS | 863ed70b21b372eb73416b23bacf206e84468330 | [
"MIT"
] | 81 | 2016-02-25T13:18:52.000Z | 2022-01-02T04:14:53.000Z | apps/calculator/__init__.py | mcecchi/PythonOS | 863ed70b21b372eb73416b23bacf206e84468330 | [
"MIT"
] | 19 | 2016-02-24T22:11:02.000Z | 2018-10-12T17:35:51.000Z | apps/calculator/__init__.py | mcecchi/PythonOS | 863ed70b21b372eb73416b23bacf206e84468330 | [
"MIT"
] | 44 | 2016-03-12T13:29:13.000Z | 2022-01-16T15:43:48.000Z | import pyos
import math
ans = 0
def sqrt(n):
return math.sqrt(n)
def nrt(r, n):
return n**(1.0/r)
def onStart(s, a):
global state, app
state = s
app = a
calc = Calculator()
class Calculator(object):
def __init__(self):
app.ui.clearChildren()
self.input = ""
s... | 63.445161 | 154 | 0.52532 | import pyos
import math
ans = 0
def sqrt(n):
return math.sqrt(n)
def nrt(r, n):
return n**(1.0/r)
def onStart(s, a):
global state, app
state = s
app = a
calc = Calculator()
class Calculator(object):
def __init__(self):
app.ui.clearChildren()
self.input = ""
s... | true | true |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.