id
stringlengths
1
7
text
stringlengths
6
1.03M
dataset_id
stringclasses
1 value
1608535
<filename>lib/loaders/gt_mrcn_loader.py """ data_json has 0. refs: [{ref_id, ann_id, box, image_id, split, category_id, sent_ids, att_wds}] 1. images: [{image_id, ref_ids, file_name, width, height, h5_id}] 2. anns: [{ann_id, category_id, image_id, box, h5_id}] 3. sentences: [{sent_id, tokens, h5_id}] 4...
StarcoderdataPython
1637652
# -*- coding:utf-8 -*- ''' 获取最大利益 author:zhangyu date:2020/3/24 ''' from typing import List class Solution: def massage(self, nums: List[int]) -> int: ''' 求最大利润 Args: nums:数组 Returns: 最大利润 ''' if not nums or len(nums) < 1: ret...
StarcoderdataPython
4838029
<reponame>DLR-SC/tigl from tigl3.geometry import CTiglPointsToBSplineInterpolation from tigl3.occ_helpers.containers import float_array, int_array, point_array from OCC.Core.Geom import Geom_BSplineCurve def interpolate_points(points, params=None, degree=3, close_continuous=False): """ Creates a b-spline that ...
StarcoderdataPython
1635066
# Copyright (c) Microsoft. All rights reserved. # Licensed under the MIT license. See LICENSE file in the project root for full license information. from MiniFramework.EnumDef_6_0 import * from MiniFramework.Layer import * class DropoutLayer(CLayer): def __init__(self, input_size, ratio=0.5): self.dropout...
StarcoderdataPython
162469
from typing import ( List, Tuple, ) from hummingbot.strategy.market_symbol_pair import MarketSymbolPair from hummingbot.strategy.simple_trade import ( SimpleTradeStrategy ) from hummingbot.strategy.simple_trade.simple_trade_config_map import simple_trade_config_map def start(self): try: order...
StarcoderdataPython
4841206
<reponame>xcsp3team/pycsp3 """ See https://en.wikipedia.org/wiki/Shikaku See "Shikaku as a Constraint Problem" by <NAME> Example of Execution: python3 Shikaku.py -data=Shikaku_grid1.json """ from pycsp3 import * nRows, nCols, rooms = data nRooms = len(rooms) def no_overlapping(i, j): leftmost = i if rooms[i]...
StarcoderdataPython
191275
<gh_stars>0 __copyright__ = """This file is part of SCINE Utilities. This code is licensed under the 3-clause BSD license. Copyright ETH Zurich, Laboratory of Physical Chemistry, Reiher Group. See LICENSE.txt for details. """ from conans import ConanFile class TestPackageConan(ConanFile): def build(self): ...
StarcoderdataPython
3387074
import numpy as np from torch import nn from torch.nn import init from torch.nn.functional import elu from braindecode.torch_ext.init import glorot_weight_zero_bias from braindecode.torch_ext.modules import Expression from braindecode.torch_ext.util import np_to_var class EEGNet(object): """ EEGNet model fro...
StarcoderdataPython
3230151
#!/usr/bin/env python # vim: ai ts=4 sts=4 et sw=4 import django_tables2 as tables from rapidsms.contrib.messagelog.models import Message class MessageTable(tables.Table): class Meta: model = Message exclude = ('id', ) order_by = ('-date', ) attrs = { 'class': 'table ...
StarcoderdataPython
1658459
<filename>FizzBuzz.py<gh_stars>0 """ Created by akiselev on 2019-06-21 """ #!/usr/bin/python for num in range(1,21): string="" if num % 3 == 0: string += "fizz" if num % 5 == 0: string += "buzz" if (num % 3 != 0) and (num % 5 != 0) : string = str(num) print (string)
StarcoderdataPython
87474
<reponame>trevor-ngugi/instagram-clone # -*- coding: utf-8 -*- # Generated by Django 1.11.17 on 2020-02-09 09:03 from __future__ import unicode_literals from django.db import migrations, models import django.db.models.deletion class Migration(migrations.Migration): dependencies = [ ('gram', '0002_profil...
StarcoderdataPython
3230701
<reponame>bemxio/osu-replay-parser import lzma import struct from datetime import datetime, timezone, timedelta from typing import List, Optional import base64 from dataclasses import dataclass from osrparse.utils import (Mod, GameMode, ReplayEvent, ReplayEventOsu, ReplayEventCatch, ReplayEventMania, ReplayEventTa...
StarcoderdataPython
3332087
""" """ import time, zlib, re from calendar import timegm from .rtlibRepl import minidom import wx from WikiExceptions import * import Consts from .MiscEvent import MiscEventSourceMixin, KeyFunctionSink from . import Exporters, Serialization from . import StringOps # from ..StringOps import a...
StarcoderdataPython
774
<reponame>zhiqwang/mmdeploy _base_ = ['../_base_/base_tensorrt_static-300x300.py']
StarcoderdataPython
93209
# Import the converted model's class import numpy as np import random import tensorflow as tf from tensorflow.python.ops import rnn, rnn_cell from posenet import GoogLeNet as PoseNet import cv2 from tqdm import tqdm import math batch_size = 75 max_iterations = 30000 # Set this path to your project directory path = 'p...
StarcoderdataPython
1643300
ram=int(input("ingresa el valor de la ram")) tb=int(input("ingresa el valor de los bloques de la ram")) y=int(ram/tb) print("el valor de Y es:",y) if(ram % tb != 0): y= y + 1 print("el valor de Y es:",y) datos={} i=0 bloq=0 while i<=y: aux=bloq tar=input("ingrese nombre de la tarea") bloq...
StarcoderdataPython
3354513
<reponame>raface/python-bizdays_calendar class BizdaysException(Exception): pass class FormattingException(Exception): pass class FileException(Exception): pass class ConfigException(Exception): pass class ConnectionException(Exception): pass
StarcoderdataPython
17892
## Copyright 2014 Cognitect. All Rights Reserved. ## ## Licensed under the Apache License, Version 2.0 (the "License"); ## you may not use this file except in compliance with the License. ## You may obtain a copy of the License at ## ## http://www.apache.org/licenses/LICENSE-2.0 ## ## Unless required by applicable...
StarcoderdataPython
3205708
<filename>src/hepqpr/qallse/seeding/storage.py from .utils import * class DoubletInfo: """ Holds information about doublet for a given spacepoint when it is considered as the middle spacepoint. Output of the doubletCounting step write there """ def __init__(self, nbSpacepoints): # number ...
StarcoderdataPython
4833397
<reponame>zywek123/accessible_output2<filename>build/lib/accessible_output2/platform_utils/paths.py import inspect import platform import os import sys from functools import wraps def merge_paths(func): @wraps(func) def merge_paths_wrapper(*a, **k): return unicode(os.path.join(func(**k), *a)) return merge_paths_...
StarcoderdataPython
1763487
<filename>api/tacticalrmm/accounts/migrations/0007_update_agent_primary_key.py<gh_stars>100-1000 # Generated by Django 3.1.2 on 2020-11-01 22:54 from django.db import migrations def link_agents_to_users(apps, schema_editor): Agent = apps.get_model("agents", "Agent") User = apps.get_model("accounts", "User") ...
StarcoderdataPython
1740055
<reponame>ipendlet/ord-schema # Copyright 2020 Open Reaction Database Project 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 # # U...
StarcoderdataPython
3351449
# -*- coding: utf-8 -*- """ Created on Thu Dec 6 10:13:52 2018 @author: slauniai DEMO HOW TO RUN POINT-SCALE MODEL FOR A SINGLE OR MULTIPLE SITES. """ import numpy as np import pandas as pd import matplotlib.pyplot as plt # import model and functions to read data from spafhy_point import SpaFHy_point from spafhy...
StarcoderdataPython
1757711
<reponame>daintlab/unknown-detection-benchmarks import torch import torch.nn as nn import torch.nn.functional as F import math def conv3x3(in_planes, out_planes, stride=1): " 3x3 convolution with padding " return nn.Conv2d(in_planes, out_planes, kernel_size=3, stride=stride, padding=1, bias=False) class Ba...
StarcoderdataPython
97540
import re import time from selenium import webdriver from selenium.webdriver.common.keys import Keys from selenium.webdriver.common.by import By from selenium.webdriver.support.ui import WebDriverWait from selenium.webdriver.support import expected_conditions as EC from random import seed from random import random fro...
StarcoderdataPython
100270
<gh_stars>0 import sklearn.base import numpy as np class ProbT(sklearn.base.BaseEstimator, sklearn.base.TransformerMixin): """Wraps a sklearn classifier (ClassifierMixin) to use the output of their .predict_proba method. Args: model (sklearn.base.ClassifierMixin): A sklearn classification model ...
StarcoderdataPython
138467
<reponame>esorot/upb<gh_stars>0 # copybara:strip_for_google3_begin def pyproto_test_wrapper(name): src = name + "_wrapper.py" native.py_test( name = name, srcs = [src], legacy_create_init = False, main = src, data = ["@com_google_protobuf//:testdata"], deps = [ ...
StarcoderdataPython
4817270
from __future__ import print_function import torch from api import config_fun import train_helper cfg = config_fun.config() model = train_helper.get_model(cfg, pretrained=False) model_pa = torch.nn.DataParallel(model) model_cuda = model.cuda() print(type(model)) print(type(model_cuda)) print(type(model_pa)) pri...
StarcoderdataPython
3290069
<filename>Text-Based-Browser/browser.py import sys import os from pathlib import Path import requests from bs4 import BeautifulSoup from colorama import init, Fore, Back, Style def get_url_file(dir, url): url_key = url.replace(".", "_").replace("_com", "").replace("_org", "") return os.sep.join([dir, url_key ...
StarcoderdataPython
123823
<filename>Notatki/5_GUI/1_Tkinter/przyklad.py # Programowanie I R # Graficzny interfejs użytkownika: Tkinter - przykład #*********************************************************************************** # Importujemy niezbędne moduły #**********************************************************************************...
StarcoderdataPython
140384
# -- Project information ----------------------------------------------------- project = "2i2c Pilot Hubs Infrastructure" copyright = "2020, 2i2c.org" author = "2<EMAIL>" # -- General configuration --------------------------------------------------- # Add any Sphinx extension module names here, as strings. They can...
StarcoderdataPython
32033
<gh_stars>1-10 import matplotlib import numpy as np import matplotlib.cm as cm import matplotlib.pyplot as plt import random from sympy import symbols, diff, N def fun(X, Y): return 2*(np.exp(-X**2 - Y**2))# - np.exp(-(X - 1)**2 - (Y - 1)**2)) def symfun(X, Y): return 2*(np.exp(1)**(-X**2 - Y**2))# - np.exp(1...
StarcoderdataPython
156496
import copy from collections import OrderedDict from typing import List import numpy as np from opticverge.core.chromosome.abstract_chromosome import AbstractChromosome from opticverge.core.chromosome.function_chromosome import FunctionChromosome from opticverge.core.generator.int_distribution_generator import rand_i...
StarcoderdataPython
194915
<filename>packages/augur-core/tests/trading/test_claimTradingProceeds.py #!/usr/bin/env python from eth_tester.exceptions import TransactionFailed from pytest import raises, fixture, mark from utils import fix, AssertLog, EtherDelta, TokenDelta, BuyWithCash, nullAddress from constants import YES, NO def captureLog(c...
StarcoderdataPython
1669056
# -*- coding: utf-8 -*- """ Tencent is pleased to support the open source community by making 蓝鲸智云PaaS平台社区版 (BlueKing PaaS Community Edition) available. Copyright (C) 2017-2018 THL A29 Limited, a Tencent company. All rights reserved. Licensed under the MIT License (the "License"); you may not use this file except in co...
StarcoderdataPython
1775609
#! /usr/bin/env python from typing import Optional import numpy as np # type: ignore from scipy.constants import g # type: ignore def compact( dz: np.ndarray, porosity: np.ndarray, c: float = 5e-8, rho_grain: float = 2650.0, excess_pressure: float = 0.0, porosity_min: float = 0.0, poros...
StarcoderdataPython
3329495
<reponame>computerboy0555/GBVision from .recording_opencv_window import RecordingOpenCVWindow from .feed_window import FeedWindow class RecordingFeedWindow(RecordingOpenCVWindow, FeedWindow): """ a basic window that displays the stream from a stream receiver """
StarcoderdataPython
144318
import os import requests import json class SimulationManagerException(Exception): def __init__(self, status_code, message): self.status_code = status_code self.message = message def createSimulation(incident_id, num_nodes, requested_walltime, kind, executable, queuestate_callbacks={}, directory=N...
StarcoderdataPython
3380687
import os import uuid import unittest from spaceone.core.unittest.runner import RichTestRunner from spaceone.tester.unittest import TestCase, to_json, print_json def random_string(): return uuid.uuid4().hex TOKEN = os.environ.get('KEYCLOAK_TOKEN', 'export KEYCLOAK_TOKEN=<KEY>') OPENID_CONFIGURATION = os.environ....
StarcoderdataPython
1757540
<filename>dival/util/plot.py<gh_stars>10-100 # -*- coding: utf-8 -*- """Provides utility functions for visualization.""" from warnings import warn from math import ceil import matplotlib.pyplot as plt # import mpl_toolkits.axes_grid.axes_size as Size # from mpl_toolkits.axes_grid import Divider import numpy as np def...
StarcoderdataPython
157375
default_app_config = 'business.staff_accounts.apps.UserManagementConfig' """ This APP is for management of users Functions:- Adding staff Users and giving them initial details -Department -Staff Type -Departmental,General Managers have predefined roles depending on the departments they can...
StarcoderdataPython
7173
import torch.nn as nn from .basic import * class squeeze_excitation_2d(nn.Module): """Squeeze-and-Excitation Block 2D Args: channel (int): number of input channels. channel_reduction (int): channel squeezing factor. spatial_reduction (int): pooling factor for x,y axes. """ def ...
StarcoderdataPython
42480
""" An AWS Lambda function used to run periodic background jobs on ECS. The complication with running these tasks is that we need to run them on the same version of the Docker image that the web servers are currently running on. """ import logging import boto3 from utils import env_list, env_param # Logging setup...
StarcoderdataPython
1693003
from django.contrib import admin from .models import Tag, Article # admin.site.register(Tag) # admin.site.register(Article) def set_active(modeladmin, request, queryset): queryset.update(is_active = True) class ArticleAdmin(admin.ModelAdmin): list_display = ['article_name','article_text', 'is_active','ar...
StarcoderdataPython
139396
<filename>mooiter/account.py<gh_stars>1-10 #!/usr/bin/env python # -*- coding: utf-8 -*- # Mooiter # Copyright 2010 <NAME> # See LICENCE for details. import sys import base64 #Test third party modules try: import tweepy from PyQt4 import QtGui from PyQt4 import QtCore except ImportError as e: print "...
StarcoderdataPython
20407
# "javascript" section for javascript. see @app.route('/config.js') in app/views.py # oauth constants HOSTNAME = "http://hackathon.chinacloudapp.cn" # host name of the UI site QQ_OAUTH_STATE = "openhackathon" # todo state should be constant. Actually it should be unguessable to prevent CSFA HACkATHON_API_ENDPOINT = ...
StarcoderdataPython
1781639
<reponame>amplify-education/bcfg2 from django.contrib.auth.models import User from nisauth import * class NISBackend(object): def authenticate(self, username=None, password=<PASSWORD>): try: print("start nis authenticate") n = nisauth(username, password) temp_pass = Us...
StarcoderdataPython
1674106
<filename>source/lp_solver.py """ Solves the battery control problem using the LP formulation """ import numpy as np import pulp def solve_lp(load, price_buy, price_sell, h, b_0, b_max, b_min, eff_c, eff_d, d_max, d_min, commitment=None, eps=1e-5): """ Solves the LP asociated with controlling a battery Pa...
StarcoderdataPython
73901
from concurrent.futures import Future, ThreadPoolExecutor import logging from vonx.indy.messages import StoredCredential from vonx.web.view_helpers import ( IndyCredentialProcessor, IndyCredentialProcessorException, ) from api_indy.indy.credential import Credential, CredentialException, CredentialManager fr...
StarcoderdataPython
1628259
# -*- coding: UTF-8 -*- # pep8: disable-msg=E501 # pylint: disable=C0301 import os import logging import getpass import tempfile __version__ = '0.0.5' __author__ = '<NAME>' __author_username__ = 'marco.lovato' __author_email__ = '<EMAIL>' __description__ = 'A command-line tool to create projects \ fr...
StarcoderdataPython
149682
from django.db import models import uuid from django.db.models.deletion import CASCADE from django.utils.translation import ugettext_lazy as _ from registry.models import Aircraft, Contact class AerobridgeCredential(models.Model): ''' A class to store tokens from Digital Sky ''' KEY_ENVIRONMENT = ((0, _('...
StarcoderdataPython
3316379
<reponame>lunastorm/wissbi #!/usr/bin/env python import sys import re import socket sep_re = re.compile("^==> (\/.*) <==$") current_logger = "" hostname = socket.gethostname() while True: line = sys.stdin.readline() if len(line) == 0: break line = line.strip() if len(line) == 0: con...
StarcoderdataPython
3209966
from napalm import get_network_driver import pprint as pp driver = get_network_driver('eos') device = driver('sw-2', 'admin', 'alta3') device.open() pp.pprint(device.compliance_report("/home/student/pyna/sw2_validate01.yml")) device.close()
StarcoderdataPython
1704177
<gh_stars>0 import asyncio import os import re import sqlite3 import click import pyperclip from salmon import config from salmon.common import AliasedCommands, commandgroup from salmon.database import DB_PATH from salmon.errors import ImageUploadFailed from salmon.images import imgur, mixtape, ptpimg, vgy loop = as...
StarcoderdataPython
3205261
''' Given an integer n, count the total number of digit 1 appearing in all non-negative integers less than or equal to n. For example: Given n = 13, Return 6, because digit 1 occurred in the following numbers: 1, 10, 11, 12, 13. ''' class Solution(object): def countDigitOne(self, n): """ :type n: ...
StarcoderdataPython
64126
<gh_stars>0 # Databricks notebook source # MAGIC %md # Using the DDS package on Databricks # MAGIC # MAGIC This notebook shows you a few features of the [dds package](https://github.com/tjhunter/dds_py). Install `dds-py` to your cluster via PyPI to run this notebook. # COMMAND ---------- dbutils.fs.rm("/data_managed...
StarcoderdataPython
3374111
<reponame>ajayhk/quant<filename>algos/Catch-Dips-the-fishing-algo-Live-Trade.py ''' This algorithm buys and keeps stocks when they suddenlly dip below a certain threshold For example, buy only when the stock dips 20% below the moving average (20) Sell happens when it is 2X of what we bought it at Perf...
StarcoderdataPython
3210470
class Student: def __init__(self, first, last, courses=None): self.first_name = first self.last_name = last if courses == None: self.courses = [] else: self.courses = courses def add_course(self, course): if course not in self.courses: self.courses.append(course) else:...
StarcoderdataPython
3312465
import tensorflow as tf import tensorflow.keras as ks from kgcnn.ops.partition import change_partition_by_name, partition_row_indexing from kgcnn.layers.base import GraphBaseLayer @tf.keras.utils.register_keras_serializable(package='kgcnn',name='PoolingTopK') class PoolingTopK(GraphBaseLayer): """Layer for pooli...
StarcoderdataPython
1600288
import time import pytest import numpy as np import pandas as pd import matplotlib matplotlib.use('Agg') import matplotlib.pyplot as plt import filestore import filestore.api import filestore.handlers import hxnfly.fly import hxnfly.log from hxnfly.callbacks import FlyLiveCrossSection from hxnfly.fly2d import Fly2D...
StarcoderdataPython
4804444
import pytest from ..checker import check from tenable.errors import APIError, UnexpectedValueError from tests.pytenable_log_handler import log_exception def test_queries_constructor_sort_field_typeerror(sc): with pytest.raises(TypeError): sc.queries._constructor(sort_field=1, tool='1', type='1', filters=...
StarcoderdataPython
4837835
# Imports import torch from torch import nn from torch.utils.data import DataLoader, SubsetRandomSampler, TensorDataset import torch.nn.functional as F import torch.optim as optim import numpy as np import random from sklearn.model_selection import train_test_split, KFold from sklearn.metrics import classification_rep...
StarcoderdataPython
97689
<reponame>openedx/openedx-census #!/usr/bin/env python """Automate the process of counting courses on Open edX sites.""" import asyncio import collections import csv import itertools import json import logging import os import pickle import pprint import re import time import traceback import urllib.parse import attr...
StarcoderdataPython
24183
import os import sys import json import argparse import progressbar from pathlib import Path from random import shuffle from time import time import torch from cpc.dataset import findAllSeqs from cpc.feature_loader import buildFeature, FeatureModule, loadModel, buildFeature_batch from cpc.criterion.clustering import kM...
StarcoderdataPython
3224494
<filename>term2048/keypress.py<gh_stars>10-100 # -*- coding: UTF-8 -*- try: import termios except ImportError: # Assume windows import msvcrt UP, DOWN, RIGHT, LEFT = 72, 80, 77, 75 def getKey(): while True: if msvcrt.kbhit(): a = ord(msvcrt.getch()) ...
StarcoderdataPython
3259379
<reponame>zealoussnow/chromium<gh_stars>1000+ #!/usr/bin/env python # Copyright (c) 2021 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. """Creates a dummy RTS filter file if a real one doesn't exist yes. Real filter file...
StarcoderdataPython
1636088
<gh_stars>1-10 # ladowanie danych do tablicy dwu-wymiarowej with open('../dane/dane.txt') as f: data = [] for line in f.readlines(): data.append(line[:-1].split(' ')) # wyszukanie minimum i maximum w tablicy brightest = 0 darkest = 256 # przejscie po kazdym wierszu for ln in data: # przejscie po ka...
StarcoderdataPython
1642435
""" Copyright MIT and Harvey Mudd College MIT License Summer 2020 Defines the interface of the Display module of the racecar_core library. """ import abc import numpy as np import math from typing import List, Tuple, Any from nptyping import NDArray import racecar_utils as rc_utils class Display(abc.ABC): """ ...
StarcoderdataPython
3222918
from __future__ import print_function, division, absolute_import import pytest import subprocess32 as subprocess from runner import main as runner, _check_tool def test_bad_tx_cmd(): # Trigger a fatal error from a command line tool, to make sure # it is handled correctly. with pytest.raises(subprocess.C...
StarcoderdataPython
1676832
import logging from contextlib import contextmanager from django.db import models from django_directed.models.abstract_base_models import BaseGraph try: from asgiref.local import Local as local except ImportError: from threading import local logger = logging.getLogger("django_directed") _threadlocals = loc...
StarcoderdataPython
50620
<filename>TDMA_solver.py # Matrix solver (TDMA) # parameters required: # n: number of unknowns (length of x) # a: coefficient matrix # b: RHS/constant array # return output: # b: solution array def solve_TDMA(n, a, b): # forward substitution a[0][2] = -a[0][2] / a[0][1] b[0] = b[0] / a[0][1] for i i...
StarcoderdataPython
4838191
<gh_stars>0 # <Copyright 2022, Argo AI, LLC. Released under the MIT license.> """Implements a pinhole camera interface.""" from __future__ import annotations from dataclasses import dataclass from functools import cached_property from pathlib import Path from typing import Tuple, Union import numpy as np import av...
StarcoderdataPython
51743
# Copyright 2017 <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, so...
StarcoderdataPython
3265838
from JumpScale import j from JumpScale.grid.osis.OSISStoreMongo import OSISStoreMongo class mainclass(OSISStoreMongo): """ Defeault object implementation """ def __init__(self, *args, **kwargs): super(mainclass, self).__init__(*args, **kwargs) def set(self, key, value, waitIndex=False, s...
StarcoderdataPython
3212598
<reponame>Deltares/HYDROLIB-core import logging from typing import List, Literal, Optional from pydantic import Field from pydantic.class_validators import validator from pydantic.types import NonNegativeInt from hydrolib.core.io.ini.models import INIBasedModel, INIGeneral, INIModel from hydrolib.core.io.ini.util imp...
StarcoderdataPython
3304892
<filename>libgoods/scripts/examples/COOPS_FVCOM_multifile_example.py #!/usr/bin/env python from __future__ import print_function from libgoods import tri_grid, noaa_coops, nctools import datetime as dt import os from netCDF4 import num2date ''' Sample script to retrieve data from NOAA CO-OPS FVCOM netcdf "file" (can b...
StarcoderdataPython
3329535
<reponame>shmuelamar/phonelocator<gh_stars>1-10 import pytest from phonelocator import locator @pytest.fixture(scope='function') def countries(): return { u'US': u'1', u'UG': u'256', u'IL': u'972', u'TZ': u'255', u'TW': u'886', u'AU': u'61', } @pytest.fixture(scope='function') def states(): ...
StarcoderdataPython
1651014
# -*- coding: utf-8 -*- """ Tencent is pleased to support the open source community by making 蓝鲸智云PaaS平台社区版 (BlueKing PaaS Community Edition) available. Copyright (C) 2017-2021 TH<NAME>, a Tencent company. All rights reserved. Licensed under the MIT License (the "License"); you may not use this file except in complianc...
StarcoderdataPython
167048
<reponame>DLR-RM/python-jsonconversion # Copyright (C) 2016-2017 DLR # # All rights reserved. This program and the accompanying materials are made # available under the terms of the 2-Clause BSD License ("Simplified BSD # License") which accompanies this distribution, and is available at # https://opensource.org/licens...
StarcoderdataPython
4842521
<filename>tests/test_comm.py import unittest from qupy.framing.slip import Slip from qupy.comm.client import CommClient from qupy.comm.server import CommServer from qupy.comm.errors import CommError from qupy.interface.tcp import TcpSocketClient, TcpSocketServer from qupy.interface.errors import InterfaceTimeoutError...
StarcoderdataPython
1725565
<filename>2018/Day21.py from Day19 import Device, make_command script = """\ #ip 3 seti 123 0 1 bani 1 456 1 eqri 1 72 1 addr 1 3 3 seti 0 0 3 seti 0 0 1 bori 1 65536 2 seti 10605201 9 1 bani 2 255 5 addr 1 5 1 bani 1 16777215 1 muli 1 65899 1 bani 1 16777215 1 gtir 256 2 5 addr 5 3 3 addi 3 1 3 seti 27 3 3 seti 0 3 5...
StarcoderdataPython
3309154
from typing import List from geom2d import Circle, Rect, Segment, Point, Polygon, Vector from graphic.svg.attributes import attrs_to_str from graphic.svg.read import read_template __segment_template = read_template('line') __rect_template = read_template('rect') __circle_template = read_template('circle') __polygon_te...
StarcoderdataPython
4801114
<filename>CodeWars/7 Kyu/21 Sticks.py def makeMove(sticks): return max(sticks % 4, 1)
StarcoderdataPython
4841070
""" Network optimization """ import pandas as pd __author__ = "<NAME>" __copyright__ = "Copyright 2015, Architecture and Building Systems - ETH Zurich" __credits__ = ["<NAME>", "<NAME>", "<NAME>", "<NAME>"] __license__ = "MIT" __version__ = "0.1" __maintainer__ = "<NAME>" __email__ = "<EMAIL>" __status__ = "Produc...
StarcoderdataPython
30140
# -*- coding: utf-8 -*- """ Created on Mon Aug 5 14:01:56 2019 @author: <NAME> This implementation use ST-ResNet for inflow / outflow bike prediction on the city of NY Article: https://arxiv.org/pdf/1610.00081.pdf References and credits: <NAME>, <NAME>, <NAME>. Deep Spatio-Temporal Residual Networks for Citywide C...
StarcoderdataPython
1686218
# imports import numpy as np import tensorflow as tf from numpy import random import math import time import matplotlib.pyplot as plt """Part 1 - Forward Propagation""" def initialize_parameters(layer_dims): """ Description: This function initializes weights and biases :param layer_dims: an array of the...
StarcoderdataPython
4833300
import django_tables2 as tables from django_tables2.utils import Accessor from utilities.tables import BaseTable, ToggleColumn from .models import SecretRole, Secret SECRETROLE_EDIT_LINK = """ {% if perms.secrets.change_secretrole %} <a href="{% url 'secrets:secretrole_edit' slug=record.slug %}">Edit</a> {% end...
StarcoderdataPython
3274396
<gh_stars>0 from nehushtan.httpd.exceptions.NehushtanHTTPError import NehushtanHTTPError class NehushtanRequestDeniedByFilterError(NehushtanHTTPError): """ Since 0.4.0 When a Filter denies a request """ def __init__(self, filter_name: str, error_message: str, http_code: int): super(Nehush...
StarcoderdataPython
1732389
<gh_stars>0 from .parser import Parser __version__ = "0.1.0" def convert(html: str) -> str: parser = Parser() parser.feed(html) result = [] for elem in parser.parse_result: result.append(elem.to_str()) return "\n".join(result)
StarcoderdataPython
123260
# -*- coding: utf-8 -*- # best for i/o sql interface for history stats #TODO: #sql for pin_id_4_goods #shop for pin_ids #chart_generator #statistical view import logging import datetime import threading import time import mysql.connector from mysql.connector import errorcode import redis # method example code # sql...
StarcoderdataPython
161061
<reponame>eas342/dust_mie from dust_mie import calc_mie import matplotlib.pyplot as plt median_r = 1.0 s = 0.5 r, dr = calc_mie.get_r_to_evaluate(r=median_r,s=s) n = calc_mie.lognorm(r,s=s,med=median_r) plt.plot(r,n) plt.xlabel('Particle Radius ($\mu$m)') plt.ylabel('Number') plt.savefig('radius_distribution.png')
StarcoderdataPython
170833
class AdvancedBoxScore: def __init__(self, seconds_played, offensive_rating, defensive_rating, teammate_assist_percentage, assist_to_turnover_ratio, assists_per_100_possessions, offensive_rebound_percentage, defensive_rebound_percentage, turnovers_per_100_possessions, ...
StarcoderdataPython
139867
<reponame>IonaBrenac/BiblioAnalysis __all__ = ['ALIAS_UK', 'CHANGE', 'COUNTRIES', 'COUNTRIES_GPS', 'DIC_CHANGE_CHAR', 'IN_TO_MM', 'USA_STATES',] # Countries normalized names and GPS coordinates COUNTRY = ''' United States,Afghanistan,Albania,Algeria...
StarcoderdataPython
26963
<filename>compiler/extensions/python/runtime/src/zserio/bitfield.py """ The module provides help methods for bit fields calculation. """ from zserio.exception import PythonRuntimeException def getBitFieldLowerBound(length): """ Gets the lower bound of a unsigned bitfield type with given length. :param le...
StarcoderdataPython
98863
<filename>alg1/batch_tests/BatchTest-batched.py import subprocess if __name__ == '__main__': commbatch = "python ../StressTest.py --bw_factor=1.0 --lat_factor=1.0 --res_factor=1.0 --vnf_sharing=0.0 --vnf_sharing_same_sg=0.0 --shareable_sg_count=4 --batch_length=4 --request_seed=" commnonbatch = "python ../Stre...
StarcoderdataPython
3216701
#!/usr/bin/env python3 #**************************************************************************************************************************************************** # Copyright (c) 2016 Freescale Semiconductor, Inc. # All rights reserved. # # Redistribution and use in source and binary forms, with or without #...
StarcoderdataPython
1785499
<filename>cache_purge_hooks/backends/varnishbackend.py import logging import subprocess from django.conf import settings logger = logging.getLogger('django.cache_purge_hooks') VARNISHADM_HOST = getattr(settings, 'VARNISHADM_HOST', 'localhost') VARNISHADM_PORT = getattr(settings, 'VARNISHADM_PORT', 6082) VARNISHADM_S...
StarcoderdataPython
165392
<reponame>matthaeusheer/uncertify import logging import matplotlib.pyplot as plt import seaborn as sns import pandas as pd import matplotlib from uncertify.visualization.plotting import set_matplotlib_rc from uncertify.common import DATA_DIR_PATH from typing import List LABEL_MAP = { 'rec_err': '$\ell_{1}$', ...
StarcoderdataPython
4813416
<filename>backend/test/test_unit/test_communication_utils.py from unittest.mock import patch from django.test import TestCase # Import module from backend.communication_utils import * class OSAware(TestCase): def setUp(self) -> None: self.data_linux = {'id': 42, 'file_path': '/home/user/test', 'folder':...
StarcoderdataPython
115935
<gh_stars>0 N = int(input()) ans = 1e12 # 約数を求める。N**.5までで十分 for n in range(1, int(N ** 0.5) + 1): if N % n == 0: ans = min(ans, n + N // n - 2) print(ans)
StarcoderdataPython