hexsha stringlengths 40 40 | size int64 4 996k | ext stringclasses 8
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 4 996k | avg_line_length float64 1.33 58.2k | max_line_length int64 2 323k | alphanum_fraction float64 0 0.97 | content_no_comment stringlengths 0 946k | is_comment_constant_removed bool 2
classes | is_sharp_comment_removed bool 1
class |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
f726ec3d0e2d020ea619b787e5eec91931023911 | 5,455 | py | Python | bin/make_changelog.py | nyuszika7h/rclone | 7bf056316fe82aa9566f6e482da5cd9b184ac3f7 | [
"MIT"
] | 3 | 2018-08-25T01:14:39.000Z | 2022-03-22T00:36:27.000Z | bin/make_changelog.py | nyuszika7h/rclone | 7bf056316fe82aa9566f6e482da5cd9b184ac3f7 | [
"MIT"
] | 1 | 2020-12-01T17:00:00.000Z | 2020-12-01T17:00:00.000Z | bin/make_changelog.py | nyuszika7h/rclone | 7bf056316fe82aa9566f6e482da5cd9b184ac3f7 | [
"MIT"
] | 2 | 2021-01-16T07:35:41.000Z | 2021-01-16T08:41:00.000Z | #!/usr/bin/python3
"""
Generate a markdown changelog for the rclone project
"""
import os
import sys
import re
import datetime
import subprocess
from collections import defaultdict
IGNORE_RES = [
r"^Add .* to contributors$",
r"^Start v\d+\.\d+(\.\d+)?-DEV development$",
r"^Version v\d+\.\d+(\.\d+)?$",
]
... | 31.171429 | 128 | 0.6033 |
import os
import sys
import re
import datetime
import subprocess
from collections import defaultdict
IGNORE_RES = [
r"^Add .* to contributors$",
r"^Start v\d+\.\d+(\.\d+)?-DEV development$",
r"^Version v\d+\.\d+(\.\d+)?$",
]
IGNORE_RE = re.compile("(?:" + "|".join(IGNORE_RES) + ")")
CATEGORY = re.compi... | true | true |
f726ef153fc15bb0f73f2ddd0be42d2221822c43 | 12,328 | py | Python | dnnutil/training.py | catalys1/dnnutil | a55a73ae59c5ac0117f58d8d8136bdd32902141f | [
"MIT"
] | null | null | null | dnnutil/training.py | catalys1/dnnutil | a55a73ae59c5ac0117f58d8d8136bdd32902141f | [
"MIT"
] | 9 | 2018-07-31T02:53:23.000Z | 2019-03-28T16:57:45.000Z | dnnutil/training.py | catalys1/dnnutil | a55a73ae59c5ac0117f58d8d8136bdd32902141f | [
"MIT"
] | null | null | null | import torch
import numpy as np
import dnnutil.network as network
import time
__all__ = ['calculate_accuracy', 'Trainer', 'ClassifierTrainer', 'AutoencoderTrainer']
def calculate_accuracy(prediction, label, axis=1):
'''calculate_accuracy(prediction, label)
Computes the mean accuracy over a batch of pre... | 36.473373 | 86 | 0.596042 | import torch
import numpy as np
import dnnutil.network as network
import time
__all__ = ['calculate_accuracy', 'Trainer', 'ClassifierTrainer', 'AutoencoderTrainer']
def calculate_accuracy(prediction, label, axis=1):
return torch.eq(prediction.argmax(axis), label).float().mean().item()
class Trainer(object):
... | true | true |
f726efc91697481d09f75f4837fbbf66b5fd0535 | 4,736 | py | Python | build_nec_file.py | crumpstrr33/NEC_scripts | fcb88afc538c884dab141ac26529ed3adf53e81e | [
"MIT"
] | null | null | null | build_nec_file.py | crumpstrr33/NEC_scripts | fcb88afc538c884dab141ac26529ed3adf53e81e | [
"MIT"
] | null | null | null | build_nec_file.py | crumpstrr33/NEC_scripts | fcb88afc538c884dab141ac26529ed3adf53e81e | [
"MIT"
] | null | null | null | """
This script uses python to build a `.nec` file. This allows
for the use of variables and other arithmetic which is much
easier in python. For information on the cards specified by the
arguments, e.g. EX or RP, check out https://www.nec2.org/part_3/cards/
"""
from datetime import datetime as dt
from math import *
... | 39.798319 | 81 | 0.618243 | from datetime import datetime as dt
from math import *
def build_nec_file(
comments,
wires,
constants,
frequency=[],
excitations=[],
rad_pattern=[],
output="output",
lims=[2, 5, 10, 20, 30, 40, 50, 60, 70, 80],
sig_figs=2,
verbose=0,
):
def _format_rows(rows, car... | true | true |
f726f0ecbf1474170ae42090ca93cfbcb7385ec8 | 1,735 | py | Python | flightServices/flightApp/views.py | saibottrenham/djangorest | 45efadabb19cf421a282b98f3480cf49789eaae1 | [
"MIT"
] | null | null | null | flightServices/flightApp/views.py | saibottrenham/djangorest | 45efadabb19cf421a282b98f3480cf49789eaae1 | [
"MIT"
] | null | null | null | flightServices/flightApp/views.py | saibottrenham/djangorest | 45efadabb19cf421a282b98f3480cf49789eaae1 | [
"MIT"
] | null | null | null | from django.shortcuts import render
from flightApp.models import Flight, Passenger, Reservation
from flightApp.serializers import FlightSerializer, PassengerSerializer, ReservationSerializer
from rest_framework import viewsets
from rest_framework.response import Response
from rest_framework.decorators import api_view
f... | 34.019608 | 97 | 0.748703 | from django.shortcuts import render
from flightApp.models import Flight, Passenger, Reservation
from flightApp.serializers import FlightSerializer, PassengerSerializer, ReservationSerializer
from rest_framework import viewsets
from rest_framework.response import Response
from rest_framework.decorators import api_view
f... | true | true |
f726f0f2c8fef30d17ac352da7f4d08edb92adb8 | 15,583 | py | Python | nemo/collections/asr/models/classification_models.py | vinayphadnis/NeMo | 9dc7773c48e164b8a82051bb558a728c6eeb85ec | [
"Apache-2.0"
] | 2 | 2020-10-08T13:38:46.000Z | 2020-10-14T15:09:34.000Z | nemo/collections/asr/models/classification_models.py | vinayphadnis/NeMo | 9dc7773c48e164b8a82051bb558a728c6eeb85ec | [
"Apache-2.0"
] | null | null | null | nemo/collections/asr/models/classification_models.py | vinayphadnis/NeMo | 9dc7773c48e164b8a82051bb558a728c6eeb85ec | [
"Apache-2.0"
] | 1 | 2020-12-18T14:23:37.000Z | 2020-12-18T14:23:37.000Z | # Copyright (c) 2020, NVIDIA CORPORATION. All rights reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by appli... | 46.10355 | 258 | 0.686774 |
import copy
from typing import Dict, List, Optional, Union
import torch
from omegaconf import DictConfig, ListConfig, OmegaConf
from pytorch_lightning import Trainer
from nemo.collections.asr.data.audio_to_text import AudioLabelDataset
from nemo.collections.asr.models.asr_model import ASRModel
from nemo... | true | true |
f726f228726b7b2b3f9d488b6ba21009b47132f1 | 881 | py | Python | website/addons/s3/__init__.py | sf2ne/Playground | 95b2d222d7ac43baca0249acbfc34e043d6a95b3 | [
"Apache-2.0"
] | null | null | null | website/addons/s3/__init__.py | sf2ne/Playground | 95b2d222d7ac43baca0249acbfc34e043d6a95b3 | [
"Apache-2.0"
] | 13 | 2020-03-24T15:29:41.000Z | 2022-03-11T23:15:28.000Z | website/addons/s3/__init__.py | sf2ne/Playground | 95b2d222d7ac43baca0249acbfc34e043d6a95b3 | [
"Apache-2.0"
] | null | null | null | import os
from . import model
from . import routes
from . import views
MODELS = [model.AddonS3UserSettings, model.AddonS3NodeSettings]
USER_SETTINGS_MODEL = model.AddonS3UserSettings
NODE_SETTINGS_MODEL = model.AddonS3NodeSettings
ROUTES = [routes.settings_routes]
SHORT_NAME = 's3'
FULL_NAME = 'Amazon S3'
OWNERS ... | 20.97619 | 81 | 0.727582 | import os
from . import model
from . import routes
from . import views
MODELS = [model.AddonS3UserSettings, model.AddonS3NodeSettings]
USER_SETTINGS_MODEL = model.AddonS3UserSettings
NODE_SETTINGS_MODEL = model.AddonS3NodeSettings
ROUTES = [routes.settings_routes]
SHORT_NAME = 's3'
FULL_NAME = 'Amazon S3'
OWNERS ... | true | true |
f726f26f0db530e1d6ac7228dc6da3573ce0200f | 237 | py | Python | CodingTestForEmployment/Part3/implementation/implementation1.py | lkc263/Algorithm_Study_Python | 5b9a74ecf7e864c861df2280a1bf4b393b0fcbca | [
"MIT"
] | null | null | null | CodingTestForEmployment/Part3/implementation/implementation1.py | lkc263/Algorithm_Study_Python | 5b9a74ecf7e864c861df2280a1bf4b393b0fcbca | [
"MIT"
] | null | null | null | CodingTestForEmployment/Part3/implementation/implementation1.py | lkc263/Algorithm_Study_Python | 5b9a74ecf7e864c861df2280a1bf4b393b0fcbca | [
"MIT"
] | null | null | null | n = input()
front_n = n[0:len(n)//2]
back_n = n[len(n)//2:len(n)]
front_n = map(int,front_n)
back_n = map(int,back_n)
result_f = sum(front_n)
result_b = sum(back_n)
if result_f == result_b:
print('LUCKY')
else:
print('READY') | 15.8 | 28 | 0.637131 | n = input()
front_n = n[0:len(n)//2]
back_n = n[len(n)//2:len(n)]
front_n = map(int,front_n)
back_n = map(int,back_n)
result_f = sum(front_n)
result_b = sum(back_n)
if result_f == result_b:
print('LUCKY')
else:
print('READY') | true | true |
f726f3e6b68297e13227e122ba85506dd2bb46e5 | 2,762 | py | Python | pyclustering/samples/__init__.py | JosephChataignon/pyclustering | bf4f51a472622292627ec8c294eb205585e50f52 | [
"BSD-3-Clause"
] | 1,013 | 2015-01-26T19:50:14.000Z | 2022-03-31T07:38:48.000Z | pyclustering/samples/__init__.py | peterlau0626/pyclustering | bf4f51a472622292627ec8c294eb205585e50f52 | [
"BSD-3-Clause"
] | 542 | 2015-01-20T16:44:32.000Z | 2022-01-29T14:57:20.000Z | pyclustering/samples/__init__.py | peterlau0626/pyclustering | bf4f51a472622292627ec8c294eb205585e50f52 | [
"BSD-3-Clause"
] | 262 | 2015-03-19T07:28:12.000Z | 2022-03-30T07:28:24.000Z | """!
@brief pyclustering module for samples.
@authors Andrei Novikov (pyclustering@yandex.ru)
@date 2014-2020
@copyright BSD-3-Clause
"""
class answer_reader:
"""!
@brief Answer reader for samples that are used by pyclustering library.
"""
def __init__(self, answer_path):
... | 26.815534 | 118 | 0.589428 |
class answer_reader:
def __init__(self, answer_path):
self.__answer_path = answer_path
self.__clusters = None
self.__noise = None
def get_clusters(self):
self.__read_answer()
return self.__clusters
def get_noise(self):
self.__read_answer... | true | true |
f726f53393a6475b58d999e2bc14d087f34c543e | 1,919 | py | Python | calendar_events/views.py | alexkyllo/django-calendar-events | f1ad2c2b858f93a1256604ff9f7b223914acf29e | [
"Apache-2.0"
] | 1 | 2016-09-09T04:16:10.000Z | 2016-09-09T04:16:10.000Z | calendar_events/views.py | alexkyllo/django-calendar-events | f1ad2c2b858f93a1256604ff9f7b223914acf29e | [
"Apache-2.0"
] | null | null | null | calendar_events/views.py | alexkyllo/django-calendar-events | f1ad2c2b858f93a1256604ff9f7b223914acf29e | [
"Apache-2.0"
] | 2 | 2018-04-19T19:29:46.000Z | 2018-09-21T00:18:22.000Z | from django.shortcuts import render, render_to_response
from django.http import Http404
from django.http import HttpResponse, HttpResponseRedirect
from django.template import RequestContext
from django.views.decorators.http import require_GET, require_POST, require_http_methods
from models import *
from forms import *
... | 35.537037 | 133 | 0.756123 | from django.shortcuts import render, render_to_response
from django.http import Http404
from django.http import HttpResponse, HttpResponseRedirect
from django.template import RequestContext
from django.views.decorators.http import require_GET, require_POST, require_http_methods
from models import *
from forms import *
... | true | true |
f726f57c229488230500b5d7998e2d3d8ba1a490 | 176 | py | Python | regular-expressions-tutorial/verify_email.py | dapopov-st/python-youtube-code | 770c9291988898f259ad28bbab5989acee8fb830 | [
"MIT"
] | 262 | 2020-03-17T03:24:35.000Z | 2022-03-22T12:50:02.000Z | regular-expressions-tutorial/verify_email.py | dapopov-st/python-youtube-code | 770c9291988898f259ad28bbab5989acee8fb830 | [
"MIT"
] | 14 | 2020-07-12T14:17:36.000Z | 2022-03-21T09:38:45.000Z | regular-expressions-tutorial/verify_email.py | dapopov-st/python-youtube-code | 770c9291988898f259ad28bbab5989acee8fb830 | [
"MIT"
] | 583 | 2020-02-12T17:54:21.000Z | 2022-03-30T03:59:21.000Z | import re
pattern = "[a-zA-Z0-9]+@[a-zA-z]+\.(com|edu|net)"
user_input = input()
if(re.search(pattern, user_input)):
print("valid email")
else:
print("invalid email")
| 19.555556 | 49 | 0.636364 | import re
pattern = "[a-zA-Z0-9]+@[a-zA-z]+\.(com|edu|net)"
user_input = input()
if(re.search(pattern, user_input)):
print("valid email")
else:
print("invalid email")
| true | true |
f726f5c4e2f692389ad5a170f072d70c27e57734 | 3,838 | py | Python | reservation_rest_api.py | usc-isi-i2/wikidata-reservation | 1298ec2a7b347ed88bc93fa30531fa9b10c651a7 | [
"MIT"
] | null | null | null | reservation_rest_api.py | usc-isi-i2/wikidata-reservation | 1298ec2a7b347ed88bc93fa30531fa9b10c651a7 | [
"MIT"
] | null | null | null | reservation_rest_api.py | usc-isi-i2/wikidata-reservation | 1298ec2a7b347ed88bc93fa30531fa9b10c651a7 | [
"MIT"
] | null | null | null | from flask import Flask, request
from reservation_service import get_qnode, read_data, register, delete_namespace
import json
import logging
from tabulate import tabulate
app = Flask(__name__)
ALLOWED_EXTENSIONS = {'xls', 'yaml', 'csv', 'json'}
logger = logging.getLogger()
logger.setLevel(logging.DEBUG)
# logging.ba... | 36.552381 | 113 | 0.632882 | from flask import Flask, request
from reservation_service import get_qnode, read_data, register, delete_namespace
import json
import logging
from tabulate import tabulate
app = Flask(__name__)
ALLOWED_EXTENSIONS = {'xls', 'yaml', 'csv', 'json'}
logger = logging.getLogger()
logger.setLevel(logging.DEBUG)
logging.ba... | true | true |
f726f5c80de9e071ad05e77e26f7512ec0cee0dd | 5,269 | py | Python | models.py | gautamMalu/Aesthetic_attributes_maps | f2462c92d414f9457a3babd32171b071e4703515 | [
"MIT"
] | 22 | 2017-07-14T02:53:27.000Z | 2021-03-19T20:13:12.000Z | models.py | gautamMalu/Aesthetic_attributes_maps | f2462c92d414f9457a3babd32171b071e4703515 | [
"MIT"
] | 3 | 2017-07-25T03:01:23.000Z | 2018-06-27T14:03:43.000Z | models.py | gautamMalu/Aesthetic_attributes_maps | f2462c92d414f9457a3babd32171b071e4703515 | [
"MIT"
] | 11 | 2017-07-14T08:23:33.000Z | 2021-11-24T09:18:48.000Z | from keras.applications.resnet50 import ResNet50
from keras.applications.vgg16 import VGG16
from keras.layers import Flatten, Dropout, Lambda, GlobalAveragePooling2D, merge, Input, Dense
from keras.models import Model
import keras.backend as K
#from keras.utils.visualize_util import plot
#from SpatialPyramidPooling imp... | 37.368794 | 126 | 0.707155 | from keras.applications.resnet50 import ResNet50
from keras.applications.vgg16 import VGG16
from keras.layers import Flatten, Dropout, Lambda, GlobalAveragePooling2D, merge, Input, Dense
from keras.models import Model
import keras.backend as K
def l2_normalize(x):
return K.l2_normalize(x, 0)
def l2_normalize_... | true | true |
f726f884a93cc0f5b265ff93d535edd969498ccd | 518 | py | Python | Models/initialize.py | jeffrey-clark/gender_in_academia | 25f76abfccb06ee7d6a630ee1d4cecdbf6dbe21d | [
"MIT"
] | null | null | null | Models/initialize.py | jeffrey-clark/gender_in_academia | 25f76abfccb06ee7d6a630ee1d4cecdbf6dbe21d | [
"MIT"
] | null | null | null | Models/initialize.py | jeffrey-clark/gender_in_academia | 25f76abfccb06ee7d6a630ee1d4cecdbf6dbe21d | [
"MIT"
] | null | null | null | # import dependencies
import os, re, io, sys
import pandas as pd
#import mysql.connector
import json
import numpy as np
# import function collections
from Functions.j_functions import *
from Functions.language import *
from Functions.functions import *
# set universal variables
project_root = os.path.abspath(os.path... | 24.666667 | 83 | 0.69305 |
import os, re, io, sys
import pandas as pd
import json
import numpy as np
from Functions.j_functions import *
from Functions.language import *
from Functions.functions import *
project_root = os.path.abspath(os.path.join(os.path.dirname(__file__), ".."))
pref_order = ['app_id', 'name', 'surname', 'financier', '... | true | true |
f726f911716ec981e91b4ea974dc3e14779424c2 | 29,285 | py | Python | zdd.py | sonecabr/marathon-lb-rsyslog | 1e4f6a738b7b7afaa0b2a70c67963b95f8ee54c8 | [
"Apache-2.0"
] | null | null | null | zdd.py | sonecabr/marathon-lb-rsyslog | 1e4f6a738b7b7afaa0b2a70c67963b95f8ee54c8 | [
"Apache-2.0"
] | null | null | null | zdd.py | sonecabr/marathon-lb-rsyslog | 1e4f6a738b7b7afaa0b2a70c67963b95f8ee54c8 | [
"Apache-2.0"
] | null | null | null | #!/usr/bin/env python3
import argparse
import csv
import json
import logging
import math
import socket
import subprocess
import sys
import time
import traceback
from datetime import datetime
from collections import namedtuple
import requests
import six.moves.urllib as urllib
from common import (get_marathon_auth_par... | 35.325694 | 82 | 0.623937 |
import argparse
import csv
import json
import logging
import math
import socket
import subprocess
import sys
import time
import traceback
from datetime import datetime
from collections import namedtuple
import requests
import six.moves.urllib as urllib
from common import (get_marathon_auth_params, set_logging_args,... | true | true |
f726fa1e73e6103ef46be0193e0b17c20617c6fb | 2,819 | py | Python | generator/modules/caffe.py | kklemon/deepo | 038063faf9a4c883a853aac77471e859f61b0d0a | [
"MIT"
] | null | null | null | generator/modules/caffe.py | kklemon/deepo | 038063faf9a4c883a853aac77471e859f61b0d0a | [
"MIT"
] | null | null | null | generator/modules/caffe.py | kklemon/deepo | 038063faf9a4c883a853aac77471e859f61b0d0a | [
"MIT"
] | null | null | null | # -*- coding: utf-8 -*-
from .__module__ import Module, dependency, source
from .tools import Tools
from .boost import Boost
from .python import Python
from .opencv import Opencv
@dependency(Tools, Python, Boost, Opencv)
@source('git')
class Caffe(Module):
def build(self):
pyver = self.composer.ver(Pytho... | 40.855072 | 90 | 0.496985 |
from .__module__ import Module, dependency, source
from .tools import Tools
from .boost import Boost
from .python import Python
from .opencv import Opencv
@dependency(Tools, Python, Boost, Opencv)
@source('git')
class Caffe(Module):
def build(self):
pyver = self.composer.ver(Python)
cpu_only = s... | true | true |
f726fac98d42191736a2bb1553a3990d3286b9b1 | 4,770 | py | Python | surfpy/simplegribmessage.py | mjmayank1/surfpy | 969b1a626db7606a42fab0eae445fcb351d6cbcd | [
"MIT"
] | 46 | 2018-04-08T15:56:32.000Z | 2022-01-05T17:36:55.000Z | surfpy/simplegribmessage.py | mjmayank1/surfpy | 969b1a626db7606a42fab0eae445fcb351d6cbcd | [
"MIT"
] | 13 | 2017-08-15T13:12:10.000Z | 2021-03-23T09:09:04.000Z | surfpy/simplegribmessage.py | mjmayank1/surfpy | 969b1a626db7606a42fab0eae445fcb351d6cbcd | [
"MIT"
] | 15 | 2018-03-08T16:52:19.000Z | 2021-12-27T21:17:37.000Z | try:
from grippy.message import Message
except:
Message = None
from .location import Location
import math
import datetime
from . import tools
class SimpleGribMessage(Message):
def __init__(self, data, offset):
super(SimpleGribMessage, self).__init__(data, offset)
@property
def model_time... | 30.974026 | 128 | 0.692034 | try:
from grippy.message import Message
except:
Message = None
from .location import Location
import math
import datetime
from . import tools
class SimpleGribMessage(Message):
def __init__(self, data, offset):
super(SimpleGribMessage, self).__init__(data, offset)
@property
def model_time... | true | true |
f726fb4d2abc77279d107a4f456ba056c71958e4 | 2,801 | py | Python | tests/test_lsp.py | Zhu-Liu/cp2k-input-tools | 3c84e82554bc5cde687395499e3d6f9e2b50e13b | [
"MIT"
] | null | null | null | tests/test_lsp.py | Zhu-Liu/cp2k-input-tools | 3c84e82554bc5cde687395499e3d6f9e2b50e13b | [
"MIT"
] | null | null | null | tests/test_lsp.py | Zhu-Liu/cp2k-input-tools | 3c84e82554bc5cde687395499e3d6f9e2b50e13b | [
"MIT"
] | 1 | 2020-12-22T19:20:53.000Z | 2020-12-22T19:20:53.000Z | from pathlib import Path
from time import sleep
import io
import sys
import pytest
from . import TEST_DIR
try:
from pygls.features import INITIALIZE, TEXT_DOCUMENT_DID_OPEN
from pygls.types import DidOpenTextDocumentParams, TextDocumentItem, InitializeParams
except ImportError:
pytest.skip("pygls unavail... | 32.952941 | 128 | 0.735809 | from pathlib import Path
from time import sleep
import io
import sys
import pytest
from . import TEST_DIR
try:
from pygls.features import INITIALIZE, TEXT_DOCUMENT_DID_OPEN
from pygls.types import DidOpenTextDocumentParams, TextDocumentItem, InitializeParams
except ImportError:
pytest.skip("pygls unavail... | true | true |
f726fcafaecf7a7db97b64adcecf290f5e75fcde | 862 | py | Python | emailnetwork/tests/test_graph.py | utomoreza/emailnetwork | 5b9e3532173256be6e766e216d54aaa895210adc | [
"MIT"
] | 8 | 2021-03-26T12:36:47.000Z | 2022-03-16T22:48:05.000Z | emailnetwork/tests/test_graph.py | utomoreza/emailnetwork | 5b9e3532173256be6e766e216d54aaa895210adc | [
"MIT"
] | 8 | 2021-02-20T08:47:21.000Z | 2022-01-21T10:18:50.000Z | emailnetwork/tests/test_graph.py | utomoreza/emailnetwork | 5b9e3532173256be6e766e216d54aaa895210adc | [
"MIT"
] | 17 | 2021-01-28T02:38:38.000Z | 2022-03-27T08:07:49.000Z | import os
from unittest import TestCase, mock
from emailnetwork.extract import MBoxReader
# from emailnetwork.graph import plot_single_email
import emailnetwork.graph as graph
MBOX_PATH = f'{os.path.dirname(__file__)}/test.mbox'
@mock.patch(f"{__name__}.graph.plt")
def test_plot_single_directed(mock_plt):
reader... | 31.925926 | 200 | 0.722738 | import os
from unittest import TestCase, mock
from emailnetwork.extract import MBoxReader
import emailnetwork.graph as graph
MBOX_PATH = f'{os.path.dirname(__file__)}/test.mbox'
@mock.patch(f"{__name__}.graph.plt")
def test_plot_single_directed(mock_plt):
reader = MBoxReader(MBOX_PATH)
graph.plot_single_dir... | true | true |
f726fcb5e7e57b3c5f279ecd143cbfc0329a5cc9 | 5,866 | py | Python | globus_cli/parsing/command_state.py | glentner/globus-cli | a6542d6824cc123f60088bf2602cd7a0fdb0e64e | [
"Apache-2.0"
] | null | null | null | globus_cli/parsing/command_state.py | glentner/globus-cli | a6542d6824cc123f60088bf2602cd7a0fdb0e64e | [
"Apache-2.0"
] | null | null | null | globus_cli/parsing/command_state.py | glentner/globus-cli | a6542d6824cc123f60088bf2602cd7a0fdb0e64e | [
"Apache-2.0"
] | null | null | null | import warnings
import click
import jmespath
from globus_cli import config
# Format Enum for output formatting
# could use a namedtuple, but that's overkill
JSON_FORMAT = "json"
TEXT_FORMAT = "text"
UNIX_FORMAT = "unix"
class CommandState:
def __init__(self):
# default is config value, or TEXT if it's ... | 28.896552 | 80 | 0.579782 | import warnings
import click
import jmespath
from globus_cli import config
JSON_FORMAT = "json"
TEXT_FORMAT = "text"
UNIX_FORMAT = "unix"
class CommandState:
def __init__(self):
# default is config value, or TEXT if it's not set
self.output_format = config.get_output_format() or TEXT_FORMAT
... | true | true |
f726fe1931108c84f05c321fc08cb81032045981 | 272 | py | Python | accounts/views.py | Monkasen/blog_project | fac6618007d03e4f127f0c0c302a90595054ff12 | [
"CC0-1.0"
] | null | null | null | accounts/views.py | Monkasen/blog_project | fac6618007d03e4f127f0c0c302a90595054ff12 | [
"CC0-1.0"
] | null | null | null | accounts/views.py | Monkasen/blog_project | fac6618007d03e4f127f0c0c302a90595054ff12 | [
"CC0-1.0"
] | null | null | null | from django.contrib.auth.forms import UserCreationForm
from django.urls import reverse_lazy
from django.views import generic
class SignUpView(generic.CreateView):
form_class = UserCreationForm
success_url = reverse_lazy('login')
template_name = 'signup.html'
| 30.222222 | 54 | 0.797794 | from django.contrib.auth.forms import UserCreationForm
from django.urls import reverse_lazy
from django.views import generic
class SignUpView(generic.CreateView):
form_class = UserCreationForm
success_url = reverse_lazy('login')
template_name = 'signup.html'
| true | true |
f726fee2b9520f0732bc657c2498044fa21cf593 | 6,213 | py | Python | human_eval.py | nlindqv/pytorch_RVAE | d9e58134965f69aad557fb3bd2478500a51210f8 | [
"MIT"
] | null | null | null | human_eval.py | nlindqv/pytorch_RVAE | d9e58134965f69aad557fb3bd2478500a51210f8 | [
"MIT"
] | null | null | null | human_eval.py | nlindqv/pytorch_RVAE | d9e58134965f69aad557fb3bd2478500a51210f8 | [
"MIT"
] | null | null | null | import argparse
import os
import pandas as pd
import numpy as np
import torch as t
from torch.optim import Adam
import pickle5 as pickle
import json
import random
from sample import sample_with_input, sample_with_beam
from utils.batch_loader import BatchLoader, clean_str
from model.paraphraser import Par... | 40.607843 | 116 | 0.597779 | import argparse
import os
import pandas as pd
import numpy as np
import torch as t
from torch.optim import Adam
import pickle5 as pickle
import json
import random
from sample import sample_with_input, sample_with_beam
from utils.batch_loader import BatchLoader, clean_str
from model.paraphraser import Par... | true | true |
f726fef4bfca13a95ea4893f0812a453b7a6ce20 | 727 | py | Python | setup.py | krajasek/pyjama | e8cfd7ac07cfca37a73f8060ff28867a0e35909e | [
"MIT"
] | null | null | null | setup.py | krajasek/pyjama | e8cfd7ac07cfca37a73f8060ff28867a0e35909e | [
"MIT"
] | null | null | null | setup.py | krajasek/pyjama | e8cfd7ac07cfca37a73f8060ff28867a0e35909e | [
"MIT"
] | null | null | null | from setuptools import setup, find_packages
from pyjamaparty.strutils.string_builder import StringBuilder
description = 'Set of casual python utilities'
long_description = StringBuilder('{}, written standing on shoulders of giants.'.format(description))
long_description += ' Tools include a string builder, singleton d... | 34.619048 | 100 | 0.763411 | from setuptools import setup, find_packages
from pyjamaparty.strutils.string_builder import StringBuilder
description = 'Set of casual python utilities'
long_description = StringBuilder('{}, written standing on shoulders of giants.'.format(description))
long_description += ' Tools include a string builder, singleton d... | true | true |
f726ff12eef650ff5b72b0281b3558b574845521 | 2,507 | py | Python | app.py | jleclanche/quassel-weblog | 127de4f13f61e424fad4e33c89c288a64cef9b61 | [
"MIT"
] | 5 | 2016-08-08T17:32:52.000Z | 2019-06-04T13:21:18.000Z | app.py | quassel/quassel-weblog | 127de4f13f61e424fad4e33c89c288a64cef9b61 | [
"MIT"
] | null | null | null | app.py | quassel/quassel-weblog | 127de4f13f61e424fad4e33c89c288a64cef9b61 | [
"MIT"
] | null | null | null | import hashlib
import re
from datetime import date, timedelta
from flask import Flask, render_template, request, abort
from jinja2.utils import urlize
from sqlalchemy import asc, desc
from sqlalchemy.orm import joinedload
from quassel import quassel_session, Message, Buffer, Sender, Network
import settings
app = Fla... | 28.168539 | 75 | 0.691264 | import hashlib
import re
from datetime import date, timedelta
from flask import Flask, render_template, request, abort
from jinja2.utils import urlize
from sqlalchemy import asc, desc
from sqlalchemy.orm import joinedload
from quassel import quassel_session, Message, Buffer, Sender, Network
import settings
app = Fla... | true | true |
f727011bf8d2cc213c21de27b98b3b27c47d249a | 520 | py | Python | tests/nnapi/specs/V1_2/reduce_any_2D_nnfw.mod.py | bogus-sudo/ONE-1 | 7052a817eff661ec2854ed2e7ee0de5e8ba82b55 | [
"Apache-2.0"
] | 255 | 2020-05-22T07:45:29.000Z | 2022-03-29T23:58:22.000Z | tests/nnapi/specs/V1_2/reduce_any_2D_nnfw.mod.py | bogus-sudo/ONE-1 | 7052a817eff661ec2854ed2e7ee0de5e8ba82b55 | [
"Apache-2.0"
] | 5,102 | 2020-05-22T07:48:33.000Z | 2022-03-31T23:43:39.000Z | tests/nnapi/specs/V1_2/reduce_any_2D_nnfw.mod.py | bogus-sudo/ONE-1 | 7052a817eff661ec2854ed2e7ee0de5e8ba82b55 | [
"Apache-2.0"
] | 120 | 2020-05-22T07:51:08.000Z | 2022-02-16T19:08:05.000Z | # model
model = Model()
i1 = Input("input", "TENSOR_BOOL8", "{3, 4}")
axis = Int32Scalar("axis", 1)
keepDims = False
out1 = Output("output", "TENSOR_BOOL8", "{3}")
model = model.Operation("REDUCE_ANY", i1, axis, keepDims).To(out1)
# Example 1. Input in operand 0, 1
input0 = {i1: # input 0
[False, False, Fals... | 26 | 66 | 0.611538 |
model = Model()
i1 = Input("input", "TENSOR_BOOL8", "{3, 4}")
axis = Int32Scalar("axis", 1)
keepDims = False
out1 = Output("output", "TENSOR_BOOL8", "{3}")
model = model.Operation("REDUCE_ANY", i1, axis, keepDims).To(out1)
input0 = {i1:
[False, False, False, False,
False, True, False, False,
... | true | true |
f727017762f29818a9fcaf162bb13d318487b8a6 | 1,219 | py | Python | var/spack/repos/builtin/packages/relax/package.py | player1537-forks/spack | 822b7632222ec5a91dc7b7cda5fc0e08715bd47c | [
"ECL-2.0",
"Apache-2.0",
"MIT-0",
"MIT"
] | 11 | 2015-10-04T02:17:46.000Z | 2018-02-07T18:23:00.000Z | var/spack/repos/builtin/packages/relax/package.py | player1537-forks/spack | 822b7632222ec5a91dc7b7cda5fc0e08715bd47c | [
"ECL-2.0",
"Apache-2.0",
"MIT-0",
"MIT"
] | 22 | 2017-08-01T22:45:10.000Z | 2022-03-10T07:46:31.000Z | var/spack/repos/builtin/packages/relax/package.py | player1537-forks/spack | 822b7632222ec5a91dc7b7cda5fc0e08715bd47c | [
"ECL-2.0",
"Apache-2.0",
"MIT-0",
"MIT"
] | 4 | 2016-06-10T17:57:39.000Z | 2018-09-11T04:59:38.000Z | # Copyright 2013-2022 Lawrence Livermore National Security, LLC and other
# Spack Project Developers. See the top-level COPYRIGHT file for details.
#
# SPDX-License-Identifier: (Apache-2.0 OR MIT)
from spack import *
class Relax(CMakePackage):
"""A set of Reflex libraries for the most common used general data ty... | 32.078947 | 95 | 0.656276 |
from spack import *
class Relax(CMakePackage):
homepage = "https://twiki.cern.ch/twiki/bin/view/LCG/RELAX"
url = "http://lcgpackages.web.cern.ch/lcgpackages/tarFiles/sources/RELAX-1.tar.gz"
tags = ['hep']
version('root6', sha256='1d24b1a0884bbe99d60f7d02fea45d59695c158ab5e53516ac3fb780eb4... | true | true |
f72701a8444dcb76142a4a452fafb56971989631 | 4,930 | py | Python | Fashion_Test.py | denis19973/Keras-RFCN | e62670c2e01ac1e942f513d324642cf8d6aee368 | [
"MIT"
] | 88 | 2018-05-04T08:04:02.000Z | 2022-01-05T02:57:28.000Z | Fashion_Test.py | denis19973/Keras-RFCN | e62670c2e01ac1e942f513d324642cf8d6aee368 | [
"MIT"
] | 16 | 2018-07-03T11:58:51.000Z | 2021-07-12T04:49:05.000Z | Fashion_Test.py | mitulrm/FaceRFCN | 5e1fdaf197b3a93c22a82d9476a3f9a1c804e398 | [
"MIT"
] | 33 | 2018-05-04T08:02:32.000Z | 2022-01-09T14:39:06.000Z | """
Keras RFCN
Copyright (c) 2018
Licensed under the MIT License (see LICENSE for details)
Written by parap1uie-s@github.com
"""
'''
This is a demo to Eval a RFCN model with DeepFashion Dataset
http://mmlab.ie.cuhk.edu.hk/projects/DeepFashion.html
'''
from KerasRFCN.Model.Model import RFCN_Model
from KerasRFCN.Config... | 35.214286 | 96 | 0.650913 |
from KerasRFCN.Model.Model import RFCN_Model
from KerasRFCN.Config import Config
import KerasRFCN.Utils
import os
from keras.preprocessing import image
import pickle
import numpy as np
import argparse
import matplotlib.pyplot as plt
import matplotlib.patches as patches
class RFCNNConfig(Config):
NAME = "Fa... | true | true |
f72701ca82258a63b2f05eaaa0b57d341079e90e | 13,760 | py | Python | mhdb/write_ttl.py | charlie42/mhdb-tables2turtles | b289cc79b85e7c5d63bdf1b718e4e1d7bf188864 | [
"Apache-2.0"
] | 1 | 2020-04-15T14:22:14.000Z | 2020-04-15T14:22:14.000Z | mhdb/write_ttl.py | charlie42/mhdb-tables2turtles | b289cc79b85e7c5d63bdf1b718e4e1d7bf188864 | [
"Apache-2.0"
] | 3 | 2020-03-03T17:49:04.000Z | 2020-03-09T18:40:26.000Z | mhdb/write_ttl.py | charlie42/mhdb-tables2turtles | b289cc79b85e7c5d63bdf1b718e4e1d7bf188864 | [
"Apache-2.0"
] | 1 | 2020-04-20T15:05:42.000Z | 2020-04-20T15:05:42.000Z | #!/usr/bin/env python3
"""
This program contains generic functions to build a Turtle (Terse RDF Triple Language) document.
Authors:
- Arno Klein, 2017-2020 (arno@childmind.org) http://binarybottle.com
- Jon Clucas, 2017–2018 (jon.clucas@childmind.org)
Copyright 2020, Child Mind Institute (http://childmind.or... | 25.063752 | 95 | 0.50952 |
import os
import sys
top_dir = os.path.abspath(os.path.join(
(__file__),
os.pardir,
os.pardir
))
if top_dir not in sys.path:
sys.path.append(top_dir)
import numpy as np
def language_string(s, lang="en"):
return(
"\"\"\"{0}\"\"\"@{1}".format(
return_string(
s,
... | true | true |
f72703a3d0c01193efa4ecd4a94ed6ea309de133 | 3,106 | py | Python | Question_prepare/answers/answer_rotation.py | KuKuXia/DeepLearningMugenKnock | 979cf05e65e352da36453337380a418a2a2fdccb | [
"MIT"
] | null | null | null | Question_prepare/answers/answer_rotation.py | KuKuXia/DeepLearningMugenKnock | 979cf05e65e352da36453337380a418a2a2fdccb | [
"MIT"
] | null | null | null | Question_prepare/answers/answer_rotation.py | KuKuXia/DeepLearningMugenKnock | 979cf05e65e352da36453337380a418a2a2fdccb | [
"MIT"
] | null | null | null | import cv2
import numpy as np
from glob import glob
import matplotlib.pyplot as plt
np.random.seed(0)
num_classes = 2
img_height, img_width = 64, 64
CLS = ['akahara', 'madara']
# get train data
def data_load(path, hf=False, vf=False, rot=None):
xs = []
ts = []
paths = []
for dir_path in glob(pa... | 26.775862 | 87 | 0.433033 | import cv2
import numpy as np
from glob import glob
import matplotlib.pyplot as plt
np.random.seed(0)
num_classes = 2
img_height, img_width = 64, 64
CLS = ['akahara', 'madara']
def data_load(path, hf=False, vf=False, rot=None):
xs = []
ts = []
paths = []
for dir_path in glob(path + '/*'):
... | true | true |
f72703e878cca7379abbf6d41d3989ee572b5ae9 | 283 | py | Python | app/user/urls.py | Eslamhathout/restuarant_reservation_api | 67292e95eed13b5bee423a443180230b9de4c036 | [
"MIT"
] | null | null | null | app/user/urls.py | Eslamhathout/restuarant_reservation_api | 67292e95eed13b5bee423a443180230b9de4c036 | [
"MIT"
] | null | null | null | app/user/urls.py | Eslamhathout/restuarant_reservation_api | 67292e95eed13b5bee423a443180230b9de4c036 | [
"MIT"
] | null | null | null | from django.urls import path
from user import views
app_name = 'user'
urlpatterns = [
path('create/', views.createUserView.as_view(), name='create'),
path('token/', views.CreateTokenView.as_view(), name='token'),
path('me/', views.ManageUserView.as_view(), name='me'),
] | 31.444444 | 67 | 0.689046 | from django.urls import path
from user import views
app_name = 'user'
urlpatterns = [
path('create/', views.createUserView.as_view(), name='create'),
path('token/', views.CreateTokenView.as_view(), name='token'),
path('me/', views.ManageUserView.as_view(), name='me'),
] | true | true |
f7270451a42cc428358813a37592ce306c2d3a9e | 263 | py | Python | courses/templatetags/course_tags.py | pauljherrera/avantiweb | 40b87e754e68a0e2adcf5e1640d5e2e0c8637d0a | [
"MIT"
] | null | null | null | courses/templatetags/course_tags.py | pauljherrera/avantiweb | 40b87e754e68a0e2adcf5e1640d5e2e0c8637d0a | [
"MIT"
] | null | null | null | courses/templatetags/course_tags.py | pauljherrera/avantiweb | 40b87e754e68a0e2adcf5e1640d5e2e0c8637d0a | [
"MIT"
] | null | null | null | from django import template
register = template.Library()
@register.filter
def model_name(obj):
try:
return obj._meta.model_name
except AttributeError:
return None
@register.filter
def filter_course_id(obj, filter_):
return obj.filter(course_id=filter_) | 18.785714 | 37 | 0.790875 | from django import template
register = template.Library()
@register.filter
def model_name(obj):
try:
return obj._meta.model_name
except AttributeError:
return None
@register.filter
def filter_course_id(obj, filter_):
return obj.filter(course_id=filter_) | true | true |
f72704eca60cfb15f7653086792eaae9dad19395 | 21,810 | py | Python | backend/opnreco/syncbase.py | OpenPaymentNetwork/opnreco | 99c8955d7e200fe11fc23c3568879c543940b168 | [
"MIT"
] | null | null | null | backend/opnreco/syncbase.py | OpenPaymentNetwork/opnreco | 99c8955d7e200fe11fc23c3568879c543940b168 | [
"MIT"
] | null | null | null | backend/opnreco/syncbase.py | OpenPaymentNetwork/opnreco | 99c8955d7e200fe11fc23c3568879c543940b168 | [
"MIT"
] | null | null | null |
from decimal import Decimal
from opnreco.models.db import File
from opnreco.models.db import Movement
from opnreco.models.db import now_func
from opnreco.models.db import OwnerLog
from opnreco.models.db import Peer
from opnreco.models.db import TransferDownloadRecord
from opnreco.models.db import TransferRecord
from o... | 36.966102 | 79 | 0.509078 |
from decimal import Decimal
from opnreco.models.db import File
from opnreco.models.db import Movement
from opnreco.models.db import now_func
from opnreco.models.db import OwnerLog
from opnreco.models.db import Peer
from opnreco.models.db import TransferDownloadRecord
from opnreco.models.db import TransferRecord
from o... | true | true |
f727055625800f39e74865dd3234c711f006f0de | 23,966 | py | Python | electroncash/tests/test_transaction.py | christroutner/Electron-Cash | d5217ed3e878bd56977181f022f9e5c43f449241 | [
"MIT"
] | 208 | 2017-07-25T19:52:15.000Z | 2018-09-21T13:44:58.000Z | electroncash/tests/test_transaction.py | christroutner/Electron-Cash | d5217ed3e878bd56977181f022f9e5c43f449241 | [
"MIT"
] | 1,478 | 2018-09-24T09:30:13.000Z | 2022-03-29T15:48:17.000Z | electroncash/tests/test_transaction.py | christroutner/Electron-Cash | d5217ed3e878bd56977181f022f9e5c43f449241 | [
"MIT"
] | 159 | 2018-09-24T12:56:47.000Z | 2022-03-28T23:52:17.000Z | import unittest
from pprint import pprint
from .. import transaction
from ..address import Address, ScriptOutput, PublicKey
from ..bitcoin import TYPE_ADDRESS, TYPE_PUBKEY, TYPE_SCRIPT
from ..keystore import xpubkey_to_address
from ..util import bh2u
unsigned_blob = '010000000149f35e43fefd22d8bb9e4b3ff294c6286154c2... | 78.320261 | 780 | 0.791747 | import unittest
from pprint import pprint
from .. import transaction
from ..address import Address, ScriptOutput, PublicKey
from ..bitcoin import TYPE_ADDRESS, TYPE_PUBKEY, TYPE_SCRIPT
from ..keystore import xpubkey_to_address
from ..util import bh2u
unsigned_blob = '010000000149f35e43fefd22d8bb9e4b3ff294c6286154c2... | true | true |
f7270752dcf18a0603f052723ab81ca799050193 | 2,977 | py | Python | parsers/archived/US_BPA.py | electricitymap/electricitymap-contrib | 6572b12d1cef72c734b80273598e156ebe3c22ea | [
"MIT"
] | 143 | 2022-01-01T10:56:58.000Z | 2022-03-31T11:25:47.000Z | parsers/archived/US_BPA.py | electricitymap/electricitymap-contrib | 6572b12d1cef72c734b80273598e156ebe3c22ea | [
"MIT"
] | 276 | 2021-12-30T15:57:15.000Z | 2022-03-31T14:57:16.000Z | parsers/archived/US_BPA.py | electricitymap/electricitymap-contrib | 6572b12d1cef72c734b80273598e156ebe3c22ea | [
"MIT"
] | 44 | 2021-12-30T19:48:42.000Z | 2022-03-29T22:46:16.000Z | #!/usr/bin/env python3
# Archive reason: No longer in use.
"""Parser for the Bonneville Power Administration area of the USA."""
import logging
from io import StringIO
import arrow
import pandas as pd
import requests
GENERATION_URL = "https://transmission.bpa.gov/business/operations/Wind/baltwg.txt"
GENERATION_MA... | 25.228814 | 90 | 0.64125 |
import logging
from io import StringIO
import arrow
import pandas as pd
import requests
GENERATION_URL = "https://transmission.bpa.gov/business/operations/Wind/baltwg.txt"
GENERATION_MAPPING = {
"Wind": "wind",
"Hydro": "hydro",
"Fossil/Biomass": "unknown",
"Nuclear": "nuclear",
}
def get_data... | true | true |
f727078e22cc661d90d89e25a90adb97e4f7dee0 | 2,049 | py | Python | pre_commit_hooks/detect_aws_credentials.py | pk026/pre-commit-hooks | 3fa02652357ff0dbb42b5bc78c673b7bc105fcf3 | [
"MIT"
] | null | null | null | pre_commit_hooks/detect_aws_credentials.py | pk026/pre-commit-hooks | 3fa02652357ff0dbb42b5bc78c673b7bc105fcf3 | [
"MIT"
] | null | null | null | pre_commit_hooks/detect_aws_credentials.py | pk026/pre-commit-hooks | 3fa02652357ff0dbb42b5bc78c673b7bc105fcf3 | [
"MIT"
] | 1 | 2016-05-06T15:27:07.000Z | 2016-05-06T15:27:07.000Z | from __future__ import print_function
from __future__ import unicode_literals
import argparse
import os
from six.moves import configparser # pylint: disable=import-error
def get_your_keys(credentials_file):
"""reads the secret keys in your credentials file in order to be able to
look for them in the submit... | 28.458333 | 82 | 0.646657 | from __future__ import print_function
from __future__ import unicode_literals
import argparse
import os
from six.moves import configparser
def get_your_keys(credentials_file):
aws_credentials_file_path = os.path.expanduser(credentials_file)
if not os.path.exists(aws_credentials_file_path):
return ... | true | true |
f72707b300b185159ce19245e032dddc604d32ab | 17,706 | py | Python | pytorch_src/ResnetV2.py | ccj5351/hmr_rgbd | d1dcf81d72c11e1f502f2c494cd86425f384d9cc | [
"MIT"
] | null | null | null | pytorch_src/ResnetV2.py | ccj5351/hmr_rgbd | d1dcf81d72c11e1f502f2c494cd86425f384d9cc | [
"MIT"
] | 1 | 2020-12-09T07:29:00.000Z | 2020-12-09T07:29:00.000Z | pytorch_src/ResnetV2.py | ccj5351/hmr_rgbd | d1dcf81d72c11e1f502f2c494cd86425f384d9cc | [
"MIT"
] | null | null | null | # !/usr/bin/env python3
# -*-coding:utf-8-*-
# @file:
# @brief:
# @author: Changjiang Cai, ccai1@stevens.edu, caicj5351@gmail.com
# @version: 0.0.1
# @creation date: 23-10-2019
# @last modified: Wed 30 Oct 2019 03:17:36 PM EDT
"""
file: ResnetV2.py
author: Changjiang Cai
mark: adopted from:
... | 40.797235 | 127 | 0.605162 |
import torch.nn as nn
import torch.nn.functional as F
import torch
from torch.nn.parameter import Parameter
import torch.optim as optim
import numpy as np
import math
import torchvision
import sys
cout, stride):
super(Bottleneck_V2, self).__init__()
cmid = cout// self.expansion
s... | true | true |
f727081df263bc130ba55eb6cf42a0583ef84e06 | 543 | py | Python | problems/chapter05/Ysi/dp_c.py | tokuma09/algorithm_problems | 58534620df73b230afbeb12de126174362625a78 | [
"CC0-1.0"
] | 1 | 2021-07-07T15:46:58.000Z | 2021-07-07T15:46:58.000Z | problems/chapter05/Ysi/dp_c.py | tokuma09/algorithm_problems | 58534620df73b230afbeb12de126174362625a78 | [
"CC0-1.0"
] | 5 | 2021-06-05T14:16:41.000Z | 2021-07-10T07:08:28.000Z | problems/chapter05/Ysi/dp_c.py | tokuma09/algorithm_problems | 58534620df73b230afbeb12de126174362625a78 | [
"CC0-1.0"
] | null | null | null | def main():
n = int(input())
welfare = []
for i in range(n):
a, b, c = map(int, input().split())
welfare.append([a, b, c])
dp = [[0, 0, 0] for _ in range(n+1)]
for i in range(1, n+1):
dp[i][0] = max(dp[i-1][1] + welfare[i-1][0], dp[i-1][2] + welfare[i-1][0])
dp[i][1... | 30.166667 | 82 | 0.464088 | def main():
n = int(input())
welfare = []
for i in range(n):
a, b, c = map(int, input().split())
welfare.append([a, b, c])
dp = [[0, 0, 0] for _ in range(n+1)]
for i in range(1, n+1):
dp[i][0] = max(dp[i-1][1] + welfare[i-1][0], dp[i-1][2] + welfare[i-1][0])
dp[i][1... | true | true |
f7270905c7aba4a402b7cd24c6eb95248f25ce9c | 1,368 | py | Python | setup.py | RevengeComing/DemonHunter | 8ab5fc0e8e4f33c3e299cba78555f33b96cc28d8 | [
"MIT"
] | 52 | 2017-02-06T10:43:42.000Z | 2022-03-06T02:21:57.000Z | setup.py | RevengeComing/DemonHunter | 8ab5fc0e8e4f33c3e299cba78555f33b96cc28d8 | [
"MIT"
] | 4 | 2017-05-03T23:28:43.000Z | 2018-05-16T18:40:28.000Z | setup.py | RevengeComing/DemonHunter | 8ab5fc0e8e4f33c3e299cba78555f33b96cc28d8 | [
"MIT"
] | 10 | 2017-05-03T23:18:45.000Z | 2022-03-31T13:51:06.000Z | from setuptools import setup, find_packages
long_description = """
DemonHunter is a framework to create a Honeypot network very simple and easy.
"""
requirements = [
"httptools==0.0.11",
"aiohttp==2.3.10",
"bcrypt==3.1.4",
"flask==0.12.2",
"flask-login==0.4.1",
"flask-sqlalchemy==2.3.2",
... | 23.186441 | 77 | 0.574561 | from setuptools import setup, find_packages
long_description = """
DemonHunter is a framework to create a Honeypot network very simple and easy.
"""
requirements = [
"httptools==0.0.11",
"aiohttp==2.3.10",
"bcrypt==3.1.4",
"flask==0.12.2",
"flask-login==0.4.1",
"flask-sqlalchemy==2.3.2",
... | true | true |
f727096ddb4e3b582b8a50d866549fed8ea616db | 2,026 | py | Python | exp/python_c3_class_mro/python_c3_mro_anler.py | nicolasessisbreton/fython | 988f5a94cee8b16b0000501a22239195c73424a1 | [
"Apache-2.0"
] | 41 | 2016-01-21T05:14:45.000Z | 2021-11-24T20:37:21.000Z | exp/python_c3_class_mro/python_c3_mro_anler.py | nicolasessisbreton/fython | 988f5a94cee8b16b0000501a22239195c73424a1 | [
"Apache-2.0"
] | 5 | 2016-01-21T05:36:37.000Z | 2016-08-22T19:26:51.000Z | exp/python_c3_class_mro/python_c3_mro_anler.py | nicolasessisbreton/fython | 988f5a94cee8b16b0000501a22239195c73424a1 | [
"Apache-2.0"
] | 3 | 2016-01-23T04:03:44.000Z | 2016-08-21T15:58:38.000Z | # taken from https://gist.github.com/anler/1144867
def C3(cls, *mro_lists):
"""Implementation of the Python's C3 Algorithm.
Notes:
* The order of items in an MRO should be preserved in all of
its future subclasses
"""
import itertools
# Make a copy so we don't change existing... | 36.836364 | 87 | 0.55923 |
def C3(cls, *mro_lists):
import itertools
mro_lists = [list(mro_list[:]) for mro_list in mro_lists]
# Set up the new MRO with the class itself
mro = [cls]
# The real algorithm goes here
while True:
# Reset for the next round of tests
candidate_found = False
... | true | true |
f72709c4742158734a8a8151b8c373a41c265cb7 | 13,728 | py | Python | jc/parsers/netstat.py | shaikustin/jc | b59e38cfd2c8a7f5868e05d5562557b1c27e5e56 | [
"MIT"
] | 3,215 | 2019-10-24T15:25:56.000Z | 2022-03-31T15:43:01.000Z | jc/parsers/netstat.py | shaikustin/jc | b59e38cfd2c8a7f5868e05d5562557b1c27e5e56 | [
"MIT"
] | 109 | 2019-11-02T16:22:29.000Z | 2022-03-30T17:32:17.000Z | jc/parsers/netstat.py | shaikustin/jc | b59e38cfd2c8a7f5868e05d5562557b1c27e5e56 | [
"MIT"
] | 75 | 2020-02-07T00:16:32.000Z | 2022-03-29T09:29:53.000Z | """jc - JSON CLI output utility `netstat` command output parser
Caveats:
- Use of multiple `l` options is not supported on OSX (e.g. `netstat -rlll`)
- Use of the `A` option is not supported on OSX when using the `r` option (e.g. `netstat -rA`)
Usage (cli):
$ netstat | jc --netstat
or
$ jc netstat
Usa... | 29.908497 | 99 | 0.436844 | import jc.utils
class info():
version = '1.10'
description = '`netstat` command parser'
author = 'Kelly Brazil'
author_email = 'kellyjonbrazil@gmail.com'
compatible = ['linux', 'darwin', 'freebsd']
magic_commands = ['netstat']
__version__ = info.version
def _process(proc_data):
f... | true | true |
f7270a9ece60d01e3332a67758dc9efe26f5976e | 3,799 | py | Python | tests/test_02_app/test_custom_app.py | hairychris/uvicorn-gunicorn-docker | 5c1f3538b14a52676e0723497e1f65947382888b | [
"MIT"
] | null | null | null | tests/test_02_app/test_custom_app.py | hairychris/uvicorn-gunicorn-docker | 5c1f3538b14a52676e0723497e1f65947382888b | [
"MIT"
] | null | null | null | tests/test_02_app/test_custom_app.py | hairychris/uvicorn-gunicorn-docker | 5c1f3538b14a52676e0723497e1f65947382888b | [
"MIT"
] | null | null | null | import time
from pathlib import Path, PurePath
import docker
import pytest
import requests
from ..utils import (
CONTAINER_NAME,
IMAGE_NAME,
get_config,
get_logs,
remove_previous_container,
)
client = docker.from_env()
def verify_container(container, response_text):
config_data = get_config... | 33.619469 | 88 | 0.609371 | import time
from pathlib import Path, PurePath
import docker
import pytest
import requests
from ..utils import (
CONTAINER_NAME,
IMAGE_NAME,
get_config,
get_logs,
remove_previous_container,
)
client = docker.from_env()
def verify_container(container, response_text):
config_data = get_config... | true | true |
f7270af0eb3dba69ec7cddb1fdb8c33f7344108d | 1,231 | py | Python | src/modules/agents/noisy_agents.py | mariuslindegaard/6.867_MARL_project | 572b88b4d491db8a1673535868f4bf9aff58f73d | [
"Apache-2.0"
] | 401 | 2021-02-23T02:42:42.000Z | 2022-03-21T08:22:37.000Z | src/modules/agents/noisy_agents.py | mariuslindegaard/6.867_MARL_project | 572b88b4d491db8a1673535868f4bf9aff58f73d | [
"Apache-2.0"
] | 21 | 2021-04-10T10:05:07.000Z | 2022-03-29T10:09:03.000Z | src/modules/agents/noisy_agents.py | mariuslindegaard/6.867_MARL_project | 572b88b4d491db8a1673535868f4bf9aff58f73d | [
"Apache-2.0"
] | 90 | 2021-02-15T08:37:04.000Z | 2022-03-21T06:37:15.000Z | import torch.nn as nn
import torch.nn.functional as F
from utils.noisy_liner import NoisyLinear
from torch.nn import LayerNorm
class NoisyRNNAgent(nn.Module):
def __init__(self, input_shape, args):
super(NoisyRNNAgent, self).__init__()
self.args = args
self.fc1 = nn.Linear(input_shape, arg... | 35.171429 | 86 | 0.640942 | import torch.nn as nn
import torch.nn.functional as F
from utils.noisy_liner import NoisyLinear
from torch.nn import LayerNorm
class NoisyRNNAgent(nn.Module):
def __init__(self, input_shape, args):
super(NoisyRNNAgent, self).__init__()
self.args = args
self.fc1 = nn.Linear(input_shape, arg... | true | true |
f7270bef7a963e5cdee0174d9826895442fbf65b | 11,468 | py | Python | modules/flow.py | aasensio/bayesDI | 4ddad57d89c3512b4c4ee5684ddc5608060ebdec | [
"MIT"
] | 2 | 2021-08-20T07:59:05.000Z | 2021-12-02T20:19:48.000Z | modules/flow.py | aasensio/bayesDI | 4ddad57d89c3512b4c4ee5684ddc5608060ebdec | [
"MIT"
] | null | null | null | modules/flow.py | aasensio/bayesDI | 4ddad57d89c3512b4c4ee5684ddc5608060ebdec | [
"MIT"
] | null | null | null | import numpy as np
import torch
import torch.nn.functional as F
from nflows import transforms, distributions, flows, utils
import nflows.nn.nets as nn_
import matplotlib.pyplot as pl
from modules import resnet
# https://github.com/stephengreen/lfi-gw/blob/master/lfigw/nde_flows.py
def create_linear_transform(input_di... | 42.791045 | 155 | 0.593129 | import numpy as np
import torch
import torch.nn.functional as F
from nflows import transforms, distributions, flows, utils
import nflows.nn.nets as nn_
import matplotlib.pyplot as pl
from modules import resnet
def create_linear_transform(input_dim):
permutation = transforms.RandomPermutation(features = inpu... | true | true |
f7270cc5a74622d850496e16ffaf8362ce017691 | 3,489 | py | Python | WebServer/microservices/dispatcher/auth_token.py | AnneEjsing/TrafficDataAnonymisation | 6ee5b4a46d53a656299d6a53896175b78008228a | [
"MIT"
] | 1 | 2020-03-12T13:27:58.000Z | 2020-03-12T13:27:58.000Z | WebServer/microservices/dispatcher/auth_token.py | AnneEjsing/TrafficDataAnonymisation | 6ee5b4a46d53a656299d6a53896175b78008228a | [
"MIT"
] | 7 | 2020-04-02T12:47:45.000Z | 2022-03-02T07:35:49.000Z | WebServer/microservices/dispatcher/auth_token.py | AnneEjsing/Traffic-Data-Anonymisation-Web | 6ee5b4a46d53a656299d6a53896175b78008228a | [
"MIT"
] | null | null | null | import base64
import requests
import json
import hashlib
import hmac
from enum import IntEnum
from datetime import datetime, timedelta
import os
secretKey = os.getenv("SECRET_KEY")
def valid_token(token):
return ('.' in token) and len(token.split('.')) == 3
def verify_credentials(email, pwd):
data = {"email... | 28.137097 | 131 | 0.665807 | import base64
import requests
import json
import hashlib
import hmac
from enum import IntEnum
from datetime import datetime, timedelta
import os
secretKey = os.getenv("SECRET_KEY")
def valid_token(token):
return ('.' in token) and len(token.split('.')) == 3
def verify_credentials(email, pwd):
data = {"email... | true | true |
f7270eb6f31c026c910661b3d770b077b26405bb | 990 | py | Python | scenedetect/main.py | zhaipro/MySceneDetect | fbbe085b05e916d52253ffddd91848c3e85b2fe9 | [
"MIT"
] | null | null | null | scenedetect/main.py | zhaipro/MySceneDetect | fbbe085b05e916d52253ffddd91848c3e85b2fe9 | [
"MIT"
] | null | null | null | scenedetect/main.py | zhaipro/MySceneDetect | fbbe085b05e916d52253ffddd91848c3e85b2fe9 | [
"MIT"
] | 2 | 2019-11-27T04:44:11.000Z | 2020-01-15T05:32:59.000Z | import sys
import time
import cv2
import numpy as np
def scenedetect(cap, threshold=30, min_scene_len=15):
w = cap.get(cv2.CAP_PROP_FRAME_WIDTH)
downscale_factor = int(w / 200)
last_hsv = None
first = 0
curr = 0
while True:
ret, im = cap.read()
if not ret:
break
... | 24.146341 | 72 | 0.614141 | import sys
import time
import cv2
import numpy as np
def scenedetect(cap, threshold=30, min_scene_len=15):
w = cap.get(cv2.CAP_PROP_FRAME_WIDTH)
downscale_factor = int(w / 200)
last_hsv = None
first = 0
curr = 0
while True:
ret, im = cap.read()
if not ret:
break
... | true | true |
f727103bf36fa5841b9d61da58cc4ea81dc4118e | 4,404 | py | Python | desertbot/modules/admin/Ignore.py | Helle-Daryd/DesertBot | 0b497db135a4c08dfbdb59108f830ba12fdc6465 | [
"MIT",
"BSD-3-Clause"
] | 7 | 2018-03-20T17:10:10.000Z | 2021-11-17T18:58:04.000Z | desertbot/modules/admin/Ignore.py | Helle-Daryd/DesertBot | 0b497db135a4c08dfbdb59108f830ba12fdc6465 | [
"MIT",
"BSD-3-Clause"
] | 109 | 2015-08-20T13:16:35.000Z | 2022-01-21T19:40:35.000Z | desertbot/modules/admin/Ignore.py | Helle-Daryd/DesertBot | 0b497db135a4c08dfbdb59108f830ba12fdc6465 | [
"MIT",
"BSD-3-Clause"
] | 7 | 2018-03-29T05:55:01.000Z | 2021-02-05T19:19:39.000Z | """
Created on Feb 09, 2018
@author: StarlitGhost
"""
import re
from collections import OrderedDict
from twisted.plugin import IPlugin
from zope.interface import implementer
from desertbot.moduleinterface import IModule
from desertbot.modules.commandinterface import BotCommand, admin
from desertbot.response import I... | 37.965517 | 93 | 0.603542 | import re
from collections import OrderedDict
from twisted.plugin import IPlugin
from zope.interface import implementer
from desertbot.moduleinterface import IModule
from desertbot.modules.commandinterface import BotCommand, admin
from desertbot.response import IRCResponse
@implementer(IPlugin, IModule)
class Ignor... | true | true |
f727105123cecc3f0975d6ac12017569a168ee54 | 3,444 | py | Python | tests/ut/python/parallel/test_dropout_do_mask.py | GuoSuiming/mindspore | 48afc4cfa53d970c0b20eedfb46e039db2a133d5 | [
"Apache-2.0"
] | 55 | 2020-12-17T10:26:06.000Z | 2022-03-28T07:18:26.000Z | tests/ut/python/parallel/test_dropout_do_mask.py | forwhat461/mindspore | 59a277756eb4faad9ac9afcc7fd526e8277d4994 | [
"Apache-2.0"
] | null | null | null | tests/ut/python/parallel/test_dropout_do_mask.py | forwhat461/mindspore | 59a277756eb4faad9ac9afcc7fd526e8277d4994 | [
"Apache-2.0"
] | 14 | 2021-01-29T02:39:47.000Z | 2022-03-23T05:00:26.000Z | # Copyright 2020 Huawei Technologies Co., Ltd
#
# 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... | 35.142857 | 103 | 0.707027 |
import numpy as np
import mindspore as ms
from mindspore import context, Tensor, Parameter
from mindspore.common.api import _executor
from mindspore.nn import Cell, TrainOneStepCell, Momentum
from mindspore.ops import operations as P
class Net(Cell):
def __init__(self, mul_weight, strategy1=None, s... | true | true |
f72710d9f65e5ca4beff6e82aed8a822c535c132 | 5,172 | py | Python | tests/unit/test_charm.py | gabrielcocenza/prometheus-bind-exporter-operator | 8998f049f68e72a71b7d97949d9a0e1dc57d8113 | [
"Apache-2.0"
] | null | null | null | tests/unit/test_charm.py | gabrielcocenza/prometheus-bind-exporter-operator | 8998f049f68e72a71b7d97949d9a0e1dc57d8113 | [
"Apache-2.0"
] | null | null | null | tests/unit/test_charm.py | gabrielcocenza/prometheus-bind-exporter-operator | 8998f049f68e72a71b7d97949d9a0e1dc57d8113 | [
"Apache-2.0"
] | null | null | null | # Copyright 2021 Unicorn
# See LICENSE file for licensing details.
#
# Learn more about testing at: https://juju.is/docs/sdk/testing
import unittest
from unittest import mock
import charm
from ops.model import Unit
from ops.testing import Harness
class TestCharm(unittest.TestCase):
def assert_active_unit(self, u... | 42.04878 | 97 | 0.687355 |
import unittest
from unittest import mock
import charm
from ops.model import Unit
from ops.testing import Harness
class TestCharm(unittest.TestCase):
def assert_active_unit(self, unit: Unit):
self.assertEqual(unit.status.name, "active")
self.assertEqual(unit.status.message, "Unit is ready")
... | true | true |
f727121629beee502e1de4f5eae42d70c7b1b0db | 12,344 | py | Python | tensorflow/python/keras/layers/preprocessing/categorical.py | lightyang/tensorflow | 1a455a77d80fa788fd7963530dd130ad7d902226 | [
"Apache-2.0"
] | null | null | null | tensorflow/python/keras/layers/preprocessing/categorical.py | lightyang/tensorflow | 1a455a77d80fa788fd7963530dd130ad7d902226 | [
"Apache-2.0"
] | 2 | 2021-08-25T16:13:06.000Z | 2022-02-10T02:19:43.000Z | tensorflow/python/keras/layers/preprocessing/categorical.py | Hyperclaw79/tensorflow | 14c58e1d380b2001ffdf7ef782d44ad1a21f763c | [
"Apache-2.0"
] | null | null | null | # Copyright 2019 The TensorFlow Authors. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applica... | 40.208469 | 80 | 0.679439 |
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
import numpy as np
from tensorflow.python.framework import dtypes
from tensorflow.python.framework import ops
from tensorflow.python.framework import sparse_tensor
from tensorflow.python.framewo... | true | true |
f727139b39073fe544e6ea44332b015dc4cb68d8 | 7,589 | py | Python | applications/views.py | AndyUGA/ugahacks5 | 6a7787b50d9e8ea9685c3e36c38da6bc699bca77 | [
"MIT"
] | null | null | null | applications/views.py | AndyUGA/ugahacks5 | 6a7787b50d9e8ea9685c3e36c38da6bc699bca77 | [
"MIT"
] | null | null | null | applications/views.py | AndyUGA/ugahacks5 | 6a7787b50d9e8ea9685c3e36c38da6bc699bca77 | [
"MIT"
] | null | null | null | # Create your views here.
from __future__ import print_function
import logging
from datetime import timedelta
from django import http
from django.contrib import messages
from django.contrib.auth.mixins import UserPassesTestMixin
from django.core.exceptions import ValidationError
from django.http import Http404, HttpR... | 36.311005 | 112 | 0.65305 |
from __future__ import print_function
import logging
from datetime import timedelta
from django import http
from django.contrib import messages
from django.contrib.auth.mixins import UserPassesTestMixin
from django.core.exceptions import ValidationError
from django.http import Http404, HttpResponseRedirect, JsonResp... | true | true |
f72715df1abfb3b959b3006e717ef5f1bb7888f0 | 90 | py | Python | app/reserve/__init__.py | YaJunCui/bhbmjsfwzx | 1241b433663d5bcd170d61ab3e31423304f8a257 | [
"Apache-2.0"
] | null | null | null | app/reserve/__init__.py | YaJunCui/bhbmjsfwzx | 1241b433663d5bcd170d61ab3e31423304f8a257 | [
"Apache-2.0"
] | null | null | null | app/reserve/__init__.py | YaJunCui/bhbmjsfwzx | 1241b433663d5bcd170d61ab3e31423304f8a257 | [
"Apache-2.0"
] | null | null | null | from flask import Blueprint
reserve = Blueprint('reserve', __name__)
from . import views | 18 | 40 | 0.777778 | from flask import Blueprint
reserve = Blueprint('reserve', __name__)
from . import views | true | true |
f727170830757a9927a76f877b9aa62a8ac16456 | 4,123 | py | Python | scripts/appleseedMaya/menu.py | mororo250/appleseed-maya | 267d747d56b10fea716d014a6952e2a3de91b69c | [
"MIT"
] | 85 | 2016-03-02T13:52:08.000Z | 2022-01-07T22:45:30.000Z | scripts/appleseedMaya/menu.py | markreidvfx/appleseed-maya | d8dbf4b4134b34edc6c30b3f5e51f042de6abbf0 | [
"MIT"
] | 167 | 2016-01-29T17:45:44.000Z | 2021-09-17T04:47:17.000Z | scripts/appleseedMaya/menu.py | markreidvfx/appleseed-maya | d8dbf4b4134b34edc6c30b3f5e51f042de6abbf0 | [
"MIT"
] | 24 | 2016-01-29T17:37:06.000Z | 2022-01-07T15:55:24.000Z |
#
# This source file is part of appleseed.
# Visit https://appleseedhq.net/ for additional information and resources.
#
# This software is released under the MIT license.
#
# Copyright (c) 2016-2019 Esteban Tovagliari, The appleseedhq Organization
#
# Permission is hereby granted, free of charge, to any person obtaini... | 29.876812 | 86 | 0.696338 |
import os
import maya.cmds as mc
import maya.mel as mel
from logger import logger
from util import createLocator
def showAbout():
if mc.window('appleseedAboutDialog', query=True, exists=True):
mc.deleteUI('appleseedAboutDialog')
window = mc.window('appleseedAboutDialo... | true | true |
f727178eb81e72d2d877679f084f64e3e80cf022 | 2,302 | py | Python | test/functional/wallet_coinbase_category.py | picacoin/picacoin | a6b6c1053d796fac077d1c4ce63e09014002b364 | [
"MIT"
] | 1 | 2021-06-17T01:38:26.000Z | 2021-06-17T01:38:26.000Z | test/functional/wallet_coinbase_category.py | picacoin/picacoin | a6b6c1053d796fac077d1c4ce63e09014002b364 | [
"MIT"
] | null | null | null | test/functional/wallet_coinbase_category.py | picacoin/picacoin | a6b6c1053d796fac077d1c4ce63e09014002b364 | [
"MIT"
] | null | null | null | #!/usr/bin/env python3
# Copyright (c) 2014-2018 The Picacoin Core developers
# Distributed under the MIT software license, see the accompanying
# file COPYING or http://www.opensource.org/licenses/mit-license.php.
"""Test coinbase transactions return the correct categories.
Tests listtransactions, listsinceblock, and... | 38.366667 | 75 | 0.650738 |
from test_framework.test_framework import PicacoinTestFramework
from test_framework.util import (
assert_array_result
)
class CoinbaseCategoryTest(PicacoinTestFramework):
def set_test_params(self):
self.num_nodes = 1
def skip_test_if_missing_module(self):
self.skip_if_no_wallet()
... | true | true |
f727180f817153cce34f871f9fe22f9853129f9e | 717 | py | Python | WEEKS/CD_Sata-Structures/_MISC/misc-examples/python3-book-examples/re/re_negative_look_behind.py | webdevhub42/Lambda | b04b84fb5b82fe7c8b12680149e25ae0d27a0960 | [
"MIT"
] | null | null | null | WEEKS/CD_Sata-Structures/_MISC/misc-examples/python3-book-examples/re/re_negative_look_behind.py | webdevhub42/Lambda | b04b84fb5b82fe7c8b12680149e25ae0d27a0960 | [
"MIT"
] | null | null | null | WEEKS/CD_Sata-Structures/_MISC/misc-examples/python3-book-examples/re/re_negative_look_behind.py | webdevhub42/Lambda | b04b84fb5b82fe7c8b12680149e25ae0d27a0960 | [
"MIT"
] | null | null | null | # Copyright (c) 2010 Doug Hellmann. All rights reserved.
#
"""Negative look behind assertion.
"""
# end_pymotw_header
import re
address = re.compile(
"""
^
# An address: username@domain.tld
[\w\d.+-]+ # username
# Ignore noreply addresses
(?<!noreply)
@
([\w\d.]+\.)+ # do... | 18.868421 | 65 | 0.591353 |
import re
address = re.compile(
"""
^
# An address: username@domain.tld
[\w\d.+-]+ # username
# Ignore noreply addresses
(?<!noreply)
@
([\w\d.]+\.)+ # domain name prefix
(com|org|edu) # limit the allowed top-level domains
$
""",
re.VERBOSE,
)
candi... | true | true |
f727184e862d83fc9178a8cd67a0568c1ac7bed2 | 1,740 | py | Python | pandas/tests/categorical/test_algos.py | stillmatic/pandas | da067b2fe4cdc43eac5349e0648cfbbe4b96dbbd | [
"PSF-2.0",
"Apache-2.0",
"BSD-3-Clause-No-Nuclear-License-2014",
"MIT",
"ECL-2.0",
"BSD-3-Clause"
] | 2 | 2021-01-13T09:40:44.000Z | 2021-01-13T09:40:52.000Z | pandas/tests/categorical/test_algos.py | stillmatic/pandas | da067b2fe4cdc43eac5349e0648cfbbe4b96dbbd | [
"PSF-2.0",
"Apache-2.0",
"BSD-3-Clause-No-Nuclear-License-2014",
"MIT",
"ECL-2.0",
"BSD-3-Clause"
] | null | null | null | pandas/tests/categorical/test_algos.py | stillmatic/pandas | da067b2fe4cdc43eac5349e0648cfbbe4b96dbbd | [
"PSF-2.0",
"Apache-2.0",
"BSD-3-Clause-No-Nuclear-License-2014",
"MIT",
"ECL-2.0",
"BSD-3-Clause"
] | null | null | null | import pytest
import numpy as np
import pandas as pd
import pandas.util.testing as tm
@pytest.mark.parametrize('ordered', [True, False])
@pytest.mark.parametrize('categories', [
['b', 'a', 'c'],
['a', 'b', 'c', 'd'],
])
def test_factorize(categories, ordered):
cat = pd.Categorical(['b', 'b', 'a', 'c', No... | 34.8 | 65 | 0.58046 | import pytest
import numpy as np
import pandas as pd
import pandas.util.testing as tm
@pytest.mark.parametrize('ordered', [True, False])
@pytest.mark.parametrize('categories', [
['b', 'a', 'c'],
['a', 'b', 'c', 'd'],
])
def test_factorize(categories, ordered):
cat = pd.Categorical(['b', 'b', 'a', 'c', No... | true | true |
f727187cf5688be60c2c2db7a635f08927f1a6e9 | 3,431 | py | Python | utils/unshrtn.py | rongpenl/twarc | 1294fc717d16787b631236cd43e9f2b3155d3d96 | [
"MIT"
] | null | null | null | utils/unshrtn.py | rongpenl/twarc | 1294fc717d16787b631236cd43e9f2b3155d3d96 | [
"MIT"
] | null | null | null | utils/unshrtn.py | rongpenl/twarc | 1294fc717d16787b631236cd43e9f2b3155d3d96 | [
"MIT"
] | null | null | null | #!/usr/bin/env python
"""
Unfortunately the "expanded_url" as supplied by Twitter aren't fully
expanded one hop past t.co.
unshrtn.py will attempt to completely unshorten URLs and add them as the
"unshortened_url" key to each url, and emit the tweet as JSON again on stdout.
This script starts 10 seaprate processes w... | 25.043796 | 100 | 0.609443 |
import re
import json
import time
import urllib.request, urllib.parse, urllib.error
import logging
import argparse
import fileinput
import multiprocessing
POOL_SIZE = 10
unshrtn_url = "http://localhost:3000"
retries = 2
wait = 15
logging.basicConfig(filename="unshorten.log", level=logging.INFO)
def unshorten_u... | true | true |
f727189e07ca7e93ec6cf131f33eb666eb02749e | 7,355 | py | Python | python/dl.py | mkuznets/ytbackup | 834cf65432860bc3fbd92d7d79f2449464ee3ed0 | [
"MIT"
] | null | null | null | python/dl.py | mkuznets/ytbackup | 834cf65432860bc3fbd92d7d79f2449464ee3ed0 | [
"MIT"
] | null | null | null | python/dl.py | mkuznets/ytbackup | 834cf65432860bc3fbd92d7d79f2449464ee3ed0 | [
"MIT"
] | null | null | null | #!/usr/bin/env python
import argparse
import contextlib
import copy
import glob
import hashlib
import http.client
import json
import logging
import os
import shutil
import stat
import sys
import typing
import urllib.error
from unittest import mock
SYSTEM_EXCS = (urllib.error.URLError, http.client.HTTPException, OSErr... | 28.397683 | 85 | 0.556628 |
import argparse
import contextlib
import copy
import glob
import hashlib
import http.client
import json
import logging
import os
import shutil
import stat
import sys
import typing
import urllib.error
from unittest import mock
SYSTEM_EXCS = (urllib.error.URLError, http.client.HTTPException, OSError)
STDERR = sys.std... | true | true |
f727190f87503bd55a12dd3ee0e9882c00f0b9d2 | 4,189 | py | Python | Prototype.py | supersamdam/ConversationalAI | bb6013c33f6332aee57abbae310577c056c6fdc1 | [
"MIT"
] | 1 | 2021-02-17T16:38:56.000Z | 2021-02-17T16:38:56.000Z | Prototype.py | samaydumasia/ConversationalAI | bb6013c33f6332aee57abbae310577c056c6fdc1 | [
"MIT"
] | null | null | null | Prototype.py | samaydumasia/ConversationalAI | bb6013c33f6332aee57abbae310577c056c6fdc1 | [
"MIT"
] | null | null | null | import numpy as np
import pandas as pd
import re
import nltk
nltk.download('stopwords')
from nltk.corpus import stopwords
from nltk.stem.porter import PorterStemmer
from sklearn.feature_extraction.text import CountVectorizer
from sklearn.model_selection import train_test_split
from sklearn.naive_bayes import GaussianNB... | 39.149533 | 139 | 0.644307 | import numpy as np
import pandas as pd
import re
import nltk
nltk.download('stopwords')
from nltk.corpus import stopwords
from nltk.stem.porter import PorterStemmer
from sklearn.feature_extraction.text import CountVectorizer
from sklearn.model_selection import train_test_split
from sklearn.naive_bayes import GaussianNB... | true | true |
f7271956500274e8b25a12c00f4764c1033c5146 | 4,346 | py | Python | modisco/value_provider.py | XiaotingChen/tfmodisco | 17cbafe806942304a02e8134fe10224bdff38b0c | [
"MIT"
] | null | null | null | modisco/value_provider.py | XiaotingChen/tfmodisco | 17cbafe806942304a02e8134fe10224bdff38b0c | [
"MIT"
] | null | null | null | modisco/value_provider.py | XiaotingChen/tfmodisco | 17cbafe806942304a02e8134fe10224bdff38b0c | [
"MIT"
] | null | null | null | from __future__ import division, print_function, absolute_import
import numpy as np
import scipy.stats
class AbstractValueProvider(object):
def __call__(self, seqlet):
raise NotImplementedError()
@classmethod
def from_hdf5(cls, grp):
the_class = eval(grp.attrs["class"])
return th... | 32.676692 | 77 | 0.637598 | from __future__ import division, print_function, absolute_import
import numpy as np
import scipy.stats
class AbstractValueProvider(object):
def __call__(self, seqlet):
raise NotImplementedError()
@classmethod
def from_hdf5(cls, grp):
the_class = eval(grp.attrs["class"])
return th... | true | true |
f727196220df796339c62b0c3941e771d9d06e76 | 119 | py | Python | model_helpers/flatten.py | FlorianKlemt/pytorch-latent-i2a | 36809bf3adda1fcffaccd27e352b7ad2338060a7 | [
"MIT"
] | 3 | 2019-02-24T07:37:36.000Z | 2020-03-17T16:00:38.000Z | model_helpers/flatten.py | FlorianKlemt/pytorch-latent-i2a | 36809bf3adda1fcffaccd27e352b7ad2338060a7 | [
"MIT"
] | null | null | null | model_helpers/flatten.py | FlorianKlemt/pytorch-latent-i2a | 36809bf3adda1fcffaccd27e352b7ad2338060a7 | [
"MIT"
] | null | null | null | import torch
class Flatten(torch.nn.Module):
def forward(self,input):
return input.view(input.size(0), -1) | 23.8 | 44 | 0.680672 | import torch
class Flatten(torch.nn.Module):
def forward(self,input):
return input.view(input.size(0), -1) | true | true |
f7271973927dc75098169d414d35dcc361007bc5 | 2,078 | py | Python | scripts/data_dir_to_fasta.py | yuzhiguo07/openfold | 5fb0f074066387b9969578b8bf68f7e046c778af | [
"Apache-2.0"
] | 789 | 2021-11-12T16:12:21.000Z | 2022-03-28T05:45:19.000Z | scripts/data_dir_to_fasta.py | yuzhiguo07/openfold | 5fb0f074066387b9969578b8bf68f7e046c778af | [
"Apache-2.0"
] | 84 | 2021-11-12T22:23:50.000Z | 2022-03-29T01:06:06.000Z | scripts/data_dir_to_fasta.py | yuzhiguo07/openfold | 5fb0f074066387b9969578b8bf68f7e046c778af | [
"Apache-2.0"
] | 114 | 2021-11-12T16:00:57.000Z | 2022-03-27T21:32:31.000Z | import argparse
import logging
import os
from openfold.data import mmcif_parsing
from openfold.np import protein, residue_constants
def main(args):
fasta = []
for fname in os.listdir(args.data_dir):
basename, ext = os.path.splitext(fname)
basename = basename.upper()
fpath = os.path.jo... | 29.685714 | 67 | 0.547161 | import argparse
import logging
import os
from openfold.data import mmcif_parsing
from openfold.np import protein, residue_constants
def main(args):
fasta = []
for fname in os.listdir(args.data_dir):
basename, ext = os.path.splitext(fname)
basename = basename.upper()
fpath = os.path.jo... | true | true |
f727197bfaf0ad1a02e1a5e39ce0bac083ab567e | 6,741 | py | Python | configs/_base_/models/cascade_mask_rcnn_swin_fpn.py | AminRezaei0x443/Swin-Transformer-Object-Detection | 5376785b9e7b172a1d08cbb87362d5631b47eca9 | [
"Apache-2.0"
] | null | null | null | configs/_base_/models/cascade_mask_rcnn_swin_fpn.py | AminRezaei0x443/Swin-Transformer-Object-Detection | 5376785b9e7b172a1d08cbb87362d5631b47eca9 | [
"Apache-2.0"
] | null | null | null | configs/_base_/models/cascade_mask_rcnn_swin_fpn.py | AminRezaei0x443/Swin-Transformer-Object-Detection | 5376785b9e7b172a1d08cbb87362d5631b47eca9 | [
"Apache-2.0"
] | null | null | null | # model settings
model = dict(
type='CascadeRCNN',
pretrained=None,
backbone=dict(
type='SwinTransformer',
embed_dim=96,
depths=[2, 2, 6, 2],
num_heads=[3, 6, 12, 24],
window_size=7,
mlp_ratio=4.,
qkv_bias=True,
qk_scale=None,
drop_rate... | 34.218274 | 79 | 0.446966 |
model = dict(
type='CascadeRCNN',
pretrained=None,
backbone=dict(
type='SwinTransformer',
embed_dim=96,
depths=[2, 2, 6, 2],
num_heads=[3, 6, 12, 24],
window_size=7,
mlp_ratio=4.,
qkv_bias=True,
qk_scale=None,
drop_rate=0.,
att... | true | true |
f7271afaec979ef8020208ff603d1aed3f64fd7f | 7,132 | py | Python | backend/src/services/asr/iflytek_asr.py | didi/MeetDot | a57009d30c1347a9b85950c2e02b77685ce63952 | [
"Apache-2.0"
] | 6 | 2021-09-23T14:53:58.000Z | 2022-02-18T10:14:17.000Z | backend/src/services/asr/iflytek_asr.py | didi/MeetDot | a57009d30c1347a9b85950c2e02b77685ce63952 | [
"Apache-2.0"
] | null | null | null | backend/src/services/asr/iflytek_asr.py | didi/MeetDot | a57009d30c1347a9b85950c2e02b77685ce63952 | [
"Apache-2.0"
] | 1 | 2021-09-24T02:48:50.000Z | 2021-09-24T02:48:50.000Z | """
iflytek stream ASR service class (using WebSocket)
"""
import gevent
import os
from .interface import (
SpeechRecognitionConfig,
SpeechRecognitionRequest,
SpeechRecognitionResponse,
)
from .stream_asr import StreamAsr
from ..tokenizer import Tokenizer
import sys
import hashlib
from hashlib import sha1... | 31.982063 | 94 | 0.580342 | import gevent
import os
from .interface import (
SpeechRecognitionConfig,
SpeechRecognitionRequest,
SpeechRecognitionResponse,
)
from .stream_asr import StreamAsr
from ..tokenizer import Tokenizer
import sys
import hashlib
from hashlib import sha1
import hmac
import base64
import json
import time
from web... | true | true |
f7271b097f49a4ac7e244128ea6b6cecfc86fd93 | 1,008 | py | Python | api/celery/worker/config.py | keitaroinc/spodeli-novosti | f74d4658f2df02536c0cc05e60ade4c2fd7efeac | [
"BSD-2-Clause"
] | 1 | 2018-06-07T09:21:28.000Z | 2018-06-07T09:21:28.000Z | api/celery/worker/config.py | keitaroinc/spodeli-novosti | f74d4658f2df02536c0cc05e60ade4c2fd7efeac | [
"BSD-2-Clause"
] | null | null | null | api/celery/worker/config.py | keitaroinc/spodeli-novosti | f74d4658f2df02536c0cc05e60ade4c2fd7efeac | [
"BSD-2-Clause"
] | 1 | 2018-06-07T09:21:31.000Z | 2018-06-07T09:21:31.000Z | # -*-coding:utf-8-*-
import os
class BaseConfig(object):
"""Base configuration."""
DEBUG = True
BROKER_URL = os.getenv('BROKER_URL', 'amqp://guest:guest@localhost:5672/')
BROKER_POOL_LIMIT = os.getenv('BROKER_POOL_LIMIT', None)
CELERY_ENABLE_UTC = True
CELERY_TIMEZONE = os.getenv('CELERY_TIMEZO... | 30.545455 | 78 | 0.703373 |
import os
class BaseConfig(object):
DEBUG = True
BROKER_URL = os.getenv('BROKER_URL', 'amqp://guest:guest@localhost:5672/')
BROKER_POOL_LIMIT = os.getenv('BROKER_POOL_LIMIT', None)
CELERY_ENABLE_UTC = True
CELERY_TIMEZONE = os.getenv('CELERY_TIMEZONE', 'UTC')
CELERYD_CONCURRENCY = os.getenv('C... | true | true |
f7271c70df3a4e2a5327a3da3f3419e8bf553154 | 71 | py | Python | ModelHelper/__init__.py | yasarc4/Auto_time_series | 5a9aa5c535fbe09a4cc59e44124a5de435ac5059 | [
"MIT"
] | 7 | 2018-06-18T20:14:30.000Z | 2019-05-24T08:21:52.000Z | ModelHelper/__init__.py | yasarc4/Auto_time_series | 5a9aa5c535fbe09a4cc59e44124a5de435ac5059 | [
"MIT"
] | null | null | null | ModelHelper/__init__.py | yasarc4/Auto_time_series | 5a9aa5c535fbe09a4cc59e44124a5de435ac5059 | [
"MIT"
] | 1 | 2019-06-08T18:20:57.000Z | 2019-06-08T18:20:57.000Z | from .prophet_helper import ProphetHelper
__all__ = ['ProphetHelper']
| 17.75 | 41 | 0.802817 | from .prophet_helper import ProphetHelper
__all__ = ['ProphetHelper']
| true | true |
f7271cc4b96db4c6911f4848e194d1acf37f4ccd | 9,988 | py | Python | spyder/widgets/ipythonconsole/shell.py | computeVision/spyder | 0a71273e0a1bad8fb9812ee8054c0a2711a6178e | [
"MIT"
] | null | null | null | spyder/widgets/ipythonconsole/shell.py | computeVision/spyder | 0a71273e0a1bad8fb9812ee8054c0a2711a6178e | [
"MIT"
] | null | null | null | spyder/widgets/ipythonconsole/shell.py | computeVision/spyder | 0a71273e0a1bad8fb9812ee8054c0a2711a6178e | [
"MIT"
] | null | null | null | # -*- coding: utf-8 -*-
#
# Copyright © Spyder Project Contributors
# Licensed under the terms of the MIT License
# (see spyder/__init__.py for details)
"""
Shell Widget for the IPython Console
"""
import ast
import uuid
from qtpy.QtCore import Signal
from qtpy.QtWidgets import QMessageBox
from spyder.config.base i... | 37.130112 | 83 | 0.605527 |
import ast
import uuid
from qtpy.QtCore import Signal
from qtpy.QtWidgets import QMessageBox
from spyder.config.base import _
from spyder.config.gui import config_shortcut, fixed_shortcut
from spyder.py3compat import to_text_string
from spyder.utils import programs
from spyder.widgets.arraybuilder import SHORT... | true | true |
f7271cf5c26369051323e3140d6893796b0e8cba | 1,752 | py | Python | macarico/actors/bow.py | bgalbraith/macarico | 448e3e7f088dde0f4eb016fbdee857221b9523fb | [
"MIT"
] | 121 | 2019-04-09T15:44:26.000Z | 2022-03-29T19:56:19.000Z | macarico/actors/bow.py | bgalbraith/macarico | 448e3e7f088dde0f4eb016fbdee857221b9523fb | [
"MIT"
] | 1 | 2019-04-10T16:07:04.000Z | 2019-05-09T00:41:19.000Z | macarico/actors/bow.py | bgalbraith/macarico | 448e3e7f088dde0f4eb016fbdee857221b9523fb | [
"MIT"
] | 11 | 2019-04-09T16:13:34.000Z | 2019-09-30T23:31:14.000Z | from __future__ import division, generators, print_function
import torch
import torch.nn as nn
import macarico
import macarico.util as util
from macarico.util import Var, Varng
class BOWActor(macarico.Actor):
def __init__(self, attention, n_actions, act_history_length=1, obs_history_length=0):
self.att_d... | 39.818182 | 105 | 0.619863 | from __future__ import division, generators, print_function
import torch
import torch.nn as nn
import macarico
import macarico.util as util
from macarico.util import Var, Varng
class BOWActor(macarico.Actor):
def __init__(self, attention, n_actions, act_history_length=1, obs_history_length=0):
self.att_d... | true | true |
f7271d2609206d32d2b77afed5f598fa29a5e6b0 | 1,463 | py | Python | api/v2/serializers/details/project_volume.py | simpsonw/atmosphere | 3a5203ef0b563de3a0e8c8c8715df88186532d7a | [
"BSD-3-Clause"
] | 197 | 2016-12-08T02:33:32.000Z | 2022-03-23T14:27:47.000Z | api/v2/serializers/details/project_volume.py | simpsonw/atmosphere | 3a5203ef0b563de3a0e8c8c8715df88186532d7a | [
"BSD-3-Clause"
] | 385 | 2017-01-03T22:51:46.000Z | 2020-12-16T16:20:42.000Z | api/v2/serializers/details/project_volume.py | benlazarine/atmosphere | 38fad8e4002e510e8b4294f2bb5bc75e8e1817fa | [
"BSD-3-Clause"
] | 50 | 2016-12-08T08:32:25.000Z | 2021-12-10T00:21:39.000Z | from core.models import Project, Volume
from rest_framework import serializers
from api.v2.serializers.summaries import ProjectSummarySerializer
from .volume import VolumeSerializer
class ProjectRelatedField(serializers.PrimaryKeyRelatedField):
def get_queryset(self):
return Project.objects.all()
def... | 33.25 | 76 | 0.726589 | from core.models import Project, Volume
from rest_framework import serializers
from api.v2.serializers.summaries import ProjectSummarySerializer
from .volume import VolumeSerializer
class ProjectRelatedField(serializers.PrimaryKeyRelatedField):
def get_queryset(self):
return Project.objects.all()
def... | true | true |
f7271d3ae4367499cf666b0eda40d2fc6daee534 | 20,768 | py | Python | jax/_src/errors.py | machineko/jax | 5a9048a0058d027000afc5707413d24209aa6f9f | [
"Apache-2.0"
] | 1 | 2021-09-14T07:12:46.000Z | 2021-09-14T07:12:46.000Z | jax/_src/errors.py | josephrocca/jax | ab544cb26dfea3147c336754d3e3eb457a405e38 | [
"Apache-2.0"
] | 6 | 2022-01-03T22:13:42.000Z | 2022-02-14T22:07:51.000Z | jax/_src/errors.py | kbnarayanavit/jax | 1e3c4833c97302caf6046ff99656b8ff21430b8d | [
"Apache-2.0"
] | 1 | 2021-08-11T20:57:59.000Z | 2021-08-11T20:57:59.000Z | # Copyright 2021 Google LLC
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# https://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, ... | 36.499121 | 111 | 0.658995 |
from jax import core
class _JAXErrorMixin:
_error_page = 'https://jax.readthedocs.io/en/latest/errors.html'
_module_name = "jax.errors"
def __init__(self, message: str):
error_page = self._error_page
module_name = self._module_name
class_name = self.__class__.__name__
error_msg = f... | true | true |
f7271e85642896049a5ab911d13a4ad8df8ec1de | 14,429 | py | Python | PaddleNLP/emotion_detection/run_classifier.py | FrancisLiang/models-1 | e14d5bc1ab36d0dd11977f27cff54605bf99c945 | [
"Apache-2.0"
] | 1 | 2022-02-08T06:00:29.000Z | 2022-02-08T06:00:29.000Z | PaddleNLP/emotion_detection/run_classifier.py | FrancisLiang/models-1 | e14d5bc1ab36d0dd11977f27cff54605bf99c945 | [
"Apache-2.0"
] | null | null | null | PaddleNLP/emotion_detection/run_classifier.py | FrancisLiang/models-1 | e14d5bc1ab36d0dd11977f27cff54605bf99c945 | [
"Apache-2.0"
] | 2 | 2019-05-06T12:10:15.000Z | 2019-09-01T04:28:10.000Z | """
Emotion Detection Task
"""
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
import os
import time
import argparse
import multiprocessing
import sys
sys.path.append("../")
import paddle
import paddle.fluid as fluid
import numpy as np
from models.classif... | 38.171958 | 136 | 0.587012 |
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
import os
import time
import argparse
import multiprocessing
import sys
sys.path.append("../")
import paddle
import paddle.fluid as fluid
import numpy as np
from models.classification import nets
import read... | true | true |
f7271ea3544f50197b3f61177d0ffc065eca8731 | 9,227 | py | Python | deep_learning.py | ice-blaze/simple-captcha-deeplearning | 16960249bf316bef8fe6b9d86113c902309b36c5 | [
"MIT"
] | 2 | 2018-02-20T14:41:59.000Z | 2018-03-02T20:52:26.000Z | deep_learning.py | ice-blaze/simple-captcha-deeplearning | 16960249bf316bef8fe6b9d86113c902309b36c5 | [
"MIT"
] | null | null | null | deep_learning.py | ice-blaze/simple-captcha-deeplearning | 16960249bf316bef8fe6b9d86113c902309b36c5 | [
"MIT"
] | null | null | null | from generate_captchas import CHAR_POSSIBILITIES
from generate_captchas import generate_captcha
from generate_captchas import get_random_captcha_names_and_lines
from digital_processing_image_approach import clean_image_kernel4
import keras
from keras.models import Sequential, load_model
from keras.layers import Dense, ... | 30.452145 | 79 | 0.645605 | from generate_captchas import CHAR_POSSIBILITIES
from generate_captchas import generate_captcha
from generate_captchas import get_random_captcha_names_and_lines
from digital_processing_image_approach import clean_image_kernel4
import keras
from keras.models import Sequential, load_model
from keras.layers import Dense, ... | true | true |
f7271f75be46e1387690682014cc916246b65748 | 8,007 | py | Python | pepper_variant/modules/python/models/predict_distributed_cpu.py | Samteymoori/pepper | 734d226de47a855952e3b58145c1fcfbe221d3b4 | [
"MIT"
] | null | null | null | pepper_variant/modules/python/models/predict_distributed_cpu.py | Samteymoori/pepper | 734d226de47a855952e3b58145c1fcfbe221d3b4 | [
"MIT"
] | null | null | null | pepper_variant/modules/python/models/predict_distributed_cpu.py | Samteymoori/pepper | 734d226de47a855952e3b58145c1fcfbe221d3b4 | [
"MIT"
] | null | null | null | import sys
import os
import torch
import torch.onnx
import torch.distributed as dist
import torch.nn as nn
import onnxruntime
from datetime import datetime
from torch.utils.data import DataLoader
import torch.multiprocessing as mp
from pepper_variant.modules.python.models.dataloader_predict import SequenceDataset
from... | 47.378698 | 123 | 0.608842 | import sys
import os
import torch
import torch.onnx
import torch.distributed as dist
import torch.nn as nn
import onnxruntime
from datetime import datetime
from torch.utils.data import DataLoader
import torch.multiprocessing as mp
from pepper_variant.modules.python.models.dataloader_predict import SequenceDataset
from... | true | true |
f7271f7b24dfad40337af89fa46c4ae330c1b315 | 2,394 | py | Python | neuroballad/neuroballad_execute.py | KathyFeiyang/Neuroballad | e02506f81a2af4125b58b34849135ef8eead314c | [
"BSD-3-Clause"
] | null | null | null | neuroballad/neuroballad_execute.py | KathyFeiyang/Neuroballad | e02506f81a2af4125b58b34849135ef8eead314c | [
"BSD-3-Clause"
] | null | null | null | neuroballad/neuroballad_execute.py | KathyFeiyang/Neuroballad | e02506f81a2af4125b58b34849135ef8eead314c | [
"BSD-3-Clause"
] | null | null | null | import numpy as np
import h5py
import networkx as nx
import argparse
import itertools
import random
import pickle
import neurokernel.mpi_relaunch
import neurokernel.core_gpu as core
from neurokernel.LPU.InputProcessors.StepInputProcessor import StepInputProcessor
from neurokernel.LPU.InputProcessors.FileInputProcesso... | 36.272727 | 112 | 0.724728 | import numpy as np
import h5py
import networkx as nx
import argparse
import itertools
import random
import pickle
import neurokernel.mpi_relaunch
import neurokernel.core_gpu as core
from neurokernel.LPU.InputProcessors.StepInputProcessor import StepInputProcessor
from neurokernel.LPU.InputProcessors.FileInputProcesso... | true | true |
f7272096c7c7419d953f812ee3f5ff9bf5aca83f | 674 | py | Python | apis/task/serializers.py | computablelabs/capi | 44e349fa3c71c8d2d390cdf2a5b7b8892807b40a | [
"MIT"
] | null | null | null | apis/task/serializers.py | computablelabs/capi | 44e349fa3c71c8d2d390cdf2a5b7b8892807b40a | [
"MIT"
] | 43 | 2019-09-03T14:50:23.000Z | 2019-12-18T17:30:11.000Z | apis/task/serializers.py | computablelabs/capi | 44e349fa3c71c8d2d390cdf2a5b7b8892807b40a | [
"MIT"
] | 1 | 2019-10-15T14:41:28.000Z | 2019-10-15T14:41:28.000Z | from flask_restplus import Model, fields
NewTaskResult = Model('NewTaskResult', {
'message': fields.String(required=True, description='Server response when an anyschronous task is created'),
'task_id': fields.String(required=True, description='UUID of the created asynchronous task')
})
TaskResult = Model(... | 51.846154 | 114 | 0.743323 | from flask_restplus import Model, fields
NewTaskResult = Model('NewTaskResult', {
'message': fields.String(required=True, description='Server response when an anyschronous task is created'),
'task_id': fields.String(required=True, description='UUID of the created asynchronous task')
})
TaskResult = Model(... | true | true |
f727210386943796d9c7b108e0c2ae73b4a71275 | 1,325 | py | Python | azure-mgmt-compute/azure/mgmt/compute/v2018_06_01/models/diagnostics_profile.py | JonathanGailliez/azure-sdk-for-python | f0f051bfd27f8ea512aea6fc0c3212ee9ee0029b | [
"MIT"
] | 1 | 2021-09-07T18:36:04.000Z | 2021-09-07T18:36:04.000Z | azure-mgmt-compute/azure/mgmt/compute/v2018_06_01/models/diagnostics_profile.py | JonathanGailliez/azure-sdk-for-python | f0f051bfd27f8ea512aea6fc0c3212ee9ee0029b | [
"MIT"
] | 2 | 2019-10-02T23:37:38.000Z | 2020-10-02T01:17:31.000Z | azure-mgmt-compute/azure/mgmt/compute/v2018_06_01/models/diagnostics_profile.py | JonathanGailliez/azure-sdk-for-python | f0f051bfd27f8ea512aea6fc0c3212ee9ee0029b | [
"MIT"
] | 1 | 2019-06-17T22:18:23.000Z | 2019-06-17T22:18:23.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 ... | 38.970588 | 82 | 0.640755 |
from msrest.serialization import Model
class DiagnosticsProfile(Model):
_attribute_map = {
'boot_diagnostics': {'key': 'bootDiagnostics', 'type': 'BootDiagnostics'},
}
def __init__(self, **kwargs):
super(DiagnosticsProfile, self).__init__(**kwargs)
self.boot_diagnostic... | true | true |
f7272115b89aaed7d8a829a174cfd5a6199d6efc | 2,425 | py | Python | 19th/ads-insert/solution.py | WooJin1993/coding_test | ec9dc2dc768fe45700b4c0695b16535c0a824f6e | [
"MIT"
] | null | null | null | 19th/ads-insert/solution.py | WooJin1993/coding_test | ec9dc2dc768fe45700b4c0695b16535c0a824f6e | [
"MIT"
] | null | null | null | 19th/ads-insert/solution.py | WooJin1993/coding_test | ec9dc2dc768fe45700b4c0695b16535c0a824f6e | [
"MIT"
] | null | null | null | # 문제: https://programmers.co.kr/learn/courses/30/lessons/72414
# --- 첫 풀이 ---
# 31개 테스트 케이스 중 시간초과 18개
from bisect import bisect_left, bisect_right
def solution(play_time, adv_time, logs):
adv_time = 3600*int(adv_time[:2]) + 60*int(adv_time[3:5]) + int(adv_time[6:])
starts, ends = [], []
for log in ... | 31.493506 | 81 | 0.547216 |
from bisect import bisect_left, bisect_right
def solution(play_time, adv_time, logs):
adv_time = 3600*int(adv_time[:2]) + 60*int(adv_time[3:5]) + int(adv_time[6:])
starts, ends = [], []
for log in logs:
start, end = log.split("-")
start = 3600*int(start[:2]) + 60*int(start[3:5]) +... | true | true |
f72721e58066887b759506095186097135e7d354 | 379,524 | py | Python | Data/scigrid-de/pypower/scigrid_2011_01_07_01.py | thanever/SOC | 9f30d1a9c7610a68de9c178a1170bdf1c8ca11d4 | [
"MIT"
] | null | null | null | Data/scigrid-de/pypower/scigrid_2011_01_07_01.py | thanever/SOC | 9f30d1a9c7610a68de9c178a1170bdf1c8ca11d4 | [
"MIT"
] | null | null | null | Data/scigrid-de/pypower/scigrid_2011_01_07_01.py | thanever/SOC | 9f30d1a9c7610a68de9c178a1170bdf1c8ca11d4 | [
"MIT"
] | null | null | null | from numpy import array
def scigrid_2011_01_07_01():
ppc = {"version": '2'}
ppc["baseMVA"] = 100.0
ppc["bus"] = array([
[586, 3, 0, 0, 0, 0, 0, 1.0, 0, 220.0, 0, 1.1, 0.9 ],
[589, 2, 0, 0, 0, 0, 0, 1.0, 0, 380.0, 0, 1.1, 0.9 ],
[590, 2, 0, 0, 0, 0, 0, 1.0, 0, 380.0, 0, 1.1,... | 71.018713 | 137 | 0.464687 | from numpy import array
def scigrid_2011_01_07_01():
ppc = {"version": '2'}
ppc["baseMVA"] = 100.0
ppc["bus"] = array([
[586, 3, 0, 0, 0, 0, 0, 1.0, 0, 220.0, 0, 1.1, 0.9 ],
[589, 2, 0, 0, 0, 0, 0, 1.0, 0, 380.0, 0, 1.1, 0.9 ],
[590, 2, 0, 0, 0, 0, 0, 1.0, 0, 380.0, 0, 1.1,... | true | true |
f727228b9cd69dec7cd34e56d40507b2d808473f | 2,667 | py | Python | src/assignments/Assignment13/win.py | acc-cosc-1336/cosc-1336-spring-2018-Skynet2020 | bfa9a4cb98ec33aee5b1c2a4277f66851c703335 | [
"MIT"
] | null | null | null | src/assignments/Assignment13/win.py | acc-cosc-1336/cosc-1336-spring-2018-Skynet2020 | bfa9a4cb98ec33aee5b1c2a4277f66851c703335 | [
"MIT"
] | 4 | 2018-02-02T13:51:49.000Z | 2018-04-01T03:07:58.000Z | src/assignments/Assignment13/win.py | acc-cosc-1336/cosc-1336-spring-2018-Skynet2020 | bfa9a4cb98ec33aee5b1c2a4277f66851c703335 | [
"MIT"
] | null | null | null | from tkinter import Tk, IntVar, Checkbutton, Button, Label, StringVar
from evaluator import Evaluator
#src.assignments.assignment13.
class Win(Tk):
def __init__(self):
Tk.__init__(self, None, None)
self.wm_title('My first window')
self.evaluator = Evaluator()
self.label_var = Stri... | 39.220588 | 112 | 0.661417 | from tkinter import Tk, IntVar, Checkbutton, Button, Label, StringVar
from evaluator import Evaluator
class Win(Tk):
def __init__(self):
Tk.__init__(self, None, None)
self.wm_title('My first window')
self.evaluator = Evaluator()
self.label_var = StringVar()
Label(self, te... | true | true |
f7272317299c91b38f7773508e076da242b481f9 | 10,657 | py | Python | tensorflow_probability/python/mcmc/transformed_kernel_test.py | oahziur/probability | 11645be43d2845da65a4fbafde4cfa95780280c0 | [
"Apache-2.0"
] | 1 | 2019-01-09T19:51:29.000Z | 2019-01-09T19:51:29.000Z | tensorflow_probability/python/mcmc/transformed_kernel_test.py | oahziur/probability | 11645be43d2845da65a4fbafde4cfa95780280c0 | [
"Apache-2.0"
] | null | null | null | tensorflow_probability/python/mcmc/transformed_kernel_test.py | oahziur/probability | 11645be43d2845da65a4fbafde4cfa95780280c0 | [
"Apache-2.0"
] | null | null | null | # Copyright 2018 The TensorFlow Probability Authors.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law o... | 36.496575 | 80 | 0.63836 |
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
import collections
import numpy as np
import tensorflow as tf
import tensorflow_probability as tfp
tfd = tfp.distributions
tfb = tfp.bijectors
FakeInnerKernelResults = collections.namedtupl... | true | true |
f727232d55060b38548b3df09955ef9d66976e61 | 1,988 | py | Python | test_for_daysBetweenDates.py | serglit72/Python_exercises | 7de440a3bdf50c4162bb2df5250487d568942ca8 | [
"Apache-2.0"
] | null | null | null | test_for_daysBetweenDates.py | serglit72/Python_exercises | 7de440a3bdf50c4162bb2df5250487d568942ca8 | [
"Apache-2.0"
] | null | null | null | test_for_daysBetweenDates.py | serglit72/Python_exercises | 7de440a3bdf50c4162bb2df5250487d568942ca8 | [
"Apache-2.0"
] | null | null | null | def nextDay(year, month, day):
"""Simple version: assume every month has 30 days"""
if day < 30:
return year, month, day + 1
else:
if month == 12:
return year + 1, 1, 1
else:
return year, month + 1, 1
def dateIsBefore(year1, month1, day1, year2, month... | 33.694915 | 115 | 0.560865 | def nextDay(year, month, day):
if day < 30:
return year, month, day + 1
else:
if month == 12:
return year + 1, 1, 1
else:
return year, month + 1, 1
def dateIsBefore(year1, month1, day1, year2, month2, day2):
if year1 < year2:
return True
i... | true | true |
f72723395930ff9f16f58ae6aa2edef6800a2bf5 | 16,970 | py | Python | intake/tests/services/test_submissions.py | cforlando/intake | a5233d5c0f862f28ee265b9b4831405aabeec7e2 | [
"MIT"
] | null | null | null | intake/tests/services/test_submissions.py | cforlando/intake | a5233d5c0f862f28ee265b9b4831405aabeec7e2 | [
"MIT"
] | null | null | null | intake/tests/services/test_submissions.py | cforlando/intake | a5233d5c0f862f28ee265b9b4831405aabeec7e2 | [
"MIT"
] | 1 | 2020-02-05T01:11:45.000Z | 2020-02-05T01:11:45.000Z | import logging
from unittest.mock import Mock, patch
from django.test import TestCase
import intake.services.submissions as SubmissionsService
from intake.tests import mock, factories
from intake.tests.mock_org_answers import get_answers_for_orgs
from intake.tests.base_testcases import ExternalNotificationsPatchTestCas... | 39.55711 | 79 | 0.668592 | import logging
from unittest.mock import Mock, patch
from django.test import TestCase
import intake.services.submissions as SubmissionsService
from intake.tests import mock, factories
from intake.tests.mock_org_answers import get_answers_for_orgs
from intake.tests.base_testcases import ExternalNotificationsPatchTestCas... | true | true |
f727240f97e54b1fa0c0d75687b19d2e132d762b | 1,245 | py | Python | restaurant/urls.py | ugleiton/Restaurant-Website | 63473bf1e27ee71c082d1065fcb3ea949ec95da1 | [
"MIT"
] | null | null | null | restaurant/urls.py | ugleiton/Restaurant-Website | 63473bf1e27ee71c082d1065fcb3ea949ec95da1 | [
"MIT"
] | null | null | null | restaurant/urls.py | ugleiton/Restaurant-Website | 63473bf1e27ee71c082d1065fcb3ea949ec95da1 | [
"MIT"
] | null | null | null | """restaurant URL Configuration
The `urlpatterns` list routes URLs to views. For more information please see:
https://docs.djangoproject.com/en/4.0/topics/http/urls/
Examples:
Function views
1. Add an import: from my_app import views
2. Add a URL to urlpatterns: path('', views.home, name='home')
Class-ba... | 40.16129 | 78 | 0.724498 | from django.conf import settings
from django.contrib import admin
from django.urls import path, include
from django.conf.urls.static import static
from index.views import home, about
from contact.views import contact
urlpatterns = [
path('', home, name="home"),
path('about/', about, name="about"),
path('co... | true | true |
f727248befee3dfa1776794c2e1e23214fd8cac8 | 262 | py | Python | finmeter/sentiment/__init__.py | mikahama/FinMeter | fd1d3d8feb216e6247a1eeac3bac16a9dd235e66 | [
"Apache-2.0"
] | 5 | 2019-10-06T20:13:32.000Z | 2021-11-07T14:27:02.000Z | finmeter/sentiment/__init__.py | mikahama/FinMeter | fd1d3d8feb216e6247a1eeac3bac16a9dd235e66 | [
"Apache-2.0"
] | null | null | null | finmeter/sentiment/__init__.py | mikahama/FinMeter | fd1d3d8feb216e6247a1eeac3bac16a9dd235e66 | [
"Apache-2.0"
] | null | null | null | from .predict_sentiment import predict as _predict
def predict(sentence):
r = _predict([sentence])[0]
if r == 0:
#positive
return 1
elif r == 1:
#strongly positive
return 2
elif r == 2:
#negative
return -1
else:
#strongly negative
return -2 | 16.375 | 50 | 0.671756 | from .predict_sentiment import predict as _predict
def predict(sentence):
r = _predict([sentence])[0]
if r == 0:
return 1
elif r == 1:
return 2
elif r == 2:
return -1
else:
return -2 | true | true |
f72726193d6a6874ed012cc02ed9030e36debec2 | 84,269 | py | Python | tests/fields/test_fields.py | SolarTech/mongoengine | 772096ec55963fc6b079b84ccac2a9917deb9204 | [
"MIT"
] | null | null | null | tests/fields/test_fields.py | SolarTech/mongoengine | 772096ec55963fc6b079b84ccac2a9917deb9204 | [
"MIT"
] | null | null | null | tests/fields/test_fields.py | SolarTech/mongoengine | 772096ec55963fc6b079b84ccac2a9917deb9204 | [
"MIT"
] | null | null | null | import datetime
import unittest
from bson import DBRef, ObjectId, SON
import pytest
from mongoengine import (
BooleanField,
ComplexDateTimeField,
DateField,
DateTimeField,
DictField,
Document,
DoesNotExist,
DynamicDocument,
DynamicField,
EmbeddedDocument,
EmbeddedDocumentFi... | 31.303492 | 116 | 0.585008 | import datetime
import unittest
from bson import DBRef, ObjectId, SON
import pytest
from mongoengine import (
BooleanField,
ComplexDateTimeField,
DateField,
DateTimeField,
DictField,
Document,
DoesNotExist,
DynamicDocument,
DynamicField,
EmbeddedDocument,
EmbeddedDocumentFi... | true | true |
f72726b689c5695dc442b20557b929ef70c44146 | 9,818 | py | Python | la_funding_analysis/pipeline/cleaning.py | nestauk/la_funding_analysis | bc338583817174f47f2cff2105f4a20a89df4c99 | [
"MIT"
] | null | null | null | la_funding_analysis/pipeline/cleaning.py | nestauk/la_funding_analysis | bc338583817174f47f2cff2105f4a20a89df4c99 | [
"MIT"
] | 1 | 2021-06-24T13:45:14.000Z | 2021-06-24T13:45:14.000Z | la_funding_analysis/pipeline/cleaning.py | nestauk/la_decarb_funding_analysis | bc338583817174f47f2cff2105f4a20a89df4c99 | [
"MIT"
] | 1 | 2021-07-19T11:54:24.000Z | 2021-07-19T11:54:24.000Z | # File: pipeline/cleaning.py
"""Functions to clean datasets.
Calling each function returns a clean version of the associated dataset.
"""
import numpy as np
import pandas as pd
from la_funding_analysis.getters.local_authority_data import (
get_epc,
get_grants,
get_imd,
get_old_parties,
get_parties... | 36.095588 | 91 | 0.637401 |
import numpy as np
import pandas as pd
from la_funding_analysis.getters.local_authority_data import (
get_epc,
get_grants,
get_imd,
get_old_parties,
get_parties_models,
get_fuel_poverty,
)
from la_funding_analysis.utils.name_cleaners import (
clean_names,
model_type,
strip_and_tit... | true | true |
f72726ceb124706a8c674c54488644e60cd85184 | 3,806 | py | Python | test/validation/test_request_history.py | thenetcircle/dino | 1047c3458e91a1b4189e9f48f1393b3a68a935b3 | [
"Apache-2.0"
] | 150 | 2016-10-05T11:09:36.000Z | 2022-03-06T16:24:41.000Z | test/validation/test_request_history.py | thenetcircle/dino | 1047c3458e91a1b4189e9f48f1393b3a68a935b3 | [
"Apache-2.0"
] | 27 | 2017-03-02T03:37:02.000Z | 2022-02-10T04:59:54.000Z | test/validation/test_request_history.py | thenetcircle/dino | 1047c3458e91a1b4189e9f48f1393b3a68a935b3 | [
"Apache-2.0"
] | 21 | 2016-11-11T07:51:48.000Z | 2020-04-26T21:38:33.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
# distributed under the Li... | 38.06 | 77 | 0.696532 |
from test.base import BaseTest
from activitystreams import parse as as_parser
from dino.validation import request
class RequestHistoryTest(BaseTest):
def setUp(self):
super(RequestHistoryTest, self).setUp()
self.create_channel_and_room()
def test_history(self):
act = sel... | true | true |
f72728291b1f65b40e3ca725885ed1fbb1420452 | 4,483 | py | Python | federated_learning_without_transfer_learning/ntf_client_fit_model.py | HwangDongJun/Federated_Learning_using_Websockets | 87c2873ae9b6a651750d08f4cd0ad5757893ce88 | [
"MIT"
] | 2 | 2021-01-05T09:41:09.000Z | 2022-02-04T04:38:50.000Z | federated_learning_without_transfer_learning/ntf_client_fit_model.py | HwangDongJun/Federated_Learning_using_Websockets | 87c2873ae9b6a651750d08f4cd0ad5757893ce88 | [
"MIT"
] | null | null | null | federated_learning_without_transfer_learning/ntf_client_fit_model.py | HwangDongJun/Federated_Learning_using_Websockets | 87c2873ae9b6a651750d08f4cd0ad5757893ce88 | [
"MIT"
] | null | null | null | # Setup library
from __future__ import absolute_import, division, print_function, unicode_literals
import os
import numpy as np
import PIL.Image as Image
from PIL import ImageFile
import tensorflow as tf
import tensorflow_hub as hub
from tensorflow.keras import layers
import matplotlib.pylab as plt
import efficientnet... | 30.496599 | 86 | 0.741914 |
from __future__ import absolute_import, division, print_function, unicode_literals
import os
import numpy as np
import PIL.Image as Image
from PIL import ImageFile
import tensorflow as tf
import tensorflow_hub as hub
from tensorflow.keras import layers
import matplotlib.pylab as plt
import efficientnet.tfkeras as efn... | true | true |
f7272b3ab2b9841850357f84b5ad356ecf40ce88 | 967 | py | Python | python/src/queues/linked_queue_improved.py | marioluan/abstract-data-types | f3823fc4649c86f5a9b677e97e8a8706e5340405 | [
"MIT"
] | 5 | 2017-03-17T17:00:00.000Z | 2018-01-27T12:31:37.000Z | python/src/queues/linked_queue_improved.py | marioluan/abstract-data-types | f3823fc4649c86f5a9b677e97e8a8706e5340405 | [
"MIT"
] | 2 | 2016-08-16T17:02:57.000Z | 2016-08-28T03:34:31.000Z | python/src/queues/linked_queue_improved.py | marioluan/abstract-data-types | f3823fc4649c86f5a9b677e97e8a8706e5340405 | [
"MIT"
] | 1 | 2020-05-19T13:30:19.000Z | 2020-05-19T13:30:19.000Z | from queue_interface import QueueInterface
from src.list.node import Node
class LinkedQueueImproved(QueueInterface):
""" implementation of a queue using a linked list """
def __init__(self):
""" create an empty queue """
self.length = 0
self.head = None
self.tail = None
def isEmpty(self):
"... | 25.447368 | 68 | 0.620476 | from queue_interface import QueueInterface
from src.list.node import Node
class LinkedQueueImproved(QueueInterface):
def __init__(self):
self.length = 0
self.head = None
self.tail = None
def isEmpty(self):
return (self.length == 0)
def insert(self, cargo):
node = Node(cargo)
node.next ... | true | true |
f7272babaf32e6372e7957c59ee51b846979c0a3 | 12,854 | py | Python | representation_batch_rl/representation_batch_rl/cql_pixels.py | pedersor/google-research | 6fa751dd261b3f6d918fd2cd35efef5d8bf3eea6 | [
"Apache-2.0"
] | null | null | null | representation_batch_rl/representation_batch_rl/cql_pixels.py | pedersor/google-research | 6fa751dd261b3f6d918fd2cd35efef5d8bf3eea6 | [
"Apache-2.0"
] | null | null | null | representation_batch_rl/representation_batch_rl/cql_pixels.py | pedersor/google-research | 6fa751dd261b3f6d918fd2cd35efef5d8bf3eea6 | [
"Apache-2.0"
] | null | null | null | # coding=utf-8
# Copyright 2022 The Google Research Authors.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicab... | 35.410468 | 143 | 0.658316 |
import typing
from dm_env import specs as dm_env_specs
import numpy as np
import tensorflow as tf
from tf_agents.specs.tensor_spec import TensorSpec
from representation_batch_rl.batch_rl import critic
from representation_batch_rl.batch_rl.encoders import ConvStack
from representation_batch_rl.batch_rl... | true | true |
f7272c0f0357147e933343d529e0daf7bf5c0052 | 872 | py | Python | src/test/test_duplicate_registration.py | FlyrInc/alembic_utils | a63465da1bd91eed86e28d65334e168ab9a2bfb6 | [
"MIT"
] | null | null | null | src/test/test_duplicate_registration.py | FlyrInc/alembic_utils | a63465da1bd91eed86e28d65334e168ab9a2bfb6 | [
"MIT"
] | null | null | null | src/test/test_duplicate_registration.py | FlyrInc/alembic_utils | a63465da1bd91eed86e28d65334e168ab9a2bfb6 | [
"MIT"
] | null | null | null | from alembic_utils.pg_function import PGFunction
from alembic_utils.replaceable_entity import register_entities, registry
from alembic_utils.testbase import run_alembic_command
def to_upper():
return PGFunction(
schema="public",
signature="to_upper(some_text text)",
definition="""
... | 27.25 | 81 | 0.666284 | from alembic_utils.pg_function import PGFunction
from alembic_utils.replaceable_entity import register_entities, registry
from alembic_utils.testbase import run_alembic_command
def to_upper():
return PGFunction(
schema="public",
signature="to_upper(some_text text)",
definition="""
... | true | true |
f7272cffc5cbad32c974f28fc7ed2fe66f62b9fc | 13,112 | py | Python | cochlear/noise_exposure.py | bburan/cochlear | 1e7ea32730a794b9f6936440a32e4a82c4bf73e7 | [
"BSD-3-Clause"
] | null | null | null | cochlear/noise_exposure.py | bburan/cochlear | 1e7ea32730a794b9f6936440a32e4a82c4bf73e7 | [
"BSD-3-Clause"
] | null | null | null | cochlear/noise_exposure.py | bburan/cochlear | 1e7ea32730a794b9f6936440a32e4a82c4bf73e7 | [
"BSD-3-Clause"
] | null | null | null | from __future__ import division
import logging
log = logging.getLogger(__name__)
import numpy as np
from scipy import signal
from traits.api import Instance, Float, Property, Int
from traitsui.api import (View, Item, ToolBar, Action, ActionGroup, VGroup,
HSplit, MenuBar, Menu, HGroup)
from ... | 35.630435 | 80 | 0.583359 | from __future__ import division
import logging
log = logging.getLogger(__name__)
import numpy as np
from scipy import signal
from traits.api import Instance, Float, Property, Int
from traitsui.api import (View, Item, ToolBar, Action, ActionGroup, VGroup,
HSplit, MenuBar, Menu, HGroup)
from ... | true | true |
f7272d6bde17f58aecbdc1140fbcccd1817e75c6 | 3,313 | py | Python | contrib/cmap.py | visinf/deblur-devil | 53cc4c72a4ddb9dcede5ee52dc53000c39ff5dab | [
"Apache-2.0"
] | 18 | 2019-11-02T05:45:48.000Z | 2021-09-12T10:03:08.000Z | contrib/cmap.py | visinf/deblur-devil | 53cc4c72a4ddb9dcede5ee52dc53000c39ff5dab | [
"Apache-2.0"
] | 3 | 2019-12-10T07:52:24.000Z | 2021-04-07T19:14:31.000Z | contrib/cmap.py | visinf/deblur-devil | 53cc4c72a4ddb9dcede5ee52dc53000c39ff5dab | [
"Apache-2.0"
] | 3 | 2020-05-26T08:02:05.000Z | 2020-09-26T21:25:10.000Z | # Author: Jochen Gast <jochen.gast@visinf.tu-darmstadt.de>
import numpy as np
import torch
from matplotlib import cm
from torch import nn
# ----------------------------------------------------------------------------------------
# See https://matplotlib.org/examples/color/colormaps_reference.html
#
# Typical choices ... | 36.01087 | 99 | 0.563236 |
import numpy as np
import torch
from matplotlib import cm
from torch import nn
# ----------------------------------------------------------------------------------------
COLORMAPS = [
# Perceptually Uniform Sequential
'viridis', 'plasma', 'inferno', 'magma',
# Sequential
'Greys', 'Purples', 'B... | true | true |
f7272f2c05e0fbb0337367a91ca3012dfcefc44e | 7,426 | py | Python | release.py | euri10/opentelemetry-operations-python | d751953dc30d6d0b27dbf605e9b505c283d00cb2 | [
"Apache-2.0"
] | null | null | null | release.py | euri10/opentelemetry-operations-python | d751953dc30d6d0b27dbf605e9b505c283d00cb2 | [
"Apache-2.0"
] | null | null | null | release.py | euri10/opentelemetry-operations-python | d751953dc30d6d0b27dbf605e9b505c283d00cb2 | [
"Apache-2.0"
] | null | null | null | #!/usr/bin/env python3
import argparse
import re
import subprocess
import sys
from datetime import datetime
from pathlib import Path
from typing import Dict, Iterable, Sequence, Union
RELEASE_COMMIT_FMT = """Release {release_version} (Part 1/2) release commit
- Update version.py files
- Marked releases in changelogs... | 28.452107 | 99 | 0.62564 |
import argparse
import re
import subprocess
import sys
from datetime import datetime
from pathlib import Path
from typing import Dict, Iterable, Sequence, Union
RELEASE_COMMIT_FMT = """Release {release_version} (Part 1/2) release commit
- Update version.py files
- Marked releases in changelogs
- Pinned `opentelemet... | true | true |
f7272fca640e6f007ec6f1e2a9189cc37e27b8ba | 5,026 | py | Python | pgAdmin/pgadmin4/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/indexes/tests/test_indexes_get.py | WeilerWebServices/PostgreSQL | ae594ed077bebbad1be3c1d95c38b7c2c2683e8c | [
"PostgreSQL"
] | null | null | null | pgAdmin/pgadmin4/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/indexes/tests/test_indexes_get.py | WeilerWebServices/PostgreSQL | ae594ed077bebbad1be3c1d95c38b7c2c2683e8c | [
"PostgreSQL"
] | null | null | null | pgAdmin/pgadmin4/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/indexes/tests/test_indexes_get.py | WeilerWebServices/PostgreSQL | ae594ed077bebbad1be3c1d95c38b7c2c2683e8c | [
"PostgreSQL"
] | null | null | null | ##########################################################################
#
# pgAdmin 4 - PostgreSQL Tools
#
# Copyright (C) 2013 - 2020, The pgAdmin Development Team
# This software is released under the PostgreSQL Licence
#
##########################################################################
import uuid
from ... | 47.415094 | 79 | 0.547951 | true | true | |
f72730970d6aae9560fb47022aa4c2e36ccd3f51 | 2,001 | py | Python | api/serializers.py | Vadim3x4/yamdb_final | d6ccca74a41c5d0a78977d71b446daf2420fa8bf | [
"MIT"
] | null | null | null | api/serializers.py | Vadim3x4/yamdb_final | d6ccca74a41c5d0a78977d71b446daf2420fa8bf | [
"MIT"
] | null | null | null | api/serializers.py | Vadim3x4/yamdb_final | d6ccca74a41c5d0a78977d71b446daf2420fa8bf | [
"MIT"
] | null | null | null | from django.shortcuts import get_object_or_404
from rest_framework import serializers
from .models import Category, Comment, Genre, Review, Title
class CategorySerializer(serializers.ModelSerializer):
class Meta:
model = Category
fields = (
"name",
"slug",
)
clas... | 23.821429 | 75 | 0.625187 | from django.shortcuts import get_object_or_404
from rest_framework import serializers
from .models import Category, Comment, Genre, Review, Title
class CategorySerializer(serializers.ModelSerializer):
class Meta:
model = Category
fields = (
"name",
"slug",
)
clas... | true | true |
f72730c032f7ff966ee6845ddca77d3b6280e9b8 | 10,719 | py | Python | optimization/main/federated_trainer.py | alshedivat/federated | 100f0e0940282818c42c39156407ae419f26de50 | [
"Apache-2.0"
] | 2 | 2021-10-19T13:55:11.000Z | 2021-11-11T11:26:05.000Z | federated/optimization/main/federated_trainer.py | luke-who/TFF | fe9f44a504bc51b603a3ab9a181148da0aa9612f | [
"MIT"
] | null | null | null | federated/optimization/main/federated_trainer.py | luke-who/TFF | fe9f44a504bc51b603a3ab9a181148da0aa9612f | [
"MIT"
] | 1 | 2021-03-09T09:48:56.000Z | 2021-03-09T09:48:56.000Z | # Copyright 2020, Google LLC.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing... | 41.546512 | 80 | 0.746525 |
import collections
import os.path
from typing import Callable
from absl import app
from absl import flags
import tensorflow as tf
import tensorflow_federated as tff
from optimization.cifar100 import federated_cifar100
from optimization.emnist import federated_emnist
from optimization.emnist_ae import fe... | true | true |
f72730c9259d1d4a5dd9d24f84dc6bcf9bf25740 | 7,306 | py | Python | fuzzyJets.py | hbawa120578/JetClustering | b0991927258e5a80e61b985695f06f45740e706b | [
"MIT"
] | 3 | 2018-06-15T09:12:17.000Z | 2021-06-20T15:58:21.000Z | fuzzyJets.py | hbawa120578/JetClustering | b0991927258e5a80e61b985695f06f45740e706b | [
"MIT"
] | 1 | 2018-06-22T00:03:45.000Z | 2018-06-22T00:03:45.000Z | fuzzyJets.py | mickypaganini/SSI2016-jet-clustering | a340558957f55159197e845850fc16e622082e7e | [
"MIT"
] | 6 | 2016-08-18T23:16:00.000Z | 2020-04-13T01:13:20.000Z | import sys
import numpy as np
from numpy import matlib
from scipy.stats import multivariate_normal
from read_data import read_data
import matplotlib.pyplot as plt
import time
import visual
########## Description of Algorithm ###########
# We will assume having m events
# Each event should have k=3 jets
# Each event sh... | 34.956938 | 134 | 0.540378 | import sys
import numpy as np
from numpy import matlib
from scipy.stats import multivariate_normal
from read_data import read_data
import matplotlib.pyplot as plt
import time
import visual
newParticle[0] = particles[i][2]
newParticle[1] = particles[i][0]
newParticle[2] = p... | false | true |
f7273144dffee7dafd27261d8848ea23eb74a2e3 | 8,984 | py | Python | nipype/utils/misc.py | lighthall-lab/NiPype | 80d3f05d9aa006fa3055785327892e8a89530a80 | [
"Apache-2.0"
] | null | null | null | nipype/utils/misc.py | lighthall-lab/NiPype | 80d3f05d9aa006fa3055785327892e8a89530a80 | [
"Apache-2.0"
] | null | null | null | nipype/utils/misc.py | lighthall-lab/NiPype | 80d3f05d9aa006fa3055785327892e8a89530a80 | [
"Apache-2.0"
] | null | null | null | # -*- coding: utf-8 -*-
# emacs: -*- mode: python; py-indent-offset: 4; indent-tabs-mode: nil -*-
# vi: set ft=python sts=4 ts=4 sw=4 et:
"""Miscellaneous utility functions
"""
from __future__ import (print_function, unicode_literals, division,
absolute_import)
from builtins import next, str
im... | 29.552632 | 78 | 0.603851 |
from __future__ import (print_function, unicode_literals, division,
absolute_import)
from builtins import next, str
import sys
import re
from collections import Iterator
from distutils.version import LooseVersion
import numpy as np
from future.utils import raise_from
from future import sta... | true | true |
f7273303519fad0fa8811da7d0c2b7e2b0859a99 | 6,318 | py | Python | src/generated-spec/redshift.py | wheerd/cloudformation-to-terraform | 5411b33293e1f7d7673bb5d4cb52ff0537240db3 | [
"MIT"
] | null | null | null | src/generated-spec/redshift.py | wheerd/cloudformation-to-terraform | 5411b33293e1f7d7673bb5d4cb52ff0537240db3 | [
"MIT"
] | null | null | null | src/generated-spec/redshift.py | wheerd/cloudformation-to-terraform | 5411b33293e1f7d7673bb5d4cb52ff0537240db3 | [
"MIT"
] | null | null | null | from . import *
class AWS_Redshift_ClusterParameterGroup_Parameter(CloudFormationProperty):
def write(self, w):
with w.block("parameter"):
self.property(w, "ParameterName", "parameter_name", StringValueConverter())
self.property(w, "ParameterValue", "parameter_value", StringValueConverter())
class ... | 55.911504 | 363 | 0.755461 | from . import *
class AWS_Redshift_ClusterParameterGroup_Parameter(CloudFormationProperty):
def write(self, w):
with w.block("parameter"):
self.property(w, "ParameterName", "parameter_name", StringValueConverter())
self.property(w, "ParameterValue", "parameter_value", StringValueConverter())
class ... | true | true |
f72733fd03757b454a35ae32f4709e54b50e01e9 | 2,585 | py | Python | lib/python/treadmill/cli/scheduler/__init__.py | drienyov/treadmill | ce21537cd9a2fdb0567ac2aa3de1afcb2f6861de | [
"Apache-2.0"
] | 2 | 2017-10-31T18:48:20.000Z | 2018-03-04T20:35:20.000Z | lib/python/treadmill/cli/scheduler/__init__.py | bretttegart/treadmill | 812109e31c503a6eddaee2d3f2e1faf2833b6aaf | [
"Apache-2.0"
] | null | null | null | lib/python/treadmill/cli/scheduler/__init__.py | bretttegart/treadmill | 812109e31c503a6eddaee2d3f2e1faf2833b6aaf | [
"Apache-2.0"
] | null | null | null | """Top level command for Treadmill reports.
"""
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
from __future__ import unicode_literals
import json
import click
import pandas as pd
import tabulate
from six.moves import urllib_parse
from treadmill import ... | 27.795699 | 78 | 0.635977 |
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
from __future__ import unicode_literals
import json
import click
import pandas as pd
import tabulate
from six.moves import urllib_parse
from treadmill import cli
from treadmill import context
from treadmill... | true | true |
f727340d07d3b97b4a2fa74591b9f914b730fdb4 | 730 | py | Python | polygon/__init__.py | pssolanki111/polygon | 99c90950a116f78fdfd8096e354153752c6cdd95 | [
"MIT"
] | 20 | 2021-08-29T10:06:00.000Z | 2022-03-22T07:30:01.000Z | polygon/__init__.py | pssolanki111/polygon | 99c90950a116f78fdfd8096e354153752c6cdd95 | [
"MIT"
] | 1 | 2022-02-16T19:03:12.000Z | 2022-02-25T06:13:51.000Z | polygon/__init__.py | pssolanki111/polygon | 99c90950a116f78fdfd8096e354153752c6cdd95 | [
"MIT"
] | 3 | 2022-01-25T03:34:07.000Z | 2022-02-08T15:06:11.000Z | # ========================================================= #
from .stocks import StocksClient
from .streaming import StreamClient, AsyncStreamClient
from .forex import ForexClient
from .crypto import CryptoClient
from .reference_apis import ReferenceClient
from .options import (OptionsClient, build_option_symbol, pars... | 42.941176 | 116 | 0.591781 | from .stocks import StocksClient
from .streaming import StreamClient, AsyncStreamClient
from .forex import ForexClient
from .crypto import CryptoClient
from .reference_apis import ReferenceClient
from .options import (OptionsClient, build_option_symbol, parse_option_symbol, OptionSymbol,
build_opt... | true | true |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.