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 |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
1c1c4d260c41f14227ca0b9b6a4b892482ccb868 | 568 | py | Python | Preview/dump_db_shelve.py | Deteriorator/Programming-Python | 0c259093de011c0d5dadaba256a2bc9b2294e6c8 | [
"Apache-2.0"
] | null | null | null | Preview/dump_db_shelve.py | Deteriorator/Programming-Python | 0c259093de011c0d5dadaba256a2bc9b2294e6c8 | [
"Apache-2.0"
] | null | null | null | Preview/dump_db_shelve.py | Deteriorator/Programming-Python | 0c259093de011c0d5dadaba256a2bc9b2294e6c8 | [
"Apache-2.0"
] | null | null | null | #!/usr/bin/env python
# -*- coding: utf-8 -*-
"""
-------------------------------------------------------------------------------
@Name: dump_db_shelve.py
@Desc:
@Author: liangz.org@gmail.com
@Create: 2020.05.06 17:25
----------------------------------------------------------------------------... | 25.818182 | 79 | 0.325704 |
import shelve
db = shelve.open('people-shelve')
for key in db:
print(key, '=>\n ', db[key])
print(db['sue']['name'])
db.close()
| true | true |
1c1c4ea15ce3a10a7dcbab9407c1070268520490 | 335 | py | Python | test/utils.py | payala/pyjitter | 730c73762c4a505d47862f6a54290784b012533e | [
"MIT"
] | null | null | null | test/utils.py | payala/pyjitter | 730c73762c4a505d47862f6a54290784b012533e | [
"MIT"
] | null | null | null | test/utils.py | payala/pyjitter | 730c73762c4a505d47862f6a54290784b012533e | [
"MIT"
] | null | null | null | from pyjitter.signal import Signal
def create_basic_signal() -> Signal:
sig = Signal('basic')
sig.add_edge(10e-9, Signal.Level.HIGH, 2e-9)
sig.add_edge(20e-9, Signal.Level.LOW, 3e-9)
sig.add_edge(25e-9, Signal.Level.LOW, 2e-9) # This should not be added
sig.add_edge(30e-9, Signal.Level.Z, 2e-9)
... | 27.916667 | 75 | 0.680597 | from pyjitter.signal import Signal
def create_basic_signal() -> Signal:
sig = Signal('basic')
sig.add_edge(10e-9, Signal.Level.HIGH, 2e-9)
sig.add_edge(20e-9, Signal.Level.LOW, 3e-9)
sig.add_edge(25e-9, Signal.Level.LOW, 2e-9)
sig.add_edge(30e-9, Signal.Level.Z, 2e-9)
return sig | true | true |
1c1c4ec5696eec5bfef765c4476283c44865fe81 | 2,101 | py | Python | scripts/question_utils.py | Chad-Ballay/devops-interview-questions | 5f635bd710788b0dbe885e6993e90092cd637484 | [
"Apache-2.0"
] | 1 | 2021-12-12T07:12:47.000Z | 2021-12-12T07:12:47.000Z | scripts/question_utils.py | Chad-Ballay/devops-interview-questions | 5f635bd710788b0dbe885e6993e90092cd637484 | [
"Apache-2.0"
] | null | null | null | scripts/question_utils.py | Chad-Ballay/devops-interview-questions | 5f635bd710788b0dbe885e6993e90092cd637484 | [
"Apache-2.0"
] | null | null | null | """
Question utils functions
"""
import pathlib
from random import choice
from typing import List
p = pathlib.Path(__file__).parent.parent.joinpath('README.md')
def get_file_list():
with open(p, 'rb') as f:
file_list = [line.rstrip() for line in f.readlines()]
return file_list
def get_question_lis... | 22.351064 | 93 | 0.658734 |
import pathlib
from random import choice
from typing import List
p = pathlib.Path(__file__).parent.parent.joinpath('README.md')
def get_file_list():
with open(p, 'rb') as f:
file_list = [line.rstrip() for line in f.readlines()]
return file_list
def get_question_list(file_list: List[bytes]) -> list... | true | true |
1c1c4f7a34b3b93f956f3508afd49ae74418cb88 | 4,900 | py | Python | pypastry/experiment/evaluation.py | spacemonkey01/pypastry | b5c71d114af5740344aad7ba577c06fbf02a6046 | [
"MIT"
] | 1 | 2020-12-28T07:49:47.000Z | 2020-12-28T07:49:47.000Z | pypastry/experiment/evaluation.py | spacemonkey01/pypastry | b5c71d114af5740344aad7ba577c06fbf02a6046 | [
"MIT"
] | null | null | null | pypastry/experiment/evaluation.py | spacemonkey01/pypastry | b5c71d114af5740344aad7ba577c06fbf02a6046 | [
"MIT"
] | null | null | null | from datetime import datetime
from types import ModuleType
import numpy as np
import pandas as pd
from git import Repo
from joblib import Parallel, delayed
from pypastry.experiment import Experiment
from pypastry.experiment.hasher import get_dataset_hash
from pypastry.experiment.results import ResultsRepo
from scipy.s... | 35.507246 | 113 | 0.671837 | from datetime import datetime
from types import ModuleType
import numpy as np
import pandas as pd
from git import Repo
from joblib import Parallel, delayed
from pypastry.experiment import Experiment
from pypastry.experiment.hasher import get_dataset_hash
from pypastry.experiment.results import ResultsRepo
from scipy.s... | true | true |
1c1c5060e108af12277199894d1c6a2d987875a4 | 1,884 | py | Python | tensorflow/examples/tutorials/mnist/mnist_softmax.py | DeepThoughtTeam/tensorflow | 486a8950537c04fbd1c781b6e0bd0bf0999cc9a4 | [
"Apache-2.0"
] | null | null | null | tensorflow/examples/tutorials/mnist/mnist_softmax.py | DeepThoughtTeam/tensorflow | 486a8950537c04fbd1c781b6e0bd0bf0999cc9a4 | [
"Apache-2.0"
] | null | null | null | tensorflow/examples/tutorials/mnist/mnist_softmax.py | DeepThoughtTeam/tensorflow | 486a8950537c04fbd1c781b6e0bd0bf0999cc9a4 | [
"Apache-2.0"
] | 1 | 2016-01-31T18:58:02.000Z | 2016-01-31T18:58:02.000Z | # Copyright 2015 Google Inc. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or a... | 33.642857 | 80 | 0.725584 |
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
import input_data
import tensorflow as tf
mnist = input_data.read_data_sets("/tmp/data/", one_hot=True)
sess = tf.InteractiveSession()
x = tf.placeholder(tf.float32, [None, 784])
W = tf.Va... | true | true |
1c1c50d3a921ff3365163b02e69b22a83b88602b | 155 | py | Python | HW1/Numpy/Arrays.py | danial1371/ADM-HW1 | 30c8b7879b14d29dddf6e20192f7e0fea2466cf9 | [
"MIT"
] | null | null | null | HW1/Numpy/Arrays.py | danial1371/ADM-HW1 | 30c8b7879b14d29dddf6e20192f7e0fea2466cf9 | [
"MIT"
] | null | null | null | HW1/Numpy/Arrays.py | danial1371/ADM-HW1 | 30c8b7879b14d29dddf6e20192f7e0fea2466cf9 | [
"MIT"
] | null | null | null | import numpy
def arrays(arr):
arr.reverse()
return numpy.array(arr,float)
arr = input().strip().split(' ')
result = arrays(arr)
print(result) | 22.142857 | 34 | 0.651613 | import numpy
def arrays(arr):
arr.reverse()
return numpy.array(arr,float)
arr = input().strip().split(' ')
result = arrays(arr)
print(result) | true | true |
1c1c51b7f87a814d4b220d21ba3ff297f00131c4 | 6,317 | py | Python | Tests/test_SearchIO_legacy.py | SquidBio/biopython | 55430ff5233a82aaeeabfb782f45308d1c0a7ceb | [
"BSD-3-Clause"
] | 1 | 2020-01-21T02:04:08.000Z | 2020-01-21T02:04:08.000Z | Tests/test_SearchIO_legacy.py | SquidBio/biopython | 55430ff5233a82aaeeabfb782f45308d1c0a7ceb | [
"BSD-3-Clause"
] | null | null | null | Tests/test_SearchIO_legacy.py | SquidBio/biopython | 55430ff5233a82aaeeabfb782f45308d1c0a7ceb | [
"BSD-3-Clause"
] | null | null | null | # Copyright 1999 by Jeffrey Chang. All rights reserved.
# This code is part of the Biopython distribution and governed by its
# license. Please see the LICENSE file that should have been included
# as part of this package.
"""Tests for SearchIO legacy module."""
import string
import unittest
from io import String... | 35.094444 | 78 | 0.656166 |
import string
import unittest
from io import StringIO
import warnings
from Bio import BiopythonWarning
with warnings.catch_warnings():
warnings.simplefilter("ignore", BiopythonWarning)
from Bio.SearchIO._legacy import ParserSupport
class UndoHandleTests(unittest.TestCase):
def test_one(self):
... | true | true |
1c1c524babbea6b4e870b670481e9e6cb323e152 | 16,730 | py | Python | train.py | robgon-art/stylegan2-ada-pytorch | 51b24a249469b08e17ff2d6b2cd618d9cbf79e0f | [
"MIT"
] | 3 | 2021-12-07T15:47:04.000Z | 2022-02-19T15:54:53.000Z | train.py | robgon-art/stylegan2-ada-pytorch | 51b24a249469b08e17ff2d6b2cd618d9cbf79e0f | [
"MIT"
] | null | null | null | train.py | robgon-art/stylegan2-ada-pytorch | 51b24a249469b08e17ff2d6b2cd618d9cbf79e0f | [
"MIT"
] | null | null | null | # from https://github.com/rosinality/stylegan2-pytorch
import argparse
import math
import random
import os
import numpy as np
import torch
from torch import nn, autograd, optim
from torch.nn import functional as F
from torch.utils import data
import torch.distributed as dist
from torchvision import trans... | 30.810313 | 114 | 0.580873 |
import argparse
import math
import random
import os
import numpy as np
import torch
from torch import nn, autograd, optim
from torch.nn import functional as F
from torch.utils import data
import torch.distributed as dist
from torchvision import transforms, utils
from tqdm import tqdm
try:
import... | true | true |
1c1c52a7588e2ea6dd87f79e8b2490d868d08dbf | 21,778 | py | Python | app/systems/models/facade.py | zimagi/zima | d87b3f91e2fa669a77145413582d636d783a0c71 | [
"Apache-2.0"
] | null | null | null | app/systems/models/facade.py | zimagi/zima | d87b3f91e2fa669a77145413582d636d783a0c71 | [
"Apache-2.0"
] | null | null | null | app/systems/models/facade.py | zimagi/zima | d87b3f91e2fa669a77145413582d636d783a0c71 | [
"Apache-2.0"
] | null | null | null | from collections import OrderedDict
from functools import lru_cache
from django.conf import settings
from django.db.models import fields, Count, Avg, Min, Max, Sum
from django.db.models.fields import NOT_PROVIDED, Field
from django.db.models.fields.related import RelatedField, ForeignKey, OneToOneField, ManyToManyFiel... | 30.247222 | 117 | 0.546239 | from collections import OrderedDict
from functools import lru_cache
from django.conf import settings
from django.db.models import fields, Count, Avg, Min, Max, Sum
from django.db.models.fields import NOT_PROVIDED, Field
from django.db.models.fields.related import RelatedField, ForeignKey, OneToOneField, ManyToManyFiel... | true | true |
1c1c52fc7a39391cba43c7551e5841297274cc81 | 1,128 | py | Python | kibitzr/fetcher/factory.py | cescobarresi/kibitzr | 629f894d8d102657bc2c27edda2eb47ff51f1fa8 | [
"MIT"
] | null | null | null | kibitzr/fetcher/factory.py | cescobarresi/kibitzr | 629f894d8d102657bc2c27edda2eb47ff51f1fa8 | [
"MIT"
] | null | null | null | kibitzr/fetcher/factory.py | cescobarresi/kibitzr | 629f894d8d102657bc2c27edda2eb47ff51f1fa8 | [
"MIT"
] | null | null | null | """
Kibitzr supports a number of fetchers and the list can be extended by plugins.
In the nutshell each fetcher takes conf and returns a tuple: ok, content.
where ok is boolean meaning success, and content is a Unicode string with fetch result.
Each fetcher has a promoter.
Promoter knows if the fetcher is applicable ... | 29.684211 | 87 | 0.717199 |
from kibitzr.conf import ConfigurationError
from .loader import load_promoters
PROMOTERS = None
def fetcher_factory(conf):
global PROMOTERS
applicable = []
if not PROMOTERS:
PROMOTERS = load_promoters()
for promoter in PROMOTERS:
if promoter.is_applicable(conf):
applica... | true | true |
1c1c53b8f0f326c154374edeb224fc63f0e73a12 | 3,572 | py | Python | tests/functional/faster.py | Yelp/venv-update | 5fb5491bd421fdd8ef3cff3faa5d4846b5985ec8 | [
"MIT"
] | 165 | 2015-01-05T10:19:30.000Z | 2022-03-22T21:14:58.000Z | tests/functional/faster.py | Yelp/venv-update | 5fb5491bd421fdd8ef3cff3faa5d4846b5985ec8 | [
"MIT"
] | 148 | 2015-01-06T19:57:15.000Z | 2021-07-23T20:50:06.000Z | tests/functional/faster.py | Yelp/venv-update | 5fb5491bd421fdd8ef3cff3faa5d4846b5985ec8 | [
"MIT"
] | 30 | 2015-01-05T10:19:35.000Z | 2022-03-01T00:48:53.000Z | """attempt to show that pip-faster is... faster"""
from __future__ import absolute_import
from __future__ import print_function
from __future__ import unicode_literals
import contextlib
import sys
import pytest
from py._path.local import LocalPath as Path
from testing import enable_coverage
from testing import insta... | 30.271186 | 103 | 0.573628 | from __future__ import absolute_import
from __future__ import print_function
from __future__ import unicode_literals
import contextlib
import sys
import pytest
from py._path.local import LocalPath as Path
from testing import enable_coverage
from testing import install_coverage
from testing import pip_freeze
from tes... | true | true |
1c1c53c41f7d31bcdbd041873211faea6e87c63d | 1,138 | py | Python | var/spack/repos/builtin/packages/py-decorator/package.py | kkauder/spack | 6ae8d5c380c1f42094b05d38be26b03650aafb39 | [
"ECL-2.0",
"Apache-2.0",
"MIT-0",
"MIT"
] | 2 | 2019-02-10T13:47:48.000Z | 2019-04-17T13:05:17.000Z | var/spack/repos/builtin/packages/py-decorator/package.py | kkauder/spack | 6ae8d5c380c1f42094b05d38be26b03650aafb39 | [
"ECL-2.0",
"Apache-2.0",
"MIT-0",
"MIT"
] | 32 | 2020-12-15T17:29:20.000Z | 2022-03-21T15:08:31.000Z | var/spack/repos/builtin/packages/py-decorator/package.py | kkauder/spack | 6ae8d5c380c1f42094b05d38be26b03650aafb39 | [
"ECL-2.0",
"Apache-2.0",
"MIT-0",
"MIT"
] | 2 | 2021-07-19T20:31:27.000Z | 2021-07-19T21:14:14.000Z | # Copyright 2013-2021 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 PyDecorator(PythonPackage):
"""The aim of the decorator module it to simplify the usage of... | 45.52 | 95 | 0.766257 |
from spack import *
class PyDecorator(PythonPackage):
homepage = "https://github.com/micheles/decorator"
pypi = "decorator/decorator-4.4.2.tar.gz"
version('4.4.2', sha256='e3a62f0520172440ca0dcc823749319382e377f37f140a0b99ef45fecb84bfe7')
version('4.4.0', sha256='86156361c50488b84a3f148056ea716... | true | true |
1c1c56f9f385bd2858416f8b4e04715c961fc343 | 1,973 | py | Python | pomito/task.py | codito/pomito | aa936982737e5ffe8ff808197d0896ee6e5239a8 | [
"MIT"
] | 1 | 2019-09-10T16:06:50.000Z | 2019-09-10T16:06:50.000Z | pomito/task.py | codito/pomito | aa936982737e5ffe8ff808197d0896ee6e5239a8 | [
"MIT"
] | 3 | 2017-09-11T14:11:42.000Z | 2017-09-14T02:14:22.000Z | pomito/task.py | codito/pomito | aa936982737e5ffe8ff808197d0896ee6e5239a8 | [
"MIT"
] | null | null | null | # Pomito - Pomodoro timer on steroids
"""Task concept and routines."""
import hashlib
class Task(object):
"""A Task is an activity that the user is working on during a pomodoro session."""
def __init__(self, uid, estimate, actual, tags, description):
"""Create a Task.
Args:
desc... | 32.883333 | 107 | 0.577293 |
import hashlib
class Task(object):
def __init__(self, uid, estimate, actual, tags, description):
try:
self.uid = uid
self.description = description
self.estimate = int(estimate)
self.actual = int(actual)
self.tags = tags
self.compl... | true | true |
1c1c5708e2e31387f9bbf4a4fdf706959eed8cc8 | 441 | py | Python | scripts/utils/utypes/ufloat/fractional.py | Oleksii-Kshenskyi/purple_tools | 3c3a7fde0865e3458c5e885a5a5b68677a55cd1b | [
"0BSD"
] | null | null | null | scripts/utils/utypes/ufloat/fractional.py | Oleksii-Kshenskyi/purple_tools | 3c3a7fde0865e3458c5e885a5a5b68677a55cd1b | [
"0BSD"
] | 27 | 2019-10-06T20:14:48.000Z | 2020-03-31T20:42:16.000Z | scripts/utils/utypes/ufloat/fractional.py | Oleksii-Kshenskyi/purple_tools | 3c3a7fde0865e3458c5e885a5a5b68677a55cd1b | [
"0BSD"
] | null | null | null | from scripts.utils.time.checks import is_of_type
def get_fractional_part_as_string(the_float):
if not is_of_type(the_float, float):
return ""
string_float = str(the_float)
dot_position = string_float.find(".")
return "" if dot_position == -1 else string_float[dot_position + 1 : ]
def is_fractional_part_s... | 24.5 | 72 | 0.746032 | from scripts.utils.time.checks import is_of_type
def get_fractional_part_as_string(the_float):
if not is_of_type(the_float, float):
return ""
string_float = str(the_float)
dot_position = string_float.find(".")
return "" if dot_position == -1 else string_float[dot_position + 1 : ]
def is_fractional_part_s... | true | true |
1c1c574b78b09eb97c5ce30956777b0e5980f336 | 9,338 | py | Python | serial_scripts/alarm_config/test_alarm_config.py | atsgen/tf-test | 2748fcd81491450c75dadc71849d2a1c11061029 | [
"Apache-2.0"
] | 5 | 2020-09-29T00:36:57.000Z | 2022-02-16T06:51:32.000Z | serial_scripts/alarm_config/test_alarm_config.py | atsgen/tf-test | 2748fcd81491450c75dadc71849d2a1c11061029 | [
"Apache-2.0"
] | 27 | 2019-11-02T02:18:34.000Z | 2022-02-24T18:49:08.000Z | serial_scripts/alarm_config/test_alarm_config.py | atsgen/tf-test | 2748fcd81491450c75dadc71849d2a1c11061029 | [
"Apache-2.0"
] | 20 | 2019-11-28T16:02:25.000Z | 2022-01-06T05:56:58.000Z | from __future__ import absolute_import
from .base import BaseAlarmConfigTest
from alarm_test import *
from .verify import VerifyAlarms
from tcutils.wrappers import preposttest_wrapper
import test
class TestAlarmConfigCases(BaseAlarmConfigTest, VerifyAlarms):
@classmethod
def setUpClass(cls):
super(Tes... | 49.407407 | 108 | 0.656779 | from __future__ import absolute_import
from .base import BaseAlarmConfigTest
from alarm_test import *
from .verify import VerifyAlarms
from tcutils.wrappers import preposttest_wrapper
import test
class TestAlarmConfigCases(BaseAlarmConfigTest, VerifyAlarms):
@classmethod
def setUpClass(cls):
super(Tes... | true | true |
1c1c579a325e8969cf3107225fb0c5ad92c0964a | 4,707 | py | Python | algofi/v1/liquidate.py | Algofiorg/algofi-py-sdk | 6100a6726d36db4d4d3287064f0ad1d0b9a05e03 | [
"MIT"
] | 38 | 2021-12-30T02:32:57.000Z | 2022-03-23T22:09:16.000Z | algofi/v1/liquidate.py | Algofiorg/algofi-py-sdk | 6100a6726d36db4d4d3287064f0ad1d0b9a05e03 | [
"MIT"
] | 4 | 2021-11-03T00:14:46.000Z | 2022-03-28T02:17:33.000Z | algofi/v1/liquidate.py | Algofiorg/algofi-py-sdk | 6100a6726d36db4d4d3287064f0ad1d0b9a05e03 | [
"MIT"
] | 8 | 2021-12-15T05:29:55.000Z | 2022-02-08T03:45:11.000Z |
from algosdk.future.transaction import ApplicationNoOpTxn, PaymentTxn, AssetTransferTxn
from .prepend import get_init_txns
from ..utils import Transactions, TransactionGroup
from ..contract_strings import algofi_manager_strings as manager_strings
from copy import deepcopy
def prepare_liquidate_transactions(sender, s... | 47.545455 | 328 | 0.747822 |
from algosdk.future.transaction import ApplicationNoOpTxn, PaymentTxn, AssetTransferTxn
from .prepend import get_init_txns
from ..utils import Transactions, TransactionGroup
from ..contract_strings import algofi_manager_strings as manager_strings
from copy import deepcopy
def prepare_liquidate_transactions(sender, s... | true | true |
1c1c57bc81b55893b298a79df4b92ac19952e3de | 11,530 | py | Python | visualpriors/transforms.py | memmelma/visual-prior | 6b9c65f291c587fcbb3fcc3f61f76cdd1c3eb175 | [
"MIT"
] | 1 | 2022-01-13T17:08:51.000Z | 2022-01-13T17:08:51.000Z | visualpriors/transforms.py | memmelma/visual-prior | 6b9c65f291c587fcbb3fcc3f61f76cdd1c3eb175 | [
"MIT"
] | null | null | null | visualpriors/transforms.py | memmelma/visual-prior | 6b9c65f291c587fcbb3fcc3f61f76cdd1c3eb175 | [
"MIT"
] | null | null | null | from .taskonomy_network import TaskonomyEncoder, TaskonomyDecoder, TaskonomyNetwork, TASKONOMY_PRETRAINED_URLS, TASKS_TO_CHANNELS
import multiprocessing.dummy as mp
import torch
default_device = 'cuda' if torch.cuda.is_available() else 'cpu'
def representation_transform(img, feature_task='normal', device=default_devi... | 38.952703 | 130 | 0.627147 | from .taskonomy_network import TaskonomyEncoder, TaskonomyDecoder, TaskonomyNetwork, TASKONOMY_PRETRAINED_URLS, TASKS_TO_CHANNELS
import multiprocessing.dummy as mp
import torch
default_device = 'cuda' if torch.cuda.is_available() else 'cpu'
def representation_transform(img, feature_task='normal', device=default_devi... | true | true |
1c1c57c0aa500075769a66afdb000eed03f79f6e | 12,527 | py | Python | xclingo/preprocessor/_preprocessor.py | bramucas/xclingo2 | 07e69273fe6a45b4586018d3c7f250ac370f9882 | [
"MIT"
] | 1 | 2022-03-03T12:49:49.000Z | 2022-03-03T12:49:49.000Z | xclingo/preprocessor/_preprocessor.py | bramucas/xclingo2 | 07e69273fe6a45b4586018d3c7f250ac370f9882 | [
"MIT"
] | null | null | null | xclingo/preprocessor/_preprocessor.py | bramucas/xclingo2 | 07e69273fe6a45b4586018d3c7f250ac370f9882 | [
"MIT"
] | null | null | null | from clingo.symbol import Number
from ._utils import (
translate_show_all,
translate_trace,
translate_trace_all,
translate_mute,
is_xclingo_label,
is_xclingo_show_trace,
is_choice_rule,
is_label_rule,
is_xclingo_mute,
is_constraint,
is_disyunctive_head,
)
from clingo import a... | 34.797222 | 100 | 0.420133 | from clingo.symbol import Number
from ._utils import (
translate_show_all,
translate_trace,
translate_trace_all,
translate_mute,
is_xclingo_label,
is_xclingo_show_trace,
is_choice_rule,
is_label_rule,
is_xclingo_mute,
is_constraint,
is_disyunctive_head,
)
from clingo import a... | true | true |
1c1c5b954aa87c081e24bca55cfca27a1f2c4043 | 4,009 | py | Python | wagtail/contrib/simple_translation/wagtail_hooks.py | stevedya/wagtail | 52e5abfe62547cdfd90ea7dfeb8bf5a52f16324c | [
"BSD-3-Clause"
] | null | null | null | wagtail/contrib/simple_translation/wagtail_hooks.py | stevedya/wagtail | 52e5abfe62547cdfd90ea7dfeb8bf5a52f16324c | [
"BSD-3-Clause"
] | null | null | null | wagtail/contrib/simple_translation/wagtail_hooks.py | stevedya/wagtail | 52e5abfe62547cdfd90ea7dfeb8bf5a52f16324c | [
"BSD-3-Clause"
] | null | null | null | from typing import List
from django.conf import settings
from django.contrib.admin.utils import quote
from django.contrib.auth.models import Permission
from django.urls import include, path, reverse
from django.utils.translation import gettext as _
from wagtail import hooks
from wagtail.admin import widgets as wagtai... | 34.86087 | 111 | 0.656772 | from typing import List
from django.conf import settings
from django.contrib.admin.utils import quote
from django.contrib.auth.models import Permission
from django.urls import include, path, reverse
from django.utils.translation import gettext as _
from wagtail import hooks
from wagtail.admin import widgets as wagtai... | true | true |
1c1c5ba2ff45b43b5fd67850835dc8fdeabbc0de | 4,524 | py | Python | configs/restorers/basicvsr_plusplus/basicvsr_plusplus_c64n7_8x1_600k_reds4.py | Weepingchestnut/mmediting | c6fb8c0cf8234177e705ff0c31871431d02811a5 | [
"Apache-2.0"
] | 1 | 2021-09-02T04:11:19.000Z | 2021-09-02T04:11:19.000Z | configs/restorers/basicvsr_plusplus/basicvsr_plusplus_c64n7_8x1_600k_reds4.py | Weepingchestnut/mmediting | c6fb8c0cf8234177e705ff0c31871431d02811a5 | [
"Apache-2.0"
] | null | null | null | configs/restorers/basicvsr_plusplus/basicvsr_plusplus_c64n7_8x1_600k_reds4.py | Weepingchestnut/mmediting | c6fb8c0cf8234177e705ff0c31871431d02811a5 | [
"Apache-2.0"
] | null | null | null | exp_name = 'basicvsr_plusplus_c64n7_8x1_600k_reds4'
# model settings
model = dict(
type='BasicVSR',
generator=dict(
type='BasicVSRPlusPlus',
mid_channels=64,
num_blocks=7,
is_low_res_input=True,
spynet_pretrained='https://download.openmmlab.com/mmediting/restorers/'
... | 29.376623 | 79 | 0.630858 | exp_name = 'basicvsr_plusplus_c64n7_8x1_600k_reds4'
model = dict(
type='BasicVSR',
generator=dict(
type='BasicVSRPlusPlus',
mid_channels=64,
num_blocks=7,
is_low_res_input=True,
spynet_pretrained='https://download.openmmlab.com/mmediting/restorers/'
'basicvsr/sp... | true | true |
1c1c5c2e741f397d835ca19551beee044ca7b07f | 1,918 | py | Python | airflow/plugins/helpers/sql_queries.py | danjaq/sparkify-airflow-pipeline | 03f75589bff51c602f8a91df8b59b36049851692 | [
"MIT"
] | null | null | null | airflow/plugins/helpers/sql_queries.py | danjaq/sparkify-airflow-pipeline | 03f75589bff51c602f8a91df8b59b36049851692 | [
"MIT"
] | null | null | null | airflow/plugins/helpers/sql_queries.py | danjaq/sparkify-airflow-pipeline | 03f75589bff51c602f8a91df8b59b36049851692 | [
"MIT"
] | null | null | null | class SqlQueries:
songplay_table_insert = ("""
SELECT
md5(events.sessionid || events.start_time) songplay_id,
events.start_time,
events.userid,
events.level,
songs.song_id,
songs.artist_id,
e... | 27.797101 | 119 | 0.552659 | class SqlQueries:
songplay_table_insert = ("""
SELECT
md5(events.sessionid || events.start_time) songplay_id,
events.start_time,
events.userid,
events.level,
songs.song_id,
songs.artist_id,
e... | true | true |
1c1c5e1792fefc2746bde774e96ce3eab409542a | 555 | py | Python | src/python/turicreate/toolkits/object_detector/util/__init__.py | Bpowers4/turicreate | 73dad213cc1c4f74337b905baea2b3a1e5a0266c | [
"BSD-3-Clause"
] | 11,356 | 2017-12-08T19:42:32.000Z | 2022-03-31T16:55:25.000Z | src/python/turicreate/toolkits/object_detector/util/__init__.py | Bpowers4/turicreate | 73dad213cc1c4f74337b905baea2b3a1e5a0266c | [
"BSD-3-Clause"
] | 2,402 | 2017-12-08T22:31:01.000Z | 2022-03-28T19:25:52.000Z | src/python/turicreate/toolkits/object_detector/util/__init__.py | Bpowers4/turicreate | 73dad213cc1c4f74337b905baea2b3a1e5a0266c | [
"BSD-3-Clause"
] | 1,343 | 2017-12-08T19:47:19.000Z | 2022-03-26T11:31:36.000Z | # -*- coding: utf-8 -*-
# Copyright © 2017 Apple Inc. All rights reserved.
#
# Use of this source code is governed by a BSD-3-clause license that can
# be found in the LICENSE.txt file or at https://opensource.org/licenses/BSD-3-Clause
from __future__ import print_function as _
from __future__ import division as _
from... | 42.692308 | 85 | 0.796396 |
from __future__ import print_function as _
from __future__ import division as _
from __future__ import absolute_import as _
from ._output_formats import stack_annotations, unstack_annotations
from ._visualization import draw_bounding_boxes
__all__ = ["stack_annotations", "unstack_annotations", "draw_bounding_boxe... | true | true |
1c1c5e26a82985b7eb8550c291af385518f0f714 | 2,833 | py | Python | contrib/dash_app/chat_res.py | wakafengfan/CDial-GPT | e49d90a715755b428b46d2d1556f68245e6fffb3 | [
"MIT"
] | 906 | 2020-06-10T09:24:10.000Z | 2022-03-31T09:33:29.000Z | contrib/dash_app/chat_res.py | wakafengfan/CDial-GPT | e49d90a715755b428b46d2d1556f68245e6fffb3 | [
"MIT"
] | 84 | 2020-07-16T08:04:33.000Z | 2022-03-29T13:02:07.000Z | contrib/dash_app/chat_res.py | wakafengfan/CDial-GPT | e49d90a715755b428b46d2d1556f68245e6fffb3 | [
"MIT"
] | 181 | 2020-06-10T09:24:11.000Z | 2022-03-29T12:41:41.000Z | from interact import *
def eva_model():
parser = ArgumentParser()
parser.add_argument('--gpt2', action='store_true', help="use gpt2")
parser.add_argument("--model_checkpoint", type=str, default="./models/", help="Path, url or short name of the model")
parser.add_argument("--max_history", type=int, defa... | 42.283582 | 121 | 0.690787 | from interact import *
def eva_model():
parser = ArgumentParser()
parser.add_argument('--gpt2', action='store_true', help="use gpt2")
parser.add_argument("--model_checkpoint", type=str, default="./models/", help="Path, url or short name of the model")
parser.add_argument("--max_history", type=int, defa... | true | true |
1c1c5f2b684de8307c1fbfe6665517f40dce3625 | 4,083 | py | Python | src/oci/core/models/shape_max_vnic_attachment_options.py | LaudateCorpus1/oci-python-sdk | b0d3ce629d5113df4d8b83b7a6502b2c5bfa3015 | [
"Apache-2.0",
"BSD-3-Clause"
] | null | null | null | src/oci/core/models/shape_max_vnic_attachment_options.py | LaudateCorpus1/oci-python-sdk | b0d3ce629d5113df4d8b83b7a6502b2c5bfa3015 | [
"Apache-2.0",
"BSD-3-Clause"
] | null | null | null | src/oci/core/models/shape_max_vnic_attachment_options.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... | 30.244444 | 245 | 0.650747 |
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 ShapeMaxVnicAttachmentOptions(object):
def __init__(self, **kwargs):
self.swagger_types = {
'min': 'i... | true | true |
1c1c5f92c818655fb12e9567d378e576862b13e3 | 76 | py | Python | config.py | rkobler/interpret_lin_rts_mdls | 3ab103140930919dc5049dc30e26a67c66db371d | [
"BSD-3-Clause"
] | 1 | 2021-09-14T13:20:02.000Z | 2021-09-14T13:20:02.000Z | config.py | rkobler/interpret_lin_rts_mdls | 3ab103140930919dc5049dc30e26a67c66db371d | [
"BSD-3-Clause"
] | null | null | null | config.py | rkobler/interpret_lin_rts_mdls | 3ab103140930919dc5049dc30e26a67c66db371d | [
"BSD-3-Clause"
] | null | null | null | import os.path as op
path_outputs = op.join('./outputs') # path to outputs | 25.333333 | 54 | 0.710526 | import os.path as op
path_outputs = op.join('./outputs') | true | true |
1c1c60ab6740676f60d2e83d069d3e60c8193da6 | 867 | py | Python | 01_Language/01_Functions/python/hash_pbkdf2.py | cliff363825/TwentyFour | 09df59bd5d275e66463e343647f46027397d1233 | [
"MIT"
] | 3 | 2020-06-28T07:42:51.000Z | 2021-01-15T10:32:11.000Z | 01_Language/01_Functions/python/hash_pbkdf2.py | cliff363825/TwentyFour | 09df59bd5d275e66463e343647f46027397d1233 | [
"MIT"
] | 9 | 2021-03-10T22:45:40.000Z | 2022-02-27T06:53:20.000Z | 01_Language/01_Functions/python/hash_pbkdf2.py | cliff363825/TwentyFour | 09df59bd5d275e66463e343647f46027397d1233 | [
"MIT"
] | 1 | 2021-01-15T10:51:24.000Z | 2021-01-15T10:51:24.000Z | # coding: utf-8
import hashlib
def hash_pbkdf2(algo, password, salt, iterations, length=None):
return hashlib.pbkdf2_hmac(algo, password, salt, iterations, length)
if __name__ == '__main__':
password = b"password"
iterations = 1000
salt = b"abcdef"
def hexstr(data, lowercase=True):
if... | 27.09375 | 72 | 0.653979 |
import hashlib
def hash_pbkdf2(algo, password, salt, iterations, length=None):
return hashlib.pbkdf2_hmac(algo, password, salt, iterations, length)
if __name__ == '__main__':
password = b"password"
iterations = 1000
salt = b"abcdef"
def hexstr(data, lowercase=True):
if lowercase:
... | true | true |
1c1c60fda9b25ecdc6dd63d5dda7a629c1df6a76 | 10,528 | py | Python | docs/conf.py | CESNET/invenio-filestorage | bb113bea33828d099237e70df3b228eac4e8d6f8 | [
"MIT"
] | null | null | null | docs/conf.py | CESNET/invenio-filestorage | bb113bea33828d099237e70df3b228eac4e8d6f8 | [
"MIT"
] | 4 | 2019-06-16T12:26:16.000Z | 2021-06-25T15:21:59.000Z | docs/conf.py | CESNET/invenio-filestorage | bb113bea33828d099237e70df3b228eac4e8d6f8 | [
"MIT"
] | null | null | null | # -*- coding: utf-8 -*-
#
# Copyright (C) 2019 CESNET.
#
# Invenio Files Multi-Checksum Storage is free software; you can redistribute it and/or modify it
# under the terms of the MIT License; see LICENSE file for more details.
"""Sphinx configuration."""
from __future__ import print_function
import os
import sphin... | 32.294479 | 120 | 0.710296 |
from __future__ import print_function
import os
import sphinx.environment
suppress_warnings = ['image.nonlocal_uri']
extensions = [
'sphinx.ext.autodoc',
'sphinx.ext.coverage',
'sphinx.ext.doctest',
'sphinx.ext.intersphinx',
'sphinx.ext.viewcode',
]
templates_path = ['_templat... | true | true |
1c1c6156818a02f644b796a61c038869eef2f59b | 298 | py | Python | dedis_cluster/serializers/msgpack.py | feiwenchaoyes/dedis-cluster | 88ff3dc0446581207a16bc7038790c45354b3aad | [
"MIT"
] | 1 | 2021-11-17T03:37:43.000Z | 2021-11-17T03:37:43.000Z | dedis_cluster/serializers/msgpack.py | hifeiwenchao/dedis-cluster | 88ff3dc0446581207a16bc7038790c45354b3aad | [
"MIT"
] | 1 | 2019-12-02T06:50:51.000Z | 2019-12-02T06:52:00.000Z | dedis_cluster/serializers/msgpack.py | hifeiwenchao/dedis-cluster | 88ff3dc0446581207a16bc7038790c45354b3aad | [
"MIT"
] | null | null | null |
from __future__ import absolute_import, unicode_literals
import msgpack
from .base import BaseSerializer
class MSGPackSerializer(BaseSerializer):
def dumps(self, value):
return msgpack.dumps(value)
def loads(self, value):
return msgpack.loads(value, encoding="utf-8")
| 19.866667 | 56 | 0.738255 |
from __future__ import absolute_import, unicode_literals
import msgpack
from .base import BaseSerializer
class MSGPackSerializer(BaseSerializer):
def dumps(self, value):
return msgpack.dumps(value)
def loads(self, value):
return msgpack.loads(value, encoding="utf-8")
| true | true |
1c1c6160d051726eba403fd1223f5826038ed33b | 7,202 | py | Python | elasticfeeds/aggregators/yearmonth.py | qlands/elasticfeeds | a1c41a31d56b082cb57c52768ea290abb925d812 | [
"BSD-3-Clause"
] | 15 | 2018-12-18T00:36:55.000Z | 2021-08-30T02:30:00.000Z | elasticfeeds/aggregators/yearmonth.py | qlands/elasticfeeds | a1c41a31d56b082cb57c52768ea290abb925d812 | [
"BSD-3-Clause"
] | null | null | null | elasticfeeds/aggregators/yearmonth.py | qlands/elasticfeeds | a1c41a31d56b082cb57c52768ea290abb925d812 | [
"BSD-3-Clause"
] | 3 | 2019-10-18T14:21:30.000Z | 2021-05-22T18:31:39.000Z | from .base import BaseAggregator
from ..exceptions import ElasticFeedException
class YearMonthAggregator(BaseAggregator):
"""
This aggregator returns activity feeds grouped by the same year, month and type (verb).
"""
def __init__(self, actor_id, year=None):
"""
We overwrite the const... | 39.355191 | 115 | 0.381422 | from .base import BaseAggregator
from ..exceptions import ElasticFeedException
class YearMonthAggregator(BaseAggregator):
def __init__(self, actor_id, year=None):
BaseAggregator.__init__(self, actor_id)
if year is not None:
if not isinstance(year, int):
raise Elastic... | true | true |
1c1c61b3b667a64f70e7f2dca960b4767be0ea24 | 665 | py | Python | engine/screen.py | dbrizov/PyTetris | f783526a37944452607d86c5def28dbaf3cd4481 | [
"MIT"
] | 3 | 2018-07-19T11:59:02.000Z | 2021-12-19T15:05:02.000Z | engine/screen.py | dbrizov/PyTetris | f783526a37944452607d86c5def28dbaf3cd4481 | [
"MIT"
] | null | null | null | engine/screen.py | dbrizov/PyTetris | f783526a37944452607d86c5def28dbaf3cd4481 | [
"MIT"
] | null | null | null | import pygame.display
from engine.vector import Vector2
class Screen:
_surface = None
@staticmethod
def init(width, height, flags=0, depth=0):
Screen._surface = pygame.display.set_mode((width, height), flags, depth)
@staticmethod
def repaint():
pygame.display.flip()
@staticm... | 21.451613 | 81 | 0.663158 | import pygame.display
from engine.vector import Vector2
class Screen:
_surface = None
@staticmethod
def init(width, height, flags=0, depth=0):
Screen._surface = pygame.display.set_mode((width, height), flags, depth)
@staticmethod
def repaint():
pygame.display.flip()
@staticm... | true | true |
1c1c62735572f4b8ed1b75199de869a527897c3c | 1,829 | py | Python | src/generate_supervisor_conf.py | 510908220/django-backend-template | 77c6a789e86654885616334b4a3590934026b07e | [
"MIT"
] | 1 | 2017-01-22T09:24:20.000Z | 2017-01-22T09:24:20.000Z | src/generate_supervisor_conf.py | 510908220/django-backend-template | 77c6a789e86654885616334b4a3590934026b07e | [
"MIT"
] | null | null | null | src/generate_supervisor_conf.py | 510908220/django-backend-template | 77c6a789e86654885616334b4a3590934026b07e | [
"MIT"
] | null | null | null | # -*- coding: utf-8 -*-
"""
生成supervisor配置文件
"""
import os
import subprocess
import sys
from optparse import OptionParser
ROOT_DIR = os.path.dirname(os.path.abspath(__file__))
COMMAND_BLACK_LIST = ['__init__']
COMMAND_TEMPLATE = """
[program:{program}]
command={python} {project_dir}/manage.py {command}
directory=/
a... | 26.507246 | 82 | 0.665938 |
import os
import subprocess
import sys
from optparse import OptionParser
ROOT_DIR = os.path.dirname(os.path.abspath(__file__))
COMMAND_BLACK_LIST = ['__init__']
COMMAND_TEMPLATE = """
[program:{program}]
command={python} {project_dir}/manage.py {command}
directory=/
autostart=true
autorestart=true
stopasgroup=true
... | true | true |
1c1c627e30f450067ad6f80dd64e804f5f6b458d | 1,224 | py | Python | pthread_download/single.py | aibittek/PythonSpider | 64b2d6f8fe016d79a990ee735754b811cf285df0 | [
"MIT"
] | null | null | null | pthread_download/single.py | aibittek/PythonSpider | 64b2d6f8fe016d79a990ee735754b811cf285df0 | [
"MIT"
] | null | null | null | pthread_download/single.py | aibittek/PythonSpider | 64b2d6f8fe016d79a990ee735754b811cf285df0 | [
"MIT"
] | null | null | null | import time
import requests
import urllib.request
from bs4 import BeautifulSoup
# 该函数用于下载图片
# 传入函数: 网页的网址url
def download_picture(url):
# 获取网页的源代码
r = requests.get(url)
# 利用BeautifulSoup将获取到的文本解析成HTML
soup = BeautifulSoup(r.text, "lxml")
# 获取网页中的电影图片
content = soup.find('div', cl... | 26.042553 | 89 | 0.629085 | import time
import requests
import urllib.request
from bs4 import BeautifulSoup
def download_picture(url):
r = requests.get(url)
soup = BeautifulSoup(r.text, "lxml")
content = soup.find('div', class_='article')
if content is None:
print('content is null')
r... | true | true |
1c1c62a3696f08b34327a091f55168dc2ab790f3 | 24,362 | py | Python | autocnet/utils/utils.py | readthedocs-assistant/autocnet | 579cccd0edc4cd870b5d9671165ebd830f1112b8 | [
"CC0-1.0"
] | 17 | 2016-11-21T17:07:18.000Z | 2022-01-16T06:14:04.000Z | autocnet/utils/utils.py | readthedocs-assistant/autocnet | 579cccd0edc4cd870b5d9671165ebd830f1112b8 | [
"CC0-1.0"
] | 504 | 2015-12-17T18:46:11.000Z | 2021-12-17T19:19:49.000Z | autocnet/utils/utils.py | readthedocs-assistant/autocnet | 579cccd0edc4cd870b5d9671165ebd830f1112b8 | [
"CC0-1.0"
] | 42 | 2015-12-09T15:30:15.000Z | 2022-02-24T04:47:46.000Z | import importlib
import itertools
import json
from functools import reduce, singledispatch, update_wrapper
import numpy as np
import pandas as pd
import networkx as nx
from osgeo import ogr
from sklearn.cluster import DBSCAN
from sklearn.neighbors import NearestNeighbors
from sklearn.neighbors import KDTree
from s... | 27.098999 | 114 | 0.580453 | import importlib
import itertools
import json
from functools import reduce, singledispatch, update_wrapper
import numpy as np
import pandas as pd
import networkx as nx
from osgeo import ogr
from sklearn.cluster import DBSCAN
from sklearn.neighbors import NearestNeighbors
from sklearn.neighbors import KDTree
from s... | true | true |
1c1c62eb8268fe36dd6c26313595007b2c593c70 | 418 | py | Python | tests/ci_env.py | paddycarey/ims | 7f2fa762d9bcd127b8a5d2e785966b62fca428e1 | [
"MIT"
] | 3 | 2015-03-27T09:20:18.000Z | 2015-12-09T00:50:26.000Z | tests/ci_env.py | paddycarey/ims | 7f2fa762d9bcd127b8a5d2e785966b62fca428e1 | [
"MIT"
] | 4 | 2015-03-30T13:06:41.000Z | 2017-09-16T23:48:44.000Z | tests/ci_env.py | paddycarey/ims | 7f2fa762d9bcd127b8a5d2e785966b62fca428e1 | [
"MIT"
] | null | null | null | #!/usr/bin/env python
import base64
import os
def decode_env_var():
v = os.environ.get("GCS_DATA", None)
return base64.urlsafe_b64decode(v)
def write_file(path, data):
with open(path, "w") as f:
f.write(data)
if __name__ == "__main__":
print "Writing .env file"
data = decode_env_var()... | 19 | 69 | 0.65311 |
import base64
import os
def decode_env_var():
v = os.environ.get("GCS_DATA", None)
return base64.urlsafe_b64decode(v)
def write_file(path, data):
with open(path, "w") as f:
f.write(data)
if __name__ == "__main__":
print "Writing .env file"
data = decode_env_var()
path = os.path.j... | false | true |
1c1c639bff85db8799be55ba5a1883d4c3fc78fc | 1,608 | py | Python | src/all_user_tweets.py | Forcoa-NET/TweetDataAnalysis | 74eada421a895fa622c5d960f19f8f22aa3cf2d3 | [
"MIT"
] | null | null | null | src/all_user_tweets.py | Forcoa-NET/TweetDataAnalysis | 74eada421a895fa622c5d960f19f8f22aa3cf2d3 | [
"MIT"
] | null | null | null | src/all_user_tweets.py | Forcoa-NET/TweetDataAnalysis | 74eada421a895fa622c5d960f19f8f22aa3cf2d3 | [
"MIT"
] | null | null | null | import tweepy
import sys
import codecs
import datetime
import time
import tauth
def parseTweet( tweet ):
url = "https://t.co/"
text = tweet.full_text
date = tweet.created_at
if ( text.rfind(url) > -1 ) :
parsedText = text[:text.rfind(url)]
parsedText = parsedText.replace("\n", "")
... | 30.339623 | 168 | 0.616915 | import tweepy
import sys
import codecs
import datetime
import time
import tauth
def parseTweet( tweet ):
url = "https://t.co/"
text = tweet.full_text
date = tweet.created_at
if ( text.rfind(url) > -1 ) :
parsedText = text[:text.rfind(url)]
parsedText = parsedText.replace("\n", "")
... | true | true |
1c1c6432b3fc656077301627fcb2bcf5b3b8968a | 6,581 | py | Python | rethinkdb/errors.py | MichalMazurek/rethinkdb-python | 28a21960ad5a303e4690c6b3fb3da5b8d6c547ca | [
"Apache-2.0"
] | 1 | 2020-08-01T23:15:00.000Z | 2020-08-01T23:15:00.000Z | rethinkdb/errors.py | MichalMazurek/rethinkdb-python | 28a21960ad5a303e4690c6b3fb3da5b8d6c547ca | [
"Apache-2.0"
] | null | null | null | rethinkdb/errors.py | MichalMazurek/rethinkdb-python | 28a21960ad5a303e4690c6b3fb3da5b8d6c547ca | [
"Apache-2.0"
] | null | null | null | # Copyright 2018 RethinkDB
#
# 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, so... | 26.011858 | 78 | 0.65993 |
__all__ = [
"ReqlAuthError",
"ReqlAvailabilityError",
"ReqlCompileError",
"ReqlCursorEmpty",
"ReqlDriverCompileError",
"ReqlDriverError",
"ReqlError",
"ReqlInternalError",
"ReqlNonExistenceError",
"ReqlOpFailedError",
"ReqlOpIndeterminateError",
"ReqlPer... | true | true |
1c1c6569d42fa09af05e1444271dfdbe477511ec | 64 | py | Python | katas/kyu_7/monotone_travel.py | the-zebulan/CodeWars | 1eafd1247d60955a5dfb63e4882e8ce86019f43a | [
"MIT"
] | 40 | 2016-03-09T12:26:20.000Z | 2022-03-23T08:44:51.000Z | katas/kyu_7/monotone_travel.py | akalynych/CodeWars | 1eafd1247d60955a5dfb63e4882e8ce86019f43a | [
"MIT"
] | null | null | null | katas/kyu_7/monotone_travel.py | akalynych/CodeWars | 1eafd1247d60955a5dfb63e4882e8ce86019f43a | [
"MIT"
] | 36 | 2016-11-07T19:59:58.000Z | 2022-03-31T11:18:27.000Z | def is_monotone(heights):
return sorted(heights) == heights
| 21.333333 | 37 | 0.734375 | def is_monotone(heights):
return sorted(heights) == heights
| true | true |
1c1c65b7744c8192969a0098f15de1d0687f3b9c | 12,597 | py | Python | deeppavlov/dataset_iterators/ranking_iterator.py | amithfernando/DeepPavlov | d643000f0a5bb4c220a28899d727e12e195000e0 | [
"Apache-2.0"
] | 1 | 2018-09-28T05:49:43.000Z | 2018-09-28T05:49:43.000Z | deeppavlov/dataset_iterators/ranking_iterator.py | amithfernando/DeepPavlov | d643000f0a5bb4c220a28899d727e12e195000e0 | [
"Apache-2.0"
] | null | null | null | deeppavlov/dataset_iterators/ranking_iterator.py | amithfernando/DeepPavlov | d643000f0a5bb4c220a28899d727e12e195000e0 | [
"Apache-2.0"
] | null | null | null | from deeppavlov.core.common.registry import register
from deeppavlov.core.data.data_learning_iterator import DataLearningIterator
import numpy as np
import random
from typing import Dict, List, Tuple
@register('ranking_iterator')
class RankingIterator(DataLearningIterator):
"""The class contains methods for iter... | 51.839506 | 119 | 0.620465 | from deeppavlov.core.common.registry import register
from deeppavlov.core.data.data_learning_iterator import DataLearningIterator
import numpy as np
import random
from typing import Dict, List, Tuple
@register('ranking_iterator')
class RankingIterator(DataLearningIterator):
def __init__(self,
d... | true | true |
1c1c66b97f8fd5da93a722746934603e0d19022f | 4,940 | py | Python | mayan/apps/events/urls.py | atitaya1412/Mayan-EDMS | bda9302ba4b743e7d829ad118b8b836221888172 | [
"Apache-2.0"
] | 336 | 2019-05-09T07:05:19.000Z | 2022-03-25T09:50:22.000Z | mayan/apps/events/urls.py | atitaya1412/Mayan-EDMS | bda9302ba4b743e7d829ad118b8b836221888172 | [
"Apache-2.0"
] | 9 | 2019-10-29T00:12:27.000Z | 2021-09-09T15:16:51.000Z | mayan/apps/events/urls.py | atitaya1412/Mayan-EDMS | bda9302ba4b743e7d829ad118b8b836221888172 | [
"Apache-2.0"
] | 257 | 2019-05-14T10:26:37.000Z | 2022-03-30T03:37:36.000Z | from django.conf.urls import url
from .api_views import (
APIEventListView, APIEventTypeListView, APIEventTypeNamespaceDetailView,
APIEventTypeNamespaceEventTypeListView, APIEventTypeNamespaceListView,
APINotificationListView, APIObjectEventListView
)
from .views.clear_views import (
EventListClearView... | 32.933333 | 110 | 0.669231 | from django.conf.urls import url
from .api_views import (
APIEventListView, APIEventTypeListView, APIEventTypeNamespaceDetailView,
APIEventTypeNamespaceEventTypeListView, APIEventTypeNamespaceListView,
APINotificationListView, APIObjectEventListView
)
from .views.clear_views import (
EventListClearView... | true | true |
1c1c66c5050b7f7c99d29a163a3b2ead2b1ffdd8 | 8,273 | py | Python | app/sims/menubar.py | DeepanshS/mrsimulator-ui | 42f1a85f1cb76896cde2a3c8d4e38fe2c989b710 | [
"BSD-3-Clause"
] | 2 | 2019-11-21T16:14:13.000Z | 2020-10-17T21:36:00.000Z | app/sims/menubar.py | DeepanshS/mrsimulator-ui | 42f1a85f1cb76896cde2a3c8d4e38fe2c989b710 | [
"BSD-3-Clause"
] | 32 | 2021-07-07T20:16:29.000Z | 2022-03-29T14:09:23.000Z | app/sims/menubar.py | DeepanshS/mrsimulator-ui | 42f1a85f1cb76896cde2a3c8d4e38fe2c989b710 | [
"BSD-3-Clause"
] | 2 | 2019-10-23T18:23:57.000Z | 2021-03-25T00:13:10.000Z | # -*- coding: utf-8 -*-
import dash_bootstrap_components as dbc
import dash_core_components as dcc
import dash_html_components as html
from dash.dependencies import Input
from dash.dependencies import Output
from dash.dependencies import State
from .modal.about import about_modals
from app import app
from app import y... | 32.065891 | 88 | 0.582376 |
import dash_bootstrap_components as dbc
import dash_core_components as dcc
import dash_html_components as html
from dash.dependencies import Input
from dash.dependencies import Output
from dash.dependencies import State
from .modal.about import about_modals
from app import app
from app import year
className = "d-fl... | true | true |
1c1c68514881ac2cb07bfd4e4770bb377aa53659 | 3,426 | py | Python | PythonAPI/my_workplace/repository/class.py | joao-paulo-alves/carla_vts | 92542ad69a9119734af7b97cf0dc4d887ecf354b | [
"MIT"
] | null | null | null | PythonAPI/my_workplace/repository/class.py | joao-paulo-alves/carla_vts | 92542ad69a9119734af7b97cf0dc4d887ecf354b | [
"MIT"
] | null | null | null | PythonAPI/my_workplace/repository/class.py | joao-paulo-alves/carla_vts | 92542ad69a9119734af7b97cf0dc4d887ecf354b | [
"MIT"
] | null | null | null | import carla
from carla import *
import numpy
import pygame
import argparse
import random
class Data(object):
class Pawn:
daf = 0
class Vehicle:
daf = 0
class Building:
daf = 0
def main():
vehicles_list = []
walkers_list = []
all_id = []
# SETTING CLIENT
cl... | 33.920792 | 121 | 0.598949 | import carla
from carla import *
import numpy
import pygame
import argparse
import random
class Data(object):
class Pawn:
daf = 0
class Vehicle:
daf = 0
class Building:
daf = 0
def main():
vehicles_list = []
walkers_list = []
all_id = []
client = carla.Cli... | true | true |
1c1c6998042654c23ebebaff4a77f9c8052427eb | 9,033 | py | Python | code/utils/util.py | Maclory/Deep-Iterative-Collaboration | 3ff19f1e4232e11b33fcd4c035aadaadf9d445f0 | [
"MIT"
] | 276 | 2020-03-16T05:23:24.000Z | 2022-03-31T02:44:10.000Z | code/utils/util.py | Maclory/Deep-Iterative-Collaboration | 3ff19f1e4232e11b33fcd4c035aadaadf9d445f0 | [
"MIT"
] | 47 | 2020-04-20T15:59:12.000Z | 2022-03-30T03:33:52.000Z | code/utils/util.py | Maclory/Deep-Iterative-Collaboration | 3ff19f1e4232e11b33fcd4c035aadaadf9d445f0 | [
"MIT"
] | 64 | 2020-04-03T12:34:33.000Z | 2021-12-20T15:45:58.000Z | import os
import math
from datetime import datetime
import numpy as np
from PIL import Image
import cv2
import matplotlib.pyplot as plt
####################
# miscellaneous
####################
def get_timestamp():
return datetime.now().strftime('%y%m%d-%H%M%S')
def mkdir(path):
if not os.path.exists(path)... | 30.516892 | 97 | 0.588177 | import os
import math
from datetime import datetime
import numpy as np
from PIL import Image
import cv2
import matplotlib.pyplot as plt
ived_' + get_timestamp()
print('Path already exists. Rename it to [{:s}]'.format(new_name))
choice = input('Are you sure? y/[n]')
if choice is not 'y':
... | false | true |
1c1c6ad982758665eff345ac5f14e8a47d7b119d | 2,183 | py | Python | test_pandas/test_pd_map.py | MinpLemon/studyPython | 39ab3b49ccc2fb122827de0b1fab89a53888e6b5 | [
"MIT"
] | null | null | null | test_pandas/test_pd_map.py | MinpLemon/studyPython | 39ab3b49ccc2fb122827de0b1fab89a53888e6b5 | [
"MIT"
] | 1 | 2021-12-13T20:00:00.000Z | 2021-12-13T20:00:00.000Z | test_pandas/test_pd_map.py | MinpLemon/studyPython | 39ab3b49ccc2fb122827de0b1fab89a53888e6b5 | [
"MIT"
] | null | null | null | #!/usr/bin/env python
# -*- coding: utf-8 -*-
# @Time : 2019-05-24 10:34
# @Author : minp
# @contact : king101125s@gmail.com
# @Site :
# @File : test_pd_map.py
# @Software: PyCharm
import unittest
import pandas as pd
import numpy as np
"""
通过df.(tab)键,发现df的属性列表中有apply() 和 applymap(),但没有map().
map()是python 自... | 28.350649 | 84 | 0.51443 |
import unittest
import pandas as pd
import numpy as np
class Test(unittest.TestCase):
def set_data(self):
self.toward_dict = {1: '东', 2: '南', 3: '西', 4: '北'}
self.df = pd.DataFrame({
'house': list('AACDEFG'),
'price': [100, 90, '', 50, 120, 150, 200],
... | true | true |
1c1c6afa452582e583940a6dc33bb9deb6151584 | 7,863 | py | Python | shape.py | workingenius/shape | 5e1adece365adc602f53ae09403b3410ac7273de | [
"Apache-2.0"
] | 1 | 2021-08-05T02:28:43.000Z | 2021-08-05T02:28:43.000Z | shape.py | workingenius/shape | 5e1adece365adc602f53ae09403b3410ac7273de | [
"Apache-2.0"
] | null | null | null | shape.py | workingenius/shape | 5e1adece365adc602f53ae09403b3410ac7273de | [
"Apache-2.0"
] | null | null | null | # -*- coding:utf8 -*-
from __future__ import print_function, unicode_literals
try:
# noinspection PyUnresolvedReferences
from typing import List, Dict, Hashable
except ImportError:
pass
NO_KEY = object()
class Summary(object):
"""
Describes if verification passes.
And if not, collect where ... | 26.036424 | 101 | 0.593158 |
from __future__ import print_function, unicode_literals
try:
from typing import List, Dict, Hashable
except ImportError:
pass
NO_KEY = object()
class Summary(object):
def __init__(self, success, path=None, error=''):
if not path:
path = []
self.success = bool(success... | true | true |
1c1c6c3f34f1481d731abfd53581fc825f8bfc80 | 21,718 | py | Python | neutron/tests/base.py | tankertyp/openstack-learning | d729672663f170d0138ecf23b3c23df225c1b1b8 | [
"Apache-2.0"
] | null | null | null | neutron/tests/base.py | tankertyp/openstack-learning | d729672663f170d0138ecf23b3c23df225c1b1b8 | [
"Apache-2.0"
] | null | null | null | neutron/tests/base.py | tankertyp/openstack-learning | d729672663f170d0138ecf23b3c23df225c1b1b8 | [
"Apache-2.0"
] | null | null | null | # Copyright 2010-2011 OpenStack Foundation
# All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance with the License. You may obtain
# a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by ap... | 36.623946 | 79 | 0.641173 |
import abc
import contextlib
import functools
import inspect
import logging
import os
import os.path
import queue
import threading
from unittest import mock
import eventlet.timeout
import fixtures
from neutron_lib.callbacks import manager as registry_manager
from neutron_lib.db import api as db_api
fro... | true | true |
1c1c6d0d632054bcfb3a3ce79c4286dcf11a6d9c | 4,714 | py | Python | hotword.py | Mem-Tech/meme-voice-assistant | 9ec4c6bcd7decb5593095fa53646bc8ff2810ce7 | [
"MIT"
] | 1 | 2021-03-05T21:36:14.000Z | 2021-03-05T21:36:14.000Z | hotword.py | Mem-Tech/meme-voice-assistant | 9ec4c6bcd7decb5593095fa53646bc8ff2810ce7 | [
"MIT"
] | 2 | 2021-04-30T22:09:03.000Z | 2021-04-30T22:11:19.000Z | hotword.py | Mem-Tech/meme-voice-assistant | 9ec4c6bcd7decb5593095fa53646bc8ff2810ce7 | [
"MIT"
] | null | null | null | import os
import struct
import sys
from datetime import datetime
from time import sleep
import numpy as np
import pyaudio
from porcupine import Porcupine
from Classes.MemePost import PostWithValidPhotos
from util import *
import speech_recognition as sr
from settings import VK_TOKEN, VK_USER_ID, VK_PUBLIC_IDS, VK_CHA... | 30.61039 | 112 | 0.602036 | import os
import struct
import sys
from datetime import datetime
from time import sleep
import numpy as np
import pyaudio
from porcupine import Porcupine
from Classes.MemePost import PostWithValidPhotos
from util import *
import speech_recognition as sr
from settings import VK_TOKEN, VK_USER_ID, VK_PUBLIC_IDS, VK_CHA... | true | true |
1c1c6e9338e5bc7f389c1bffb9b56c49d987f05c | 1,313 | py | Python | web/project_data/migrations/0001_initial.py | dambergn-codefellows/kickstarter_projects | 24ea88a1c4965df130c01031f837afff6b7daf6e | [
"MIT"
] | 1 | 2018-09-24T22:08:50.000Z | 2018-09-24T22:08:50.000Z | web/project_data/migrations/0001_initial.py | dambergn-codefellows/kickstarter_projects | 24ea88a1c4965df130c01031f837afff6b7daf6e | [
"MIT"
] | 1 | 2018-09-26T07:39:25.000Z | 2018-09-26T07:39:25.000Z | web/project_data/migrations/0001_initial.py | dambergn-codefellows/kickstarter_projects | 24ea88a1c4965df130c01031f837afff6b7daf6e | [
"MIT"
] | 1 | 2019-10-03T07:44:12.000Z | 2019-10-03T07:44:12.000Z | # Generated by Django 2.1.1 on 2018-09-26 22:55
from django.db import migrations, models
class Migration(migrations.Migration):
initial = True
dependencies = [
]
operations = [
migrations.CreateModel(
name='Project',
fields=[
('id', models.AutoField(... | 36.472222 | 114 | 0.549124 |
from django.db import migrations, models
class Migration(migrations.Migration):
initial = True
dependencies = [
]
operations = [
migrations.CreateModel(
name='Project',
fields=[
('id', models.AutoField(auto_created=True, primary_key=True, serialize=... | true | true |
1c1c6ed496275b946885479923284e5f8fff5d8c | 8,712 | py | Python | Autoencoders/AutoencoderPhasedTraining.py | gtuzi/TensorFlowPlayground | 293457e8e8a5e802aa0f28da3034d17492171f4c | [
"BSD-3-Clause"
] | null | null | null | Autoencoders/AutoencoderPhasedTraining.py | gtuzi/TensorFlowPlayground | 293457e8e8a5e802aa0f28da3034d17492171f4c | [
"BSD-3-Clause"
] | null | null | null | Autoencoders/AutoencoderPhasedTraining.py | gtuzi/TensorFlowPlayground | 293457e8e8a5e802aa0f28da3034d17492171f4c | [
"BSD-3-Clause"
] | null | null | null | '''
Train Autoencoder networks one at a time. Then combine the final
network into one. Each of these steps are phases.
To achieve this, use a different TensorFlow graph for each phase.
At each phase, you build the outer layers, as you progress inwards.
Training data for the next phase becomes the training output
from t... | 36.3 | 117 | 0.67011 |
import tensorflow as tf
import numpy as np
reg_loss], feed_dict={X: mnist.train.images})
loss_val = sess.run(reconstruction_loss, feed_dict={X: mnist.validation.images})
print('Train: Reconstruction MSE = {0:.4f}, Regularization: {1:.4f}'.format(loss_train, reg_loss_train))
print(... | true | true |
1c1c70e91292e7e1a5c1fe8bff1a93eea11f62f7 | 1,476 | py | Python | 27_DragDropWidget.py | Rming/pyqt-examples | c9b81607785da0028e7afe8ace9357ec1c6ffdb9 | [
"MIT"
] | null | null | null | 27_DragDropWidget.py | Rming/pyqt-examples | c9b81607785da0028e7afe8ace9357ec1c6ffdb9 | [
"MIT"
] | null | null | null | 27_DragDropWidget.py | Rming/pyqt-examples | c9b81607785da0028e7afe8ace9357ec1c6ffdb9 | [
"MIT"
] | null | null | null | #!/usr/local/bin/python3
# -*- coding: utf-8 -*-
import sys
from PyQt5.QtWidgets import QWidget, QApplication, QPushButton
from PyQt5.QtGui import QDrag
from PyQt5.QtCore import Qt, QMimeData
class Button(QPushButton):
def __init__(self, title, parent):
super().__init__(title, parent)
self.setA... | 22.363636 | 62 | 0.595528 |
import sys
from PyQt5.QtWidgets import QWidget, QApplication, QPushButton
from PyQt5.QtGui import QDrag
from PyQt5.QtCore import Qt, QMimeData
class Button(QPushButton):
def __init__(self, title, parent):
super().__init__(title, parent)
self.setAcceptDrops(True)
def mouseMoveEvent(self, ... | true | true |
1c1c71aced5ace3fd54226240faf78f261306a15 | 4,211 | py | Python | src/celeba.py | EleMisi/ConditionalVAE | f5e6a13f13b6539a71d8aced830fcda8f5171090 | [
"Apache-2.0"
] | 16 | 2020-03-29T20:57:07.000Z | 2022-03-07T20:13:14.000Z | src/celeba.py | EleMisi/ConditionalVAE | f5e6a13f13b6539a71d8aced830fcda8f5171090 | [
"Apache-2.0"
] | 6 | 2020-03-28T17:12:54.000Z | 2021-04-16T13:25:25.000Z | src/celeba.py | EleMisi/ConditionalVAE | f5e6a13f13b6539a71d8aced830fcda8f5171090 | [
"Apache-2.0"
] | 8 | 2021-04-16T13:11:43.000Z | 2022-01-10T13:06:03.000Z | from collections import OrderedDict
import cv2
from tensorflow.keras.utils import Sequence
import math
import numpy as np
import os
import pandas as pd
import random
import tensorflow as tf
from utils import save_data
class CelebADataset(Sequence):
def __init__(self, train_size, batch_size, mode = 'train', sav... | 30.294964 | 114 | 0.588221 | from collections import OrderedDict
import cv2
from tensorflow.keras.utils import Sequence
import math
import numpy as np
import os
import pandas as pd
import random
import tensorflow as tf
from utils import save_data
class CelebADataset(Sequence):
def __init__(self, train_size, batch_size, mode = 'train', sav... | true | true |
1c1c71c1b810ef65919ec8550488ce0756278d00 | 364 | py | Python | python-for-beginners/05 - Numeric variables/convert_strings_to_numbers_for_math.py | CloudBreadPaPa/c9-python-getting-started | c49580be5e7e88a480d05596a7a53c89d0be7dd3 | [
"MIT"
] | null | null | null | python-for-beginners/05 - Numeric variables/convert_strings_to_numbers_for_math.py | CloudBreadPaPa/c9-python-getting-started | c49580be5e7e88a480d05596a7a53c89d0be7dd3 | [
"MIT"
] | null | null | null | python-for-beginners/05 - Numeric variables/convert_strings_to_numbers_for_math.py | CloudBreadPaPa/c9-python-getting-started | c49580be5e7e88a480d05596a7a53c89d0be7dd3 | [
"MIT"
] | 1 | 2021-09-12T15:34:13.000Z | 2021-09-12T15:34:13.000Z | first_num = input('Enter first number ')
second_num = input('Enter second number ')
# 숫자가 포함된 문자열 변수가 있는 경우
# 문자열을 숫자로 처리하고 싶다면, numeric datatype 으로 convert 해야 합니다
# int()는 문자열을 정수로 변환합니다. 예를 들어, 5, 8, 416, 506
print(int(first_num) + int(second_num))
# float()는 문자열을 decimal 또는 float로 변환합니다. 예를 들어, 3.14159, 89.5, 1.0
... | 33.090909 | 66 | 0.708791 | first_num = input('Enter first number ')
second_num = input('Enter second number ')
print(int(first_num) + int(second_num))
print(float(first_num) + float(second_num))
| true | true |
1c1c72d30049c26ca5920d9bda97f0e00ab2750e | 27,756 | py | Python | pydantic/main.py | henriklindgren/pydantic | 830278b17b49acf279ccb071448a997070feb68c | [
"MIT"
] | null | null | null | pydantic/main.py | henriklindgren/pydantic | 830278b17b49acf279ccb071448a997070feb68c | [
"MIT"
] | null | null | null | pydantic/main.py | henriklindgren/pydantic | 830278b17b49acf279ccb071448a997070feb68c | [
"MIT"
] | null | null | null | import json
import sys
import warnings
from abc import ABCMeta
from copy import deepcopy
from enum import Enum
from functools import partial
from pathlib import Path
from types import FunctionType
from typing import TYPE_CHECKING, Any, Callable, Dict, Optional, Tuple, Type, TypeVar, Union, cast, no_type_check
from .cl... | 37.256376 | 120 | 0.596628 | import json
import sys
import warnings
from abc import ABCMeta
from copy import deepcopy
from enum import Enum
from functools import partial
from pathlib import Path
from types import FunctionType
from typing import TYPE_CHECKING, Any, Callable, Dict, Optional, Tuple, Type, TypeVar, Union, cast, no_type_check
from .cl... | true | true |
1c1c72f2bfca3ce8614ca7f892aa590b56aad309 | 135 | py | Python | deepnade/buml/Optimization/__init__.py | vlimant/NADE | e2446c73250a99979c8710a8acbb14823a54bce0 | [
"BSD-3-Clause"
] | 43 | 2017-06-19T21:19:55.000Z | 2022-02-06T01:21:48.000Z | deepnade/buml/Optimization/__init__.py | vlimant/NADE | e2446c73250a99979c8710a8acbb14823a54bce0 | [
"BSD-3-Clause"
] | 1 | 2017-08-29T14:09:49.000Z | 2017-09-08T12:34:19.000Z | deepnade/buml/Optimization/__init__.py | vlimant/NADE | e2446c73250a99979c8710a8acbb14823a54bce0 | [
"BSD-3-Clause"
] | 12 | 2017-09-12T07:56:13.000Z | 2021-09-19T19:11:41.000Z | from Optimizer import Optimizer, has_parameter
from Epochable import Epochable
from SGD import SGD
from MomentumSGD import MomentumSGD
| 27 | 46 | 0.866667 | from Optimizer import Optimizer, has_parameter
from Epochable import Epochable
from SGD import SGD
from MomentumSGD import MomentumSGD
| true | true |
1c1c73a31001484c0f4d098de5629c661cedc421 | 184 | py | Python | python/default_dicts.py | mr-uuid/snippets | 49bb59641d8160d7635b8d5e574cb50f9e5362e2 | [
"MIT"
] | null | null | null | python/default_dicts.py | mr-uuid/snippets | 49bb59641d8160d7635b8d5e574cb50f9e5362e2 | [
"MIT"
] | 1 | 2021-03-10T04:00:01.000Z | 2021-03-10T04:00:01.000Z | python/default_dicts.py | mr-uuid/snippets | 49bb59641d8160d7635b8d5e574cb50f9e5362e2 | [
"MIT"
] | null | null | null | from collections import defaultdict
string = "The lazy fox jumped over the brown doge."
counter = defaultdict(lambda: 0)
for letter in string:
counter[letter] += 1
print counter
| 20.444444 | 51 | 0.75 | from collections import defaultdict
string = "The lazy fox jumped over the brown doge."
counter = defaultdict(lambda: 0)
for letter in string:
counter[letter] += 1
print counter
| false | true |
1c1c762df243e5fa7d7435e7d7872708dca51512 | 13,044 | py | Python | env/lib/python3.7/site-packages/tests/defences/detector/poison/test_activation_defence.py | GU-DataLab/fairness-and-missing-values | 36a900aa235d1d53bd57e11c89e3f73f9a585aca | [
"MIT"
] | 1 | 2021-09-09T13:19:34.000Z | 2021-09-09T13:19:34.000Z | tests/defences/detector/poison/test_activation_defence.py | nelsonmanohar-umich/adversarial-robustness-toolbox | 065ac24e7f5ec124f6cfe39ce21f085f4c87a401 | [
"MIT"
] | 10 | 2021-10-04T23:25:53.000Z | 2022-03-24T23:20:38.000Z | tests/defences/detector/poison/test_activation_defence.py | nelsonmanohar-umich/adversarial-robustness-toolbox | 065ac24e7f5ec124f6cfe39ce21f085f4c87a401 | [
"MIT"
] | 1 | 2021-09-09T13:19:35.000Z | 2021-09-09T13:19:35.000Z | # MIT License
#
# Copyright (C) The Adversarial Robustness Toolbox (ART) Authors 2018
#
# 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
# r... | 41.674121 | 120 | 0.682306 |
from __future__ import absolute_import, division, print_function, unicode_literals
import logging
import unittest
from keras_preprocessing.image import ImageDataGenerator
import numpy as np
from art.data_generators import KerasDataGenerator
from art.defences.detector.poison import ActivationDefence
... | true | true |
1c1c76f7c4bea462b7291fe3d05a036ce7b22f07 | 7,812 | py | Python | src/benchmark.py | HildeTeamTNT/pyarmor | a699f43baa766d8826f801021f1f483d19fdcb87 | [
"OLDAP-2.5",
"Python-2.0"
] | 3 | 2020-05-11T12:01:48.000Z | 2021-04-23T16:33:54.000Z | src/benchmark.py | HildeTeamTNT/pyarmor | a699f43baa766d8826f801021f1f483d19fdcb87 | [
"OLDAP-2.5",
"Python-2.0"
] | null | null | null | src/benchmark.py | HildeTeamTNT/pyarmor | a699f43baa766d8826f801021f1f483d19fdcb87 | [
"OLDAP-2.5",
"Python-2.0"
] | null | null | null | #! /usr/bin/env python
# -*- coding: utf-8 -*-
#
#############################################################
# #
# Copyright @ 2013 - 2017 Dashingsoft corp. #
# All rights reserved. #
# ... | 26.845361 | 78 | 0.593574 |
thod
def run_empty_no_obfuscated_code_object(foo):
return foo.empty()
@metricmethod
def run_one_thousand_no_obfuscated_bytecode(foo):
return foo.one_thousand()
@metricmethod
def run_ten_thousand_no_obfuscated_bytecode(foo):
return foo.ten_thousand()
def main():
if not os.path.exists('benchmark.... | true | true |
1c1c77890ca0679b4c1f8db412e057d8ba707abb | 560 | py | Python | tests/test_polygon.py | mmgalushka/object-detection-vae | f96d59cf3d63a4a8b84e7371b709bba7228607a8 | [
"MIT"
] | null | null | null | tests/test_polygon.py | mmgalushka/object-detection-vae | f96d59cf3d63a4a8b84e7371b709bba7228607a8 | [
"MIT"
] | null | null | null | tests/test_polygon.py | mmgalushka/object-detection-vae | f96d59cf3d63a4a8b84e7371b709bba7228607a8 | [
"MIT"
] | null | null | null | """
Test for deeptrace/data/polygon.py
"""
from deeptrace import Point
from deeptrace import Polygon
def test_polygon_constructor():
v1 = Point(1, 2)
v2 = Point(3, 4)
p = Polygon([v1, v2])
assert len(p) == 2
assert p[0] == Point(1, 2)
assert p[1] == Point(3, 4)
def test_polygon_flatten():
... | 18.666667 | 39 | 0.555357 |
from deeptrace import Point
from deeptrace import Polygon
def test_polygon_constructor():
v1 = Point(1, 2)
v2 = Point(3, 4)
p = Polygon([v1, v2])
assert len(p) == 2
assert p[0] == Point(1, 2)
assert p[1] == Point(3, 4)
def test_polygon_flatten():
v1 = Point(1, 2)
v2 = Point(3, 4)
... | true | true |
1c1c783224b0d785a321c47a27584f621246c9cd | 5,908 | py | Python | reid/models/fusion_branch.py | dulithchinthaka/DCDS | 3f804a87aa57007769985b51eb2d7939fe15cb95 | [
"MIT"
] | null | null | null | reid/models/fusion_branch.py | dulithchinthaka/DCDS | 3f804a87aa57007769985b51eb2d7939fe15cb95 | [
"MIT"
] | null | null | null | reid/models/fusion_branch.py | dulithchinthaka/DCDS | 3f804a87aa57007769985b51eb2d7939fe15cb95 | [
"MIT"
] | null | null | null | from torch import nn
import torch
import torch.nn.functional as F
from torch.autograd import Variable
import pdb
def Dist_Comp(pg1, pg2, dotp):
A = dotp
A = A - torch.min(A) #############
#############################################################################################################3
... | 30.453608 | 143 | 0.516418 | from torch import nn
import torch
import torch.nn.functional as F
from torch.autograd import Variable
import pdb
def Dist_Comp(pg1, pg2, dotp):
A = dotp
A = A - torch.min(A) | true | true |
1c1c78a77910c70265f0daf49c7a079d02984d85 | 3,256 | py | Python | rpn_util/generate_anchors.py | ncsoft/rotated-box-is-back | 52040333851bd2456a4e2f15347311cad3410636 | [
"BSD-3-Clause"
] | 30 | 2022-01-11T03:33:45.000Z | 2022-02-07T01:04:26.000Z | rpn_util/generate_anchors.py | ncsoft/rotated-box-is-back | 52040333851bd2456a4e2f15347311cad3410636 | [
"BSD-3-Clause"
] | null | null | null | rpn_util/generate_anchors.py | ncsoft/rotated-box-is-back | 52040333851bd2456a4e2f15347311cad3410636 | [
"BSD-3-Clause"
] | 2 | 2022-01-20T16:22:56.000Z | 2022-01-20T22:19:05.000Z | # --------------------------------------------------------
# Faster R-CNN
# Copyright (c) 2015 Microsoft
# Licensed under The MIT License [see LICENSE for details]
# Written by Ross Girshick and Sean Bell
# --------------------------------------------------------
from __future__ import absolute_import
from __future__ i... | 27.133333 | 78 | 0.542076 |
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
import numpy as np
#
# >> load output/rpn_cachedir/faster_rcnn_VOC2007_ZF_stage1_rpn/anchors.mat
# >> anchors
#
# anchors =
#
# -83 -39 100 56
# -175 -87 192 104
# ... | true | true |
1c1c797325c6f01fdd9b8ebf4939513d3e3aacfb | 14,727 | py | Python | python/ccxt/btcalpha.py | t4n6a1ka/ccxt | 0a69e046942564e918ffda2a52c196808b1b9d83 | [
"MIT"
] | null | null | null | python/ccxt/btcalpha.py | t4n6a1ka/ccxt | 0a69e046942564e918ffda2a52c196808b1b9d83 | [
"MIT"
] | 1 | 2019-09-19T06:38:21.000Z | 2019-09-19T06:38:21.000Z | python/ccxt/btcalpha.py | t4n6a1ka/ccxt | 0a69e046942564e918ffda2a52c196808b1b9d83 | [
"MIT"
] | null | null | null | # -*- coding: utf-8 -*-
# PLEASE DO NOT EDIT THIS FILE, IT IS GENERATED AND WILL BE OVERWRITTEN:
# https://github.com/ccxt/ccxt/blob/master/CONTRIBUTING.md#how-to-contribute-code
from ccxt.base.exchange import Exchange
import math
from ccxt.base.errors import ExchangeError
from ccxt.base.errors import AuthenticationE... | 36.8175 | 126 | 0.478984 |
ge import Exchange
import math
from ccxt.base.errors import ExchangeError
from ccxt.base.errors import AuthenticationError
from ccxt.base.errors import InvalidOrder
from ccxt.base.errors import DDoSProtection
class btcalpha (Exchange):
def describe(self):
return self.deep_extend(super(btcalpha, self).... | true | true |
1c1c79e27a64c29349d6b010d301f5f49d9fff05 | 714 | py | Python | action_plugins/password.py | benthomasson/ansible-jupyter-widgets | f67fd88f611ab594e6d8d56efa4ed835a58082da | [
"Apache-2.0"
] | null | null | null | action_plugins/password.py | benthomasson/ansible-jupyter-widgets | f67fd88f611ab594e6d8d56efa4ed835a58082da | [
"Apache-2.0"
] | null | null | null | action_plugins/password.py | benthomasson/ansible-jupyter-widgets | f67fd88f611ab594e6d8d56efa4ed835a58082da | [
"Apache-2.0"
] | null | null | null | from ansible.plugins.action import ActionBase
class ActionModule(ActionBase):
BYPASS_HOST_LOOP = True
def run(self, tmp=None, task_vars=None):
if task_vars is None:
task_vars = dict()
result = super(ActionModule, self).run(tmp, task_vars)
var_name = self._task.args.get('v... | 35.7 | 74 | 0.670868 | from ansible.plugins.action import ActionBase
class ActionModule(ActionBase):
BYPASS_HOST_LOOP = True
def run(self, tmp=None, task_vars=None):
if task_vars is None:
task_vars = dict()
result = super(ActionModule, self).run(tmp, task_vars)
var_name = self._task.args.get('v... | true | true |
1c1c7a3a46efd81b4fea53289ba9108a44449baf | 2,920 | py | Python | editing files/Portable Python 3.2.5.1/App/Lib/site-packages/IPython/zmq/completer.py | mattl1598/testing | cd8124773b83a07301c507ffbb9ccaafbfe7a274 | [
"Unlicense"
] | null | null | null | editing files/Portable Python 3.2.5.1/App/Lib/site-packages/IPython/zmq/completer.py | mattl1598/testing | cd8124773b83a07301c507ffbb9ccaafbfe7a274 | [
"Unlicense"
] | 1 | 2018-04-15T22:59:15.000Z | 2018-04-15T22:59:15.000Z | editing files/Portable Python 3.2.5.1/App/Lib/site-packages/IPython/zmq/completer.py | mattl1598/Project-Mochachino | cd8124773b83a07301c507ffbb9ccaafbfe7a274 | [
"Unlicense"
] | null | null | null | """Tab-completion over zmq"""
# Trying to get print statements to work during completion, not very
# successfully...
import itertools
try:
import readline
except ImportError:
readline = None
import rlcompleter
import time
from . import session
class KernelCompleter(object):
"""Kernel-side completion ma... | 31.73913 | 78 | 0.588356 |
import itertools
try:
import readline
except ImportError:
readline = None
import rlcompleter
import time
from . import session
class KernelCompleter(object):
def __init__(self, namespace):
self.namespace = namespace
self.completer = rlcompleter.Completer(namespace)
def complete(s... | true | true |
1c1c7ac5c89fc6f8682efcb86527ccfcda1bc443 | 2,894 | py | Python | alipay/aop/api/domain/PaidOuterCardPurchaseInfoDTO.py | antopen/alipay-sdk-python-all | 8e51c54409b9452f8d46c7bb10eea7c8f7e8d30c | [
"Apache-2.0"
] | null | null | null | alipay/aop/api/domain/PaidOuterCardPurchaseInfoDTO.py | antopen/alipay-sdk-python-all | 8e51c54409b9452f8d46c7bb10eea7c8f7e8d30c | [
"Apache-2.0"
] | null | null | null | alipay/aop/api/domain/PaidOuterCardPurchaseInfoDTO.py | antopen/alipay-sdk-python-all | 8e51c54409b9452f8d46c7bb10eea7c8f7e8d30c | [
"Apache-2.0"
] | null | null | null | #!/usr/bin/env python
# -*- coding: utf-8 -*-
import json
from alipay.aop.api.constant.ParamConstants import *
class PaidOuterCardPurchaseInfoDTO(object):
def __init__(self):
self._action_date = None
self._alipay_trade_no = None
self._out_trade_no = None
self._price = None
... | 28.653465 | 81 | 0.587422 |
import json
from alipay.aop.api.constant.ParamConstants import *
class PaidOuterCardPurchaseInfoDTO(object):
def __init__(self):
self._action_date = None
self._alipay_trade_no = None
self._out_trade_no = None
self._price = None
self._source = None
@property
def... | true | true |
1c1c7afa085fd8b108375ad88da144e9aa120161 | 1,274 | py | Python | app/routers/v1/api_nodes.py | d3vzer0/reternal-backend | aeeb613c820759212e7aef9150738a66b2882d50 | [
"MIT"
] | 6 | 2019-01-01T23:38:12.000Z | 2021-07-27T03:43:11.000Z | app/routers/v1/api_nodes.py | d3vzer0/reternal-backend | aeeb613c820759212e7aef9150738a66b2882d50 | [
"MIT"
] | 1 | 2020-08-02T00:21:41.000Z | 2020-08-02T00:21:41.000Z | app/routers/v1/api_nodes.py | d3vzer0/reternal-backend | aeeb613c820759212e7aef9150738a66b2882d50 | [
"MIT"
] | 1 | 2021-07-27T03:43:24.000Z | 2021-07-27T03:43:24.000Z | from app.utils import celery
from app.utils.depends import job_uuid, decode_token, validate_token
from app.schemas.nodes import Node
from typing import List, Dict, Any
from app.schemas.generic import CeleryTask
from fastapi import APIRouter, Depends, Security
from celery.result import AsyncResult
from celery import Si... | 37.470588 | 145 | 0.737834 | from app.utils import celery
from app.utils.depends import job_uuid, decode_token, validate_token
from app.schemas.nodes import Node
from typing import List, Dict, Any
from app.schemas.generic import CeleryTask
from fastapi import APIRouter, Depends, Security
from celery.result import AsyncResult
from celery import Si... | true | true |
1c1c7b0585a19297352558b99758edbabe1b30bc | 5,703 | py | Python | materials_trash_detector/trash_dataset.py | Waste-NANDO/Mask_RCNN | 272fbeba35e62ce3a6772c9c70e62da9fcb4a40e | [
"MIT"
] | null | null | null | materials_trash_detector/trash_dataset.py | Waste-NANDO/Mask_RCNN | 272fbeba35e62ce3a6772c9c70e62da9fcb4a40e | [
"MIT"
] | null | null | null | materials_trash_detector/trash_dataset.py | Waste-NANDO/Mask_RCNN | 272fbeba35e62ce3a6772c9c70e62da9fcb4a40e | [
"MIT"
] | 1 | 2020-04-25T17:29:33.000Z | 2020-04-25T17:29:33.000Z | # -*- coding: utf-8 -*-
"""
Dataset for Mask R-CNN
Configurations and data loading code for COCO format.
@author: Mattia Brusamento
"""
import os
import sys
import time
import numpy as np
import json
# Download and install the Python coco tools from https://github.com/waleedka/coco
# That's a fork from the original... | 38.533784 | 136 | 0.565843 |
import os
import sys
import time
import numpy as np
import json
# fix for Python 3.
# I submitted a pull request https://github.com/cocodataset/cocoapi/pull/50
# If the PR is merged then use the original repo.
# Note: Edit PythonAPI/Makefile and replace "python" with "python3".
from pycocotools.coco import COCO
fr... | true | true |
1c1c7b36135585cc42749277d7e021632e86e85e | 4,386 | py | Python | synapse/rest/synapse/client/new_user_consent.py | mlakkadshaw/synapse | 74a2365bd5066955567cc551e72632d6cece94b9 | [
"Apache-2.0"
] | 9,945 | 2015-01-02T07:41:06.000Z | 2022-03-31T23:22:42.000Z | synapse/rest/synapse/client/new_user_consent.py | t2bot/synapse | 62ca554ef09330cb88d46fca8296a859d0adc143 | [
"Apache-2.0"
] | 9,320 | 2015-01-08T14:09:03.000Z | 2022-03-31T21:11:24.000Z | synapse/rest/synapse/client/new_user_consent.py | t2bot/synapse | 62ca554ef09330cb88d46fca8296a859d0adc143 | [
"Apache-2.0"
] | 2,299 | 2015-01-31T22:16:29.000Z | 2022-03-31T06:08:26.000Z | # Copyright 2021 The Matrix.org Foundation C.I.C.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or a... | 40.611111 | 93 | 0.696534 |
import logging
from typing import TYPE_CHECKING, Generator
from twisted.web.server import Request
from synapse.api.errors import SynapseError
from synapse.handlers.sso import get_username_mapping_session_cookie_from_request
from synapse.http.server import DirectServeHtmlResource, respond_with_html
from s... | true | true |
1c1c7b7d1c112cc2ef1f15635d483009308dfe29 | 2,793 | py | Python | Python/win32/win32_mouse_handler.py | honchardev/Fun | ca7c0076e9bb3017c5d7e89aa7d5bd54a83c8ecc | [
"MIT"
] | null | null | null | Python/win32/win32_mouse_handler.py | honchardev/Fun | ca7c0076e9bb3017c5d7e89aa7d5bd54a83c8ecc | [
"MIT"
] | 3 | 2020-03-24T16:26:35.000Z | 2020-04-15T19:40:41.000Z | Python/win32/win32_mouse_handler.py | honchardev/Fun | ca7c0076e9bb3017c5d7e89aa7d5bd54a83c8ecc | [
"MIT"
] | null | null | null | import win32con
import win32gui
import ctypes
from ctypes import wintypes
# container class for global hook
# this will store the HHOOK id and mouse information
class Hook:
def __init__(self):
self.hook = 0
self.m_struct = None
class MSLLHOOKSTRUCT(ctypes.Structure):
_fields_ = [("pt", wintypes.POINT),
("m... | 32.858824 | 113 | 0.741855 | import win32con
import win32gui
import ctypes
from ctypes import wintypes
class Hook:
def __init__(self):
self.hook = 0
self.m_struct = None
class MSLLHOOKSTRUCT(ctypes.Structure):
_fields_ = [("pt", wintypes.POINT),
("mouseData", ctypes.c_long),
("flags", ctypes.c_long),
("time", ctypes.c_long),... | true | true |
1c1c7b816b2124d97b6394f391f8b76e31d71b52 | 4,876 | py | Python | virtual/lib/python3.8/site-packages/flask/templating.py | Tee-Mureithi/blogging-website | 03419e9d3ab87af150c332f7b5867b0d7b28d56e | [
"MIT"
] | null | null | null | virtual/lib/python3.8/site-packages/flask/templating.py | Tee-Mureithi/blogging-website | 03419e9d3ab87af150c332f7b5867b0d7b28d56e | [
"MIT"
] | null | null | null | virtual/lib/python3.8/site-packages/flask/templating.py | Tee-Mureithi/blogging-website | 03419e9d3ab87af150c332f7b5867b0d7b28d56e | [
"MIT"
] | null | null | null | # -*- coding: utf-8 -*-
"""
flask.templating
~~~~~~~~~~~~~~~~
Implements the bridge to Jinja2.
:copyright: 2010 Pallets
:license: BSD-3-Clause
"""
from jinja2 import BaseLoader, Environment as BaseEnvironment, \
TemplateNotFound
from .globals import _request_ctx_stack, _app_ctx_stack
from .... | 32.291391 | 83 | 0.644381 |
from jinja2 import BaseLoader, Environment as BaseEnvironment, \
TemplateNotFound
from .globals import _request_ctx_stack, _app_ctx_stack
from .signals import template_rendered, before_render_template
def _default_template_ctx_processor():
reqctx = _request_ctx_stack.top
appctx = _app_ctx_stack.top
... | true | true |
1c1c7be49bf08b3e78209c144bcdd345edbc9f65 | 1,311 | py | Python | tests/test_cli.py | moonbzyx/ctp | e5f663352124ac8033912c5867cc5ac2cecbb662 | [
"MIT"
] | 1 | 2020-09-23T11:53:50.000Z | 2020-09-23T11:53:50.000Z | tests/test_cli.py | moonbzyx/ctp | e5f663352124ac8033912c5867cc5ac2cecbb662 | [
"MIT"
] | null | null | null | tests/test_cli.py | moonbzyx/ctp | e5f663352124ac8033912c5867cc5ac2cecbb662 | [
"MIT"
] | null | null | null | # -*- coding: utf-8 -*-
import os
import sys
import numpy as np
import subprocess
import pytest
@pytest.mark.light
def test_complex_cli_v1():
env = os.environ.copy()
env['PYTHONPATH'] = '.'
cmd_str = 'python3 ./bin/kbc-cli.py --train data/wn18rr/dev.tsv --dev data/wn18rr/dev.tsv ' \
'--t... | 26.755102 | 116 | 0.613272 |
import os
import sys
import numpy as np
import subprocess
import pytest
@pytest.mark.light
def test_complex_cli_v1():
env = os.environ.copy()
env['PYTHONPATH'] = '.'
cmd_str = 'python3 ./bin/kbc-cli.py --train data/wn18rr/dev.tsv --dev data/wn18rr/dev.tsv ' \
'--test data/wn18rr/test.ts... | true | true |
1c1c7bef358361087a2f56c5764055035910ebec | 83 | py | Python | src/main.py | alexcarrega/python-goose-game | 388107399610adb51ace1f7c17968f7e6f9762cd | [
"MIT"
] | null | null | null | src/main.py | alexcarrega/python-goose-game | 388107399610adb51ace1f7c17968f7e6f9762cd | [
"MIT"
] | null | null | null | src/main.py | alexcarrega/python-goose-game | 388107399610adb51ace1f7c17968f7e6f9762cd | [
"MIT"
] | 1 | 2020-11-02T17:05:44.000Z | 2020-11-02T17:05:44.000Z | from Commands import Commands
if __name__ == '__main__':
Commands().cmdloop()
| 16.6 | 29 | 0.710843 | from Commands import Commands
if __name__ == '__main__':
Commands().cmdloop()
| true | true |
1c1c7c8952d4420c140c56fdca8c24d71360cf2e | 12,124 | py | Python | xsocs/gui/view/fitview/FitModel.py | omserta/xsocs | 5e1cf1352233498c48f0566e0b819e18373e95e5 | [
"MIT"
] | null | null | null | xsocs/gui/view/fitview/FitModel.py | omserta/xsocs | 5e1cf1352233498c48f0566e0b819e18373e95e5 | [
"MIT"
] | null | null | null | xsocs/gui/view/fitview/FitModel.py | omserta/xsocs | 5e1cf1352233498c48f0566e0b819e18373e95e5 | [
"MIT"
] | null | null | null | # coding: utf-8
# /*##########################################################################
#
# Copyright (c) 2015-2017 European Synchrotron Radiation Facility
#
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the "Software"), to d... | 31.087179 | 79 | 0.562108 |
label.setAlignment(Qt.Qt.AlignCenter)
label.setAttribute(Qt.Qt.WA_TranslucentBackground)
pixmap = _grabWidget(label)
self.setData(3, pixmap, Qt.Qt.DecorationRole)
qApp.processEvents()
def _loadChildren(self):
return []
def mimeData(s... | true | true |
1c1c7cbaf83959b89a05573054b7107d43ad5971 | 5,727 | py | Python | backtrader/tools/rewrite-data.py | harshabakku/live-back-testing-trader | 1fd69c7598dc15bea740f160eed886f396bcba2c | [
"MIT"
] | 1 | 2021-07-14T22:04:08.000Z | 2021-07-14T22:04:08.000Z | backtrader/tools/rewrite-data.py | ajmal017/LiveBackTestingTrader | 8b4f5804c0aa6046128f6706582f9cde78a0519a | [
"MIT"
] | null | null | null | backtrader/tools/rewrite-data.py | ajmal017/LiveBackTestingTrader | 8b4f5804c0aa6046128f6706582f9cde78a0519a | [
"MIT"
] | 3 | 2021-03-07T16:29:40.000Z | 2022-03-17T21:42:38.000Z | #!/usr/bin/env python
# -*- coding: utf-8; py-indent-offset:4 -*-
###############################################################################
#
# Copyright (C) 2015 Daniel Rodriguez
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as pub... | 31.295082 | 79 | 0.574472 | true | true | |
1c1c7cf922d771884a3e5f4f1563b1ba6246dc41 | 14,262 | py | Python | lib/model/train_val.py | huan123/py-fatser-rcnn | b0c02e004bcd480a01671603578fe18740b85ac0 | [
"MIT"
] | null | null | null | lib/model/train_val.py | huan123/py-fatser-rcnn | b0c02e004bcd480a01671603578fe18740b85ac0 | [
"MIT"
] | null | null | null | lib/model/train_val.py | huan123/py-fatser-rcnn | b0c02e004bcd480a01671603578fe18740b85ac0 | [
"MIT"
] | null | null | null | # -*- coding: utf-8 -*-
# --------------------------------------------------------
# Tensorflow Faster R-CNN
# Licensed under The MIT License [see LICENSE for details]
# Written by Xinlei Chen and Zheqi He
# --------------------------------------------------------
from __future__ import absolute_import
from __future__ ... | 37.630607 | 103 | 0.663652 |
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
import sys
from model.config import cfg
import roi_data_layer.roidb as rdl_roidb
from roi_data_layer.layer import RoIDataLayer
from utils.timer import Timer
try:
import cPickle as pickle
except ImportEr... | true | true |
1c1c7d81556d66089a24670e2f9161e07122254e | 26,618 | py | Python | KilluaRobot/modules/nsfw.py | apisuserbot/Killua-Robot | eb23a6bab090cbda74743ba47b96d5779949e9a4 | [
"MIT"
] | 3 | 2022-01-28T11:18:58.000Z | 2022-02-01T09:19:46.000Z | KilluaRobot/modules/nsfw.py | apisuserbot/Killua-Robot | eb23a6bab090cbda74743ba47b96d5779949e9a4 | [
"MIT"
] | 5 | 2022-01-28T09:04:54.000Z | 2022-03-20T23:24:54.000Z | KilluaRobot/modules/nsfw.py | apisuserbot/Killua-Robot | eb23a6bab090cbda74743ba47b96d5779949e9a4 | [
"MIT"
] | 4 | 2022-01-31T14:23:27.000Z | 2022-02-04T11:30:37.000Z | import os
import html
import nekos
import requests
from PIL import Image
from telegram import ParseMode
from KilluaRobot import dispatcher, updater
import KilluaRobot.modules.sql.nsfw_sql as sql
from KilluaRobot.modules.log_channel import gloggable
from telegram import Message, Chat, Update, Bot, MessageEntity
from tel... | 31.05951 | 85 | 0.703622 | import os
import html
import nekos
import requests
from PIL import Image
from telegram import ParseMode
from KilluaRobot import dispatcher, updater
import KilluaRobot.modules.sql.nsfw_sql as sql
from KilluaRobot.modules.log_channel import gloggable
from telegram import Message, Chat, Update, Bot, MessageEntity
from tel... | true | true |
1c1c7d87690f333799f253b83bdf310b029ede5f | 10,763 | py | Python | take.py | meng-coke/gobangGame | b433a99c51144268ecdb0f54b70fd479c16a9db4 | [
"MIT"
] | 2 | 2021-06-08T05:10:47.000Z | 2021-06-26T12:18:53.000Z | take.py | meng-coke/gobangGame | b433a99c51144268ecdb0f54b70fd479c16a9db4 | [
"MIT"
] | null | null | null | take.py | meng-coke/gobangGame | b433a99c51144268ecdb0f54b70fd479c16a9db4 | [
"MIT"
] | null | null | null |
from time import sleep
import pygame
from pygame.locals import *
from random import randint
level = 15
grade = 10
MAX = 1008611
def Scan(chesspad, color):
shape = [[[0 for high in range(5)] for col in range(15)] for row in range(15)]
# 扫描每一个点,然后在空白的点每一个方向上做出价值评估!!
for i in range(15):
for j in rang... | 33.845912 | 119 | 0.410852 |
from time import sleep
import pygame
from pygame.locals import *
from random import randint
level = 15
grade = 10
MAX = 1008611
def Scan(chesspad, color):
shape = [[[0 for high in range(5)] for col in range(15)] for row in range(15)]
for i in range(15):
for j in range(15):
... | true | true |
1c1c7e542e32f97485f5779c24d3ca7284242ec9 | 2,798 | py | Python | app/recipe/tests/test_ingredients_api.py | gschmeits/recipe-app-api | dbf747499589898300d4bfe6c71f79eb331126de | [
"MIT"
] | null | null | null | app/recipe/tests/test_ingredients_api.py | gschmeits/recipe-app-api | dbf747499589898300d4bfe6c71f79eb331126de | [
"MIT"
] | null | null | null | app/recipe/tests/test_ingredients_api.py | gschmeits/recipe-app-api | dbf747499589898300d4bfe6c71f79eb331126de | [
"MIT"
] | null | null | null | from django.contrib.auth import get_user_model
from django.urls import reverse
from django.test import TestCase
from rest_framework import status
from rest_framework.test import APIClient
from core.models import Ingredient
from recipe.serializers import IngredientSerializer
INGREDIENTS_URL = reverse('recipe:ingredi... | 33.309524 | 78 | 0.682273 | from django.contrib.auth import get_user_model
from django.urls import reverse
from django.test import TestCase
from rest_framework import status
from rest_framework.test import APIClient
from core.models import Ingredient
from recipe.serializers import IngredientSerializer
INGREDIENTS_URL = reverse('recipe:ingredi... | true | true |
1c1c80a614295f88862986a86263b6cd96148eea | 1,775 | py | Python | tests/day03_test.py | zoeimogen/AoC2019 | 44ffc08a38cb07273d7c4fd49200fb7912d4a1cb | [
"MIT"
] | null | null | null | tests/day03_test.py | zoeimogen/AoC2019 | 44ffc08a38cb07273d7c4fd49200fb7912d4a1cb | [
"MIT"
] | null | null | null | tests/day03_test.py | zoeimogen/AoC2019 | 44ffc08a38cb07273d7c4fd49200fb7912d4a1cb | [
"MIT"
] | null | null | null | #!/usr/bin/python3
'''Advent of Code 2019 Day 3 tests'''
import unittest
import os
import sys
sys.path.insert(0, os.path.abspath(os.path.join(os.path.dirname(__file__), '..')))
from aoc2019 import day03 # pylint: disable=wrong-import-position
class TestUM(unittest.TestCase):
'''Unit Tests'''
def test_day03part... | 52.205882 | 99 | 0.465915 |
import unittest
import os
import sys
sys.path.insert(0, os.path.abspath(os.path.join(os.path.dirname(__file__), '..')))
from aoc2019 import day03
class TestUM(unittest.TestCase):
def test_day03part1(self) -> None:
self.assertEqual(day03.single_run('R8,U5,L5,D3'.split(','),
... | true | true |
1c1c8121de0f4b9e04af8e5904dce9bf1a01a4c0 | 3,200 | py | Python | aalh_iit_buildings_03/merge-title-columns.py | johndewees/iitmigration | 4dadfbecda719d6e7d60af076a231aedec3c862f | [
"Unlicense"
] | null | null | null | aalh_iit_buildings_03/merge-title-columns.py | johndewees/iitmigration | 4dadfbecda719d6e7d60af076a231aedec3c862f | [
"Unlicense"
] | null | null | null | aalh_iit_buildings_03/merge-title-columns.py | johndewees/iitmigration | 4dadfbecda719d6e7d60af076a231aedec3c862f | [
"Unlicense"
] | null | null | null | from openpyxl import load_workbook
import re
filename = 'aalh_iit_buildings_03.xlsx'
wb = load_workbook(filename)
ws = wb['Metadata Template']
minimumcol = 2
maximumcol = 2
minimumrow = 7
maximumrow = 499
iterationrow = 7
targetcol = 2
locationcol = 13
datecol = 15
commaspace = ', '
space = ' '
o... | 44.444444 | 583 | 0.614375 | from openpyxl import load_workbook
import re
filename = 'aalh_iit_buildings_03.xlsx'
wb = load_workbook(filename)
ws = wb['Metadata Template']
minimumcol = 2
maximumcol = 2
minimumrow = 7
maximumrow = 499
iterationrow = 7
targetcol = 2
locationcol = 13
datecol = 15
commaspace = ', '
space = ' '
o... | true | true |
1c1c83170fca6883fd9c065000a70d857a73e6ca | 1,685 | py | Python | src/handlers/game_state_handler.py | IsaacSmith13/zegend-of-lelda | 5ca834e9c5c2168dd2eda5446292991971f532cf | [
"MIT"
] | null | null | null | src/handlers/game_state_handler.py | IsaacSmith13/zegend-of-lelda | 5ca834e9c5c2168dd2eda5446292991971f532cf | [
"MIT"
] | null | null | null | src/handlers/game_state_handler.py | IsaacSmith13/zegend-of-lelda | 5ca834e9c5c2168dd2eda5446292991971f532cf | [
"MIT"
] | null | null | null | import sys
import pygame
from ..states.menu_state import MenuState, MENU_NAMES
from ..states.level_state import LevelState, LEVEL_NAMES
class GameStateHandler:
def __init__(self, display):
self.display = display
self.game_states = self._get_clean_game_state()
def _get_clean_game_state(self):
... | 28.083333 | 73 | 0.635015 | import sys
import pygame
from ..states.menu_state import MenuState, MENU_NAMES
from ..states.level_state import LevelState, LEVEL_NAMES
class GameStateHandler:
def __init__(self, display):
self.display = display
self.game_states = self._get_clean_game_state()
def _get_clean_game_state(self):
... | true | true |
1c1c834e21066d787d1a80f473d479a65ff5b2a3 | 9,527 | py | Python | python/eggroll/core/pair_store/lmdb.py | liszekei/eggroll | 6a8cc5e1c9106d2633dc415092151f921f003743 | [
"Apache-2.0"
] | null | null | null | python/eggroll/core/pair_store/lmdb.py | liszekei/eggroll | 6a8cc5e1c9106d2633dc415092151f921f003743 | [
"Apache-2.0"
] | null | null | null | python/eggroll/core/pair_store/lmdb.py | liszekei/eggroll | 6a8cc5e1c9106d2633dc415092151f921f003743 | [
"Apache-2.0"
] | null | null | null | # -*- coding: utf-8 -*-
# Copyright (c) 2019 - now, Eggroll 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... | 34.643636 | 135 | 0.569014 |
import os
import platform
import sys
import threading
import lmdb
from eggroll.core.pair_store.adapter import PairIterator, PairWriteBatch, \
PairAdapter
from eggroll.utils.log_utils import get_logger
L = get_logger()
LMDB_MAP_SIZE = 16 * 4_096 * 244_140
LMDB_MAP_SIZE_WINDOWS_OS = 40 * 1024 *... | true | true |
1c1c8443216f1788d7a411388f9f4d9dda981f11 | 30,857 | py | Python | mycroft/skills/skill_data.py | OpenVoiceOS/ovos-core | 662577740a6e8cb5bb92bec014a05be9a6870b05 | [
"Apache-2.0"
] | 4 | 2021-11-03T22:06:30.000Z | 2021-11-19T08:03:58.000Z | mycroft/skills/skill_data.py | OpenVoiceOS/ovos-core | 662577740a6e8cb5bb92bec014a05be9a6870b05 | [
"Apache-2.0"
] | 62 | 2021-10-29T21:18:51.000Z | 2022-03-30T07:08:29.000Z | mycroft/skills/skill_data.py | OpenVoiceOS/ovos-core | 662577740a6e8cb5bb92bec014a05be9a6870b05 | [
"Apache-2.0"
] | null | null | null | # Copyright 2018 Mycroft AI Inc.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writin... | 35.064773 | 95 | 0.630197 |
import re
from collections import namedtuple
from os import walk
from os.path import dirname
from pathlib import Path
from typing import List, Optional, Tuple
from ovos_utils.configuration import get_xdg_data_save_path
from mycroft.util.file_utils import resolve_resource_file
from mycroft.util.format im... | true | true |
1c1c863b3904844c596d6be44460c5446fb047b9 | 4,078 | py | Python | report/app.py | Kellel/reports | 975e99396301e87176a38dd440a273c9319b3e22 | [
"BSD-3-Clause"
] | null | null | null | report/app.py | Kellel/reports | 975e99396301e87176a38dd440a273c9319b3e22 | [
"BSD-3-Clause"
] | null | null | null | report/app.py | Kellel/reports | 975e99396301e87176a38dd440a273c9319b3e22 | [
"BSD-3-Clause"
] | null | null | null | import logging
import sys
import os
import imp
from sqlalchemy import create_engine
from sqlalchemy.orm import sessionmaker
from redis import StrictRedis
from wrapper import ConfigurableWrapper
def singleton(cls):
instances = {}
def getinstance():
if cls not in instances:
instances[cls] = ... | 27.741497 | 120 | 0.686856 | import logging
import sys
import os
import imp
from sqlalchemy import create_engine
from sqlalchemy.orm import sessionmaker
from redis import StrictRedis
from wrapper import ConfigurableWrapper
def singleton(cls):
instances = {}
def getinstance():
if cls not in instances:
instances[cls] = ... | true | true |
1c1c87065822519a155d4c9c3b16a3bac61a2a20 | 98 | py | Python | Flattener/__init__.py | CT15/postia | c5679268e9bd4a43dbd4abe6d94d3a716be48bf3 | [
"MIT"
] | null | null | null | Flattener/__init__.py | CT15/postia | c5679268e9bd4a43dbd4abe6d94d3a716be48bf3 | [
"MIT"
] | 1 | 2020-05-15T09:47:25.000Z | 2020-05-15T09:48:19.000Z | Flattener/__init__.py | CT15/postia | c5679268e9bd4a43dbd4abe6d94d3a716be48bf3 | [
"MIT"
] | null | null | null | from .CommentFlattener import CommentFlattener
from .TimestampFlattener import TimestampFlattener
| 32.666667 | 50 | 0.897959 | from .CommentFlattener import CommentFlattener
from .TimestampFlattener import TimestampFlattener
| true | true |
1c1c872acad30885dc077a5849e4f7403e352df2 | 1,729 | py | Python | mods/pyCAPI/VUnit.py | proppy/osvb | c6e84fb06fa52d29d17ff832d47c950307a41b76 | [
"Apache-2.0",
"CC-BY-4.0"
] | 22 | 2021-03-31T05:46:54.000Z | 2022-01-17T11:10:08.000Z | mods/pyCAPI/VUnit.py | proppy/osvb | c6e84fb06fa52d29d17ff832d47c950307a41b76 | [
"Apache-2.0",
"CC-BY-4.0"
] | 3 | 2021-04-02T00:02:24.000Z | 2022-01-12T23:43:53.000Z | mods/pyCAPI/VUnit.py | proppy/osvb | c6e84fb06fa52d29d17ff832d47c950307a41b76 | [
"Apache-2.0",
"CC-BY-4.0"
] | 5 | 2021-03-30T22:53:49.000Z | 2021-12-21T14:57:19.000Z | # Python API for using CAPI 3 core files from VUnit
# Authors:
# Unai Martinez-Corral
#
# Copyright 2021 Unai Martinez-Corral <unai.martinezcorral@ehu.eus>
#
# 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... | 36.787234 | 80 | 0.70214 |
def AddCoreFilesets(vunitHandle, core, filesets):
_root = core.FILE_PATH.parent
_defaultLib = "VUnitUserLib"
_sources = {_defaultLib: []}
for fsetname in filesets:
if fsetname in core.filesets:
fset = core.filesets[fsetname]
_lib = _defaultLib if f... | true | true |
1c1c87d6929a757eaf3e2151d1c0d089ebe78116 | 2,389 | py | Python | qiskit/transpiler/passes/mapping/enlarge_with_ancilla.py | rabaniten/qiskit-terra | 68da37be74d133faef530c42d1fd11d696a80c12 | [
"Apache-2.0"
] | 2 | 2021-09-06T19:25:36.000Z | 2021-11-17T10:46:12.000Z | qiskit/transpiler/passes/mapping/enlarge_with_ancilla.py | rabaniten/qiskit-terra | 68da37be74d133faef530c42d1fd11d696a80c12 | [
"Apache-2.0"
] | null | null | null | qiskit/transpiler/passes/mapping/enlarge_with_ancilla.py | rabaniten/qiskit-terra | 68da37be74d133faef530c42d1fd11d696a80c12 | [
"Apache-2.0"
] | null | null | null | # -*- coding: utf-8 -*-
# Copyright 2019, 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.
"""
This pass extends the DAG with idle physical qubits in the layout
"""
from qiskit.transpiler.basepasses import Transfor... | 36.753846 | 96 | 0.64797 |
from qiskit.transpiler.basepasses import TransformationPass
from qiskit.transpiler.exceptions import TranspilerError
from qiskit.circuit import QuantumRegister
class EnlargeWithAncilla(TransformationPass):
def __init__(self, layout=None):
super().__init__()
self.layout = layout
s... | true | true |
1c1c89537a0b9c7ad7c90983b07dc1fe800d7a19 | 1,028 | py | Python | malwareconfig/komand_malwareconfig/connection/connection.py | killstrelok/insightconnect-plugins | 911358925f4233ab273dbd8172e8b7b9188ebc01 | [
"MIT"
] | 1 | 2020-03-18T09:14:55.000Z | 2020-03-18T09:14:55.000Z | malwareconfig/komand_malwareconfig/connection/connection.py | killstrelok/insightconnect-plugins | 911358925f4233ab273dbd8172e8b7b9188ebc01 | [
"MIT"
] | 1 | 2021-02-23T23:57:37.000Z | 2021-02-23T23:57:37.000Z | malwareconfig/komand_malwareconfig/connection/connection.py | killstrelok/insightconnect-plugins | 911358925f4233ab273dbd8172e8b7b9188ebc01 | [
"MIT"
] | null | null | null | import komand
from .schema import ConnectionSchema
# Custom imports below
from komand_malwareconfig.util.client import MalwareConfigClient
class Connection(komand.Connection):
__SUCCESS_STATUS_CODE = "200"
def __init__(self):
super(self.__class__, self).__init__(input=ConnectionSchema())
sel... | 36.714286 | 92 | 0.715953 | import komand
from .schema import ConnectionSchema
from komand_malwareconfig.util.client import MalwareConfigClient
class Connection(komand.Connection):
__SUCCESS_STATUS_CODE = "200"
def __init__(self):
super(self.__class__, self).__init__(input=ConnectionSchema())
self.client = None
d... | true | true |
1c1c89cdb619f5c0b928d82631e9805b0d87d71b | 491 | py | Python | app/application_patterns/redis_db/redis_ex.py | andykmiles/code-boutique | 26d05202f832af163f2900c36237988f37ceea8a | [
"MIT"
] | 10 | 2020-06-28T05:38:32.000Z | 2022-01-27T13:48:51.000Z | app/application_patterns/redis_db/redis_ex.py | andykmiles/code-boutique | 26d05202f832af163f2900c36237988f37ceea8a | [
"MIT"
] | null | null | null | app/application_patterns/redis_db/redis_ex.py | andykmiles/code-boutique | 26d05202f832af163f2900c36237988f37ceea8a | [
"MIT"
] | 5 | 2020-09-24T20:14:36.000Z | 2021-11-07T22:47:23.000Z | """
demonstrate use of Redis
"""
# code intentionally omitted - see git for complete module
try:
log.info('Step 1: connect to Redis')
r = src.login_database.login_redis_cloud()
log.info('Step 2: cache some data in Redis')
r.set('andy', 'andy@somewhere.com')
log.info('Step 2: now I can read it... | 24.55 | 58 | 0.641548 |
try:
log.info('Step 1: connect to Redis')
r = src.login_database.login_redis_cloud()
log.info('Step 2: cache some data in Redis')
r.set('andy', 'andy@somewhere.com')
log.info('Step 2: now I can read it')
email = r.get('andy')
log.info('But I must know the key')
log.info(f'The results... | true | true |
1c1c8b0ada2a610d936f7b0820d7d24742c895dd | 15,034 | py | Python | rlpyt/utils/logging/logger.py | ZiwenZhuang/rlpyt | 95a05a86f576190cf6217fd9aad7b5f615ee97d1 | [
"MIT"
] | null | null | null | rlpyt/utils/logging/logger.py | ZiwenZhuang/rlpyt | 95a05a86f576190cf6217fd9aad7b5f615ee97d1 | [
"MIT"
] | null | null | null | rlpyt/utils/logging/logger.py | ZiwenZhuang/rlpyt | 95a05a86f576190cf6217fd9aad7b5f615ee97d1 | [
"MIT"
] | null | null | null | from enum import Enum
from exptools.logging.tabulate import tabulate
from exptools.logging.console import mkdir_p, colorize
from exptools.logging.autoargs import get_all_parameters
from contextlib import contextmanager
import numpy as np
import os
import os.path as osp
import sys
import datetime
# import dateutil.tz
i... | 31.784355 | 112 | 0.633364 | from enum import Enum
from exptools.logging.tabulate import tabulate
from exptools.logging.console import mkdir_p, colorize
from exptools.logging.autoargs import get_all_parameters
from contextlib import contextmanager
import numpy as np
import os
import os.path as osp
import sys
import datetime
import csv
import js... | true | true |
1c1c8b6196c72a16c49d0f85310e8fb1a10d4061 | 13,774 | py | Python | 6103_11_Final_Thiersch_Alexander.py | akthiersch-01/My6103Work | 1ee3053b788baf370de197911fae4e6855b88938 | [
"Apache-2.0"
] | null | null | null | 6103_11_Final_Thiersch_Alexander.py | akthiersch-01/My6103Work | 1ee3053b788baf370de197911fae4e6855b88938 | [
"Apache-2.0"
] | null | null | null | 6103_11_Final_Thiersch_Alexander.py | akthiersch-01/My6103Work | 1ee3053b788baf370de197911fae4e6855b88938 | [
"Apache-2.0"
] | null | null | null | # To add a new cell, type '#%%'
# To add a new markdown cell, type '#%% [markdown]'
#%%
import numpy as np
import pandas as pd
import dm6103 as dm
world1 = dm.api_dsLand('World1', 'id')
world2 = dm.api_dsLand('World2', 'id')
print("\nReady to continue.")
#%% [markdown]
# # Two Worlds (Continuation from midterm: Par... | 49.017794 | 416 | 0.692537 |
import numpy as np
import pandas as pd
import dm6103 as dm
world1 = dm.api_dsLand('World1', 'id')
world2 = dm.api_dsLand('World2', 'id')
print("\nReady to continue.")
l predict what is the growth factor for each person in the immediate month ahead.
# Along the same line, it also calculate what is the expected ... | true | true |
1c1c8b93ab2b1cb73322f29d7f6c1f11ba3c26d2 | 4,090 | py | Python | Taxonomies/amphibiaweb/load_aw.py | Smithsonian/DPO-Informatics-Data-Sources | 52aae5e3d76b239887b1f0a40e8b3eba8bf0e85f | [
"Apache-2.0"
] | 1 | 2022-01-02T07:15:25.000Z | 2022-01-02T07:15:25.000Z | Taxonomies/amphibiaweb/load_aw.py | Smithsonian/DPO-Informatics-Data-Sources | 52aae5e3d76b239887b1f0a40e8b3eba8bf0e85f | [
"Apache-2.0"
] | null | null | null | Taxonomies/amphibiaweb/load_aw.py | Smithsonian/DPO-Informatics-Data-Sources | 52aae5e3d76b239887b1f0a40e8b3eba8bf0e85f | [
"Apache-2.0"
] | 1 | 2022-01-02T07:15:34.000Z | 2022-01-02T07:15:34.000Z | #!/usr/bin/env python3
#
# Import AW taxonomy
import psycopg2
import simplejson as json
import psycopg2
import psycopg2.extras
from psycopg2.extensions import AsIs
import pandas as pd
import sys
import csv
import io
import settings
try:
conn = psycopg2.connect(host=settings.pg_host,
... | 34.083333 | 121 | 0.622005 |
import psycopg2
import simplejson as json
import psycopg2
import psycopg2.extras
from psycopg2.extensions import AsIs
import pandas as pd
import sys
import csv
import io
import settings
try:
conn = psycopg2.connect(host=settings.pg_host,
database=settings.pg_db,
... | true | true |
1c1c8ba747e09fb484fff852cccfb09e21e6c3e2 | 6,966 | py | Python | tests/test_response.py | jsexton-portfolio/pyocle | e50e183c05acf4fde4d93ce9d09e350ea4487437 | [
"MIT"
] | 1 | 2021-03-11T22:53:18.000Z | 2021-03-11T22:53:18.000Z | tests/test_response.py | jsexton-portfolio/pyocle | e50e183c05acf4fde4d93ce9d09e350ea4487437 | [
"MIT"
] | 1 | 2021-08-25T05:21:57.000Z | 2021-08-25T05:21:57.000Z | tests/test_response.py | jsexton-portfolio/pyocle | e50e183c05acf4fde4d93ce9d09e350ea4487437 | [
"MIT"
] | null | null | null | import pytest
from pydantic import BaseModel
from pyocle.response import *
from pyocle.response import _build_error_details
class DummyForm(BaseModel):
first_name: str
last_name: str
@pytest.fixture
def schemas():
return {'requestBody': DummyForm.schema()}
def test_pagination_details_ignores_unexpect... | 29.268908 | 106 | 0.553976 | import pytest
from pydantic import BaseModel
from pyocle.response import *
from pyocle.response import _build_error_details
class DummyForm(BaseModel):
first_name: str
last_name: str
@pytest.fixture
def schemas():
return {'requestBody': DummyForm.schema()}
def test_pagination_details_ignores_unexpect... | true | true |
1c1c8c9a06979bc002609f5cca8d10c7e32055ce | 948 | py | Python | Benchmarks/web-search/Parser/dynamic_scripts/2_pre_cp_audit_flag.py | FaniD/SecureWilly | f929f94c6a778b2527e493edbc7309cf10e616e0 | [
"Apache-2.0"
] | 9 | 2019-03-11T22:57:14.000Z | 2021-12-14T13:04:09.000Z | Benchmarks/media-streaming_multiple_clients/clients_8/Parser/dynamic_scripts/2_pre_cp_audit_flag.py | FaniD/Security-on-Docker | f929f94c6a778b2527e493edbc7309cf10e616e0 | [
"Apache-2.0"
] | null | null | null | Benchmarks/media-streaming_multiple_clients/clients_8/Parser/dynamic_scripts/2_pre_cp_audit_flag.py | FaniD/Security-on-Docker | f929f94c6a778b2527e493edbc7309cf10e616e0 | [
"Apache-2.0"
] | 1 | 2021-01-30T15:23:01.000Z | 2021-01-30T15:23:01.000Z | #!/usr/bin/env python
import io
import sys
from collections import OrderedDict
#This will be the output profile
new_profile = []
service = str(sys.argv[1])
version = str(sys.argv[2]) #New version
mode = 'complain'
new = '../parser_output/profiles/' + service + '/version_' + version
with open(new,'r') as infile:
... | 27.085714 | 125 | 0.71308 |
import io
import sys
from collections import OrderedDict
new_profile = []
service = str(sys.argv[1])
version = str(sys.argv[2])
mode = 'complain'
new = '../parser_output/profiles/' + service + '/version_' + version
with open(new,'r') as infile:
data = infile.readlines()
profile = 'profile'
for line in da... | true | true |
1c1c8f980d60d7aaee2a94b4eac3a794dad2a17b | 1,614 | py | Python | mayan/apps/metadata/migrations/0005_auto_20150729_2344.py | CMU-313/fall-2021-hw2-451-unavailable-for-legal-reasons | 0e4e919fd2e1ded6711354a0330135283e87f8c7 | [
"Apache-2.0"
] | 2 | 2021-09-12T19:41:19.000Z | 2021-09-12T19:41:20.000Z | mayan/apps/metadata/migrations/0005_auto_20150729_2344.py | CMU-313/fall-2021-hw2-451-unavailable-for-legal-reasons | 0e4e919fd2e1ded6711354a0330135283e87f8c7 | [
"Apache-2.0"
] | 37 | 2021-09-13T01:00:12.000Z | 2021-10-02T03:54:30.000Z | mayan/apps/metadata/migrations/0005_auto_20150729_2344.py | CMU-313/fall-2021-hw2-451-unavailable-for-legal-reasons | 0e4e919fd2e1ded6711354a0330135283e87f8c7 | [
"Apache-2.0"
] | 1 | 2021-09-22T13:17:30.000Z | 2021-09-22T13:17:30.000Z | from django.db import models, migrations
class Migration(migrations.Migration):
dependencies = [
('metadata', '0004_auto_20150708_0324'),
]
operations = [
migrations.AlterField(
model_name='metadatatype',
name='default',
field=models.CharFie... | 36.681818 | 78 | 0.534696 | from django.db import models, migrations
class Migration(migrations.Migration):
dependencies = [
('metadata', '0004_auto_20150708_0324'),
]
operations = [
migrations.AlterField(
model_name='metadatatype',
name='default',
field=models.CharFie... | true | true |
1c1c9042731408bcece91fe1deec02f0e3be5610 | 25,472 | py | Python | posthog/utils.py | asherf/posthog | 1e50704d76cba484e80b83f1e1f658bd6e98743a | [
"MIT"
] | null | null | null | posthog/utils.py | asherf/posthog | 1e50704d76cba484e80b83f1e1f658bd6e98743a | [
"MIT"
] | null | null | null | posthog/utils.py | asherf/posthog | 1e50704d76cba484e80b83f1e1f658bd6e98743a | [
"MIT"
] | null | null | null | import base64
import datetime
import datetime as dt
import gzip
import hashlib
import json
import os
import re
import shutil
import subprocess
import sys
import time
import uuid
from itertools import count
from typing import (
Any,
Dict,
Generator,
List,
Mapping,
Optional,
Sequence,
Tupl... | 32.202276 | 120 | 0.652599 | import base64
import datetime
import datetime as dt
import gzip
import hashlib
import json
import os
import re
import shutil
import subprocess
import sys
import time
import uuid
from itertools import count
from typing import (
Any,
Dict,
Generator,
List,
Mapping,
Optional,
Sequence,
Tupl... | true | true |
1c1c91d0e637ad49e9e31906479d2c5f2474a4bc | 10,448 | py | Python | zktraffic/base/sniffer.py | LaudateCorpus1/zktraffic | 82db04d9aafa13f694d4f5c7265069db42c0307c | [
"Apache-2.0"
] | 159 | 2015-01-12T14:58:36.000Z | 2021-12-22T13:15:49.000Z | zktraffic/base/sniffer.py | twitter/zktraffic | 82db04d9aafa13f694d4f5c7265069db42c0307c | [
"Apache-2.0"
] | 42 | 2015-01-06T03:13:53.000Z | 2020-03-12T17:04:05.000Z | zktraffic/base/sniffer.py | LaudateCorpus1/zktraffic | 82db04d9aafa13f694d4f5c7265069db42c0307c | [
"Apache-2.0"
] | 42 | 2015-01-12T14:55:43.000Z | 2022-03-21T01:02:43.000Z | # ==================================================================================================
# Copyright 2014 Twitter, Inc.
# --------------------------------------------------------------------------------------------------
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use thi... | 31.95107 | 100 | 0.657829 |
from collections import defaultdict
from random import random
from threading import Thread
import logging
import os
import hexdump
import signal
import socket
import struct
import sys
from .client_message import ClientMessage, Request
from .network import BadPacket, get_ip, get_ip_packet, SnifferBase... | true | true |
1c1c91db3941cc40ce2500d1476c6fe538c2fa88 | 1,358 | py | Python | nick_derobertis_site/software_page/software_card/software_card_model.py | nickderobertis/nick-derobertis-site | 386061dc258921eed41f2d3965ef69e02adde7ba | [
"MIT"
] | 1 | 2022-03-31T10:55:40.000Z | 2022-03-31T10:55:40.000Z | nick_derobertis_site/software_page/software_card/software_card_model.py | nickderobertis/nick-derobertis-site | 386061dc258921eed41f2d3965ef69e02adde7ba | [
"MIT"
] | 8 | 2020-08-28T11:44:37.000Z | 2020-08-31T09:19:19.000Z | nick_derobertis_site/software_page/software_card/software_card_model.py | nickderobertis/nick-derobertis-site | 386061dc258921eed41f2d3965ef69e02adde7ba | [
"MIT"
] | null | null | null | import param
from derobertis_cv.pltemplates.software.project import SoftwareProject
from nick_derobertis_site.common.model import ComponentModel
from nick_derobertis_site.general.utils import PLACEHOLDER_IMAGE
class SoftwareCardModel(ComponentModel):
image_src: str = param.String(default=PLACEHOLDER_IMAGE)
f... | 34.820513 | 76 | 0.706922 | import param
from derobertis_cv.pltemplates.software.project import SoftwareProject
from nick_derobertis_site.common.model import ComponentModel
from nick_derobertis_site.general.utils import PLACEHOLDER_IMAGE
class SoftwareCardModel(ComponentModel):
image_src: str = param.String(default=PLACEHOLDER_IMAGE)
f... | true | true |
1c1c927ae8dabd10d61d3b6c8e59327bab9c7c1c | 8,687 | py | Python | lib/setup.py | hkaraoguz/RRPN | 4d09535cc383d6311738cda0c6c7cde3eeca05d8 | [
"BSD-2-Clause"
] | null | null | null | lib/setup.py | hkaraoguz/RRPN | 4d09535cc383d6311738cda0c6c7cde3eeca05d8 | [
"BSD-2-Clause"
] | null | null | null | lib/setup.py | hkaraoguz/RRPN | 4d09535cc383d6311738cda0c6c7cde3eeca05d8 | [
"BSD-2-Clause"
] | null | null | null | # --------------------------------------------------------
# Fast R-CNN
# Copyright (c) 2015 Microsoft
# Licensed under The MIT License [see LICENSE for details]
# Written by Ross Girshick
# --------------------------------------------------------
import os
from os.path import join as pjoin
from setuptools import setu... | 38.78125 | 90 | 0.584206 |
import os
from os.path import join as pjoin
from setuptools import setup
from distutils.extension import Extension
from Cython.Distutils import build_ext
import subprocess
import numpy as np
def find_in_path(name, path):
for dir in path.split(os.pathsep):
binpath = pjoin(dir, name)
... | true | true |
1c1c934c9d2d4bc9cb4014474d3ff0258bb75128 | 808 | py | Python | fw/ada-macropad/t9_keypad.py | dupontgu/t9-macropad-circuitpython | 5b4f32adbdbcfb1491588e9741372b538d20a3b9 | [
"Apache-2.0"
] | 22 | 2021-05-27T01:20:23.000Z | 2022-02-12T02:52:25.000Z | fw/ada-macropad/t9_keypad.py | dupontgu/t9-macropad-circuitpython | 5b4f32adbdbcfb1491588e9741372b538d20a3b9 | [
"Apache-2.0"
] | 1 | 2022-02-10T12:14:20.000Z | 2022-02-10T14:20:35.000Z | fw/ada-macropad/t9_keypad.py | dupontgu/t9-macropad-circuitpython | 5b4f32adbdbcfb1491588e9741372b538d20a3b9 | [
"Apache-2.0"
] | 3 | 2021-06-03T20:25:09.000Z | 2021-12-01T08:39:08.000Z |
import board
import keypad
class Keypad():
def __init__(self, keys):
self._key_pins = [getattr(board, "KEY%d" % (num + 1)) for num in list(range(12))]
self._keys = keypad.Keys(self._key_pins, value_when_pressed=False, pull=True)
self._key_map = [item for sublist in list(keys) for item in s... | 36.727273 | 89 | 0.621287 |
import board
import keypad
class Keypad():
def __init__(self, keys):
self._key_pins = [getattr(board, "KEY%d" % (num + 1)) for num in list(range(12))]
self._keys = keypad.Keys(self._key_pins, value_when_pressed=False, pull=True)
self._key_map = [item for sublist in list(keys) for item in s... | true | true |
1c1c93f7b84529b17671877f9dd85e3749f21900 | 2,908 | py | Python | parlai/scripts/convert_data_to_parlai_format.py | mohan-chinnappan-n/ParlAI | ddf10373339390408c92d8765d7ff9ae00e4204e | [
"MIT"
] | 55 | 2020-09-16T02:11:28.000Z | 2022-01-27T01:03:19.000Z | parlai/scripts/convert_data_to_parlai_format.py | jacklee20151/ParlAI | b4a442018d1a46f9374547ef0a9b8134b7bb4944 | [
"MIT"
] | 14 | 2020-03-13T19:08:56.000Z | 2020-05-12T07:38:41.000Z | parlai/scripts/convert_data_to_parlai_format.py | jacklee20151/ParlAI | b4a442018d1a46f9374547ef0a9b8134b7bb4944 | [
"MIT"
] | 11 | 2019-06-06T01:19:08.000Z | 2020-07-23T07:34:56.000Z | #!/usr/bin/env python3
# Copyright (c) Facebook, Inc. and its affiliates.
# This source code is licensed under the MIT license found in the
# LICENSE file in the root directory of this source tree.
"""
Convert a dataset into the ParlAI text format.
Examples
--------
.. code-block:: shell
python convert_data_to_pa... | 28.509804 | 81 | 0.596286 |
from parlai.core.params import ParlaiParser
from parlai.agents.repeat_label.repeat_label import RepeatLabelAgent
from parlai.core.worlds import create_task
from parlai.utils.misc import msg_to_str, TimeLogger
import random
import tempfile
def dump_data(opt):
agent = RepeatLabelAgent(opt)
world = cr... | true | true |
1c1c9403e22b510ebe6cffae2f4c960e419958ea | 907 | py | Python | tests/test_pycharm.py | benvdh/ansible-role-pycharm | 0c1d201ab3a855df6f1da9256c0fbeafcf73c453 | [
"MIT"
] | 2 | 2018-10-04T09:39:28.000Z | 2020-04-07T13:11:36.000Z | tests/test_pycharm.py | benvdh/ansible-role-pycharm | 0c1d201ab3a855df6f1da9256c0fbeafcf73c453 | [
"MIT"
] | 1 | 2017-07-26T16:12:50.000Z | 2017-07-26T16:12:50.000Z | tests/test_pycharm.py | benvdh/ansible-role-pycharm | 0c1d201ab3a855df6f1da9256c0fbeafcf73c453 | [
"MIT"
] | 3 | 2018-04-17T01:07:26.000Z | 2022-01-15T00:08:39.000Z | import testinfra.utils.ansible_runner
testinfra_hosts = testinfra.utils.ansible_runner.AnsibleRunner(
'.molecule/ansible_inventory').get_hosts('all')
desktop_file_location = "/root/.local/share/applications/pycharm-community-2017.1.5.desktop"
def test_desktop_file_exists(File):
f = File(desktop_file_locati... | 25.914286 | 92 | 0.76075 | import testinfra.utils.ansible_runner
testinfra_hosts = testinfra.utils.ansible_runner.AnsibleRunner(
'.molecule/ansible_inventory').get_hosts('all')
desktop_file_location = "/root/.local/share/applications/pycharm-community-2017.1.5.desktop"
def test_desktop_file_exists(File):
f = File(desktop_file_locati... | true | true |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.