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 |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
1c24dc570243af2b9426d42558e15d3eaf9681b5 | 15,618 | py | Python | tornado/test/simple_httpclient_test.py | globocom/tornado | 73c0aee4a5898ef3fb7d67e753ae8d47e400b570 | [
"Apache-2.0"
] | 1 | 2018-09-05T09:53:59.000Z | 2018-09-05T09:53:59.000Z | tornado/test/simple_httpclient_test.py | globocom/tornado | 73c0aee4a5898ef3fb7d67e753ae8d47e400b570 | [
"Apache-2.0"
] | null | null | null | tornado/test/simple_httpclient_test.py | globocom/tornado | 73c0aee4a5898ef3fb7d67e753ae8d47e400b570 | [
"Apache-2.0"
] | null | null | null | from __future__ import absolute_import, division, print_function, with_statement
import collections
from contextlib import closing
import errno
import gzip
import logging
import os
import re
import socket
import sys
from tornado.httpclient import AsyncHTTPClient
from tornado.httputil import HTTPHeaders
from tornado.i... | 40.356589 | 90 | 0.643616 | from __future__ import absolute_import, division, print_function, with_statement
import collections
from contextlib import closing
import errno
import gzip
import logging
import os
import re
import socket
import sys
from tornado.httpclient import AsyncHTTPClient
from tornado.httputil import HTTPHeaders
from tornado.i... | true | true |
1c24dc7d3a5187070fae0300f372cf38b72aa0ab | 3,158 | py | Python | scheduler/models.py | janton42/reservationator | b5f8d64b39dcdd75525f83cf97a59e1c66ea4125 | [
"Unlicense"
] | 1 | 2018-12-28T04:18:14.000Z | 2018-12-28T04:18:14.000Z | scheduler/models.py | janton42/reservationator | b5f8d64b39dcdd75525f83cf97a59e1c66ea4125 | [
"Unlicense"
] | null | null | null | scheduler/models.py | janton42/reservationator | b5f8d64b39dcdd75525f83cf97a59e1c66ea4125 | [
"Unlicense"
] | null | null | null | import uuid
from datetime import datetime
from django.db import models
from django.urls import reverse
from django.dispatch import receiver
from django.contrib.auth.models import User
from django.db.models.signals import post_save
from phone_field import PhoneField
from localflavor.us.models import USStateField
cla... | 26.762712 | 96 | 0.658328 | import uuid
from datetime import datetime
from django.db import models
from django.urls import reverse
from django.dispatch import receiver
from django.contrib.auth.models import User
from django.db.models.signals import post_save
from phone_field import PhoneField
from localflavor.us.models import USStateField
cla... | true | true |
1c24dc8c55a9e00c109a3ae8e1dea4eb8073c9c0 | 540 | py | Python | var/spack/repos/builtin.mock/packages/b/package.py | lguyot/spack | e910c227a7bac3adf2c18fc86cf994811b7d14f7 | [
"ECL-2.0",
"Apache-2.0",
"MIT"
] | 2 | 2020-10-15T01:08:42.000Z | 2021-10-18T01:28:18.000Z | var/spack/repos/builtin.mock/packages/b/package.py | lguyot/spack | e910c227a7bac3adf2c18fc86cf994811b7d14f7 | [
"ECL-2.0",
"Apache-2.0",
"MIT"
] | null | null | null | var/spack/repos/builtin.mock/packages/b/package.py | lguyot/spack | e910c227a7bac3adf2c18fc86cf994811b7d14f7 | [
"ECL-2.0",
"Apache-2.0",
"MIT"
] | null | null | null | # Copyright 2013-2019 Lawrence Livermore National Security, LLC and other
# Spack Project Developers. See the top-level COPYRIGHT file for details.
#
# SPDX-License-Identifier: (Apache-2.0 OR MIT)
from spack import *
class B(Package):
"""Simple package with no dependencies"""
homepage = "http://www.example.... | 27 | 73 | 0.683333 |
from spack import *
class B(Package):
homepage = "http://www.example.com"
url = "http://www.example.com/b-1.0.tar.gz"
version('1.0', '0123456789abcdef0123456789abcdef')
def install(self, spec, prefix):
with working_dir(prefix):
touch("fake_install")
| true | true |
1c24dd95338b3cb31d962013626ffa3c5692fc4a | 6,133 | py | Python | picoCTF-web/api/routes/user.py | NNHSSE201819/picoCTF | eae563c2e68dce85a1c426d086b422dc25649003 | [
"MIT"
] | null | null | null | picoCTF-web/api/routes/user.py | NNHSSE201819/picoCTF | eae563c2e68dce85a1c426d086b422dc25649003 | [
"MIT"
] | null | null | null | picoCTF-web/api/routes/user.py | NNHSSE201819/picoCTF | eae563c2e68dce85a1c426d086b422dc25649003 | [
"MIT"
] | null | null | null | import json
import mimetypes
import os.path
from datetime import datetime
import api
from api.annotations import (api_wrapper, block_after_competition,
block_before_competition, check_csrf, log_action,
require_admin, require_login, require_teacher)
from api.com... | 30.361386 | 96 | 0.671613 | import json
import mimetypes
import os.path
from datetime import datetime
import api
from api.annotations import (api_wrapper, block_after_competition,
block_before_competition, check_csrf, log_action,
require_admin, require_login, require_teacher)
from api.com... | true | true |
1c24ddc6d392007a558134ce28eab0074ad6ddf5 | 9,219 | py | Python | src/hueskill.py | THaeckel/PyHomeAutomate | b66715effa27533765a114b588ee6a93c37117aa | [
"MIT"
] | null | null | null | src/hueskill.py | THaeckel/PyHomeAutomate | b66715effa27533765a114b588ee6a93c37117aa | [
"MIT"
] | null | null | null | src/hueskill.py | THaeckel/PyHomeAutomate | b66715effa27533765a114b588ee6a93c37117aa | [
"MIT"
] | null | null | null | """
Skills to control hue smart lights
HueDaytimeAndWeatherSkill is a Skill that adapts hue lights to daytime and weather.
Copyright (c) 2021 Timo Haeckel
"""
from skills import SkillWithState
import colorsys
import datetime
from phue import Bridge
class HueDaytimeAndWeatherSkill(SkillWithState):
""" Skill ada... | 38.735294 | 134 | 0.590086 |
from skills import SkillWithState
import colorsys
import datetime
from phue import Bridge
class HueDaytimeAndWeatherSkill(SkillWithState):
MODE_SLEEP = "SLEEP"
MODE_DAY_CLEAR = "DAY_CLEAR"
MODE_DAY_DARK = "DAY_DARK"
MODE_DAY_MODERATE = "DAY_MODERATE"
MODE_SUNRISE = "SUNRISE"
MODE_SUNSET = "SU... | true | true |
1c24e08bfee8a3c5571c18d1499b7ed84222b710 | 5,488 | py | Python | docs/conf.py | marius-ne/Adafruit_CircuitPython_DS18X20 | aa15f9cbd161bad5da28f295f6592ea86ce061e7 | [
"MIT",
"MIT-0",
"Unlicense"
] | 6 | 2018-09-12T17:36:34.000Z | 2019-08-08T15:08:02.000Z | docs/conf.py | marius-ne/Adafruit_CircuitPython_DS18X20 | aa15f9cbd161bad5da28f295f6592ea86ce061e7 | [
"MIT",
"MIT-0",
"Unlicense"
] | 7 | 2018-11-03T08:07:50.000Z | 2021-09-27T16:43:50.000Z | docs/conf.py | marius-ne/Adafruit_CircuitPython_DS18X20 | aa15f9cbd161bad5da28f295f6592ea86ce061e7 | [
"MIT",
"MIT-0",
"Unlicense"
] | 13 | 2018-02-14T18:39:24.000Z | 2022-03-28T14:43:41.000Z | # -*- coding: utf-8 -*-
# SPDX-FileCopyrightText: 2020 ladyada for Adafruit Industries
#
# SPDX-License-Identifier: MIT
import os
import sys
sys.path.insert(0, os.path.abspath(".."))
# -- General configuration ------------------------------------------------
# Add any Sphinx extension module names here, as strings... | 29.664865 | 85 | 0.667092 |
import os
import sys
sys.path.insert(0, os.path.abspath(".."))
extensions = [
"sphinx.ext.autodoc",
"sphinx.ext.intersphinx",
"sphinx.ext.viewcode",
]
autodoc_mock_imports = [
"adafruit_onewire",
]
intersphinx_mapping = {
"python": ("https://docs.python.org/3.4", None),
"Circui... | true | true |
1c24e0bb6cc18ae4b23b9a08174ba3c0a5842a51 | 2,841 | py | Python | tests/test__file.py | pombredanne/version-manager | d0ca7b0ade1b20de9fc7f4bfc97c407ef26e0e6f | [
"MIT"
] | 27 | 2015-07-09T13:46:06.000Z | 2022-03-02T04:47:07.000Z | tests/test__file.py | pombredanne/version-manager | d0ca7b0ade1b20de9fc7f4bfc97c407ef26e0e6f | [
"MIT"
] | 4 | 2015-09-21T13:41:02.000Z | 2018-04-16T16:51:50.000Z | tests/test__file.py | pombredanne/version-manager | d0ca7b0ade1b20de9fc7f4bfc97c407ef26e0e6f | [
"MIT"
] | 3 | 2016-12-31T14:57:57.000Z | 2020-01-08T18:45:34.000Z | import os
from unittest import TestCase
from os.path import dirname
import sys
from colorama import Fore
from src.file import File
from src.parser import RegexParser
try:
from StringIO import StringIO
except ImportError:
from io import StringIO
__author__ = 'ahmetdal'
class test_File(TestCase):
def se... | 36.423077 | 126 | 0.640268 | import os
from unittest import TestCase
from os.path import dirname
import sys
from colorama import Fore
from src.file import File
from src.parser import RegexParser
try:
from StringIO import StringIO
except ImportError:
from io import StringIO
__author__ = 'ahmetdal'
class test_File(TestCase):
def se... | true | true |
1c24e19282737a5a07d7851b681647335cd24287 | 1,395 | py | Python | vit_jax/models_test.py | Kasumigaoka-Utaha/self-copy-and-modify-about-the-vision-transformer | 1b840336809171d181ffa80d15955fb03ed29859 | [
"Apache-2.0"
] | 1 | 2022-02-12T15:15:36.000Z | 2022-02-12T15:15:36.000Z | vit_jax/models_test.py | Thanusan19/Vision_Transformer | 80179d57e617ef6cd9599de93c7c7633f891f9a9 | [
"Apache-2.0"
] | null | null | null | vit_jax/models_test.py | Thanusan19/Vision_Transformer | 80179d57e617ef6cd9599de93c7c7633f891f9a9 | [
"Apache-2.0"
] | 1 | 2022-02-25T06:26:28.000Z | 2022-02-25T06:26:28.000Z | # Copyright 2020 Google LLC
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, ... | 29.0625 | 77 | 0.713978 |
import unittest
import flax
import jax
import jax.numpy as jnp
from vit_jax import models
MODEL_SIZES = {
'ViT-B_16': 86_567_656,
'R50+ViT-B_16': 98_659_112,
'ViT-B_32': 88_224_232,
'ViT-L_16': 304_326_632,
'ViT-L_32': 306_535_400,
'ViT-H_14': 632_045_800,
'testing': 2985
}
... | true | true |
1c24e1b127d3ff9b9dd1f3fde8be8ce5430ade91 | 5,453 | py | Python | acme/adders/reverb/episode.py | mavroudisv/acme | 3eb4d55a67ea460710ba9e2b2ecf1aa339ba7d2d | [
"Apache-2.0"
] | null | null | null | acme/adders/reverb/episode.py | mavroudisv/acme | 3eb4d55a67ea460710ba9e2b2ecf1aa339ba7d2d | [
"Apache-2.0"
] | 3 | 2021-10-05T16:03:00.000Z | 2022-03-12T01:03:06.000Z | acme/adders/reverb/episode.py | mavroudisv/acme | 3eb4d55a67ea460710ba9e2b2ecf1aa339ba7d2d | [
"Apache-2.0"
] | 1 | 2021-07-06T06:40:35.000Z | 2021-07-06T06:40:35.000Z | # python3
# Copyright 2018 DeepMind Technologies Limited. 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 re... | 35.640523 | 95 | 0.695397 |
from typing import Callable, Optional, Iterable, Tuple
from acme import specs
from acme import types
from acme.adders.reverb import base
from acme.adders.reverb import utils
import dm_env
import numpy as np
import reverb
import tensorflow as tf
import tree
_PaddingFn = Callable[[Tuple[int, ...], np.d... | true | true |
1c24e2a9681ce990a0e5d9dedcc9c7c04cd17234 | 232 | py | Python | backend/utils/trim_silence.py | zeraye/rege | aa93be8da08fb8faca916f07bb7435cf1a1ed3c3 | [
"BSD-2-Clause"
] | 2 | 2022-03-14T09:23:09.000Z | 2022-03-24T19:27:39.000Z | backend/utils/trim_silence.py | zeraye/rege | aa93be8da08fb8faca916f07bb7435cf1a1ed3c3 | [
"BSD-2-Clause"
] | 6 | 2022-03-08T22:04:47.000Z | 2022-03-25T06:54:48.000Z | backend/utils/trim_silence.py | zeraye/rege | aa93be8da08fb8faca916f07bb7435cf1a1ed3c3 | [
"BSD-2-Clause"
] | 2 | 2022-03-08T21:26:25.000Z | 2022-03-08T21:29:28.000Z | from . import librosa, soundfile
def trim_silence(audio_path: str) -> None:
audio, sample_rate = librosa.load(audio_path)
clip = librosa.effects.trim(audio, top_db=10)
soundfile.write(audio_path, clip[0], sample_rate)
| 29 | 53 | 0.732759 | from . import librosa, soundfile
def trim_silence(audio_path: str) -> None:
audio, sample_rate = librosa.load(audio_path)
clip = librosa.effects.trim(audio, top_db=10)
soundfile.write(audio_path, clip[0], sample_rate)
| true | true |
1c24e2c9916bf9e59b369c823f3bdb6fdddec37f | 537 | py | Python | docassemble_webapp/docassemble/webapp/alembic/versions/025e06b85efc_package_github_branch.py | knod/docassemble | bd052b557743d098138a5f2129a9d3c2f68090a6 | [
"MIT"
] | 568 | 2016-01-08T19:05:06.000Z | 2022-03-30T19:44:47.000Z | docassemble_webapp/docassemble/webapp/alembic/versions/025e06b85efc_package_github_branch.py | knod/docassemble | bd052b557743d098138a5f2129a9d3c2f68090a6 | [
"MIT"
] | 348 | 2016-01-25T02:17:36.000Z | 2022-03-27T21:22:43.000Z | docassemble_webapp/docassemble/webapp/alembic/versions/025e06b85efc_package_github_branch.py | knod/docassemble | bd052b557743d098138a5f2129a9d3c2f68090a6 | [
"MIT"
] | 262 | 2016-01-14T23:09:50.000Z | 2022-03-23T15:06:08.000Z | """package github branch
Revision ID: 025e06b85efc
Revises: f0b00081fda9
Create Date: 2017-12-01 20:37:28.967575
"""
from alembic import op
import sqlalchemy as sa
from docassemble.webapp.database import dbtableprefix
# revision identifiers, used by Alembic.
revision = '025e06b85efc'
down_revision = 'f0b00081fda9'
b... | 22.375 | 84 | 0.761639 | from alembic import op
import sqlalchemy as sa
from docassemble.webapp.database import dbtableprefix
revision = '025e06b85efc'
down_revision = 'f0b00081fda9'
branch_labels = None
depends_on = None
def upgrade():
op.add_column(dbtableprefix + 'package', sa.Column('gitbranch', sa.String(255)))
def downgrade():
... | true | true |
1c24e3b6150f19c05116c0d3cc51d9690739fdfd | 2,871 | py | Python | client_mining_p/miner.py | rushman7/Blockchain | c1967b8542d8856dc2622bd680a79fc32e7b763f | [
"MIT"
] | null | null | null | client_mining_p/miner.py | rushman7/Blockchain | c1967b8542d8856dc2622bd680a79fc32e7b763f | [
"MIT"
] | null | null | null | client_mining_p/miner.py | rushman7/Blockchain | c1967b8542d8856dc2622bd680a79fc32e7b763f | [
"MIT"
] | null | null | null | import hashlib
import requests
import sys
import json
from time import time
DIFFICULTY = 6
coins = 0
def proof_of_work(block):
"""
Simple Proof of Work Algorithm
Stringify the block and look for a proof.
Loop through possibilities, checking each one against `valid_proof`
in an effort to find a n... | 33 | 96 | 0.623128 | import hashlib
import requests
import sys
import json
from time import time
DIFFICULTY = 6
coins = 0
def proof_of_work(block):
print(f'Searching for proof on block...')
new_time = time()
block_string = json.dumps(block, sort_keys=True)
proof = 0
while valid_proof(block_string, proof) is False:
... | true | true |
1c24e3c47c73c740261e0b9dd42174aef9b35f8c | 1,397 | py | Python | setup.py | niloch/inotifications | 39a25f90e60e8156c8dfa07a0ee84a7ea0a5a3fc | [
"MIT"
] | 2 | 2017-05-11T23:11:45.000Z | 2017-05-25T19:16:59.000Z | setup.py | niloch/inotifications | 39a25f90e60e8156c8dfa07a0ee84a7ea0a5a3fc | [
"MIT"
] | 1 | 2017-06-20T14:29:13.000Z | 2017-06-22T02:28:32.000Z | setup.py | niloch/inotifications | 39a25f90e60e8156c8dfa07a0ee84a7ea0a5a3fc | [
"MIT"
] | null | null | null | from setuptools import setup
from setuptools import find_packages
from inotifications import __version__
if __name__ == '__main__':
setup(name='inotifications',
version=__version__,
description='Notifications for Jupyter Notebooks',
setup_requires=['setuptools-markdown'],
... | 37.756757 | 78 | 0.566929 | from setuptools import setup
from setuptools import find_packages
from inotifications import __version__
if __name__ == '__main__':
setup(name='inotifications',
version=__version__,
description='Notifications for Jupyter Notebooks',
setup_requires=['setuptools-markdown'],
... | true | true |
1c24e44a28e8cce42a264f1a7193c9d79672d2b8 | 3,152 | py | Python | util/visualize_custom.py | chengyu0910/DeepFusion_IQA_V1.1 | 7c55f7629b24df00a8c37f82e6142c3a636a667b | [
"BSD-3-Clause"
] | 1 | 2020-02-04T10:30:58.000Z | 2020-02-04T10:30:58.000Z | util/visualize_custom.py | chengyu0910/DeepFusion_IQA_V1.1 | 7c55f7629b24df00a8c37f82e6142c3a636a667b | [
"BSD-3-Clause"
] | null | null | null | util/visualize_custom.py | chengyu0910/DeepFusion_IQA_V1.1 | 7c55f7629b24df00a8c37f82e6142c3a636a667b | [
"BSD-3-Clause"
] | 2 | 2020-02-03T11:01:28.000Z | 2022-03-18T06:46:36.000Z | #coding=utf-8
import numpy as np
import time
import os
import visdom
import datetime
class Visualizer_custom():
def __init__(self, netname, snapdir, display_port=8097,restore_train=False):
self.name = netname
print('打开visdom')
self.vis = visdom.Visdom(port = display_port,env=self.name)
... | 37.52381 | 113 | 0.551079 |
import numpy as np
import time
import os
import visdom
import datetime
class Visualizer_custom():
def __init__(self, netname, snapdir, display_port=8097,restore_train=False):
self.name = netname
print('打开visdom')
self.vis = visdom.Visdom(port = display_port,env=self.name)
assert se... | true | true |
1c24e5570176b5829af7db9d516de264f6efd7b8 | 3,371 | py | Python | shark/trainer/trainer_base.py | 7starsea/shark | 5030f576da6f5998728d80170480e68a3debfe79 | [
"MIT"
] | null | null | null | shark/trainer/trainer_base.py | 7starsea/shark | 5030f576da6f5998728d80170480e68a3debfe79 | [
"MIT"
] | null | null | null | shark/trainer/trainer_base.py | 7starsea/shark | 5030f576da6f5998728d80170480e68a3debfe79 | [
"MIT"
] | null | null | null | # coding=utf-8
import os.path
import torch
import numpy as np
from abc import ABC, abstractmethod
from torch.utils.tensorboard import SummaryWriter
from shark.replay import ReplayBufferBase, SimpleReplayBuffer
class RLConfig(object):
def __init__(self, batch_size=256):
self.batch_size = batch_size
... | 33.04902 | 120 | 0.589736 |
import os.path
import torch
import numpy as np
from abc import ABC, abstractmethod
from torch.utils.tensorboard import SummaryWriter
from shark.replay import ReplayBufferBase, SimpleReplayBuffer
class RLConfig(object):
def __init__(self, batch_size=256):
self.batch_size = batch_size
self.init_le... | true | true |
1c24e597efff2f68f86591af97ba88b960dc68b1 | 1,031 | py | Python | pajbot/utils/__init__.py | sadlyfell/bullbot | b6ef96f61678fab4a245d8ccddf9d1ae7aae9fee | [
"MIT"
] | null | null | null | pajbot/utils/__init__.py | sadlyfell/bullbot | b6ef96f61678fab4a245d8ccddf9d1ae7aae9fee | [
"MIT"
] | null | null | null | pajbot/utils/__init__.py | sadlyfell/bullbot | b6ef96f61678fab4a245d8ccddf9d1ae7aae9fee | [
"MIT"
] | null | null | null | from .clean_up_message import clean_up_message
from .datetime_from_utc_milliseconds import datetime_from_utc_milliseconds
from .dump_threads import dump_threads
from .extend_version_with_git_data import extend_version_with_git_data, extend_version_if_possible
from .find import find
from .get_class_that_defined_method i... | 46.863636 | 98 | 0.896217 | from .clean_up_message import clean_up_message
from .datetime_from_utc_milliseconds import datetime_from_utc_milliseconds
from .dump_threads import dump_threads
from .extend_version_with_git_data import extend_version_with_git_data, extend_version_if_possible
from .find import find
from .get_class_that_defined_method i... | true | true |
1c24e5b0852b1615254b5e213fb46fe7c9f796d0 | 239 | py | Python | amostra/tests/test_openapi.py | JunAishima/amostra | 0f649ab4593a708f5537897e7f0049f9a0ce35e2 | [
"BSD-3-Clause"
] | null | null | null | amostra/tests/test_openapi.py | JunAishima/amostra | 0f649ab4593a708f5537897e7f0049f9a0ce35e2 | [
"BSD-3-Clause"
] | 44 | 2016-02-29T20:34:00.000Z | 2022-01-20T21:24:43.000Z | amostra/tests/test_openapi.py | JunAishima/amostra | 0f649ab4593a708f5537897e7f0049f9a0ce35e2 | [
"BSD-3-Clause"
] | 12 | 2016-02-08T12:46:38.000Z | 2021-12-15T16:13:38.000Z | import json
import os
def test_load():
here = os.path.abspath(os.path.dirname(__file__))
loc = os.path.join(here, '../../docs/source/openapi.json')
with open(loc) as f:
data = json.loads(f.read())
assert data
| 21.727273 | 62 | 0.619247 | import json
import os
def test_load():
here = os.path.abspath(os.path.dirname(__file__))
loc = os.path.join(here, '../../docs/source/openapi.json')
with open(loc) as f:
data = json.loads(f.read())
assert data
| true | true |
1c24e6318136d4fe28b31cd4fded3a47631350f1 | 21,149 | py | Python | databuilder/example/scripts/sample_data_loader.py | defendercrypt/amundsen | 83c728b646020f60cf2270c12e766fe4af8c9948 | [
"Apache-2.0"
] | 2,072 | 2020-08-11T20:16:48.000Z | 2022-03-31T07:04:05.000Z | databuilder/example/scripts/sample_data_loader.py | defendercrypt/amundsen | 83c728b646020f60cf2270c12e766fe4af8c9948 | [
"Apache-2.0"
] | 795 | 2020-08-11T15:24:39.000Z | 2022-03-31T18:56:13.000Z | databuilder/example/scripts/sample_data_loader.py | defendercrypt/amundsen | 83c728b646020f60cf2270c12e766fe4af8c9948 | [
"Apache-2.0"
] | 671 | 2020-08-11T20:39:56.000Z | 2022-03-31T08:39:07.000Z | # Copyright Contributors to the Amundsen project.
# SPDX-License-Identifier: Apache-2.0
"""
This is a example script demonstrating how to load data into Neo4j and
Elasticsearch without using an Airflow DAG.
It contains several jobs:
- `run_csv_job`: runs a job that extracts table data from a CSV, loads (writes)
thi... | 49.879717 | 119 | 0.726417 |
import logging
import os
import sys
import uuid
from amundsen_common.models.index_map import DASHBOARD_ELASTICSEARCH_INDEX_MAPPING, USER_INDEX_MAP
from elasticsearch import Elasticsearch
from pyhocon import ConfigFactory
from sqlalchemy.ext.declarative import declarative_base
from databuilder.extractor.csv_extrac... | true | true |
1c24e7d770aa29b8b8930339d37ac9116999ff3f | 3,127 | py | Python | src/blog/migrations/0001_initial.py | joe19940422/my_blog | 8c9289953950fb8b80c8204509627098ec308f59 | [
"MIT"
] | null | null | null | src/blog/migrations/0001_initial.py | joe19940422/my_blog | 8c9289953950fb8b80c8204509627098ec308f59 | [
"MIT"
] | null | null | null | src/blog/migrations/0001_initial.py | joe19940422/my_blog | 8c9289953950fb8b80c8204509627098ec308f59 | [
"MIT"
] | 1 | 2022-01-02T12:04:53.000Z | 2022-01-02T12:04:53.000Z | # Generated by Django 2.2.13 on 2021-03-26 18:25
from django.conf import settings
from django.db import migrations, models
import django.db.models.deletion
class Migration(migrations.Migration):
initial = True
dependencies = [
migrations.swappable_dependency(settings.AUTH_USER_MODEL),
]
op... | 44.671429 | 139 | 0.573073 |
from django.conf import settings
from django.db import migrations, models
import django.db.models.deletion
class Migration(migrations.Migration):
initial = True
dependencies = [
migrations.swappable_dependency(settings.AUTH_USER_MODEL),
]
operations = [
migrations.CreateModel(
... | true | true |
1c24ea12e19685739d9cf034ec293fdd73cfc9f2 | 5,016 | py | Python | flaskbb/utils/permissions.py | Xender/flaskbb | b573c4fd38d9e274692c21adcdb4a30e68a401f2 | [
"BSD-3-Clause"
] | null | null | null | flaskbb/utils/permissions.py | Xender/flaskbb | b573c4fd38d9e274692c21adcdb4a30e68a401f2 | [
"BSD-3-Clause"
] | null | null | null | flaskbb/utils/permissions.py | Xender/flaskbb | b573c4fd38d9e274692c21adcdb4a30e68a401f2 | [
"BSD-3-Clause"
] | null | null | null | # -*- coding: utf-8 -*-
"""
flaskbb.utils.permissions
~~~~~~~~~~~~~~~~~~~~~~~~~
A place for all permission checks
:copyright: (c) 2014 by the FlaskBB Team.
:license: BSD, see LICENSE for more details.
"""
def check_perm(user, perm, forum, post_user_id=None):
"""Checks if the `user` has a spe... | 33 | 79 | 0.663876 |
def check_perm(user, perm, forum, post_user_id=None):
if can_moderate(user=user, forum=forum):
return True
if post_user_id and user.is_authenticated():
return user.permissions[perm] and user.id == post_user_id
return not user.permissions['banned'] and user.permissions[perm]
def is_mod... | true | true |
1c24ea3acb9e2eb95a3c72bb2936afe10cff1f90 | 265 | py | Python | no1s/1804_test/config.py | soup7soup/test | 227babc87f9744fe2c28a27dc2af9eeb6771e23c | [
"MIT"
] | null | null | null | no1s/1804_test/config.py | soup7soup/test | 227babc87f9744fe2c28a27dc2af9eeb6771e23c | [
"MIT"
] | null | null | null | no1s/1804_test/config.py | soup7soup/test | 227babc87f9744fe2c28a27dc2af9eeb6771e23c | [
"MIT"
] | null | null | null | CONSUMER_KEY = "UhuBsj54DbRnnHGQYaPywHmAi"
CONSUMER_SECRET = "e1zSaGoQorVKzyW5W7U8LaAmkUsf3nnjdIHCxh45Y03bnnBj86"
ACCESS_TOKEN = "42566916-5CI2BDtmiUQdWFKtTY6ajgxmLlYjURI4ftW2K88h3"
ACCESS_TOKEN_SECRET = "YHfdFB1RJxIcHQ6XOriX0GZhmZmFpNmI5wegaBIRDflIU" | 66.25 | 74 | 0.856604 | CONSUMER_KEY = "UhuBsj54DbRnnHGQYaPywHmAi"
CONSUMER_SECRET = "e1zSaGoQorVKzyW5W7U8LaAmkUsf3nnjdIHCxh45Y03bnnBj86"
ACCESS_TOKEN = "42566916-5CI2BDtmiUQdWFKtTY6ajgxmLlYjURI4ftW2K88h3"
ACCESS_TOKEN_SECRET = "YHfdFB1RJxIcHQ6XOriX0GZhmZmFpNmI5wegaBIRDflIU" | true | true |
1c24eba657b21499f09025bdfc242d84387dd879 | 527 | py | Python | scripts/codelists/mappings_to_json.py | samuele-mattiuzzo/IATI-Standard-Reference-Site | cc75562ab854cabd0168df56771cd1086564fd38 | [
"MIT"
] | null | null | null | scripts/codelists/mappings_to_json.py | samuele-mattiuzzo/IATI-Standard-Reference-Site | cc75562ab854cabd0168df56771cd1086564fd38 | [
"MIT"
] | 2 | 2019-07-25T12:08:41.000Z | 2019-12-11T21:51:33.000Z | scripts/codelists/mappings_to_json.py | samuele-mattiuzzo/IATI-Standard-Reference-Site | cc75562ab854cabd0168df56771cd1086564fd38 | [
"MIT"
] | null | null | null | from lxml import etree as ET
import os, json
def mapping_to_json(mappings):
for mapping in mappings.getroot().xpath('//mapping'):
out = {
'path': mapping.find('path').text,
'codelist': mapping.find('codelist').attrib['ref']
}
if mapping.find('condition') is not None:... | 29.277778 | 62 | 0.612903 | from lxml import etree as ET
import os, json
def mapping_to_json(mappings):
for mapping in mappings.getroot().xpath('//mapping'):
out = {
'path': mapping.find('path').text,
'codelist': mapping.find('codelist').attrib['ref']
}
if mapping.find('condition') is not None:... | true | true |
1c24ebf8e5fa1cd5c2e364b6cf9a4ed124b766f9 | 7,643 | py | Python | lib/python3.8/site-packages/ansible/plugins/lookup/url.py | cjsteel/python3-venv-ansible-2.10.5 | c95395c4cae844dc66fddde9b4343966f4b2ecd5 | [
"Apache-1.1"
] | 4 | 2021-09-16T01:32:29.000Z | 2022-03-24T07:32:10.000Z | lib/python3.8/site-packages/ansible/plugins/lookup/url.py | cjsteel/python3-venv-ansible-2.10.5 | c95395c4cae844dc66fddde9b4343966f4b2ecd5 | [
"Apache-1.1"
] | null | null | null | lib/python3.8/site-packages/ansible/plugins/lookup/url.py | cjsteel/python3-venv-ansible-2.10.5 | c95395c4cae844dc66fddde9b4343966f4b2ecd5 | [
"Apache-1.1"
] | null | null | null | # (c) 2015, Brian Coca <bcoca@ansible.com>
# (c) 2012-17 Ansible Project
# GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt)
from __future__ import (absolute_import, division, print_function)
__metaclass__ = type
DOCUMENTATION = """
lookup: url
author: Brian Coca (@bcoca)
versi... | 34.427928 | 144 | 0.633521 |
from __future__ import (absolute_import, division, print_function)
__metaclass__ = type
DOCUMENTATION = """
lookup: url
author: Brian Coca (@bcoca)
version_added: "1.9"
short_description: return contents from URL
description:
- Returns the content of the URL requested to be used as data in play.
options:
_ter... | true | true |
1c24ec9fac7b5615ada690837e97ce8e7eaef603 | 11,766 | py | Python | src/python/pants/init/engine_initializer.py | timgates42/pants | 1b10d78b9e3dbbb3f66a5e08c9ba5d369913fdbd | [
"Apache-2.0"
] | null | null | null | src/python/pants/init/engine_initializer.py | timgates42/pants | 1b10d78b9e3dbbb3f66a5e08c9ba5d369913fdbd | [
"Apache-2.0"
] | null | null | null | src/python/pants/init/engine_initializer.py | timgates42/pants | 1b10d78b9e3dbbb3f66a5e08c9ba5d369913fdbd | [
"Apache-2.0"
] | null | null | null | # Copyright 2016 Pants project contributors (see CONTRIBUTORS.md).
# Licensed under the Apache License, Version 2.0 (see LICENSE).
from __future__ import annotations
import logging
from dataclasses import dataclass
from pathlib import Path
from typing import Any, ClassVar, Iterable, List, Optional, Set, Tuple, Type, ... | 39.22 | 117 | 0.670831 |
from __future__ import annotations
import logging
from dataclasses import dataclass
from pathlib import Path
from typing import Any, ClassVar, Iterable, List, Optional, Set, Tuple, Type, cast
from pants.base.build_environment import get_buildroot
from pants.base.build_root import BuildRoot
from pants.base.exiter i... | true | true |
1c24ef1acfbea245f05a3756ba3337fc5f6f35f7 | 10,594 | py | Python | lib/python2.7/site-packages/ryu/tests/unit/packet/test_dhcp.py | nishaero/wifi-userseg-ryu | 1132f2c813b79eff755bdd1a9e73e7ad3980af7c | [
"Apache-2.0"
] | 36 | 2015-10-18T21:13:16.000Z | 2022-03-06T23:09:11.000Z | lib/python2.7/site-packages/ryu/tests/unit/packet/test_dhcp.py | nishaero/wifi-userseg-ryu | 1132f2c813b79eff755bdd1a9e73e7ad3980af7c | [
"Apache-2.0"
] | 4 | 2017-03-07T11:51:24.000Z | 2020-07-07T20:13:55.000Z | lib/python2.7/site-packages/ryu/tests/unit/packet/test_dhcp.py | nishaero/wifi-userseg-ryu | 1132f2c813b79eff755bdd1a9e73e7ad3980af7c | [
"Apache-2.0"
] | 32 | 2015-01-03T13:06:57.000Z | 2020-11-14T05:38:25.000Z | # Copyright (C) 2013 Nippon Telegraph and Telephone Corporation.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicab... | 40.435115 | 80 | 0.588069 |
import inspect
import logging
import six
import struct
import unittest
from nose.tools import eq_
from ryu.lib import addrconv
from ryu.lib.packet import dhcp
LOG = logging.getLogger(__name__)
class Test_dhcp_offer(unittest.TestCase):
op = dhcp.DHCP_BOOT_REPLY
chaddr = 'aa:aa:aa:aa:aa:aa'
... | true | true |
1c24f066af895e37043f6b6b1f37cd5d2753180a | 9,184 | py | Python | easymunk/pyxel/bodies.py | fabiommendes/easymunk | 420dfc4a006997c47887f6876876249674feb3cd | [
"MIT"
] | 1 | 2021-07-02T11:59:07.000Z | 2021-07-02T11:59:07.000Z | easymunk/pyxel/bodies.py | fabiommendes/easymunk | 420dfc4a006997c47887f6876876249674feb3cd | [
"MIT"
] | null | null | null | easymunk/pyxel/bodies.py | fabiommendes/easymunk | 420dfc4a006997c47887f6876876249674feb3cd | [
"MIT"
] | 1 | 2022-01-14T20:18:35.000Z | 2022-01-14T20:18:35.000Z | """
Easier factory functions for creating Pymunk objects.
"""
from functools import wraps
from typing import Sequence, Union, Callable, TypeVar, TYPE_CHECKING, Any
from . import Color, DrawOptions
from .helpers import get_pyxel
from ..core import CircleBody, SegmentBody, PolyBody, Body, Space
from ..typing import VecL... | 26.165242 | 87 | 0.608123 | from functools import wraps
from typing import Sequence, Union, Callable, TypeVar, TYPE_CHECKING, Any
from . import Color, DrawOptions
from .helpers import get_pyxel
from ..core import CircleBody, SegmentBody, PolyBody, Body, Space
from ..typing import VecLike
if TYPE_CHECKING:
from .camera import Camera
T = Typ... | true | true |
1c24f148ceb9cc925fdf22c22b3beba4144c3502 | 2,143 | py | Python | neopixel-blinkt/setup.py | druck13/pantilt-hat | 2c3053c7c8ba761e0d7c484d7e30b4723f99e30c | [
"MIT"
] | null | null | null | neopixel-blinkt/setup.py | druck13/pantilt-hat | 2c3053c7c8ba761e0d7c484d7e30b4723f99e30c | [
"MIT"
] | 1 | 2020-02-29T11:45:23.000Z | 2020-02-29T11:45:23.000Z | neopixel-blinkt/setup.py | druck13/pantilt-hat | 2c3053c7c8ba761e0d7c484d7e30b4723f99e30c | [
"MIT"
] | null | null | null | #!/usr/bin/env python
"""
Copyright (c) 2016 Pimoroni.
Permission is hereby granted, free of charge, to any person obtaining a copy of
this software and associated documentation files (the "Software"), to deal in
the Software without restriction, including without limitation the rights to
use, copy, modify, merge, pu... | 40.433962 | 139 | 0.707886 |
try:
from setuptools import setup
except ImportError:
from distutils.core import setup
classifiers = ['Development Status :: 5 - Production/Stable',
'Operating System :: POSIX :: Linux',
'License :: OSI Approved :: MIT License',
'Intended Audience :: Developers',... | true | true |
1c24f3ef22cf203e3ab1cd0deed8472e89fccddd | 148 | py | Python | Tests/Aula_20e.py | o-Ian/Practice-Python | 1e4b2d0788e70006096a53a7cf038db3148ba4b7 | [
"MIT"
] | 4 | 2021-04-23T18:07:58.000Z | 2021-05-12T11:38:14.000Z | Tests/Aula_20e.py | o-Ian/Practice-Python | 1e4b2d0788e70006096a53a7cf038db3148ba4b7 | [
"MIT"
] | null | null | null | Tests/Aula_20e.py | o-Ian/Practice-Python | 1e4b2d0788e70006096a53a7cf038db3148ba4b7 | [
"MIT"
] | null | null | null | def dobra(lst):
pos = 0
while pos < len(lst):
lst[pos] *= 2
pos += 1
lista = [0, 3, 4, 6, 1, 7]
dobra(lista)
print(lista)
| 13.454545 | 26 | 0.47973 | def dobra(lst):
pos = 0
while pos < len(lst):
lst[pos] *= 2
pos += 1
lista = [0, 3, 4, 6, 1, 7]
dobra(lista)
print(lista)
| true | true |
1c24f40eafd60c476aa3659e418372cb858fed68 | 4,130 | py | Python | toyRegression/Ensemble-MAP-SGD/train.py | dataflowr/evaluating_bdl | b7d7e3f2b8095a0ec43118d2b69b4b49e0b910f2 | [
"MIT"
] | 110 | 2019-06-04T13:30:23.000Z | 2022-03-05T07:37:52.000Z | toyRegression/Ensemble-MAP-SGD/train.py | dataflowr/evaluating_bdl | b7d7e3f2b8095a0ec43118d2b69b4b49e0b910f2 | [
"MIT"
] | 3 | 2020-08-31T17:12:39.000Z | 2021-09-12T01:21:24.000Z | toyRegression/Ensemble-MAP-SGD/train.py | dataflowr/evaluating_bdl | b7d7e3f2b8095a0ec43118d2b69b4b49e0b910f2 | [
"MIT"
] | 23 | 2019-06-05T08:53:28.000Z | 2022-03-05T09:01:25.000Z | # code-checked
# server-checked
from datasets import ToyDataset # (this needs to be imported before torch, because cv2 needs to be imported before torch for some reason)
from model import ToyNet
import torch
import torch.utils.data
import torch.nn as nn
from torch.autograd import Variable
import torch.optim as optim
... | 35 | 137 | 0.584504 |
from datasets import ToyDataset
from model import ToyNet
import torch
import torch.utils.data
import torch.nn as nn
from torch.autograd import Variable
import torch.optim as optim
import torch.nn.functional as F
import numpy as np
import pickle
import matplotlib
matplotlib.use("Agg")
import matplotlib.pyplot as p... | true | true |
1c24f415251484d838f5cb367317847618440ad4 | 50,991 | py | Python | froide/helper/name_generator.py | OpendataCH/froide | 8136bac0d8caa56f9cfc7ba15480be987280e55d | [
"MIT"
] | null | null | null | froide/helper/name_generator.py | OpendataCH/froide | 8136bac0d8caa56f9cfc7ba15480be987280e55d | [
"MIT"
] | null | null | null | froide/helper/name_generator.py | OpendataCH/froide | 8136bac0d8caa56f9cfc7ba15480be987280e55d | [
"MIT"
] | null | null | null | import hashlib
import random
from typing import List, Sequence
from django.conf import settings
NAMES = [
"3_d_man",
"alars",
"aardwolf",
"abdul_alhazred",
"abe_brown",
"abigail_brand",
"abner_jenkins",
"abner_little",
"abominable_snowman",
"abomination",
"abominatrix",
... | 17.729833 | 86 | 0.550038 | import hashlib
import random
from typing import List, Sequence
from django.conf import settings
NAMES = [
"3_d_man",
"alars",
"aardwolf",
"abdul_alhazred",
"abe_brown",
"abigail_brand",
"abner_jenkins",
"abner_little",
"abominable_snowman",
"abomination",
"abominatrix",
... | true | true |
1c24f424817fcd40eddd31f6e5c49f0d837bd24f | 8,343 | py | Python | photo_site/routes_admin.py | sanderfoobar/quart-photo-site | eadd5a47e46595a7f488b2fb1bc409c61633c3dc | [
"WTFPL"
] | 2 | 2021-06-30T19:04:56.000Z | 2021-07-11T21:55:55.000Z | photo_site/routes_admin.py | sanderfoobar/quart-photo-site | eadd5a47e46595a7f488b2fb1bc409c61633c3dc | [
"WTFPL"
] | null | null | null | photo_site/routes_admin.py | sanderfoobar/quart-photo-site | eadd5a47e46595a7f488b2fb1bc409c61633c3dc | [
"WTFPL"
] | 1 | 2021-06-23T16:59:49.000Z | 2021-06-23T16:59:49.000Z | import re
from typing import List
from datetime import datetime
import os
import tempfile
import magic
import aiofiles
from PIL import Image
from quart import render_template, request, redirect, url_for, jsonify, Blueprint, abort, flash
from quart_auth import AuthUser, login_user, login_required, logout_user, current_... | 30.448905 | 106 | 0.659115 | import re
from typing import List
from datetime import datetime
import os
import tempfile
import magic
import aiofiles
from PIL import Image
from quart import render_template, request, redirect, url_for, jsonify, Blueprint, abort, flash
from quart_auth import AuthUser, login_user, login_required, logout_user, current_... | true | true |
1c24f4849f316caba255aea40d3bbf6cd125036e | 4,661 | py | Python | Telegram-Bot.py | PranavMurali/Covid-Bots | 034f3f957b17e8d7649d4b8ba48b3d8f884931db | [
"MIT"
] | 1 | 2020-12-04T13:42:07.000Z | 2020-12-04T13:42:07.000Z | Telegram-Bot.py | PranavMurali/Covid-Bots | 034f3f957b17e8d7649d4b8ba48b3d8f884931db | [
"MIT"
] | null | null | null | Telegram-Bot.py | PranavMurali/Covid-Bots | 034f3f957b17e8d7649d4b8ba48b3d8f884931db | [
"MIT"
] | null | null | null | from telegram.ext import Updater, CommandHandler
import re
import requests
import datetime
from covid import Covid
import re
covid = Covid()
a=covid.list_countries()
class BotHandler:
def __init__(self, token):
self.token = token
self.api_url = "https://api.telegram.org/bot{}/".format(token... | 40.181034 | 154 | 0.537867 | from telegram.ext import Updater, CommandHandler
import re
import requests
import datetime
from covid import Covid
import re
covid = Covid()
a=covid.list_countries()
class BotHandler:
def __init__(self, token):
self.token = token
self.api_url = "https://api.telegram.org/bot{}/".format(token... | true | true |
1c24f487b32f909b9796ef9bf72db98c92b84c49 | 5,768 | py | Python | 0CTF/2021/Quals/pwn/uc_goood/uc_goood.py | ruhan-islam/ctf-archives | 8c2bf6a608c821314d1a1cfaa05a6cccef8e3103 | [
"MIT"
] | 1 | 2021-11-02T20:53:58.000Z | 2021-11-02T20:53:58.000Z | 0CTF/2021/Quals/pwn/uc_goood/uc_goood.py | ruhan-islam/ctf-archives | 8c2bf6a608c821314d1a1cfaa05a6cccef8e3103 | [
"MIT"
] | null | null | null | 0CTF/2021/Quals/pwn/uc_goood/uc_goood.py | ruhan-islam/ctf-archives | 8c2bf6a608c821314d1a1cfaa05a6cccef8e3103 | [
"MIT"
] | null | null | null | #!/usr/bin/env python
import os
import struct
import types
from unicorn import *
from unicorn.x86_const import *
from syscall import hook_syscall
CODE = 0xdeadbeef000
STACK = 0xbabecafe000
MAIN = b'\x48\x83\xec\x20\x66\xc7\x44\x24\x0e\x00\x00\x48\x8d\x5c\x24\x0e\x48\xc7\x44\x24\x10\x00\x00\x00\x00\x48\xc7\x44\x24\x1... | 62.695652 | 2,138 | 0.713766 |
import os
import struct
import types
from unicorn import *
from unicorn.x86_const import *
from syscall import hook_syscall
CODE = 0xdeadbeef000
STACK = 0xbabecafe000
MAIN = b'\x48\x83\xec\x20\x66\xc7\x44\x24\x0e\x00\x00\x48\x8d\x5c\x24\x0e\x48\xc7\x44\x24\x10\x00\x00\x00\x00\x48\xc7\x44\x24\x18\x00\x00\x00\x00\xb9... | true | true |
1c24f538afdb45d431b8e4df9675f286f181adac | 359 | py | Python | tributary/streaming/input/__init__.py | blshao84/tributary | 20e41f782d46fa5d8c340629ed60719741702e7e | [
"Apache-2.0"
] | null | null | null | tributary/streaming/input/__init__.py | blshao84/tributary | 20e41f782d46fa5d8c340629ed60719741702e7e | [
"Apache-2.0"
] | null | null | null | tributary/streaming/input/__init__.py | blshao84/tributary | 20e41f782d46fa5d8c340629ed60719741702e7e | [
"Apache-2.0"
] | null | null | null | from .input import * # noqa: F401, F403
from .file import File, File as FileSource # noqa: F401
from .http import HTTP, HTTP as HTTPSource # noqa: F401
from .kafka import Kafka, Kafka as KafkaSource # noqa: F401
from .socketio import SocketIO, SocketIO as SocketIOSource # noqa: F401
from .ws import WebSocket, WebS... | 51.285714 | 72 | 0.752089 | from .input import *
from .file import File, File as FileSource
from .http import HTTP, HTTP as HTTPSource
from .kafka import Kafka, Kafka as KafkaSource
from .socketio import SocketIO, SocketIO as SocketIOSource
from .ws import WebSocket, WebSocket as WebSocketSource
| true | true |
1c24f5aca788fbe7925e0c06ca9d1e12a329cb74 | 467 | py | Python | examples/type_custom_arg.py | gmerz/ArgTyper | 56e1d60ce2cc8f7d889fb8890ddbe922b85ab9f3 | [
"MIT"
] | 1 | 2021-04-26T19:46:33.000Z | 2021-04-26T19:46:33.000Z | examples/type_custom_arg.py | gmerz/ArgTyper | 56e1d60ce2cc8f7d889fb8890ddbe922b85ab9f3 | [
"MIT"
] | null | null | null | examples/type_custom_arg.py | gmerz/ArgTyper | 56e1d60ce2cc8f7d889fb8890ddbe922b85ab9f3 | [
"MIT"
] | null | null | null | import argtyper
class CustomArg(object):
def __init__(self, string):
self.data = string
if "jedi" not in string.lower():
raise ValueError("Error in custom Argument")
def __str__(self):
return f"Custom Argument({self.data})"
def type_test(
pos_arg: CustomArg,
opt_... | 19.458333 | 56 | 0.635974 | import argtyper
class CustomArg(object):
def __init__(self, string):
self.data = string
if "jedi" not in string.lower():
raise ValueError("Error in custom Argument")
def __str__(self):
return f"Custom Argument({self.data})"
def type_test(
pos_arg: CustomArg,
opt_... | true | true |
1c24f681539e59d8627fcfcb3740121e429753f6 | 946 | py | Python | bin/latest_release.py | joeysim/redash | 141dbc9e706899df9b82898fc7f355c2d9ce56b1 | [
"BSD-2-Clause-FreeBSD"
] | 1 | 2017-06-29T15:02:38.000Z | 2017-06-29T15:02:38.000Z | bin/latest_release.py | joeysim/redash | 141dbc9e706899df9b82898fc7f355c2d9ce56b1 | [
"BSD-2-Clause-FreeBSD"
] | null | null | null | bin/latest_release.py | joeysim/redash | 141dbc9e706899df9b82898fc7f355c2d9ce56b1 | [
"BSD-2-Clause-FreeBSD"
] | null | null | null | #!/usr/bin/env python
import sys
import requests
if __name__ == '__main__':
response = requests.get('https://api.github.com/repos/EverythingMe/redash/releases')
if response.status_code != 200:
exit("Failed getting releases (status code: %s)." % response.status_code)
sorted_releases = sorted(respo... | 30.516129 | 102 | 0.654334 |
import sys
import requests
if __name__ == '__main__':
response = requests.get('https://api.github.com/repos/EverythingMe/redash/releases')
if response.status_code != 200:
exit("Failed getting releases (status code: %s)." % response.status_code)
sorted_releases = sorted(response.json(), key=lambd... | false | true |
1c24f69c53c7b35793e55038653b46b06b602172 | 4,125 | py | Python | utils.py | kemfic/SimpleVO | 4dffad27c47ca8a20bbc4dea75128b0f45c94d61 | [
"MIT"
] | 6 | 2019-09-21T16:07:09.000Z | 2020-08-09T03:44:54.000Z | utils.py | kemfic/SimpleVO | 4dffad27c47ca8a20bbc4dea75128b0f45c94d61 | [
"MIT"
] | null | null | null | utils.py | kemfic/SimpleVO | 4dffad27c47ca8a20bbc4dea75128b0f45c94d61 | [
"MIT"
] | 1 | 2021-01-30T12:25:05.000Z | 2021-01-30T12:25:05.000Z | # Utility functions
import cv2
import numpy as np
import quaternion
from params import param
def bgr2gray(img):
return cv2.cvtColor(img, cv2.COLOR_BGR2GRAY)
def getCorners(img, params=param.get("gftt")):
"""
- Example from: https://docs.opencv.org/3.0-beta/doc/py_tutorials/py_feature2d/py_shi_tomasi/py_shi_tom... | 27.138158 | 157 | 0.628848 |
import cv2
import numpy as np
import quaternion
from params import param
def bgr2gray(img):
return cv2.cvtColor(img, cv2.COLOR_BGR2GRAY)
def getCorners(img, params=param.get("gftt")):
gray = bgr2gray(img)
corners = cv2.goodFeaturesToTrack(gray, **params)
corners = np.int0(corners)
return corners
def get_... | true | true |
1c24f77f7c42796e3d0dcc2319eed5189b053dbe | 2,530 | py | Python | scrapers/vaccination_campaigns.py | OCHA-DAP/hdx-scraper-covid-viz | a3fcc4758a96b07b38ea138c04c5cab66f331383 | [
"MIT"
] | 6 | 2020-08-24T15:31:49.000Z | 2021-11-05T11:25:59.000Z | scrapers/vaccination_campaigns.py | OCHA-DAP/hdx-scraper-covid-viz | a3fcc4758a96b07b38ea138c04c5cab66f331383 | [
"MIT"
] | 16 | 2021-01-24T22:52:52.000Z | 2022-03-22T03:38:52.000Z | scrapers/vaccination_campaigns.py | OCHA-DAP/hdx-scraper-covid-viz | a3fcc4758a96b07b38ea138c04c5cab66f331383 | [
"MIT"
] | 5 | 2020-08-24T15:31:49.000Z | 2022-01-27T18:54:06.000Z | import logging
from hdx.scraper.readers import read_hdx
from scrapers import calculate_ratios
logger = logging.getLogger(__name__)
def add_vaccination_campaigns(
configuration, today, countryiso3s, downloader, outputs, scrapers=None
):
name = "vaccination_campaigns"
if scrapers and not any(scraper in n... | 36.666667 | 88 | 0.620949 | import logging
from hdx.scraper.readers import read_hdx
from scrapers import calculate_ratios
logger = logging.getLogger(__name__)
def add_vaccination_campaigns(
configuration, today, countryiso3s, downloader, outputs, scrapers=None
):
name = "vaccination_campaigns"
if scrapers and not any(scraper in n... | true | true |
1c24f9199f648a684593609a1798a095eb3b5076 | 3,639 | py | Python | appqos/stats.py | Axecalever/intel-cmt-cat | 50e77aaeca0734ad037d64fec1c20d07f2546d26 | [
"BSD-3-Clause"
] | null | null | null | appqos/stats.py | Axecalever/intel-cmt-cat | 50e77aaeca0734ad037d64fec1c20d07f2546d26 | [
"BSD-3-Clause"
] | null | null | null | appqos/stats.py | Axecalever/intel-cmt-cat | 50e77aaeca0734ad037d64fec1c20d07f2546d26 | [
"BSD-3-Clause"
] | null | null | null | ################################################################################
# BSD LICENSE
#
# Copyright(c) 2019 Intel Corporation. All rights reserved.
# All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions
... | 31.921053 | 80 | 0.654575 | true | true | |
1c24f92cf75837457d2f803327363e8d87d201a9 | 1,323 | py | Python | src/dwimgs/utils/package_info.py | amsaid1989/bulk-download-images | 5350d41aa199a1977d50325529876b7fd0d4aee5 | [
"MIT"
] | 2 | 2021-01-20T11:04:22.000Z | 2021-07-10T14:38:50.000Z | src/dwimgs/utils/package_info.py | amsaid1989/bulk-download-images | 5350d41aa199a1977d50325529876b7fd0d4aee5 | [
"MIT"
] | null | null | null | src/dwimgs/utils/package_info.py | amsaid1989/bulk-download-images | 5350d41aa199a1977d50325529876b7fd0d4aee5 | [
"MIT"
] | null | null | null | # Copyright 2021 Abdelrahman Said
#
# Permission is hereby granted, free of charge, to any person obtaining
# a copy of this software and associated documentation files
# (the "Software"), to deal in the Software without restriction, including
# without limitation the rights to use, copy, modify, merge, publish,
# dis... | 41.34375 | 77 | 0.771731 |
name: str = 'dwimgs'
version: str = '1.0.2'
author: str = 'Abdelrahman Said'
| true | true |
1c24f957228d5ed4b05c91dcd7edf9743916197f | 692 | py | Python | bzt/engine/names.py | IamSaurabh1/taurus | 928d44e30e6cd5b979e675bfdce4c1dbeb5d0eff | [
"Apache-2.0"
] | 1,743 | 2015-03-30T20:56:03.000Z | 2022-03-31T09:08:37.000Z | bzt/engine/names.py | IamSaurabh1/taurus | 928d44e30e6cd5b979e675bfdce4c1dbeb5d0eff | [
"Apache-2.0"
] | 1,159 | 2015-04-01T08:25:53.000Z | 2022-03-29T08:15:31.000Z | bzt/engine/names.py | IamSaurabh1/taurus | 928d44e30e6cd5b979e675bfdce4c1dbeb5d0eff | [
"Apache-2.0"
] | 497 | 2015-03-31T21:05:18.000Z | 2022-03-17T12:45:21.000Z | """
Global BZT names
Copyright 2019 BlazeMeter Inc.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in... | 28.833333 | 72 | 0.781792 |
EXEC = "execution"
SETTINGS = "settings"
SCENARIO = "scenario"
TAURUS_ARTIFACTS_DIR = "TAURUS_ARTIFACTS_DIR"
| true | true |
1c24f9afa669b6023e8e7ed28311f95edad55b24 | 1,136 | py | Python | torchreid/utils/logger.py | Shengyuan-Z/AGRL.pytorch | 6107fe0e4df5c8048a65f811bab46d2fb4624783 | [
"MIT"
] | 39 | 2020-07-15T07:01:48.000Z | 2021-11-25T08:13:13.000Z | torchreid/utils/logger.py | Shengyuan-Z/AGRL.pytorch | 6107fe0e4df5c8048a65f811bab46d2fb4624783 | [
"MIT"
] | 5 | 2020-07-27T15:36:05.000Z | 2021-04-23T10:30:24.000Z | torchreid/utils/logger.py | Shengyuan-Z/AGRL.pytorch | 6107fe0e4df5c8048a65f811bab46d2fb4624783 | [
"MIT"
] | 19 | 2020-08-02T00:16:32.000Z | 2022-02-05T06:01:42.000Z | from __future__ import absolute_import
import sys
import os
import os.path as osp
import time
from .iotools import mkdir_if_missing
class Logger(object):
"""
Write console output to external text file.
Code imported from https://github.com/Cysu/open-reid/blob/master/reid/utils/logging.py.
"""
de... | 23.666667 | 91 | 0.589789 | from __future__ import absolute_import
import sys
import os
import os.path as osp
import time
from .iotools import mkdir_if_missing
class Logger(object):
def __init__(self, fpath=None):
self.console = sys.stdout
self.file = None
if fpath is not None:
mkdir_if_missing(osp.dirn... | true | true |
1c24fa5003c366ad6b11174e078e84ce4371c092 | 879 | py | Python | meli/sampling.py | rmarcacini/cc-meli2019 | 57139212b0afce5ada550c903516e5b919347b7b | [
"MIT"
] | 5 | 2019-10-13T21:32:55.000Z | 2021-01-12T15:47:36.000Z | meli/sampling.py | pablozivic/cc-meli2019 | 57139212b0afce5ada550c903516e5b919347b7b | [
"MIT"
] | null | null | null | meli/sampling.py | pablozivic/cc-meli2019 | 57139212b0afce5ada550c903516e5b919347b7b | [
"MIT"
] | 2 | 2019-10-07T15:43:05.000Z | 2019-10-25T23:36:26.000Z | from tqdm import tqdm
import pandas as pd
def balanced_sampling(df, num_instances=500):
L = []
counter = 1
categories = df['category'].unique()
for category in tqdm(categories):
sample = df[df.category==category]
try:
sample_reliable = sample[sample.label_quality=='reliab... | 23.756757 | 105 | 0.634812 | from tqdm import tqdm
import pandas as pd
def balanced_sampling(df, num_instances=500):
L = []
counter = 1
categories = df['category'].unique()
for category in tqdm(categories):
sample = df[df.category==category]
try:
sample_reliable = sample[sample.label_quality=='reliab... | true | true |
1c24fb3c6fc5db0c545ea61cc53bd41c321727ad | 817 | py | Python | GreyMatter/define_subject.py | nayangupta824/Melissa-Web | cd669a60bf5642145904b6e7e2c4f3de2d4874c1 | [
"MIT"
] | 20 | 2015-12-09T13:14:25.000Z | 2020-05-14T05:08:31.000Z | Building_a_Web_Interface_for_Melissa/Building_a_Web_Interface_for_Melissa/Melissa-Web/GreyMatter/define_subject.py | Abhidalakoti/Project1 | e7b6bae3cb96f543d04d33cdb5015b2698af283e | [
"MIT"
] | 1 | 2016-07-17T06:30:02.000Z | 2016-07-17T06:30:02.000Z | Building_a_Web_Interface_for_Melissa/Building_a_Web_Interface_for_Melissa/Melissa-Web/GreyMatter/define_subject.py | Abhidalakoti/Project1 | e7b6bae3cb96f543d04d33cdb5015b2698af283e | [
"MIT"
] | 24 | 2015-12-16T13:15:32.000Z | 2021-02-21T17:29:44.000Z | import re
import wikipedia
from SenseCells.tts import tts
def define_subject(speech_text):
words_of_message = speech_text.split()
words_of_message.remove('define')
cleaned_message = ' '.join(words_of_message)
try:
wiki_data = wikipedia.summary(cleaned_message, sentences=5)
regEx = r... | 31.423077 | 96 | 0.646267 | import re
import wikipedia
from SenseCells.tts import tts
def define_subject(speech_text):
words_of_message = speech_text.split()
words_of_message.remove('define')
cleaned_message = ' '.join(words_of_message)
try:
wiki_data = wikipedia.summary(cleaned_message, sentences=5)
regEx = r... | true | true |
1c24fbff698e144981293b28b2bc341aca27a1fb | 1,068 | py | Python | prima/configuration/utils/depreciationHandler.py | kivo360/cadCAD | 8df7bde0e1be9adebef89d975bea64a695f472b9 | [
"MIT"
] | 215 | 2020-06-22T18:42:30.000Z | 2022-03-23T13:25:10.000Z | prima/configuration/utils/depreciationHandler.py | kivo360/cadCAD | 8df7bde0e1be9adebef89d975bea64a695f472b9 | [
"MIT"
] | 99 | 2020-06-22T20:35:37.000Z | 2022-03-07T20:39:13.000Z | prima/configuration/utils/depreciationHandler.py | kivo360/cadCAD | 8df7bde0e1be9adebef89d975bea64a695f472b9 | [
"MIT"
] | 86 | 2020-06-20T16:22:22.000Z | 2022-03-02T07:10:01.000Z | from copy import deepcopy
def sanitize_config(config):
for key, value in config.kwargs.items():
if key == 'state_dict':
config.initial_state = value
elif key == 'seed':
config.seeds = value
elif key == 'mechanisms':
config.partial_state_update_blocks = v... | 30.514286 | 81 | 0.653558 | from copy import deepcopy
def sanitize_config(config):
for key, value in config.kwargs.items():
if key == 'state_dict':
config.initial_state = value
elif key == 'seed':
config.seeds = value
elif key == 'mechanisms':
config.partial_state_update_blocks = v... | true | true |
1c24fda5cb8014ea140dfbf8026e419a207f8ab1 | 326 | py | Python | sp2d/views/admin/__init__.py | aagusti/sp2d | 51122cdbb9f85bee91d08c3dd29fb1f7d1ae3d90 | [
"MIT"
] | null | null | null | sp2d/views/admin/__init__.py | aagusti/sp2d | 51122cdbb9f85bee91d08c3dd29fb1f7d1ae3d90 | [
"MIT"
] | null | null | null | sp2d/views/admin/__init__.py | aagusti/sp2d | 51122cdbb9f85bee91d08c3dd29fb1f7d1ae3d90 | [
"MIT"
] | null | null | null | from pyramid.view import (
view_config,
)
from pyramid.httpexceptions import (
HTTPFound,
)
from ...models import App
########
# APP Home #
########
@view_config(route_name='admin', renderer='templates/home.pt', permission='view')
def view_app(request):
return dict(project='o-SIPKD')
... | 23.285714 | 82 | 0.619632 | from pyramid.view import (
view_config,
)
from pyramid.httpexceptions import (
HTTPFound,
)
from ...models import App
sion='view')
def view_app(request):
return dict(project='o-SIPKD')
| true | true |
1c24fe090cbc34a6924dab58eee36f877bb55b18 | 12,711 | py | Python | sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2017_05_01_preview/aio/operations/_diagnostic_settings_operations.py | vbarbaresi/azure-sdk-for-python | 397ba46c51d001ff89c66b170f5576cf8f49c05f | [
"MIT"
] | 8 | 2021-01-13T23:44:08.000Z | 2021-03-17T10:13:36.000Z | sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2017_05_01_preview/aio/operations/_diagnostic_settings_operations.py | vbarbaresi/azure-sdk-for-python | 397ba46c51d001ff89c66b170f5576cf8f49c05f | [
"MIT"
] | 2 | 2020-03-03T23:11:13.000Z | 2020-03-30T18:50:55.000Z | sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2017_05_01_preview/aio/operations/_diagnostic_settings_operations.py | vbarbaresi/azure-sdk-for-python | 397ba46c51d001ff89c66b170f5576cf8f49c05f | [
"MIT"
] | null | null | null | # coding=utf-8
# --------------------------------------------------------------------------
# Copyright (c) Microsoft Corporation. All rights reserved.
# Licensed under the MIT License. See License.txt in the project root for license information.
# Code generated by Microsoft (R) AutoRest Code Generator.
# Changes may ... | 46.221818 | 133 | 0.672095 |
from typing import Any, Callable, Dict, Generic, Optional, TypeVar
import warnings
from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error
from azure.core.pipeline import PipelineResponse
from azure.core.pipeline.transport import Asyn... | true | true |
1c24fe4d1032f887700b2ec90df19be4c46ac94b | 1,856 | py | Python | archivebox/core/utils.py | Mirwaisse/ArchiveBox | 6a3dbaad1230b3253a292c3a72de8dc05a7a5e5d | [
"MIT"
] | null | null | null | archivebox/core/utils.py | Mirwaisse/ArchiveBox | 6a3dbaad1230b3253a292c3a72de8dc05a7a5e5d | [
"MIT"
] | null | null | null | archivebox/core/utils.py | Mirwaisse/ArchiveBox | 6a3dbaad1230b3253a292c3a72de8dc05a7a5e5d | [
"MIT"
] | null | null | null | from pathlib import Path
from django.utils.html import format_html
from core.models import Snapshot
def get_icons(snapshot: Snapshot) -> str:
link = snapshot.as_link()
canon = link.canonical_outputs()
out_dir = Path(link.link_dir)
link_tuple = lambda link, method: (link.archive_path, canon[method] ... | 50.162162 | 147 | 0.522629 | from pathlib import Path
from django.utils.html import format_html
from core.models import Snapshot
def get_icons(snapshot: Snapshot) -> str:
link = snapshot.as_link()
canon = link.canonical_outputs()
out_dir = Path(link.link_dir)
link_tuple = lambda link, method: (link.archive_path, canon[method] ... | true | true |
1c2501ba3758a4b34bcbf523d12f563aa484f1ad | 1,106 | py | Python | src/hpo.py | AstrorEnales/GenCoNet | c596d31a889f14499883fcdf74fdc67f927a806e | [
"MIT"
] | 2 | 2019-12-05T11:46:48.000Z | 2022-03-09T00:11:06.000Z | src/hpo.py | AstrorEnales/GenCoNet | c596d31a889f14499883fcdf74fdc67f927a806e | [
"MIT"
] | null | null | null | src/hpo.py | AstrorEnales/GenCoNet | c596d31a889f14499883fcdf74fdc67f927a806e | [
"MIT"
] | null | null | null | #!/usr/bin/env python3
import os.path
import urllib.request
import io
import csv
from model.network import Network
from model.disease import Disease
from model.gene import Gene
file = '../data/HPO/OMIM_FREQUENT_FEATURES_diseases_to_genes_to_phenotypes.txt'
url = 'http://compbio.charite.de/jenkins/job/hpo.annotations.... | 31.6 | 114 | 0.678119 |
import os.path
import urllib.request
import io
import csv
from model.network import Network
from model.disease import Disease
from model.gene import Gene
file = '../data/HPO/OMIM_FREQUENT_FEATURES_diseases_to_genes_to_phenotypes.txt'
url = 'http://compbio.charite.de/jenkins/job/hpo.annotations.monthly/lastSuccessful... | true | true |
1c25024f0cb36ef18ffcaae0d271d7fc89ae4925 | 2,568 | py | Python | LM-1221 intro-python-xml/py-json/json_parse_3.py | russellpope/devnet-express-dc | 4bdb2194abdee2fc950c2ff20e607aa4af9b68b5 | [
"Apache-2.0"
] | null | null | null | LM-1221 intro-python-xml/py-json/json_parse_3.py | russellpope/devnet-express-dc | 4bdb2194abdee2fc950c2ff20e607aa4af9b68b5 | [
"Apache-2.0"
] | null | null | null | LM-1221 intro-python-xml/py-json/json_parse_3.py | russellpope/devnet-express-dc | 4bdb2194abdee2fc950c2ff20e607aa4af9b68b5 | [
"Apache-2.0"
] | null | null | null | # Examples
food = {"vegetables": ["carrots", "kale", "cucumber", "tomato"]}
print(food["vegetables"][1])
for veg in food["vegetables"]:
print(veg)
cars = {"sports": {"Porsche": "Volkswagon", "Viper": "Dodge", "Corvette": "Chevy"}}
print(cars["sports"]["Corvette"])
for auto in cars["sports"]:
print(auto, cars["... | 36.685714 | 117 | 0.617991 |
food = {"vegetables": ["carrots", "kale", "cucumber", "tomato"]}
print(food["vegetables"][1])
for veg in food["vegetables"]:
print(veg)
cars = {"sports": {"Porsche": "Volkswagon", "Viper": "Dodge", "Corvette": "Chevy"}}
print(cars["sports"]["Corvette"])
for auto in cars["sports"]:
print(auto, cars["sports"][a... | true | true |
1c2502bbcf7c805c5f66756245b5fb58ba368291 | 4,716 | py | Python | tests/app_loading/tests.py | ericholscher/django | b9a90b371c90a987ed57f7a4a7cc1274c432b438 | [
"BSD-3-Clause"
] | 1 | 2015-11-08T11:42:08.000Z | 2015-11-08T11:42:08.000Z | tests/app_loading/tests.py | ericholscher/django | b9a90b371c90a987ed57f7a4a7cc1274c432b438 | [
"BSD-3-Clause"
] | null | null | null | tests/app_loading/tests.py | ericholscher/django | b9a90b371c90a987ed57f7a4a7cc1274c432b438 | [
"BSD-3-Clause"
] | null | null | null | from __future__ import unicode_literals
import copy
import os
import sys
import time
from unittest import TestCase
from django.conf import Settings
from django.db.models.loading import cache, load_app, get_model, get_models, AppCache
from django.test.utils import override_settings
from django.utils._os import upath
... | 36.55814 | 104 | 0.662214 | from __future__ import unicode_literals
import copy
import os
import sys
import time
from unittest import TestCase
from django.conf import Settings
from django.db.models.loading import cache, load_app, get_model, get_models, AppCache
from django.test.utils import override_settings
from django.utils._os import upath
... | true | true |
1c2502d81822e1c1023b198505c713d2159b8c2f | 10,980 | py | Python | Lib/idlelib/UndoDelegator.py | Hadron/python | 73137f499ed658169f49273eee46845e3b53e800 | [
"PSF-2.0"
] | 486 | 2016-05-28T18:51:54.000Z | 2022-03-20T17:30:31.000Z | Lib/idlelib/UndoDelegator.py | Hadron/python | 73137f499ed658169f49273eee46845e3b53e800 | [
"PSF-2.0"
] | 40 | 2016-05-29T00:24:56.000Z | 2020-07-13T11:56:58.000Z | Lib/idlelib/UndoDelegator.py | Hadron/python | 73137f499ed658169f49273eee46845e3b53e800 | [
"PSF-2.0"
] | 46 | 2016-05-28T18:52:03.000Z | 2021-06-01T07:57:51.000Z | import string
from tkinter import *
from idlelib.Delegator import Delegator
#$ event <<redo>>
#$ win <Control-y>
#$ unix <Alt-z>
#$ event <<undo>>
#$ win <Control-z>
#$ unix <Control-z>
#$ event <<dump-undo-state>>
#$ win <Control-backslash>
#$ unix <Control-backslash>
class UndoDelegator(Delegator):
max_und... | 29.756098 | 77 | 0.579508 | import string
from tkinter import *
from idlelib.Delegator import Delegator
class UndoDelegator(Delegator):
max_undo = 1000
def __init__(self):
Delegator.__init__(self)
self.reset_undo()
def setdelegate(self, delegate):
if self.delegate is not None:
self... | true | true |
1c2502dc29c5891a4a7e6c911efa074518aff66f | 306 | py | Python | src/marketplace/authorization/common.py | dssg/marketplace | c1ad9d25499c5dbafef3b06ba3eb1924ff1a5fbb | [
"MIT"
] | 5 | 2018-08-28T19:31:51.000Z | 2021-04-15T22:14:34.000Z | src/marketplace/authorization/common.py | dssg/marketplace | c1ad9d25499c5dbafef3b06ba3eb1924ff1a5fbb | [
"MIT"
] | 49 | 2018-07-26T01:03:23.000Z | 2022-02-10T10:46:27.000Z | src/marketplace/authorization/common.py | dssg/marketplace | c1ad9d25499c5dbafef3b06ba3eb1924ff1a5fbb | [
"MIT"
] | 2 | 2020-08-04T11:01:59.000Z | 2020-08-13T19:04:16.000Z | import rules
from django.core.exceptions import PermissionDenied
def ensure_rule(rule, *args):
if not rules.test_rule(rule, *args):
raise PermissionDenied
def ensure_user_has_permission(user, target, permission):
if not user.has_perm(permission, target):
raise PermissionDenied
| 23.538462 | 57 | 0.751634 | import rules
from django.core.exceptions import PermissionDenied
def ensure_rule(rule, *args):
if not rules.test_rule(rule, *args):
raise PermissionDenied
def ensure_user_has_permission(user, target, permission):
if not user.has_perm(permission, target):
raise PermissionDenied
| true | true |
1c2503386fc520f32eca6665afca18a630daf79d | 1,791 | py | Python | postgresqleu/accountinfo/views.py | dlangille/pgeu-system | 3f1910010063bab118e94a55ed757b23f1d36bf5 | [
"MIT"
] | null | null | null | postgresqleu/accountinfo/views.py | dlangille/pgeu-system | 3f1910010063bab118e94a55ed757b23f1d36bf5 | [
"MIT"
] | null | null | null | postgresqleu/accountinfo/views.py | dlangille/pgeu-system | 3f1910010063bab118e94a55ed757b23f1d36bf5 | [
"MIT"
] | null | null | null | from django.http import HttpResponse
from django.db.models import Q
from django.db import transaction
from django.contrib.auth.decorators import login_required
from django.contrib.auth.models import User
import json
from postgresqleu.util.auth import authenticate_backend_group
from postgresqleu.auth import user_sear... | 32.563636 | 173 | 0.620882 | from django.http import HttpResponse
from django.db.models import Q
from django.db import transaction
from django.contrib.auth.decorators import login_required
from django.contrib.auth.models import User
import json
from postgresqleu.util.auth import authenticate_backend_group
from postgresqleu.auth import user_sear... | true | true |
1c2503764ea2f391c7316ca67540eed3c109cda4 | 5,423 | py | Python | test/python/transpiler/test_optimize_swap_before_measure.py | lerongil/qiskit-terra | a25af2a2378bc3d4f5ec73b948d048d1b707454c | [
"Apache-2.0"
] | 22 | 2019-08-15T04:39:15.000Z | 2022-03-06T05:17:04.000Z | test/python/transpiler/test_optimize_swap_before_measure.py | lerongil/qiskit-terra | a25af2a2378bc3d4f5ec73b948d048d1b707454c | [
"Apache-2.0"
] | 4 | 2019-05-13T15:28:46.000Z | 2019-12-19T20:47:02.000Z | test/python/transpiler/test_optimize_swap_before_measure.py | lerongil/qiskit-terra | a25af2a2378bc3d4f5ec73b948d048d1b707454c | [
"Apache-2.0"
] | 9 | 2019-09-05T05:33:00.000Z | 2021-10-09T16:04:53.000Z | # -*- coding: utf-8 -*-
# This code is part of Qiskit.
#
# (C) Copyright IBM 2017, 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... | 33.68323 | 91 | 0.538816 |
import unittest
from qiskit import QuantumRegister, QuantumCircuit, ClassicalRegister
from qiskit.transpiler import PassManager
from qiskit.compiler import transpile
from qiskit.transpiler.passes import OptimizeSwapBeforeMeasure, DAGFixedPoint
from qiskit.converters import circuit_to_dag
from qiskit.tes... | true | true |
1c2503c7a2f57ca8541eb1cf4aa6232dec5878ae | 50 | py | Python | spinesTS/feature_extract/__init__.py | BirchKwok/spinesTS | b88ec333f41f58979e0570177d1fdc364d976056 | [
"Apache-2.0"
] | 2 | 2021-08-15T09:29:37.000Z | 2022-03-10T13:56:13.000Z | spinesTS/feature_extract/__init__.py | BirchKwok/spinesTS | b88ec333f41f58979e0570177d1fdc364d976056 | [
"Apache-2.0"
] | null | null | null | spinesTS/feature_extract/__init__.py | BirchKwok/spinesTS | b88ec333f41f58979e0570177d1fdc364d976056 | [
"Apache-2.0"
] | null | null | null | from ._features_extractor import FeatureExtractor
| 25 | 49 | 0.9 | from ._features_extractor import FeatureExtractor
| true | true |
1c25074f82a0d8776e8fb3606505a46e58d066fc | 840 | py | Python | Part A/Topic 4 Sort/Practical 4.py | Eugenelcc/Data-Structure-Algorithm-Assignments | 4a2dc3336f5463be98688b0c9fbc6d62f84984a0 | [
"MIT"
] | null | null | null | Part A/Topic 4 Sort/Practical 4.py | Eugenelcc/Data-Structure-Algorithm-Assignments | 4a2dc3336f5463be98688b0c9fbc6d62f84984a0 | [
"MIT"
] | null | null | null | Part A/Topic 4 Sort/Practical 4.py | Eugenelcc/Data-Structure-Algorithm-Assignments | 4a2dc3336f5463be98688b0c9fbc6d62f84984a0 | [
"MIT"
] | null | null | null | # Sort a sequence in ascending order using the selection sort # algorithm
def selectionSort(theSeq):
n = len(theSeq)
for i in range(n - 1):
# Assume the ith element is the smallest.
smallNdx = i # Determine if any other element contains a smaller value.
for j in range(i + 1, n):
... | 33.6 | 131 | 0.608333 | ionSort(theSeq):
n = len(theSeq)
for i in range(n - 1):
smallNdx = i
for j in range(i + 1, n):
if theSeq[j] < theSeq[smallNdx]:
smallNdx = j
theSeq[i] = theSeq[smallNdx]
theSeq[smallNdx] = tmp
list_of_numbers... | true | true |
1c2507911070fc623af6c68556e64f99cdef2bcd | 7,310 | py | Python | kubernetes/client/models/v1_job_condition.py | dix000p/kubernetes-client-python | 22e473e02883aca1058606092c86311f02f42be2 | [
"Apache-2.0"
] | null | null | null | kubernetes/client/models/v1_job_condition.py | dix000p/kubernetes-client-python | 22e473e02883aca1058606092c86311f02f42be2 | [
"Apache-2.0"
] | null | null | null | kubernetes/client/models/v1_job_condition.py | dix000p/kubernetes-client-python | 22e473e02883aca1058606092c86311f02f42be2 | [
"Apache-2.0"
] | null | null | null | # coding: utf-8
"""
Kubernetes
No description provided (generated by Swagger Codegen https://github.com/swagger-api/swagger-codegen)
OpenAPI spec version: v1.8.1
Generated by: https://github.com/swagger-api/swagger-codegen.git
"""
from pprint import pformat
from six import iteritems
import re
... | 27.174721 | 123 | 0.582627 |
from pprint import pformat
from six import iteritems
import re
class V1JobCondition(object):
swagger_types = {
'last_probe_time': 'datetime',
'last_transition_time': 'datetime',
'message': 'str',
'reason': 'str',
'status': 'str',
'type': 'str'
}
attri... | true | true |
1c250998c344ffb287ad790af85fe11e86eb86eb | 55,973 | py | Python | pandas/tests/groupby/test_categorical.py | HeidiNeuhaeuser/pandas | 4ef033fe487df127ffb7ba186cee539e534a8bb4 | [
"PSF-2.0",
"Apache-2.0",
"BSD-3-Clause-No-Nuclear-License-2014",
"MIT",
"MIT-0",
"ECL-2.0",
"BSD-3-Clause"
] | 2 | 2021-05-07T04:58:36.000Z | 2021-05-07T04:58:59.000Z | pandas/tests/groupby/test_categorical.py | HeidiNeuhaeuser/pandas | 4ef033fe487df127ffb7ba186cee539e534a8bb4 | [
"PSF-2.0",
"Apache-2.0",
"BSD-3-Clause-No-Nuclear-License-2014",
"MIT",
"MIT-0",
"ECL-2.0",
"BSD-3-Clause"
] | null | null | null | pandas/tests/groupby/test_categorical.py | HeidiNeuhaeuser/pandas | 4ef033fe487df127ffb7ba186cee539e534a8bb4 | [
"PSF-2.0",
"Apache-2.0",
"BSD-3-Clause-No-Nuclear-License-2014",
"MIT",
"MIT-0",
"ECL-2.0",
"BSD-3-Clause"
] | 2 | 2021-06-16T07:19:12.000Z | 2021-12-16T10:24:44.000Z | from datetime import datetime
import numpy as np
import pytest
import pandas.util._test_decorators as td
import pandas as pd
from pandas import (
Categorical,
CategoricalIndex,
DataFrame,
Index,
MultiIndex,
Series,
qcut,
)
import pandas._testing as tm
def cartesian_product_for_groupers(... | 32.828739 | 88 | 0.57274 | from datetime import datetime
import numpy as np
import pytest
import pandas.util._test_decorators as td
import pandas as pd
from pandas import (
Categorical,
CategoricalIndex,
DataFrame,
Index,
MultiIndex,
Series,
qcut,
)
import pandas._testing as tm
def cartesian_product_for_groupers(... | true | true |
1c2509cc9075abee31b86d67e2d98a89cf6563ac | 268 | py | Python | Python3/1310-XOR-Queries-of-a-Subarray/soln-1.py | wyaadarsh/LeetCode-Solutions | 3719f5cb059eefd66b83eb8ae990652f4b7fd124 | [
"MIT"
] | 5 | 2020-07-24T17:48:59.000Z | 2020-12-21T05:56:00.000Z | Python3/1310-XOR-Queries-of-a-Subarray/soln-1.py | zhangyaqi1989/LeetCode-Solutions | 2655a1ffc8678ad1de6c24295071308a18c5dc6e | [
"MIT"
] | null | null | null | Python3/1310-XOR-Queries-of-a-Subarray/soln-1.py | zhangyaqi1989/LeetCode-Solutions | 2655a1ffc8678ad1de6c24295071308a18c5dc6e | [
"MIT"
] | 2 | 2020-07-24T17:49:01.000Z | 2020-08-31T19:57:35.000Z | class Solution:
def xorQueries(self, arr: List[int], queries: List[List[int]]) -> List[int]:
n = len(arr)
for i in range(1, n):
arr[i] ^= arr[i - 1]
return [(arr[hi] if lo == 0 else arr[hi] ^ arr[lo - 1]) for lo, hi in queries]
| 38.285714 | 86 | 0.526119 | class Solution:
def xorQueries(self, arr: List[int], queries: List[List[int]]) -> List[int]:
n = len(arr)
for i in range(1, n):
arr[i] ^= arr[i - 1]
return [(arr[hi] if lo == 0 else arr[hi] ^ arr[lo - 1]) for lo, hi in queries]
| true | true |
1c250adb9a49bea7ab4f50d6c6ecee3db5d57e9b | 5,908 | py | Python | ebadge_msg/market_level.py | eBADGE/message-bus | 705aafc7b0c7c74f8812e489338c5e9e2d9492aa | [
"BSD-3-Clause"
] | 1 | 2016-12-12T03:37:32.000Z | 2016-12-12T03:37:32.000Z | ebadge_msg/market_level.py | eBADGE/message-bus | 705aafc7b0c7c74f8812e489338c5e9e2d9492aa | [
"BSD-3-Clause"
] | null | null | null | ebadge_msg/market_level.py | eBADGE/message-bus | 705aafc7b0c7c74f8812e489338c5e9e2d9492aa | [
"BSD-3-Clause"
] | null | null | null | """
Copyright (c) 2013, XLAB D.O.O.
All rights reserved.
Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:
- Redistributions of source code must retain the above copyright notice, this list of conditions and the following di... | 28.541063 | 205 | 0.750339 | from ebadge_msg import *
import logging
logger = logging.getLogger("ebadge")
from common import *
class BalancingReserveBid(EbadgeSyncMsg):
def __init__(
self, product, quantity, divisible,
reserve_price, energy_price):
super(BalancingReserveBid, self).__init__()
self.bid_id = makeuuid()
self.product = pro... | true | true |
1c250aeadf6dcff58c3c5b879b9f54b0c3f8c415 | 619 | py | Python | decors.py | claywahlstrom/pack | 86b70198a4b185611c2ce3d29df99dd01233a6ac | [
"BSD-2-Clause"
] | 2 | 2019-05-04T09:32:15.000Z | 2021-02-08T08:38:23.000Z | decors.py | claywahlstrom/pack | 86b70198a4b185611c2ce3d29df99dd01233a6ac | [
"BSD-2-Clause"
] | null | null | null | decors.py | claywahlstrom/pack | 86b70198a4b185611c2ce3d29df99dd01233a6ac | [
"BSD-2-Clause"
] | null | null | null |
"""
Decorators
"""
from collections import abc
from clay.utils import qualify
def obsolete(func: abc.Callable) -> abc.Callable:
"""Decorator for warning the consumer the function is obsolete"""
def inner(*args, **kwargs):
print('Function {} is obsolete'.format(qualify(func)))
return func(*a... | 25.791667 | 69 | 0.663974 |
from collections import abc
from clay.utils import qualify
def obsolete(func: abc.Callable) -> abc.Callable:
def inner(*args, **kwargs):
print('Function {} is obsolete'.format(qualify(func)))
return func(*args, **kwargs)
return inner
def vintage(func: abc.Callable) -> abc.Callable:
def ... | true | true |
1c250cabd49b8f6daaad77cf00100c4dda5bd9b8 | 672 | py | Python | filer_addons/tests/testapp/migrations/0004_auto_20170705_0525.py | benzkji/django-filer-addons | 0220b1c75520dcda9ec1fe6a46e62a66735c7699 | [
"MIT"
] | null | null | null | filer_addons/tests/testapp/migrations/0004_auto_20170705_0525.py | benzkji/django-filer-addons | 0220b1c75520dcda9ec1fe6a46e62a66735c7699 | [
"MIT"
] | 23 | 2017-06-17T07:11:07.000Z | 2020-11-06T17:05:05.000Z | filer_addons/tests/testapp/migrations/0004_auto_20170705_0525.py | benzkji/django-filer-addons | 0220b1c75520dcda9ec1fe6a46e62a66735c7699 | [
"MIT"
] | 2 | 2017-06-20T09:25:09.000Z | 2017-08-03T07:38:17.000Z | # -*- coding: utf-8 -*-
# Generated by Django 1.10.7 on 2017-07-05 05:25
from __future__ import unicode_literals
from django.db import migrations, models
import django.db.models.deletion
class Migration(migrations.Migration):
dependencies = [
('testapp', '0003_auto_20170705_0524'),
]
operations... | 25.846154 | 121 | 0.627976 |
from __future__ import unicode_literals
from django.db import migrations, models
import django.db.models.deletion
class Migration(migrations.Migration):
dependencies = [
('testapp', '0003_auto_20170705_0524'),
]
operations = [
migrations.RemoveField(
model_name='filertest'... | true | true |
1c250e573d985b6c118719330776971e594bcfb8 | 94,843 | py | Python | cinder/tests/test_netapp.py | CiscoSystems/cinder | 15cd9ac7427255dcba8c783c65b67134b85e2887 | [
"Apache-2.0"
] | null | null | null | cinder/tests/test_netapp.py | CiscoSystems/cinder | 15cd9ac7427255dcba8c783c65b67134b85e2887 | [
"Apache-2.0"
] | null | null | null | cinder/tests/test_netapp.py | CiscoSystems/cinder | 15cd9ac7427255dcba8c783c65b67134b85e2887 | [
"Apache-2.0"
] | null | null | null | # vim: tabstop=4 shiftwidth=4 softtabstop=4
# Copyright (c) 2012 NetApp, Inc.
# All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance with the License. You may obtain
# a copy of the License at
#
# http://www.apache.or... | 40.427536 | 79 | 0.571566 |
"""
Tests for NetApp volume driver
"""
import BaseHTTPServer
import httplib
import shutil
import StringIO
import tempfile
from lxml import etree
from cinder.exception import VolumeBackendAPIException
from cinder.openstack.common import log as logging
from cinder import test
from cinder.volume import... | false | true |
1c250eaff978521e25b269d52db38063c5176840 | 12,766 | py | Python | models/official/amoeba_net/tf_hub.py | tensorflow/tpu-demos | 8aac591077e5781785aa6c22bc400472ba14dada | [
"Apache-2.0"
] | 65 | 2017-07-28T03:47:42.000Z | 2018-02-04T20:54:18.000Z | models/official/amoeba_net/tf_hub.py | tensorflow/tpu-demos | 8aac591077e5781785aa6c22bc400472ba14dada | [
"Apache-2.0"
] | 10 | 2017-08-11T22:55:40.000Z | 2018-02-07T01:11:28.000Z | models/official/amoeba_net/tf_hub.py | tensorflow/tpu-demos | 8aac591077e5781785aa6c22bc400472ba14dada | [
"Apache-2.0"
] | 28 | 2017-07-28T08:20:06.000Z | 2018-01-28T16:28:12.000Z | # Copyright 2018 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... | 38.920732 | 80 | 0.703196 |
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
import re
from absl import app
from absl import flags
import tensorflow.compat.v1 as tf
from tensorflow.compat.v1 import estimator as tf_estimator
import tensorflow_hub as hub
import amoeba_net... | true | true |
1c250f1d025b4011227edc3284d005cb8e3018fb | 4,467 | py | Python | main.py | cheonbok94/Pytorch-Latent-Constraints-Learning-to-Generate-Conditionally-from-Unconditional-Generative-Models | 0dbd182b294e0c6d3ad0deda3be1dd855fd57617 | [
"MIT"
] | 10 | 2018-07-13T06:09:59.000Z | 2021-03-02T13:40:41.000Z | main.py | cheonbok94/Pytorch-Latent-Constraints-Learning-to-Generate-Conditionally-from-Unconditional-Generative-Models | 0dbd182b294e0c6d3ad0deda3be1dd855fd57617 | [
"MIT"
] | 1 | 2021-08-12T08:43:08.000Z | 2021-08-12T08:43:08.000Z | main.py | cheonbok94/Pytorch-Latent-Constraints-Learning-to-Generate-Conditionally-from-Unconditional-Generative-Models | 0dbd182b294e0c6d3ad0deda3be1dd855fd57617 | [
"MIT"
] | null | null | null | import argparse
import numpy
from model.trainer import Trainer,AC_Trainer
from model.loss import loss_function,celeba_loss
from model.vae import Mnist_VAE,Celeba_VAE
from utils.get_data import MNIST_DATA ,Celeba_DATA
from model.model import Actor,Critic
import torch
def main():
parser = argparse.Argu... | 42.951923 | 245 | 0.73293 | import argparse
import numpy
from model.trainer import Trainer,AC_Trainer
from model.loss import loss_function,celeba_loss
from model.vae import Mnist_VAE,Celeba_VAE
from utils.get_data import MNIST_DATA ,Celeba_DATA
from model.model import Actor,Critic
import torch
def main():
parser = argparse.Argu... | true | true |
1c250fe7c86eeb9ffeac58dd3d0fa3c29bd3545b | 7,254 | py | Python | recognize_process/tools/mytest_crnn.py | ericosmic/2019-CCF-BDCI-OCR-MCZJ-OCR-IdentificationIDElement | c7fc04489360a0d4ad75495a59821ef9860e060c | [
"MIT"
] | 886 | 2019-12-31T04:51:06.000Z | 2022-03-28T07:04:42.000Z | recognize_process/tools/mytest_crnn.py | shanhedian2017/2019-CCF-BDCI-OCR-MCZJ-OCR-IdentificationIDElement | 54417d43d71af37588f3a8141aa34d151e5b7884 | [
"MIT"
] | 42 | 2020-01-03T02:50:48.000Z | 2021-12-08T13:29:08.000Z | recognize_process/tools/mytest_crnn.py | shanhedian2017/2019-CCF-BDCI-OCR-MCZJ-OCR-IdentificationIDElement | 54417d43d71af37588f3a8141aa34d151e5b7884 | [
"MIT"
] | 318 | 2019-12-31T06:25:28.000Z | 2022-03-08T09:24:11.000Z | #!/usr/bin/env python
# -*- coding: utf-8 -*-
# @Time : 19-11-19 23:45
# @Author : Miao Wenqiang
# @Reference : https://github.com/MaybeShewill-CV/CRNN_Tensorflow
# https://github.com/bai-shang/crnn_ctc_ocr.Tensorflow
# @File : test_crnn.py
# @IDE : PyCharm Commu... | 36.452261 | 233 | 0.644472 |
import argparse
import os
import time
import cv2
import numpy as np
import tensorflow as tf
import json
import sys
from recognize_process.config import model_config
from recognize_process.crnn_model import crnn_model
CFG = model_config.cfg
def init_args():
parser = argparse.ArgumentParser()
parse... | true | true |
1c2510e9e3fc374f8a4cfa3a691a649ff8aaf2d9 | 5,734 | py | Python | test/ibmq/test_ibmq_integration.py | delapuente/qiskit-ibmq-provider | 03322e8df52217ddb91c96f437dbeecebc4564ee | [
"Apache-2.0"
] | null | null | null | test/ibmq/test_ibmq_integration.py | delapuente/qiskit-ibmq-provider | 03322e8df52217ddb91c96f437dbeecebc4564ee | [
"Apache-2.0"
] | null | null | null | test/ibmq/test_ibmq_integration.py | delapuente/qiskit-ibmq-provider | 03322e8df52217ddb91c96f437dbeecebc4564ee | [
"Apache-2.0"
] | null | null | null | # -*- coding: utf-8 -*-
# Copyright 2018, IBM.
#
# This source code is licensed under the Apache License, Version 2.0 found in
# the LICENSE.txt file in the root directory of this source tree.
"""IBMQ provider integration tests (compile and run)."""
from qiskit import ClassicalRegister, QuantumCircuit, QuantumRegist... | 39.006803 | 77 | 0.667597 |
from qiskit import ClassicalRegister, QuantumCircuit, QuantumRegister
from qiskit.providers.ibmq import IBMQ, least_busy
from qiskit.result import Result
from qiskit.test import QiskitTestCase, requires_qe_access
from qiskit.tools.compiler import compile, execute
from qiskit.transpiler import transpile
class ... | true | true |
1c2511d75eefd301292b3ef1f417c76e4c2f6520 | 13,917 | py | Python | xrspatial/tests/test_zonal.py | brendancol/xarray-spatial | 36d53b75086b760cab5100a12fcbda946dd85a25 | [
"MIT"
] | null | null | null | xrspatial/tests/test_zonal.py | brendancol/xarray-spatial | 36d53b75086b760cab5100a12fcbda946dd85a25 | [
"MIT"
] | null | null | null | xrspatial/tests/test_zonal.py | brendancol/xarray-spatial | 36d53b75086b760cab5100a12fcbda946dd85a25 | [
"MIT"
] | null | null | null | import numpy as np
import pandas as pd
import xarray as xr
import dask.array as da
import dask.dataframe as dd
from xrspatial import zonal_stats as stats
from xrspatial import zonal_apply as apply
from xrspatial import zonal_crosstab as crosstab
from xrspatial import suggest_zonal_canvas
from xrspatial import trim
fro... | 29.298947 | 77 | 0.518431 | import numpy as np
import pandas as pd
import xarray as xr
import dask.array as da
import dask.dataframe as dd
from xrspatial import zonal_stats as stats
from xrspatial import zonal_apply as apply
from xrspatial import zonal_crosstab as crosstab
from xrspatial import suggest_zonal_canvas
from xrspatial import trim
fro... | true | true |
1c2512908e00d555648e4c71618567bcb3daf511 | 1,378 | py | Python | ch_8/Deck.py | ProhardONE/python_primer | 211e37c1f2fd169269fc4f3c08e8b7e5225f2ad0 | [
"MIT"
] | 51 | 2016-04-05T16:56:11.000Z | 2022-02-08T00:08:47.000Z | ch_8/Deck.py | zhangxiao921207/python_primer | 211e37c1f2fd169269fc4f3c08e8b7e5225f2ad0 | [
"MIT"
] | null | null | null | ch_8/Deck.py | zhangxiao921207/python_primer | 211e37c1f2fd169269fc4f3c08e8b7e5225f2ad0 | [
"MIT"
] | 47 | 2016-05-02T07:51:37.000Z | 2022-02-08T01:28:15.000Z | import random
# Author: Noah Waterfield Price
# random.seed(10)
class Deck:
def __init__(self):
ranks = ['A', '2', '3', '4', '5', '6', '7',
'8', '9', '10', 'J', 'Q', 'K']
suits = ['C', 'D', 'H', 'S']
self.deck = [s + r for s in suits for r in ranks]
random.shuffl... | 28.122449 | 66 | 0.532656 | import random
class Deck:
def __init__(self):
ranks = ['A', '2', '3', '4', '5', '6', '7',
'8', '9', '10', 'J', 'Q', 'K']
suits = ['C', 'D', 'H', 'S']
self.deck = [s + r for s in suits for r in ranks]
random.shuffle(self.deck)
def hand(self, n=1):
"... | false | true |
1c2512ad6f4c980f21b18ec98f4dcf8c790f4448 | 5,315 | py | Python | utils/probability_utils.py | ZiningWang/Inferring-Spatial-Uncertainty-in-Object-Detection | 3fc7c8d78e538805d928ba084c1c4570f795babc | [
"Unlicense"
] | 23 | 2020-12-23T02:37:09.000Z | 2022-03-03T06:16:43.000Z | utils/probability_utils.py | ZiningWang/Inferring-Spatial-Uncertainty-in-Object-Detection | 3fc7c8d78e538805d928ba084c1c4570f795babc | [
"Unlicense"
] | 2 | 2020-10-30T02:24:45.000Z | 2022-03-17T14:27:44.000Z | utils/probability_utils.py | ZiningWang/Inferring-Spatial-Uncertainty-in-Object-Detection | 3fc7c8d78e538805d928ba084c1c4570f795babc | [
"Unlicense"
] | 3 | 2021-01-11T23:57:07.000Z | 2022-03-25T04:19:04.000Z | import numpy as np
import os
import sys
from tqdm import tqdm
from utils.kitti_utils import boxes3d_to_corners3d
class cov_interp:
#interpterlate covariance matrix of Var[X(w)] = cov[\Phi(Y)ww^T\Phi(Y)^T] where w is n*1 and Y is m*n (Var[X] is m*m)
#Y is a fixed random variable matrix, w is the coordinate ... | 40.572519 | 183 | 0.667921 | import numpy as np
import os
import sys
from tqdm import tqdm
from utils.kitti_utils import boxes3d_to_corners3d
class cov_interp:
def __init__(self, W, Vs):
#Vs are the k corresponding Var[X(w)]'s
k = len(W)
Vstack = np.zeros([k,Vs[0].size])
self.m = Vs[0].shape[0]
self.n = W[0].siz... | true | true |
1c25131392a2ba9b568cdfc44a8e52bbf7418796 | 10,493 | py | Python | projects/DensePose/densepose/engine/trainer.py | jss367/detectron2 | 085fda47bc49f2cdd9c05a895580b2b31fcdb6c3 | [
"Apache-2.0"
] | 21,274 | 2019-10-10T17:50:46.000Z | 2022-03-31T17:58:45.000Z | projects/DensePose/densepose/engine/trainer.py | jss367/detectron2 | 085fda47bc49f2cdd9c05a895580b2b31fcdb6c3 | [
"Apache-2.0"
] | 3,253 | 2019-10-10T20:39:47.000Z | 2022-03-31T22:27:53.000Z | projects/DensePose/densepose/engine/trainer.py | jss367/detectron2 | 085fda47bc49f2cdd9c05a895580b2b31fcdb6c3 | [
"Apache-2.0"
] | 6,288 | 2019-10-10T18:00:27.000Z | 2022-03-31T21:22:58.000Z | # Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved
import logging
import os
from collections import OrderedDict
from typing import List, Optional, Union
import torch
from torch import nn
from detectron2.checkpoint import DetectionCheckpointer
from detectron2.config import CfgNode
from detectron2.e... | 40.670543 | 100 | 0.632136 |
import logging
import os
from collections import OrderedDict
from typing import List, Optional, Union
import torch
from torch import nn
from detectron2.checkpoint import DetectionCheckpointer
from detectron2.config import CfgNode
from detectron2.engine import DefaultTrainer
from detectron2.evaluation import (
Da... | true | true |
1c2513627632c6c79d89f226fa2acd03bcb74e58 | 2,249 | py | Python | tests/test_actions_modernizer_django.py | regisb/repo-tools | 69c03ce99a4a6d87bc0c0fecaf1a3cbdb2a3b281 | [
"Apache-2.0"
] | 23 | 2015-01-17T15:51:41.000Z | 2021-11-01T17:47:10.000Z | tests/test_actions_modernizer_django.py | regisb/repo-tools | 69c03ce99a4a6d87bc0c0fecaf1a3cbdb2a3b281 | [
"Apache-2.0"
] | 79 | 2015-02-09T15:26:47.000Z | 2021-12-16T15:51:42.000Z | tests/test_actions_modernizer_django.py | regisb/repo-tools | 69c03ce99a4a6d87bc0c0fecaf1a3cbdb2a3b281 | [
"Apache-2.0"
] | 23 | 2015-01-26T14:38:37.000Z | 2021-11-05T10:33:39.000Z | """
Tests for Github Actions Django Modernizer Script
"""
import os
import shutil
from os.path import dirname, basename, join
from edx_repo_tools.codemods.django3 import GithubCIDjangoModernizer
from edx_repo_tools.utils import YamlLoader
def setup_local_copy(filepath, tmpdir):
current_directory = dirname(__file... | 35.140625 | 95 | 0.744775 | import os
import shutil
from os.path import dirname, basename, join
from edx_repo_tools.codemods.django3 import GithubCIDjangoModernizer
from edx_repo_tools.utils import YamlLoader
def setup_local_copy(filepath, tmpdir):
current_directory = dirname(__file__)
local_file = join(current_directory, filepath)
... | true | true |
1c2513aa0259e30db2eb160fe9f49b21ac462d39 | 6,642 | py | Python | web3/providers/ipc.py | lastmjs/web3.py | 899a991684a8a30b2d3832776eb07de2f6544951 | [
"MIT"
] | 1 | 2021-11-15T19:06:05.000Z | 2021-11-15T19:06:05.000Z | web3/providers/ipc.py | beimingmaster/web3.py | 910443d8a17d73841341309f8497893a96ddb3b6 | [
"MIT"
] | null | null | null | web3/providers/ipc.py | beimingmaster/web3.py | 910443d8a17d73841341309f8497893a96ddb3b6 | [
"MIT"
] | 1 | 2018-08-29T06:09:03.000Z | 2018-08-29T06:09:03.000Z | import logging
import os
import pathlib
import socket
import sys
import threading
from web3.utils.threads import (
Timeout,
)
from .base import (
JSONBaseProvider,
)
try:
from json import JSONDecodeError
except ImportError:
JSONDecodeError = ValueError
def get_ipc_socket(ipc_path, timeout=0.1):
... | 27.110204 | 95 | 0.51897 | import logging
import os
import pathlib
import socket
import sys
import threading
from web3.utils.threads import (
Timeout,
)
from .base import (
JSONBaseProvider,
)
try:
from json import JSONDecodeError
except ImportError:
JSONDecodeError = ValueError
def get_ipc_socket(ipc_path, timeout=0.1):
... | true | true |
1c251431cb48528ab997feddc3df2c2bb5a98813 | 1,036 | py | Python | google/cloud/compute_v1/services/instance_templates/transports/__init__.py | georgiyekkert/python-compute | d128efbb3bf10af9b41e55b20aaa8080b3221e77 | [
"Apache-2.0"
] | 19 | 2021-02-10T21:17:20.000Z | 2022-02-20T03:16:36.000Z | google/cloud/compute_v1/services/instance_templates/transports/__init__.py | georgiyekkert/python-compute | d128efbb3bf10af9b41e55b20aaa8080b3221e77 | [
"Apache-2.0"
] | 121 | 2021-01-08T23:46:58.000Z | 2022-03-26T04:34:36.000Z | google/cloud/compute_v1/services/instance_templates/transports/__init__.py | georgiyekkert/python-compute | d128efbb3bf10af9b41e55b20aaa8080b3221e77 | [
"Apache-2.0"
] | 20 | 2021-01-08T23:14:16.000Z | 2022-02-25T01:27:20.000Z | # -*- coding: utf-8 -*-
# Copyright 2020 Google LLC
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or... | 33.419355 | 88 | 0.775097 |
from collections import OrderedDict
from typing import Dict, Type
from .base import InstanceTemplatesTransport
from .rest import InstanceTemplatesRestTransport
_transport_registry = OrderedDict()
_transport_registry["rest"] = InstanceTemplatesRestTransport
__all__ = (
"InstanceTemplatesTranspo... | true | true |
1c25146e781ad9021c4699a685cc5c5e066c7579 | 9,296 | py | Python | pybamm/models/submodels/interface/kinetics/base_kinetics.py | NunoEdgarGFlowHub/PyBaMM | 4e4e1ab8c488b0c0a6efdb9934c5ac59e947a190 | [
"BSD-3-Clause"
] | 1 | 2021-03-06T15:10:34.000Z | 2021-03-06T15:10:34.000Z | pybamm/models/submodels/interface/kinetics/base_kinetics.py | NunoEdgarGFlowHub/PyBaMM | 4e4e1ab8c488b0c0a6efdb9934c5ac59e947a190 | [
"BSD-3-Clause"
] | null | null | null | pybamm/models/submodels/interface/kinetics/base_kinetics.py | NunoEdgarGFlowHub/PyBaMM | 4e4e1ab8c488b0c0a6efdb9934c5ac59e947a190 | [
"BSD-3-Clause"
] | null | null | null | #
# Base kinetics class
#
import pybamm
from ..base_interface import BaseInterface
class BaseKinetics(BaseInterface):
"""
Base submodel for kinetics
Parameters
----------
param :
model parameters
domain : str
The domain to implement the model, either: 'Negative' or 'Positive'... | 38.895397 | 87 | 0.600366 |
import pybamm
from ..base_interface import BaseInterface
class BaseKinetics(BaseInterface):
def __init__(self, param, domain, reaction, options=None):
super().__init__(param, domain, reaction)
if options is None:
options = {"sei film resistance": None}
self.options = optio... | true | true |
1c2514ae4761d4a80857b2f2d75d38f0b0abea1d | 456 | py | Python | sum_product.py | phsantosjr/python-algorithms | 4683b66eb3b7e934ccb8f7bb263f3988a661c202 | [
"CNRI-Python"
] | null | null | null | sum_product.py | phsantosjr/python-algorithms | 4683b66eb3b7e934ccb8f7bb263f3988a661c202 | [
"CNRI-Python"
] | null | null | null | sum_product.py | phsantosjr/python-algorithms | 4683b66eb3b7e934ccb8f7bb263f3988a661c202 | [
"CNRI-Python"
] | null | null | null | from utils import timer_decorator
@timer_decorator
def sum_product(array: list) -> dict:
"""
BIG-O Notation: This will take O(N) time. The fact that we iterate through the array twice doesn't matter.
:param array: list of numbers
:return:
"""
total_sum = 0
total_product = 1
for i in... | 19.826087 | 110 | 0.638158 | from utils import timer_decorator
@timer_decorator
def sum_product(array: list) -> dict:
total_sum = 0
total_product = 1
for i in array:
total_sum += i
for i in array:
total_product *= i
return {"sum": total_sum, "product": total_product}
| true | true |
1c25157bc88211b16e3d4572d25813171146b952 | 2,451 | py | Python | lib/init.py | motioncrypto/sentinel | d6d6f0c14c539f8c0c3f013605ea3d0a2bfb1c44 | [
"MIT"
] | null | null | null | lib/init.py | motioncrypto/sentinel | d6d6f0c14c539f8c0c3f013605ea3d0a2bfb1c44 | [
"MIT"
] | 1 | 2018-06-11T00:40:39.000Z | 2018-06-11T00:40:39.000Z | lib/init.py | motioncrypto/sentinel | d6d6f0c14c539f8c0c3f013605ea3d0a2bfb1c44 | [
"MIT"
] | 2 | 2018-09-23T19:54:26.000Z | 2019-01-21T12:57:36.000Z | import sys
import os
sys.path.append(os.path.join(os.path.dirname(__file__), '..'))
sys.path.append(os.path.join(os.path.dirname(__file__), '..', 'lib'))
def is_valid_python_version():
version_valid = False
ver = sys.version_info
if (2 == ver.major) and (7 <= ver.minor):
version_valid = True
... | 23.567308 | 159 | 0.659323 | import sys
import os
sys.path.append(os.path.join(os.path.dirname(__file__), '..'))
sys.path.append(os.path.join(os.path.dirname(__file__), '..', 'lib'))
def is_valid_python_version():
version_valid = False
ver = sys.version_info
if (2 == ver.major) and (7 <= ver.minor):
version_valid = True
... | true | true |
1c251703bdc3298086dec9b6cee4d79705df7111 | 29,809 | py | Python | src/ClusterManager/job_launcher.py | AI-ML-Projects/DLWorkspace | b4b07187f673fa6b98341c6d38a7a83bb6baa160 | [
"MIT"
] | null | null | null | src/ClusterManager/job_launcher.py | AI-ML-Projects/DLWorkspace | b4b07187f673fa6b98341c6d38a7a83bb6baa160 | [
"MIT"
] | null | null | null | src/ClusterManager/job_launcher.py | AI-ML-Projects/DLWorkspace | b4b07187f673fa6b98341c6d38a7a83bb6baa160 | [
"MIT"
] | null | null | null | #!/usr/bin/env python
import json
import yaml
import os
import logging
import logging.config
import timeit
import functools
import time
import datetime
import base64
import multiprocessing
import hashlib
from kubernetes import client, config as k8s_config
from kubernetes.client.rest import ApiException
from kubernete... | 39.69241 | 135 | 0.608206 |
import json
import yaml
import os
import logging
import logging.config
import timeit
import functools
import time
import datetime
import base64
import multiprocessing
import hashlib
from kubernetes import client, config as k8s_config
from kubernetes.client.rest import ApiException
from kubernetes.stream import strea... | true | true |
1c25172998fbe410804d06d3f64b2b383d255cea | 26 | py | Python | mzdeepnet/io/__init__.py | MobtgZhang/mzdeepnet | 7856461444d9874de2fce9883e23bcd571834364 | [
"MIT"
] | null | null | null | mzdeepnet/io/__init__.py | MobtgZhang/mzdeepnet | 7856461444d9874de2fce9883e23bcd571834364 | [
"MIT"
] | null | null | null | mzdeepnet/io/__init__.py | MobtgZhang/mzdeepnet | 7856461444d9874de2fce9883e23bcd571834364 | [
"MIT"
] | null | null | null | from .io import save,load
| 13 | 25 | 0.769231 | from .io import save,load
| true | true |
1c2517915e73d6c03852251471aa8a1d28f4dce4 | 5,569 | py | Python | app_mt5(gradio).py | sultanbst123/Text_summarization-id2id | 22db114f6c9f138e0391e98440ec992eadf0578b | [
"Apache-2.0"
] | 4 | 2022-02-18T08:19:42.000Z | 2022-03-13T12:58:59.000Z | app_mt5(gradio).py | sultanbst123/Text_summarization-Finetune | 22db114f6c9f138e0391e98440ec992eadf0578b | [
"Apache-2.0"
] | null | null | null | app_mt5(gradio).py | sultanbst123/Text_summarization-Finetune | 22db114f6c9f138e0391e98440ec992eadf0578b | [
"Apache-2.0"
] | null | null | null |
#MT5 FINE TUNE
import gradio as gr
#import tensorflow as tf masih error
import torch #ganti ke pt
import sentencepiece
from transformers import MT5Tokenizer, MT5ForConditionalGeneration
def run_model(input_text,
min_length,
max_length,
length_penalty):
#... | 55.69 | 1,391 | 0.672113 |
import gradio as gr
import torch
import sentencepiece
from transformers import MT5Tokenizer, MT5ForConditionalGeneration
def run_model(input_text,
min_length,
max_length,
length_penalty):
mt5_model = MT5ForConditionalGeneration.from_pretrained("c... | true | true |
1c2518646bb2916c7c9408764cc05a808f06661a | 10,714 | py | Python | .venv/lib/python3.8/site-packages/pandas/tests/io/parser/test_textreader.py | acrucetta/Chicago_COVI_WebApp | a37c9f492a20dcd625f8647067394617988de913 | [
"MIT",
"Unlicense"
] | 115 | 2020-06-18T15:00:58.000Z | 2022-03-02T10:13:19.000Z | .venv/lib/python3.8/site-packages/pandas/tests/io/parser/test_textreader.py | acrucetta/Chicago_COVI_WebApp | a37c9f492a20dcd625f8647067394617988de913 | [
"MIT",
"Unlicense"
] | 37 | 2020-10-20T08:30:53.000Z | 2020-12-22T13:15:45.000Z | .venv/lib/python3.8/site-packages/pandas/tests/io/parser/test_textreader.py | acrucetta/Chicago_COVI_WebApp | a37c9f492a20dcd625f8647067394617988de913 | [
"MIT",
"Unlicense"
] | 60 | 2020-07-22T14:53:10.000Z | 2022-03-23T10:17:59.000Z | """
Tests the TextReader class in parsers.pyx, which
is integral to the C engine in parsers.py
"""
from io import BytesIO, StringIO
import os
import numpy as np
import pytest
import pandas._libs.parsers as parser
from pandas._libs.parsers import TextReader
from pandas import DataFrame
import pandas._testing as tm
f... | 30.69914 | 88 | 0.549095 | from io import BytesIO, StringIO
import os
import numpy as np
import pytest
import pandas._libs.parsers as parser
from pandas._libs.parsers import TextReader
from pandas import DataFrame
import pandas._testing as tm
from pandas.io.parsers import TextFileReader, read_csv
class TestTextReader:
@pytest.fixture(a... | true | true |
1c2519d67d09cabd20170f99304afffab55fb3a5 | 17,783 | py | Python | tools/c7n_mailer/tests/common.py | StevenGunn/cloud-custodian | 95fde5dbfdb5d273ee0f7a65d046dec18b37173e | [
"Apache-2.0"
] | 1,787 | 2016-04-18T21:25:59.000Z | 2018-12-03T17:16:48.000Z | tools/c7n_mailer/tests/common.py | StevenGunn/cloud-custodian | 95fde5dbfdb5d273ee0f7a65d046dec18b37173e | [
"Apache-2.0"
] | 2,238 | 2016-04-19T22:21:50.000Z | 2018-12-03T22:45:56.000Z | tools/c7n_mailer/tests/common.py | StevenGunn/cloud-custodian | 95fde5dbfdb5d273ee0f7a65d046dec18b37173e | [
"Apache-2.0"
] | 650 | 2016-04-18T20:53:21.000Z | 2018-11-29T21:40:32.000Z | # Copyright The Cloud Custodian Authors.
# SPDX-License-Identifier: Apache-2.0
import logging
import os
import fakeredis
from ldap3 import MOCK_SYNC, Connection, Server
from ldap3.strategy import mockBase
from c7n_mailer.ldap_lookup import LdapLookup, Redis
logger = logging.getLogger('custodian.mailer')
PETER = (
... | 28.137658 | 144 | 0.519204 |
import logging
import os
import fakeredis
from ldap3 import MOCK_SYNC, Connection, Server
from ldap3.strategy import mockBase
from c7n_mailer.ldap_lookup import LdapLookup, Redis
logger = logging.getLogger('custodian.mailer')
PETER = (
'uid=peter,cn=users,dc=initech,dc=com',
{
'uid': ['peter'],
... | true | true |
1c251a3ab5cfb02b5e48a911970aad96684b9af7 | 151 | py | Python | applications/assets/admin.py | awwong1/apollo | 5571b5f222265bec3eed45b21e862636ccdc9a97 | [
"MIT"
] | null | null | null | applications/assets/admin.py | awwong1/apollo | 5571b5f222265bec3eed45b21e862636ccdc9a97 | [
"MIT"
] | null | null | null | applications/assets/admin.py | awwong1/apollo | 5571b5f222265bec3eed45b21e862636ccdc9a97 | [
"MIT"
] | null | null | null | from applications.assets.models import Equipment, Service
from django.contrib import admin
admin.site.register(Equipment)
admin.site.register(Service) | 30.2 | 57 | 0.847682 | from applications.assets.models import Equipment, Service
from django.contrib import admin
admin.site.register(Equipment)
admin.site.register(Service) | true | true |
1c251af69d7e142cf516f25aba2cd5fb5f2bc256 | 450 | py | Python | examples/python/typetest.py | casallas/osgswig | 42bd392fefb09771e7cdc0c59eb6b19fa159431e | [
"MIT"
] | 5 | 2015-12-31T06:08:05.000Z | 2021-09-07T08:52:09.000Z | examples/python/typetest.py | casallas/osgswig | 42bd392fefb09771e7cdc0c59eb6b19fa159431e | [
"MIT"
] | null | null | null | examples/python/typetest.py | casallas/osgswig | 42bd392fefb09771e7cdc0c59eb6b19fa159431e | [
"MIT"
] | 6 | 2015-12-31T06:08:06.000Z | 2019-04-20T13:35:07.000Z | #!/usr/bin/env python
import sys
# we need to patch in our own directory
# sys.path.append('../../bin/python')
import wosg
import wosgDB
vec = wosg.Vec3f()
print vec.x()
q = wosg.Quat()
# proper return values
angle,x,y,z = q.getRotate()
print angle,x,y,z
# testing if GLenum disappears
bf = wosg.BlendFunc()
... | 12.857143 | 65 | 0.706667 |
import sys
import wosg
import wosgDB
vec = wosg.Vec3f()
print vec.x()
q = wosg.Quat()
angle,x,y,z = q.getRotate()
print angle,x,y,z
bf = wosg.BlendFunc()
bf.setFunction(wosg.BlendFunc.DST_ALPHA,wosg.BlendFunc.DST_COLOR)
print bf.getSource()
node = wosgDB.readNodeFile('cow.osg')
| false | true |
1c251e0d37eb2f6fe90c7280f55da9621ab85b36 | 118 | py | Python | FUNDAMENTALS_MODULE/Data_Types_and_Variables/EXERCISE/04_Sum_of_Chars.py | sleepychild/ProgramingBasicsPython | d96dc4662adc1c8329b731b9c9b7fa4ecf69ec16 | [
"MIT"
] | null | null | null | FUNDAMENTALS_MODULE/Data_Types_and_Variables/EXERCISE/04_Sum_of_Chars.py | sleepychild/ProgramingBasicsPython | d96dc4662adc1c8329b731b9c9b7fa4ecf69ec16 | [
"MIT"
] | 1 | 2022-01-15T10:33:56.000Z | 2022-01-15T10:33:56.000Z | FUNDAMENTALS_MODULE/Data_Types_and_Variables/EXERCISE/04_Sum_of_Chars.py | sleepychild/ProgramingBasicsPython | d96dc4662adc1c8329b731b9c9b7fa4ecf69ec16 | [
"MIT"
] | null | null | null | char_sum: int = int()
for _ in range(int(input())):
char_sum += ord(input())
print(f'The sum equals: {char_sum}')
| 23.6 | 36 | 0.635593 | char_sum: int = int()
for _ in range(int(input())):
char_sum += ord(input())
print(f'The sum equals: {char_sum}')
| true | true |
1c251e5d5c899c19892e3bebbc76db136e53a985 | 581 | py | Python | Dataset/Leetcode/train/104/522.py | kkcookies99/UAST | fff81885aa07901786141a71e5600a08d7cb4868 | [
"MIT"
] | null | null | null | Dataset/Leetcode/train/104/522.py | kkcookies99/UAST | fff81885aa07901786141a71e5600a08d7cb4868 | [
"MIT"
] | null | null | null | Dataset/Leetcode/train/104/522.py | kkcookies99/UAST | fff81885aa07901786141a71e5600a08d7cb4868 | [
"MIT"
] | null | null | null | class Solution:
def XXX(self, root: TreeNode) -> int:
# 双向队列法
if not root:
return 0
level = deque([root])
depth = 0
while level:
for _ in range(len(level)):
node = level.popleft()
if node.left:
level.... | 26.409091 | 80 | 0.447504 | class Solution:
def XXX(self, root: TreeNode) -> int:
if not root:
return 0
level = deque([root])
depth = 0
while level:
for _ in range(len(level)):
node = level.popleft()
if node.left:
level.append(... | true | true |
1c251e88532782b524665e5b8994128e9e74b5f1 | 2,262 | py | Python | tests/python/gaia-ui-tests/gaiatest/tests/functional/email/test_email_one_header_displayed.py | ythej/gaia | 309cb1a71beb5adc61ee1162bad42c4e9167f853 | [
"Apache-2.0"
] | 1 | 2019-02-13T23:44:14.000Z | 2019-02-13T23:44:14.000Z | tests/python/gaia-ui-tests/gaiatest/tests/functional/email/test_email_one_header_displayed.py | ythej/gaia | 309cb1a71beb5adc61ee1162bad42c4e9167f853 | [
"Apache-2.0"
] | null | null | null | tests/python/gaia-ui-tests/gaiatest/tests/functional/email/test_email_one_header_displayed.py | ythej/gaia | 309cb1a71beb5adc61ee1162bad42c4e9167f853 | [
"Apache-2.0"
] | null | null | null | # This Source Code Form is subject to the terms of the Mozilla Public
# License, v. 2.0. If a copy of the MPL was not distributed with this
# file, You can obtain one at http://mozilla.org/MPL/2.0/.
from marionette import SkipTest
try:
from marionette import Wait
except ImportError:
from marionette_driver impo... | 39 | 97 | 0.709107 |
from marionette import SkipTest
try:
from marionette import Wait
except ImportError:
from marionette_driver import Wait
from gaiatest import GaiaTestCase
from gaiatest.apps.email.app import Email
from gaiatest.apps.system.regions.cards_view import CardsView
from gaiatest.apps.homescreen.app import Homescre... | true | true |
1c251ead70fb6018151fa30c31ce04cb770c4da0 | 10,507 | py | Python | src/oci/data_integration/models/published_object_from_integration_task.py | LaudateCorpus1/oci-python-sdk | b0d3ce629d5113df4d8b83b7a6502b2c5bfa3015 | [
"Apache-2.0",
"BSD-3-Clause"
] | null | null | null | src/oci/data_integration/models/published_object_from_integration_task.py | LaudateCorpus1/oci-python-sdk | b0d3ce629d5113df4d8b83b7a6502b2c5bfa3015 | [
"Apache-2.0",
"BSD-3-Clause"
] | null | null | null | src/oci/data_integration/models/published_object_from_integration_task.py | LaudateCorpus1/oci-python-sdk | b0d3ce629d5113df4d8b83b7a6502b2c5bfa3015 | [
"Apache-2.0",
"BSD-3-Clause"
] | null | null | null | # coding: utf-8
# Copyright (c) 2016, 2022, Oracle and/or its affiliates. All rights reserved.
# This software is dual-licensed to you under the Universal Permissive License (UPL) 1.0 as shown at https://oss.oracle.com/licenses/upl or Apache License 2.0 as shown at http://www.apache.org/licenses/LICENSE-2.0. You may c... | 37.525 | 245 | 0.678405 |
from .published_object import PublishedObject
from oci.util import formatted_flat_dict, NONE_SENTINEL, value_allowed_none_or_none_sentinel
from oci.decorators import init_model_state_from_kwargs
@init_model_state_from_kwargs
class PublishedObjectFromIntegrationTask(PublishedObject):
def __init__(self, **kw... | true | true |
1c25248e3dbdf5a05401450bff131983776582bc | 4,940 | gyp | Python | binding.gyp | comeadows/dymo-label-converter | 0347dfa5dc2ababa500735680fe5a1e2b6a4ab7a | [
"MIT",
"Unlicense"
] | null | null | null | binding.gyp | comeadows/dymo-label-converter | 0347dfa5dc2ababa500735680fe5a1e2b6a4ab7a | [
"MIT",
"Unlicense"
] | null | null | null | binding.gyp | comeadows/dymo-label-converter | 0347dfa5dc2ababa500735680fe5a1e2b6a4ab7a | [
"MIT",
"Unlicense"
] | 1 | 2022-03-21T09:55:25.000Z | 2022-03-21T09:55:25.000Z | {
'conditions': [
['OS=="win"', {
'variables': {
'GTK_Root%': 'C:/GTK', # Set the location of GTK all-in-one bundle
'with_jpeg%': 'false',
'with_gif%': 'false',
'with_pango%': 'false',
'with_freetype%': 'false'
}
}, { # 'OS!="win"'
'variables': {
... | 28.72093 | 99 | 0.383603 | {
'conditions': [
['OS=="win"', {
'variables': {
'GTK_Root%': 'C:/GTK',
'with_jpeg%': 'false',
'with_gif%': 'false',
'with_pango%': 'false',
'with_freetype%': 'false'
}
}, {
'variables': {
'with_jpeg%': '<!(./util/has_lib.sh jpeg)',
'... | true | true |
1c2524aa612ccf42bc52692a7c358d425570bd5f | 1,314 | py | Python | account/admin.py | ianahart/devtrove | b743881a5a4b470ffb235bb2311b9a71952ad05b | [
"MIT"
] | null | null | null | account/admin.py | ianahart/devtrove | b743881a5a4b470ffb235bb2311b9a71952ad05b | [
"MIT"
] | null | null | null | account/admin.py | ianahart/devtrove | b743881a5a4b470ffb235bb2311b9a71952ad05b | [
"MIT"
] | null | null | null | from django.contrib import admin
from django.contrib.auth.admin import UserAdmin as BaseUserAdmin
from .forms import UserCreationForm, UserChangeForm
from .models import CustomUser
class CustomUserAdmin(BaseUserAdmin):
list_display = ('email', 'is_staff', 'is_superuser')
add_form = UserCreationForm
form... | 25.764706 | 64 | 0.472603 | from django.contrib import admin
from django.contrib.auth.admin import UserAdmin as BaseUserAdmin
from .forms import UserCreationForm, UserChangeForm
from .models import CustomUser
class CustomUserAdmin(BaseUserAdmin):
list_display = ('email', 'is_staff', 'is_superuser')
add_form = UserCreationForm
form... | true | true |
1c25256e056ec511fb6453e0fb07288c3592d465 | 1,533 | py | Python | Managers/TypeManager.py | JHP4911/PyDoc | 34cadcd2ebce134171d1522d9c499a720d8f311f | [
"MIT"
] | 21 | 2017-05-19T05:47:27.000Z | 2021-12-11T17:04:48.000Z | Managers/TypeManager.py | tdamdouni/PyDoc | 34cadcd2ebce134171d1522d9c499a720d8f311f | [
"MIT"
] | null | null | null | Managers/TypeManager.py | tdamdouni/PyDoc | 34cadcd2ebce134171d1522d9c499a720d8f311f | [
"MIT"
] | 7 | 2017-05-19T06:12:47.000Z | 2020-08-17T19:19:33.000Z | import json
import os
import ui
class Type (object):
def __init__(self):
self.__name = ''
self.__plural = ''
self.__aliases = []
self.__icon = None
@property
def name(self):
return self.__name
@name.setter
def name(self, data):
self.__name = data
@property
def plural(self):
return self.__plura... | 20.171053 | 81 | 0.669276 | import json
import os
import ui
class Type (object):
def __init__(self):
self.__name = ''
self.__plural = ''
self.__aliases = []
self.__icon = None
@property
def name(self):
return self.__name
@name.setter
def name(self, data):
self.__name = data
@property
def plural(self):
return self.__plura... | true | true |
1c252589101d1118d919b225ac3ca853d3f33db4 | 4,871 | py | Python | preproc/split_dataset.py | mctouch/dlrm_for_pytorch | 3d7e345aa1686f02a514cbcb207b1b1ce50ba3c9 | [
"Apache-2.0"
] | 1 | 2021-04-20T21:43:46.000Z | 2021-04-20T21:43:46.000Z | preproc/split_dataset.py | SpringWave1/DLRM-TEST | a6572655053bbca0461af87c5ce30042950282bc | [
"Apache-2.0"
] | null | null | null | preproc/split_dataset.py | SpringWave1/DLRM-TEST | a6572655053bbca0461af87c5ce30042950282bc | [
"Apache-2.0"
] | null | null | null | # Copyright (c) 2020 NVIDIA CORPORATION. All rights reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by appli... | 38.054688 | 116 | 0.710121 |
import argparse
import json
import os
import math
from shutil import copyfile
from tqdm import tqdm
import numpy as np
from typing import Sequence
def get_categorical_feature_type(size: int):
types = (np.int8, np.int16, np.int32)
for numpy_type in types:
if size < np.iinfo(numpy_type).... | true | true |
1c2525a25fc59971a3bbf48b4a159f02fb993244 | 653 | py | Python | del2rpp/util.py | dcower/del2rpp | d0afa4ec39c2060b44e772f87a6700807d8d8155 | [
"MIT"
] | 34 | 2019-12-31T15:00:32.000Z | 2022-01-21T00:29:59.000Z | del2rpp/util.py | dcower/del2rpp | d0afa4ec39c2060b44e772f87a6700807d8d8155 | [
"MIT"
] | 5 | 2019-12-31T00:15:39.000Z | 2020-02-23T21:33:03.000Z | del2rpp/util.py | dcower/del2rpp | d0afa4ec39c2060b44e772f87a6700807d8d8155 | [
"MIT"
] | 2 | 2020-11-16T06:29:33.000Z | 2022-02-02T18:43:23.000Z | #! /usr/bin/env python
# -*- coding: utf-8 -*-
import base64
import binascii
import uuid
def generate_guid():
return "{" + str(uuid.uuid4()) + "}"
def color_to_reaper(color):
return ((color.r << 16) | (color.g << 8) | color.b) | 0x1000000
def bytes_to_hex(b):
return binascii.hexlify(bytearray(b)).decode("a... | 24.185185 | 79 | 0.69219 |
import base64
import binascii
import uuid
def generate_guid():
return "{" + str(uuid.uuid4()) + "}"
def color_to_reaper(color):
return ((color.r << 16) | (color.g << 8) | color.b) | 0x1000000
def bytes_to_hex(b):
return binascii.hexlify(bytearray(b)).decode("ascii")
def hex_to_base64(h):
# give... | true | true |
1c2525a2e754bf910d6c85773de25e5def0f20ad | 884 | py | Python | flask_site/libraries/tunein.py | wcpr740/740.wcpr.org | 14cd31eeda38adc0ad3bd98d2386e92b02f794ff | [
"Apache-2.0"
] | null | null | null | flask_site/libraries/tunein.py | wcpr740/740.wcpr.org | 14cd31eeda38adc0ad3bd98d2386e92b02f794ff | [
"Apache-2.0"
] | null | null | null | flask_site/libraries/tunein.py | wcpr740/740.wcpr.org | 14cd31eeda38adc0ad3bd98d2386e92b02f794ff | [
"Apache-2.0"
] | null | null | null | import requests
from flask_site import config, DEBUG
TUNEIN_URL = 'http://air.radiotime.com/Playing.ashx'
TUNEIN_CONFIG = config.get('tunein')
if (TUNEIN_CONFIG is None or TUNEIN_CONFIG.get('station_id', '') == ''
or TUNEIN_CONFIG.get('partner_id', '') == '' or TUNEIN_CONFIG.get('partner_key', '') == ''):
... | 34 | 100 | 0.65724 | import requests
from flask_site import config, DEBUG
TUNEIN_URL = 'http://air.radiotime.com/Playing.ashx'
TUNEIN_CONFIG = config.get('tunein')
if (TUNEIN_CONFIG is None or TUNEIN_CONFIG.get('station_id', '') == ''
or TUNEIN_CONFIG.get('partner_id', '') == '' or TUNEIN_CONFIG.get('partner_key', '') == ''):
... | true | true |
1c2525dc3ae926be6ded2903d6cae73bf62ca10c | 2,949 | py | Python | tests/test_typedeclaration_smiv1_pysnmp.py | pysnmp/pysmi | 8859f4e81bb4d2ee7396e710163782a59aed854b | [
"BSD-2-Clause"
] | null | null | null | tests/test_typedeclaration_smiv1_pysnmp.py | pysnmp/pysmi | 8859f4e81bb4d2ee7396e710163782a59aed854b | [
"BSD-2-Clause"
] | null | null | null | tests/test_typedeclaration_smiv1_pysnmp.py | pysnmp/pysmi | 8859f4e81bb4d2ee7396e710163782a59aed854b | [
"BSD-2-Clause"
] | null | null | null | #
# This file is part of pysmi software.
#
# Copyright (c) 2015-2019, Ilya Etingof <etingof@gmail.com>
# License: http://snmplabs.com/pysmi/license.html
#
import sys
try:
import unittest2 as unittest
except ImportError:
import unittest
from pysmi.parser.smi import parserFactory
from pysmi.parser.dialect impor... | 27.055046 | 103 | 0.698881 |
import sys
try:
import unittest2 as unittest
except ImportError:
import unittest
from pysmi.parser.smi import parserFactory
from pysmi.parser.dialect import smiV1Relaxed
from pysmi.codegen.pysnmp import PySnmpCodeGen
from pysmi.codegen.symtable import SymtableCodeGen
from pysnmp.smi.builder import MibBu... | true | true |
1c25278a0e61f9d643f206e7df80fefbe8d1919d | 1,964 | py | Python | src/tinkoff/credit.py | vaibhavantil2/education-backend | ae36f6652d8b120f13d3859874d5051ddbef7092 | [
"MIT"
] | 151 | 2020-04-21T09:58:57.000Z | 2021-09-12T09:01:21.000Z | src/tinkoff/credit.py | vaibhavantil2/education-backend | ae36f6652d8b120f13d3859874d5051ddbef7092 | [
"MIT"
] | 163 | 2020-05-29T20:52:00.000Z | 2021-09-11T12:44:56.000Z | src/tinkoff/credit.py | boochamoocha/education-backend | c6ffb0c00bc066c8f1e0a8c0ffe4d0215c7c416a | [
"MIT"
] | 39 | 2020-04-21T12:28:16.000Z | 2021-09-12T15:33:47.000Z | import requests
from django.conf import settings
from app.banking import Bank
class TinkoffCreditRequestException(Exception):
pass
class TinkoffCredit(Bank):
def get_initial_payment_url(self) -> str:
result = self.call(
url=self.get_create_order_url(),
payload={
... | 28.882353 | 122 | 0.550916 | import requests
from django.conf import settings
from app.banking import Bank
class TinkoffCreditRequestException(Exception):
pass
class TinkoffCredit(Bank):
def get_initial_payment_url(self) -> str:
result = self.call(
url=self.get_create_order_url(),
payload={
... | true | true |
1c25288aa73f5f5426227115485c987c693844c3 | 3,234 | py | Python | test/find_exe.py | stormrust/wabtest | e7266f7576a70f4b50782a21dc3d0969ed7b0c26 | [
"Apache-2.0"
] | null | null | null | test/find_exe.py | stormrust/wabtest | e7266f7576a70f4b50782a21dc3d0969ed7b0c26 | [
"Apache-2.0"
] | null | null | null | test/find_exe.py | stormrust/wabtest | e7266f7576a70f4b50782a21dc3d0969ed7b0c26 | [
"Apache-2.0"
] | 2 | 2021-07-08T18:47:43.000Z | 2021-07-08T20:17:58.000Z | #!/usr/bin/env python3
#
# Copyright 2016 WebAssembly Community Group participants
#
# 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
#
# Unles... | 28.368421 | 83 | 0.719233 |
import os
import sys
from utils import Error
IS_WINDOWS = sys.platform == 'win32'
SCRIPT_DIR = '/mia/wabt/'
REPO_ROOT_DIR = os.path.dirname(SCRIPT_DIR)
EXECUTABLES = [
'wat2wasm', 'wast2json', 'wasm2wat', 'wasm-objdump', 'wasm-interp',
'wasm-opcodecnt', 'wat-desugar', 'spectest-interp', 'wasm... | true | true |
1c252bc0f69a4f8d215e33b77e6585d552527436 | 6,472 | py | Python | graph_objs/scattergeo/selected/_marker.py | wwwidonja/changed_plotly | 1bda35a438539a97c84a3ab3952e95e8848467bd | [
"MIT"
] | null | null | null | graph_objs/scattergeo/selected/_marker.py | wwwidonja/changed_plotly | 1bda35a438539a97c84a3ab3952e95e8848467bd | [
"MIT"
] | null | null | null | graph_objs/scattergeo/selected/_marker.py | wwwidonja/changed_plotly | 1bda35a438539a97c84a3ab3952e95e8848467bd | [
"MIT"
] | null | null | null | from plotly.basedatatypes import BaseTraceHierarchyType as _BaseTraceHierarchyType
import copy as _copy
class Marker(_BaseTraceHierarchyType):
# class properties
# --------------------
_parent_path_str = "scattergeo.selected"
_path_str = "scattergeo.selected.marker"
_valid_props = {"color", "opac... | 33.189744 | 82 | 0.54759 | from plotly.basedatatypes import BaseTraceHierarchyType as _BaseTraceHierarchyType
import copy as _copy
class Marker(_BaseTraceHierarchyType):
_parent_path_str = "scattergeo.selected"
_path_str = "scattergeo.selected.marker"
_valid_props = {"color", "opacity", "size"}
@property
... | true | true |
1c252bca69a0cf9f85e966558cc3c3e6b0110700 | 21,232 | py | Python | src/widgetastic/browser.py | RonnyPfannschmidt-RedHat/widgetastic.core | b24a8098846a9e64c0b9a6547184cd2e3c42e30d | [
"Apache-2.0"
] | null | null | null | src/widgetastic/browser.py | RonnyPfannschmidt-RedHat/widgetastic.core | b24a8098846a9e64c0b9a6547184cd2e3c42e30d | [
"Apache-2.0"
] | null | null | null | src/widgetastic/browser.py | RonnyPfannschmidt-RedHat/widgetastic.core | b24a8098846a9e64c0b9a6547184cd2e3c42e30d | [
"Apache-2.0"
] | null | null | null | # -*- coding: utf-8 -*-
from __future__ import unicode_literals
import six
import time
from cached_property import cached_property
from selenium.webdriver.common.action_chains import ActionChains
from selenium.webdriver.common.by import By
from selenium.webdriver.remote.file_detector import LocalFileDetector, Useless... | 39.391466 | 100 | 0.628203 |
from __future__ import unicode_literals
import six
import time
from cached_property import cached_property
from selenium.webdriver.common.action_chains import ActionChains
from selenium.webdriver.common.by import By
from selenium.webdriver.remote.file_detector import LocalFileDetector, UselessFileDetector
from selen... | true | true |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.