id
stringlengths
1
8
text
stringlengths
6
1.05M
dataset_id
stringclasses
1 value
11374979
############################################################################## # # Copyright (c) 2006 Zope Foundation and Contributors. # All Rights Reserved. # # This software is subject to the provisions of the Zope Public License, # Version 2.1 (ZPL). A copy of the ZPL should accompany this distribution. # THIS SOF...
StarcoderdataPython
4928555
<filename>stocker/error.py import math from sklearn.metrics import mean_squared_error def get(true_values, predicted_values, error_method='mape'): # function to calculate the error error = 0 if error_method == 'mape': # calculate the mean absolute percentage error error = (abs((true_values - ...
StarcoderdataPython
8101558
<filename>wsgi.py<gh_stars>0 import os # pragma: no cover os.environ.setdefault("DJANGO_SETTINGS_MODULE", "weddingPlanner.settings") # pragma: no cover from django.core.wsgi import get_wsgi_application # pragma: no cover from whitenoise.django import DjangoWhiteNoise # pragma: no cover application = get_wsgi_applicati...
StarcoderdataPython
1833979
<filename>params.py<gh_stars>0 #import gym class train_params: # Environment parameters ENV = 'L2M' # Environment to use (must have low dimensional state space (i.e. not image) and continuous action space) RENDER = False # Whether or not to display the env...
StarcoderdataPython
11269540
__copyright__ = "Copyright (C) 2013 <NAME>" __license__ = """ Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, mer...
StarcoderdataPython
5000160
<gh_stars>0 # Given an integer array nums, find the contiguous subarray (containing at least one number) which has the largest sum and return its sum. # Example: # Input: [-2,1,-3,4,-1,2,1,-5,4], # Output: 6 # Explanation: [4,-1,2,1] has the largest sum = 6. # Follow up: # If you have figured out the O(n) solution, ...
StarcoderdataPython
1853211
from __future__ import absolute_import from __future__ import division from __future__ import print_function import sys def main(argv): filename = argv[1] data = [] with open(filename, 'rb') as f: header1 = f.readline() header2 = f.readline() line = str(f.readline(), 'utf-8') while line: i...
StarcoderdataPython
3245999
<filename>pytibrv/tport.py ## # pytibrv/tport.py # TIBRV Library for PYTHON # tibrvTransport_XXX # # LAST MODIFIED : V1.1 20170220 ARIEN <EMAIL> # # DESCRIPTIONS # ----------------------------------------------------------------------------- # # # FEATURES: * = un-implement # ---------------------------------------...
StarcoderdataPython
3356835
<reponame>gmedard/aws-decoupled-serverless-scheduler<gh_stars>10-100 #Copyright 2019 Amazon.com, Inc. or its affiliates. All Rights Reserved. #Permission is hereby granted, free of charge, to any person obtaining a copy of #this software and associated documentation files (the "Software"), to deal in #the Software...
StarcoderdataPython
5034062
<filename>librarian/views.py from django.shortcuts import render # Create your views here. from django.shortcuts import render from django.http import HttpResponse, HttpResponseRedirect # Create your views here. from django.shortcuts import render from .models import librarian #from datetime import datetime as dt #...
StarcoderdataPython
8091521
import torch import numpy as np def COCO2HUMAN(coco_keypoints): ''' "keypoints": { 0: "nose", 1: "left_eye", 2: "right_eye", 3: "left_ear", 4: "right_ear", 5: "left_shoulder", 6: "right_shoulder", 7: "left_elbow", 8: "right_elbow", ...
StarcoderdataPython
6549639
<filename>docs/errcode.py """ 错误代码管理器: 管理现有的错误代码与描述 生成错误代码描述文档 """ # 将文件路径向上转移 import os as _os import json as _json import argparse as _argparse from collections import namedtuple as _namedtuple from collections import OrderedDict as _ODict from typing import List as _List from typing import Dict as _Dict wo...
StarcoderdataPython
11239401
from django.core.exceptions import ObjectDoesNotExist from django.test import TestCase from .models import BaseManagerModel, RenameManagerModel, ReplaceManagerModel, MultipleManagerModel class TestModelIdent(TestCase): def setUp(self): self.base_model = BaseManagerModel.create() self.rename_model ...
StarcoderdataPython
1605246
<reponame>pystatic/pystatic from .prep_alias import A A_ext = A
StarcoderdataPython
9632357
""" Canadian Astronomy Data Centre (CADC). """ from astropy import config as _config class Conf(_config.ConfigNamespace): """ Configuration parameters for `astroquery.cadc`. """ CADC_REGISTRY_URL = _config.ConfigItem( 'http://www.cadc-ccda.hia-iha.nrc-cnrc.gc.ca/reg/resource-caps', 'C...
StarcoderdataPython
4945964
#CREATED BY <NAME> (Github : AnkDos) def check_pallindrome(number_to_check): return str(number_to_check)[::-1] == str(number_to_check) #AS This Solution will raise TypeError with int print(check_pallindrome(1991)) #returns true if pallindrome else false
StarcoderdataPython
3520580
<filename>venv/lib/python3.8/site-packages/ansible_collections/community/dns/tests/unit/plugins/modules/test_hetzner_dns_record_sets.py # -*- coding: utf-8 -*- # (c) 2021 <NAME> <<EMAIL>> # GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt) from __future__ import (absolute_impor...
StarcoderdataPython
3426952
<filename>2021/util.py import re from operator import add from collections import deque, defaultdict, Counter import copy import sys sys.setrecursionlimit(int(1e7)) # convention that positive y is down # increment to clockwise/turn right, decrement to counterclockwise/turn left DIRS = { 0: (0, -1), 1: (1, 0),...
StarcoderdataPython
8174653
from setuptools import setup from codecs import open from os import path here = path.abspath(path.dirname(__file__)) with open(path.join(here, "README.md"), encoding="utf-8") as f: long_description = f.read() setup( name="change-album", version="1.0", python_requires=">=3.8", description="Script...
StarcoderdataPython
4875647
import sip for api in ["QDate", "QDateTime", "QString", "QTextStream", "QTime", "QUrl", "QVariant"]: sip.setapi(api, 2) from Geon.gui import GEditorMainWindow from Geon.utils import GInit from Geon.editor import GEditorController app = GInit() ctrl = GEditorController() m = GEditorMainWindow(ctrl) m.show() app...
StarcoderdataPython
6518766
<filename>script_1_beech.py from fanpy import Formind home_dir = '/p/project/hai_deep_c/project_data/forest-carbon-flux/' model_path = home_dir par_file_name='beech' project_path= home_dir + 'formind_sim/sim_100ha_42_0/' num_sim = 1 print(model_path) print(project_path) print(par_file_name) model = Formind(model_pa...
StarcoderdataPython
6613137
''' Author: <NAME> Date: 2021-11-18 09:58:40 LastEditors: <NAME> LastEditTime: 2021-11-26 12:13:14 Description: file content FilePath: /CVMI_Sementic_Segmentation/utils/ddp/__init__.py ''' from utils.ddp.dist_utils import get_dist_info, setup_distributed, convert_sync_bn, mkdirs from utils.ddp.mmdistributed_ddp import ...
StarcoderdataPython
3362392
import logging from typing import Callable, Union, Any, TYPE_CHECKING, Type from numbers import Number import numpy as np from scipy.interpolate import interp1d # type: ignore from scipy.integrate import cumulative_trapezoid, trapz # type: ignore from math_signals.defaults.base_structures import BaseXY, Typ...
StarcoderdataPython
6690830
<reponame>mathemaphysics/APGL ''' Created on 6 Jul 2009 @author: charanpal ''' from apgl.io.PajekWriter import PajekWriter from apgl.graph.DenseGraph import DenseGraph from apgl.graph.DictGraph import DictGraph from apgl.graph.SparseGraph import SparseGraph from apgl.graph.VertexList import VertexList from a...
StarcoderdataPython
3504427
import param import panel as pn import pathlib from pyhdx.panel.template import ExtendedGoldenTemplate class ExtendedGoldenDefaultTheme(pn.template.golden.GoldenDefaultTheme): css = param.Filename(default=pathlib.Path(__file__).parent / 'static' / 'extendedgoldentemplate' / 'default.css') _template = Exten...
StarcoderdataPython
6502815
from helper_data_plot import Plot as Plot import os import numpy as np ### nyu40 class CLASS_LABELS = ['wall','floor','cabinet', 'bed', 'chair', 'sofa', 'table', 'door', 'window', 'bookshelf', 'picture', 'counter', 'blinds', 'desk', 'shelves', 'curtain', 'dresser', 'pillow', 'mirror', 'floor mat', 'cl...
StarcoderdataPython
8015885
<filename>common_tools/load_graph_layer_setting_dialog.py """ ----------------------------------------------------------------------------------------------------------- Package: AequilibraE Name: Loads graph from file Purpose: Loads GUI for loading graphs from files and configuring them before computa...
StarcoderdataPython
4925518
<filename>blog/forms.py from django import forms from .models import Blog class BlogAddForm(forms.ModelForm): title = forms.CharField(max_length=256) description = forms.CharField(max_length=256, help_text='Briefly describe the content of your blog post (This will appear when looking at the list of blog posts)...
StarcoderdataPython
5186964
<reponame>DevipriyaSarkar/SniFFile import urllib2 import json import os import traceback from bs4 import BeautifulSoup ''' Source 3: https://medium.com/web-development-zone/a-complete-list-of-computer-programming-languages-1d8bc5a891f Given a language, returns its paradigm if known, else returns "Not Known" ''' # pe...
StarcoderdataPython
3574656
import tensorflow as tf import numpy as np def tensorboard_scalar(writer, tag, value, step): summary = tf.Summary(value=[tf.Summary.Value(tag=tag, simple_value=value)]) writer.add_summary(summary, step) def tensorboard_array(writer, tag, value, step): # convert to a numpy array values = np.asarray(v...
StarcoderdataPython
110868
from django.apps import AppConfig class StoreRssFeedsConfig(AppConfig): name = 'store_rss_feeds'
StarcoderdataPython
9654586
<filename>distributedsocialnetwork/node/admin.py from django.contrib import admin from .models import Node from author.models import Author import random import string # Register your models here. class NodeAdmin(admin.ModelAdmin): # Our Node form in the admin panel model = Node list_display = ["server_us...
StarcoderdataPython
394476
from django.conf.urls import url def some_view(request): pass urlpatterns = [ url(r'^some-url/$', some_view, name='some-view'), ]
StarcoderdataPython
1909110
from django.conf.urls import url from .views import google_verification_view urlpatterns = [ url(r'^$', google_verification_view, name='google_verification_view'), ]
StarcoderdataPython
4891296
""" # JSON Tools Safe JSON SerDe. """ import datetime import decimal import json from typing import Any, Type class SafeJSONEncoder(json.JSONEncoder): """ Safe encoder for `json.dumps`. Handles `decimal.Decimal` values properly and uses `repr` for any non-serializeable object. - set is serialized to...
StarcoderdataPython
11225745
<filename>seekr2/tests/test_markov_chain_monte_carlo.py """ test_markov_chain_monte_carlo.py Unit tests for the MCMC sampling algorithms to estimate error bars in milestoning calculations. """ from collections import defaultdict import pytest import numpy as np import scipy.linalg as la import matplotlib.pyplot as ...
StarcoderdataPython
4937708
#!/usr/bin/env python3 import sys import requests f = open(sys.argv[1], "r") for line in f.readlines(): url = "http://localhost:4000/submit?run_id=" + line.strip() print(url) r = requests.get(url) print(r.text)
StarcoderdataPython
9744471
"""Main class, holding information about models and training/testing routines.""" import torch import warnings import time import pickle from ..utils import cw_loss, reverse_xent, reverse_xent_avg from ..consts import NON_BLOCKING, BENCHMARK torch.backends.cudnn.benchmark = BENCHMARK class _Forgemaster(): """Bre...
StarcoderdataPython
6689092
from __future__ import absolute_import from __future__ import unicode_literals import copy import re from collections import OrderedDict from django import forms from django.forms.forms import NON_FIELD_ERRORS from django.core.validators import EMPTY_VALUES from django.db import models from django.db.models.constants...
StarcoderdataPython
8043003
from sys import argv from math import sqrt, trunc from numpy import zeros, sum, ndarray import time from numba import jit, float32, boolean, int32, float64, int64 compile_start = time.time() @jit([boolean(int32)]) def check_prime(num): has_divisor = False if(num ==2): return True #Check 2 specially if n...
StarcoderdataPython
4934461
#!env python3 #-*- coding: utf-8 -*- """ feasibility research No.0 for 'editor' 1. get current tty device path and write this path to a file. 2. execute vim to editor this file, restart if user exit vim """ import logging import os import sys def main(): """main function""" # get tty path name, write to a fil...
StarcoderdataPython
5193110
<reponame>Felicia56/flavio r"""Module for Higgs production and decay. Based on arXiv:1911.07866.""" from . import production from . import decay from . import width from . import signalstrength
StarcoderdataPython
6614889
<gh_stars>1-10 """Accesses the Google Analytics API to spit out a CSV of aircraft usage""" from __future__ import division, print_function import argparse import collections import logging from ga_library import * from utils import * from collections import defaultdict, OrderedDict SHOW_ABSOLUTE_NUMBERS = False _o...
StarcoderdataPython
39211
<filename>016 3Sum Closest.py<gh_stars>100-1000 """ Given an array S of n integers, find three integers in S such that the sum is closest to a given number, target. Return the sum of the three integers. You may assume that each input would have exactly one solution. For example, given array S = {-1 2 1 -4}, an...
StarcoderdataPython
1750200
<gh_stars>0 import rospy import tf import numpy as np from matplotlib import pyplot as plt class VSCaleCalibrator(object): def __init__(self): rospy.init_node('vscale_calibrator') self._tfl = tf.TransformListener() self._data = [] # (timestamp, distance) self._t0 = rospy.Time.now() def step(self): try: ...
StarcoderdataPython
4936820
# -*- coding: utf-8 -*- """ This is for database upgrades, you can ignore it and preferably don't change anything. """ from sys import stderr from django.contrib.auth.hashers import make_password from django.contrib.auth.models import BaseUserManager from django.db import migrations def create_admin(apps, schema_e...
StarcoderdataPython
5176101
n,k,x = list(map(int,input().split())) l = list(map(int,input().split())) l=sorted(l) ans = [] for i in range(n): if l[i]-l[i-1]>x: ans.append((l[i]-l[i-1]-1)//x) ans = sorted(ans)[::-1] t = len(ans) while t: if ans[t-1] <= k: k-=ans[t-1] t-=1 else: break final=t+1 print(fina...
StarcoderdataPython
9614305
<filename>frappe-bench/apps/erpnext/erpnext/config/setup.py from __future__ import unicode_literals from frappe import _ from frappe.desk.moduleview import add_setup_section def get_data(): data = [ { "label": _("Settings"), "icon": "fa fa-wrench", "items": [ { "type": "doctype", "name": "Glo...
StarcoderdataPython
225148
<reponame>peombwa/Sample-Graph-Python-Client<gh_stars>0 # coding=utf-8 # -------------------------------------------------------------------------- # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is # regenerated. # -------------------------...
StarcoderdataPython
1857567
<gh_stars>0 import os import json import logging from pipeline_model import TensorFlowServingModel from pipeline_monitor import prometheus_monitor as monitor from pipeline_logger import log import tensorflow as tf import requests from PIL import Image from io import StringIO, BytesIO _logger = logging.getLogger('pip...
StarcoderdataPython
1848785
import re from exceptions.availability_checker_exception import AvailabilityCheckerException class Client: def __init__(self, name, mobile, email, pincode): self.name = name self.mobile = mobile self.email = email self.pincode = pincode @property def name(self): re...
StarcoderdataPython
3502614
<reponame>mitsuhiko/pip #! /usr/bin/env python # Hi There! # You may be wondering what this giant blob of binary data here is, you might # even be worried that we're up to something nefarious (good for you for being # paranoid!). It is a base64 encoded bz2 stream that was stored using the # pickle module. # # Pip is a...
StarcoderdataPython
1731800
import scrapy from OnlineParticipationDataset import items from OnlineParticipationDataset.spiders.Bonn2017Spider import Bonn2017Spider from datetime import datetime import re import locale class Bonn2019Spider(Bonn2017Spider): name = "bonn2019" start_urls = ['https://www.bonn-macht-mit.de/node/2900'] de...
StarcoderdataPython
296420
from django.conf.urls import include, url from django.contrib.auth import get_user_model from django.contrib.auth.models import Permission from django.core.urlresolvers import reverse from django.http import HttpResponse from django.test import TestCase from django.views.generic import View from ralph.lib.permissions....
StarcoderdataPython
5198051
<reponame>Tenebrar/codebase # Generated by Django 2.0.6 on 2018-08-21 22:19 from django.db import migrations, models class Migration(migrations.Migration): dependencies = [ ('charsheet', '0022_character_experience'), ] operations = [ migrations.AddField( model_name='race', ...
StarcoderdataPython
366643
import setuptools with open("README.md", "r") as fh: long_description = fh.read() setuptools.setup( name="torchtrain", version="0.4.13", author="HQ", author_email="<EMAIL>", description="A small tool for PyTorch training", long_description=long_description, long_description_content_typ...
StarcoderdataPython
1693062
<gh_stars>0 # coding: utf-8 """ FINBOURNE Insights API FINBOURNE Technology # noqa: E501 The version of the OpenAPI document: 0.0.238 Contact: <EMAIL> Generated by: https://openapi-generator.tech """ try: from inspect import getfullargspec except ImportError: from inspect import getarg...
StarcoderdataPython
11258059
<reponame>71unxv/Python_DTG def doublePower(x) : hasil = x ** x return hasil result = doublePower(2) print(result) # 4 result = doublePower(3) print(result) # 27 result = doublePower(4) print(result)
StarcoderdataPython
1741455
<filename>Exercise05/5-31.py ''' @Date: 2019-11-02 10:28:29 @Author: ywyz @LastModifiedBy: ywyz @Github: https://github.com/ywyz @LastEditors: ywyz @LastEditTime: 2019-11-10 00:22:14 ''' year = eval(input("Enter the year: ")) day = eval(input("Enter the day of the week: ")) for months in range(1, 13): if months ==...
StarcoderdataPython
11222943
<reponame>chandrakant1991/python0123 #Assignment #create dictionary of user data dict_03 = { 'Name': '<NAME>', 'User name': '<EMAIL>', 'Password': <PASSWORD>, 'Address': 'maji sainik nagar,Yerwada,pune-6,', 'Mobile No': 9637646900, 'Security Question': 'What is your Favourite Game' } print(di...
StarcoderdataPython
6419383
# https://github.com/lucidrains/vit-pytorch/blob/main/vit_pytorch/vit_pytorch.py import torch import torch.nn.functional as F from einops import rearrange from torch import nn MIN_NUM_PATCHES = 16 defaultcfg = { # 6 : [512, 512, 512, 512, 512, 512, 512, 512, 512, 512, 512, 512, 512, 512, 512, 512, 512, 512, 512, ...
StarcoderdataPython
4822052
class UserNotInGroupError(Exception): """Raised when the user doesn't have access to the related group.""" def __init__(self, user=None, group=None, *args, **kwargs): if user and group: super().__init__(f'User {user} doesn\'t belong to group {group}.', *args, **...
StarcoderdataPython
6404036
<reponame>theandygross/CancerData __author__ = 'agross'
StarcoderdataPython
4852122
<gh_stars>10-100 # Copyright (c) 2016 iXsystems # 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 # # U...
StarcoderdataPython
3334153
from __future__ import print_function import torch.utils.data as data import os import sys import numpy as np import h5py class MLMLoader(data.Dataset): def __init__(self, data_path, partition, mismatch=0.5): if data_path == None: raise Exception('No data path specified.') if partitio...
StarcoderdataPython
9738209
<reponame>safiza-web/ru-gpts<filename>src/gpt3_data_loader.py # coding=utf-8 # Copyright (c) 2020, Sber. 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://w...
StarcoderdataPython
8011388
<gh_stars>0 # -*- coding: utf-8 -*- from rest_framework import status from rest_framework.viewsets import ViewSet from rest_framework.response import Response from rest_framework.decorators import detail_route from api.serializers import ImagePutSerializer, TaskSerializer __all__ = ( 'TaskViewSet', ) class Tas...
StarcoderdataPython
6566559
<filename>cdlib/algorithms/__init__.py from .edge_clustering import * from .crisp_partition import * from .overlapping_partition import * from .attribute_clustering import * from .bipartite_clustering import * from .temporal_partition import *
StarcoderdataPython
11217193
<gh_stars>100-1000 import logging from shlex import quote from subprocess import run, PIPE, DEVNULL from typing import Sequence, List from aurman.own_exceptions import InvalidInput def split_query_helper(max_length: int, base_length_of_query: int, length_per_append: int, to_append: Sequence[str]) -> \ List[L...
StarcoderdataPython
1958858
<reponame>YimengYang/wol<filename>code/utils/tests/test_tree.py #!/usr/bin/env python3 from unittest import TestCase, main from shutil import rmtree from tempfile import mkdtemp from os.path import join, dirname, realpath from skbio import TreeNode from skbio.tree import MissingNodeError from utils.tree import ( ...
StarcoderdataPython
9688495
# -*- coding: utf-8 -*- from setuptools import setup, Extension setup( name='extension_dist', version='0.1', description="A dummy distribution", long_description="A distribution with an extension module.", classifiers=[ "Topic :: Software Development :: Testing", ], author='<NAME...
StarcoderdataPython
5168618
import cv2 import keyboard import numpy as np import open3d as o3d import pygame from transforms3d.axangles import axangle2mat import config from capture import OpenCVCapture from hand_mesh import HandMesh from kinematics import mpii_to_mano from utils import OneEuroFilter, imresize from wrappers import ModelPipeline ...
StarcoderdataPython
11226465
from time import time from tori.decorator.common import singleton from tori.centre import settings as AppSettings from tori.common import Enigma @singleton class GuidGenerator(object): def generate(self): key = '%s/%s' % (AppSettings['cookie_secret'], time())\ if 'cookie_secret' in AppSettings...
StarcoderdataPython
8090292
import scrapy import time class HoboSpider(scrapy.Spider): name = "hobo" start_urls = [ 'https://www.hobo.nl/hi-fi.html', 'https://www.hobo.nl/streaming.html', 'https://www.hobo.nl/home-cinema-beeld.html', 'https://www.hobo.nl/luidsprekers.html', 'htt...
StarcoderdataPython
1809358
<reponame>nathanfdunn/ipymd<filename>ipymd/formats/atlas.py # -*- coding: utf-8 -*- """Atlas readers and writers.""" #------------------------------------------------------------------------------ # Imports #------------------------------------------------------------------------------ import re from .markdown impo...
StarcoderdataPython
3378445
<gh_stars>10-100 # ------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. # Licensed under the MIT License. See License.txt in the project root for # license information. # --------------------------------------------------------------------...
StarcoderdataPython
6520825
#!/usr/bin/python from auvlib.data_tools import std_data, gsf_data, utils from auvlib.bathy_maps import mesh_map import sys import os import numpy as np import torch from matplotlib import pyplot as plt import cv2 # needed for resizing from auvlib.bathy_maps.gen_utils import clip_to_interval def predict_sidescan(netw...
StarcoderdataPython
154984
<filename>scicite/compute_features.py """ Module for computing features """ import re from collections import Counter, defaultdict from typing import List, Optional, Tuple, Type import functools from spacy.tokens.token import Token as SpacyToken import scicite.constants as constants from scicite.constants import CITA...
StarcoderdataPython
9603564
class Solution: """ @param n: An integer @param nums: An array @return: the Kth largest element """ def kthLargestElement(self, n, nums): if not nums or n < 1 or n > len(nums): return None return self.partition(nums, 0, len(nums) - 1, len(nums) - n) def ...
StarcoderdataPython
152291
<reponame>Dmarch28/khmer # This file is part of khmer, https://github.com/dib-lab/khmer/, and is # Copyright (C) 2016, The Regents of the University of California. # # Redistribution and use in source and binary forms, with or without # modification, are permitted provided that the following conditions are # met: # # ...
StarcoderdataPython
284348
<reponame>CFMTech/monitor-server-api # SPDX-FileCopyrightText: 2021 <NAME> <<EMAIL>> # # SPDX-License-Identifier: MIT def test_list_head_resources_on_all_metrics(monitor, gen): # Lets generate 200 metrics c, s = gen.new_context(), gen.new_session() for i in range(200): mem = abs(100 - i) * 100 ...
StarcoderdataPython
4874525
<reponame>gayatriprasad/critical-learning<filename>model.py import torch from torch import nn import torch.nn.functional as F import torch.nn.init as init import numpy as np from helper_functions import * def _weights_init(m): classname = m.__class__.__name__ if isinstance(m, nn.Linear) or isinstance(m, nn.C...
StarcoderdataPython
4976913
<gh_stars>0 import os from scipy.optimize import curve_fit import numpy as np from astropy.modeling import models, fitting from astropy.stats import sigma_clip from astropy.io import fits from astropy import wcs as WCS import matplotlib.pyplot as plt import matplotlib.colors from matplotlib.ticker import MaxNLocator ...
StarcoderdataPython
380259
from datetime import datetime import time import wget import os now = datetime.now() cu= now.strftime("%H:%M:%S") # print("Current Time =", cu) t=True urls=["url1","url2"] # in place of url1 place your direct downloadable links while t: now = datetime.now() cu= now.strftime("%H:%M:%S") print("Curren...
StarcoderdataPython
8136800
<gh_stars>0 # Generated by Django 2.1 on 2018-08-24 21:14 from django.db import migrations, models import django.db.models.deletion class Migration(migrations.Migration): dependencies = [ ('cars', '0005_auto_20180824_1123'), ] operations = [ migrations.CreateModel( name='Car...
StarcoderdataPython
3393851
<gh_stars>10-100 from typing import * from cognite.client import utils from cognite.client._api_client import APIClient from cognite.client.data_classes import ( DataSet, DataSetAggregate, DataSetFilter, DataSetList, DataSetUpdate, TimestampRange, ) class DataSetsAPI(APIClient): _RESOURCE...
StarcoderdataPython
5161205
# http://www.djangosnippets.org/snippets/741/ from django.template import Library register = Library() @register.filter_function def order_by(queryset, args): args = [x.strip() for x in args.split(',')] return queryset.order_by(*args)
StarcoderdataPython
9704810
<gh_stars>1-10 from . import vgg from . import estimator from . import util __author__ = "<NAME>" __version__ = "0.1.0" __license__ = "MIT"
StarcoderdataPython
6507270
<filename>daily-questions/28-11-19/anne18#5106.py l=[0,1,1] n=int(input("Enter number of terms to be displayed")) if n<=3: for i in range(n): print(l[i], end=" ") else: for i in range(3,n): a=l[i-3] b=l[i-2] c=l[i-1] d=a+b+c l.append(d) for i in range(n): ...
StarcoderdataPython
8023823
<filename>functions/__init__.py # -*- coding: utf-8 -*- """ Created on Wed Dec 6 13:53:50 2017 @author: Lennart """ # Empty file
StarcoderdataPython
8129815
#!/usr/bin/env python3 """Simple script that effectively "greps" for function calls. By default it looks for calls to the system allocator. For projects that provide their own allocation interface, this helps ensure that direct calls to the system allocator aren't accidentally introduced. It can also check for calls t...
StarcoderdataPython
4828162
<reponame>felixpelaez/python-sdk<filename>tests/common/chain_dict.py import unittest from devo.common import ChainDict class TestChainDict(unittest.TestCase): def setUp(self): self.test_dict = {'film': "Kung Fury", 'disc': {'type': 'dvd'}} self.test_values = [['film', 'Kung Fury'], [['disc', 'type...
StarcoderdataPython
5142794
<reponame>lycantropos/ground<filename>tests/base_tests/context_tests/test_polygons_box.py from typing import (Sequence, Tuple) from hypothesis import given from ground.base import Context from ground.hints import Polygon from tests.utils import (is_box, permute, ...
StarcoderdataPython
3247995
import numpy as np import cv2 as cv import time image = np.array([[150, 2, 5], [80, 145, 45], [74, 102, 165]]) # a 3X3 array of numbers pad = 1; padded_image = np.pad(image, pad, 'constant'); # Padding the image with zeros # This reduces the need to verfiy corner pixels in the 8-connectivity algo # The extra zeros...
StarcoderdataPython
141999
<filename>hello.py #!/usr/bin/env python3 import os import json import templates print('Content-Type: application/json') print() print(json.dumps(dict(os.environ), indent=2)) # print('Content-Type: text/html') # print() # print("""<!DOCTYPE html> # <html> # <body> # <h1>HELLO I AM HTML</h1> # """) # print("<ul>")...
StarcoderdataPython
390643
<gh_stars>1-10 from .game import Game from .flowchart import Flowchart from .position import Position
StarcoderdataPython
4917506
<filename>import/party_scraper/src/party_scraper/spiders/muenster.py # -*- coding: utf-8 -*- """ Copyright (C) 2019 <NAME> This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 ...
StarcoderdataPython
11297711
# coding: utf-8 # Copyright (c) 2016, 2021, Oracle and/or its affiliates. All rights reserved. # This software is dual-licensed to you under the Universal Permissive License (UPL) 1.0 as shown at https://oss.oracle.com/licenses/upl or Apache License 2.0 as shown at http://www.apache.org/licenses/LICENSE-2.0. You may c...
StarcoderdataPython
8000753
""" Quick example to illustrate how a raw STEREO EUVI image will be prepped to lvl 1.0 via SSW/IDL. - Here the compressed file we save via a query/download is uncompressed and sent to an IDL subprocess that calls secchi_prep and writes the output. """ from chmap.utilities.file_io import io_helpers from chmap.utilitie...
StarcoderdataPython
5118759
# coding: utf-8 """ OpenAPI Petstore This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ # noqa: E501 OpenAPI spec version: 1.0.0 Generated by: https://openapi-generator.tech """ from __future_...
StarcoderdataPython