id
stringlengths
1
8
text
stringlengths
6
1.05M
dataset_id
stringclasses
1 value
4900284
from pso import pso from optitestfuns import ackley import unittest import math intVar = [] result = pso(ackley, [-5,-5], [5,5], intVar) print(result.exit) print('x_opt: {}'.format(result.xopt)) print('FO: {:2e}'.format(result.FO))
StarcoderdataPython
8136335
<gh_stars>0 import math import numpy as np def flattenpoints(points, verticalz = True): if verticalz: vert = 2 else: vert = 1 for i in range(len(points)): points[i][vert] = 0 def slice(mesh, vertical, verticalz = True, json_serialize=False): points = np.asarray(...
StarcoderdataPython
3586075
# -*- coding: utf-8 -*- from django.conf import settings from django.contrib.auth import get_user_model from django.db.models import Prefetch from django.db.models.fields import NOT_PROVIDED from django.template.loader import render_to_string from comments.models import Comment User = get_user_model() class Search...
StarcoderdataPython
4881457
<filename>web/ptonprowl/students/views.py # django imports from django.contrib.auth.mixins import LoginRequiredMixin from django.http import HttpResponseRedirect, HttpResponse from django.shortcuts import get_object_or_404, render from django.urls import reverse from django.views import generic # project imports from ...
StarcoderdataPython
3263097
<filename>scripts/x_model_gen.py """ This is a small script for generating the initial Go model from the olca-schema yaml files. To run this script you need to have PyYAML installed: pip install pyyaml You also have to configure the YAML_DIR in this script to point to the directory where the YAML files are ...
StarcoderdataPython
5050308
from concurrent import futures import time import logging import sys import grpc import util import example_pb2_grpc as pbgrpc import example_pb2 as pb _ONE_DAY_IN_SECONDS = 60 * 60 * 24 # functions to validate def xor_cipher(key: str, in_str: str) -> str: key_len = len(key) ks = bytearray(key, encoding='u...
StarcoderdataPython
93187
"""Python package treeplot vizualizes a tree based on a randomforest or xgboost model.""" # -------------------------------------------------- # Name : treeplot.py # Author : E.Taskesen # Contact : <EMAIL> # github : https://github.com/erdogant/treeplot # Licence : See Licences # --------------...
StarcoderdataPython
3432672
<filename>setup.py # -*- coding: utf-8 -*- from setuptools import setup setup( name="triggercmd_cli", version="0.1.0", url="https://github.com/GussSoares/triggercmd-cli", license="MIT License", author="<NAME>", author_email="<EMAIL>", keywords="triggercmd alexa echo-dot cli archlinux manjar...
StarcoderdataPython
11314771
import os import re import shutil from sinolify.converters.base import ConverterBase from sinolify.converters.mapping import ConversionMapping from sinolify.utils.log import log, warning_assert, error_assert, die from sinolify.heuristics.limits import pick_time_limits class SowaToSinolConverter(ConverterBase): "...
StarcoderdataPython
9744911
<reponame>mikeengland/fireant<gh_stars>1-10 from .builder import *
StarcoderdataPython
9617264
import os import pathlib import torch SEED_VALUE = 42 PROJECT_ROOT = os.path.abspath(os.path.join(os.path.dirname(__file__), os.pardir)) LOCAL_DATA_LIMIT = 75000 TORCH_DEVICE = torch.device("cuda" if torch.cuda.is_available() else "cpu") DATA_FOLDER = os.path.join(PROJECT_ROOT, "data") EMBEDDINGS_FOLDER = os.path.joi...
StarcoderdataPython
3304006
<reponame>meals-app/django-graphql-auth from .settings import * GRAPHQL_AUTH = { "ALLOW_DELETE_ACCOUNT": True, "REGISTER_MUTATION_FIELDS": {"email": "String", "username": "String"}, "UPDATE_MUTATION_FIELDS": ["first_name", "last_name"], "ALLOW_LOGIN_NOT_VERIFIED": False, } INSTALLED_APPS += ["tests"] ...
StarcoderdataPython
4826038
import math from pathlib import Path import matplotlib.pyplot as plt from PIL import Image import torch import torch.nn as nn import torch.nn.functional as F from torchvision import transforms class Net(nn.Module): def __init__(self): super().__init__() # N = (W - F + 2P) / S + 1 self.con...
StarcoderdataPython
1759474
from graph_tool import GraphView import numpy as np def number_of_classes( D, edge_labels=np.empty(0), stats=dict(), print_stats=False ): """counts the number of different classes""" if edge_labels is None or edge_labels.size == 0: edge_labels = np.array( [ D.ep.c0[p] for p in D.get_edges() ] ) #...
StarcoderdataPython
6545317
from old import * import graphics import spin2008 import run5note
StarcoderdataPython
30642
from serendipity.linear_structures.singly_linked_list import LinkedList class Set: def __init__(self): self._list = LinkedList() def get_size(self): return self._list.get_size() def is_empty(self): return self._list.is_empty() def contains(self, e): return self._list...
StarcoderdataPython
6700977
<filename>treadmill/api/trace.py """Implementation of state API.""" import logging from .. import context from .. import schema from .. import exc from .. import zknamespace as z _LOGGER = logging.getLogger(__name__) class API(object): """Treadmill State REST api.""" def __init__(self): zkclien...
StarcoderdataPython
11357112
<filename>scrapper_app/spiders/kp_movies_spider.py from scrapy_redis.spiders import RedisSpider from scrapper_app.items import MovieDetailsItem from scrapper_app.loaders import load_movie_details import os class KpMoviesSpider(RedisSpider): """ Предоставляет парсер страниц кинофильмов с kinopoisk.ru. """ ...
StarcoderdataPython
8035704
import csv, codecs, cStringIO from django.http import HttpResponse # also include UnicodeWriter from the Python docs http://docs.python.org/library/csv.html class UTF8Recoder: """ Iterator that reads an encoded stream and reencodes the input to UTF-8 """ def __init__(self, f, encoding): self...
StarcoderdataPython
3247941
<gh_stars>0 # coding: utf-8 """Módulo para funciones de preprocesamiento de texto.""" import re def filtrar_cortas(texto, chars=0): """Filtra líneas en texto de longitud chars o inferior. Parameters ---------- texto : str Texto que se quiere filtrar. chars : int Mínimo número de c...
StarcoderdataPython
9624530
import pandas as pd import os import pyspark.sql def python_location(): """work out the location of the python interpretter - this is needed for Pyspark to initialise""" import subprocess import pathlib with subprocess.Popen("where python", shell=True, stdout=subprocess.PIPE) as subprocess_return: ...
StarcoderdataPython
6688405
<reponame>mikimaus78/ml_monorepo<filename>statarb/src/python/bin/fsck_attr.py #!/usr/bin/env python import util import newdb def main(): util.info("Checking Attributes") for table in ('co_attr_d', 'co_attr_n', 'co_attr_s', 'sec_attr_s', 'sec_attr_n'): print "Looking at %s" % table if table.sta...
StarcoderdataPython
232081
<reponame>ywen666/CodeXGLUE<filename>Code-Code/CodeCompletion-token/code/dataset.py # Copyright (c) Microsoft Corporation. # Licensed under the MIT License. from __future__ import absolute_import, division, print_function import argparse import glob import logging import os import pickle import random import re import...
StarcoderdataPython
6652209
<reponame>pylangstudy/201707<gh_stars>0 #dir() は主に対話プロンプトでの使用に便利なように提供されている #厳密性や一貫性を重視して定義された名前のセットというよりも、むしろ興味を引くような名前のセットを返す print(dir()) class A: pass print() print(dir(A)) print() print(dir(A())) class B: def __dir__(self): return ['BBB'] print() print(dir(B)) print() print(dir(B()))
StarcoderdataPython
1784055
# emacs: -*- mode: python; py-indent-offset: 4; indent-tabs-mode: nil -*- # vi: set ft=python sts=4 ts=4 sw=4 et: """ Use Mayavi to visualize the structure of a VolumeGrid """ from enthought.mayavi import mlab import numpy as np from enthought.tvtk.api import tvtk dims = (4, 4, 4) x, y, z = np.mgrid[0.:dims[0], 0:di...
StarcoderdataPython
370209
# from app import app import urllib.request import json from .models import Source,Article # Source = source.Source # Getting api key api_key = None # Getting the news base url source_base_url = None article_base_url = None def configure_request(app): ''' Function to acquire the api key and base urls ''' glo...
StarcoderdataPython
11204832
from django.contrib import admin from .models import Book @admin.register(Book) class ExamplesAdmin(admin.ModelAdmin): list_display = ('id', 'title', 'publication_date', 'author', 'price', 'pages', 'book_type', 'timestamp', 'editora')
StarcoderdataPython
6403004
<reponame>VirtualVFix/AndroidTestFramework # All rights reserved by forest fairy. # You cannot modify or share anything without sacrifice. # If you don't agree, keep calm and don't look at code bellow! __author__ = "VirtualV <https://github.com/virtualvfix>" __date__ = "09/27/17 14:58" from .base import Base class ...
StarcoderdataPython
3597183
# coding: utf-8 """ Module `chatette.units.ast` Contains the data structure holding the Abstract Syntax Tree generated when parsing the template files. NOTE: this is not exactly an AST as it is not a tree, but it has the same purpose as an AST in a compiler, i.e. an intermediate representation of the parsed...
StarcoderdataPython
4942120
# -*- coding:utf8 -*- from PyQt5.QtGui import * from PyQt5.QtCore import * from PyQt5.QtWidgets import * from base.logger import LOG class MusicTableWidget(QTableWidget): """显示音乐信息的tablewidget """ signal_play_music = pyqtSignal([int], name='play_music') signal_remove_music_from_list = pyqtSignal([...
StarcoderdataPython
9685194
<gh_stars>0 # -*- coding: utf-8 -*- """ Part of slugdetection package @author: <NAME> github: dapolak """ name = "slugdetection" __all__ = ["Data_Engineering", "confusion_mat", "Slug_Labelling", "Flow_Recognition", "Slug_Detection", "Slug_Forecasting"] from slugdetection.Data_Engineering import Data_Engi...
StarcoderdataPython
3322203
try: import RPi.GPIO as gpio except: import x007007007.RPi.GPIO as gpio class _GPIOPins(object): def __init__(self): self._pins = {} def __getitem__(self, key): return self._pins[key] def __setitem__(self, key, value): self._pins[key] = value def __getattribute__(self...
StarcoderdataPython
8153738
<reponame>Genomicsplc/ukb-pret import numpy import os import pandas from tempfile import TemporaryDirectory import unittest from ukb_pret._io import load_phenotype_dictionary from ukb_pret.error import UkbPretImportError from ukb_pret.evaluate import _get_overlapping_results, _filter_null_values, _infer_ancestry_from_...
StarcoderdataPython
4975123
<filename>cloudmesh/nn/service/nfl_2019.py import sys import os import pandas import numpy as np import matplotlib.pyplot as plt from scipy.spatial import distance # prompt user for file name to read, assuming this is a csv pwd = os.getcwd() pwd = str(pwd) + "/" file_name = input("Enter the name of the file including ...
StarcoderdataPython
4925275
import pwd import gevent import pytest from mock import MagicMock from volttron.platform import is_rabbitmq_available from volttron.platform import get_services_core from volttron.platform.agent.utils import execute_command from volttron.platform.vip.agent import * from volttrontesting.fixtures.volttron_platform_fixt...
StarcoderdataPython
1848978
<filename>11/specop.py #!/usr/bin/python3 import sys from brilpy import * PROFILE = 'profile.txt' def main(): prog = json.load(sys.stdin) # Hack to make brench work: we wait to open 'profile.txt' until *after* # we've finished reading from stdin trace = json.load(open(PROFILE)) mainfunc = list(...
StarcoderdataPython
4937101
<gh_stars>0 from typing import List from pybm import __version__ from pybm.command import CLICommand from pybm.status_codes import SUCCESS, ERROR class BaseCommand(CLICommand): """ Commands: apply - Run a benchmarking workflow specified in a YAML file. config - Display and change pybm configurati...
StarcoderdataPython
251168
from lxml import html from base_test import BaseTest import model from database import db_session class ProblemsTestCase(BaseTest): """ Contains tests for the problems blueprint """ def _problem_add(self, init_problem_name): rv = self.app.post( "/admin/problems/add/", ...
StarcoderdataPython
8120185
<reponame>tstu92197t/SC-project """ File: hangman.py name: <NAME> ----------------------------- This program plays hangman game. Users sees a dashed word, trying to correctly figure the un-dashed word out by inputting one character each round. If the user input is correct, show the updated word on console. Players have...
StarcoderdataPython
4859315
<filename>common/__init__.py # -*- coding: utf-8 -*- # @Time : 2021/3/25 10:37 AM import base64 import hashlib import hmac import json import time from hashlib import md5 from Crypto.Cipher import AES def token(message, enc=False, expire=3600 * 24): """ token加密解密算法 :param message: :param enc: ...
StarcoderdataPython
41942
<gh_stars>0 import git from zeppos_root.root import Root from zeppos_logging.app_logger import AppLogger from cachetools import cached, TTLCache class Branch: @staticmethod @cached(cache=TTLCache(maxsize=1024, ttl=600)) def get_current(): g = git.cmd.Git(Root.find_root_of_project(__file__)) ...
StarcoderdataPython
3379522
<gh_stars>10-100 # Definition for singly-linked list. # class ListNode: # def __init__(self, x): # self.val = x # self.next = None class Solution: def rotateRight(self, head, k): """ :type head: ListNode :type k: int :rtype: ListNode """ if not h...
StarcoderdataPython
5004638
<gh_stars>0 from flask import Flask, render_template, jsonify, redirect from splinter import Browser from flask_pymongo import PyMongo import pymongo import scrape_mars app = Flask(__name__) # Use flask_pymongo to set up mongo connection # app.config["MONGO_URI"] = "mongodb://localhost:27017/mars_app" # m...
StarcoderdataPython
12851152
<gh_stars>0 import struct import zlib from wrpg.piaf.common import ( header_structure, file_entry_structure, file_entry_size, get_data_offset, header_size, header_check_size, header_data_size) class ParserError(Exception): pass class ParserMagicHeaderError(ParserError): pass class...
StarcoderdataPython
1893927
# locust -f locustfile.py from locust import HttpUser, between, task class WebsiteUser(HttpUser): wait_time = between(5, 15) def on_start(self): self.client.post("/login", { "username": "test_user", "password": "" }) @task def index(self): # se...
StarcoderdataPython
1783927
r""" Interfaces for primitives of the :py:mod:`cobald` model Each :py:class:`~.Pool` provides a varying number of resources. A :py:class:`~.Controller` adjusts the number of resources that a :py:class:`~.Pool` must provide. Several :py:class:`~.Pool`\ s can be combined in a single :py:class:`~.CompositePool` to appear...
StarcoderdataPython
8084280
<reponame>RAIJ95/https-github.com-failys-cairis # Licensed to the Apache Software Foundation (ASF) under one # or more contributor license agreements. See the NOTICE file # distributed with this work for additional information # regarding copyright ownership. The ASF licenses this file # to you under the Apache ...
StarcoderdataPython
1944739
<reponame>StephenRoille/flit from pathlib import Path import pytest from flit.inifile import read_flit_config, ConfigError samples_dir = Path(__file__).parent / 'samples' def test_invalid_classifier(): with pytest.raises(ConfigError): read_flit_config(samples_dir / 'invalid_classifier.ini') def test_cla...
StarcoderdataPython
6694720
# Copyright 2019 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, ...
StarcoderdataPython
1730244
from tkinter import * from tkinter import ttk from tkinter import filedialog # your code goes between window and window.mainloop window = Tk() window.title('Writy') window.configure(background = 'gray1') # function for saving file def save(event): with open('text.txt', 'w') as file: file.write(text1.get("1.0",'en...
StarcoderdataPython
12863227
# SPDX-FileCopyrightText: 2021 Carnegie Mellon University # # SPDX-License-Identifier: Apache-2.0 import logging import cv2 from busedge_protocol import busedge_pb2 from gabriel_protocol import gabriel_pb2 from sign_filter import SignFilter logger = logging.getLogger(__name__) import argparse import multiprocessing...
StarcoderdataPython
11318136
<reponame>netinvent/ofunctions<gh_stars>1-10 #! /usr/bin/env python # -*- coding: utf-8 -*- # # This file is part of ofunctions package """ ofunctions is a general library for basic repetitive tasks that should be no brainers :) Versioning semantics: Major version: backward compatibility breaking changes Min...
StarcoderdataPython
8077349
<filename>transfer_learning/neuralnet.py import tensorflow as tf from tensorflow.keras import Model from tensorflow.keras.models import Sequential from tensorflow.keras.layers import Dense, InputLayer, Dropout, Conv1D, Flatten, Reshape, MaxPooling1D, BatchNormalization, Conv2D, GlobalMaxPooling2D, Lambda from tensorflo...
StarcoderdataPython
6477709
<filename>resolucao/numpy/x2.py import matplotlib.pyplot as plt import numpy as np x = np.linspace(0, 2, 15) plt.plot(x, x**2, marker='o') plt.show()
StarcoderdataPython
4855729
# CWrap imports from cwrap.backend import cw_ast from cwrap.config import ASTContainer # Local package imports import c_ast def find_toplevel_items(items): """ Finds and returns the toplevel items given a list of items, one of which should be a toplevel namespace node. """ for item in items: ...
StarcoderdataPython
11293878
import torch import torch.nn as nn import torch.nn.functional as F from torch.distributions import Normal from .layers import Encoder, Decoder, Discriminator from .utils_deep import Optimisation_AAE from ..utils.kl_utils import compute_mse import numpy as np from torch.autograd import Variable import pytorch_lightnin...
StarcoderdataPython
5182561
import argparse from oie_readers.extraction import Extraction if __name__ == '__main__': parser = argparse.ArgumentParser(description='combine conll') parser.add_argument('-inp', type=str, help='input conll files separated by ":"') parser.add_argument('-gold', type=str, help='gold conll file', default=None...
StarcoderdataPython
158939
<filename>setup.py<gh_stars>1-10 #!/usr/bin/env python from setuptools import setup, find_packages setup(name='shares_count', version='1.0', author='vlinhart', author_email='<EMAIL>', packages=find_packages(), include_package_data=True, install_requires=['socialshares~=1.0.0'], ...
StarcoderdataPython
6638399
<gh_stars>1-10 # built-in import json import pickle from pathlib import Path from time import time from typing import List # app from .cached_property import cached_property from .config import config class BaseCache: ext = '' def __init__(self, *keys, ttl: int = -1): self.path = Path(config['cache'...
StarcoderdataPython
3594425
<reponame>gmaterni/teimed2html<filename>writehtmlfile.py<gh_stars>1-10 #!/usr/bin/env python3 # -*- coding: utf-8 -*- import sys import argparse from teixml2lib.ualog import Log __date__ = "04-01-2021" __version__ = "0.1.0" __author__ = "<NAME>" logerr = Log("a") if __name__ == "__main__": logerr.open("log/wri...
StarcoderdataPython
4888526
<reponame>emencia/seantis-questionnaire # Create your views here. from django.shortcuts import render_to_response from django.conf import settings from django.template import RequestContext from django import http from django.utils import translation from models import Page def page(request, page): try: p ...
StarcoderdataPython
8179887
<filename>tests/unit/dataactvalidator/test_c14_award_financial_2.py from tests.unit.dataactcore.factories.staging import AwardFinancialFactory from tests.unit.dataactvalidator.utils import number_of_errors, query_columns _FILE = 'c14_award_financial_2' def test_column_headers(database): expected_subset = {'row_n...
StarcoderdataPython
4905165
<reponame>A-kriti/Amazing-Python-Scripts<filename>Zoom-Auto-Attend/zoomzoom.py import json import pyautogui import re import pyfiglet import getpass import platform from selenium import webdriver from selenium.webdriver.common.keys import Keys from selenium.webdriver.chrome.options import Options from clint.textui impo...
StarcoderdataPython
11356482
import RPi.GPIO as GPIO import os, sys, kintone, time from kintone import getCurrentTimeStamp GPIO.setmode(GPIO.BCM) # Start writing your program below sdomain = "SUB-DOMAIN-NAME" appId = "APP-ID-NUMBER" token = "APP-TOKEN" button = 19 buttonSwitch = 26 GPIO.setup(button, GPIO.OUT) GPIO.setup(buttonSwitch, GPIO.IN) ...
StarcoderdataPython
6629082
<reponame>Nightwish-cn/my_leetcode class Solution: def checkPerfectNumber(self, num): """ :type num: int :rtype: bool """ i, sum = 1, -num while i * i < num: if num % i == 0: sum += i + num // i i += 1 if i * i == num: ...
StarcoderdataPython
11383402
# -*- coding: utf-8 -*- # Copyright 2016 Yelp 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 ag...
StarcoderdataPython
331922
import unittest from programy.storage.stores.sql.dao.trigger import Trigger class TriggerTests(unittest.TestCase): def test_init(self): trigger1 = Trigger(name='name', trigger_class='class') self.assertIsNotNone(trigger1) self.assertEqual("<Trigger(id='n/a', name='name', trigger_cla...
StarcoderdataPython
11263610
<filename>flask_reddit/__init__.py #!/usr/bin/env python # -*- coding: utf-8 -*- from flask import Flask, render_template, url_for from flask.ext.sqlalchemy import SQLAlchemy from werkzeug.routing import BaseConverter app = Flask(__name__, static_url_path='/static') app.config.from_object('config') db = SQLAlchemy(ap...
StarcoderdataPython
1744912
from chainercv.chainer_experimental.datasets.sliceable import GetterDataset from chainercv.chainer_experimental.datasets.sliceable.sliceable_dataset \ import _is_iterable class TransformDataset(GetterDataset): """A sliceable version of :class:`chainer.datasets.TransformDataset`. Note that it requires :ob...
StarcoderdataPython
3314841
""" You are given an array A of strings. A move onto S consists of swapping any two even indexed characters of S, or any two odd indexed characters of S. Two strings S and T are special-equivalent if after any number of moves onto S, S == T. For example, S = "zzxy" and T = "xyzz" are special-equivalent because we ma...
StarcoderdataPython
8123586
<gh_stars>1-10 import re from w3af.plugins.attack.payloads.base_payload import Payload from w3af.core.ui.console.tables import table class gcc_version(Payload): """ This payload shows the current GCC Version """ def api_read(self): result = {} def parse_gcc_version(proc_version): ...
StarcoderdataPython
4909849
<reponame>frankier/sklearn-ann from sklearn.neighbors import KNeighborsTransformer from functools import partial BallTreeTransformer = partial(KNeighborsTransformer, algorithm="ball_tree") KDTreeTransformer = partial(KNeighborsTransformer, algorithm="kd_tree") BruteTransformer = partial(KNeighborsTransformer, algorit...
StarcoderdataPython
11575
import shutil from pathlib import Path from tempfile import mkdtemp import pytest from click.testing import CliRunner import ape # NOTE: Ensure that we don't use local paths for these ape.config.DATA_FOLDER = Path(mkdtemp()).resolve() ape.config.PROJECT_FOLDER = Path(mkdtemp()).resolve() @pytest.fixture(scope="ses...
StarcoderdataPython
8039464
# -*- coding: utf-8 -*- """ 校验提交信息是否包含规范的前缀 """ from __future__ import absolute_import, print_function, unicode_literals import sys try: reload(sys) sys.setdefaultencoding("utf-8") except NameError: # py3 pass ALLOWED_COMMIT_MSG_PREFIX = [ ("feature", "新特性"), ("bugfix", "线上功能bug"), ("min...
StarcoderdataPython
4987514
<reponame>gupta19avaneesh/DataScience import numpy as np import l21cca from sklearn.preprocessing import StandardScaler X=[np.random.randn(10,10) for i in range(10)] reduced1=l21cca.l21_cca(X,5) reduced2=l21cca.l21_cca(X,10,20,5,5)
StarcoderdataPython
6423884
from rdisq.service import RdisqService, remote_method from rdisq.redis_dispatcher import PoolRedisDispatcher class GrumpyException(Exception): pass class SimpleWorker(RdisqService): service_name = "MyClass" response_timeout = 10 # seconds redis_dispatcher = PoolRedisDispatcher(host='127.0.0.1', port...
StarcoderdataPython
8199706
<gh_stars>0 # Copyright (c) 2020 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 req...
StarcoderdataPython
3273175
from ....utils.code_utils import deprecate_module deprecate_module("ediFilesUtils", "edi_files_utils", "0.16.0", error=True) from .edi_files_utils import *
StarcoderdataPython
227893
from linebot.models import ImageSendMessage, TextSendMessage from config.line_bot_api import line_bot_api, heroku_url, num_list import re class TextMessageUtil: def __init__(self, event): self.event = event def send_pass_image(self): num = re.sub("\\D", "", self.event.message.text) if...
StarcoderdataPython
5177531
<gh_stars>1-10 #TUI Form def main(): # Find the largest number among three numbers L = [] num1 = eval(input("Enter the first number:")) L.append(num1) num2 = eval(input("Enter the second number:")) L.append(num2) num3 = eval(input("Enter the third number:")) L.append(num3) ...
StarcoderdataPython
1847535
# California state symbols # state_bird = 'California quail' # state_animal = 'Grizzly bear' # state_flower = 'California poppy' # state_fruit = 'Avocado' california_symbols = { 'bird': 'California quail', 'animal': 'Grizzly bear', 'flower': 'California poppy', 'fruit': 'Avocado', } california_flower ...
StarcoderdataPython
312824
<reponame>wongongv/scholarship_wonjun<gh_stars>0 from __future__ import division, print_function, absolute_import, unicode_literals import tensorflow as tf import numpy as np import os import matplotlib.pyplot as plt import tensorflow.keras.layers as layers import pandas as pd # get the image def load_img(path): img ...
StarcoderdataPython
173093
#################### version 1 ################################################# a = list(range(10)) # print(a, id(a)) res_1 = list(a) # print(res_1, id(res_1)) for i in a: if i in (3, 5): print(">>>", i, id(i)) res_1 = list(filter(lambda x: x != i, res_1)) # print(type(res_1), id(res_1))...
StarcoderdataPython
1968334
from math import sqrt, acos def dist(v1, v2): return sqrt((v1[0]-v2[0])**2 + (v1[1]-v2[1])**2) def dot(v1, v2): return v1[0]*v2[0] + v1[1]*v2[1] def cross(v1, v2, v3): return (v2[0]-v1[0])*(v3[1]-v1[1]) - (v2[1]-v1[1])*(v3[0]-v1[0]) def norm(v1): return sqrt(v1[0]*v1[0] + v1[1]*v1[1]) def angle(v1,...
StarcoderdataPython
11286168
#!/usr/bin/env python3 """ Polyglot v2 node server Davice WeatherLink Live weather data Copyright (C) 2018 <NAME> """ CLOUD = False try: import polyinterface except ImportError: import pgc_interface as polyinterface CLOUD = True import sys import time import datetime import requests import socket import ma...
StarcoderdataPython
1962809
<filename>pynlg/spec/list.py # encoding: utf-8 """Definition of the ListElement container class.""" from .base import NLGElement from ..lexicon.feature.internal import COMPONENTS class ListElement(NLGElement): """ ListElement is used to define elements that can be grouped together and treated in a simi...
StarcoderdataPython
20117
<reponame>roberthutto/aws-cfn-bootstrap #============================================================================== # Copyright 2011 Amazon.com, Inc. or its affiliates. All Rights Reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the ...
StarcoderdataPython
9673493
import sys sys.path.append('../src/org_to_anki') from org_to_anki.noteModels.models import NoteModels def testNodeModelsCanBeLoaded(): models = NoteModels() assert(models.getBasicModel().get("name") == "Basic") assert(models.getRevseredModel().get("name") == "Basic (and reversed card)") assert(mode...
StarcoderdataPython
66625
<reponame>aimo84/ProyectoRe-seikosta # Cloud y Big Data # Realizado por <NAME>, <NAME>, <NAME> # Nombre Script: S10 # Descripcion: Extrae la relacion entre la puntuacion y el numero de comentarios de cada subreddit from pyspark import SparkConf, SparkContext from pyspark.sql import SparkSession import pyspark.sql.func...
StarcoderdataPython
3233622
<gh_stars>1-10 from __future__ import annotations from corkus.objects.base import CorkusBase from typing import TYPE_CHECKING, Optional if TYPE_CHECKING: from .ingredient import Ingredient class PartialIngredient(CorkusBase): """Represents a ``Partial`` version of :py:class:`Ingredient`.""" @property ...
StarcoderdataPython
9682980
<reponame>vidalmatheus/DS.com<filename>database/teste.py from flask import Flask import sqlalchemy as db from sqlalchemy import * app = Flask(__name__) # connect to the db engine = create_engine('postgresql://postgres:admin@localhost/ds') con = engine.connect() @app.route("/hello") def hello(): return "<h1>Hello...
StarcoderdataPython
8041740
# -*- coding: UTF-8 -*- import sys import numpy as np import scipy as sp from scipy import stats import matplotlib matplotlib.use('Agg') import matplotlib.pyplot as plt from rklib.utils import dirDetectCreate import matplotlib as mpl import matplotlib.gridspec as gridspec import matplotlib.cm as cm from matplotlib im...
StarcoderdataPython
5127904
from crontab import CronTab class Scheduler: def __init__(self, file_name): self.cron = CronTab(tab=file_name) self.file_name = file_name # <-- End of __init__() def add_job( self, command: str, comment: str, minute: int = 0, hour: int = 0, ...
StarcoderdataPython
1917581
import os import shutil all_task_test_images_path = "/home/maaz/PycharmProjects/VOC_EVAL/all_task_images" all_dets_path = "/home/maaz/PycharmProjects/VOC_EVAL/dets_from_diff_methods/deep_mask/deep_mask_dets" output_path = "/home/maaz/PycharmProjects/VOC_EVAL/dets_from_diff_methods/deep_mask/deep_mask_all_task_dets" if...
StarcoderdataPython
9791114
# Copyright 2019 Google LLC. All Rights Reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or a...
StarcoderdataPython
1617650
<gh_stars>1-10 """Eventlist coordinate check. """ from gammapy.data import EventListDataset from gammapy.datasets import gammapy_extra filename = gammapy_extra.filename('test_datasets/unbundled/hess/run_0023037_hard_eventlist.fits.gz') event_list = EventListDataset.read(filename) print(event_list.info) event_list.chec...
StarcoderdataPython
8133170
<reponame>bsridatta/robotfashion # import necessary libraries from PIL import Image from train_epoch import train_one_epoch, evaluate import matplotlib.pyplot as plt import torch import transforms as T import torchvision.utils import torchvision import copy import torch import numpy as np import cv2 import random impo...
StarcoderdataPython
6676194
#!/usr/bin/env python3 # -*- coding: utf-8 -*- """ Created on Tue May 12 09:04:34 2020 @author: abhijit """ # set a splitting point split_point = 3 # make two empty lists lower = []; upper = [] # Split numbers from 0 to 9 into two groups, one lower or equal to the split point and one higher than the split point for...
StarcoderdataPython
190535
# -*- coding: utf-8 -*- """ Created on Mon Oct 18 01:20:47 2021 @author: user """ import numpy as np import matplotlib.pyplot as pt S = np.array([[4410000*4410000*4410000,4410000*4410000, 4410000, 1], [4830000*4830000*4830000,4830000*4830000,4830000,1], [5250000*5250000*5250000,5250000*525000...
StarcoderdataPython
3287296
<filename>anvil/objects/curve.py import yaml from collections import OrderedDict import anvil import anvil.config as cfg import anvil.runtime as rt from transform import Transform import io from anvil.meta_data import MetaData from six import iteritems class Curve(Transform): DCC_TYPE = 'nurbsCurve' ANVIL_TYP...
StarcoderdataPython