max_stars_repo_path stringlengths 4 286 | max_stars_repo_name stringlengths 5 119 | max_stars_count int64 0 191k | id stringlengths 1 7 | content stringlengths 6 1.03M | content_cleaned stringlengths 6 1.03M | language stringclasses 111
values | language_score float64 0.03 1 | comments stringlengths 0 556k | edu_score float64 0.32 5.03 | edu_int_score int64 0 5 |
|---|---|---|---|---|---|---|---|---|---|---|
test/crossrunner/compat.py | BluechipSystems/thrift | 0 | 900 | import os
import sys
if sys.version_info[0] == 2:
_ENCODE = sys.getfilesystemencoding()
def path_join(*args):
bin_args = map(lambda a: a.decode(_ENCODE), args)
return os.path.join(*bin_args).encode(_ENCODE)
def str_join(s, l):
bin_args = map(lambda a: a.decode(_ENCODE), l)
b = s.decode(_ENCODE)... | import os
import sys
if sys.version_info[0] == 2:
_ENCODE = sys.getfilesystemencoding()
def path_join(*args):
bin_args = map(lambda a: a.decode(_ENCODE), args)
return os.path.join(*bin_args).encode(_ENCODE)
def str_join(s, l):
bin_args = map(lambda a: a.decode(_ENCODE), l)
b = s.decode(_ENCODE)... | none | 1 | 2.955769 | 3 | |
test/test_vom.py | usamaahmadkhan/vpp | 0 | 901 | #!/usr/bin/env python
""" VAPI test """
import unittest
import os
import signal
from framework import VppTestCase, running_extended_tests, \
VppTestRunner, Worker
@unittest.skipUnless(running_extended_tests(), "part of extended tests")
class VOMTestCase(VppTestCase):
""" VPP Object Model Test """
def te... | #!/usr/bin/env python
""" VAPI test """
import unittest
import os
import signal
from framework import VppTestCase, running_extended_tests, \
VppTestRunner, Worker
@unittest.skipUnless(running_extended_tests(), "part of extended tests")
class VOMTestCase(VppTestCase):
""" VPP Object Model Test """
def te... | en | 0.182799 | #!/usr/bin/env python VAPI test VPP Object Model Test run C++ VOM tests | 2.262224 | 2 |
locations/spiders/tesco.py | bealbrown/allhours | 0 | 902 | <reponame>bealbrown/allhours<filename>locations/spiders/tesco.py
import json
import re
import scrapy
from locations.hourstudy import inputoutput
DAYS = {
'mo': 'Mo',
'tu': 'Tu',
'we': 'We',
'fr': 'Fr',
'th': 'Th',
'sa': 'Sa',
'su': 'Su',
}
class TescoSpider(scrapy.Spider):
name = "tesco"... | import json
import re
import scrapy
from locations.hourstudy import inputoutput
DAYS = {
'mo': 'Mo',
'tu': 'Tu',
'we': 'We',
'fr': 'Fr',
'th': 'Th',
'sa': 'Sa',
'su': 'Su',
}
class TescoSpider(scrapy.Spider):
name = "tesco"
allowed_domains = ["tescolocation.api.tesco.com"]
def st... | en | 0.226384 | # yield inputoutput(**properties) | 2.750491 | 3 |
astropy/table/serialize.py | tacaswell/astropy | 1 | 903 | from importlib import import_module
import re
from copy import deepcopy
from collections import OrderedDict
from astropy.utils.data_info import MixinInfo
from .column import Column
from .table import Table, QTable, has_info_class
from astropy.units.quantity import QuantityInfo
__construct_mixin_classes = ('astropy.t... | from importlib import import_module
import re
from copy import deepcopy
from collections import OrderedDict
from astropy.utils.data_info import MixinInfo
from .column import Column
from .table import Table, QTable, has_info_class
from astropy.units.quantity import QuantityInfo
__construct_mixin_classes = ('astropy.t... | en | 0.752779 | Subclass of dict that is a used in the representation to contain the name (and possible other info) for a mixin attribute (either primary data or an array-like attribute) that is serialized as a column in the table. Normally contains the single key ``name`` with the name of the column in the table. Car... | 2.313375 | 2 |
UVa 573 - The Snail/sample/main.py | tadvi/uva | 1 | 904 | '''
Created on Jun 18, 2013
@author: <NAME>
All rights reserved.
'''
import time
from multiprocessing.pool import Pool
parallelSolve = False
infinity = 1 << 30
def solve(par):
H, U, D, F = par
day = 0
amountRise = U
currH = 0
while True:
amountRise = U * (1 - 0.01 * F * day)
cur... | '''
Created on Jun 18, 2013
@author: <NAME>
All rights reserved.
'''
import time
from multiprocessing.pool import Pool
parallelSolve = False
infinity = 1 << 30
def solve(par):
H, U, D, F = par
day = 0
amountRise = U
currH = 0
while True:
amountRise = U * (1 - 0.01 * F * day)
cur... | en | 0.479178 | Created on Jun 18, 2013 @author: <NAME> All rights reserved. #%d: %s\n" % (test + 1, self.results[test])) | 3.149916 | 3 |
scibert/models/text_classifier.py | tomhoper/scibert | 1,143 | 905 | from typing import Dict, Optional, List, Any
import torch
import torch.nn.functional as F
from allennlp.data import Vocabulary
from allennlp.models.model import Model
from allennlp.modules import FeedForward, TextFieldEmbedder, Seq2SeqEncoder
from allennlp.nn import InitializerApplicator, RegularizerApplicator
from al... | from typing import Dict, Optional, List, Any
import torch
import torch.nn.functional as F
from allennlp.data import Vocabulary
from allennlp.models.model import Model
from allennlp.modules import FeedForward, TextFieldEmbedder, Seq2SeqEncoder
from allennlp.nn import InitializerApplicator, RegularizerApplicator
from al... | en | 0.522829 | Implements a basic text classifier: 1) Embed tokens using `text_field_embedder` 2) Seq2SeqEncoder, e.g. BiLSTM 3) Append the first and last encoder states 4) Final feedforward layer Optimized with CrossEntropyLoss. Evaluated with CategoricalAccuracy & F1. Parameters ---------- text... | 2.590485 | 3 |
plugins/template/tasks.py | crotwell/cmd2 | 469 | 906 | #
# -*- coding: utf-8 -*-
"""Development related tasks to be run with 'invoke'"""
import os
import pathlib
import shutil
import invoke
TASK_ROOT = pathlib.Path(__file__).resolve().parent
TASK_ROOT_STR = str(TASK_ROOT)
# shared function
def rmrf(items, verbose=True):
"""Silently remove a list of directories or ... | #
# -*- coding: utf-8 -*-
"""Development related tasks to be run with 'invoke'"""
import os
import pathlib
import shutil
import invoke
TASK_ROOT = pathlib.Path(__file__).resolve().parent
TASK_ROOT_STR = str(TASK_ROOT)
# shared function
def rmrf(items, verbose=True):
"""Silently remove a list of directories or ... | en | 0.578148 | # # -*- coding: utf-8 -*- Development related tasks to be run with 'invoke' # shared function Silently remove a list of directories or files # rmtree doesn't remove bare files # create namespaces ##### # # pytest, pylint, and codecov # ##### Run tests and code coverage using pytest Remove pytest cache and code coverage... | 2.270921 | 2 |
scripts/automation/trex_control_plane/interactive/trex/examples/stl/ndr_plugin.py | timgates42/trex-core | 956 | 907 | import stl_path
class MyNDRPlugin():
def __init__(self):
pass
def pre_iteration(self, finding_max_rate, run_results=None, **kwargs):
""" Function ran before each iteration.
:parameters:
finding_max_rate: boolean
Indicates whether we are running ... | import stl_path
class MyNDRPlugin():
def __init__(self):
pass
def pre_iteration(self, finding_max_rate, run_results=None, **kwargs):
""" Function ran before each iteration.
:parameters:
finding_max_rate: boolean
Indicates whether we are running ... | en | 0.849385 | Function ran before each iteration. :parameters: finding_max_rate: boolean Indicates whether we are running for the first time, trying to find the max rate. In this is the case, the run_results will be None. run_results: dict A dictio... | 2.949941 | 3 |
homeassistant/components/epsonworkforce/sensor.py | maexono/home-assistant | 2 | 908 | """Support for Epson Workforce Printer."""
from datetime import timedelta
import logging
import voluptuous as vol
from homeassistant.components.sensor import PLATFORM_SCHEMA
from homeassistant.const import CONF_HOST, CONF_MONITORED_CONDITIONS
from homeassistant.exceptions import PlatformNotReady
import homeassistant.... | """Support for Epson Workforce Printer."""
from datetime import timedelta
import logging
import voluptuous as vol
from homeassistant.components.sensor import PLATFORM_SCHEMA
from homeassistant.const import CONF_HOST, CONF_MONITORED_CONDITIONS
from homeassistant.exceptions import PlatformNotReady
import homeassistant.... | en | 0.816778 | Support for Epson Workforce Printer. Set up the cartridge sensor. Representation of a cartridge sensor. Initialize a cartridge sensor. Return the name of the sensor. Icon to use in the frontend, if any. Return the unit the value is expressed in. Return the state of the device. Could the device be accessed during the la... | 2.274142 | 2 |
bot/exts/help_channels/_cog.py | bast0006/bot | 0 | 909 | <gh_stars>0
import asyncio
import logging
import random
import typing as t
from datetime import datetime, timezone
from operator import attrgetter
import discord
import discord.abc
from discord.ext import commands
from bot import constants
from bot.bot import Bot
from bot.exts.help_channels import _caches, _channel, ... | import asyncio
import logging
import random
import typing as t
from datetime import datetime, timezone
from operator import attrgetter
import discord
import discord.abc
from discord.ext import commands
from bot import constants
from bot.bot import Bot
from bot.exts.help_channels import _caches, _channel, _cooldown, _... | en | 0.860747 | This is a Python help channel. You can claim your own help channel in the Python Help: Available category. Manage the help channel system of the guild. The system is based on a 3-category system: Available Category * Contains channels which are ready to be occupied by someone who needs help * Will al... | 2.58007 | 3 |
code/menu/screens/shopmenu.py | LordZagreus/LodeRunner | 1 | 910 | <filename>code/menu/screens/shopmenu.py
import os
import math
import random
import time
from code.menu.menu import Menu
from code.tools.eventqueue import EventQueue
from code.tools.xml import XMLParser
from code.utils.common import coalesce, intersect, offset_rect, log, log2, xml_encode, xml_decode, translate_rgb... | <filename>code/menu/screens/shopmenu.py
import os
import math
import random
import time
from code.menu.menu import Menu
from code.tools.eventqueue import EventQueue
from code.tools.xml import XMLParser
from code.utils.common import coalesce, intersect, offset_rect, log, log2, xml_encode, xml_decode, translate_rgb... | en | 0.793161 | # Assume all shop menus come from already-lightboxed dialogues. # We're going to keep a handle to the seller so that we can # remove items from their inventory after a purchase... #seller # Shop title (e.g. "Bob's Fine Items") # Salutation (e.g. "Look at these great items") # Before we begin populating the shop menu, w... | 2.878021 | 3 |
lib/bridgedb/runner.py | liudonghua123/bridgedb | 0 | 911 | # -*- coding: utf-8 ; test-case-name: bridgedb.test.test_runner -*-
#
# This file is part of BridgeDB, a Tor bridge distribution system.
#
# :authors: <NAME> 0xA3ADB67A2CDB8B35 <<EMAIL>>
# please also see AUTHORS file
# :copyright: (c) 2007-2015, The Tor Project, Inc.
# (c) 2007-2015, all entities... | # -*- coding: utf-8 ; test-case-name: bridgedb.test.test_runner -*-
#
# This file is part of BridgeDB, a Tor bridge distribution system.
#
# :authors: <NAME> 0xA3ADB67A2CDB8B35 <<EMAIL>>
# please also see AUTHORS file
# :copyright: (c) 2007-2015, The Tor Project, Inc.
# (c) 2007-2015, all entities... | en | 0.757382 | # -*- coding: utf-8 ; test-case-name: bridgedb.test.test_runner -*- # # This file is part of BridgeDB, a Tor bridge distribution system. # # :authors: <NAME> 0xA3ADB67A2CDB8B35 <<EMAIL>> # please also see AUTHORS file # :copyright: (c) 2007-2015, The Tor Project, Inc. # (c) 2007-2015, all entities... | 1.85274 | 2 |
wce_triage/ops/create_image_runner.py | pfrouleau/wce-triage-v2 | 3 | 912 | <filename>wce_triage/ops/create_image_runner.py
#!/usr/bin/env python3
#
# Create disk image
#
import re, sys, traceback
from .tasks import task_fetch_partitions, task_refresh_partitions, task_mount, task_remove_persistent_rules, task_remove_logs, task_fsck, task_shrink_partition, task_expand_partition, task_unmount
... | <filename>wce_triage/ops/create_image_runner.py
#!/usr/bin/env python3
#
# Create disk image
#
import re, sys, traceback
from .tasks import task_fetch_partitions, task_refresh_partitions, task_mount, task_remove_persistent_rules, task_remove_logs, task_fsck, task_shrink_partition, task_expand_partition, task_unmount
... | en | 0.796317 | #!/usr/bin/env python3 # # Create disk image # # "Waiting", "Prepare", "Preflight", "Running", "Success", "Failed"] # Runner for creating disk image. does fsck, shrink partition, create disk image and resize the file system back to the max. For now, this is only dealing with the EXT4 linux partition. # FIXME: If I wan... | 2.180471 | 2 |
batch_processing_dataflow/play_store_flow.py | KeeplerIO/meetup-hands-on-gcp-2019 | 1 | 913 | <gh_stars>1-10
import argparse
import logging
import apache_beam as beam
from apache_beam.io import WriteToBigQuery
from apache_beam.io import ReadFromText, WriteToText
from apache_beam.options.pipeline_options import PipelineOptions
class ProcessCSV(beam.DoFn):
def process(self, element, *args, **kwargs):
... | import argparse
import logging
import apache_beam as beam
from apache_beam.io import WriteToBigQuery
from apache_beam.io import ReadFromText, WriteToText
from apache_beam.options.pipeline_options import PipelineOptions
class ProcessCSV(beam.DoFn):
def process(self, element, *args, **kwargs):
import csv
... | en | 0.86914 | Main entry point. It defines and runs the pipeline. | 2.433789 | 2 |
backend/main/server/resources/Message.py | Manotomo-Alliance-Support-Squad/WWS | 0 | 914 | from flask import request
from flask_jwt import jwt_required
from flask_restful import Resource
from main.server import app, cache, db
from main.server.models import Message, MessageSchema
messages_schema = MessageSchema(many=True)
message_schema = MessageSchema()
@app.after_request
def add_header(response):
r... | from flask import request
from flask_jwt import jwt_required
from flask_restful import Resource
from main.server import app, cache, db
from main.server.models import Message, MessageSchema
messages_schema = MessageSchema(many=True)
message_schema = MessageSchema()
@app.after_request
def add_header(response):
r... | en | 0.603479 | Gets the number of messages available on the server Gets a range of messages on the server # the last item in the range # Partial Content Served Gets all messages on the server # Partial Content Served Add message "Get a message by message ID delete a message by ID | 2.442037 | 2 |
demos/chicken_pasta/chicken_pasta.py | icaros-usc/wecook | 15 | 915 | <filename>demos/chicken_pasta/chicken_pasta.py
#!/usr/bin/env python3
import rospy
from wecook.msg import ActionMsg, TaskMsg, SceneMsg, ObjectMsg, ContainingMsg, AgentMsg
def talker():
pub = rospy.Publisher('WeCookDispatch', TaskMsg, queue_size=10)
rospy.init_node('wecook_chicken_pasta', anonymous=True)
... | <filename>demos/chicken_pasta/chicken_pasta.py
#!/usr/bin/env python3
import rospy
from wecook.msg import ActionMsg, TaskMsg, SceneMsg, ObjectMsg, ContainingMsg, AgentMsg
def talker():
pub = rospy.Publisher('WeCookDispatch', TaskMsg, queue_size=10)
rospy.init_node('wecook_chicken_pasta', anonymous=True)
... | en | 0.467875 | #!/usr/bin/env python3 # sleeping 10 seconds to publish | 2.126915 | 2 |
volttron/platform/vip/agent/subsystems/heartbeat.py | rmay-intwine/volttron | 0 | 916 | # -*- coding: utf-8 -*- {{{
# vim: set fenc=utf-8 ft=python sw=4 ts=4 sts=4 et:
#
# Copyright 2017, Battelle Memorial Institute.
#
# 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... | # -*- coding: utf-8 -*- {{{
# vim: set fenc=utf-8 ft=python sw=4 ts=4 sts=4 et:
#
# Copyright 2017, Battelle Memorial Institute.
#
# 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... | en | 0.865185 | # -*- coding: utf-8 -*- {{{ # vim: set fenc=utf-8 ft=python sw=4 ts=4 sts=4 et: # # Copyright 2017, Battelle Memorial Institute. # # 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... | 1.203405 | 1 |
datasets/experimental/ni_superalloys/Ni_superalloy.py | kyawlin/smlb | 0 | 917 | """Ni-Superalloy dataset.
Scientific Machine Learning Benchmark
A benchmark of regression models in chem- and materials informatics.
2019, <NAME>, Citrine Informatics.
See class NiSuperalloyDataset for details.
"""
import os
import json
import zipfile
from typing import List, Optional, Tuple, Union
import numpy as ... | """Ni-Superalloy dataset.
Scientific Machine Learning Benchmark
A benchmark of regression models in chem- and materials informatics.
2019, <NAME>, Citrine Informatics.
See class NiSuperalloyDataset for details.
"""
import os
import json
import zipfile
from typing import List, Optional, Tuple, Union
import numpy as ... | en | 0.833426 | Ni-Superalloy dataset. Scientific Machine Learning Benchmark A benchmark of regression models in chem- and materials informatics. 2019, <NAME>, Citrine Informatics. See class NiSuperalloyDataset for details. Ni-Superalloy dataset. Based on: <NAME>, <NAME>, <NAME>, <NAME>: Design of a nickel-base superall... | 2.701426 | 3 |
metricbeat/module/postgresql/test_postgresql.py | SHolzhauer/beats | 4 | 918 | import metricbeat
import os
import pytest
import sys
import unittest
class Test(metricbeat.BaseTest):
COMPOSE_SERVICES = ['postgresql']
def common_checks(self, output):
# Ensure no errors or warnings exist in the log.
self.assert_no_logged_warnings()
for evt in output:
t... | import metricbeat
import os
import pytest
import sys
import unittest
class Test(metricbeat.BaseTest):
COMPOSE_SERVICES = ['postgresql']
def common_checks(self, output):
# Ensure no errors or warnings exist in the log.
self.assert_no_logged_warnings()
for evt in output:
t... | en | 0.276432 | # Ensure no errors or warnings exist in the log. PostgreSQL module outputs an event. PostgreSQL module outputs an event. PostgreSQL module outputs an event. | 2.156323 | 2 |
pytorch_lightning/accelerators/cpu_backend.py | ozen/pytorch-lightning | 0 | 919 | <gh_stars>0
# Copyright The PyTorch Lightning team.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or... | # Copyright The PyTorch Lightning team.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to i... | en | 0.875979 | # Copyright The PyTorch Lightning team. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to i... | 2.012612 | 2 |
books/admin.py | aurphillus/Django-Library-Completed | 0 | 920 | from django.contrib import admin
from books.models import Genre, Author, Book, TBR
# Register your models here.
admin.site.register(Genre)
admin.site.register(Author)
admin.site.register(Book)
admin.site.register(TBR) | from django.contrib import admin
from books.models import Genre, Author, Book, TBR
# Register your models here.
admin.site.register(Genre)
admin.site.register(Author)
admin.site.register(Book)
admin.site.register(TBR) | en | 0.968259 | # Register your models here. | 1.580305 | 2 |
rabbitmq/tests/common.py | jfmyers9/integrations-core | 1 | 921 | # (C) Datadog, Inc. 2018-present
# All rights reserved
# Licensed under a 3-clause BSD style license (see LICENSE)
import os
from packaging import version
from datadog_checks.base.utils.common import get_docker_hostname
HERE = os.path.dirname(os.path.abspath(__file__))
ROOT = os.path.dirname(os.path.dirname(HERE))
... | # (C) Datadog, Inc. 2018-present
# All rights reserved
# Licensed under a 3-clause BSD style license (see LICENSE)
import os
from packaging import version
from datadog_checks.base.utils.common import get_docker_hostname
HERE = os.path.dirname(os.path.abspath(__file__))
ROOT = os.path.dirname(os.path.dirname(HERE))
... | en | 0.764575 | # (C) Datadog, Inc. 2018-present # All rights reserved # Licensed under a 3-clause BSD style license (see LICENSE) | 1.862866 | 2 |
st2common/st2common/util/pack.py | timgates42/st2 | 0 | 922 | <reponame>timgates42/st2
# Copyright 2020 The StackStorm Authors.
# Copyright 2019 Extreme Networks, Inc.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/license... | # Copyright 2020 The StackStorm Authors.
# Copyright 2019 Extreme Networks, Inc.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless ... | en | 0.806787 | # Copyright 2020 The StackStorm Authors. # Copyright 2019 Extreme Networks, Inc. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless ... | 1.414347 | 1 |
module1-introduction-to-sql/query.py | jrslagle/DS-Unit-3-Sprint-2-SQL-and-Databases | 0 | 923 |
# Look at the charactercreator_character table
# GET_CHARACTERS = """
# SELECT *
# FROM charactercreator_character;
# """
# How many total Characters are there? (302)
TOTAL_CHARACTERS = """
SELECT COUNT(*) as number_of_characters
FROM charactercreator_character;
"""
# How many of each specific subclass?
# TOTAL_SUBC... |
# Look at the charactercreator_character table
# GET_CHARACTERS = """
# SELECT *
# FROM charactercreator_character;
# """
# How many total Characters are there? (302)
TOTAL_CHARACTERS = """
SELECT COUNT(*) as number_of_characters
FROM charactercreator_character;
"""
# How many of each specific subclass?
# TOTAL_SUBC... | en | 0.728923 | # Look at the charactercreator_character table # GET_CHARACTERS = """ # SELECT * # FROM charactercreator_character; # """ # How many total Characters are there? (302) SELECT COUNT(*) as number_of_characters FROM charactercreator_character; # How many of each specific subclass? # TOTAL_SUBCLASS = """ # SELECT # (SELECT... | 3.444632 | 3 |
pixelproject/grid.py | MickaelRigault/pixelproject | 0 | 924 | <filename>pixelproject/grid.py
#! /usr/bin/env python
#
import warnings
import numpy as np
UNIT_SQUARE = np.asarray([[0,0],[0,1],[1,1],[1,0]])-0.5
from propobject import BaseObject
from shapely import geometry
import pandas
import geopandas
# ======================= #
# #
# Functions ... | <filename>pixelproject/grid.py
#! /usr/bin/env python
#
import warnings
import numpy as np
UNIT_SQUARE = np.asarray([[0,0],[0,1],[1,1],[1,0]])-0.5
from propobject import BaseObject
from shapely import geometry
import pandas
import geopandas
# ======================= #
# #
# Functions ... | en | 0.659762 | #! /usr/bin/env python # # ======================= # # # # Functions # # # # ======================= # # not += because conflict between int and float array # ======================= # # # # Classes # # ... | 2.932539 | 3 |
numpy/lib/format.py | AnirudhDagar/numpy | 5 | 925 | """
Binary serialization
NPY format
==========
A simple format for saving numpy arrays to disk with the full
information about them.
The ``.npy`` format is the standard binary file format in NumPy for
persisting a *single* arbitrary NumPy array on disk. The format stores all
of the shape and dtype information necess... | """
Binary serialization
NPY format
==========
A simple format for saving numpy arrays to disk with the full
information about them.
The ``.npy`` format is the standard binary file format in NumPy for
persisting a *single* arbitrary NumPy array on disk. The format stores all
of the shape and dtype information necess... | en | 0.799126 | Binary serialization NPY format ========== A simple format for saving numpy arrays to disk with the full information about them. The ``.npy`` format is the standard binary file format in NumPy for persisting a *single* arbitrary NumPy array on disk. The format stores all of the shape and dtype information necessary ... | 3.392648 | 3 |
gva/data/validator/is_valid_enum.py | gva-jjoyce/gva_data | 0 | 926 | <gh_stars>0
"""
Enumerator Test
"""
from typing import Any
class is_valid_enum():
"""
Test if a variable is on a list of valid values
"""
__slots__ = ('symbols')
def __init__(self, **kwargs):
"""
-> "type": "enum", "symbols": ["up", "down"]
symbols: list of allowed values ... | """
Enumerator Test
"""
from typing import Any
class is_valid_enum():
"""
Test if a variable is on a list of valid values
"""
__slots__ = ('symbols')
def __init__(self, **kwargs):
"""
-> "type": "enum", "symbols": ["up", "down"]
symbols: list of allowed values (case sensit... | en | 0.400734 | Enumerator Test Test if a variable is on a list of valid values -> "type": "enum", "symbols": ["up", "down"] symbols: list of allowed values (case sensitive) | 3.701057 | 4 |
events_page/app.py | los-verdes/lv-event-pagenerator | 0 | 927 | #!/usr/bin/env python
from zoneinfo import ZoneInfo
import flask
from dateutil.parser import parse
from flask_assets import Bundle, Environment
from logzero import logger, setup_logger
from webassets.filter import get_filter
from config import cfg
from apis import calendar as gcal
setup_logger(name=__name__)
app =... | #!/usr/bin/env python
from zoneinfo import ZoneInfo
import flask
from dateutil.parser import parse
from flask_assets import Bundle, Environment
from logzero import logger, setup_logger
from webassets.filter import get_filter
from config import cfg
from apis import calendar as gcal
setup_logger(name=__name__)
app =... | en | 0.364226 | #!/usr/bin/env python # create an Environment instance # define nested Bundle Convert a string to all caps. # noqa # TODO: do this default settings thing better? | 2.376106 | 2 |
bin/focus_scan.py | desihub/desicmx | 3 | 928 | <gh_stars>1-10
#!/usr/bin/env python
import astropy.io.fits as fits
import numpy as np
import os
import matplotlib.pyplot as plt
import argparse
def _fname(expid, night,
basedir='/n/home/datasystems/users/ameisner/reduced/focus',
ccds=False):
fname = basedir + '/' + night + '/' + st... | #!/usr/bin/env python
import astropy.io.fits as fits
import numpy as np
import os
import matplotlib.pyplot as plt
import argparse
def _fname(expid, night,
basedir='/n/home/datasystems/users/ameisner/reduced/focus',
ccds=False):
fname = basedir + '/' + night + '/' + str(expid).zfill(... | en | 0.799121 | #!/usr/bin/env python # try to handle case where observer accidentally lists the 'setup focus scan' # 1 second exposure as the start of the focus scan # PSF stamps plot #plt.cla() | 2.318761 | 2 |
proto_3/ddq/topics/logics/topic.py | jadnohra/connect | 0 | 929 | from typing import List
from ddq.taxonomy.reference import Reference
from ddq.topics.topic import Topic
class Logic(Topic):
def references(self) -> List[Reference]:
return [
Reference("Classical and Nonclassical Logics",
[("Eric", "Schechter")])
]
| from typing import List
from ddq.taxonomy.reference import Reference
from ddq.topics.topic import Topic
class Logic(Topic):
def references(self) -> List[Reference]:
return [
Reference("Classical and Nonclassical Logics",
[("Eric", "Schechter")])
]
| none | 1 | 2.433887 | 2 | |
pythia/utils/logger.py | abhiskk/pythia | 2 | 930 | # Copyright (c) Facebook, Inc. and its affiliates.
import base64
import logging
import os
import sys
from tensorboardX import SummaryWriter
from pythia.utils.distributed_utils import is_main_process
from pythia.utils.general import (ckpt_name_from_core_args,
foldername_from_config_ov... | # Copyright (c) Facebook, Inc. and its affiliates.
import base64
import logging
import os
import sys
from tensorboardX import SummaryWriter
from pythia.utils.distributed_utils import is_main_process
from pythia.utils.general import (ckpt_name_from_core_args,
foldername_from_config_ov... | en | 0.772344 | # Copyright (c) Facebook, Inc. and its affiliates. # Set level # Add handler to file # Add handler to stdout # Single log wrapper map # if it should not log then just print it | 1.796316 | 2 |
sdk/python/pulumi_google_native/healthcare/v1beta1/user_data_mapping.py | AaronFriel/pulumi-google-native | 44 | 931 | <reponame>AaronFriel/pulumi-google-native
# coding=utf-8
# *** WARNING: this file was generated by the Pulumi SDK Generator. ***
# *** Do not edit by hand unless you're certain you know what you are doing! ***
import warnings
import pulumi
import pulumi.runtime
from typing import Any, Mapping, Optional, Sequence, Unio... | # coding=utf-8
# *** WARNING: this file was generated by the Pulumi SDK Generator. ***
# *** Do not edit by hand unless you're certain you know what you are doing! ***
import warnings
import pulumi
import pulumi.runtime
from typing import Any, Mapping, Optional, Sequence, Union, overload
from ... import _utilities
fro... | en | 0.689282 | # coding=utf-8 # *** WARNING: this file was generated by the Pulumi SDK Generator. *** # *** Do not edit by hand unless you're certain you know what you are doing! *** The set of arguments for constructing a UserDataMapping resource. :param pulumi.Input[str] data_id: A unique identifier for the mapped resource.... | 2.126436 | 2 |
_doc/sphinxdoc/source/conf.py | Jerome-maker/ensae_teaching_cs | 0 | 932 | import sys
import os
import sphinx_rtd_theme
source_path = os.path.normpath(
os.path.join(
os.path.abspath(
os.path.split(__file__)[0])))
try:
from conf_base import *
except ImportError:
sys.path.append(source_path)
from conf_base import *
html_theme = 'sphinx_rtd_theme'
html_the... | import sys
import os
import sphinx_rtd_theme
source_path = os.path.normpath(
os.path.join(
os.path.abspath(
os.path.split(__file__)[0])))
try:
from conf_base import *
except ImportError:
sys.path.append(source_path)
from conf_base import *
html_theme = 'sphinx_rtd_theme'
html_the... | none | 1 | 1.961637 | 2 | |
dolfyn/adv/api.py | lkilcher/dolfyn-light | 0 | 933 | <filename>dolfyn/adv/api.py
"""
This module contains routines for reading and working with adv
data. It contains:
+-----------------------------------+-----------------------------------------+
| Name | Description |
+===================================+========... | <filename>dolfyn/adv/api.py
"""
This module contains routines for reading and working with adv
data. It contains:
+-----------------------------------+-----------------------------------------+
| Name | Description |
+===================================+========... | en | 0.429094 | This module contains routines for reading and working with adv data. It contains: +-----------------------------------+-----------------------------------------+ | Name | Description | +===================================+========================================... | 2.254225 | 2 |
server/api/migrations/0002_auto_20201011_1053.py | ShahriarDhruvo/WebTech_Assignment2 | 0 | 934 | # Generated by Django 3.1.2 on 2020-10-11 10:53
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('api', '0001_initial'),
]
operations = [
migrations.AlterField(
model_name='task',
name='author',
field=m... | # Generated by Django 3.1.2 on 2020-10-11 10:53
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('api', '0001_initial'),
]
operations = [
migrations.AlterField(
model_name='task',
name='author',
field=m... | en | 0.782508 | # Generated by Django 3.1.2 on 2020-10-11 10:53 | 1.530067 | 2 |
flink-ai-flow/lib/notification_service/notification_service/mongo_event_storage.py | lisy09/flink-ai-extended | 1 | 935 | #
# Licensed to the Apache Software Foundation (ASF) under one
# or more contributor license agreements. See the NOTICE file
# distributed with this work for additional information
# regarding copyright ownership. The ASF licenses this file
# to you under the Apache License, Version 2.0 (the
# "License"); you may not... | #
# Licensed to the Apache Software Foundation (ASF) under one
# or more contributor license agreements. See the NOTICE file
# distributed with this work for additional information
# regarding copyright ownership. The ASF licenses this file
# to you under the Apache License, Version 2.0 (the
# "License"); you may not... | en | 0.86503 | # # Licensed to the Apache Software Foundation (ASF) under one # or more contributor license agreements. See the NOTICE file # distributed with this work for additional information # regarding copyright ownership. The ASF licenses this file # to you under the Apache License, Version 2.0 (the # "License"); you may not... | 2.013186 | 2 |
src/unicon/plugins/confd/csp/__init__.py | tahigash/unicon.plugins | 1 | 936 | __author__ = "<NAME> <<EMAIL>>"
from unicon.plugins.confd import ConfdServiceList, ConfdConnection, ConfdConnectionProvider
from .statemachine import CspStateMachine
from .settings import CspSettings
from . import service_implementation as csp_svc
class CspServiceList(ConfdServiceList):
def __init__(self):
... | __author__ = "<NAME> <<EMAIL>>"
from unicon.plugins.confd import ConfdServiceList, ConfdConnection, ConfdConnectionProvider
from .statemachine import CspStateMachine
from .settings import CspSettings
from . import service_implementation as csp_svc
class CspServiceList(ConfdServiceList):
def __init__(self):
... | none | 1 | 1.793611 | 2 | |
setup.py | rrwen/search_google | 15 | 937 | # -*- coding: utf-8 -*-
from setuptools import setup
import search_google as package
def readme():
with open('README.rst') as f:
return ''.join(f.readlines()[11:])
setup(
name=package.__name__,
version=package.__version__,
description=package.__description__,
long_description=readme(),
author=pack... | # -*- coding: utf-8 -*-
from setuptools import setup
import search_google as package
def readme():
with open('README.rst') as f:
return ''.join(f.readlines()[11:])
setup(
name=package.__name__,
version=package.__version__,
description=package.__description__,
long_description=readme(),
author=pack... | en | 0.769321 | # -*- coding: utf-8 -*- | 1.261187 | 1 |
setup.py | chearon/macpack | 24 | 938 | <filename>setup.py
import setuptools
import os
try:
import pypandoc
description = pypandoc.convert('README.md', 'rst') if os.path.exists('README.md') else ''
except ImportError:
description = ''
setuptools.setup(
name = 'macpack',
packages = setuptools.find_packages(),
version = '1.0.3',
description = '... | <filename>setup.py
import setuptools
import os
try:
import pypandoc
description = pypandoc.convert('README.md', 'rst') if os.path.exists('README.md') else ''
except ImportError:
description = ''
setuptools.setup(
name = 'macpack',
packages = setuptools.find_packages(),
version = '1.0.3',
description = '... | none | 1 | 1.785397 | 2 | |
WEEK2/day5/scripts/06_NB_Challenges_Isolines.py | tizon9804/SS2017 | 0 | 939 | import vtk
# Read the file (to test that it was written correctly)
reader = vtk.vtkXMLImageDataReader()
reader.SetFileName("../data/wind_image.vti")
reader.Update()
print(reader.GetOutput())
# Convert the image to a polydata
imageDataGeometryFilter = vtk.vtkImageDataGeometryFilter()
imageDataGeometryFilter.SetInputCon... | import vtk
# Read the file (to test that it was written correctly)
reader = vtk.vtkXMLImageDataReader()
reader.SetFileName("../data/wind_image.vti")
reader.Update()
print(reader.GetOutput())
# Convert the image to a polydata
imageDataGeometryFilter = vtk.vtkImageDataGeometryFilter()
imageDataGeometryFilter.SetInputCon... | en | 0.958404 | # Read the file (to test that it was written correctly) # Convert the image to a polydata # Setup rendering | 2.418173 | 2 |
mbbl_envs/mbbl/env/gym_env/invertedPendulum.py | hbutsuak95/iv_rl | 9 | 940 | <reponame>hbutsuak95/iv_rl
"""
# -----------------------------------------------------------------------------
# @brief:
# Tingwu: reset the reward function so that it's more similar to the one
# defined in GYM
# -----------------------------------------------------------------------------
"""
import nump... | """
# -----------------------------------------------------------------------------
# @brief:
# Tingwu: reset the reward function so that it's more similar to the one
# defined in GYM
# -----------------------------------------------------------------------------
"""
import numpy as np
from mbbl.config i... | en | 0.511082 | # ----------------------------------------------------------------------------- # @brief: # Tingwu: reset the reward function so that it's more similar to the one # defined in GYM # ----------------------------------------------------------------------------- # acrobot has applied sin/cos obs # return the... | 2.74436 | 3 |
ACME/visdom/__init__.py | mauriziokovacic/ACME | 3 | 941 | from .bar import *
from .create_session import *
from .image import *
from .line import *
from .mesh import *
from .pie import *
from .text import *
from .VisdomFigure import *
from .VisdomScene import *
| from .bar import *
from .create_session import *
from .image import *
from .line import *
from .mesh import *
from .pie import *
from .text import *
from .VisdomFigure import *
from .VisdomScene import *
| none | 1 | 1.092026 | 1 | |
web/pingpongpiweb.py | andrewdyersmith/pingpongpi | 0 | 942 | <gh_stars>0
# Ping Pong Pi web UI running on flask.
# Uses zmq to speak to daemon controlling screen.
from flask import Flask, render_template, appcontext_tearing_down, request
from multiprocessing import Process, Queue
from multiprocessing.connection import Client
import atexit
import time
import zmq
app = Flask(__n... | # Ping Pong Pi web UI running on flask.
# Uses zmq to speak to daemon controlling screen.
from flask import Flask, render_template, appcontext_tearing_down, request
from multiprocessing import Process, Queue
from multiprocessing.connection import Client
import atexit
import time
import zmq
app = Flask(__name__)
@ap... | en | 0.758816 | # Ping Pong Pi web UI running on flask. # Uses zmq to speak to daemon controlling screen. | 2.675459 | 3 |
watcher/tests/decision_engine/strategy/strategies/test_base.py | ajaytikoo/watcher | 64 | 943 | # -*- encoding: utf-8 -*-
# Copyright (c) 2019 European Organization for Nuclear Research (CERN)
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0... | # -*- encoding: utf-8 -*-
# Copyright (c) 2019 European Organization for Nuclear Research (CERN)
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0... | en | 0.790414 | # -*- encoding: utf-8 -*- # Copyright (c) 2019 European Organization for Nuclear Research (CERN) # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0... | 1.713755 | 2 |
main.py | BenG49/sudoku | 0 | 944 | <filename>main.py
from sudoku import Sudoku
def main():
s = Sudoku.parse(
'''
-------------
| |2 | |
| | 6 |4 3|
| | 5| 7 |
-------------
| 7 | 2|8 |
|51 | 4|9 |
| 9| 3| |
-------------
| | 9| |
| 2| | 98|
| 83|1 |2 |
-------------
'''
)
print(s)
print(s.s... | <filename>main.py
from sudoku import Sudoku
def main():
s = Sudoku.parse(
'''
-------------
| |2 | |
| | 6 |4 3|
| | 5| 7 |
-------------
| 7 | 2|8 |
|51 | 4|9 |
| 9| 3| |
-------------
| | 9| |
| 2| | 98|
| 83|1 |2 |
-------------
'''
)
print(s)
print(s.s... | en | 0.169669 | ------------- | |2 | | | | 6 |4 3| | | 5| 7 | ------------- | 7 | 2|8 | |51 | 4|9 | | 9| 3| | ------------- | | 9| | | 2| | 98| | 83|1 |2 | ------------- | 2.989713 | 3 |
test/test_sampler.py | pfnet-research/autogbt-alt | 83 | 945 | <filename>test/test_sampler.py<gh_stars>10-100
import numpy as np
import pandas as pd
from autogbt.sampler import MajorityUnderSampler
def _test_sample(y):
sampler = MajorityUnderSampler()
idx = sampler.sample(y, 40000, 3.0)
assert len(idx) == 40000
assert y[idx].sum() == 10000
def test_sample_with_... | <filename>test/test_sampler.py<gh_stars>10-100
import numpy as np
import pandas as pd
from autogbt.sampler import MajorityUnderSampler
def _test_sample(y):
sampler = MajorityUnderSampler()
idx = sampler.sample(y, 40000, 3.0)
assert len(idx) == 40000
assert y[idx].sum() == 10000
def test_sample_with_... | none | 1 | 2.556716 | 3 | |
experiment/diabetes/accuracy_info.py | leandro-santiago/bloomwisard | 2 | 946 | import numpy as np
import sys
from timeit import default_timer as timer
sys.path.append("../../")
from core import wnn
from encoding import thermometer
from encoding import util
#Load Diabetes data
base_path = "../../dataset/diabetes/"
#2/3 Test
bits_encoding = 20
train_data, train_label, test_data, test_label, data... | import numpy as np
import sys
from timeit import default_timer as timer
sys.path.append("../../")
from core import wnn
from encoding import thermometer
from encoding import util
#Load Diabetes data
base_path = "../../dataset/diabetes/"
#2/3 Test
bits_encoding = 20
train_data, train_label, test_data, test_label, data... | en | 0.296916 | #Load Diabetes data #2/3 Test #print test_label #Wisard #print entry_size #Bloom Wisard #capacity = len(train_bin) | 2.200902 | 2 |
PyGame/pygame1/tutorial1/startercode.py | hoppfull/Legacy-Python | 0 | 947 | <reponame>hoppfull/Legacy-Python
from pygamehelper import *
from pygame import *
from pygame.locals import *
from vec2d import *
from random import uniform
import numpy as np
class Starter(PygameHelper):
def __init__(self):
self.w, self.h = 800, 600
PygameHelper.__init__(self, size=(self.w, self.h... | from pygamehelper import *
from pygame import *
from pygame.locals import *
from vec2d import *
from random import uniform
import numpy as np
class Starter(PygameHelper):
def __init__(self):
self.w, self.h = 800, 600
PygameHelper.__init__(self, size=(self.w, self.h), fill=((0,0,0)))
d... | none | 1 | 2.738821 | 3 | |
main.py | thewhiteninja/twitch-recorder | 0 | 948 | import glob
import os
import sys
import utils
from recorder import StreamRec
OUTDIR = ""
def parse_args(a):
global OUTDIR
i = 1
while i < len(a):
if a[i] in ["-h", "--help", "/?"]:
usage()
if a[i] in ["-d", "--dir"]:
OUTDIR = a[i + 1]
i += 1
i ... | import glob
import os
import sys
import utils
from recorder import StreamRec
OUTDIR = ""
def parse_args(a):
global OUTDIR
i = 1
while i < len(a):
if a[i] in ["-h", "--help", "/?"]:
usage()
if a[i] in ["-d", "--dir"]:
OUTDIR = a[i + 1]
i += 1
i ... | none | 1 | 2.919413 | 3 | |
karbor-1.3.0/karbor/policies/protectables.py | scottwedge/OpenStack-Stein | 0 | 949 | # Copyright (c) 2017 Huawei Technologies Co., Ltd.
# 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
#
# ... | # Copyright (c) 2017 Huawei Technologies Co., Ltd.
# 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
#
# ... | en | 0.846161 | # Copyright (c) 2017 Huawei Technologies Co., Ltd. # 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 # # ... | 1.76178 | 2 |
router.example.py | unyo/uhpackage | 0 | 950 | #!/usr/bin/python
# -*- coding: utf-8 -*-
# routers are dictionaries of URL routing parameters.
#
# For each request, the effective router is:
# the built-in default base router (shown below),
# updated by the BASE router in routes.py routers,
# updated by the app-specific router in routes.py routers (if an... | #!/usr/bin/python
# -*- coding: utf-8 -*-
# routers are dictionaries of URL routing parameters.
#
# For each request, the effective router is:
# the built-in default base router (shown below),
# updated by the BASE router in routes.py routers,
# updated by the app-specific router in routes.py routers (if an... | en | 0.652683 | #!/usr/bin/python # -*- coding: utf-8 -*- # routers are dictionaries of URL routing parameters. # # For each request, the effective router is: # the built-in default base router (shown below), # updated by the BASE router in routes.py routers, # updated by the app-specific router in routes.py routers (if any... | 2.359324 | 2 |
notebooks/2018.11.09 Meeting.py | costrouc/uarray | 0 | 951 | <reponame>costrouc/uarray
#%%
from uarray.core import *
#%%
s = Scalar(Int(10))
#%%
@operation
def Always(a: T) -> CCallableUnary[T, CContent]:
...
#%%
register(Call(Always(w("a")), w("idx")), lambda a, idx: a)
#%%
a_ten = Always(s)
#%%
s = Sequence(Int(10), a_ten)
| #%%
from uarray.core import *
#%%
s = Scalar(Int(10))
#%%
@operation
def Always(a: T) -> CCallableUnary[T, CContent]:
...
#%%
register(Call(Always(w("a")), w("idx")), lambda a, idx: a)
#%%
a_ten = Always(s)
#%%
s = Sequence(Int(10), a_ten) | ja | 0.403458 | #%% #%% #%% #%% #%% #%% | 2.178592 | 2 |
var/spack/repos/builtin/packages/py-black/package.py | dwstreetNNL/spack | 0 | 952 | # Copyright 2013-2020 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 PyBlack(PythonPackage):
"""Black is the uncompromising Python code formatter. By using it,... | # Copyright 2013-2020 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 PyBlack(PythonPackage):
"""Black is the uncompromising Python code formatter. By using it,... | en | 0.805535 | # Copyright 2013-2020 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) Black is the uncompromising Python code formatter. By using it, you agree to cede control over minutiae of hand-formatt... | 1.793278 | 2 |
store/adminshop/templatetags/admin_extras.py | vallemrv/my_store_test | 0 | 953 | <filename>store/adminshop/templatetags/admin_extras.py
# -*- coding: utf-8 -*-
# @Author: <NAME> <valle>
# @Date: 27-Aug-2017
# @Email: <EMAIL>
# @Filename: admin_extras.py
# @Last modified by: valle
# @Last modified time: 02-Feb-2018
# @License: Apache license vesion 2.0
from django import template
from django.... | <filename>store/adminshop/templatetags/admin_extras.py
# -*- coding: utf-8 -*-
# @Author: <NAME> <valle>
# @Date: 27-Aug-2017
# @Email: <EMAIL>
# @Filename: admin_extras.py
# @Last modified by: valle
# @Last modified time: 02-Feb-2018
# @License: Apache license vesion 2.0
from django import template
from django.... | en | 0.455292 | # -*- coding: utf-8 -*- # @Author: <NAME> <valle> # @Date: 27-Aug-2017 # @Email: <EMAIL> # @Filename: admin_extras.py # @Last modified by: valle # @Last modified time: 02-Feb-2018 # @License: Apache license vesion 2.0 | 1.935158 | 2 |
doc/tutorial/using_gpu_solution_1.py | abdalazizrashid/Theano-PyMC | 0 | 954 | <gh_stars>0
#!/usr/bin/env python
# Aesara tutorial
# Solution to Exercise in section 'Using the GPU'
# 1. Raw results
import numpy as np
import aesara
import aesara.tensor as tt
aesara.config.floatX = "float32"
rng = np.random
N = 400
feats = 784
D = (
rng.randn(N, feats).astype(aesara.config.floatX),
... | #!/usr/bin/env python
# Aesara tutorial
# Solution to Exercise in section 'Using the GPU'
# 1. Raw results
import numpy as np
import aesara
import aesara.tensor as tt
aesara.config.floatX = "float32"
rng = np.random
N = 400
feats = 784
D = (
rng.randn(N, feats).astype(aesara.config.floatX),
rng.randint... | en | 0.409318 | #!/usr/bin/env python # Aesara tutorial # Solution to Exercise in section 'Using the GPU' # 1. Raw results # Declare Aesara symbolic variables # print "Initial model:" # print w.get_value(), b.get_value() # Construct Aesara expression graph # Probability of having a one # The prediction that is done: 0 or 1 # Cross-ent... | 2.609801 | 3 |
chainercv/transforms/bbox/translate_bbox.py | souravsingh/chainercv | 1 | 955 | def translate_bbox(bbox, y_offset=0, x_offset=0):
"""Translate bounding boxes.
This method is mainly used together with image transforms, such as padding
and cropping, which translates the left top point of the image from
coordinate :math:`(0, 0)` to coordinate
:math:`(y, x) = (y_{offset}, x_{offse... | def translate_bbox(bbox, y_offset=0, x_offset=0):
"""Translate bounding boxes.
This method is mainly used together with image transforms, such as padding
and cropping, which translates the left top point of the image from
coordinate :math:`(0, 0)` to coordinate
:math:`(y, x) = (y_{offset}, x_{offse... | en | 0.790243 | Translate bounding boxes. This method is mainly used together with image transforms, such as padding and cropping, which translates the left top point of the image from coordinate :math:`(0, 0)` to coordinate :math:`(y, x) = (y_{offset}, x_{offset})`. The bounding boxes are expected to be packed i... | 3.667295 | 4 |
behave/features/environment.py | ministryofjustice/cla-end-to-end-tests | 1 | 956 | <gh_stars>1-10
import os
from configparser import ConfigParser
from helper.helper_web import get_browser
def before_all(context):
config = ConfigParser()
print((os.path.join(os.getcwd(), 'setup.cfg')))
my_file = (os.path.join(os.getcwd(), 'setup.cfg'))
config.read(my_file)
# Reading the browser ... | import os
from configparser import ConfigParser
from helper.helper_web import get_browser
def before_all(context):
config = ConfigParser()
print((os.path.join(os.getcwd(), 'setup.cfg')))
my_file = (os.path.join(os.getcwd(), 'setup.cfg'))
config.read(my_file)
# Reading the browser type from the c... | en | 0.741767 | # Reading the browser type from the configuration file | 2.466176 | 2 |
recipe_organizer/gui/recipe_list/recipe_source.py | j-sommer/recipe-organizer | 0 | 957 | <filename>recipe_organizer/gui/recipe_list/recipe_source.py
from pathlib import Path
from tkinter import Frame, Label
from recipe_organizer.events.event import Event, EventType
from recipe_organizer.events.event_observer import EventObserver
from recipe_organizer.events.event_publisher import EventPublisher
from recip... | <filename>recipe_organizer/gui/recipe_list/recipe_source.py
from pathlib import Path
from tkinter import Frame, Label
from recipe_organizer.events.event import Event, EventType
from recipe_organizer.events.event_observer import EventObserver
from recipe_organizer.events.event_publisher import EventPublisher
from recip... | none | 1 | 2.384023 | 2 | |
var/spack/repos/builtin/packages/spot/package.py | xiki-tempula/spack | 1 | 958 | <filename>var/spack/repos/builtin/packages/spot/package.py
# Copyright 2013-2020 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 Spot(AutotoolsPackage):
"""Spot... | <filename>var/spack/repos/builtin/packages/spot/package.py
# Copyright 2013-2020 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 Spot(AutotoolsPackage):
"""Spot... | en | 0.715451 | # Copyright 2013-2020 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) Spot is a C++11 library for omega-automata manipulation and model checking. | 1.268615 | 1 |
0.py | itspuneet/itspuneet | 0 | 959 | <reponame>itspuneet/itspuneet
k=0
while k!=1:
print(k)
k+=1
| k=0
while k!=1:
print(k)
k+=1 | none | 1 | 3.010861 | 3 | |
jss_figures_replication_script.py | Cole-vJ/AdvEMDpy | 0 | 960 |
# ________
# /
# \ /
# \ /
# \/
import random
import textwrap
import emd_mean
import AdvEMDpy
import emd_basis
import emd_utils
import numpy as np
import pandas as pd
import cvxpy as cvx
import seaborn as sns
import matplotlib.pyplot as plt
from scipy.integrate import odeint
from ... |
# ________
# /
# \ /
# \ /
# \/
import random
import textwrap
import emd_mean
import AdvEMDpy
import emd_basis
import emd_utils
import numpy as np
import pandas as pd
import cvxpy as cvx
import seaborn as sns
import matplotlib.pyplot as plt
from scipy.integrate import odeint
from ... | en | 0.792078 | # ________ # / # \ / # \ / # \/ # alternate packages # plot 0 - addition # plot 1 # plot 1a - addition # plot 1b - addition # plot 1c - addition # plot 1d - addition # plot 1e - addition # plot 2 # plot 3 # plot 4 # slightly edit signal to make difference between slope-based method ... | 2.00592 | 2 |
GPT-distributed.py | wenhuchen/LogicNLG | 141 | 961 | <filename>GPT-distributed.py<gh_stars>100-1000
import argparse
import logging
import torch
import torch.nn.functional as F
import numpy as np
from torch import nn
from torch.autograd import Variable
from transformers import GPT2Config
from transformers import GPT2LMHeadModel, GPT2Tokenizer, BertTokenizer
from DataLoade... | <filename>GPT-distributed.py<gh_stars>100-1000
import argparse
import logging
import torch
import torch.nn.functional as F
import numpy as np
from torch import nn
from torch.autograd import Variable
from transformers import GPT2Config
from transformers import GPT2LMHeadModel, GPT2Tokenizer, BertTokenizer
from DataLoade... | en | 0.392359 | #model = nn.DataParallel(model) #for idx in range(0, dataset.train_len()): #samples = model.sample(fake_inputs, tabfeat, caption, highlight_idx, bert) | 2.395335 | 2 |
bentoml/saved_bundle/loader.py | niits/BentoML | 3,451 | 962 | <gh_stars>1000+
# Copyright 2019 Atalaya Tech, Inc.
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
# http://www.apache.org/licenses/LICENSE-2.0
# Unless required by applicable law or agreed... | # Copyright 2019 Atalaya Tech, Inc.
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
# http://www.apache.org/licenses/LICENSE-2.0
# Unless required by applicable law or agreed to in writing, ... | en | 0.755761 | # Copyright 2019 Atalaya Tech, Inc. # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # http://www.apache.org/licenses/LICENSE-2.0 # Unless required by applicable law or agreed to in writing, sof... | 1.767424 | 2 |
migrations/versions/0158_remove_rate_limit_default.py | cds-snc/notifier-api | 41 | 963 | """
Revision ID: 0158_remove_rate_limit_default
Revises: 0157_add_rate_limit_to_service
Create Date: 2018-01-09 14:33:08.313893
"""
import sqlalchemy as sa
from alembic import op
revision = "0158_remove_rate_limit_default"
down_revision = "0157_add_rate_limit_to_service"
def upgrade():
op.execute("ALTER TABLE ... | """
Revision ID: 0158_remove_rate_limit_default
Revises: 0157_add_rate_limit_to_service
Create Date: 2018-01-09 14:33:08.313893
"""
import sqlalchemy as sa
from alembic import op
revision = "0158_remove_rate_limit_default"
down_revision = "0157_add_rate_limit_to_service"
def upgrade():
op.execute("ALTER TABLE ... | en | 0.114436 | Revision ID: 0158_remove_rate_limit_default Revises: 0157_add_rate_limit_to_service Create Date: 2018-01-09 14:33:08.313893 | 1.466566 | 1 |
gen-post.py | younghk/younghk.netlify.com | 0 | 964 | <gh_stars>0
import os
import errno
from datetime import datetime
print("Generating A New Post\n")
post_name = input('Input Post Name: ')
date_time = datetime.now()
date_time_dir = date_time.strftime("%Y-%m-%d")
date_time_post = date_time.strftime("%Y-%m-%d %H:%M:%S")
p_name = post_name.replace(" ","-")
p_name = p_n... | import os
import errno
from datetime import datetime
print("Generating A New Post\n")
post_name = input('Input Post Name: ')
date_time = datetime.now()
date_time_dir = date_time.strftime("%Y-%m-%d")
date_time_post = date_time.strftime("%Y-%m-%d %H:%M:%S")
p_name = post_name.replace(" ","-")
p_name = p_name.replace(... | none | 1 | 3.196033 | 3 | |
rmgpy/reactionTest.py | Lyle-zhang/RMG-Py | 0 | 965 | #!/usr/bin/env python
# encoding: utf-8 -*-
"""
This module contains unit tests of the rmgpy.reaction module.
"""
import numpy
import unittest
from external.wip import work_in_progress
from rmgpy.species import Species, TransitionState
from rmgpy.reaction import Reaction
from rmgpy.statmech.translation import Transl... | #!/usr/bin/env python
# encoding: utf-8 -*-
"""
This module contains unit tests of the rmgpy.reaction module.
"""
import numpy
import unittest
from external.wip import work_in_progress
from rmgpy.species import Species, TransitionState
from rmgpy.reaction import Reaction
from rmgpy.statmech.translation import Transl... | en | 0.691401 | #!/usr/bin/env python # encoding: utf-8 -*- This module contains unit tests of the rmgpy.reaction module. ################################################################################ Can be used in place of a :class:`rmg.species.Species` for isomorphism checks. PseudoSpecies('a') is isomorphic with PseudoS... | 2.328835 | 2 |
backend/core/api_urls.py | albeiks/omaralbeik.com | 10 | 966 | <filename>backend/core/api_urls.py
from django.conf.urls import url, include
from core.routers import OptionalTrailingSlashRouter
from blog import views as blogViews
from snippets import views as snippetsViews
from projects import views as projectsViews
from tags import views as tagsViews
from contents import views as... | <filename>backend/core/api_urls.py
from django.conf.urls import url, include
from core.routers import OptionalTrailingSlashRouter
from blog import views as blogViews
from snippets import views as snippetsViews
from projects import views as projectsViews
from tags import views as tagsViews
from contents import views as... | en | 0.528112 | # List or url patterns for the api subdomain | 2.074326 | 2 |
python/video_ADG.py | alexberndt/mobile-AGV-optimization | 2 | 967 | """
closed-loop MILP solved to determine optimal ordering defined by ADG
"""
import sys
import yaml
import time
import matplotlib.colors as mcolors
import matplotlib
import matplotlib.pyplot as plt
import random
import logging
import time
import networkx as nx
import csv
import statistics as stat
import os
import ... | """
closed-loop MILP solved to determine optimal ordering defined by ADG
"""
import sys
import yaml
import time
import matplotlib.colors as mcolors
import matplotlib
import matplotlib.pyplot as plt
import random
import logging
import time
import networkx as nx
import csv
import statistics as stat
import os
import ... | en | 0.519381 | closed-loop MILP solved to determine optimal ordering defined by ADG --------------------------- INPUTS --------------------------------- #not show_visual #False #True # define prediction and control horizons: H_prediction >= H_control # integer value for forward node lookup # sub-optimality bound: w = 1.0 -> CBS, else... | 2.24942 | 2 |
tests/model/test_guest.py | bcurnow/rfid-security-svc | 0 | 968 | <reponame>bcurnow/rfid-security-svc
import pytest
from unittest.mock import patch
import rfidsecuritysvc.model.guest as model
from rfidsecuritysvc.model.color import Color
from rfidsecuritysvc.model.guest import Guest
from rfidsecuritysvc.model.sound import Sound
from rfidsecuritysvc.exception import SoundNotFoundErro... | import pytest
from unittest.mock import patch
import rfidsecuritysvc.model.guest as model
from rfidsecuritysvc.model.color import Color
from rfidsecuritysvc.model.guest import Guest
from rfidsecuritysvc.model.sound import Sound
from rfidsecuritysvc.exception import SoundNotFoundError
def test_Guest(assert_model, def... | none | 1 | 2.456042 | 2 | |
ice/consoles.py | reavessm/Ice | 578 | 969 | <reponame>reavessm/Ice<gh_stars>100-1000
# encoding: utf-8
import os
import roms
def console_roms_directory(configuration, console):
"""
If the user has specified a custom ROMs directory in consoles.txt then
return that.
Otherwise, append the shortname of the console to the default ROMs
directory given by... | # encoding: utf-8
import os
import roms
def console_roms_directory(configuration, console):
"""
If the user has specified a custom ROMs directory in consoles.txt then
return that.
Otherwise, append the shortname of the console to the default ROMs
directory given by config.txt.
"""
if console.custom_ro... | en | 0.760422 | # encoding: utf-8 If the user has specified a custom ROMs directory in consoles.txt then return that. Otherwise, append the shortname of the console to the default ROMs directory given by config.txt. This function determines if a given path is actually a valid ROM file. If a list of extensions is supplied for ... | 3.705689 | 4 |
clue/c3.py | dumpmemory/roformer-v2 | 44 | 970 | <filename>clue/c3.py
#! -*- coding:utf-8 -*-
# CLUE评测
# c3多项选择阅读理解
# 思路:每个选项分别与问题、篇章拼接后打分排序
import json
import numpy as np
from snippets import *
from bert4keras.backend import keras
from bert4keras.snippets import sequence_padding, DataGenerator
from bert4keras.snippets import open
from bert4keras.snippets import tru... | <filename>clue/c3.py
#! -*- coding:utf-8 -*-
# CLUE评测
# c3多项选择阅读理解
# 思路:每个选项分别与问题、篇章拼接后打分排序
import json
import numpy as np
from snippets import *
from bert4keras.backend import keras
from bert4keras.snippets import sequence_padding, DataGenerator
from bert4keras.snippets import open
from bert4keras.snippets import tru... | zh | 0.973823 | #! -*- coding:utf-8 -*- # CLUE评测 # c3多项选择阅读理解 # 思路:每个选项分别与问题、篇章拼接后打分排序 # 基本参数 加载数据 格式:[(篇章, 问题, 选项, 答案id)] # 加载数据集 数据生成器 # 转换数据集 多项选择的交叉熵 多项选择的准确率 # 构建模型 保存验证集acc最好的模型 输出测试结果到文件 结果文件可以提交到 https://www.cluebenchmarks.com 评测。 | 2.654707 | 3 |
tools/perf/contrib/oop_raster/oop_raster.py | zipated/src | 2,151 | 971 | <filename>tools/perf/contrib/oop_raster/oop_raster.py
# Copyright 2018 The Chromium Authors. All rights reserved.
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
from benchmarks import smoothness,thread_times
import page_sets
from telemetry import benchmark
# pylin... | <filename>tools/perf/contrib/oop_raster/oop_raster.py
# Copyright 2018 The Chromium Authors. All rights reserved.
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
from benchmarks import smoothness,thread_times
import page_sets
from telemetry import benchmark
# pylin... | en | 0.823626 | # Copyright 2018 The Chromium Authors. All rights reserved. # Use of this source code is governed by a BSD-style license that can be # found in the LICENSE file. # pylint: disable=protected-access Enables flags needed for out of process rasterization. Measures rendering statistics for the top 25 with oop rasterization.... | 1.993237 | 2 |
logpy/util.py | mrocklin/logpy | 1 | 972 | <reponame>mrocklin/logpy<filename>logpy/util.py
import itertools as it
from toolz.compatibility import range, map, iteritems
def hashable(x):
try:
hash(x)
return True
except TypeError:
return False
def transitive_get(key, d):
""" Transitive dict.get
>>> from logpy.util import ... | import itertools as it
from toolz.compatibility import range, map, iteritems
def hashable(x):
try:
hash(x)
return True
except TypeError:
return False
def transitive_get(key, d):
""" Transitive dict.get
>>> from logpy.util import transitive_get
>>> d = {1: 2, 2: 3, 3: 4}
... | en | 0.67669 | Transitive dict.get >>> from logpy.util import transitive_get >>> d = {1: 2, 2: 3, 3: 4} >>> d.get(1) 2 >>> transitive_get(1, d) 4 Transitive get that propagates within tuples >>> from logpy.util import transitive_get, deep_transitive_get >>> d = {1: (2, 3), 2: 12, 3: 13} >>> trans... | 2.965068 | 3 |
index.py | rinocloud/rinobot-plugin-shift | 0 | 973 | import rinobot_plugin as bot
import numpy as np
def main():
# lets get our parameters and data
filepath = bot.filepath()
data = bot.loadfile(filepath)
# now comes the custom plugin logic
shift = bot.get_arg('shift', type=float, required=True)
index = bot.index_from_args(data)
data[index] =... | import rinobot_plugin as bot
import numpy as np
def main():
# lets get our parameters and data
filepath = bot.filepath()
data = bot.loadfile(filepath)
# now comes the custom plugin logic
shift = bot.get_arg('shift', type=float, required=True)
index = bot.index_from_args(data)
data[index] =... | en | 0.472577 | # lets get our parameters and data # now comes the custom plugin logic # then we set up the output | 2.329007 | 2 |
gluon/contrib/memcache/__init__.py | arsfeld/fog-web2py | 0 | 974 | from gluon.contrib.memcache.memcache import Client
import time
"""
examle of usage:
cache.memcache=MemcacheClient(request,[127.0.0.1:11211],debug=true)
"""
import cPickle as pickle
import thread
locker = thread.allocate_lock()
def MemcacheClient(*a, **b):
locker.acquire()
if not hasattr(MemcacheClient, '__... | from gluon.contrib.memcache.memcache import Client
import time
"""
examle of usage:
cache.memcache=MemcacheClient(request,[127.0.0.1:11211],debug=true)
"""
import cPickle as pickle
import thread
locker = thread.allocate_lock()
def MemcacheClient(*a, **b):
locker.acquire()
if not hasattr(MemcacheClient, '__... | en | 0.211089 | examle of usage: cache.memcache=MemcacheClient(request,[127.0.0.1:11211],debug=true) #key=self.__keyFormat__(key) | 2.665801 | 3 |
test_data/parse/unexpected/symbol_table/inheritance_from_non_class/meta_model.py | aas-core-works/aas-core-csharp-codegen | 0 | 975 | <filename>test_data/parse/unexpected/symbol_table/inheritance_from_non_class/meta_model.py
class Some_enum(Enum):
some_literal = "some_literal"
class Something(Some_enum):
pass
class Reference:
pass
__book_url__ = "dummy"
__book_version__ = "dummy"
associate_ref_with(Reference)
| <filename>test_data/parse/unexpected/symbol_table/inheritance_from_non_class/meta_model.py
class Some_enum(Enum):
some_literal = "some_literal"
class Something(Some_enum):
pass
class Reference:
pass
__book_url__ = "dummy"
__book_version__ = "dummy"
associate_ref_with(Reference)
| none | 1 | 2.063345 | 2 | |
deepcut/deepcut.py | wannaphong/deepcut | 17 | 976 | #!/usr/bin/env python
# encoding: utf-8
import numbers
import os
import re
import sys
from itertools import chain
import numpy as np
import scipy.sparse as sp
import six
import pickle
from .model import get_convo_nn2
from .stop_words import THAI_STOP_WORDS
from .utils import CHAR_TYPES_MAP, CHARS_MAP, create_feature_... | #!/usr/bin/env python
# encoding: utf-8
import numbers
import os
import re
import sys
from itertools import chain
import numpy as np
import scipy.sparse as sp
import six
import pickle
from .model import get_convo_nn2
from .stop_words import THAI_STOP_WORDS
from .utils import CHAR_TYPES_MAP, CHARS_MAP, create_feature_... | en | 0.64639 | #!/usr/bin/env python # encoding: utf-8 Tokenize given Thai text string Input ===== text: str, Thai text string custom_dict: str (or list), path to customized dictionary file It allows the function not to tokenize given dictionary wrongly. The file should contain custom words separated ... | 2.493782 | 2 |
spconv/utils/__init__.py | djiajunustc/spconv | 0 | 977 | # Copyright 2021 <NAME>
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, softw... | # Copyright 2021 <NAME>
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, softw... | en | 0.858355 | # Copyright 2021 <NAME> # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, softw... | 1.322848 | 1 |
build/android/gyp/lint.py | justremotephone/android_external_chromium_org | 2 | 978 | <gh_stars>1-10
#!/usr/bin/env python
#
# Copyright (c) 2013 The Chromium Authors. All rights reserved.
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
"""Runs Android's lint tool."""
import optparse
import os
import sys
from xml.dom import minidom
from util impo... | #!/usr/bin/env python
#
# Copyright (c) 2013 The Chromium Authors. All rights reserved.
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
"""Runs Android's lint tool."""
import optparse
import os
import sys
from xml.dom import minidom
from util import build_utils
... | en | 0.850269 | #!/usr/bin/env python # # Copyright (c) 2013 The Chromium Authors. All rights reserved. # Use of this source code is governed by a BSD-style license that can be # found in the LICENSE file. Runs Android's lint tool. Returns relative path to top-level src dir. Args: path: A path relative to cwd. # Issues in c... | 2.113664 | 2 |
clif/pybind11/generator.py | snu5mumr1k/clif | 0 | 979 | <filename>clif/pybind11/generator.py
# 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 app... | <filename>clif/pybind11/generator.py
# 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 app... | en | 0.764128 | # 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, ... | 2.12248 | 2 |
advent/model/discriminator.py | ChristopheGraveline064/ADVENT | 1 | 980 | from torch import nn
def get_fc_discriminator(num_classes, ndf=64):
return nn.Sequential(
nn.Conv2d(num_classes, ndf, kernel_size=4, stride=2, padding=1),
nn.LeakyReLU(negative_slope=0.2, inplace=True),
nn.Conv2d(ndf, ndf * 2, kernel_size=4, stride=2, padding=1),
nn.LeakyReLU(negat... | from torch import nn
def get_fc_discriminator(num_classes, ndf=64):
return nn.Sequential(
nn.Conv2d(num_classes, ndf, kernel_size=4, stride=2, padding=1),
nn.LeakyReLU(negative_slope=0.2, inplace=True),
nn.Conv2d(ndf, ndf * 2, kernel_size=4, stride=2, padding=1),
nn.LeakyReLU(negat... | en | 0.339705 | # def get_fe_discriminator(num_classes, ndf=64): # 256-128-64-32-16 # return nn.Sequential( # nn.Conv2d(num_classes, ndf * 4, kernel_size=4, stride=2, padding=1), # nn.LeakyReLU(negative_slope=0.2, inplace=True), # nn.Conv2d(ndf * 4, ndf * 2, kernel_size=4, stride=2, padding=1), # nn... | 2.492601 | 2 |
spyder/dependencies.py | aglotero/spyder | 2 | 981 | <reponame>aglotero/spyder
# -*- coding: utf-8 -*-
#
# Copyright © Spyder Project Contributors
# Licensed under the terms of the MIT License
# (see spyder/__init__.py for details)
"""Module checking Spyder runtime dependencies"""
import os
# Local imports
from spyder.utils import programs
class Depe... | # -*- coding: utf-8 -*-
#
# Copyright © Spyder Project Contributors
# Licensed under the terms of the MIT License
# (see spyder/__init__.py for details)
"""Module checking Spyder runtime dependencies"""
import os
# Local imports
from spyder.utils import programs
class Dependency(object):
"""Sp... | en | 0.654205 | # -*- coding: utf-8 -*- # # Copyright © Spyder Project Contributors # Licensed under the terms of the MIT License # (see spyder/__init__.py for details) Module checking Spyder runtime dependencies # Local imports Spyder's dependency
version may starts with =, >=, > or < to specify the exact requirement ;
mu... | 2.772022 | 3 |
setup.py | jasperhyp/Chemprop4SE | 1 | 982 | import os
from setuptools import find_packages, setup
# Load version number
__version__ = None
src_dir = os.path.abspath(os.path.dirname(__file__))
version_file = os.path.join(src_dir, 'chemprop', '_version.py')
with open(version_file, encoding='utf-8') as fd:
exec(fd.read())
# Load README
with ope... | import os
from setuptools import find_packages, setup
# Load version number
__version__ = None
src_dir = os.path.abspath(os.path.dirname(__file__))
version_file = os.path.join(src_dir, 'chemprop', '_version.py')
with open(version_file, encoding='utf-8') as fd:
exec(fd.read())
# Load README
with ope... | en | 0.282902 | # Load version number # Load README | 1.463866 | 1 |
mars/tensor/indexing/slice.py | HarshCasper/mars | 2 | 983 | # Copyright 1999-2020 Alibaba Group Holding 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 a... | # Copyright 1999-2020 Alibaba Group Holding 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 a... | en | 0.845566 | # Copyright 1999-2020 Alibaba Group Holding 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 a... | 1.846796 | 2 |
ftplugin/python/python/pyflakes/pyflakes/checker.py | leewckk/vim.configuration | 0 | 984 | """
Main module.
Implement the central Checker class.
Also, it models the Bindings and Scopes.
"""
import __future__
import doctest
import os
import sys
PY2 = sys.version_info < (3, 0)
PY32 = sys.version_info < (3, 3) # Python 2.5 to 3.2
PY33 = sys.version_info < (3, 4) # Python 2.5 to 3.3
PY34 = ... | """
Main module.
Implement the central Checker class.
Also, it models the Bindings and Scopes.
"""
import __future__
import doctest
import os
import sys
PY2 = sys.version_info < (3, 0)
PY32 = sys.version_info < (3, 3) # Python 2.5 to 3.2
PY33 = sys.version_info < (3, 4) # Python 2.5 to 3.3
PY34 = ... | en | 0.896496 | Main module.
Implement the central Checker class.
Also, it models the Bindings and Scopes. # Python 2.5 to 3.2 # Python 2.5 to 3.3 # Python 2.5 to 3.4 # Python 2.5 # Patch the missing attribute 'decorator_list' # workaround str.upper() which is locale-dependent # Python >= 3.3 uses ast.Try instead of (ast.TryExcept... | 2.257941 | 2 |
AutoScreenShot.py | infinyte7/Auto-Screenshot | 3 | 985 | # Project Name: Auto Screenshot
# Description: Take screenshot of screen when any change take place.
# Author: Mani (Infinyte7)
# Date: 26-10-2020
# License: MIT
from pyscreenshot import grab
from PIL import ImageChops
import os
import time
import subprocess, sys
from datetime import datetime
import tkinter as tk
fr... | # Project Name: Auto Screenshot
# Description: Take screenshot of screen when any change take place.
# Author: Mani (Infinyte7)
# Date: 26-10-2020
# License: MIT
from pyscreenshot import grab
from PIL import ImageChops
import os
import time
import subprocess, sys
from datetime import datetime
import tkinter as tk
fr... | en | 0.783014 | # Project Name: Auto Screenshot # Description: Take screenshot of screen when any change take place. # Author: Mani (Infinyte7) # Date: 26-10-2020 # License: MIT # project name label # start button # close button # Create folder to store images # all images to one folder # new folder for storing images for current sess... | 3.211947 | 3 |
rqalpha/utils/logger.py | HaidongHe/rqalpha | 1 | 986 | <reponame>HaidongHe/rqalpha
# -*- coding: utf-8 -*-
# 版权所有 2019 深圳米筐科技有限公司(下称“米筐科技”)
#
# 除非遵守当前许可,否则不得使用本软件。
#
# * 非商业用途(非商业用途指个人出于非商业目的使用本软件,或者高校、研究所等非营利机构出于教育、科研等目的使用本软件):
# 遵守 Apache License 2.0(下称“Apache 2.0 许可”),您可以在以下位置获得 Apache 2.0 许可的副本:http://www.apache.org/licenses/LICENSE-2.0。
# 除非法律有要求或以... | # -*- coding: utf-8 -*-
# 版权所有 2019 深圳米筐科技有限公司(下称“米筐科技”)
#
# 除非遵守当前许可,否则不得使用本软件。
#
# * 非商业用途(非商业用途指个人出于非商业目的使用本软件,或者高校、研究所等非营利机构出于教育、科研等目的使用本软件):
# 遵守 Apache License 2.0(下称“Apache 2.0 许可”),您可以在以下位置获得 Apache 2.0 许可的副本:http://www.apache.org/licenses/LICENSE-2.0。
# 除非法律有要求或以书面形式达成协议,否则本软件分发时需保持当前许可“原样”... | zh | 0.984505 | # -*- coding: utf-8 -*- # 版权所有 2019 深圳米筐科技有限公司(下称“米筐科技”) # # 除非遵守当前许可,否则不得使用本软件。 # # * 非商业用途(非商业用途指个人出于非商业目的使用本软件,或者高校、研究所等非营利机构出于教育、科研等目的使用本软件): # 遵守 Apache License 2.0(下称“Apache 2.0 许可”),您可以在以下位置获得 Apache 2.0 许可的副本:http://www.apache.org/licenses/LICENSE-2.0。 # 除非法律有要求或以书面形式达成协议,否则本软件分发时需保持当前许可“原样”... | 1.83624 | 2 |
salt/modules/oracle.py | wikimedia/operations-debs-salt | 0 | 987 | # -*- coding: utf-8 -*-
'''
Oracle DataBase connection module
:mainteiner: <NAME> <<EMAIL>>
:maturity: new
:depends: cx_Oracle
:platform: all
:configuration: module provide connections for multiple Oracle DB instances.
**OS Environment**
.. code-block:: text
ORACLE_HOME: path to oracle product
... | # -*- coding: utf-8 -*-
'''
Oracle DataBase connection module
:mainteiner: <NAME> <<EMAIL>>
:maturity: new
:depends: cx_Oracle
:platform: all
:configuration: module provide connections for multiple Oracle DB instances.
**OS Environment**
.. code-block:: text
ORACLE_HOME: path to oracle product
... | en | 0.484315 | # -*- coding: utf-8 -*- Oracle DataBase connection module :mainteiner: <NAME> <<EMAIL>> :maturity: new :depends: cx_Oracle :platform: all :configuration: module provide connections for multiple Oracle DB instances. **OS Environment** .. code-block:: text ORACLE_HOME: path to oracle product ... | 2.308878 | 2 |
tests/test_std.py | ashwini-balnaves/python-consul | 469 | 988 | <filename>tests/test_std.py
import base64
import operator
import struct
import time
import pytest
import six
import consul
import consul.std
Check = consul.Check
class TestHTTPClient(object):
def test_uri(self):
http = consul.std.HTTPClient()
assert http.uri('/v1/kv') == 'http://127.0.0.1:8500... | <filename>tests/test_std.py
import base64
import operator
import struct
import time
import pytest
import six
import consul
import consul.std
Check = consul.Check
class TestHTTPClient(object):
def test_uri(self):
http = consul.std.HTTPClient()
assert http.uri('/v1/kv') == 'http://127.0.0.1:8500... | en | 0.831098 | # test binary # test unicode # test empty-string comes back as `None` # test None # check unencoded values raises assert # test setting notes on a check # wait for ttl to expire # https://github.com/cablehead/python-consul/issues/156 #127.0.0.1#3000' # Clean up tasks # Clean up tasks # Cleanup tasks # Cleanup tasks # C... | 2.273365 | 2 |
Q58/sol.py | shivamT95/projecteuler | 0 | 989 | <filename>Q58/sol.py
import math
def is_prime(n):
if n == 1:
return False
if n % 2 == 0 and n > 2:
return False
return all(n % i for i in range(3, int(math.sqrt(n))+1,2))
tot = 1
dia = 0
for side_length in range(3,100001,2):
hi = side_length**2
for i in range(4):
if is_prime(hi-i*side_length+... | <filename>Q58/sol.py
import math
def is_prime(n):
if n == 1:
return False
if n % 2 == 0 and n > 2:
return False
return all(n % i for i in range(3, int(math.sqrt(n))+1,2))
tot = 1
dia = 0
for side_length in range(3,100001,2):
hi = side_length**2
for i in range(4):
if is_prime(hi-i*side_length+... | none | 1 | 3.389274 | 3 | |
lesson_07/02.py | alexartwww/geekbrains | 0 | 990 | task = '''
Реализовать проект расчета суммарного расхода ткани на производство одежды.
Основная сущность (класс) этого проекта — одежда, которая может иметь
определенное название. К типам одежды в этом проекте относятся пальто и костюм.
У этих типов одежды существуют параметры: размер (для пальто) и рост (для костюма)... | task = '''
Реализовать проект расчета суммарного расхода ткани на производство одежды.
Основная сущность (класс) этого проекта — одежда, которая может иметь
определенное название. К типам одежды в этом проекте относятся пальто и костюм.
У этих типов одежды существуют параметры: размер (для пальто) и рост (для костюма)... | ru | 0.997398 | Реализовать проект расчета суммарного расхода ткани на производство одежды. Основная сущность (класс) этого проекта — одежда, которая может иметь определенное название. К типам одежды в этом проекте относятся пальто и костюм. У этих типов одежды существуют параметры: размер (для пальто) и рост (для костюма). Это могут... | 2.560008 | 3 |
core/fanarttvapi.py | SchadLucas/pyscrape | 0 | 991 | <gh_stars>0
import urllib2
import json
import time
from core.helpers.decorator import Cached
from core.helpers.config import config
from core.helpers.logger import log, LogLevel
@Cached
def __request(request):
log('Send Fanart Request: ' + request.replace(config.fanart.api_key, 'XXX'), 'DEBUG')
headers = {'A... | import urllib2
import json
import time
from core.helpers.decorator import Cached
from core.helpers.config import config
from core.helpers.logger import log, LogLevel
@Cached
def __request(request):
log('Send Fanart Request: ' + request.replace(config.fanart.api_key, 'XXX'), 'DEBUG')
headers = {'Accept': 'app... | none | 1 | 2.511734 | 3 | |
metrics.py | AndreasLH/Image-Colourization | 1 | 992 | <reponame>AndreasLH/Image-Colourization
from math import log10, sqrt
import cv2
import numpy as np
def PSNR(original, compressed):
'''
Calculates the Peak signal to noise ratio between a ground truth image and predicted image.
see https://www.geeksforgeeks.org/python-peak-signal-to-noise-ratio-psnr/
... | from math import log10, sqrt
import cv2
import numpy as np
def PSNR(original, compressed):
'''
Calculates the Peak signal to noise ratio between a ground truth image and predicted image.
see https://www.geeksforgeeks.org/python-peak-signal-to-noise-ratio-psnr/
for reference
Parameters
--... | en | 0.719874 | Calculates the Peak signal to noise ratio between a ground truth image and predicted image. see https://www.geeksforgeeks.org/python-peak-signal-to-noise-ratio-psnr/ for reference Parameters ---------- true image (cv2 image) predicted image (cv2 image) Returns ---... | 3.586877 | 4 |
redirink/insights/tests/test_models.py | Egor4ik325/redirink | 0 | 993 | <filename>redirink/insights/tests/test_models.py
"""Test insight model is working the way it should."""
import pytest
from django.core.exceptions import ValidationError
from django.db import DataError
from .factories import InsightFactory
pytestmark = pytest.mark.django_db
def test_create_new_fake_visitor_instance_... | <filename>redirink/insights/tests/test_models.py
"""Test insight model is working the way it should."""
import pytest
from django.core.exceptions import ValidationError
from django.db import DataError
from .factories import InsightFactory
pytestmark = pytest.mark.django_db
def test_create_new_fake_visitor_instance_... | en | 0.787939 | Test insight model is working the way it should. # Should not raise ValidationError | 2.253313 | 2 |
scripts/list-all-test-suites-for-ci.py | uc-cdis/gen3-qa | 4 | 994 | <reponame>uc-cdis/gen3-qa<gh_stars>1-10
import os
import subprocess
test_suites_that_cant_run_in_parallel = [
"test-apis-dbgapTest", # not thread-safe
"test-google-googleDataAccessTest", # not thread-safe
"test-google-googleServiceAccountRemovalTest", # not th... | import os
import subprocess
test_suites_that_cant_run_in_parallel = [
"test-apis-dbgapTest", # not thread-safe
"test-google-googleDataAccessTest", # not thread-safe
"test-google-googleServiceAccountRemovalTest", # not thread-safe
"test-guppy-guppyTest", ... | en | 0.621709 | # not thread-safe # not thread-safe # not thread-safe # not thread-safe # manual (executable test) # @donot # @donot # @donot # @donot # special suite to force failures for invalid test labels # manual (executable test) # manual (executable test) # manual (executable test) # manual (executable test) # manual (executabl... | 1.685818 | 2 |
querybook/server/lib/query_executor/all_executors.py | set5think/querybook | 1 | 995 | from lib.utils.plugin import import_plugin
from .base_executor import parse_exception
from .executors.hive import HiveQueryExecutor
from .executors.presto import PrestoQueryExecutor
from .executors.sqlalchemy import (
MysqlQueryExecutor,
DruidQueryExecutor,
SqliteQueryExecutor,
SnowflakeQueryExecutor,
... | from lib.utils.plugin import import_plugin
from .base_executor import parse_exception
from .executors.hive import HiveQueryExecutor
from .executors.presto import PrestoQueryExecutor
from .executors.sqlalchemy import (
MysqlQueryExecutor,
DruidQueryExecutor,
SqliteQueryExecutor,
SnowflakeQueryExecutor,
... | en | 0.261975 | # Re-export parse_exception | 2.10673 | 2 |
bot/exts/info/pypi.py | MrGrote/bot | 1 | 996 | <filename>bot/exts/info/pypi.py
import itertools
import random
import re
from contextlib import suppress
from disnake import Embed, NotFound
from disnake.ext.commands import Cog, Context, command
from disnake.utils import escape_markdown
from bot.bot import Bot
from bot.constants import Colours, NEGATIVE_REPLIES, Red... | <filename>bot/exts/info/pypi.py
import itertools
import random
import re
from contextlib import suppress
from disnake import Embed, NotFound
from disnake.ext.commands import Cog, Context, command
from disnake.utils import escape_markdown
from bot.bot import Bot
from bot.constants import Colours, NEGATIVE_REPLIES, Red... | en | 0.877373 | Cog for getting information about PyPi packages. Provide information about a specific package from PyPI. # Summary could be completely empty, or just whitespace. # Make sure that we won't cause a ghost-ping by deleting the message Load the PyPi cog. | 2.317162 | 2 |
app/decorators.py | GinnyGaga/lanbo | 0 | 997 | from functools import wraps
from flask import abort
from flask_login import current_user
from .models import Permission
<<<<<<< HEAD
def permission_required(permission):
def decorator(f):
@wraps(f)
def decorated_function(*args, **kwargs):
if not current_user.can(permission):
... | from functools import wraps
from flask import abort
from flask_login import current_user
from .models import Permission
<<<<<<< HEAD
def permission_required(permission):
def decorator(f):
@wraps(f)
def decorated_function(*args, **kwargs):
if not current_user.can(permission):
... | none | 1 | 2.337044 | 2 | |
jnpy/experiments/Qt/pyqtgraph_tutorial/codeloop_org_materials/c4_drawing_curves.py | jojoquant/jnpy | 5 | 998 | <reponame>jojoquant/jnpy
# !/usr/bin/env python3
# -*- coding:utf-8 -*-
# @Datetime : 2019/11/14 上午2:26
# @Author : Fangyang
# @Software : PyCharm
import sys
from PyQt5.QtWidgets import QApplication
import pyqtgraph as pg
import numpy as np
app = QApplication(sys.argv)
x = np.arange(1000)
y = np.random.normal(size... | # !/usr/bin/env python3
# -*- coding:utf-8 -*-
# @Datetime : 2019/11/14 上午2:26
# @Author : Fangyang
# @Software : PyCharm
import sys
from PyQt5.QtWidgets import QApplication
import pyqtgraph as pg
import numpy as np
app = QApplication(sys.argv)
x = np.arange(1000)
y = np.random.normal(size=(3, 1000))
plotWidget = ... | fr | 0.241247 | # !/usr/bin/env python3 # -*- coding:utf-8 -*- # @Datetime : 2019/11/14 上午2:26 # @Author : Fangyang # @Software : PyCharm | 2.46733 | 2 |
compyle/api.py | nauaneed/compyle | 0 | 999 | from .array import Array, wrap
from .ast_utils import (get_symbols, get_assigned,
get_unknown_names_and_calls, has_return, has_node)
from .config import get_config, set_config, use_config, Config
from .cython_generator import (
CythonGenerator, get_func_definition
)
from .ext_module import E... | from .array import Array, wrap
from .ast_utils import (get_symbols, get_assigned,
get_unknown_names_and_calls, has_return, has_node)
from .config import get_config, set_config, use_config, Config
from .cython_generator import (
CythonGenerator, get_func_definition
)
from .ext_module import E... | none | 1 | 1.472527 | 1 |