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 417k | max_line_length int64 1 987k | alphanum_fraction float64 0 1 | content_no_comment stringlengths 0 1.01M | is_comment_constant_removed bool 1
class | is_sharp_comment_removed bool 1
class |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
f730e75319233d0ac8ad0b52753232168804b1d8 | 13,463 | py | Python | pyinduct/parabolic/general.py | pyinduct/pyinduct | f743ecfcee3b940505ec95b48fa07bb1648cfcc1 | [
"BSD-3-Clause"
] | 1 | 2017-01-26T14:26:55.000Z | 2017-01-26T14:26:55.000Z | pyinduct/parabolic/general.py | pyinduct/pyinduct | f743ecfcee3b940505ec95b48fa07bb1648cfcc1 | [
"BSD-3-Clause"
] | 89 | 2017-01-31T12:52:18.000Z | 2020-12-14T23:31:53.000Z | pyinduct/parabolic/general.py | pyinduct/pyinduct | f743ecfcee3b940505ec95b48fa07bb1648cfcc1 | [
"BSD-3-Clause"
] | 5 | 2017-01-26T14:35:41.000Z | 2018-10-23T06:52:32.000Z | from collections.abc import Callable
import warnings
import numpy as np
from scipy.optimize import fsolve
from ..core import Function, find_roots, ConstantFunction
from ..eigenfunctions import SecondOrderOperator
from ..placeholder import (ScalarFunction, TestFunction, FieldVariable, ScalarTerm,
... | 34.609254 | 113 | 0.587016 | from collections.abc import Callable
import warnings
import numpy as np
from scipy.optimize import fsolve
from ..core import Function, find_roots, ConstantFunction
from ..eigenfunctions import SecondOrderOperator
from ..placeholder import (ScalarFunction, TestFunction, FieldVariable, ScalarTerm,
... | true | true |
f730e7ff83b04baa1e0997a21573175be97d9f24 | 13,185 | py | Python | account/migrations/0011_initial.py | Amechi101/indieapp | 606c1346f65c343eb2cc8f7fba9d555b8c30a7fa | [
"MIT"
] | null | null | null | account/migrations/0011_initial.py | Amechi101/indieapp | 606c1346f65c343eb2cc8f7fba9d555b8c30a7fa | [
"MIT"
] | null | null | null | account/migrations/0011_initial.py | Amechi101/indieapp | 606c1346f65c343eb2cc8f7fba9d555b8c30a7fa | [
"MIT"
] | null | null | null | # -*- coding: utf-8 -*-
from south.utils import datetime_utils as datetime
from south.db import db
from south.v2 import SchemaMigration
from django.db import models
class Migration(SchemaMigration):
def forwards(self, orm):
# Adding model 'Account'
db.create_table(u'account_account', (
... | 68.316062 | 195 | 0.593174 | from south.utils import datetime_utils as datetime
from south.db import db
from south.v2 import SchemaMigration
from django.db import models
class Migration(SchemaMigration):
def forwards(self, orm):
db.create_table(u'account_account', (
(u'id', self.gf('django.db.models.fields.AutoFi... | true | true |
f730e8f89e65c95d296e2cde955fa32203c26f03 | 11,449 | py | Python | litex/build/efinix/ifacewriter.py | andykitchen/litex | 85d6cb4b8df98730bd83b412dff6108df188bbb4 | [
"ADSL"
] | null | null | null | litex/build/efinix/ifacewriter.py | andykitchen/litex | 85d6cb4b8df98730bd83b412dff6108df188bbb4 | [
"ADSL"
] | null | null | null | litex/build/efinix/ifacewriter.py | andykitchen/litex | 85d6cb4b8df98730bd83b412dff6108df188bbb4 | [
"ADSL"
] | 1 | 2022-02-11T01:07:07.000Z | 2022-02-11T01:07:07.000Z | #
# This file is part of LiteX.
#
# Copyright (c) 2021 Franck Jullien <franck.jullien@collshade.fr>
# SPDX-License-Identifier: BSD-2-Clause
import os
import csv
import re
import datetime
from xml.dom import expatbuilder
import xml.etree.ElementTree as et
from litex.build import tools
namespaces = {
"efxpt" : "h... | 40.17193 | 159 | 0.537427 |
import os
import csv
import re
import datetime
from xml.dom import expatbuilder
import xml.etree.ElementTree as et
from litex.build import tools
namespaces = {
"efxpt" : "http://www.efinixinc.com/peri_design_db",
"xi" : "http://www.w3.org/2001/XInclude"
}
class InterfaceWriterBlock(dict):
def gener... | true | true |
f730ec2bfb3b16a954fec00652bacff3f553b828 | 4,007 | py | Python | totem/TotemModel.py | amonmillner/playfulportfolio | d848d9c87d28fd9930c50e44cd7c5f4cdd2db93d | [
"MIT"
] | 1 | 2019-04-22T18:50:52.000Z | 2019-04-22T18:50:52.000Z | totem/TotemModel.py | amonmillner/playfulportfolio | d848d9c87d28fd9930c50e44cd7c5f4cdd2db93d | [
"MIT"
] | null | null | null | totem/TotemModel.py | amonmillner/playfulportfolio | d848d9c87d28fd9930c50e44cd7c5f4cdd2db93d | [
"MIT"
] | null | null | null | # -*- coding: utf-8 -*-
"""
Created April 2019
@author: Amon Millner
This is a module that contains a class that serves as a model
for the totem game built, which is an example of the
Model-View-Controller (MVC) framework.
"""
import pygame, copy
from pygame.locals import *
import random
class TotemModel(object):
... | 38.902913 | 88 | 0.572498 | import pygame, copy
from pygame.locals import *
import random
class TotemModel(object):
def __init__(self, size=(640,480),number_of_faces=0):
self.width, self.height = size
self.level = 1
self.foundation = {}
self.direction = 'left'
self.reset_game = 0
self.won_game... | true | true |
f730ed6d33436dced0bf6a00b2f80e83c54ec3ea | 18,160 | py | Python | tests/utils/test_imageutil.py | shokakucarrier/atomic-reactor | 3ad81a5532cde317d0fddd4578f27438e88ee637 | [
"BSD-3-Clause"
] | null | null | null | tests/utils/test_imageutil.py | shokakucarrier/atomic-reactor | 3ad81a5532cde317d0fddd4578f27438e88ee637 | [
"BSD-3-Clause"
] | null | null | null | tests/utils/test_imageutil.py | shokakucarrier/atomic-reactor | 3ad81a5532cde317d0fddd4578f27438e88ee637 | [
"BSD-3-Clause"
] | null | null | null | """
Copyright (c) 2021 Red Hat, Inc
All rights reserved.
This software may be modified and distributed under the terms
of the BSD license. See the LICENSE file for details.
"""
import pytest
import tarfile
import io
import os
from flexmock import flexmock
from pathlib import Path
from osbs.utils import ImageName
fr... | 42.931442 | 111 | 0.644934 |
import pytest
import tarfile
import io
import os
from flexmock import flexmock
from pathlib import Path
from osbs.utils import ImageName
from atomic_reactor import config
from atomic_reactor import util
from atomic_reactor.utils import imageutil, retries
@pytest.fixture
def df_images():
return util.DockerfileI... | true | true |
f730ed7aa9f9349f15c6cbfc5165fbc8a60781f3 | 1,755 | py | Python | MGSIM/Commands/Genome_download.py | nick-youngblut/MGSIM | 9edae3c170cf5100b3408a853a87e1205e70dd1b | [
"MIT"
] | 3 | 2019-09-02T11:03:40.000Z | 2021-12-13T15:59:06.000Z | MGSIM/Commands/Genome_download.py | nick-youngblut/MGSIM | 9edae3c170cf5100b3408a853a87e1205e70dd1b | [
"MIT"
] | 2 | 2020-11-13T13:04:47.000Z | 2022-02-03T14:58:13.000Z | MGSIM/Commands/Genome_download.py | nick-youngblut/MGSIM | 9edae3c170cf5100b3408a853a87e1205e70dd1b | [
"MIT"
] | 1 | 2020-08-13T12:40:39.000Z | 2020-08-13T12:40:39.000Z | #!/usr/bin/env python
"""
genome_download: downloading genomes
Usage:
genome_download [options] <accession_table>
genome_download -h | --help
genome_download --version
Options:
<accessin_table> Taxon-accession table (see Description).
Use '-' if from STDIN.
-d=<d> Output dir... | 28.770492 | 85 | 0.631339 |
import sys,os
import logging
from docopt import docopt
from MGSIM import Genome_Download
logging.basicConfig(format='%(asctime)s - %(message)s', level=logging.DEBUG)
def opt_parse(args=None):
if args is None:
args = docopt(__doc__, version='0.1')
else:
args = docopt(__doc__, version=... | true | true |
f730edaf07a7da17bb74420c371eafd4f32d6873 | 7,584 | py | Python | fixtura/contact.py | KateRuss/python_training | 38ea3f710fd9ba3b555277aac84a1ccda752b056 | [
"Apache-2.0"
] | null | null | null | fixtura/contact.py | KateRuss/python_training | 38ea3f710fd9ba3b555277aac84a1ccda752b056 | [
"Apache-2.0"
] | null | null | null | fixtura/contact.py | KateRuss/python_training | 38ea3f710fd9ba3b555277aac84a1ccda752b056 | [
"Apache-2.0"
] | null | null | null | # -*- coding: utf-8 -*-
from model.contact import Contact
from selenium.webdriver.support.ui import Select
import re
class ContactHelper:
def __init__(self, app):
self.app = app
def fill_contact_form(self, contact):
wd = self.app.wd
# fill contact fields (displayd on home page)
... | 41.900552 | 116 | 0.654272 |
from model.contact import Contact
from selenium.webdriver.support.ui import Select
import re
class ContactHelper:
def __init__(self, app):
self.app = app
def fill_contact_form(self, contact):
wd = self.app.wd
self.change_contact_field("firstname", contact.first_name)
s... | true | true |
f730edc45a14dd6184a9dea61869338a9c700c7e | 545 | py | Python | dashboard/models.py | Lukmanhakim112/ppdb | c6179478b4c1f0b6cec77a8a059a6e418f6263f1 | [
"MIT"
] | null | null | null | dashboard/models.py | Lukmanhakim112/ppdb | c6179478b4c1f0b6cec77a8a059a6e418f6263f1 | [
"MIT"
] | null | null | null | dashboard/models.py | Lukmanhakim112/ppdb | c6179478b4c1f0b6cec77a8a059a6e418f6263f1 | [
"MIT"
] | null | null | null | from django.db import models
from django.utils import timezone
from users.models import CustomUser
from primaseru import choices
class StudentStatus(models.Model):
student = models.OneToOneField(CustomUser, on_delete=models.CASCADE)
accepted = models.BooleanField('Diterima', db_index=True, null=True)
maj... | 34.0625 | 110 | 0.766972 | from django.db import models
from django.utils import timezone
from users.models import CustomUser
from primaseru import choices
class StudentStatus(models.Model):
student = models.OneToOneField(CustomUser, on_delete=models.CASCADE)
accepted = models.BooleanField('Diterima', db_index=True, null=True)
maj... | true | true |
f730edff89f56bcceeeca88db6221bf6caeacef5 | 27,762 | py | Python | tacotron2/model.py | HudsonHuang/tacotron2 | fa55a0b633abe358e1258e1dc3b40d85e17b3450 | [
"BSD-3-Clause"
] | null | null | null | tacotron2/model.py | HudsonHuang/tacotron2 | fa55a0b633abe358e1258e1dc3b40d85e17b3450 | [
"BSD-3-Clause"
] | null | null | null | tacotron2/model.py | HudsonHuang/tacotron2 | fa55a0b633abe358e1258e1dc3b40d85e17b3450 | [
"BSD-3-Clause"
] | null | null | null | # *****************************************************************************
# Copyright (c) 2018, NVIDIA CORPORATION. All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions are met:
# * Redistributions... | 40.002882 | 108 | 0.630394 |
from math import sqrt
import torch
from torch.autograd import Variable
from torch import nn
from torch.nn import functional as F
import sys
from os.path import abspath, dirname
sys.path.append(abspath(dirname(__file__)+'/../'))
from common.layers import ConvNorm, LinearNorm
from common.utils import to_gpu, get_mask_fr... | true | true |
f730efb7bb6d6467c2a0411647710d26fbaf595b | 17,309 | py | Python | models/tacotron.py | peter3125/WaveRNN | ef34b9d91dfbff3197c8cc20d3ed272b222a5ec2 | [
"MIT"
] | null | null | null | models/tacotron.py | peter3125/WaveRNN | ef34b9d91dfbff3197c8cc20d3ed272b222a5ec2 | [
"MIT"
] | null | null | null | models/tacotron.py | peter3125/WaveRNN | ef34b9d91dfbff3197c8cc20d3ed272b222a5ec2 | [
"MIT"
] | null | null | null | import os
import numpy as np
import torch
import torch.nn as nn
import torch.nn.functional as F
class HighwayNetwork(nn.Module):
def __init__(self, size):
super().__init__()
self.W1 = nn.Linear(size, size)
self.W2 = nn.Linear(size, size)
self.W1.bias.data.fill_(0.)
def... | 37.223656 | 110 | 0.60847 | import os
import numpy as np
import torch
import torch.nn as nn
import torch.nn.functional as F
class HighwayNetwork(nn.Module):
def __init__(self, size):
super().__init__()
self.W1 = nn.Linear(size, size)
self.W2 = nn.Linear(size, size)
self.W1.bias.data.fill_(0.)
def... | true | true |
f730efec7b67472ded36ecfb1b4ff7670ef81c41 | 849 | py | Python | slixmpp/xmlstream/handler/xmlwaiter.py | anirudhrata/slixmpp | 1fcee0e80a212eeb274d2f560e69099d8a61bf7f | [
"BSD-3-Clause"
] | 86 | 2016-07-04T13:26:02.000Z | 2022-02-19T10:26:21.000Z | slixmpp/xmlstream/handler/xmlwaiter.py | anirudhrata/slixmpp | 1fcee0e80a212eeb274d2f560e69099d8a61bf7f | [
"BSD-3-Clause"
] | 10 | 2016-09-30T18:55:41.000Z | 2020-05-01T14:22:47.000Z | slixmpp/xmlstream/handler/xmlwaiter.py | anirudhrata/slixmpp | 1fcee0e80a212eeb274d2f560e69099d8a61bf7f | [
"BSD-3-Clause"
] | 45 | 2016-09-30T18:48:41.000Z | 2022-03-18T21:39:33.000Z |
# Slixmpp: The Slick XMPP Library
# Copyright (C) 2010 Nathanael C. Fritz
# This file is part of Slixmpp.
# See the file LICENSE for copying permission.
from slixmpp.xmlstream.stanzabase import StanzaBase
from slixmpp.xmlstream.handler import Waiter
class XMLWaiter(Waiter):
"""
The XMLWaiter class is ident... | 26.53125 | 65 | 0.674912 |
from slixmpp.xmlstream.stanzabase import StanzaBase
from slixmpp.xmlstream.handler import Waiter
class XMLWaiter(Waiter):
def prerun(self, payload: StanzaBase) -> None:
Waiter.prerun(self, payload.xml) | true | true |
f730f06f9acee549a188aa709f31f37e19a2c108 | 8,731 | py | Python | tensorpack/RL/expreplay.py | skoppula/ternarynet | 1a67251f7f5a1cdf854f87f90f841655c7c9f11c | [
"Apache-2.0"
] | 109 | 2017-01-16T23:55:36.000Z | 2021-08-31T17:48:08.000Z | f1/F1_track1/tensorpack/RL/expreplay.py | mihahauke/vizdoom_cig2017 | 42baffa7c6ee43db618605838ea6f9e0547001d1 | [
"MIT"
] | 19 | 2018-01-28T23:05:33.000Z | 2022-03-11T23:14:57.000Z | tensorpack/RL/expreplay.py | czhu95/ternarynet | 1a67251f7f5a1cdf854f87f90f841655c7c9f11c | [
"Apache-2.0"
] | 46 | 2017-01-23T07:35:10.000Z | 2021-12-26T13:52:19.000Z | #!/usr/bin/env python2
# -*- coding: utf-8 -*-
# File: expreplay.py
# Author: Yuxin Wu <ppwwyyxxc@gmail.com>
import numpy as np
from collections import deque, namedtuple
import threading
from tqdm import tqdm
import six
from six.moves import queue
from ..dataflow import DataFlow
from ..utils import *
from ..utils.con... | 38.126638 | 98 | 0.593746 |
import numpy as np
from collections import deque, namedtuple
import threading
from tqdm import tqdm
import six
from six.moves import queue
from ..dataflow import DataFlow
from ..utils import *
from ..utils.concurrency import LoopThread
from ..callbacks.base import Callback
__all__ = ['ExpReplay']
Experience = named... | true | true |
f730f172a583af4fe7d0cf23626ad4bacc89fb28 | 12,835 | py | Python | tests/plugins/test_plugins_manager.py | raspberryfield/airflow | 3eb67af7a3fab61b7f691da66129c228af27d95e | [
"Apache-2.0",
"BSD-2-Clause",
"MIT",
"ECL-2.0",
"BSD-3-Clause"
] | 3 | 2021-07-30T16:46:46.000Z | 2021-10-19T07:18:47.000Z | tests/plugins/test_plugins_manager.py | raspberryfield/airflow | 3eb67af7a3fab61b7f691da66129c228af27d95e | [
"Apache-2.0",
"BSD-2-Clause",
"MIT",
"ECL-2.0",
"BSD-3-Clause"
] | 6 | 2019-03-16T02:09:30.000Z | 2019-06-27T03:27:34.000Z | tests/plugins/test_plugins_manager.py | raspberryfield/airflow | 3eb67af7a3fab61b7f691da66129c228af27d95e | [
"Apache-2.0",
"BSD-2-Clause",
"MIT",
"ECL-2.0",
"BSD-3-Clause"
] | 1 | 2021-05-12T13:17:37.000Z | 2021-05-12T13:17:37.000Z | #
# Licensed to the Apache Software Foundation (ASF) under one
# or more contributor license agreements. See the NOTICE file
# distributed with this work for additional information
# regarding copyright ownership. The ASF licenses this file
# to you under the Apache License, Version 2.0 (the
# "License"); you may not... | 40.109375 | 109 | 0.67651 | import importlib
import logging
import sys
import unittest
from unittest import mock
from airflow.hooks.base import BaseHook
from airflow.plugins_manager import AirflowPlugin
from airflow.www import app as application
from tests.test_utils.mock_plugins import mock_plugin_manager
py39 = sys.version_info >= (3, 9)
impo... | true | true |
f730f299d4453e3f89f5e91f3e64c62d116cabde | 1,003 | py | Python | person/management/commands/run_person_connector.py | AlenaYanish/Data_converter | dbeeb5c135de7f2d74dff9260a4080e7f07727f6 | [
"MIT"
] | null | null | null | person/management/commands/run_person_connector.py | AlenaYanish/Data_converter | dbeeb5c135de7f2d74dff9260a4080e7f07727f6 | [
"MIT"
] | null | null | null | person/management/commands/run_person_connector.py | AlenaYanish/Data_converter | dbeeb5c135de7f2d74dff9260a4080e7f07727f6 | [
"MIT"
] | null | null | null | from django.core.management.base import BaseCommand, CommandError
from data_ocean.command_progress import CommandProgress
from data_ocean.savepoint import Savepoint
from person.controllers import ConnectorsController, SOURCES
class Command(BaseCommand):
help = '---'
def add_arguments(self, parser):
p... | 34.586207 | 91 | 0.663011 | from django.core.management.base import BaseCommand, CommandError
from data_ocean.command_progress import CommandProgress
from data_ocean.savepoint import Savepoint
from person.controllers import ConnectorsController, SOURCES
class Command(BaseCommand):
help = '---'
def add_arguments(self, parser):
p... | true | true |
f730f358f211cb3b98b0df17cabeb3129381fe6a | 4,840 | py | Python | nikola/plugins/task_render_posts.py | kotnik/nikola | d08ed98b1b9bf7cbdabf06a18b51a3acdb745625 | [
"MIT"
] | null | null | null | nikola/plugins/task_render_posts.py | kotnik/nikola | d08ed98b1b9bf7cbdabf06a18b51a3acdb745625 | [
"MIT"
] | null | null | null | nikola/plugins/task_render_posts.py | kotnik/nikola | d08ed98b1b9bf7cbdabf06a18b51a3acdb745625 | [
"MIT"
] | null | null | null | # -*- coding: utf-8 -*-
# Copyright © 2012-2013 Roberto Alsina and others.
# Permission is hereby granted, free of charge, to any
# person obtaining a copy of this software and associated
# documentation files (the "Software"), to deal in the
# Software without restriction, including without limitation
# the rights t... | 33.846154 | 93 | 0.568595 |
from copy import copy
import codecs
import string
from nikola.plugin_categories import Task
from nikola import utils, rc4
def wrap_encrypt(path, password):
with codecs.open(path, 'rb+', 'utf8') as inf:
data = inf.read() + "<!--tail-->"
data = CRYPT.substitute(data=rc4.rc4(password, data))
with... | true | true |
f730f40810a9ab1ca74ee1b70e362abf40ace529 | 3,700 | py | Python | Visualize.py | BlindBMan/Facial-Recognition | 1f0c65174de2223a81797fee7722227a712a37bc | [
"MIT"
] | null | null | null | Visualize.py | BlindBMan/Facial-Recognition | 1f0c65174de2223a81797fee7722227a712a37bc | [
"MIT"
] | null | null | null | Visualize.py | BlindBMan/Facial-Recognition | 1f0c65174de2223a81797fee7722227a712a37bc | [
"MIT"
] | null | null | null | import cv2 as cv
import os
import numpy as np
import pdb
import ntpath
import glob
from Parameters import *
def show_detections_without_ground_truth(detections, scores, file_names, params: Parameters):
"""
Afiseaza si salveaza imaginile adnotate.
detections: numpy array de dimensiune NX4, unde N este numa... | 48.684211 | 137 | 0.699189 | import cv2 as cv
import os
import numpy as np
import pdb
import ntpath
import glob
from Parameters import *
def show_detections_without_ground_truth(detections, scores, file_names, params: Parameters):
test_images_path = os.path.join(params.dir_test_examples, '*.jpg')
test_files = glob.glob(test_images_path)
... | true | true |
f730f477cc08bbd4b7ffa1a11537af10fd058b92 | 1,852 | py | Python | couch/setup.py | brentm5/integrations-core | 5cac8788c95d8820435ef9c5d32d6a5463cf491d | [
"BSD-3-Clause"
] | 4 | 2021-06-21T19:21:49.000Z | 2021-06-23T21:21:55.000Z | couch/setup.py | brentm5/integrations-core | 5cac8788c95d8820435ef9c5d32d6a5463cf491d | [
"BSD-3-Clause"
] | null | null | null | couch/setup.py | brentm5/integrations-core | 5cac8788c95d8820435ef9c5d32d6a5463cf491d | [
"BSD-3-Clause"
] | 1 | 2021-06-21T19:21:51.000Z | 2021-06-21T19:21:51.000Z | # (C) Datadog, Inc. 2018
# All rights reserved
# Licensed under a 3-clause BSD style license (see LICENSE)
# Always prefer setuptools over distutils
from setuptools import setup
# To use a consistent encoding
from codecs import open
from os import path
HERE = path.abspath(path.dirname(__file__))
# Get the long descr... | 27.235294 | 75 | 0.682505 |
from setuptools import setup
from codecs import open
from os import path
HERE = path.abspath(path.dirname(__file__))
with open(path.join(HERE, 'README.md'), encoding='utf-8') as f:
long_description = f.read()
ABOUT = {}
with open(path.join(HERE, "datadog_checks", "couch", "__about__.py")) as f:
exec(f.read(... | true | true |
f730f49df8a3829de88cd50a3529de49a0e5a694 | 691 | py | Python | FirstStepsInPython/Basics/Exams/exam_22_may_2021/04. Computer Firm.py | Pittor052/SoftUni-Studies | 1ee6341082f6ccfa45b3e82824c37722bcf2fb31 | [
"MIT"
] | null | null | null | FirstStepsInPython/Basics/Exams/exam_22_may_2021/04. Computer Firm.py | Pittor052/SoftUni-Studies | 1ee6341082f6ccfa45b3e82824c37722bcf2fb31 | [
"MIT"
] | null | null | null | FirstStepsInPython/Basics/Exams/exam_22_may_2021/04. Computer Firm.py | Pittor052/SoftUni-Studies | 1ee6341082f6ccfa45b3e82824c37722bcf2fb31 | [
"MIT"
] | 1 | 2021-10-07T18:30:42.000Z | 2021-10-07T18:30:42.000Z | computers = int ( input () )
total_computers = computers
total_rating = 0
total_sales = 0
while not computers == 0:
command = int ( input () )
possible_sales = 0
last_digit = command % 10
first_two_digits = command // 10
rating = last_digit
if rating == 3:
possible_sales = first_two_digi... | 28.791667 | 48 | 0.652677 | computers = int ( input () )
total_computers = computers
total_rating = 0
total_sales = 0
while not computers == 0:
command = int ( input () )
possible_sales = 0
last_digit = command % 10
first_two_digits = command // 10
rating = last_digit
if rating == 3:
possible_sales = first_two_digi... | true | true |
f730f61c0558a354a0cd7c399108c3d7b08479b3 | 4,692 | py | Python | Tools/SeeDot/seedot/predictor.py | krantikiran/EdgeML | e5c7bd7c56884ca61f6d54cedb0074553cfdc896 | [
"MIT"
] | 1 | 2020-03-26T17:19:54.000Z | 2020-03-26T17:19:54.000Z | Tools/SeeDot/seedot/predictor.py | krantikiran/EdgeML | e5c7bd7c56884ca61f6d54cedb0074553cfdc896 | [
"MIT"
] | 2 | 2020-03-26T02:59:12.000Z | 2020-04-23T19:09:00.000Z | Tools/SeeDot/seedot/predictor.py | krantikiran/EdgeML | e5c7bd7c56884ca61f6d54cedb0074553cfdc896 | [
"MIT"
] | 3 | 2020-03-25T18:45:39.000Z | 2020-12-17T19:09:54.000Z | # Copyright (c) Microsoft Corporation. All rights reserved.
# Licensed under the MIT license.
import os
import subprocess
import seedot.config as config
import seedot.util as Util
# Program to build and run the predictor project using msbuild
# The accuracy and other statistics are written to the output file specifi... | 29.509434 | 82 | 0.563725 |
import os
import subprocess
import seedot.config as config
import seedot.util as Util
class Predictor:
def __init__(self, algo, version, datasetType, outputDir, scaleForX):
self.algo, self.version, self.datasetType = algo, version, datasetType
self.outputDir = outputDir
os.makedirs(se... | true | true |
f730f62a1e645556614119a1ae7ca46137ef0109 | 16,444 | py | Python | lib/python3.8/site-packages/ansible_collections/cisco/iosxr/plugins/modules/iosxr_lldp_interfaces.py | cjsteel/python3-venv-ansible-2.10.5 | c95395c4cae844dc66fddde9b4343966f4b2ecd5 | [
"Apache-1.1"
] | null | null | null | lib/python3.8/site-packages/ansible_collections/cisco/iosxr/plugins/modules/iosxr_lldp_interfaces.py | cjsteel/python3-venv-ansible-2.10.5 | c95395c4cae844dc66fddde9b4343966f4b2ecd5 | [
"Apache-1.1"
] | null | null | null | lib/python3.8/site-packages/ansible_collections/cisco/iosxr/plugins/modules/iosxr_lldp_interfaces.py | cjsteel/python3-venv-ansible-2.10.5 | c95395c4cae844dc66fddde9b4343966f4b2ecd5 | [
"Apache-1.1"
] | null | null | null | #!/usr/bin/python
# -*- coding: utf-8 -*-
# Copyright 2019 Red Hat
# GNU General Public License v3.0+
# (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt)
#############################################
# WARNING #
#############################################
#
# This file is au... | 22.681379 | 135 | 0.580151 |
from __future__ import absolute_import, division, print_function
__metaclass__ = type
DOCUMENTATION = """
module: iosxr_lldp_interfaces
short_description: LLDP interfaces resource module
description:
- This module manages Link Layer Discovery Protocol (LLDP) attributes of interfaces
on IOS-XR devices.
version_a... | true | true |
f730f63d759dc5797a07be61282a64af7a309b97 | 1,495 | py | Python | pool/models/move_to_origin.py | VisualMine/PlaneNet | a4327f0233dd3a5c4de375c2857402d28b308230 | [
"MIT"
] | 372 | 2018-03-27T23:26:38.000Z | 2022-03-30T02:58:51.000Z | pool/models/move_to_origin.py | Piratelhx/PlaneNet | 88eb76d88bb678bd26b7f101f0bb273e4897e92d | [
"MIT"
] | 38 | 2018-04-17T02:03:23.000Z | 2022-02-17T07:44:28.000Z | pool/models/move_to_origin.py | Piratelhx/PlaneNet | 88eb76d88bb678bd26b7f101f0bb273e4897e92d | [
"MIT"
] | 90 | 2018-03-27T13:47:17.000Z | 2022-03-16T03:22:27.000Z | import csv
import sys
import numpy as np
with open(sys.argv[1]) as modelFile:
modelLoader = csv.reader(modelFile, delimiter=' ')
xs = []
ys = []
zs = []
for lineIndex, line in enumerate(modelLoader):
if len(line) == 0:
continue
if line[0] == 'v':
xs.a... | 25.338983 | 74 | 0.53311 | import csv
import sys
import numpy as np
with open(sys.argv[1]) as modelFile:
modelLoader = csv.reader(modelFile, delimiter=' ')
xs = []
ys = []
zs = []
for lineIndex, line in enumerate(modelLoader):
if len(line) == 0:
continue
if line[0] == 'v':
xs.a... | true | true |
f730f66e6200f2f186c044ebd1d89110eb96e4d6 | 1,179 | py | Python | FlaskRESTFULAPITest_JE/venv/Lib/site-packages/itsdangerous/_compat.py | JE-Chen/je_old_repo | a8b2f1ac2eec25758bd15b71c64b59b27e0bcda5 | [
"MIT"
] | 2 | 2022-01-06T11:52:57.000Z | 2022-01-09T01:53:56.000Z | FlaskRESTFULAPITest_JE/venv/Lib/site-packages/itsdangerous/_compat.py | JE-Chen/je_old_repo | a8b2f1ac2eec25758bd15b71c64b59b27e0bcda5 | [
"MIT"
] | null | null | null | FlaskRESTFULAPITest_JE/venv/Lib/site-packages/itsdangerous/_compat.py | JE-Chen/je_old_repo | a8b2f1ac2eec25758bd15b71c64b59b27e0bcda5 | [
"MIT"
] | null | null | null | import decimal
import hmac
import numbers
import sys
PY2 = sys.version_info[0] == 2
if PY2:
from itertools import izip
text_type = unicode # noqa: 821
else:
izip = zip
text_type = str
number_types = (numbers.Real, decimal.Decimal)
def _constant_time_compare(val1, val2):
"""... | 25.085106 | 80 | 0.645462 | import decimal
import hmac
import numbers
import sys
PY2 = sys.version_info[0] == 2
if PY2:
from itertools import izip
text_type = unicode else:
izip = zip
text_type = str
number_types = (numbers.Real, decimal.Decimal)
def _constant_time_compare(val1, val2):
len_eq = len(val... | true | true |
f730f6f1c65f95e6079be44f28f2c5b909f64b71 | 1,999 | py | Python | flagging_site/data/_store/refresh.py | danivalades/flagging | b1a097594e9b7d9e101edef9bb6abf98a333383c | [
"MIT"
] | null | null | null | flagging_site/data/_store/refresh.py | danivalades/flagging | b1a097594e9b7d9e101edef9bb6abf98a333383c | [
"MIT"
] | null | null | null | flagging_site/data/_store/refresh.py | danivalades/flagging | b1a097594e9b7d9e101edef9bb6abf98a333383c | [
"MIT"
] | null | null | null | """The data store contains offline versions of the data so that you can run a
demo version of the website without the vault keys, or simply develop parts of
the website that don't require actively updated data without having to worry.
This data is used for the actual website when the `USE_MOCK_DATA` config
variable is... | 37.018519 | 79 | 0.737869 | import os
import sys
from typing import Optional
import click
DATA_STORE_PATH = os.path.dirname(__file__)
@click.command()
@click.option('--vault_password',
prompt=True,
default=lambda: os.environ.get('VAULT_PASSWORD', None))
def refresh_data_store(vault_password: Optional[str] = None) ->... | true | true |
f730f74e730a3d369e068ece021021184632f611 | 5,546 | py | Python | src/pyscaffold/exceptions.py | CarliJoy/pyscaffold | 6e6f8779c4a20fbab81b72c6a12716c877d8c062 | [
"MIT"
] | null | null | null | src/pyscaffold/exceptions.py | CarliJoy/pyscaffold | 6e6f8779c4a20fbab81b72c6a12716c877d8c062 | [
"MIT"
] | null | null | null | src/pyscaffold/exceptions.py | CarliJoy/pyscaffold | 6e6f8779c4a20fbab81b72c6a12716c877d8c062 | [
"MIT"
] | null | null | null | """
Functions for exception manipulation + custom exceptions used by PyScaffold to identify
common deviations from the expected behavior.
"""
import functools
import logging
import sys
import traceback
from typing import Optional, cast
if sys.version_info[:2] >= (3, 8):
# TODO: Import directly (no need for conditi... | 31.691429 | 87 | 0.671114 | import functools
import logging
import sys
import traceback
from typing import Optional, cast
if sys.version_info[:2] >= (3, 8):
from importlib.metadata import EntryPoint else:
from importlib_metadata import EntryPoint
from . import __version__ as pyscaffold_version
def exceptions2exit(exception_list)... | true | true |
f730f8239795450f1ada30cddacbcdbea7bc8310 | 4,465 | py | Python | test/functional/wallet_keypool_topup.py | t-bast/bitcoin | 42fedb4acd3cfa813059fcc3f96b2a41f78d9074 | [
"MIT"
] | 213 | 2015-01-25T19:45:22.000Z | 2022-02-24T22:48:03.000Z | test/functional/wallet_keypool_topup.py | t-bast/bitcoin | 42fedb4acd3cfa813059fcc3f96b2a41f78d9074 | [
"MIT"
] | 51 | 2019-11-03T04:00:14.000Z | 2022-03-30T07:17:34.000Z | test/functional/wallet_keypool_topup.py | t-bast/bitcoin | 42fedb4acd3cfa813059fcc3f96b2a41f78d9074 | [
"MIT"
] | 47 | 2018-08-03T04:55:45.000Z | 2022-03-10T07:50:31.000Z | #!/usr/bin/env python3
# Copyright (c) 2017-2020 The Bitcoin Core developers
# Distributed under the MIT software license, see the accompanying
# file COPYING or http://www.opensource.org/licenses/mit-license.php.
"""Test HD Wallet keypool restore function.
Two nodes. Node1 is under test. Node0 is providing transactio... | 47 | 164 | 0.657783 | import os
import shutil
from test_framework.blocktools import COINBASE_MATURITY
from test_framework.test_framework import BitcoinTestFramework
from test_framework.util import (
assert_equal,
)
class KeypoolRestoreTest(BitcoinTestFramework):
def set_test_params(self):
self.setup_clean_chain = True
... | true | true |
f730f8777658d70018bebdae1f628b30914e95b6 | 14,193 | py | Python | tests/workflows/test_imaging_component_workflows.py | mfarrera/algorithm-reference-library | 7331812aa7cc3501a15d3392cecf6ea65b43f91e | [
"Apache-2.0"
] | null | null | null | tests/workflows/test_imaging_component_workflows.py | mfarrera/algorithm-reference-library | 7331812aa7cc3501a15d3392cecf6ea65b43f91e | [
"Apache-2.0"
] | null | null | null | tests/workflows/test_imaging_component_workflows.py | mfarrera/algorithm-reference-library | 7331812aa7cc3501a15d3392cecf6ea65b43f91e | [
"Apache-2.0"
] | null | null | null | """ Unit tests for pipelines expressed via dask.delayed
"""
import logging
import sys
import unittest
import numpy
from astropy import units as u
from astropy.coordinates import SkyCoord
from data_models.polarisation import PolarisationFrame
from processing_components.image.operations import export_image_to_fits, ... | 47.949324 | 141 | 0.606989 |
import logging
import sys
import unittest
import numpy
from astropy import units as u
from astropy.coordinates import SkyCoord
from data_models.polarisation import PolarisationFrame
from processing_components.image.operations import export_image_to_fits, smooth_image
from processing_components.imaging.base import pr... | true | true |
f730f92c5485f29626ae1c7b418475779522b722 | 1,420 | py | Python | channel.py | michael-riess/language-proctor-bot | 86eb22e298a86ecd79e484c7a3ece2797fe5f027 | [
"MIT"
] | null | null | null | channel.py | michael-riess/language-proctor-bot | 86eb22e298a86ecd79e484c7a3ece2797fe5f027 | [
"MIT"
] | 1 | 2021-03-03T12:37:20.000Z | 2021-03-03T15:37:28.000Z | channel.py | michael-riess/language-proctor-bot | 86eb22e298a86ecd79e484c7a3ece2797fe5f027 | [
"MIT"
] | null | null | null | from replit import db
from locales import locales
# ========================================================
# Posts message to discord channel (translated according to channel)
# ========================================================
async def say(channel, message, arguments=None):
message = locales.get(get_chann... | 35.5 | 68 | 0.445775 | from replit import db
from locales import locales
async def say(channel, message, arguments=None):
message = locales.get(get_channel_lang(channel.id), message)
if arguments is not None:
await channel.send(message.format(*arguments))
else:
await channel.send(message)
def set_channel_lang(channel, code):
... | true | true |
f730fa6f7583c67acbf528ee804850ee2c0663f1 | 1,663 | py | Python | modules/demo/ipc/graph/fa2.py | mzegar/node-rapids | 5b2c3dafbec5f17dcedf8147a8f668a986622cc4 | [
"Apache-2.0"
] | 39 | 2021-08-04T17:30:03.000Z | 2022-03-27T18:20:05.000Z | modules/demo/ipc/graph/fa2.py | love-lena/node-rapids | 27c9e2468372df4fae3779d859089b54c8d32c4f | [
"Apache-2.0"
] | 77 | 2021-03-12T18:04:01.000Z | 2021-08-02T20:07:24.000Z | modules/demo/ipc/graph/fa2.py | love-lena/node-rapids | 27c9e2468372df4fae3779d859089b54c8d32c4f | [
"Apache-2.0"
] | 7 | 2021-03-12T19:42:40.000Z | 2021-07-27T21:57:26.000Z | # Copyright (c) 2020-2021, NVIDIA CORPORATION.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agre... | 29.696429 | 74 | 0.708358 |
import warnings
warnings.filterwarnings("ignore", category=UserWarning)
warnings.filterwarnings("ignore", category=DeprecationWarning)
import python.test_data as datasets
from python.callback import GraphZmqCallback
import zmq
import cudf
import cugraph
import asyncio
import zmq.asyncio
graph, nodes, edges = datas... | true | true |
f730fa84e14eb5fbcbc033f780025ae0e6b55f8c | 2,664 | py | Python | facebook_business/adobjects/lookalikespec.py | MyrikLD/facebook-python-business-sdk | a53c8ba0e8f7d0b41b385c60089f6ba00fa5c814 | [
"CNRI-Python"
] | 576 | 2018-05-01T19:09:32.000Z | 2022-03-31T11:45:11.000Z | facebook_business/adobjects/lookalikespec.py | MyrikLD/facebook-python-business-sdk | a53c8ba0e8f7d0b41b385c60089f6ba00fa5c814 | [
"CNRI-Python"
] | 217 | 2018-05-03T07:31:59.000Z | 2022-03-29T14:19:52.000Z | facebook_business/adobjects/lookalikespec.py | MyrikLD/facebook-python-business-sdk | a53c8ba0e8f7d0b41b385c60089f6ba00fa5c814 | [
"CNRI-Python"
] | 323 | 2018-05-01T20:32:26.000Z | 2022-03-29T07:05:12.000Z | # Copyright 2014 Facebook, Inc.
# You are hereby granted a non-exclusive, worldwide, royalty-free license to
# use, copy, modify, and distribute this software in source code or binary
# form for use in connection with the web services and APIs provided by
# Facebook.
# As with any software that integrates with the Fa... | 36 | 79 | 0.704204 |
from facebook_business.adobjects.abstractobject import AbstractObject
class LookalikeSpec(
AbstractObject,
):
def __init__(self, api=None):
super(LookalikeSpec, self).__init__()
self._isLookalikeSpec = True
self._api = api
class Field(AbstractObject.Field):
country = ... | true | true |
f730fbd03f80351c68af026f82203af4a85f5514 | 421 | py | Python | sphinxnotes/snippet/builder.py | sphinx-notes/khufu | 4225086f0e5d7d8262598d755a5f19e8ad4ebbba | [
"BSD-3-Clause"
] | 1 | 2021-02-28T12:18:23.000Z | 2021-02-28T12:18:23.000Z | sphinxnotes/snippet/builder.py | sphinx-notes/khufu | 4225086f0e5d7d8262598d755a5f19e8ad4ebbba | [
"BSD-3-Clause"
] | 10 | 2021-02-28T08:54:00.000Z | 2022-01-16T05:17:03.000Z | sphinxnotes/snippet/builder.py | sphinx-notes/khufu | 4225086f0e5d7d8262598d755a5f19e8ad4ebbba | [
"BSD-3-Clause"
] | 1 | 2021-12-24T11:34:15.000Z | 2021-12-24T11:34:15.000Z | """
sphinxnotes.snippet.builder
~~~~~~~~~~~~~~~~~~~~~~~~~~~
Dummy builder for triggering extension.
:copyright: Copyright 2021 Shengyu Zhang.
:license: BSD, see LICENSE for details.
"""
from sphinx.builders.dummy import DummyBuilder
from sphinx.locale import __
class Builder(DummyBuilder):
... | 23.388889 | 83 | 0.67696 |
from sphinx.builders.dummy import DummyBuilder
from sphinx.locale import __
class Builder(DummyBuilder):
name = 'snippet'
epilog = __('The snippet builder is a dummy builder for triggering extension.')
| true | true |
f730fd394f2382010c04a8a3319d21739e722bf6 | 252 | py | Python | linear-search-ordered.py | vaibhavmule/PythonExercise | 5b32d8db5290db5ced2c8730191fd73936d4c3d4 | [
"MIT"
] | null | null | null | linear-search-ordered.py | vaibhavmule/PythonExercise | 5b32d8db5290db5ced2c8730191fd73936d4c3d4 | [
"MIT"
] | null | null | null | linear-search-ordered.py | vaibhavmule/PythonExercise | 5b32d8db5290db5ced2c8730191fd73936d4c3d4 | [
"MIT"
] | null | null | null | foo = [1, 2, 3, 4, 6, 9, 10]
def search(arr, item):
for i in arr:
if i == item:
return True
elif i > item:
return False
return False
print(search(foo, 5))
print(search(foo, 9))
print(search(foo, 20))
| 15.75 | 28 | 0.515873 | foo = [1, 2, 3, 4, 6, 9, 10]
def search(arr, item):
for i in arr:
if i == item:
return True
elif i > item:
return False
return False
print(search(foo, 5))
print(search(foo, 9))
print(search(foo, 20))
| true | true |
f730fe3ff4f0f24911ddbed8aa3feac509e8a169 | 3,707 | py | Python | lib/rucio/tests/mock/fts3.py | brianv0/rucio | 127a36fd53e5b4d9eb14ab02fe6c36443d78bfd0 | [
"Apache-2.0"
] | null | null | null | lib/rucio/tests/mock/fts3.py | brianv0/rucio | 127a36fd53e5b4d9eb14ab02fe6c36443d78bfd0 | [
"Apache-2.0"
] | null | null | null | lib/rucio/tests/mock/fts3.py | brianv0/rucio | 127a36fd53e5b4d9eb14ab02fe6c36443d78bfd0 | [
"Apache-2.0"
] | null | null | null | # Copyright European Organization for Nuclear Research (CERN)
#
# 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
#
# Authors:
# - Mario Lassnig, <mario... | 32.80531 | 149 | 0.677367 |
import datetime
import random
import time
from sqlalchemy import and_, or_
from rucio.common.utils import generate_uuid
from rucio.core.monitor import record_counter, record_timer
from rucio.db.sqla import test_models
from rucio.db.sqla.constants import FTSState
from rucio.db.sqla.session import read_session, transa... | true | true |
f730ff473e3acc560575f38f17d8a90a26b95e0f | 1,191 | py | Python | mainsite/models/link_note.py | xjlin0/attendee | 6f0f3bfd64b2c6410af18823cd423d71a2ca59c7 | [
"MIT"
] | 2 | 2019-08-26T09:16:09.000Z | 2019-11-04T15:07:06.000Z | mainsite/models/link_note.py | xjlin0/attendee | 6f0f3bfd64b2c6410af18823cd423d71a2ca59c7 | [
"MIT"
] | null | null | null | mainsite/models/link_note.py | xjlin0/attendee | 6f0f3bfd64b2c6410af18823cd423d71a2ca59c7 | [
"MIT"
] | null | null | null | from django.db import models
from django.contrib.contenttypes.fields import GenericForeignKey
from django.contrib.contenttypes.models import ContentType
from . import RecordStatusEnum
class LinkNote(models.Model):
id = models.BigAutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')
... | 42.535714 | 140 | 0.751469 | from django.db import models
from django.contrib.contenttypes.fields import GenericForeignKey
from django.contrib.contenttypes.models import ContentType
from . import RecordStatusEnum
class LinkNote(models.Model):
id = models.BigAutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')
... | true | true |
f73102329030fad1a68ba5bb5eb01f8d626f5c90 | 2,780 | py | Python | data/cirq_new/cirq_program/startCirq_pragma440.py | UCLA-SEAL/QDiff | d968cbc47fe926b7f88b4adf10490f1edd6f8819 | [
"BSD-3-Clause"
] | null | null | null | data/cirq_new/cirq_program/startCirq_pragma440.py | UCLA-SEAL/QDiff | d968cbc47fe926b7f88b4adf10490f1edd6f8819 | [
"BSD-3-Clause"
] | null | null | null | data/cirq_new/cirq_program/startCirq_pragma440.py | UCLA-SEAL/QDiff | d968cbc47fe926b7f88b4adf10490f1edd6f8819 | [
"BSD-3-Clause"
] | null | null | null | #!/usr/bin/env python
# -*- coding: utf-8 -*-
# @Time : 5/15/20 4:49 PM
# @File : grover.py
# qubit number=4
# total number=20
import cirq
import cirq.google as cg
from typing import Optional
import sys
from math import log2
import numpy as np
class Opty(cirq.PointOptimizer):
def optimization_at(
... | 33.095238 | 92 | 0.646043 |
import cirq
import cirq.google as cg
from typing import Optional
import sys
from math import log2
import numpy as np
class Opty(cirq.PointOptimizer):
def optimization_at(
self,
circuit: 'cirq.Circuit',
index: int,
op: 'cirq.Operation'
) -> Optional[cirq.PointOpti... | true | true |
f731026b4115633e600f543fa4ca1b692d3b160d | 8,578 | py | Python | mjrl/algos/model_accel/sampling.py | YujieLu10/tslam | 1341dbecdf02ee6b1b6cdd1a538272fffdea6ffd | [
"Apache-2.0"
] | null | null | null | mjrl/algos/model_accel/sampling.py | YujieLu10/tslam | 1341dbecdf02ee6b1b6cdd1a538272fffdea6ffd | [
"Apache-2.0"
] | null | null | null | mjrl/algos/model_accel/sampling.py | YujieLu10/tslam | 1341dbecdf02ee6b1b6cdd1a538272fffdea6ffd | [
"Apache-2.0"
] | null | null | null | import logging
import numpy as np
from mjrl.utils.gym_env import GymEnv
from mjrl.utils import tensor_utils
logging.disable(logging.CRITICAL)
import multiprocessing as mp
from multiprocessing import set_start_method
try:
set_start_method('spawn')
except RuntimeError:
pass
import time as timer
import torch
loggi... | 31.653137 | 104 | 0.551877 | import logging
import numpy as np
from mjrl.utils.gym_env import GymEnv
from mjrl.utils import tensor_utils
logging.disable(logging.CRITICAL)
import multiprocessing as mp
from multiprocessing import set_start_method
try:
set_start_method('spawn')
except RuntimeError:
pass
import time as timer
import torch
loggi... | true | true |
f7310364126b99c5b9600e09110e9f438c281858 | 3,594 | py | Python | tests/test_fast/test_timeout.py | ponty/EasyProcess | 4b3f5ab487ec46133e361958d6061262bfad91c3 | [
"BSD-2-Clause"
] | 86 | 2015-02-17T11:41:18.000Z | 2022-03-05T08:05:29.000Z | tests/test_fast/test_timeout.py | ponty/EasyProcess | 4b3f5ab487ec46133e361958d6061262bfad91c3 | [
"BSD-2-Clause"
] | 18 | 2015-02-11T21:03:13.000Z | 2022-03-20T14:32:51.000Z | tests/test_fast/test_timeout.py | ponty/EasyProcess | 4b3f5ab487ec46133e361958d6061262bfad91c3 | [
"BSD-2-Clause"
] | 22 | 2015-02-11T20:47:00.000Z | 2021-11-01T15:26:23.000Z | import sys
import time
import pytest
from easyprocess import EasyProcess
python = sys.executable
def test_timeout():
p = EasyProcess("sleep 1").start()
p.wait(0.2)
assert p.is_alive()
p.wait(0.2)
assert p.is_alive()
p.wait(2)
assert not p.is_alive()
assert EasyProcess("sleep 0.3").... | 27.022556 | 148 | 0.664162 | import sys
import time
import pytest
from easyprocess import EasyProcess
python = sys.executable
def test_timeout():
p = EasyProcess("sleep 1").start()
p.wait(0.2)
assert p.is_alive()
p.wait(0.2)
assert p.is_alive()
p.wait(2)
assert not p.is_alive()
assert EasyProcess("sleep 0.3").... | true | true |
f73103cefcd8b17fc9dcdef65d4a5a5b4f9acc4f | 695 | py | Python | src/api/tests/test_profile_views.py | ThaDeveloper/grind | fa90b65d12e6d9b3d658b132874801ecda08c57f | [
"MIT"
] | 1 | 2019-11-06T22:26:26.000Z | 2019-11-06T22:26:26.000Z | src/api/tests/test_profile_views.py | ThaDeveloper/grind | fa90b65d12e6d9b3d658b132874801ecda08c57f | [
"MIT"
] | 5 | 2021-03-19T02:49:44.000Z | 2021-06-10T19:13:00.000Z | src/api/tests/test_profile_views.py | ThaDeveloper/grind | fa90b65d12e6d9b3d658b132874801ecda08c57f | [
"MIT"
] | null | null | null | from api.tests.base import BaseTestCase
class TestUserViews(BaseTestCase):
""" Test Profile views """
def test_get_profile(self):
""" Test can get single user profile """
self.create_user(self.new_user)
response = self.test_client().get('/api/v1/accounts/baduism/profile/')
self... | 36.578947 | 78 | 0.657554 | from api.tests.base import BaseTestCase
class TestUserViews(BaseTestCase):
def test_get_profile(self):
self.create_user(self.new_user)
response = self.test_client().get('/api/v1/accounts/baduism/profile/')
self.assertEqual(200, response.status_code)
self.assertIn("baduism", str(res... | true | true |
f73103d5420139f7c03250e39dd0213ce905d5f1 | 80 | py | Python | Python/01. Introduction/002. Python If-Else.py | stonehengee/HackerrankPractice | ec052e7447391e40d1919cf0b641ff5023da3da3 | [
"MIT"
] | null | null | null | Python/01. Introduction/002. Python If-Else.py | stonehengee/HackerrankPractice | ec052e7447391e40d1919cf0b641ff5023da3da3 | [
"MIT"
] | null | null | null | Python/01. Introduction/002. Python If-Else.py | stonehengee/HackerrankPractice | ec052e7447391e40d1919cf0b641ff5023da3da3 | [
"MIT"
] | null | null | null | # Problem: https://www.hackerrank.com/challenges/py-if-else/problem
# Score: 10
| 26.666667 | 67 | 0.75 | true | true | |
f731070f8dc603977540d4cf5cd5175788bed0e5 | 2,389 | py | Python | src/data_layers/ffeedbackcm100k_layer.py | emiliocuestaf/CycloRec | cf0bf39ff185f0b1ef8d1c6fe1d424a23c7716f7 | [
"MIT"
] | 3 | 2021-01-26T06:05:17.000Z | 2021-02-11T21:47:09.000Z | src/data_layers/ffeedbackcm100k_layer.py | emiliocuestaf/CycloRec | cf0bf39ff185f0b1ef8d1c6fe1d424a23c7716f7 | [
"MIT"
] | null | null | null | src/data_layers/ffeedbackcm100k_layer.py | emiliocuestaf/CycloRec | cf0bf39ff185f0b1ef8d1c6fe1d424a23c7716f7 | [
"MIT"
] | 1 | 2021-01-26T06:05:18.000Z | 2021-01-26T06:05:18.000Z | import pandas as pd
import numpy as np
#import random as rd
#from sklearn.neighbors import NearestNeighbors
#from scipy.sparse import csr_matrix
# OWN
from cyclorec.data_layers.data_layer import DataLayer
class FFeedbackCm100kLayer(DataLayer):
""" The only difference between this layer and Cm100kLayer is the feed... | 38.532258 | 130 | 0.626622 | import pandas as pd
import numpy as np
from cyclorec.data_layers.data_layer import DataLayer
class FFeedbackCm100kLayer(DataLayer):
def __init__(self, name, test_proportion):
rating_normalization = 'bin'
if rating_normalization == 'bin':
rating_conversor = dict({1: 0, 2: 0... | true | true |
f7310722bb4f9358a5e09b900096f1971cd0392f | 1,999 | py | Python | dask/cache.py | dgerlanc/dask | 627b2bc7bca9e86d938767056bc001f819824335 | [
"BSD-3-Clause"
] | 2 | 2020-11-30T14:04:19.000Z | 2021-11-08T11:29:07.000Z | dask/cache.py | dgerlanc/dask | 627b2bc7bca9e86d938767056bc001f819824335 | [
"BSD-3-Clause"
] | 37 | 2020-10-20T08:30:53.000Z | 2020-12-22T13:15:45.000Z | dask/cache.py | dgerlanc/dask | 627b2bc7bca9e86d938767056bc001f819824335 | [
"BSD-3-Clause"
] | 1 | 2019-01-31T02:44:12.000Z | 2019-01-31T02:44:12.000Z | from .callbacks import Callback
from timeit import default_timer
from numbers import Number
import sys
overhead = sys.getsizeof(1.23) * 4 + sys.getsizeof(()) * 4
class Cache(Callback):
"""Use cache for computation
Examples
--------
>>> cache = Cache(1e9) # doctest: +SKIP
The cache can... | 30.287879 | 87 | 0.578789 | from .callbacks import Callback
from timeit import default_timer
from numbers import Number
import sys
overhead = sys.getsizeof(1.23) * 4 + sys.getsizeof(()) * 4
class Cache(Callback):
def __init__(self, cache, *args, **kwargs):
try:
import cachey
except ImportError as ex:
... | true | true |
f73108a0572bbd0f825ddaada87e96d987ccfd6b | 8,856 | py | Python | auxiliary/model.py | hellolele/PoseFromShape | b7cd6fc7eab5be7710e34557504c192d36c35000 | [
"MIT"
] | 2 | 2019-07-12T14:10:37.000Z | 2019-07-12T14:10:39.000Z | auxiliary/model.py | tim885/PoseFromShape | 7daf9e4889af065861d2719cd2bca2de8a45d185 | [
"MIT"
] | null | null | null | auxiliary/model.py | tim885/PoseFromShape | 7daf9e4889af065861d2719cd2bca2de8a45d185 | [
"MIT"
] | null | null | null | import torch
import torch.nn as nn
import torch.nn.parallel
import torch.utils.data
from torch.autograd import Variable
import resnet
# ============================================================================ #
# Baseline network #
# ====================... | 47.106383 | 134 | 0.630872 | import torch
import torch.nn as nn
import torch.nn.parallel
import torch.utils.data
from torch.autograd import Variable
import resnet
class BaselineEstimator(nn.Module):
def __init__(self, img_feature_dim=1024, separate_branch=False,
azi_classes=24, ele_classes=12, inp_classes=24, pretrained_resn... | true | true |
f73109ae32ef645c13d5883015d019e998ed1a8c | 1,758 | py | Python | assignment1/learners/ANN.py | prestononeal/CS-7641-assignments | c3a6815ba1be837084c60c3dd0dc8e8e702aa9b7 | [
"MIT"
] | 148 | 2018-12-18T21:14:04.000Z | 2022-03-04T09:13:21.000Z | assignment1/learners/ANN.py | prestononeal/CS-7641-assignments | c3a6815ba1be837084c60c3dd0dc8e8e702aa9b7 | [
"MIT"
] | 22 | 2019-01-20T00:11:06.000Z | 2021-05-01T17:21:58.000Z | assignment1/learners/ANN.py | prestononeal/CS-7641-assignments | c3a6815ba1be837084c60c3dd0dc8e8e702aa9b7 | [
"MIT"
] | 172 | 2019-01-09T06:01:54.000Z | 2022-03-25T22:53:19.000Z | from sklearn import neural_network
import learners
class ANNLearner(learners.BaseLearner):
def __init__(self,
hidden_layer_sizes=(100,),
activation="relu",
solver='adam',
alpha=0.0001,
batch_size='auto',
learnin... | 30.842105 | 53 | 0.512514 | from sklearn import neural_network
import learners
class ANNLearner(learners.BaseLearner):
def __init__(self,
hidden_layer_sizes=(100,),
activation="relu",
solver='adam',
alpha=0.0001,
batch_size='auto',
learnin... | true | true |
f73109e94e405161ed8aebf68ae23f9e76eb1142 | 26,888 | py | Python | lib/pybtex-0.19/pybtex/database/__init__.py | cabeen/bibfmt | a2607506f15249f8e0ee900db103d57afec7dec8 | [
"MIT"
] | 1 | 2021-02-20T19:53:48.000Z | 2021-02-20T19:53:48.000Z | lib/pybtex-0.19/pybtex/database/__init__.py | cabeen/bibfmt | a2607506f15249f8e0ee900db103d57afec7dec8 | [
"MIT"
] | null | null | null | lib/pybtex-0.19/pybtex/database/__init__.py | cabeen/bibfmt | a2607506f15249f8e0ee900db103d57afec7dec8 | [
"MIT"
] | null | null | null | # vim: fileencoding=utf-8
# Copyright (c) 2006, 2007, 2008, 2009, 2010, 2011, 2012 Andrey Golovizin
#
# 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... | 33.652065 | 129 | 0.576056 |
import re
from collections import Mapping
from pybtex.plugin import find_plugin
from pybtex.exceptions import PybtexError
from pybtex.utils import (
deprecated,
OrderedCaseInsensitiveDict, CaseInsensitiveDefaultDict, CaseInsensitiveSet
)
from pybtex.bibtex.utils import split_tex_string, scan_bibtex_string
fr... | true | true |
f7310a03ff8c470b1a97fb65773a13fadaa84311 | 17,145 | py | Python | cinder/tests/unit/attachments/test_attachments_api.py | helenwalsh/cinder | 307fccea4cc9c6496334b0fe137206cb48499bd5 | [
"Apache-2.0"
] | 1 | 2019-02-17T17:49:41.000Z | 2019-02-17T17:49:41.000Z | cinder/tests/unit/attachments/test_attachments_api.py | BelieveInFuture/cinder | fff95fa6a68a054488ee087b6e31f4f5e28209dc | [
"Apache-2.0"
] | 1 | 2020-12-22T20:40:20.000Z | 2020-12-23T18:34:42.000Z | cinder/tests/unit/attachments/test_attachments_api.py | BelieveInFuture/cinder | fff95fa6a68a054488ee087b6e31f4f5e28209dc | [
"Apache-2.0"
] | 3 | 2020-06-16T07:29:48.000Z | 2020-06-21T10:22:57.000Z | # Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance with the License. You may obtain
# a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# d... | 45.72 | 100 | 0.552289 |
from unittest import mock
from oslo_config import cfg
from oslo_policy import policy as oslo_policy
from cinder import context
from cinder import db
from cinder import exception
from cinder import objects
from cinder.policies import attachments as attachment_policy
from cinder.policies import base as base_policy
fro... | true | true |
f7310a6506b1291656e1d48a8acd6e1397f886e7 | 1,296 | py | Python | docs/scripts/build-go.py | xUndero/noc | 9fb34627721149fcf7064860bd63887e38849131 | [
"BSD-3-Clause"
] | 1 | 2019-09-20T09:36:48.000Z | 2019-09-20T09:36:48.000Z | docs/scripts/build-go.py | ewwwcha/noc | aba08dc328296bb0e8e181c2ac9a766e1ec2a0bb | [
"BSD-3-Clause"
] | null | null | null | docs/scripts/build-go.py | ewwwcha/noc | aba08dc328296bb0e8e181c2ac9a766e1ec2a0bb | [
"BSD-3-Clause"
] | null | null | null | # -*- coding: utf-8 -*-
# ----------------------------------------------------------------------
# Build go.html
# ----------------------------------------------------------------------
# Copyright (C) 2007-2018 The NOC Project
# See LICENSE for details
# ----------------------------------------------------------------... | 25.411765 | 72 | 0.45216 |
import sys
import os
from sphinx.util.inventory import InventoryFile
JS = """
function redirect(rmap) {
var href = window.location.href;
var label = href.split('#')[1];
var base = href.substr(0, href.indexOf("go.html"))
window.location = base + rmap[label];
}
"""
def process(path):
r = [
"<html>",
... | true | true |
f7310adaaf9f436b99dc44a44f9873149854a8c7 | 312 | py | Python | trabajos/ejercicio8.py | marilynmamani/marilyn-M.Q | 54090978b1f6e2f12b79b5dd39c59e9594226414 | [
"Apache-2.0"
] | null | null | null | trabajos/ejercicio8.py | marilynmamani/marilyn-M.Q | 54090978b1f6e2f12b79b5dd39c59e9594226414 | [
"Apache-2.0"
] | null | null | null | trabajos/ejercicio8.py | marilynmamani/marilyn-M.Q | 54090978b1f6e2f12b79b5dd39c59e9594226414 | [
"Apache-2.0"
] | null | null | null | def votoElecciones():
print("Como saber si puedes votar por tu edad")
mensaje =""
edadP=int(input("ingrese la edad que tiene:"))
if edadP>=18:
mensaje ="Usted esta apto para votar"
else:
mensaje ="Usted no cumple con la edadad minima y no esta apto para votar"
print(mensaje)
votoElecciones() | 31.2 | 77 | 0.701923 | def votoElecciones():
print("Como saber si puedes votar por tu edad")
mensaje =""
edadP=int(input("ingrese la edad que tiene:"))
if edadP>=18:
mensaje ="Usted esta apto para votar"
else:
mensaje ="Usted no cumple con la edadad minima y no esta apto para votar"
print(mensaje)
votoElecciones() | true | true |
f7310ade1292bec44ede20c2ba3965b6ae5472ce | 26,481 | py | Python | openstack_dashboard/test/unit/api/test_nova.py | NunoEdgarGFlowHub/horizon | 73a0bbd43ea78ac5337f7d00977ec5f32452067e | [
"Apache-2.0"
] | null | null | null | openstack_dashboard/test/unit/api/test_nova.py | NunoEdgarGFlowHub/horizon | 73a0bbd43ea78ac5337f7d00977ec5f32452067e | [
"Apache-2.0"
] | null | null | null | openstack_dashboard/test/unit/api/test_nova.py | NunoEdgarGFlowHub/horizon | 73a0bbd43ea78ac5337f7d00977ec5f32452067e | [
"Apache-2.0"
] | null | null | null | # Copyright 2012 United States Government as represented by the
# Administrator of the National Aeronautics and Space Administration.
# All Rights Reserved.
#
# Copyright 2012 Nebula, Inc.
# Copyright (c) 2012 X.commerce, a business unit of eBay Inc.
#
# Licensed under the Apache License, Version 2.0 (the "License")... | 40.99226 | 79 | 0.629848 |
from __future__ import absolute_import
from django.conf import settings
from django.test.utils import override_settings
import mock
from novaclient import api_versions
from novaclient import exceptions as nova_exceptions
from novaclient.v2 import flavor_access as nova_flavor_access
from novaclient.v2 import servers
... | true | true |
f7310b7ead9624ea504e64c406cc2aff15d3c26e | 475 | py | Python | File3.py | PRASAD-DANGARE/PYTHON | 36214f7dc3762d327e5a29e40752edeb098249c8 | [
"MIT"
] | 1 | 2021-06-07T07:55:28.000Z | 2021-06-07T07:55:28.000Z | File3.py | PRASAD-DANGARE/PYTHON | 36214f7dc3762d327e5a29e40752edeb098249c8 | [
"MIT"
] | null | null | null | File3.py | PRASAD-DANGARE/PYTHON | 36214f7dc3762d327e5a29e40752edeb098249c8 | [
"MIT"
] | null | null | null | '''
Function Name : main()
Description : How To Open File & Read The Data Using Open, Read
Function Date : 15 Mar 2021
Function Author : Prasad Dangare
Input : Int
Output : Int
'''
def main():
name = input("Enter the file name that you want to Read : ")
... | 21.590909 | 70 | 0.543158 |
def main():
name = input("Enter the file name that you want to Read : ")
fobj = open(name,"r")
print("Data from file is ")
print(fobj.read())
if __name__ == "__main__":
main()
| true | true |
f7310b85b49a3410f4d4de81bf967f2752594b51 | 2,260 | py | Python | src/recording_script_generator/app/sentence_splitting.py | stefantaubert/recording-script-generator | 01cdcd4b85ed7f245f4bb8535d870c04472746c9 | [
"MIT"
] | null | null | null | src/recording_script_generator/app/sentence_splitting.py | stefantaubert/recording-script-generator | 01cdcd4b85ed7f245f4bb8535d870c04472746c9 | [
"MIT"
] | null | null | null | src/recording_script_generator/app/sentence_splitting.py | stefantaubert/recording-script-generator | 01cdcd4b85ed7f245f4bb8535d870c04472746c9 | [
"MIT"
] | null | null | null | from pathlib import Path
from typing import Optional
from recording_script_generator.app.helper import (
raise_error_if_directory_exists_and_not_overwrite,
raise_error_if_directory_not_exists)
from recording_script_generator.app.io import (load_reading_passages,
l... | 52.55814 | 276 | 0.684071 | from pathlib import Path
from typing import Optional
from recording_script_generator.app.helper import (
raise_error_if_directory_exists_and_not_overwrite,
raise_error_if_directory_not_exists)
from recording_script_generator.app.io import (load_reading_passages,
l... | true | true |
f7310ca10c88fc71c44d09d18e1abc98736f1dc9 | 10,685 | py | Python | pokemon_data.py | aroxby/pk-stadium-decoder | 71f23bcc7035fcd763e69372387becc1b4744fd0 | [
"Unlicense"
] | null | null | null | pokemon_data.py | aroxby/pk-stadium-decoder | 71f23bcc7035fcd763e69372387becc1b4744fd0 | [
"Unlicense"
] | null | null | null | pokemon_data.py | aroxby/pk-stadium-decoder | 71f23bcc7035fcd763e69372387becc1b4744fd0 | [
"Unlicense"
] | null | null | null | #!/usr/bin/env python3
from enum import Enum
class Type(Enum):
NORMAL = 0
FIGHTING = 1
FLYING = 2
POISON = 3
GROUND = 4
ROCK = 5
BIRD = 6
BUG = 7
GHOST = 8
FIRE = 20
WATER = 21
GRASS = 22
ELECTRIC = 23
PSYCHIC = 24
ICE = 25
DRAGON = 26
def __str__(s... | 27.753247 | 56 | 0.51839 | from enum import Enum
class Type(Enum):
NORMAL = 0
FIGHTING = 1
FLYING = 2
POISON = 3
GROUND = 4
ROCK = 5
BIRD = 6
BUG = 7
GHOST = 8
FIRE = 20
WATER = 21
GRASS = 22
ELECTRIC = 23
PSYCHIC = 24
ICE = 25
DRAGON = 26
def __str__(self):
MAPPING =... | true | true |
f7310cbb1ac1ab0317dcf30418fa49e6095d48e7 | 2,760 | py | Python | maps/ors.py | sackh/maps-cli | 64cc1877518c88bc9b885ebc22580b595bee6fcc | [
"MIT"
] | 5 | 2021-01-21T08:19:43.000Z | 2021-12-12T06:20:53.000Z | maps/ors.py | sackh/maps-cli | 64cc1877518c88bc9b885ebc22580b595bee6fcc | [
"MIT"
] | null | null | null | maps/ors.py | sackh/maps-cli | 64cc1877518c88bc9b885ebc22580b595bee6fcc | [
"MIT"
] | null | null | null | """This module defines all the ORS(https://openrouteservice.org/services/) commands."""
import os
import click
import openrouteservice as opnrs
import simplejson as json
from geojsonio import display as geo_display
from maps.exceptions import ApiKeyNotFoundError
from maps.utils import yield_subcommands
@click.group... | 34.074074 | 90 | 0.648913 | import os
import click
import openrouteservice as opnrs
import simplejson as json
from geojsonio import display as geo_display
from maps.exceptions import ApiKeyNotFoundError
from maps.utils import yield_subcommands
@click.group()
@click.pass_context
def ors(ctx):
ctx.obj = {}
@ors.command()
def show():
f... | true | true |
f7310d1859fb85e6d93daf01566a93a660d350f0 | 56 | py | Python | virtual/lib/python3.6/site-packages/imagekit/forms/__init__.py | kenmutuma001/galleria | 1bbb9fbd3ca8bf7a030dbcbcbd1674d392055d72 | [
"Unlicense"
] | 2 | 2019-04-15T10:28:42.000Z | 2019-04-26T21:48:17.000Z | virtual/lib/python3.6/site-packages/imagekit/forms/__init__.py | kenmutuma001/galleria | 1bbb9fbd3ca8bf7a030dbcbcbd1674d392055d72 | [
"Unlicense"
] | 12 | 2020-02-12T00:25:14.000Z | 2022-03-11T23:48:53.000Z | virtual/lib/python3.6/site-packages/imagekit/forms/__init__.py | kenmutuma001/galleria | 1bbb9fbd3ca8bf7a030dbcbcbd1674d392055d72 | [
"Unlicense"
] | 1 | 2021-05-24T10:19:13.000Z | 2021-05-24T10:19:13.000Z | # flake8: noqa
from .fields import ProcessedImageField
| 14 | 39 | 0.803571 |
from .fields import ProcessedImageField
| true | true |
f7310fabca6b6ef898997efb6b048ead96681b15 | 4,598 | py | Python | plastering/evaluator.py | MingzheWu418/plastering | 322531e934c3acf2ecc8f520b37a6d255b9959c2 | [
"MIT"
] | 29 | 2018-09-19T01:16:27.000Z | 2022-03-29T14:35:36.000Z | plastering/evaluator.py | MingzheWu418/plastering | 322531e934c3acf2ecc8f520b37a6d255b9959c2 | [
"MIT"
] | 14 | 2019-04-12T18:37:36.000Z | 2022-02-10T00:27:55.000Z | plastering/evaluator.py | MingzheWu418/plastering | 322531e934c3acf2ecc8f520b37a6d255b9959c2 | [
"MIT"
] | 14 | 2019-03-05T23:44:11.000Z | 2022-03-18T07:29:31.000Z | from copy import deepcopy
from sklearn.metrics import f1_score
from sklearn.preprocessing import LabelBinarizer, MultiLabelBinarizer
from sklearn.preprocessing import LabelEncoder
import numpy as np
import pdb
def binarize_labels(true_labels, pred_labels):
srcids = list(pred_labels.keys())
tot_labels = [list(l... | 38.966102 | 75 | 0.707916 | from copy import deepcopy
from sklearn.metrics import f1_score
from sklearn.preprocessing import LabelBinarizer, MultiLabelBinarizer
from sklearn.preprocessing import LabelEncoder
import numpy as np
import pdb
def binarize_labels(true_labels, pred_labels):
srcids = list(pred_labels.keys())
tot_labels = [list(l... | true | true |
f7310fbb1474ae83999ab53c3f7d66fcd8c2abb3 | 136,240 | py | Python | Lib/test/test_codecs.py | nkhandare/python31all- | c6c792f2db5938def0261378acb5cf1de440ff43 | [
"bzip2-1.0.6"
] | 33 | 2021-07-25T14:23:35.000Z | 2022-03-31T00:17:30.000Z | Lib/test/test_codecs.py | nkhandare/python31all- | c6c792f2db5938def0261378acb5cf1de440ff43 | [
"bzip2-1.0.6"
] | 32 | 2019-04-26T12:29:36.000Z | 2022-03-08T14:24:30.000Z | Lib/test/test_codecs.py | val-verde/cpython | 17aa701d799d5e071d83205d877f722f1498a09f | [
"0BSD"
] | 3 | 2019-11-12T15:21:58.000Z | 2020-09-04T14:27:55.000Z | import codecs
import contextlib
import io
import locale
import sys
import unittest
import encodings
from unittest import mock
from test import support
from test.support import os_helper
from test.support import warnings_helper
try:
import _testcapi
except ImportError:
_testcapi = None
try:
import ctypes
... | 38.649645 | 113 | 0.543188 | import codecs
import contextlib
import io
import locale
import sys
import unittest
import encodings
from unittest import mock
from test import support
from test.support import os_helper
from test.support import warnings_helper
try:
import _testcapi
except ImportError:
_testcapi = None
try:
import ctypes
... | true | true |
f73110ecdff79d7c029c0dd0d895ef71ea68326b | 12,233 | py | Python | loopy/transform/instruction.py | benSepanski/loopy | 5db582d579eb65ce58b93e2c53feb1d48404cf2d | [
"MIT"
] | null | null | null | loopy/transform/instruction.py | benSepanski/loopy | 5db582d579eb65ce58b93e2c53feb1d48404cf2d | [
"MIT"
] | null | null | null | loopy/transform/instruction.py | benSepanski/loopy | 5db582d579eb65ce58b93e2c53feb1d48404cf2d | [
"MIT"
] | null | null | null | from __future__ import division, absolute_import
__copyright__ = "Copyright (C) 2012 Andreas Kloeckner"
__license__ = """
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, incl... | 31.366667 | 83 | 0.666721 | from __future__ import division, absolute_import
__copyright__ = "Copyright (C) 2012 Andreas Kloeckner"
__license__ = """
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, incl... | true | true |
f731121b0a99cb58789c4b1de9a36c3004b171ee | 442 | py | Python | Inventory/views.py | DivyaKarunakaran/Inventory | ac883f087a5204832349e0fe3ed3692bc3d413c2 | [
"bzip2-1.0.6"
] | null | null | null | Inventory/views.py | DivyaKarunakaran/Inventory | ac883f087a5204832349e0fe3ed3692bc3d413c2 | [
"bzip2-1.0.6"
] | null | null | null | Inventory/views.py | DivyaKarunakaran/Inventory | ac883f087a5204832349e0fe3ed3692bc3d413c2 | [
"bzip2-1.0.6"
] | null | null | null | from django.shortcuts import render
from django.http import Http404
from Inventory.models import Item
def index(request):
items=Item.objects.exclude(amount=0)
return render(request,'Inventory/index.html',{
'items':items,})
def item_detail(request, id):
try:
item=Item.objects.get(id=id)
except Item.DoesNotExis... | 24.555556 | 53 | 0.751131 | from django.shortcuts import render
from django.http import Http404
from Inventory.models import Item
def index(request):
items=Item.objects.exclude(amount=0)
return render(request,'Inventory/index.html',{
'items':items,})
def item_detail(request, id):
try:
item=Item.objects.get(id=id)
except Item.DoesNotExis... | true | true |
f731144c606f8f088d759bd0b3022acc7a14317e | 6,296 | py | Python | ckan/lib/formatters.py | okfde/ckankrzn | df4c1ed624f6751ac2a8f03527ff19e448d27dfb | [
"Apache-2.0"
] | 4 | 2017-06-12T15:18:30.000Z | 2019-10-11T15:12:43.000Z | ckan/lib/formatters.py | okfde/ckankrzn | df4c1ed624f6751ac2a8f03527ff19e448d27dfb | [
"Apache-2.0"
] | 64 | 2017-05-14T22:15:53.000Z | 2020-03-08T15:26:49.000Z | ckan/lib/formatters.py | okfde/ckankrzn | df4c1ed624f6751ac2a8f03527ff19e448d27dfb | [
"Apache-2.0"
] | 2 | 2018-09-08T08:02:25.000Z | 2020-04-24T13:02:06.000Z | # encoding: utf-8
import datetime
import pytz
from babel import numbers
import ckan.lib.i18n as i18n
from ckan.common import _, ungettext
##################################################
# #
# Month translations #
# ... | 30.563107 | 94 | 0.560038 |
import datetime
import pytz
from babel import numbers
import ckan.lib.i18n as i18n
from ckan.common import _, ungettext
def _month_jan():
return _('January')
def _month_feb():
return _('February')
def _month_mar():
return _('March')
def _month_apr():
return _('April')
def _month_may():
... | true | true |
f731159d8d119b22890a43bc26246da1964a17db | 3,103 | py | Python | alipay/aop/api/domain/AlipayOpenMiniAmpeTracerSyncModel.py | antopen/alipay-sdk-python-all | 8e51c54409b9452f8d46c7bb10eea7c8f7e8d30c | [
"Apache-2.0"
] | null | null | null | alipay/aop/api/domain/AlipayOpenMiniAmpeTracerSyncModel.py | antopen/alipay-sdk-python-all | 8e51c54409b9452f8d46c7bb10eea7c8f7e8d30c | [
"Apache-2.0"
] | null | null | null | alipay/aop/api/domain/AlipayOpenMiniAmpeTracerSyncModel.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 AlipayOpenMiniAmpeTracerSyncModel(object):
def __init__(self):
self._device_id = None
self._product_id = None
self._spm_a = None
self._spm_b = None
self._s... | 26.75 | 71 | 0.548179 | import json
from alipay.aop.api.constant.ParamConstants import *
class AlipayOpenMiniAmpeTracerSyncModel(object):
def __init__(self):
self._device_id = None
self._product_id = None
self._spm_a = None
self._spm_b = None
self._spm_c = None
self._spm_d = None
@p... | true | true |
f7311738dee08b938940c7168a1cd11f92e41b95 | 338 | py | Python | cn/opencv/chapter01/01Read.py | Jasonandy/Python-X | 2f02b9a17bd5495dd1f8746b191f11ec2d7bccbe | [
"Apache-2.0"
] | null | null | null | cn/opencv/chapter01/01Read.py | Jasonandy/Python-X | 2f02b9a17bd5495dd1f8746b191f11ec2d7bccbe | [
"Apache-2.0"
] | null | null | null | cn/opencv/chapter01/01Read.py | Jasonandy/Python-X | 2f02b9a17bd5495dd1f8746b191f11ec2d7bccbe | [
"Apache-2.0"
] | 2 | 2019-06-18T05:53:26.000Z | 2019-06-19T03:26:02.000Z | """
read picture
"""
import cv2
def read_picture(path):
"""
读取图片
:return:
"""
img = cv2.imread(path)
cv2.namedWindow("OPEN_CV_READ_IMG")
cv2.imshow("OPEN_CV_READ_IMG", img)
cv2.waitKey(0)
cv2.destroyAllWindows()
if __name__ == '__main__':
path = "../media/lena/lena.jpg"
r... | 15.363636 | 39 | 0.615385 | import cv2
def read_picture(path):
img = cv2.imread(path)
cv2.namedWindow("OPEN_CV_READ_IMG")
cv2.imshow("OPEN_CV_READ_IMG", img)
cv2.waitKey(0)
cv2.destroyAllWindows()
if __name__ == '__main__':
path = "../media/lena/lena.jpg"
read_picture(path)
| true | true |
f73117825794ffc13c74bb610938ec6e7e2bbad0 | 1,828 | py | Python | pymenu/elements.py | feftio/pymenu | 846b916ce55548c53f43f3642d69e6c64fd9d774 | [
"MIT"
] | null | null | null | pymenu/elements.py | feftio/pymenu | 846b916ce55548c53f43f3642d69e6c64fd9d774 | [
"MIT"
] | null | null | null | pymenu/elements.py | feftio/pymenu | 846b916ce55548c53f43f3642d69e6c64fd9d774 | [
"MIT"
] | null | null | null | from __future__ import annotations
import typing as t
from abc import ABC, abstractmethod
from pymenu.listener import GroupListener, Listener, ListenerInterface
from pymenu.triggers import Trigger
from rich import print
class ElementInterface(ListenerInterface, ABC):
@abstractmethod
def render(self) -> None:
... | 26.882353 | 131 | 0.669037 | from __future__ import annotations
import typing as t
from abc import ABC, abstractmethod
from pymenu.listener import GroupListener, Listener, ListenerInterface
from pymenu.triggers import Trigger
from rich import print
class ElementInterface(ListenerInterface, ABC):
@abstractmethod
def render(self) -> None:
... | true | true |
f7311956fa5e3a221660dc56d6dcaaef28e32f55 | 1,662 | py | Python | tests/test_calculator.py | amard33p/minimal-pytest-project | 45844a70d8c8a6499a038a6eb99bf7b7b78ccdd8 | [
"Apache-2.0"
] | 2 | 2020-12-08T14:35:19.000Z | 2022-01-18T21:35:14.000Z | tests/test_calculator.py | amard33p/minimal-pytest-project | 45844a70d8c8a6499a038a6eb99bf7b7b78ccdd8 | [
"Apache-2.0"
] | null | null | null | tests/test_calculator.py | amard33p/minimal-pytest-project | 45844a70d8c8a6499a038a6eb99bf7b7b78ccdd8 | [
"Apache-2.0"
] | 1 | 2021-09-13T12:36:32.000Z | 2021-09-13T12:36:32.000Z | import pytest
import mymath.calculator
from mymath.calculator import add, div, filesum, fileconcat, approx_eq
# Simple tests
# ----------------------------------------------------
def test_add():
assert add(1, 2) == 3
def test_div():
assert div(4, 2) == 2
assert div(0, 2) == 0
# Catching excep... | 23.742857 | 80 | 0.493983 | import pytest
import mymath.calculator
from mymath.calculator import add, div, filesum, fileconcat, approx_eq
def test_add():
assert add(1, 2) == 3
def test_div():
assert div(4, 2) == 2
assert div(0, 2) == 0
def test_div_by_zero():
with pytest.raises(ValueError) as ex:
div(1, 0)
... | true | true |
f731198351b74c2e46960cec248a5589d6459d40 | 18,893 | py | Python | redis_in_action/redis_action_ch05.py | ftconan/python3 | eb63ba33960072f792ecce6db809866b38c402f8 | [
"MIT"
] | 1 | 2018-12-19T22:07:56.000Z | 2018-12-19T22:07:56.000Z | redis_in_action/redis_action_ch05.py | ftconan/python3 | eb63ba33960072f792ecce6db809866b38c402f8 | [
"MIT"
] | 12 | 2020-03-14T05:32:26.000Z | 2022-03-12T00:08:49.000Z | redis_in_action/redis_action_ch05.py | ftconan/python3 | eb63ba33960072f792ecce6db809866b38c402f8 | [
"MIT"
] | 1 | 2018-12-19T22:08:00.000Z | 2018-12-19T22:08:00.000Z | """
@author: magician
@file: redis_action_ch05.py
@date: 2021/11/22
"""
import bisect
import contextlib
import csv
import functools
import json
import logging
import random
import threading
import time
import unittest
import uuid
import redis
from datetime import datetime
QUIT = False
SAMPLE_COUNT = 100
config_... | 27.743025 | 97 | 0.568094 | import bisect
import contextlib
import csv
import functools
import json
import logging
import random
import threading
import time
import unittest
import uuid
import redis
from datetime import datetime
QUIT = False
SAMPLE_COUNT = 100
config_connection = None
SEVERITY = {
logging.DEBUG: 'debug',
logging.INFO... | true | true |
f7311bee17a55636231d33e9456da8fd2182c8c0 | 4,311 | py | Python | benchmark/startQiskit1590.py | UCLA-SEAL/QDiff | d968cbc47fe926b7f88b4adf10490f1edd6f8819 | [
"BSD-3-Clause"
] | null | null | null | benchmark/startQiskit1590.py | UCLA-SEAL/QDiff | d968cbc47fe926b7f88b4adf10490f1edd6f8819 | [
"BSD-3-Clause"
] | null | null | null | benchmark/startQiskit1590.py | UCLA-SEAL/QDiff | d968cbc47fe926b7f88b4adf10490f1edd6f8819 | [
"BSD-3-Clause"
] | null | null | null | # qubit number=5
# total number=50
import cirq
import qiskit
from qiskit import QuantumCircuit, QuantumRegister, ClassicalRegister
from qiskit import BasicAer, execute, transpile
from pprint import pprint
from qiskit.test.mock import FakeVigo
from math import log2,floor, sqrt, pi
import numpy as np
import networkx as ... | 32.413534 | 82 | 0.617954 | import cirq
import qiskit
from qiskit import QuantumCircuit, QuantumRegister, ClassicalRegister
from qiskit import BasicAer, execute, transpile
from pprint import pprint
from qiskit.test.mock import FakeVigo
from math import log2,floor, sqrt, pi
import numpy as np
import networkx as nx
def build_oracle(n: int, f) -> ... | true | true |
f7311d85c66f7c08923fda4bf9edb27d6e1b385e | 305 | py | Python | data/multilingual/Latn.VMW/Serif_12/pdf_to_json_test_Latn.VMW_Serif_12.py | antoinecarme/pdf_to_json_tests | d57a024fde862e698d916a1178f285883d7a3b2f | [
"BSD-3-Clause"
] | 1 | 2021-09-19T19:47:35.000Z | 2021-09-19T19:47:35.000Z | data/multilingual/Latn.VMW/Serif_12/pdf_to_json_test_Latn.VMW_Serif_12.py | antoinecarme/pdf_to_json_tests | d57a024fde862e698d916a1178f285883d7a3b2f | [
"BSD-3-Clause"
] | null | null | null | data/multilingual/Latn.VMW/Serif_12/pdf_to_json_test_Latn.VMW_Serif_12.py | antoinecarme/pdf_to_json_tests | d57a024fde862e698d916a1178f285883d7a3b2f | [
"BSD-3-Clause"
] | null | null | null | import pdf_to_json as p2j
import json
url = "file:data/multilingual/Latn.VMW/Serif_12/udhr_Latn.VMW_Serif_12.pdf"
lConverter = p2j.pdf_to_json.pdf_to_json_converter()
lConverter.mImageHashOnly = True
lDict = lConverter.convert(url)
print(json.dumps(lDict, indent=4, ensure_ascii=False, sort_keys=True))
| 30.5 | 75 | 0.813115 | import pdf_to_json as p2j
import json
url = "file:data/multilingual/Latn.VMW/Serif_12/udhr_Latn.VMW_Serif_12.pdf"
lConverter = p2j.pdf_to_json.pdf_to_json_converter()
lConverter.mImageHashOnly = True
lDict = lConverter.convert(url)
print(json.dumps(lDict, indent=4, ensure_ascii=False, sort_keys=True))
| true | true |
f7311e1a59e2934d6f9c806d49f878f1efa58c9f | 475 | py | Python | bootcamp/articles/migrations/0008_auto_20180321_1336.py | ngaurav/j | 99dc01f153155b287f419b7af357e1f7d694466d | [
"MIT"
] | null | null | null | bootcamp/articles/migrations/0008_auto_20180321_1336.py | ngaurav/j | 99dc01f153155b287f419b7af357e1f7d694466d | [
"MIT"
] | null | null | null | bootcamp/articles/migrations/0008_auto_20180321_1336.py | ngaurav/j | 99dc01f153155b287f419b7af357e1f7d694466d | [
"MIT"
] | null | null | null | # -*- coding: utf-8 -*-
# Generated by Django 1.11.11 on 2018-03-21 13:36
from __future__ import unicode_literals
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('articles', '0007_auto_20180113_2139'),
]
operations = [
migrations.AlterFi... | 22.619048 | 73 | 0.623158 | from __future__ import unicode_literals
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('articles', '0007_auto_20180113_2139'),
]
operations = [
migrations.AlterField(
model_name='article',
name='slug',
... | true | true |
f7311e2ccb16402f340b2a257b71cbb087285749 | 7,221 | py | Python | XLMMacroDeobfuscator/xls_wrapper.py | wmetcalf/XLMMacroDeobfuscator | 1a854d8effb4cf5d2e02f10bbb16d58c64c1ebe8 | [
"Apache-2.0"
] | null | null | null | XLMMacroDeobfuscator/xls_wrapper.py | wmetcalf/XLMMacroDeobfuscator | 1a854d8effb4cf5d2e02f10bbb16d58c64c1ebe8 | [
"Apache-2.0"
] | null | null | null | XLMMacroDeobfuscator/xls_wrapper.py | wmetcalf/XLMMacroDeobfuscator | 1a854d8effb4cf5d2e02f10bbb16d58c64c1ebe8 | [
"Apache-2.0"
] | null | null | null | from XLMMacroDeobfuscator.excel_wrapper import ExcelWrapper
from XLMMacroDeobfuscator.boundsheet import Boundsheet
from XLMMacroDeobfuscator.boundsheet import Cell
from win32com.client import Dispatch
import pywintypes
from enum import Enum
import os
import re
class XlCellType(Enum):
xlCellTypeFormulas = -4123
... | 36.654822 | 99 | 0.568481 | from XLMMacroDeobfuscator.excel_wrapper import ExcelWrapper
from XLMMacroDeobfuscator.boundsheet import Boundsheet
from XLMMacroDeobfuscator.boundsheet import Cell
from win32com.client import Dispatch
import pywintypes
from enum import Enum
import os
import re
class XlCellType(Enum):
xlCellTypeFormulas = -4123
... | true | true |
f7311e5292fc49af1408b0183fe1700dc5f1512b | 4,995 | py | Python | .tox/scenario/lib/python2.7/site-packages/futurist/tests/test_executors.py | bdrich/neutron-lbaas | b4711abfe0207c4fdd5d7fb7ecbf017e753abbfd | [
"Apache-2.0"
] | null | null | null | .tox/scenario/lib/python2.7/site-packages/futurist/tests/test_executors.py | bdrich/neutron-lbaas | b4711abfe0207c4fdd5d7fb7ecbf017e753abbfd | [
"Apache-2.0"
] | null | null | null | .tox/scenario/lib/python2.7/site-packages/futurist/tests/test_executors.py | bdrich/neutron-lbaas | b4711abfe0207c4fdd5d7fb7ecbf017e753abbfd | [
"Apache-2.0"
] | null | null | null | # -*- coding: utf-8 -*-
# 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, softw... | 35.678571 | 79 | 0.626226 |
import time
import testscenarios
from testtools import testcase
import futurist
from futurist.tests import base
def returns_one():
return 1
def blows_up():
raise RuntimeError("no worky")
def delayed(wait_secs):
time.sleep(wait_secs)
class TestExecutors(testscenarios.TestWithScenarios, base.Test... | true | true |
f7311e8c0c66339dabaf7cf0082947fc52f84663 | 16,658 | py | Python | Website/FlaskWebsite/env/Lib/site-packages/google/protobuf/internal/type_checkers.py | amirpaia/election-campaign-dynamics | b2b32c627cb79c7eb60e458511210308b7ff4035 | [
"CC0-1.0"
] | 6 | 2022-02-04T18:12:24.000Z | 2022-03-21T23:57:12.000Z | Website/FlaskWebsite/env/Lib/site-packages/google/protobuf/internal/type_checkers.py | amirpaia/election-campaign-dynamics | b2b32c627cb79c7eb60e458511210308b7ff4035 | [
"CC0-1.0"
] | null | null | null | Website/FlaskWebsite/env/Lib/site-packages/google/protobuf/internal/type_checkers.py | amirpaia/election-campaign-dynamics | b2b32c627cb79c7eb60e458511210308b7ff4035 | [
"CC0-1.0"
] | 1 | 2022-02-08T03:53:23.000Z | 2022-02-08T03:53:23.000Z | # Protocol Buffers - Google's data interchange format
# Copyright 2008 Google Inc. All rights reserved.
# https://developers.google.com/protocol-buffers/
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions are
# met:
#
# ... | 40.530414 | 81 | 0.742466 | # Copyright 2008 Google Inc. All rights reserved.
# https://developers.google.com/protocol-buffers/
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions are
# met:
#
# * Redistributions of source code must retain the abov... | true | true |
f7311f4832eeb38d5c97a3363066842f0f43dfd1 | 3,243 | py | Python | youtube_dl/extractor/libsyn.py | MOODesign/Youtube-videos-Download | 730c0d12a06f349907481570f1f2890251f7a181 | [
"Unlicense"
] | 24 | 2017-03-17T10:27:12.000Z | 2022-02-16T05:55:50.000Z | youtube_dl/extractor/libsyn.py | MOODesign/Youtube-videos-Download | 730c0d12a06f349907481570f1f2890251f7a181 | [
"Unlicense"
] | 7 | 2017-07-26T08:15:27.000Z | 2018-09-20T12:56:53.000Z | youtube_dl/extractor/libsyn.py | MOODesign/Youtube-videos-Download | 730c0d12a06f349907481570f1f2890251f7a181 | [
"Unlicense"
] | 3 | 2017-03-17T10:27:13.000Z | 2019-01-28T01:19:17.000Z | # coding: utf-8
from __future__ import unicode_literals
import json
import re
from .common import InfoExtractor
from ..utils import (
parse_duration,
unified_strdate,
)
class LibsynIE(InfoExtractor):
_VALID_URL = r'(?P<mainurl>https?://html5-player\.libsyn\.com/embed/episode/id/(?P<id>[0-9]+))'
_TE... | 36.852273 | 185 | 0.573235 | from __future__ import unicode_literals
import json
import re
from .common import InfoExtractor
from ..utils import (
parse_duration,
unified_strdate,
)
class LibsynIE(InfoExtractor):
_VALID_URL = r'(?P<mainurl>https?://html5-player\.libsyn\.com/embed/episode/id/(?P<id>[0-9]+))'
_TESTS = [{
... | true | true |
f7311facdc21a3212e9fa9d8178b074821aeaa20 | 1,401 | py | Python | mediagoblin/tools/request.py | stenwt/mediagoblin-quickstart-openshift | 4a728c4b3b988c59eb9a43ad1ae1ca5edf8bc3c2 | [
"CC0-1.0"
] | 1 | 2016-02-10T18:22:42.000Z | 2016-02-10T18:22:42.000Z | mediagoblin/tools/request.py | stenwt/mediagoblin-quickstart-openshift | 4a728c4b3b988c59eb9a43ad1ae1ca5edf8bc3c2 | [
"CC0-1.0"
] | 1 | 2016-04-19T13:03:17.000Z | 2016-04-19T13:03:17.000Z | mediagoblin/tools/request.py | stenwt/mediagoblin-quickstart-openshift | 4a728c4b3b988c59eb9a43ad1ae1ca5edf8bc3c2 | [
"CC0-1.0"
] | null | null | null | # GNU MediaGoblin -- federated, autonomous media hosting
# Copyright (C) 2011, 2012 MediaGoblin contributors. See AUTHORS.
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU Affero General Public License as published by
# the Free Software Foundation, either versio... | 35.025 | 79 | 0.723769 |
import logging
from mediagoblin.db.models import User
_log = logging.getLogger(__name__)
def setup_user_in_request(request):
if not request.session.has_key('user_id'):
request.user = None
return
request.user = User.query.get(request.session['user_id'])
if not request.user:
... | true | true |
f731200874a2e61790ea940792017eb5feadab06 | 13,142 | py | Python | survol/lib_export_json.py | rchateauneu/survol | ba66d3ec453b2d9dd3a8dabc6d53f71aa9ba8c78 | [
"BSD-3-Clause"
] | 9 | 2017-10-05T23:36:23.000Z | 2021-08-09T15:40:03.000Z | survol/lib_export_json.py | rchateauneu/survol | ba66d3ec453b2d9dd3a8dabc6d53f71aa9ba8c78 | [
"BSD-3-Clause"
] | 21 | 2018-01-02T09:33:03.000Z | 2018-08-27T11:09:52.000Z | survol/lib_export_json.py | rchateauneu/survol | ba66d3ec453b2d9dd3a8dabc6d53f71aa9ba8c78 | [
"BSD-3-Clause"
] | 4 | 2018-06-23T09:05:45.000Z | 2021-01-22T15:36:50.000Z | import sys
import six
import os
import json
import logging
import lib_kbase
import lib_patterns
import lib_naming
import lib_util
from lib_properties import pc
import lib_exports
_node_json_number = 0
class NodeJson:
"""This models a node as it will be saved to Json."""
# TODO: This creates a useless layer... | 39.465465 | 139 | 0.666489 | import sys
import six
import os
import json
import logging
import lib_kbase
import lib_patterns
import lib_naming
import lib_util
from lib_properties import pc
import lib_exports
_node_json_number = 0
class NodeJson:
def __init__(self,rdf_node):
global _node_json_number
subj_str = str(rdf_n... | true | true |
f73121b08999df30d985f558b20f79d8fc680663 | 8,052 | py | Python | ietf/group/tests_js.py | hassanakbar4/ietfdb-git | b899ee18604e878fb4133ef38cfeb6af781ce116 | [
"BSD-3-Clause"
] | null | null | null | ietf/group/tests_js.py | hassanakbar4/ietfdb-git | b899ee18604e878fb4133ef38cfeb6af781ce116 | [
"BSD-3-Clause"
] | null | null | null | ietf/group/tests_js.py | hassanakbar4/ietfdb-git | b899ee18604e878fb4133ef38cfeb6af781ce116 | [
"BSD-3-Clause"
] | 1 | 2021-10-05T12:49:27.000Z | 2021-10-05T12:49:27.000Z | # Copyright The IETF Trust 2021, All Rights Reserved
# -*- coding: utf-8 -*-
import datetime
import debug # pyflakes:ignore
from ietf.doc.factories import WgDraftFactory
from ietf.group.factories import GroupFactory, RoleFactory, DatedGroupMilestoneFactory
from ietf.utils.jstest import Ietf... | 42.603175 | 98 | 0.656607 |
import datetime
import debug
from ietf.doc.factories import WgDraftFactory
from ietf.group.factories import GroupFactory, RoleFactory, DatedGroupMilestoneFactory
from ietf.utils.jstest import IetfSeleniumTestCase, ifSeleniumEnabled, selenium_enabled
if selenium_enabled():
from selenium... | true | true |
f73122345854561a45917cbc6b8d22293f08b06b | 1,681 | py | Python | src/pygetwindow/__init__.py | EMOholcicka/PyGetWindow | 55743692fadd5faca330f1d5f9aa1b4ade20d786 | [
"BSD-3-Clause"
] | 1 | 2018-12-18T15:15:21.000Z | 2018-12-18T15:15:21.000Z | src/pygetwindow/__init__.py | EMOholcicka/PyGetWindow | 55743692fadd5faca330f1d5f9aa1b4ade20d786 | [
"BSD-3-Clause"
] | 3 | 2019-01-17T01:55:16.000Z | 2019-02-21T16:27:35.000Z | src/pygetwindow/__init__.py | EMOholcicka/PyGetWindow | 55743692fadd5faca330f1d5f9aa1b4ade20d786 | [
"BSD-3-Clause"
] | 1 | 2019-01-16T21:51:08.000Z | 2019-01-16T21:51:08.000Z | # PyGetWindow
# A cross-platform module to find information about the windows on the screen.
"""
# Work in progress
# Useful info:
#https://stackoverflow.com/questions/373020/finding-the-current-active-window-in-mac-os-x-using-python
#https://stackoverflow.com/questions/7142342/get-window-position-size-with-python
... | 33.62 | 197 | 0.766805 |
__version__ = '0.0.4'
import sys
import collections
class PyGetWindowException(Exception):
pass
def pointInRect(x, y, left, top, width, height):
return left < x < left + width and top < y < top + height
if sys.platform == 'darwin':
raise NotImplementedError('PyGetWindow currently does not support m... | true | true |
f731233587b1356960a9308c19c84399ba7b1cad | 8,353 | py | Python | manuscript/migrations/0007_auto__add_field_title_num_volumes__add_field_title_editor__add_field_t.py | adamsc64/django-manuscript | 9d17a8a93ddaa789a269dc5683b78f2be84778c1 | [
"MIT"
] | 1 | 2015-06-18T07:21:51.000Z | 2015-06-18T07:21:51.000Z | manuscript/migrations/0007_auto__add_field_title_num_volumes__add_field_title_editor__add_field_t.py | adamsc64/django-manuscript | 9d17a8a93ddaa789a269dc5683b78f2be84778c1 | [
"MIT"
] | null | null | null | manuscript/migrations/0007_auto__add_field_title_num_volumes__add_field_title_editor__add_field_t.py | adamsc64/django-manuscript | 9d17a8a93ddaa789a269dc5683b78f2be84778c1 | [
"MIT"
] | 1 | 2021-11-23T09:21:31.000Z | 2021-11-23T09:21:31.000Z | # encoding: utf-8
import datetime
from south.db import db
from south.v2 import SchemaMigration
from django.db import models
class Migration(SchemaMigration):
def forwards(self, orm):
# Adding field 'Title.num_volumes'
db.add_column('manuscript_title', 'num_volumes', self.gf('django.db.mod... | 64.253846 | 234 | 0.600024 | import datetime
from south.db import db
from south.v2 import SchemaMigration
from django.db import models
class Migration(SchemaMigration):
def forwards(self, orm):
db.add_column('manuscript_title', 'num_volumes', self.gf('django.db.models.fields.IntegerField')(null=True, blank=True), kee... | true | true |
f731236ba73b3b9e12b15dec7926dc5c3b69bd93 | 1,359 | py | Python | jpype/JavaLib.py | Hi-Fi/robotframework-after-jython | 1c4956f49fa28bad1156d8243456f8f102eeb8cb | [
"MIT"
] | null | null | null | jpype/JavaLib.py | Hi-Fi/robotframework-after-jython | 1c4956f49fa28bad1156d8243456f8f102eeb8cb | [
"MIT"
] | null | null | null | jpype/JavaLib.py | Hi-Fi/robotframework-after-jython | 1c4956f49fa28bad1156d8243456f8f102eeb8cb | [
"MIT"
] | null | null | null | """Main library."""
from typing import Optional
# Import module
import jpype
# Enable Java imports
import jpype.imports
# Pull in types
from jpype.types import *
import importlib
class JavaLib:
ROBOT_LIBRARY_SCOPE = "GLOBAL"
"""General library documentation."""
def __init__(
self,
lib... | 27.18 | 114 | 0.656365 |
from typing import Optional
import jpype
import jpype.imports
from jpype.types import *
import importlib
class JavaLib:
ROBOT_LIBRARY_SCOPE = "GLOBAL"
def __init__(
self,
library: str,
classpath: Optional[str] = None):
if jpype.isJVMStarted():
print("JVM runnin... | true | true |
f7312400eaec87ffea3fdf898814764925b356f6 | 2,267 | py | Python | cogs/pin.py | kdrsrt/mecha | a32047fe6bdc776cad73d95a716c7bfa8f0516ed | [
"MIT"
] | null | null | null | cogs/pin.py | kdrsrt/mecha | a32047fe6bdc776cad73d95a716c7bfa8f0516ed | [
"MIT"
] | null | null | null | cogs/pin.py | kdrsrt/mecha | a32047fe6bdc776cad73d95a716c7bfa8f0516ed | [
"MIT"
] | null | null | null | from discord.ext.commands import Cog, command
from discord import Embed, File
from discord.ext import commands
import os, discord
class Pin(Cog):
def __init__(self, bot):
self.bot = bot
self.emoji = "📌"
@Cog.listener()
async def on_raw_reaction_add(self, payload):
if p... | 44.45098 | 87 | 0.539038 | from discord.ext.commands import Cog, command
from discord import Embed, File
from discord.ext import commands
import os, discord
class Pin(Cog):
def __init__(self, bot):
self.bot = bot
self.emoji = "📌"
@Cog.listener()
async def on_raw_reaction_add(self, payload):
if p... | true | true |
f731245784b2ec4ad02c78b9de42af4e227ee2c1 | 900 | py | Python | test/test_dist.py | bachew/mollusc | 9ae0eff4455b55314c2b3fe153c51403e2affa1c | [
"MIT"
] | null | null | null | test/test_dist.py | bachew/mollusc | 9ae0eff4455b55314c2b3fe153c51403e2affa1c | [
"MIT"
] | 3 | 2017-11-20T06:46:47.000Z | 2019-12-06T07:45:59.000Z | test/test_dist.py | bachew/mollusc | 9ae0eff4455b55314c2b3fe153c51403e2affa1c | [
"MIT"
] | null | null | null | # -*- coding: utf-8 -*-
from mollusc.dist import Twine
class TestTwine(object):
def test_register_command(self):
twine = Twine(username='registrar', password='reg1strar')
assert twine.get_command('register', 'package.whl', {'-c': 'test register'}) == [
'twine',
'register',
... | 33.333333 | 105 | 0.53 | from mollusc.dist import Twine
class TestTwine(object):
def test_register_command(self):
twine = Twine(username='registrar', password='reg1strar')
assert twine.get_command('register', 'package.whl', {'-c': 'test register'}) == [
'twine',
'register',
'--repositor... | true | true |
f731257080db5facc50d1cd0d6a59693883c2335 | 107 | py | Python | slack/forms.py | pandabearcoder/pythonph | f0a1b93cd3f6234f1eb2d8eae83a8ad8b6741006 | [
"MIT"
] | 23 | 2015-02-26T04:01:02.000Z | 2021-11-09T01:48:09.000Z | slack/forms.py | pandabearcoder/pythonph | f0a1b93cd3f6234f1eb2d8eae83a8ad8b6741006 | [
"MIT"
] | 32 | 2015-04-27T14:17:16.000Z | 2022-03-11T23:12:03.000Z | slack/forms.py | pandabearcoder/pythonph | f0a1b93cd3f6234f1eb2d8eae83a8ad8b6741006 | [
"MIT"
] | 27 | 2015-02-16T17:00:18.000Z | 2022-03-29T01:01:46.000Z | from django import forms
class SlackInviteForm(forms.Form):
email = forms.EmailField(label="Email")
| 15.285714 | 43 | 0.747664 | from django import forms
class SlackInviteForm(forms.Form):
email = forms.EmailField(label="Email")
| true | true |
f73126514631ade1b408efeff6b45a1afa8ead8e | 124 | py | Python | src/opencmiss/__init__.py | rchristie/opencmiss.argon | c5cf8f313e31fc2f9d647a64ce8694cbb4f9e9cf | [
"Apache-2.0"
] | null | null | null | src/opencmiss/__init__.py | rchristie/opencmiss.argon | c5cf8f313e31fc2f9d647a64ce8694cbb4f9e9cf | [
"Apache-2.0"
] | 2 | 2016-01-15T04:17:35.000Z | 2016-02-26T04:01:02.000Z | src/opencmiss/__init__.py | rchristie/opencmiss.argon | c5cf8f313e31fc2f9d647a64ce8694cbb4f9e9cf | [
"Apache-2.0"
] | 6 | 2015-11-29T20:57:16.000Z | 2021-06-08T04:02:26.000Z |
# OpenCMISS Python package initialisation file.
from pkgutil import extend_path
__path__ = extend_path(__path__, __name__)
| 24.8 | 47 | 0.830645 |
from pkgutil import extend_path
__path__ = extend_path(__path__, __name__)
| true | true |
f73126570233a0b7d7357c728250600918f9ec85 | 126 | py | Python | mscreen/autodocktools_prepare_py3k/bhtree/__init__.py | e-mayo/mscreen | a50f0b2f7104007c730baa51b4ec65c891008c47 | [
"MIT"
] | 9 | 2021-03-06T04:24:28.000Z | 2022-01-03T09:53:07.000Z | bhtree/__init__.py | e-mayo/autodocktools-prepare-py3k | 2dd2316837bcb7c19384294443b2855e5ccd3e01 | [
"BSD-3-Clause"
] | 3 | 2021-03-07T05:37:16.000Z | 2021-09-19T15:06:54.000Z | bhtree/__init__.py | e-mayo/autodocktools-prepare-py3k | 2dd2316837bcb7c19384294443b2855e5ccd3e01 | [
"BSD-3-Clause"
] | 4 | 2019-08-28T23:11:39.000Z | 2021-11-27T08:43:36.000Z | from .bhtreelib import *
__MGLTOOLSVersion__ = '1-4alpha3'
CRITICAL_DEPENDENCIES = ['mglutil']
NONCRITICAL_DEPENDENCIES = []
| 21 | 35 | 0.777778 | from .bhtreelib import *
__MGLTOOLSVersion__ = '1-4alpha3'
CRITICAL_DEPENDENCIES = ['mglutil']
NONCRITICAL_DEPENDENCIES = []
| true | true |
f73126e4c01e01f20bce82c5853d0aa6eb16c032 | 656 | py | Python | app/utils/prediction_utils.py | Ukasz09/Clothing-recognition | 9332b0d3eac59782c0e8a72078ba97d67805d512 | [
"MIT"
] | 3 | 2020-06-11T12:38:28.000Z | 2020-11-01T13:26:47.000Z | app/utils/prediction_utils.py | Ukasz09/Clothing-recognition | 9332b0d3eac59782c0e8a72078ba97d67805d512 | [
"MIT"
] | null | null | null | app/utils/prediction_utils.py | Ukasz09/Clothing-recognition | 9332b0d3eac59782c0e8a72078ba97d67805d512 | [
"MIT"
] | null | null | null | import time
import datetime
import numpy as np
__start_time = time.time()
__end_time = time.time()
def calc_accuracy(predicted_labels, real_labels):
correct_qty = 0
for i in range(len(predicted_labels)):
if predicted_labels[i] == real_labels[i]:
correct_qty += 1
return correct_qty * 1... | 24.296296 | 95 | 0.696646 | import time
import datetime
import numpy as np
__start_time = time.time()
__end_time = time.time()
def calc_accuracy(predicted_labels, real_labels):
correct_qty = 0
for i in range(len(predicted_labels)):
if predicted_labels[i] == real_labels[i]:
correct_qty += 1
return correct_qty * 1... | true | true |
f73127413286956e4030d84fb610da04ec29aad6 | 8,529 | py | Python | saleor/discount/models.py | dnordio/saleor | 323963748e6a2702265ec6635b930a234abde4f5 | [
"BSD-3-Clause"
] | 1 | 2019-05-02T17:24:05.000Z | 2019-05-02T17:24:05.000Z | saleor/discount/models.py | valentine217/saleor | 323963748e6a2702265ec6635b930a234abde4f5 | [
"BSD-3-Clause"
] | null | null | null | saleor/discount/models.py | valentine217/saleor | 323963748e6a2702265ec6635b930a234abde4f5 | [
"BSD-3-Clause"
] | 1 | 2019-05-23T07:30:50.000Z | 2019-05-23T07:30:50.000Z | from datetime import date
from decimal import Decimal
from functools import partial
from django.conf import settings
from django.db import models
from django.db.models import F, Q
from django.utils.translation import pgettext, pgettext_lazy
from django_countries.fields import CountryField
from django_prices.models imp... | 39.486111 | 79 | 0.663735 | from datetime import date
from decimal import Decimal
from functools import partial
from django.conf import settings
from django.db import models
from django.db.models import F, Q
from django.utils.translation import pgettext, pgettext_lazy
from django_countries.fields import CountryField
from django_prices.models imp... | true | true |
f7312755a82193a6713ea6ec20053148ab734cac | 1,585 | py | Python | migrations/versions/f0793141fd6b_added_notifications.py | dyachoksa/flask-microblog | f956ba0199ab3fd4226806a9c1e0b3b38092c3d4 | [
"MIT"
] | null | null | null | migrations/versions/f0793141fd6b_added_notifications.py | dyachoksa/flask-microblog | f956ba0199ab3fd4226806a9c1e0b3b38092c3d4 | [
"MIT"
] | null | null | null | migrations/versions/f0793141fd6b_added_notifications.py | dyachoksa/flask-microblog | f956ba0199ab3fd4226806a9c1e0b3b38092c3d4 | [
"MIT"
] | null | null | null | """Added notifications
Revision ID: f0793141fd6b
Revises: 9ecc68fdc92d
Create Date: 2020-05-02 17:17:31.252794
"""
from alembic import op
import sqlalchemy as sa
# revision identifiers, used by Alembic.
revision = "f0793141fd6b"
down_revision = "9ecc68fdc92d"
branch_labels = None
depends_on = None
def upgrade():
... | 31.7 | 86 | 0.666877 | from alembic import op
import sqlalchemy as sa
revision = "f0793141fd6b"
down_revision = "9ecc68fdc92d"
branch_labels = None
depends_on = None
def upgrade():
op.create_table(
"notification",
sa.Column("id", sa.Integer(), nullable=False),
sa.Column("name", sa.String(length=128), nulla... | true | true |
f73127aea2857de2faadcfe865b063892f3787a7 | 1,823 | py | Python | elfsample.py | TheMindVirus/pico-uf22elf | ee5d95208851e6eba4b21675cae66fdf07176d0e | [
"MIT"
] | null | null | null | elfsample.py | TheMindVirus/pico-uf22elf | ee5d95208851e6eba4b21675cae66fdf07176d0e | [
"MIT"
] | null | null | null | elfsample.py | TheMindVirus/pico-uf22elf | ee5d95208851e6eba4b21675cae66fdf07176d0e | [
"MIT"
] | null | null | null | data = b""
data += b"\x7F\x45\x4C\x46\x01\x01\x01\x00\x00\x00\x00\x00\x00\x00\x00\x00"
data += b"\x02\x00\x28\x00\x01\x00\x00\x00\x60\x00\x00\x00\x40\x00\x00\x00"
data += b"\xB0\x00\x00\x00\x00\x00\x00\x00\x34\x00\x20\x00\x01\x00\x28\x00"
data += b"\x04\x00\x03\x00"
data += b"\x00" * (0x40 - len(data))
data += b"\x0... | 41.431818 | 86 | 0.668129 | data = b""
data += b"\x7F\x45\x4C\x46\x01\x01\x01\x00\x00\x00\x00\x00\x00\x00\x00\x00"
data += b"\x02\x00\x28\x00\x01\x00\x00\x00\x60\x00\x00\x00\x40\x00\x00\x00"
data += b"\xB0\x00\x00\x00\x00\x00\x00\x00\x34\x00\x20\x00\x01\x00\x28\x00"
data += b"\x04\x00\x03\x00"
data += b"\x00" * (0x40 - len(data))
data += b"\x0... | true | true |
f731283f2aec8441075c7506a401da140cdbead6 | 20,464 | py | Python | test/functional/test_framework/test_framework.py | AtomicLemon/bitcoinflex | fe02bd48be01e08a047ef8d5821eb247a0681306 | [
"MIT"
] | null | null | null | test/functional/test_framework/test_framework.py | AtomicLemon/bitcoinflex | fe02bd48be01e08a047ef8d5821eb247a0681306 | [
"MIT"
] | null | null | null | test/functional/test_framework/test_framework.py | AtomicLemon/bitcoinflex | fe02bd48be01e08a047ef8d5821eb247a0681306 | [
"MIT"
] | null | null | null | #!/usr/bin/env python3
# Copyright (c) 2014-2017 The Bitcoin Core developers
# Distributed under the MIT software license, see the accompanying
# file COPYING or http://www.opensource.org/licenses/mit-license.php.
"""Base class for RPC testing."""
from enum import Enum
import logging
import optparse
import os
import p... | 42.020534 | 310 | 0.622215 |
from enum import Enum
import logging
import optparse
import os
import pdb
import shutil
import sys
import tempfile
import time
from .authproxy import JSONRPCException
from . import coverage
from .test_node import TestNode
from .util import (
MAX_NODES,
PortSeed,
assert_equal,
check_json_precision,
... | true | true |
f731292a1a4cec34ff126f57ab5b89f88bdd9de5 | 2,733 | py | Python | test/test.py | QITI/Halftones | 8d0692b88711e858a93b90941abd6cb794a592a3 | [
"OLDAP-2.6",
"Python-2.0"
] | 4 | 2020-10-11T13:36:54.000Z | 2021-10-08T07:10:03.000Z | test/test.py | QITI/Halftones | 8d0692b88711e858a93b90941abd6cb794a592a3 | [
"OLDAP-2.6",
"Python-2.0"
] | null | null | null | test/test.py | QITI/Halftones | 8d0692b88711e858a93b90941abd6cb794a592a3 | [
"OLDAP-2.6",
"Python-2.0"
] | 2 | 2019-10-04T16:54:47.000Z | 2020-05-18T13:34:17.000Z | import halftones
from scipy.misc import *
gray = imread('lena1.jpg', True)
# halftones
jarvis = halftones.halftone.error_diffusion_jarvis(gray)
floyd_steinberg = halftones.halftone.error_diffusion_floyd_steinberg(gray)
stucki = halftones.halftone.error_diffusion_stucki(gray)
burkes = halftones.halftone.error_diffusio... | 52.557692 | 101 | 0.868277 | import halftones
from scipy.misc import *
gray = imread('lena1.jpg', True)
jarvis = halftones.halftone.error_diffusion_jarvis(gray)
floyd_steinberg = halftones.halftone.error_diffusion_floyd_steinberg(gray)
stucki = halftones.halftone.error_diffusion_stucki(gray)
burkes = halftones.halftone.error_diffusion_burkes(gra... | true | true |
f7312a9191b2633265f3e838996158b974786d78 | 4,679 | py | Python | desitrip/py/desitrip/scripts/process.py | EquinoxOmega0/timedomain | 092dcda58ed380cdb41f02c1c7af33ac19c52b63 | [
"MIT"
] | 4 | 2021-02-24T15:02:35.000Z | 2022-01-18T19:24:27.000Z | desitrip/py/desitrip/scripts/process.py | MatthewPortman/timedomain | b9c6c2e6804d7dde56311d9402769be545d505d0 | [
"MIT"
] | 35 | 2020-11-06T17:51:08.000Z | 2021-10-14T01:47:16.000Z | desitrip/py/desitrip/scripts/process.py | MatthewPortman/timedomain | b9c6c2e6804d7dde56311d9402769be545d505d0 | [
"MIT"
] | 10 | 2020-03-13T20:34:15.000Z | 2021-09-23T13:35:27.000Z | #!/usr/bin/env python
"""Apply the DESITrIP CNN classifier to observed spectra,
chosen by tile ID and date.
"""
from desispec.io import read_spectra, write_spectra
from desispec.spectra import Spectra
from desitarget.cmx.cmx_targetmask import cmx_mask
from desitrip.preproc import rebin_flux, rescale_flux
from astrop... | 34.404412 | 83 | 0.674717 |
from desispec.io import read_spectra, write_spectra
from desispec.spectra import Spectra
from desitarget.cmx.cmx_targetmask import cmx_mask
from desitrip.preproc import rebin_flux, rescale_flux
from astropy.io import fits
from astropy.table import Table, vstack, hstack
from glob import glob
from datetime import dat... | true | true |
f7312aa4fd65012229519ec351624dc9f6a06ed9 | 3,060 | py | Python | ethtx_ce/backend/processors/abi_processor/balances.py | daifoundation/ethtx_ce | 5aa0de0e33f6af569e840554b024116c9a21d54b | [
"Apache-2.0"
] | 1 | 2021-07-26T11:05:24.000Z | 2021-07-26T11:05:24.000Z | ethtx_ce/backend/processors/abi_processor/balances.py | daifoundation/ethtx_ce | 5aa0de0e33f6af569e840554b024116c9a21d54b | [
"Apache-2.0"
] | null | null | null | ethtx_ce/backend/processors/abi_processor/balances.py | daifoundation/ethtx_ce | 5aa0de0e33f6af569e840554b024116c9a21d54b | [
"Apache-2.0"
] | 1 | 2021-07-26T11:05:32.000Z | 2021-07-26T11:05:32.000Z | # Copyright 2021 DAI Foundation
#
# 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,... | 39.230769 | 88 | 0.605556 |
from collections import defaultdict
from typing import List
from .abc import ABISubmoduleAbc
from ...models.decoded_model import DecodedTransfer, DecodedBalance, AddressInfo
ZERO_ADDRESS = "0x" + 40 * "0"
class ABIBalancesDecoder(ABISubmoduleAbc):
def decode(self, transfers: List[DecodedTransfer]) -> List:
... | true | true |
f7312b9e3d53282b3517fa0a599b4e1dc17e254b | 827 | py | Python | ehome/utils/response_code.py | gavinliu4011/eHome | 2fb06a40ba7092835bd0904145086868cb9d45ed | [
"Apache-2.0"
] | 4 | 2018-07-12T11:49:05.000Z | 2020-03-23T15:14:15.000Z | ehome/utils/response_code.py | gavinliu4011/eHome | 2fb06a40ba7092835bd0904145086868cb9d45ed | [
"Apache-2.0"
] | null | null | null | ehome/utils/response_code.py | gavinliu4011/eHome | 2fb06a40ba7092835bd0904145086868cb9d45ed | [
"Apache-2.0"
] | null | null | null | class RET:
OK = '0'
DBERR = '4001'
NODATA = '4002'
DATAEXIST = '4003'
DATAERR = '4004'
SESSIONERR = '4101'
LOGINERR = '4102'
PARAMERR = '4103'
USERERR = '4104'
ROLEERR = '4105'
PWDERR = '4106'
REQERR = '4201'
IPERR = '4202'
THIRDERR = '4301'
IOERR = '4302'
... | 20.675 | 30 | 0.553809 | class RET:
OK = '0'
DBERR = '4001'
NODATA = '4002'
DATAEXIST = '4003'
DATAERR = '4004'
SESSIONERR = '4101'
LOGINERR = '4102'
PARAMERR = '4103'
USERERR = '4104'
ROLEERR = '4105'
PWDERR = '4106'
REQERR = '4201'
IPERR = '4202'
THIRDERR = '4301'
IOERR = '4302'
... | true | true |
f7312e1e9ac00ea57e3041da27b8c0ce92fd33e4 | 3,146 | py | Python | manabi/apps/books/models.py | aehlke/manabi | 1dfdd4ecb9c1214b6a70268be0dcfeda9da8754b | [
"MIT"
] | 14 | 2015-10-03T07:34:28.000Z | 2021-09-20T07:10:29.000Z | manabi/apps/books/models.py | aehlke/manabi | 1dfdd4ecb9c1214b6a70268be0dcfeda9da8754b | [
"MIT"
] | 23 | 2019-10-25T08:47:23.000Z | 2022-01-30T02:00:45.000Z | manabi/apps/books/models.py | aehlke/manabi | 1dfdd4ecb9c1214b6a70268be0dcfeda9da8754b | [
"MIT"
] | 7 | 2016-10-04T08:10:36.000Z | 2021-09-20T07:10:33.000Z | from functools import wraps
from urllib.error import URLError
from django.db import models
from django.urls import reverse
#from amazonproduct import API as AmazonAPI
from manabi.apps.utils.slugs import slugify
from django.conf import settings
#TODO-OLD find different way.
#amazon_api = AmazonAPI(settings.AWS_KEY, ... | 28.862385 | 83 | 0.608392 | from functools import wraps
from urllib.error import URLError
from django.db import models
from django.urls import reverse
from manabi.apps.utils.slugs import slugify
from django.conf import settings
class DeckedTextbookManager(models.Manager):
def get_query_set(self):
return super(DeckedTextbookManag... | true | true |
f7312ef87c220e201a4ce0da73de12af13f9c8a5 | 17,506 | py | Python | packages/python/plotly/plotly/validators/_surface.py | labaran1/plotly.py | 7ec751e8fed4a570c11ea4bea2231806389d62eb | [
"MIT"
] | null | null | null | packages/python/plotly/plotly/validators/_surface.py | labaran1/plotly.py | 7ec751e8fed4a570c11ea4bea2231806389d62eb | [
"MIT"
] | null | null | null | packages/python/plotly/plotly/validators/_surface.py | labaran1/plotly.py | 7ec751e8fed4a570c11ea4bea2231806389d62eb | [
"MIT"
] | null | null | null | import _plotly_utils.basevalidators
class SurfaceValidator(_plotly_utils.basevalidators.CompoundValidator):
def __init__(self, plotly_name="surface", parent_name="", **kwargs):
super(SurfaceValidator, self).__init__(
plotly_name=plotly_name,
parent_name=parent_name,
dat... | 49.451977 | 72 | 0.542214 | import _plotly_utils.basevalidators
class SurfaceValidator(_plotly_utils.basevalidators.CompoundValidator):
def __init__(self, plotly_name="surface", parent_name="", **kwargs):
super(SurfaceValidator, self).__init__(
plotly_name=plotly_name,
parent_name=parent_name,
dat... | true | true |
f731303f5f0120e8733ff5fb197045d0cce54435 | 34 | py | Python | env/lib/python3.9/site-packages/spline/__init__.py | AdnanKhan27/nicstestbed | d3136e23fda8bd09706eb55d9a8c44ff0ad90730 | [
"MIT"
] | 30 | 2017-12-05T11:12:06.000Z | 2021-11-06T18:27:58.000Z | env/lib/python3.9/site-packages/spline/__init__.py | AdnanKhan27/nicstestbed | d3136e23fda8bd09706eb55d9a8c44ff0ad90730 | [
"MIT"
] | 112 | 2017-10-15T12:13:38.000Z | 2021-01-12T22:29:58.000Z | env/lib/python3.9/site-packages/spline/__init__.py | AdnanKhan27/nicstestbed | d3136e23fda8bd09706eb55d9a8c44ff0ad90730 | [
"MIT"
] | 6 | 2018-08-12T17:01:52.000Z | 2021-08-17T06:05:24.000Z | """Package tool."""
VERSION = 0.1
| 11.333333 | 19 | 0.588235 | VERSION = 0.1
| true | true |
f73130757b4a0554d8ee6445c089aeb67d3e3931 | 4,942 | py | Python | tensor_rl/agents/bandits/LinUCBAgentClass.py | umd-huang-lab/reinforcement-learning-via-spectral-methods | c7bd04d7eea6869807ed70af76960dcc542b0a82 | [
"MIT"
] | null | null | null | tensor_rl/agents/bandits/LinUCBAgentClass.py | umd-huang-lab/reinforcement-learning-via-spectral-methods | c7bd04d7eea6869807ed70af76960dcc542b0a82 | [
"MIT"
] | null | null | null | tensor_rl/agents/bandits/LinUCBAgentClass.py | umd-huang-lab/reinforcement-learning-via-spectral-methods | c7bd04d7eea6869807ed70af76960dcc542b0a82 | [
"MIT"
] | null | null | null | '''
Basic LinUCB implementation.
'''
# Python imports.
import numpy as np
from collections import defaultdict
# Other imports.
from tensor_rl.agents.AgentClass import Agent
class LinUCBAgent(Agent):
'''
From:
Lihong Li, et al. "A Contextual-Bandit Approach to Personalized
News Article Recomme... | 32.300654 | 124 | 0.581951 |
import numpy as np
from collections import defaultdict
from tensor_rl.agents.AgentClass import Agent
class LinUCBAgent(Agent):
def __init__(self, actions, name="LinUCB", rand_init=True, context_size=1, alpha=1.5):
Agent.__init__(self, name, actions)
self.alpha = alpha
self.context_size =... | true | true |
f731324a891f6c3b18ab949c169e91cd701cd440 | 4,071 | py | Python | tests/ast_parser/analyzers/test_module_analyzer.py | FredHappyface/handsdown | 097cfd5addbed22ba8ab21d4657da24459b09667 | [
"MIT"
] | 47 | 2019-10-18T13:59:20.000Z | 2022-03-21T21:46:30.000Z | tests/ast_parser/analyzers/test_module_analyzer.py | FredHappyface/handsdown | 097cfd5addbed22ba8ab21d4657da24459b09667 | [
"MIT"
] | 15 | 2019-10-24T13:42:02.000Z | 2022-03-22T19:25:49.000Z | tests/ast_parser/analyzers/test_module_analyzer.py | FredHappyface/handsdown | 097cfd5addbed22ba8ab21d4657da24459b09667 | [
"MIT"
] | 7 | 2019-11-22T12:24:57.000Z | 2022-01-29T13:18:51.000Z | # pylint: disable=missing-docstring
import unittest
from unittest.mock import MagicMock
import handsdown.ast_parser.smart_ast as ast
from handsdown.ast_parser.analyzers.module_analyzer import ModuleAnalyzer
class TestModuleAnalyzer(unittest.TestCase):
def test_init(self):
analyzer = ModuleAnalyzer()
... | 37.348624 | 73 | 0.671825 | import unittest
from unittest.mock import MagicMock
import handsdown.ast_parser.smart_ast as ast
from handsdown.ast_parser.analyzers.module_analyzer import ModuleAnalyzer
class TestModuleAnalyzer(unittest.TestCase):
def test_init(self):
analyzer = ModuleAnalyzer()
self.assertEqual(analyzer.all_na... | true | true |
f73132b3321a9a9b53f0f68a1273c7a905986331 | 18,983 | py | Python | test/generic/pointers/test_pointer_tensor.py | harshkasyap/PySyft | 4575a50f38b78728dafe2615aad9145dae17b085 | [
"Apache-2.0"
] | null | null | null | test/generic/pointers/test_pointer_tensor.py | harshkasyap/PySyft | 4575a50f38b78728dafe2615aad9145dae17b085 | [
"Apache-2.0"
] | null | null | null | test/generic/pointers/test_pointer_tensor.py | harshkasyap/PySyft | 4575a50f38b78728dafe2615aad9145dae17b085 | [
"Apache-2.0"
] | null | null | null | import torch
import torch as th
import syft
from syft.frameworks.torch.tensors.interpreters.additive_shared import AdditiveSharingTensor
from syft.frameworks.torch.tensors.interpreters.precision import FixedPrecisionTensor
from syft.generic.pointers.pointer_tensor import PointerTensor
import pytest
def test_init(wor... | 26.661517 | 95 | 0.645788 | import torch
import torch as th
import syft
from syft.frameworks.torch.tensors.interpreters.additive_shared import AdditiveSharingTensor
from syft.frameworks.torch.tensors.interpreters.precision import FixedPrecisionTensor
from syft.generic.pointers.pointer_tensor import PointerTensor
import pytest
def test_init(wor... | true | true |
f73133716abf93447f9a681574d785a552cadd2f | 877 | py | Python | setup.py | jomido/jogger | d105a5d701c7958bb5ad072af4c23477e82cd363 | [
"MIT"
] | 6 | 2015-08-06T00:54:48.000Z | 2022-02-03T13:55:33.000Z | setup.py | jomido/jogger | d105a5d701c7958bb5ad072af4c23477e82cd363 | [
"MIT"
] | null | null | null | setup.py | jomido/jogger | d105a5d701c7958bb5ad072af4c23477e82cd363 | [
"MIT"
] | 1 | 2015-05-19T11:45:34.000Z | 2015-05-19T11:45:34.000Z | from setuptools import setup, find_packages
setup(
name='jogger',
version='0.1.1',
description='Navigate log files.',
long_description=(
open('README.md').read()
),
url='http://github.com/jomido/jogger/',
license='MIT',
author='Jonathan Dobson',
author_email='jon.m.dobson@gm... | 29.233333 | 54 | 0.586089 | from setuptools import setup, find_packages
setup(
name='jogger',
version='0.1.1',
description='Navigate log files.',
long_description=(
open('README.md').read()
),
url='http://github.com/jomido/jogger/',
license='MIT',
author='Jonathan Dobson',
author_email='jon.m.dobson@gm... | true | true |
f73134a89fd7d8c446480e1eb914cc01383bee8e | 4,859 | py | Python | sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2018_02_14/operations/_private_link_resources_operations.py | vbarbaresi/azure-sdk-for-python | 397ba46c51d001ff89c66b170f5576cf8f49c05f | [
"MIT"
] | 8 | 2021-01-13T23:44:08.000Z | 2021-03-17T10:13:36.000Z | sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2018_02_14/operations/_private_link_resources_operations.py | vbarbaresi/azure-sdk-for-python | 397ba46c51d001ff89c66b170f5576cf8f49c05f | [
"MIT"
] | 2 | 2021-11-03T06:10:36.000Z | 2021-12-01T06:29:39.000Z | sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2018_02_14/operations/_private_link_resources_operations.py | vbarbaresi/azure-sdk-for-python | 397ba46c51d001ff89c66b170f5576cf8f49c05f | [
"MIT"
] | 1 | 2021-12-18T20:01:22.000Z | 2021-12-18T20:01:22.000Z | # coding=utf-8
# --------------------------------------------------------------------------
# Copyright (c) Microsoft Corporation. All rights reserved.
# Licensed under the MIT License. See License.txt in the project root for license information.
# Code generated by Microsoft (R) AutoRest Code Generator.
# Changes may ... | 46.27619 | 191 | 0.686149 | from typing import TYPE_CHECKING
import warnings
from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error
from azure.core.pipeline import PipelineResponse
from azure.core.pipeline.transport import HttpRequest, HttpResponse
from azure.mgmt.cor... | true | true |
f73134cfd4c3af902e244125da2780eb7d8fee85 | 16,270 | py | Python | libgoods/libgoods/noaa_coops.py | NOAA-ORR-ERD/GnomeTools | a9ff592bd9c7ed098f6081367aa35eae525c9774 | [
"Unlicense"
] | 2 | 2017-02-15T20:45:42.000Z | 2020-10-09T16:00:00.000Z | libgoods/libgoods/noaa_coops.py | NOAA-ORR-ERD/GnomeTools | a9ff592bd9c7ed098f6081367aa35eae525c9774 | [
"Unlicense"
] | 10 | 2015-06-25T23:42:11.000Z | 2021-06-22T16:19:19.000Z | libgoods/libgoods/noaa_coops.py | NOAA-ORR-ERD/GnomeTools | a9ff592bd9c7ed098f6081367aa35eae525c9774 | [
"Unlicense"
] | 15 | 2016-01-11T20:49:10.000Z | 2020-10-15T18:02:20.000Z | #!/usr/bin/env python
from __future__ import print_function
import datetime
try:
from urllib.request import urlopen, Request #py3
except ImportError:
from urllib2 import urlopen, Request #py2
import requests
from netCDF4 import Dataset
import os, glob
'''
Methods for generating ordered filelist for... | 42.041344 | 544 | 0.631776 | from __future__ import print_function
import datetime
try:
from urllib.request import urlopen, Request except ImportError:
from urllib2 import urlopen, Request
import requests
from netCDF4 import Dataset
import os, glob
# The node values were determined by plotting grid, they
# are not ... | true | true |
f73135263aa5d42f8ba22ba5ad4466b2c6a05dc0 | 2,549 | py | Python | python2/koans/about_modules.py | rameshugar/koans | 35f2407dac045040bfd54ebe9f95ce77fd8a1b23 | [
"MIT"
] | null | null | null | python2/koans/about_modules.py | rameshugar/koans | 35f2407dac045040bfd54ebe9f95ce77fd8a1b23 | [
"MIT"
] | null | null | null | python2/koans/about_modules.py | rameshugar/koans | 35f2407dac045040bfd54ebe9f95ce77fd8a1b23 | [
"MIT"
] | null | null | null | #!/usr/bin/env python
# -*- coding: utf-8 -*-
#
# This is very different to AboutModules in Ruby Koans
# Our AboutMultipleInheritance class is a little more comparable
#
from runner.koan import *
from another_local_module import *
from local_module_with_all_defined import *
class AboutModules(Koan):
def test_i... | 32.265823 | 83 | 0.673597 |
from runner.koan import *
from another_local_module import *
from local_module_with_all_defined import *
class AboutModules(Koan):
def test_importing_other_python_scripts_as_modules(self):
import local_module
duck = local_module.Duck()
self.assertEqual("Daffy", duck.name)
def tes... | true | true |
f7313861d3e6c67d85bfeb4b43faf3df2789455b | 8,380 | py | Python | data/torch_151_data/sampler.py | jihuacao/Putil | b753fc94bea4cbda00f483681c55f0e9f54adef2 | [
"Apache-2.0"
] | 1 | 2018-12-09T06:09:29.000Z | 2018-12-09T06:09:29.000Z | data/torch_151_data/sampler.py | jihuacao/Putil | b753fc94bea4cbda00f483681c55f0e9f54adef2 | [
"Apache-2.0"
] | null | null | null | data/torch_151_data/sampler.py | jihuacao/Putil | b753fc94bea4cbda00f483681c55f0e9f54adef2 | [
"Apache-2.0"
] | null | null | null | import torch
from torch._six import int_classes as _int_classes
class Sampler(object):
r"""Base class for all Samplers.
Every Sampler subclass has to provide an :meth:`__iter__` method, providing a
way to iterate over indices of dataset elements, and a :meth:`__len__` method
that returns the length o... | 39.342723 | 100 | 0.631742 | import torch
from torch._six import int_classes as _int_classes
class Sampler(object):
def __init__(self, data_source):
pass
def __iter__(self):
raise NotImplementedError
class Sequenti... | true | true |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.