id
stringlengths
1
265
text
stringlengths
6
5.19M
dataset_id
stringclasses
7 values
116024
""" This subpackage is for providing the data to the controllers """
StarcoderdataPython
3222876
<filename>firmwire/vendor/__init__.py ## Copyright (c) 2022, Team FirmWire ## SPDX-License-Identifier: BSD-3-Clause # Import vendor plugins import firmwire.vendor.shannon import firmwire.vendor.mtk
StarcoderdataPython
41891
<filename>src/pyrin/cli/core/template/__init__.py # -*- coding: utf-8 -*- """ cli core template package. """ from pyrin.packaging.base import Package class CLICoreTemplatePackage(Package): """ cli core template package class. """ NAME = __name__
StarcoderdataPython
103107
<filename>corelib/units/volume.py # coding: utf-8 r"""Volume conversions""" from corelib.units.base import create_code volumes = {"m3": 1., "cubic_meter": 1., "cubic_meters": 1., "l": 0.001, "litre": 0.001, "liter": 0.001, "litres": 0.001, "liters": 0.001, "cm3": 1e-6, "centimeter_cube": 1e-6,...
StarcoderdataPython
3225537
<gh_stars>0 """ A supporting module that provides a routine to integrate the differential hmf in a robust manner. """ from scipy.interpolate import InterpolatedUnivariateSpline as _spline import numpy as np import scipy.integrate as intg class NaNException(Exception): pass def hmf_integral_gtm(M, dndm, mass_densi...
StarcoderdataPython
1760057
<reponame>fredmorcos/attic class Emulator: """ This class is used to parse simulation output to find a certain posedge clock cycle. In other words, a clock cycle emulator. """ def __init__(self, machine, sim_data): """ Machine is the simulation's machine. SimData cannot be em...
StarcoderdataPython
150066
<reponame>thiagofigcosta/Pytho- #!/bin/python3 import math import sys import basic_external_file as ext import basic_external_regularpy_file as py print('This is Pytho{\}') print('') print('Running over Python {}.{}.{}'.format(sys.version_info[0],sys.version_info[1],sys.version_info[2])) print('Several tab...
StarcoderdataPython
3244287
<gh_stars>0 import streamlit as st import leafmap.kepler as leafmap import geopandas as gpd def app(): st.title("Kaavoituskohteet") st.markdown( """ Väritä ja visualisoi asemakaava-aineistoa kartan vasemmasta yläkulmasta avautuvan työkalupakin avulla. """ ) m = leafmap.Map(center=[60.17...
StarcoderdataPython
95534
<reponame>Wikia/ask-fandom<gh_stars>1-10 """ SemanticMediaWiki based intents """ from .base import SemanticFandomIntent from .tv_series import EpisodeFactIntent, PersonFactIntent from. wowwiki import WoWGroupsMemberIntent
StarcoderdataPython
196119
# web-app for API image manipulation from flask import Flask, request, render_template, send_from_directory import os from PIL import Image import tensorflow as tf import cv2 import numpy as np from model import generator_model app = Flask(__name__) APP_ROOT = os.path.dirname(os.path.abspath(__file__)) # default ac...
StarcoderdataPython
23054
from collections import deque import numpy as np import os from abc import ABCMeta, abstractmethod import random random.seed(42) from common import config, VehicleState from helper import Helper INFO = """Average merging time: {} s Traffic flow: {} vehicle/s Average speed: {} km/h Average fuel consumptio...
StarcoderdataPython
1691336
from argparse import ArgumentParser from transformers import RobertaTokenizerFast from common import TOKENIZER_PATH from common.config import config def main(): parser = ArgumentParser(description="Try custom trained tokenizer.") parser.add_argument("text", nargs="?", default="This is an example.", help="Text...
StarcoderdataPython
182206
<gh_stars>0 import random, requests, pendulum, hashlib, string, os, fnmatch class File(object): __DATA_PATH = os.path.abspath(os.path.join(os.path.dirname(__file__), 'data', 'filenames')) def __init__(self): self.__filename = None self.__full_path = None self._filenames = self.__check...
StarcoderdataPython
1729848
<gh_stars>0 import nltk import numpy as np import os import pickle import torch import torch.utils.data as data from multi_vocab import Vocabulary class PrecompMultiDataset(data.Dataset): def __init__(self, data_path, data_split, langs, vocab, load_img=True, img_dim=2048, cn_seg = True): s...
StarcoderdataPython
156106
import requests, json, re from requests import get def main(): n = 1 check = True while check == True: check = scrape(n) n = n+1 def scrape(n): if n > 403: n = n+1 url = 'https://xkcd.com/%d/info.0.json' %n r = requests.get(url) if r.status_code == 200: file =...
StarcoderdataPython
11682
<reponame>holoyan/python-data-validation from setuptools import setup, find_packages # read the contents of your README file from os import path this_directory = path.abspath(path.dirname(__file__)) with open(path.join(this_directory, 'README.md'), encoding='utf-8') as f: long_description = f.read() setup( na...
StarcoderdataPython
9925
# coding=utf-8 from nlpir.native.nlpir_base import NLPIRBase from ctypes import c_bool, c_char_p, c_int, POINTER, Structure, c_float class StDoc(Structure): __fields__ = [ ("sTitle", c_char_p), ("sContent", c_char_p), ("sAuthor", c_char_p), ("sBoard", c_char_p), ("sDatatype...
StarcoderdataPython
1620791
# Copyright 2020 The Cirq Developers # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # https://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in ...
StarcoderdataPython
3292395
<gh_stars>0 import logging from typing import Union from dff.core import Context, Actor logger = logging.getLogger(__name__) def multi_response( replies: list[str], confidences: Union[list, float] = 0.0, human_attr: Union[list, dict] = {}, bot_attr: Union[list, dict] = {}, hype_attr: Union[list...
StarcoderdataPython
41311
from base import CQPartsTest from base import testlabel # units under test from cqparts_fasteners.fasteners.nutbolt import NutAndBoltFastener # ---------- Test Assembly ---------- import cadquery import cqparts from partslib.basic import Box from cqparts import constraint from cqparts.utils import CoordSystem class...
StarcoderdataPython
70393
from django.core.management.base import BaseCommand, CommandError from shortener.models import LitresinURL class Command(BaseCommand): help = 'Refrehes all LitresinURL shortcodes' def add_arguments(self, parser): parser.add_argument('--items', type=int) def handle(self, *args, **options): ...
StarcoderdataPython
1672682
from flask import Flask, redirect, url_for, render_template, request, session, flash from datetime import timedelta from json_interpreter import * from api_caller import * app = Flask(__name__) app.secret_key = "supersecretkeyrighthere" app.permanent_session_lifetime = timedelta(hours=1) # enable if session is perman...
StarcoderdataPython
3291903
<gh_stars>1-10 # -*- coding: utf-8 -*- __version__ = "1.0" __date__ = "09.05.2016" __author__ = "<NAME>" from itertools import tee # conda install mingw libpython # conda install gensim from gensim import corpora, models from gensim.models import Phrases from sklearn.externals import joblib import pandas as pd from...
StarcoderdataPython
69335
# -*- coding: utf-8 -*- from .help import Help from .welcome import Welcome from .faq import FAQ from .events import Events from .scheduler import Scheduler from .polls import Polls from .search import Search from .newMembers import NewMembers from .info import Info from .mentorships import Mentorship # from .mentionN...
StarcoderdataPython
3299109
# Copyright (C) 2019 Google Inc. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writ...
StarcoderdataPython
1630818
<filename>server/client.py from connections import * from messages import * from thread import * from store import * import time class Client(object): def __init__(self, ip=PUBLIC): # super(Client, self).__init__t__() self.ip = ip self.id = None self._socket_sync = socket.socket(socket.AF_INET, socket.SOCK_...
StarcoderdataPython
3380512
<gh_stars>10-100 #_*_coding:utf-8_*_ __author__ = 'jidong' from django.conf.urls import patterns, include, url urlpatterns = patterns('iuser.views', url(r'^user/$', 'user', name='user'), url(r'^user/list/$', 'user_list', name='user_list'), url(r'^user/add/$', 'user_add', name='user_add'), u...
StarcoderdataPython
1735552
# Copyright (c) 2017 FlashX, LLC # # 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, merge, publish, distrib...
StarcoderdataPython
4810240
<reponame>jhoblitt/ltd-keeper """Lightweight library of Fastly API interactions needed by LTD Keeper. See https://docs.fastly.com/api/ for more information about the Fastly API. """ import logging import requests from .exceptions import FastlyError log = logging.getLogger(__name__) log.addHandler(logging.NullHandle...
StarcoderdataPython
149213
# # Copyright (c) 2013 - 2017, 2019 Software AG, Darmstadt, Germany and/or its licensors # # 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...
StarcoderdataPython
1694266
import random from timezones.forms import TIMEZONE_CHOICES from django.contrib.auth.models import User names = """<NAME> <NAME> <NAME> <NAME> <NAME> <NAME> <NAME>annah <NAME> <NAME> <NAME> <NAME> <NAME> """ surnames = """<NAME> <NAME> <NAME> <NAME> <NAME> <NAME> <NAME> <NAME> <NAME> <NAME> <NAME> <NAME>...
StarcoderdataPython
1620839
# -- coding: utf-8 -- # Copyright 2018 <NAME> <<EMAIL>> """ Module to handle block type used in iontof file formats ITA,ITM,ITS, etc... """ import sys import binascii import struct import os class MissingBlock(Exception): def __init__(self, parent, name, index): self.block_name = parent.parent+'/'+name ...
StarcoderdataPython
152257
# -*- coding: utf-8 -*- # Part of Odoo. See LICENSE file for full copyright and licensing details. import tempfile from odoo import api, fields, models, tools, _ from odoo.exceptions import UserError class BaseUpdateTranslations(models.TransientModel): _name = 'base.update.translations' _description = 'Upda...
StarcoderdataPython
1747315
<gh_stars>1-10 # encoding: utf-8 from six.moves.urllib.parse import quote import webhelpers import ckan.lib.search as search from ckan.tests.legacy import setup_test_search_index from ckan.tests.legacy.functional.api.base import * from ckan.tests.legacy import TestController as ControllerTestCase class PackageSear...
StarcoderdataPython
3380909
<filename>tests/integration/test_users_and_roles.py<gh_stars>0 import src.superannotate as sa from tests.integration.base import BaseTestCase class TestUserRoles(BaseTestCase): PROJECT_NAME = "test users and roles" PROJECT_DESCRIPTION = "Desc" PROJECT_TYPE = "Vector" def test_users_roles(self): ...
StarcoderdataPython
107712
<reponame>done1892/Square-Images-Colorization import numpy as np import os import shutil import re from requests import get from bs4 import BeautifulSoup from io import BytesIO from PIL import Image import cv2 as cv def scrape_google_image(url, name_folder): """This function scrapes images from an URL coming from ...
StarcoderdataPython
1691949
# doc-export: VideoViewer """ This example demonstrates how static files can be served by making use of a static file server. If you intend to create a web application, note that using a static server is a potential security risk. Use only when needed. Other options that scale better for large websites are e.g. Nginx,...
StarcoderdataPython
35731
#!/usr/bin/env python """ Generates a list of OS X system events into a plist for crankd. This is designed to create a large (but probably not comprehensive) sample of the events generated by Mac OS X that crankd can tap into. The generated file will call the 'tunnel.sh' as the command for each event; said fail can ...
StarcoderdataPython
1638434
<gh_stars>0 __author__ = 'umran'
StarcoderdataPython
1661205
<reponame>BatsResearch/taglets import torch import torch.nn as nn from torch.nn import init from allennlp.nn.util import masked_max, masked_mean, masked_softmax from taglets.modules.zsl_kg_lite.utils.core import pad_tensor, base_modified_neighbours class AttnAggregator(nn.Module): def __init__(self, features, i...
StarcoderdataPython
46190
<reponame>lipovsek/avalanche<filename>avalanche/models/generator.py ################################################################################ # Copyright (c) 2021 ContinualAI. # # Copyrights licensed under the MIT License. # # See the...
StarcoderdataPython
44057
<gh_stars>1000+ from .version import __version__ from dtreeviz.classifiers import clfviz
StarcoderdataPython
1718301
<filename>database/app.py from flask import Flask, request, jsonify, abort, send_file from pymongo import MongoClient from bson.objectid import ObjectId import os from dotenv import load_dotenv import json from operator import itemgetter import time import shutil load_dotenv() app = Flask(__name__) MONGO_URI = 'mong...
StarcoderdataPython
1728345
class DebevecMerge: def __init__(self, args): self.img_fn = args.imgs self.exposure_times = np.array(args.exposure_times, dtype=np.float32) if len(self.img_fn) != len(self.exposure_times): sys.stderr.write('List Size Error!') self.img_list = self.readImg() def Debe...
StarcoderdataPython
43682
<reponame>baseclue/codev import logging LOGLEVELS = { 'info': logging.INFO, 'debug': logging.DEBUG, } actual_loglevel = 'info' class LoglevelFilter(logging.Filter): def __init__(self, loglevel): self.loglevel = loglevel super().__init__() def filter(self, record): if record...
StarcoderdataPython
4802595
# Copyright Contributors to the Rez project # # 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 ...
StarcoderdataPython
3218120
<filename>pypulse/__init__.py __all__ = ["archive", "Archive", "singlepulse", "SinglePulse", "dynamicspectrum", "DynamicSpectrum", "par", "Par", "Parameter", "tim", "Tim", "TOA", "utils"] __version__ = 0.1 from pypulse.archive import Archive from pypulse.singlepulse import SinglePulse from pypul...
StarcoderdataPython
125546
<filename>scripts/multi_result_summary.py # Requires nuspacesim and tabulate # # pip install nuspacesim tabulate # # Usage: # # python multi_result_summary directory/with/simulation/files/ import os import sys from tabulate import tabulate import nuspacesim as nss if __name__ == "__main__": results = list() ...
StarcoderdataPython
1732002
from nnet.optim.optimizer import Optimizer import numpy as np import nnet.cuda class SGD(Optimizer): def __init__(self, lr=0.01, momentum=0.0): super(SGD, self).__init__() self.lr = lr self.momentum = momentum self.vs = {} def update_one(self, param): xp = nnet.cuda.get...
StarcoderdataPython
89351
from octosql_py import octosql_py from octosql_py.core.storage.json import OctoSQLSourceJSON from octosql_py.core.storage.static import OctoSQLSourceStatic import octosql_py_native octo = octosql_py.OctoSQL() conn = octo.connect([ OctoSQLSourceStatic("lol", [ { "a": 99 } ]), OctoSQLSourceJSON("lol...
StarcoderdataPython
1631635
def test_polkadot_service_file(host): if host.ansible.get_variables()['inventory_hostname'] == 'public': svc = host.file('/etc/systemd/system/polkadot.service') assert svc.exists assert svc.user == 'root' assert svc.group == 'root' assert svc.mode == 0o600 assert svc....
StarcoderdataPython
166702
import os from matplotlib.pyplot import figure import matplotlib.pyplot as plt from textwrap import wrap from src.output_option.output_option import OutputOptionInterface class GraphOutputOption(OutputOptionInterface): def __init__(self, **kwargs): """ Args: dir_path: Path to dir. ...
StarcoderdataPython
4825509
from crop import Crop class Wheat(Crop): # A wheat crop def __init__(self) -> None: super().__init__(1, 1, 1) self._type = "Wheat"
StarcoderdataPython
1659955
<gh_stars>0 #!/usr/bin/env python3 # # This script is meant for testing functionalities # import requests from pprint import pprint import json import argparse import RPi.GPIO as GPIO import time import os # CONSTANTS SCRIPT_PATH = os.path.dirname(os.path.realpath(__file__)) PIR_InPin = 38 PIN_TRIGGER = 16 PIN_ECHO ...
StarcoderdataPython
42893
## the noise masks of funcSize are not binarized, this script is to binarize them import os, json import nibabel as nib import numpy as np from scipy import ndimage # initalize data work_dir = '/mindhive/saxelab3/anzellotti/forrest/output_denoise/' all_subjects = ['sub-01', 'sub-02', 'sub-03', 'sub-04', 'sub-05', 'sub...
StarcoderdataPython
4840776
<reponame>prekolna/AlgorithmsGreatestHits import unittest from .unionfind import UnionFind class UnionFindTests(unittest.TestCase): def setUp(self): self.nodes = ['a', 'b', 'c', 'd', 'e', 'f', 'g', 'h'] self.U = UnionFind(self.nodes) def test_find_pre_union(self): self.assertEqual(self...
StarcoderdataPython
1658530
<filename>pantsuBooru/backend/test.py from discord.ext import commands commands
StarcoderdataPython
27540
<filename>kubelet/datadog_checks/kubelet/summary.py # (C) Datadog, Inc. 2018-present # All rights reserved # Licensed under Simplified BSD License (see LICENSE) from __future__ import division from fnmatch import fnmatch from datadog_checks.base.utils.tagging import tagger from .common import replace_container_rt_pr...
StarcoderdataPython
3214654
<reponame>skrat/martinez<gh_stars>1-10 from hypothesis import strategies from tests.integration_tests.factories import ( make_cyclic_bound_with_ported_sweep_events, to_bound_with_ported_points_pair, to_bound_with_ported_sweep_events) from tests.integration_tests.utils import ( bound_with_ported_edges_t...
StarcoderdataPython
155859
""" A playful implementation of the famous "German Tank Problem" in statistics. First, the random number generator populates a list of "tanks", represented by sequential serial numbers. The numbers are added to the list in random order until they run out. We then choose the sample size, representi...
StarcoderdataPython
186296
import re import sys import json from ensmallen import Graph from .utils import build_path from .parsers import DocParser def doc_analysis(args): with open(build_path("results/analysis.json"), "r") as f: analysis = json.load(f) result = {} for values in analysis.values(): for function in ...
StarcoderdataPython
1700069
<gh_stars>0 from pylatex import Document, Section, StandAloneGraphic, NewPage from pylatex.utils import bold import sys import json def fill_document(): with open('./temp/explanations/explanations.json') as f: data = json.load(f) doc = Document() for element in data['elements']: date = el...
StarcoderdataPython
3378732
import os import glob import xml.etree.ElementTree as ET import numpy import soundfile def main(): for f in glob.glob("*/**/*.xps"): t = ET.parse(f) r = t.getroot() d = recurse_tree(r) if not d: continue dirname = os.path.dirname(f) irname = d["IRFileNam...
StarcoderdataPython
3295414
<reponame>tefra/xsdata-w3c-tests from dataclasses import dataclass, field from typing import Dict, Optional @dataclass class AnyAttr: class Meta: name = "anyAttr" id1: Optional[str] = field( default=None, metadata={ "type": "Attribute", } ) any_attributes: ...
StarcoderdataPython
78946
from collections import Counter from analysis.computation import utils def frequency(ambitus_list): freq = Counter(ambitus_list) r = [['Ambitus', 'Pieces']] for k, v in sorted(freq.items()): r.append([k, v]) return r def frequency_pie(ambitus_list): r = utils.aux_pie_chart(Counter(ambit...
StarcoderdataPython
155395
import argparse import os import sys class Opts(object): def __init__(self): #self.parser = argparse.ArgumentParser() #task self.task = 'ddd' #'ddd, lane' self.task = self.task.split(',') self.dataset = 'kitti' #'coco' self.test_dataset = 'kitti' #'coco' self.debug_mode = 0 sel...
StarcoderdataPython
1634266
import re # Fuzzy matching is commonly rather handled useing levenshtein-distance # e.g. https://github.com/seatgeek/fuzzywuzzy def fuzzify(query): regex = r'(?:.*?' + re.sub(r'(.)', r'(\1).*?', query) + ')' return regex def fuzzyScore(pattern, reference): result = re.match(fuzzify(pattern), reference, f...
StarcoderdataPython
4828603
import logging from nni.assessor import Assessor, AssessResult _logger = logging.getLogger('NaiveAssessor') _logger.info('start') _result = open('/tmp/nni_assessor_result.txt', 'w') class NaiveAssessor(Assessor): def __init__(self, optimize_mode): self._killed = set() _logger.info('init') de...
StarcoderdataPython
1690030
<gh_stars>1-10 # =============================================================================== # Copyright 2017 dgketchum # # 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.apac...
StarcoderdataPython
1632306
<gh_stars>10-100 import time import os, tarfile, io import numpy as np from .utils import download_dataset _urls = { "http://ai.stanford.edu/~acoates/stl10/stl10_binary.tar.gz": "stl10_binary.tar.gz", } classes = [ "airplane", "bird", "car", "cat", "deer", "dog", "horse", "monkey...
StarcoderdataPython
1658114
<gh_stars>1-10 from .fp import UpperFingerprint
StarcoderdataPython
43277
#!/usr/bin/env python # -*- coding: utf-8 -*- # # rtk.hardware.component.resistor.fixed.Wirewound.py is part of the RTK # Project # # All rights reserved. # Copyright 2007 - 2017 <NAME> andrew.rowland <AT> reliaqual <DOT> com # # Redistribution and use in source and binary forms, with or without # modifica...
StarcoderdataPython
189537
<filename>setup.py from setuptools import ( setup, find_packages, ) setup( name='lookuper', use_scm_version=True, description='Lookup nested data structures', long_description=open('README.rst').read(), url='https://github.com/cr3/lookuper', author='<NAME>', author_email='<EMAIL>',...
StarcoderdataPython
3291755
#! /usr/bin/env python # -*- coding: iso-8859-1 -*- import re, os from xml.dom.minidom import parse, parseString from DdlCommonInterface import DdlCommonInterface, g_dbTypes from OracleInterface import DdlOracle from PostgreSQLInterface import DdlPostgres from MySqlInterface import DdlMySql from FirebirdInterface impo...
StarcoderdataPython
1615492
<gh_stars>0 from keras.layers import Input, Conv2D, MaxPooling2D, UpSampling2D from keras.layers import Flatten, Dense, Reshape, Dropout, Activation from keras.layers import SpatialDropout2D from keras.regularizers import l1 from keras.models import Model def create_model(): _input_img = Input(shape=(28, 28, 1)) ...
StarcoderdataPython
58129
<gh_stars>0 # standard libraries import argparse from collections import defaultdict, OrderedDict import copy import glob import os import csv from pathlib import Path from typing import Tuple # third-party libraries import editdistance import torch import tqdm # project libraries from evaluate.eval import run_eval im...
StarcoderdataPython
3396211
import matplotlib.pyplot as plt import numpy as np import argparse def plot_iq(iq, np_data_type, frequency, sample_rate): """Plots the power spectrum of the given I/Q data. Args: iq: String containing alternating I/Q pairs (e.g. IQIQIQIQIQ..etc) dtype: numpy dtype to interpret the data as. Ra...
StarcoderdataPython
1617049
<reponame>sklam/sdc # -*- coding: utf-8 -*- # ***************************************************************************** # Copyright (c) 2019, Intel Corporation All rights reserved. # # Redistribution and use in source and binary forms, with or without # modification, are permitted provided that the following condit...
StarcoderdataPython
4841430
# -*- coding: utf-8 -*- # Part of Odoo. See LICENSE file for full copyright and licensing details. import re from odoo import fields, models, api, _ from odoo.exceptions import ValidationError class ResPartnerBank(models.Model): _inherit = 'res.partner.bank' aba_routing = fields.Char(string="ABA/Routing", h...
StarcoderdataPython
3349017
from flask import Flask, request, jsonify, url_for import db import traceback app = Flask(__name__) app.config['JSON_AS_ASCII'] = False @app.errorhandler(Exception) def exception_handler(error): tracelist = str(traceback.format_exc()).split('\n') return jsonify({"message":"Internal server error","trace":tra...
StarcoderdataPython
3368880
from mycroft.skills.core import MycroftSkill, intent_handler, intent_file_handler from mycroft.messagebus.message import Message class PetFish(MycroftSkill): def __init__(self): super(PetFish, self).__init__(name="PetFish") def initialize(self): self.gui.register_handler("pet.fish.clo...
StarcoderdataPython
3291250
#!/usr/bin/env python import sys inFile = open(sys.argv[1]) outFile = open(sys.argv[2], 'w') for line in inFile: vals = line.split() outFile.write(">"+vals[0]+"\n") outFile.write(vals[1]+"\n") outFile.close()
StarcoderdataPython
3201590
"""This module provides objects for managing the network balancer.""" from contextlib import contextmanager from typing import Dict, List from docker.models.containers import Container from loguru import logger from pydantic import BaseModel as Base from .circuit import OnionCircuit from .client import ContainerBase...
StarcoderdataPython
145712
<filename>04-Python/lexer/lexer_test.py import sys sys.path.append('..') import unittest from lexer import new from tokens import TokenType class TestNextToken(unittest.TestCase): def test_next_token(self): input = 'let five = 5; \ let ten = 10; \ let add = fn(x, y) { \ ...
StarcoderdataPython
80993
from django.db import models from django.contrib.auth.models import User from django.contrib import admin class Profile(models.Model): user = models.OneToOneField(User) created_at = models.DateTimeField(auto_now_add=True) modified_at = models.DateTimeField(auto_now=True) handle = models.CharField(max_...
StarcoderdataPython
18140
<gh_stars>10-100 """ Compute Dice between test ground truth and predictions from groupwise registration. """ import os import nibabel as nib import glob import numpy as np from core import utils_2d from core.metrics_2d import OverlapMetrics def one_hot_label(label, label_intensity): gt = np.around...
StarcoderdataPython
9483
<reponame>chenmich/google-ml-crash-course-exercises<filename>quick_pandas.py<gh_stars>0 import pandas as pd print(pd.__version__) city_names = pd.Series(['San Francisco', 'San Jose', 'Sacramento']) population = pd.Series([852469, 1015785, 485199]) #city_population_table = pd.DataFrame(({'City name': city_names, 'Popula...
StarcoderdataPython
113595
<reponame>GnomGad/KworkBrowser<gh_stars>0 import sys from src.core import execute_from_command_line def main(): execute_from_command_line(sys.argv[1:]) #execute_from_command_line(["get","-p","0"]) if __name__ == "__main__": main()
StarcoderdataPython
3348288
<gh_stars>0 from django.shortcuts import render, redirect from django.http import JsonResponse, HttpResponse from django.contrib.auth import authenticate, login, logout from decimal import Decimal from django.conf import settings import json import datetime from django.contrib import messages from django.core.mail i...
StarcoderdataPython
49654
<reponame>snowxmas/alipay-sdk-python-all<gh_stars>100-1000 #!/usr/bin/env python # -*- coding: utf-8 -*- import json from alipay.aop.api.constant.ParamConstants import * from alipay.aop.api.domain.TiansuoIsvBindVO import TiansuoIsvBindVO class AntMerchantExpandIndirectTiansuoBindModel(object): def __init__(self...
StarcoderdataPython
77486
import tensorflow as tf import os import zipfile from os import path, getcwd, chdir import os train_happy_dir = os.path.join('/Users/seanjudelyons/Downloads/happy-or-sad/happy/') # the zip file had the folders called horses and humans train_sad_dir = os.path.join('/Users/seanjudelyons/Downloads/happy-or-sad/sad/') ...
StarcoderdataPython
4805562
<reponame>marcosfpr/match_up_lib import unittest from matchup.models.algorithms import ExtendedBoolean from matchup.structure.solution import Result from matchup.structure.weighting.tf import TermFrequency from matchup.structure.weighting.idf import InverseFrequency from . import set_up_pdf_test, set_up_txt_test cl...
StarcoderdataPython
91787
#!/usr/bin/env python # -*- coding: utf-8 -*- """Tests for `pcuf` package.""" import hashlib import warnings import pytest import pcuf from tests.utils import TEST_DIR @pytest.fixture def file(request): test_file = TEST_DIR / "foo.txt" content = "hello" with open(str(test_file), "w+") as f: f....
StarcoderdataPython
129579
def my_init(shape, dtype=None): array = np.array([ [0.0, 0.2, 0.0], [0.0, -0.2, 0.0], [0.0, 0.0, 0.0], ]) # adds two axis to match the required shape (3,3,1,1) return np.expand_dims(np.expand_dims(array,-1),-1) conv_edge = Sequential([ Conv2D(kernel_size=(3,3), filters=1,...
StarcoderdataPython
96225
# Consume: CONSUMER_KEY = '' CONSUMER_SECRET = '' # Access: ACCESS_TOKEN = '' ACCESS_SECRET = ''
StarcoderdataPython
4834180
<gh_stars>100-1000 """ antecedent_consequent.py : Contains Antecedent and Consequent classes. """ import networkx as nx import numpy as np from .fuzzyvariable import FuzzyVariable from .state import StatefulProperty def accumulation_max(*args): """ Take the maximum of input values/arrays. This is the de...
StarcoderdataPython
1781903
<gh_stars>0 """ Includes functions for reading and writing graphs, in a very simple readable format. """ # Version: 30-01-2015, <NAME> # Version: 29-01-2017, <NAME> # updated 30-01-2015: writeDOT also writes color information for edges. # updated 2-2-2015: writeDOT can also write directed graphs. # updated 5-2-2015: n...
StarcoderdataPython
3387005
<filename>tests/providers/amazon/aws/sensors/test_eks.py # Licensed to the Apache Software Foundation (ASF) under one # or more contributor license agreements. See the NOTICE file # distributed with this work for additional information # regarding copyright ownership. The ASF licenses this file # to you under the Apa...
StarcoderdataPython
95048
<reponame>LukasK13/ESBO-ETC<gh_stars>0 from .AOpticalComponent import AOpticalComponent from ..IRadiant import IRadiant from ..SpectralQty import SpectralQty from ..Entry import Entry import astropy.units as u from typing import Union class StrayLight(AOpticalComponent): """ A class to model additional stray ...
StarcoderdataPython
45519
#!/usr/bin/env python #-*- coding: utf-8 -*- import threading import traceback import sys import os import shutil import zipfile from subprocess import Popen, PIPE from re import search from datetime import datetime from call_helper import CallHelper from os.path import basename class OtherException(Exception): ...
StarcoderdataPython