id
stringlengths
1
8
text
stringlengths
6
1.05M
dataset_id
stringclasses
1 value
1950838
#!/usr/bin/env python2.7 """ This script collects temperature data from wunderground.com It is using wu.cfg which is JSON dictionary with following required fields: { "key":"your key", "location":"location query" } The query specifies location for which you want weather information. Examples: CA/San_Francisco US st...
StarcoderdataPython
11359783
import requests from dictor import dictor def run(ping): notification_text = False status = False try: timeout = int(ping["timeout"]["S"]) r = requests.get(ping["host"]["S"], timeout=timeout) status = r.status_code # check a metrics in response if "check_metric" in p...
StarcoderdataPython
131843
<gh_stars>1-10 #!/usr/bin/env python import sys import rospy import moveit_commander import moveit_msgs.msg import geometry_msgs.msg import tf.transformations from std_msgs.msg import Bool from roboarm.srv import PoseRequest, PoseRequestResponse def goto_pose_server(request): group.set_pose_target(request.pose) plan...
StarcoderdataPython
5125432
<reponame>fostroll/modelsrv0 #!python #-*- coding: utf-8 -*- import argparse from fastapi import BackgroundTasks, Body, Depends, FastAPI, HTTPException, \ Response, Security, status from fastapi.responses import FileResponse, JSONResponse from fastapi.staticfiles import StaticFiles import gc import ...
StarcoderdataPython
268113
<reponame>mackelab/theano_shim from setuptools import setup setup( name='theano_shim', version='0.3.0', description="A simple interface to easily switch between using Theano and pure Numpy", author="<NAME>", author_email="<EMAIL>", license='MIT', classifiers=[ 'D...
StarcoderdataPython
135218
# -*- coding: utf-8 -*- import os.path from bs4 import BeautifulSoup try: from io import open except ImportError: pass def find_sub(parent, text): """ Given an a ToC entry find an entry directly underneath it with the given text. Here is the structure of a rendered table of contents with two level...
StarcoderdataPython
4892045
#!/usr/bin/env python3 """ Script to analyze the graph for Lightning features. https://github.com/lightningnetwork/lightning-rfc/blob/master/09-features.md """ import asyncio import os import time from electrum_spero.logging import get_logger, configure_logging from electrum_spero.simple_config import SimpleConfig f...
StarcoderdataPython
3395783
''' From Wikipedia, the free encyclopaedia: A happy number is defined by the following process: Starting with any positive integer, replace the number by the sum of the squares of its digits, and repeat the process until the number equals 1 (where it will stay), or it loops endlessly in a cycle which does not include 1...
StarcoderdataPython
1625560
import gym from gym import error, spaces, utils from gym.utils import seeding import cpufreq import pyRAPL import time import numpy as np from math import ceil class FinalEnv02(gym.Env): ### DEFAULT PERSONAL VALUES DEF_POWER = 65.0 DEF_SOCKET = 0 DEF_CORES = [0,1,2,3,4,5,6,7] DEF_MAXSTEPS = 20 ...
StarcoderdataPython
11289275
<reponame>Mhh123/tornado<gh_stars>0 ''' This module is the same as the sessions module, except that: 1. NotificationMixin sets a "notifications" property instead a "session" one, and that the NotificationManager ("notifications") gets an object only once, and deletes it from the database after retrieving; 2. The o...
StarcoderdataPython
11317274
<filename>backgen.py #!/usr/bin/python3 import argparse import numpy as np import pyopencl as cl import cv2 as cv import sys class BackgroundSubtractor: def __init__(self, weight=0.5, threshold=1.0, join_weight=30, platform=0, kernel_source="kernel.cl"): self.input=input self.weight=weight ...
StarcoderdataPython
9653817
<reponame>mtag-dev/esg<filename>tests/test_default_headers.py import httpx import pytest from esg import Config from tests.utils import run_server async def app(scope, receive, send): assert scope["type"] == "http" await send({"type": "http.response.start", "status": 200, "headers": []}) await send({"typ...
StarcoderdataPython
3435193
<reponame>ashidagithub/HJDS201909LA # -*- coding: UTF-8 -*- # ------------------------(max to 80 columns)----------------------------------- # author by : (学员ID) # created: 2019.7.10 # Description: # 防御类道具 # ------------------------(max to 80 columns)----------------------------------- import sys sys.path.append...
StarcoderdataPython
9639826
''' coder: <NAME>, <NAME> date: April 2017 summary: Trains a LSTM on the activity or tcid sequences that are saved in db called Seqdb. here, we want to know whether we can predict the crash based on the sequence data. if we can, then we are able to extract the pattern from the sequence data. ''' from __future__ im...
StarcoderdataPython
1965288
<reponame>renmengye/tfplus from data_provider import DataProvider class SampleDataProvider(DataProvider): def __init__(self, data_provider): super(SampleDataProvider, self).__init__() self._data_provider = data_provider pass @property def data_provider(self): return self....
StarcoderdataPython
3291294
<filename>sockets/experiment/util/__init__.py # Copyright (c) 2021, Intel Corporation # # SPDX-License-Identifier: BSD-3-Clause from .message_passing_protocol import MPPSocket
StarcoderdataPython
5183099
import os from oauth2client import client, tools from oauth2client.file import Storage from .settings import CLIENT_SECRET_FILE, SCOPES, APPLICATION_NAME, flags def get_credentials(credentials_path, flags=flags): """Gets valid user credentials from storage. If nothing has been stored, or if the stored cred...
StarcoderdataPython
11399481
''' ml load anaconda conda activate ke_seg cd /home/nfs/em4/shuchangyong/submit python val.py --data-dir /home/nfs/em2/wei_dataset/raw_datasets/CITYSCAPES/data/cityscapes --restore-from new_rn18-cityscape_singleAndWhole_val-75.90_test-74.58.pth --gpu 0 --type val --figsavepath 75.9val python val.py --data-dir /home/...
StarcoderdataPython
377730
import logging import sys, os import eons, esam import pandas as pd #Class name is what is used at cli, so we defy convention here in favor of ease-of-use. #Outputs all data in self.data and ASSUMES self.data is a SampleSet containing only flat data class out_excel(esam.DataFunctor): def __init__(self, name=eons.I...
StarcoderdataPython
12822048
<reponame>awwong1/apollo<gh_stars>0 from applications.charge_list.models import ChargeList, ActivityCharge, TimeCharge, UnitCharge, \ ActivityChargeActivityCount from rest_framework import relations from rest_framework.serializers import HyperlinkedModelSerializer class ChargeListSerializer(HyperlinkedModelSerial...
StarcoderdataPython
11359803
#!/usr/bin/env python3 import sys, re, os, csv, getpass, argparse, mysql.connector, time, json from Bio import Entrez import pandas as pd def create_and_parse_argument_options(argument_list): parser = argparse.ArgumentParser(description='Update structural folds tables from ECOD and SCOPe, given a PDB ID') par...
StarcoderdataPython
3511473
<reponame>jordan9001/dobby2 if __name__ == '__main__': print("Please import this file from a dobby script") exit(-1) import struct from .dobby import * from .dobby_const import * # windows kernel helper functions def createIrq(ctx, irqtype, inbuf): raise NotImplementedError("TODO") def createDrvObj(ctx, ...
StarcoderdataPython
8171349
""" Comet Chart Example ---------------------------- Inspired by `Zan Armstrong's comet chart <https://www.zanarmstrong.com/infovisresearch>`_ this plot uses ``mark_trail`` to visualize change of grouped data over time. A more elaborate example and explanation of creating comet charts in Altair is shown in `this blogpo...
StarcoderdataPython
9602417
# tests/test_provider_heroku_heroku.py # Automatically generated by tools/makecode.py (24-Sep-2021 15:18:37 UTC) def test_provider_import(): import terrascript.provider.heroku.heroku def test_resource_import(): from terrascript.resource.heroku.heroku import heroku_account_feature from terrascript.resou...
StarcoderdataPython
11313041
<filename>flaskr/__init__.py<gh_stars>0 import os from flask import Flask def create_app(test_config = None): """Flask Application Factory""" # Create and configure application app = Flask(__name__, instance_relative_config = True) app.config.from_mapping( SECRET_KEY = 'dev', database ...
StarcoderdataPython
11377891
import django_filters from .common_filters import ValueInFilter, NumberInFilter, GeoFilterSet, GeomFilter from ..models import FN122 class FN122InProjectFilter(GeoFilterSet): """A fitlerset that allows us to select subsets of catch count objects by by attributes of the catch counts (fn122 data only)""" ...
StarcoderdataPython
9730613
<reponame>underflow101/code-example<filename>ps/greedy/changes.py # changes.py # book p.90 import sys input = sys.stdin.readline n = 1260 cnt = 0 coin_list = [500, 100, 50, 10] for coin in coin_list: cnt += n // coin n %= coin print(cnt)
StarcoderdataPython
4906136
#!/usr/bin/env python # -*- coding:utf-8 -*- from bson import ObjectId from django.views.decorators.csrf import csrf_exempt import pymongo from PenBlog.func import * __author__ = 'quanix' def show_all(request): db = connect_mongodb_database(request) info = db.infos.find_one() categories = list(db.categori...
StarcoderdataPython
9645357
<gh_stars>0 import random import time from unittest import mock import funcy import pytest from taskhawk.exceptions import ValidationError, TaskNotFound from taskhawk.models import Message, Priority, Metadata from .tasks import send_email class TestMetadata: def test_new(self, message_data): metadata = ...
StarcoderdataPython
11384204
<filename>kgame/actor.py from kivy.uix.widget import Widget from kivy.graphics.context_instructions import Color class Actor(Widget): def __init__(self,scene,**args): super(Actor,self).__init__(**args) self.scene= scene self.child_map = {} self.touched = False self.init_pro...
StarcoderdataPython
97444
import torch import superp import math ############################################ # set default data type to double ############################################ torch.set_default_dtype(torch.float64) torch.set_default_tensor_type(torch.DoubleTensor) # torch.set_default_dtype(torch.float32) # torch.set_default_tensor...
StarcoderdataPython
5037181
import os # isort:skip gettext = lambda s: s DATA_DIR = os.path.dirname(os.path.dirname(__file__)) """ Django settings for mysite project. Generated by 'django-admin startproject' using Django 1.11.12. For more information on this file, see https://docs.djangoproject.com/en/1.11/topics/settings/ For the full list o...
StarcoderdataPython
8197262
# Copyright (c) 2022 PaddlePaddle Authors. All Rights Reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by appli...
StarcoderdataPython
4802920
import os from transform import app if __name__ == '__main__': port = int(os.getenv("PORT")) app.run(debug=True, host='0.0.0.0', port=port)
StarcoderdataPython
3575924
<filename>robonomicsinterface/classes/account.py import typing as tp from dataclasses import dataclass from logging import getLogger from substrateinterface import Keypair from ..constants import REMOTE_WS, TYPE_REGISTRY from ..exceptions import NoPrivateKeyException from ..types import TypeRegistryTyping from ..util...
StarcoderdataPython
5084812
# This program knows about the frequencies of various FM radio stations in # London. # # Usage: # # $ python radio_freq.py [station_name] # # For instance: # # $ python radio_freq.py "Radio 4" # You can listen to Radio 4 on 92.5 FM # # or: # # $ python radio_freq.py "BBC Radio 5" # I don't know the frequency of BBC Rad...
StarcoderdataPython
6492134
<reponame>Mimino666/python-xextract<gh_stars>10-100 from lxml import etree import six from .extractor_list import XPathExtractorList class XPathExtractor(object): _parser = etree.HTMLParser _tostring_method = 'html' def __init__(self, body=None, namespaces=None, _root=None): self.namespaces = na...
StarcoderdataPython
6565539
#! /usr/bin/env python import datetime from peewee import * from flask.ext.security import Security, PeeweeUserDatastore, UserMixin, RoleMixin, login_required from app import app class UnknownField(object): pass class BaseModel(Model): class Meta: database = SqliteDatabase(app.config['DATABASE']['name']) ...
StarcoderdataPython
3538388
#!/usr/bin/env python3 """ Read BAM files to extract all splice junctions Takes manifest of BAM false Outputs bed files with """ import os import pysam from multiprocessing import Pool import numpy as np class BamToJuncBed: def __init__(self,args): self.args = args ...
StarcoderdataPython
6496664
<gh_stars>0 from Compi2RepoAux.team21.Analisis_Ascendente.Instrucciones.instruccion import * from Compi2RepoAux.team21.Analisis_Ascendente.storageManager.jsonMode import * import Compi2RepoAux.team21.Analisis_Ascendente.Tabla_simbolos.TablaSimbolos as TS import Compi2RepoAux.team21.Analisis_Ascendente.Instrucciones.Sel...
StarcoderdataPython
6442704
# Skip if long ints are not supported. import skip_if skip_if.no_bigint() print((2**64).to_bytes(9, "little")) print((-2**64).to_bytes(9, "little", signed=True)) print(int.from_bytes(b"\x00\x01\0\0\0\0\0\0", "little")) print(int.from_bytes(b"\x01\0\0\0\0\0\0\0", "little")) print(int.from_bytes(b"\x00\x01\0\0\0\0\0\0",...
StarcoderdataPython
3523570
<reponame>HackSoftware/HackGraderTests<filename>grader_e2e/tests/test_grader_errors.py import json from datetime import datetime from unittest import TestCase from settings.base import BASE_DIR, THRESHOLD from ..helper_tests import prepare_and_get, prepare_and_post, poll from ..helpers import read_binary_file, elapse...
StarcoderdataPython
286655
s=input() print(s[0]+str(len(s)-2)+s[-1])
StarcoderdataPython
9736434
# Copyright 2019 Contributors to Hyperledger Sawtooth # # 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 ...
StarcoderdataPython
1991952
<filename>apps/courses/adminx.py import xadmin from .models import Course, Lesson, Video, CourseResources, CourseClassify2, CourseClassify, CourseWiki # 课程直接添加章节 # 没法完成在章节中再嵌套视频 # 但是可以有多个inline。在添加课程时添加课程资源 class LessonInline(object): model = Lesson extra = 0 class CourseResourcesInline(object): model...
StarcoderdataPython
9636646
# MIT License # # Copyright (c) 2021 <NAME> and <NAME> and <NAME> # # 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...
StarcoderdataPython
334290
<reponame>jcwon0/BlurHPE from .nms import oks_nms, soft_oks_nms from .post_transforms import (affine_transform, flip_back, fliplr_joints, fliplr_regression, get_affine_transform, get_warp_matrix, rotate_point, transform_preds, ...
StarcoderdataPython
1605772
""""" The problem follows the In-place Reversal of a LinkedList pattern. We can use a similar approach as discussed in Reverse a LinkedList. Here are the steps we need to follow: 1. Skip the first p-1 nodes, to reach the node at position p. 2. Remember the node at position p-1 to be used later to connect with the re...
StarcoderdataPython
11317175
# Copyright 2021 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to i...
StarcoderdataPython
287774
from aiounittest import AsyncTestCase from robot.collector.shortcut import * class ContextCollectorTest(AsyncTestCase): async def test_context(self): any_value = {'key': 'value'} collector = context() _, result = await collector(any_value, None) self.assertEqual(result, any_value...
StarcoderdataPython
1737597
<filename>results/2plus1D/compare_lithium_ion_2plus1D.py import pybamm import numpy as np import matplotlib.pyplot as plt import sys # set logging level and increase recursion limit pybamm.set_logging_level("INFO") sys.setrecursionlimit(10000) # load models models = [ pybamm.lithium_ion.SPM(name="1D SPM"), py...
StarcoderdataPython
6660786
<reponame>gymk/ANLP # -*- coding: utf-8 -*- """ Created on Fri Aug 2 15:55:40 2019 @author: <NAME> """ import nltk from nltk.corpus import stopwords import pandas as pd stop_words = stopwords.words('english') def getHeapLawValues(corpus_name): words = nltk.Text(nltk.corpus.gutenberg.words(corpus_...
StarcoderdataPython
8053256
<filename>util.py import json def loadConfig(): with open('./config.json', 'r') as f: content = json.load(f) return content def filtFileName(rawName, kind='JSON'): ''' A util function just used for make objname.json to objname. Default file type is json ''' l = len(kind) + 1...
StarcoderdataPython
3536540
<gh_stars>100-1000 """ Tests for mimic identity :mod:`mimic.rest.identity_api` """ from __future__ import absolute_import, division, unicode_literals import json import uuid from six import text_type from twisted.trial.unittest import SynchronousTestCase from twisted.internet.task import Clock from mimic.core impo...
StarcoderdataPython
175362
<reponame>Agamiru/exceptions_and_logging import logging import os EXTRA_KWARGS = ["err_type"] DEFAULT_LOGGER_NAME = "default_logger" MSG_FORMAT = '%(asctime)s - APPLICATION ERROR - %(levelname)s\n' \ 'Error Type: %(err_type)s\n' \ 'Error Message: %(message)s\n' module_dir = os.path.dirname(_...
StarcoderdataPython
1690035
<gh_stars>1-10 isbn = [] for count in range(13): isbn.append(int(input("Please enter next digit of ISBN: "))) calculated_digit = 0 count = 0 while count < 12: calculated_digit = calculated_digit + isbn[count] count = count + 1 calculated_digit = calculated_digit + isbn[count] * 3 count = count + 1 ...
StarcoderdataPython
252364
from output.models.nist_data.atomic.duration.schema_instance.nistschema_sv_iv_atomic_duration_max_inclusive_1_xsd.nistschema_sv_iv_atomic_duration_max_inclusive_1 import NistschemaSvIvAtomicDurationMaxInclusive1 __all__ = [ "NistschemaSvIvAtomicDurationMaxInclusive1", ]
StarcoderdataPython
1216
<reponame>bilalelhoudaigui/plant-brapi-etl-data-lookup-gnpis # Load json bulk files into elasticsearch import json import os import time import traceback import elasticsearch from etl.common.store import list_entity_files from etl.common.utils import get_folder_path, get_file_path, create_logger, first, replace_templ...
StarcoderdataPython
11295213
#!/usr/bin/env python #-*- coding:utf-8 -*- import string class CharsetError(Exception): pass CHARSETS = { "a": string.ascii_lowercase, "A": string.ascii_uppercase, "1": string.digits, "!": string.punctuation, "*": string.printable, } PREDEFINED_CHARSETS = { "base32": CHARSETS["A"] ...
StarcoderdataPython
6612709
import os import logging.config import json base_dir = os.path.dirname(os.path.dirname(os.path.abspath(__file__))) # set up logging with open(os.path.join(base_dir, 'config', 'logging.json'), 'r') as f: logging_config = json.load(f) logging.config.dictConfig(logging_config) logging.info("Running from "+base_...
StarcoderdataPython
5179149
""" Isomorphic widgets for working with JSON-LD algorithms """ from ._version import __version__, module_name from .widget_jsonld import Compact, Expand, Flatten, Frame, Normalize __all__ = ["__version__", "Expand", "Compact", "Flatten", "Frame", "Normalize"] def _jupyter_labextension_paths(): return [{"src": "...
StarcoderdataPython
11388921
<reponame>mohamed-a/hypermodern-python<filename>src/hypermodern_python/console.py # src/hypermodern_python/console.py import click from . import __version__ @click.command() @click.version_option(version=__version__) def main(): """The hypermodern Python project.""" click.echo("Hello, world!")
StarcoderdataPython
256667
""" .. module:: news :platform: Unix :synopsis: This module contains the interface of the events' retrieval .. moduleauthor:: <NAME> <<EMAIL>> """ import feedparser from clnews.utils import remove_html from clnews.exceptions import ChannelDataNotFound, ChannelServerError, \ ChannelRetrieveEvents...
StarcoderdataPython
4882980
<filename>api/kubeops_api/migrations/0040_auto_20191104_1009.py # Generated by Django 2.1.11 on 2019-11-04 10:09 from django.db import migrations class Migration(migrations.Migration): dependencies = [ ('kubeops_api', '0039_dns'), ] def forwards_func(apps, schema_editor): DNS = apps.get_...
StarcoderdataPython
6442710
# -*- coding: utf-8 -*- import importlib import inspect import json import random import string import fnmatch import os from django.http import HttpResponse from django.test import TestCase def find_files_recursively(root_path, filename='*', prefix='', suffix='.py', exclude_name=()): """ 递归的查找文件 :param...
StarcoderdataPython
11205088
""" Implements validation and conversion for the OCI Manifest JSON. See: https://github.com/opencontainers/image-spec/blob/master/manifest.md Example: { "schemaVersion": 2, "config": { "mediaType": "application/vnd.oci.image.config.v1+json", "size": 7023, "digest": "sha256:b5b2b2c507a0944348e0303114d...
StarcoderdataPython
8107406
import matplotlib.pyplot as plt import ipywidgets as widgets import pynwb import hdmf import ndx_grayscalevolume from collections import OrderedDict from nwbwidgets import behavior, misc, base, ecephys, image, ophys from matplotlib.pyplot import Figure from pynwb.base import ProcessingModule def fig2widget(fig: Figur...
StarcoderdataPython
4838926
import os import librosa import tempfile import numpy as np import shutil import random DL_VIDEO = ("ffmpeg -i $(youtube-dl -f \"mp4\" --get-url {url}) -ss {start_time} -to {end_time} {file} </dev/null > /dev/null 2>&1 ;") EXTRACT_AUDIO = ("ffmpeg -i {video_file} -f {audio_ext} -ar {sample_rate} -ac 1 -vn {audio_file}...
StarcoderdataPython
3520606
<reponame>Zeyu-Li/django_ecommerse_app from django.db import models from django.contrib.auth.models import User from django.conf import settings from django.shortcuts import reverse # country from django_countries.fields import CountryField CATEGORY_CHOICES = ( ('Tech', 'Technology'), ('Access', 'Accessories'...
StarcoderdataPython
278794
<reponame>focusonecc/common # -*- coding: utf-8 -*- # @Author: theo-l # @Date: 2017-09-11 10:39:29 # @Last Modified by: theo-l # @Last Modified time: 2017-09-15 17:41:09 import six from django.conf.urls import url from django.core.exceptions import ImproperlyConfigured from django.core.paginator import Paginator f...
StarcoderdataPython
3526587
<reponame>bopopescu/PyHouse_1 """ -*- test-case-name: PyHouse.src.Modules.web.test.test_web_schedules -*- @name: PyHouse/src/Modules/web/web_schedules.py @author: <NAME> @contact: <EMAIL> @copyright: (c) 2013-2016 by <NAME> @license: MIT License @note: Created on Jun 3, 2013 @summary: Web interface ...
StarcoderdataPython
6412280
<gh_stars>0 # -*- coding: utf-8 -*- from django.db import models from django.utils.encoding import python_2_unicode_compatible from django.utils.translation import ugettext_lazy as _ from cms.models import CMSPlugin @python_2_unicode_compatible class Embed(CMSPlugin): """ """ source = models.CharField( ...
StarcoderdataPython
1884874
import h5py import numpy as np from tensorflow.keras.utils import Sequence import os import sys sys.path.append( os.path.realpath(os.path.join(os.path.abspath(__file__), os.path.pardir, os.path.pardir, os.path.pardir))) from backend.ocr_service.tokenization import Tokenizer import backend.ocr_service.image_proces...
StarcoderdataPython
70262
""" Tunnel generator Generates actually two tunnels. One of glass (so we can see through), on of air (so we can walk inside). Positioning of player can still be improved. """ import mcpi.minecraft as minecraft import mcpi.block as block def generate_tunnel(): mc = minecraft.Minecraft.create() position = mc...
StarcoderdataPython
3513145
<filename>admin01/serializer.py from rest_framework import serializers from admin01.models import * from reception.serializers import * # 用户等级序列化类 class UserLevelSerializer(serializers.ModelSerializer): discount = serializers.DecimalField(max_digits=7, decimal_places=2, default=10) class Meta: model...
StarcoderdataPython
11263421
import numpy as np from numpy import copy from functools import reduce from math import pi from nevergrad.optimization import optimizerlib,registry from nevergrad.optimization.utils import Archive,Value import threading import nevergrad from hqca.opts.core import * class nevergrad_opt(OptimizerInstance): def __ini...
StarcoderdataPython
8073729
<reponame>bradywatkinson/sublime-flowtype from FlowType.tests.base import TestCase class TestAddPragma(TestCase): """Test suite for `flowtype_add_pragma` command.""" def test_no_pragma_if_not_js(self): """Do not add a pragma if it's not a JavaScript file.""" self.view.set_syntax_file("Package...
StarcoderdataPython
9776782
<filename>Misc/splat.py #use splat (*) to take unknown num of args def sumAll(*args): sum = 0 for i in args: sum += i return sum print(sumAll(2,3,4,5))
StarcoderdataPython
1858597
<filename>baseconverter/__init__.py from baseconverter import * from exceptions import * import exceptions import baseconverter
StarcoderdataPython
1910298
<filename>tensorflow_fold/blocks/test_lib.py # Copyright 2017 Google Inc. 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...
StarcoderdataPython
8143818
<gh_stars>0 from .client import ClientWrapper from .user import UserWrapper
StarcoderdataPython
11244698
#!/usr/bin/env python # Copyright (C) 2020, <NAME>. # # This file is part of pyrex. # # pyrex 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 of the License, or # (at your option) any l...
StarcoderdataPython
3541865
from gameCore import GameCore from menu import menu world ='''---------------------------------------- ---------------------------------------- ---------------------------------------- ---------------------------------------- ---------------------------------------- ---------------------------------------- ----------...
StarcoderdataPython
3527693
# encoding: utf-8 # # # This Source Code Form is subject to the terms of the Mozilla Public # License, v. 2.0. If a copy of the MPL was not distributed with this file, # You can obtain one at http://mozilla.org/MPL/2.0/. # # Author: <NAME> (<EMAIL>) # from __future__ import absolute_import, division, unicode_literals ...
StarcoderdataPython
3503918
<filename>old/cube.py #!/bin/python3 import pygame from pygame.locals import * from OpenGL.GL import * #from OpenGl.GLU import * import random from OpenGL.GLU import * from constants import Constants # to sramble white on top facing green facing #colors = { # 'blue': '#DDA0DD', # 'orange': '#EE82EE', # '...
StarcoderdataPython
6511846
<filename>World/Object/Unit/Spell/Constants/SpellCastResult.py from enum import Enum class SpellCastResult(Enum): SPELL_FAILED_AFFECTING_COMBAT = 0x00 SPELL_FAILED_ALREADY_AT_FULL_HEALTH = 0x01 SPELL_FAILED_ALREADY_AT_FULL_MANA = 0x02 SPELL_FAILED_ALREA...
StarcoderdataPython
6427628
import argparse import os import pickle import scipy.ndimage import cv2 import numpy as np import tensorflow as tf import Networks as Nets from Params import CTCInferenceParams from distutils.util import strtobool import DataHandeling import sys from utils import log_print, get_model, bbox_crop, bbox_fill __author__ =...
StarcoderdataPython
6543948
from numpy import matrix from numpy import shape def scal(alpha, x): """ Compute alpha * x, overwriting x x can be row or column vectors. """ assert type(x) is matrix and len(x.shape) is 2, \ "laff.scal: vector x must be a 2D numpy.matrix" if(type(alpha) is matrix...
StarcoderdataPython
6660274
<gh_stars>0 import time import os import numpy from absl import app, flags, logging from absl.flags import FLAGS import cv2 import numpy as np import tensorflow as tf from yolov3_tf2.models import ( YoloV3, YoloV3Tiny ) from yolov3_tf2.dataset import transform_images, load_tfrecord_dataset from yolov3_tf2.utils im...
StarcoderdataPython
5024130
<filename>augmentations_tuner/fastautoaugment/__init__.py from .search import augsearch
StarcoderdataPython
1905095
<filename>test_mtgp.py #!/usr/bin/env python3 # -*- coding: utf-8 -*- """ Created on Wed Dec 29 12:47:44 2021 @author: apple """ import math import torch import gpytorch from matplotlib import pyplot as plt train_x = torch.linspace(0, 1, 100) train_y = torch.stack([ torch.sin(train_x * (2 * math.pi)) + torch.ra...
StarcoderdataPython
1923941
import argparse from models import run_full_precision_mlp, run_binary_concept_mlp, run_binary_xgemm_mlp def parse_arguments(): """ Parse command line arguments and return them :return: command line arguments """ parser = argparse.ArgumentParser() parser.add_argument( '--full_precision...
StarcoderdataPython
1708378
import numpy as np from mcfly.models.base_hyperparameter_generator import generate_base_hyperparameter_set, \ get_regularization def test_regularization_is_float(): """ Regularization should be a float. """ reg = get_regularization(0, 5) assert isinstance(reg, np.float), "Expected different type." def...
StarcoderdataPython
3506099
<gh_stars>1-10 # MIT License # # Copyright(c) 2018 <NAME> # 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, ...
StarcoderdataPython
1884163
<filename>emd/__init__.py """ Earth Mover's Distance in Python """ from emd import emd
StarcoderdataPython
8007498
import bpy import bpy_extras from mathutils import Matrix, Vector import numpy as np import errno from pathlib import Path def MakeDir(path): try: path.mkdir(parents=True) except OSError as e: if e.errno == errno.EEXIST and path.is_dir(): pass else: raise # This...
StarcoderdataPython
3348711
"""Fancy style for fonts with Powerline symbols.""" from prompt_toolkit.token import Token style = { Token.Tabs.Tab: '#bbb', Token.Tabs.Tab.Text: 'bg:#bbb #222', Token.Tabs.Tab.Active: '#0bb', Token.Tabs.Tab.Active.Text: 'bg:#0bb #222', } def _tab_template(tab_style): """...
StarcoderdataPython
9604934
<filename>src/python/data_combine.py from pathlib import Path import pandas as pd import numpy as np from scipy.sparse import load_npz, csc_matrix, hstack, save_npz import os class Combiner: def __init__(self): self.prefix = Path("data") dtypes = {"sample_id": "int", "query_id": "int", "doc_id"...
StarcoderdataPython
4828185
import re from pathlib import Path import abc from typing import Set from rivals_workshop_assistant import paths from .sprite_generation import generate_sprite_for_file_name class Asset(abc.ABC): def __init__(self, asset_string: str): self.asset_string = asset_string @classmethod def get_from_te...
StarcoderdataPython
11386260
from PyQt5 import QtGui from PyQt5.QtCore import QPoint from PyQt5.QtGui import QPainter from PyQt5.QtWidgets import QWidget, QStyleOption, QStyle class PMoveWidget(QWidget): _parent_ = None def __init__(self, parent: QWidget, **kwargs): super().__init__(**kwargs) self._parent_ = parent ...
StarcoderdataPython