id
stringlengths
1
265
text
stringlengths
6
5.19M
dataset_id
stringclasses
7 values
171700
<reponame>JacobPorter/Radogest<gh_stars>0 #!/usr/bin/env python # -*- coding: utf-8 -*- """ Create a fasta file of intergenic regions given a gff file and a whole genome. :Authors: <NAME> <<EMAIL>> """ # TODO: Add parallelism to labeling. from __future__ import print_function import argparse import datetime imp...
StarcoderdataPython
2230
import sys import os import json from enum import Enum from .mach_o import LC_SYMTAB from macholib import MachO from macholib import mach_o from shutil import copy2 from shutil import SameFileError class ReplaceType(Enum): objc_methname = 1 symbol_table = 2 def replace_in_bytes(method_bytes, name_dict, type...
StarcoderdataPython
1716534
<gh_stars>0 from pyautofinance.common.engine.engine_component import EngineComponent class Observer(EngineComponent): def __init__(self, bt_observer, **parameters): self._bt_observer = bt_observer self._parameters = parameters def attach_to_engine(self, engine): engine.cerebro.addobs...
StarcoderdataPython
12120
import logging import os import io from fastapi import APIRouter, Depends, Header from fastapi.responses import FileResponse, StreamingResponse from fastapi import HTTPException, status import pyarrow as pa import pyarrow.parquet as pq from data_service.api.query_models import ( InputTimePeriodQuery, InputTimeQue...
StarcoderdataPython
186869
<gh_stars>1-10 count = int(input()) for i in range(count): k = int(input()) n = int(input()) people = [j for j in range(1,n+1)] for x in range (k): for v in range(n-1): people[v+1] += people[v] print(people[-1])
StarcoderdataPython
1638770
<filename>evalsig.py #!/usr/bin/env python # -*- coding: utf-8 -*- """ Evaluate the significance via wilcoxon. File: evalsig.py Author: SpaceLis Email: <EMAIL> GitHub: http://github.com/spacelis Description: """ import sys import os from collections import defaultdict from mlmodels.evaluate.stats_R import wilcox im...
StarcoderdataPython
84327
# FIXME: need to break down config manager testing a bit more # @pytest.mark.parametrize('pass_del_cfg', (True, False)) # def test_config_manager_init(mocker, pass_del_cfg): # """NOTE: unlike other configs this one validates itself on creation # """ # # Mocks # patch_del_cfg = mocker.patch('jobfunnel.co...
StarcoderdataPython
1671692
from PIL import ImageGrab import numpy as np class GetDisplay: def __init__(self): self.img = np.zeros([1, 1, 3]) pass def grabDisplay(self): self.img = ImageGrab.grab() pass def img(self): return self.img def getSize(self): self.grabDisplay() ...
StarcoderdataPython
1664954
<gh_stars>1-10 #!/usr/bin/python # synping 0.9 # author: <NAME> # email: <EMAIL> # date: 20190925 import socket import time import sys import optparse version = '0.9' # Parse and validate arguments def get_parsed_args(): usage = 'usage: %prog host [options]' # Create the parser parser = optparse.Optio...
StarcoderdataPython
1687766
<reponame>anilgitme/py class Solution: def twoSum(self, numbers: List[int], target: int) -> List[int]: left, right = 0, len(numbers) - 1 if not numbers: return -1 while left <= right: sumNum = numbers[left] + numbers[right] i...
StarcoderdataPython
4804614
<reponame>davidcortesortuno/finmag import matplotlib.pyplot as plt from dolfinh5tools import openh5 hFile = openh5("array_integrator_parallel", mode="r") plt.plot(hFile.read(t=0, field_name="T").vector().array()) plt.plot(hFile.read(t=1, field_name="T").vector().array()) plt.show()
StarcoderdataPython
198780
<reponame>UKPLab/e2e-nlg-challenge-2017<filename>components/data/__init__.py import csv import logging import re from components.constants import MR_FIELDS, NAME_TOKEN, NEAR_TOKEN from components.data.vocabulary import VocabularyShared logger = logging.getLogger('experiment') # Regular expressions used to tokenize st...
StarcoderdataPython
1664589
<reponame>antoinemadec/openrgb.nvim<filename>rplugin/python3/openrgb_nvim.py import colorsys from openrgb import OpenRGBClient from openrgb.utils import DeviceType, RGBColor import pynvim @pynvim.plugin class OpenRGBNvim(object): """interface with OpenRGB""" def __init__(self, vim): self.vim = vim ...
StarcoderdataPython
8559
import cPickle import argparse parser = argparse.ArgumentParser( "Computes the coverage of a shortlist in a corpus file") parser.add_argument("--vocab", required=True, help="Vocabulary to use (.pkl)") parser.add_argument("--text", required=True, help="Beam size, turn...
StarcoderdataPython
62935
<filename>ttyrec.py import datetime import os import re import termios import tty from datetime import timedelta from os.path import exists from select import select from struct import pack,unpack from time import time, sleep # Note: we can embed comments in a frame using # OSC 50 ; "#+<comment text>" ST # where OSC ...
StarcoderdataPython
4830394
<filename>mido/__about__.py __version__ = '1.2.10' __author__ = '<NAME>' __author_email__ = '<EMAIL>' __url__ = 'https://mido.readthedocs.io/' __license__ = 'MIT'
StarcoderdataPython
1648956
<gh_stars>10-100 """ Runs a program created from SciSheets formulas. This creates creating the API object and managing associated resources (e.g., table files). """ import api_util from program_executer import ProgramExecuter from program_generator import API_OBJECT from mysite import settings import os import sys c...
StarcoderdataPython
3323169
<reponame>captainhammy/houdini_package_runner<gh_stars>1-10 """This module contains runnable items based on Houdini digital assets.""" # ============================================================================= # IMPORTS # ============================================================================= # Future from...
StarcoderdataPython
4840379
#!/usr/bin/env python # -*- coding: UTF-8 -*- import discord import discord.ext.commands as commands import os import re from typing import Callable, Dict, List, Optional, Tuple, Union import pss_assert from cache import PssCache import pss_core as core import pss_entity as entity import pss_lookups as lookups import...
StarcoderdataPython
186086
from django.apps import AppConfig from django.utils.translation import gettext_lazy as _ class ViewCountsConfig(AppConfig): name = "services.viewcounts" verbose_name = _("View Counts")
StarcoderdataPython
1720996
# type: ignore import asyncio from social_reward_function.util import interleave_fifo, TaggedItem def test_interleave_fifo() -> None: async def generator_0(): x = 0.0 while True: yield {'timestamp': x, 'x': x} x += 1 async def generator_1(): y = 0.0 w...
StarcoderdataPython
49487
<reponame>astooke/gtimer """ Merging data from a new times instances into the receiving instance (e.g. when they correspond to the same code segments.). """ from __future__ import absolute_import from gtimer.util import iteritems # # Function to expose elsewhere in the package. # def merge_times(rcvr, new): r...
StarcoderdataPython
1714832
num_one = int(input()) num_two = int(input()) num_three = int(input()) def smallest_number(a, b, c): min_num = None if a <= b and a <= c: min_num = a elif b <= a and b <= c: min_num = b else: min_num = c return min_num print(smallest_number(num_one, num_two, num_three))
StarcoderdataPython
3293993
<reponame>oubiwann-unsupported/dreammud<filename>dreammud/app/shell/service.py from twisted.cred import portal from twisted.conch import manhole_ssh from twisted.conch.checkers import SSHPublicKeyDatabase from dreamssh.util import ssh as util from dreammud.app.shell import gameshell, setupshell def getGameShellFact...
StarcoderdataPython
1740433
<reponame>ingridfausk/midgard """Array with time epochs """ from typing import Optional # Third party imports import numpy as np # Midgard imports from midgard.data._time import TimeArray, TimeDeltaArray def Time( val: np.ndarray, scale: str, fmt: str, val2: Optional[np.ndarray] = None, _jd1: O...
StarcoderdataPython
3308728
<gh_stars>1000+ # Copyright 2020 Huawei Technologies Co., Ltd # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable ...
StarcoderdataPython
149514
<reponame>Tomoya-K-0504/deepSELF import logging from abc import ABCMeta, abstractmethod logger = logging.getLogger(__name__) import numpy as np from deepself.models.loss import set_criterion from dataclasses import dataclass, field from deepself.models.loss import LossConfig from typing import List, Any from omega...
StarcoderdataPython
1726355
def extractAmeryEdge(item): """ # 'Amery Edge' """ vol, chp, frag, postfix = extractVolChapterFragmentPostfix(item['title']) if not (chp or vol or frag) or 'preview' in item['title'].lower(): return None if 'Articles' in item['tags'] or 'Guides' in item['tags']: return None if 'Your Highness, I Know My Wrong...
StarcoderdataPython
59226
<filename>app/routing.py from channels.auth import AuthMiddlewareStack from channels.routing import ProtocolTypeRouter, URLRouter, ChannelNameRouter from django.conf.urls import url from django.urls import path, include import connect4.routing from connect4 import consumers application = ProtocolTypeRouter({ "web...
StarcoderdataPython
184926
<filename>snipts/search_indexes.py import datetime from haystack import indexes from snipts.models import Snipt class SniptIndex(indexes.SearchIndex, indexes.Indexable): text = indexes.CharField(document=True, use_template=True) author = indexes.CharField(model_attr='user') pub_date = indexes.DateTimeFie...
StarcoderdataPython
1601149
#!/usr/bin/env python # -*- cpy-indent-level: 4; indent-tabs-mode: nil -*- # ex: set expandtab softtabstop=4 shiftwidth=4: # # Copyright (C) 2012,2013,2014,2015,2016,2018 Contributor # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. #...
StarcoderdataPython
1670177
# This code is taken from https://github.com/gonglixue/LaplacianLoss-pytorch # Modified by <NAME> import cv2 import numpy as np import torch import torch.nn.functional as F from mmcv.utils import TORCH_VERSION, digit_version def gaussian_kernel_standard(channels=3, kernel_size=5, sigma=1): """ Get Gaussian ...
StarcoderdataPython
3319792
# -*- coding: utf-8 -*- # Scrapy settings for for_360pi project from datetime import datetime import os BOT_NAME = 'for_360pi' SPIDER_MODULES = ['for_360pi.spiders'] NEWSPIDER_MODULE = 'for_360pi.spiders' LOG_ENABLED = True LOG_ENCODING = 'utf-8' timestmp = datetime.now().strftime('%Y-%b-%d:%I-%M-%p') LOG_FILE = os.g...
StarcoderdataPython
3351368
<reponame>YOCKOW/PythonGitHubActionsWorkflowRepresentation<gh_stars>0 from .Node import Node, FlowStyleNode from .SequenceNode import SequenceNode from .StringNode import FlowStyleString, StringNode from .string import Lines, Line from . import util from copy import copy from typing import Any, Dict, List, Optional, Ty...
StarcoderdataPython
3220948
''' In this file, you need to obtain your access_key to the RIOT APIs. One need to register their RIOT developer account or using their existing game account to login to RIOT developer to activate their access_key. The key serves as a permit to request the APIs provided by RIOT. You can use the key to request players'...
StarcoderdataPython
27222
import sqlite3 as lite import csv # Constants. inputPath = "/Users/kdinkla/Desktop/Novartis/HCS/CellMorph/www.ebi.ac.uk/huber-srv/cellmorph/data/" outputPath = "/Users/kdinkla/MPDA/git/wrangle/db/" sqlDotReplacement = '_' # Screening parameters. plates = ["HT" + str(i).zfill(2) for i in range(1, 69)] plateDirectories...
StarcoderdataPython
4811730
<filename>reversegeocode.py<gh_stars>1-10 #!/usr/bin/env python """This is a reverse geocoding script that reads a csv file and converts a latitude and longitude into an address. Furthermore, the script writes the data back into a csv of choice. """ __author__ = "<NAME>" __credits__ = "<NAME>" __version__ = "1.1.1" ...
StarcoderdataPython
1675479
<reponame>dreamhost/python-glanceclient<filename>tests/test_authors.py # vim: tabstop=4 shiftwidth=4 softtabstop=4 # Copyright 2012 OpenStack LLC # Copyright 2012 Nebula 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 ob...
StarcoderdataPython
3386987
# Copyright 2015-2017 FUJITSU LIMITED # # 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...
StarcoderdataPython
70591
import tensorflow as tf from openea.models.trans.transe import TransE from openea.modules.base.initializers import init_embeddings from openea.modules.base.losses import get_loss_func from openea.modules.base.optimizers import generate_optimizer class TransR(TransE): def __init__(self): super().__init__...
StarcoderdataPython
3297239
<filename>snapshot_queries/testing/default_query_rewrite.py<gh_stars>0 import re def default_query_rewrite(query: str): flags = re.IGNORECASE | re.DOTALL query = re.sub( r"SELECT[\s\n](.*?)[\s\n]FROM", "SELECT ... FROM", query, flags=flags ) query = re.sub( r"UPDATE[\s\n](.*?)[\s\\n]SE...
StarcoderdataPython
3246877
# Copyright 2020 <NAME>. 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 agreed to...
StarcoderdataPython
3268874
<gh_stars>0 # name : <NAME> # net id: shoby from hero import Hero from dungeonchar import DungeonCharacter import random from special_attack import SpecialAttack class Thief(Hero, SpecialAttack): """ Warrior is a hero character that a player can choose. It is inherited from Hero class A warrior has a spe...
StarcoderdataPython
3275550
import json import difflib # debugging import numpy as np import sys from utils import sirene_request as sr from utils import labels as lbl import os dir_path = os.getcwd() + "/" """ the purpose of this function is to read a prediction output, collect the dected NE and output them in a json input : predicti...
StarcoderdataPython
82519
<filename>ansible-devel/test/units/module_utils/urls/test_prepare_multipart.py<gh_stars>0 # -*- coding: utf-8 -*- # (c) 2020 <NAME> <<EMAIL>> # GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt) from __future__ import absolute_import, division, print_function __metaclass__ = typ...
StarcoderdataPython
3225437
# Code made for : <NAME> # Specialization--> Statistics in Python Coursera # 30 March, 2021 # License MIT import numpy as np import pandas as pd import matplotlib.pyplot as plt import seaborn as sns sns.set() #1. Write a function that inputs an integers and returns the negative def negative_int(x): out =-x ...
StarcoderdataPython
87091
import weakref from rpython.rtyper.lltypesystem import lltype, llmemory, rffi from rpython.rlib.rarithmetic import LONG_BIT class GroupType(lltype.ContainerType): """A 'group' that stores static structs together in memory. On 32-bit platforms, the point is that they can be referenced by a GroupMemberOffs...
StarcoderdataPython
3289301
#!/usr/bin/env python """ Copyright (C) 2012 <NAME>. This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version...
StarcoderdataPython
1636841
from concurrent.futures import process from transformers import pipeline import re import torch class PunctuationModel(): def __init__(self, model = "oliverguhr/fullstop-punctuation-multilang-large") -> None: if torch.cuda.is_available(): self.pipe = pipeline("ner",model, grouped_entiti...
StarcoderdataPython
3217523
<reponame>alexlee-gk/Theano from __future__ import absolute_import, print_function, division import numpy from theano import Op, Apply, config from six import StringIO try: import pygpu from pygpu import gpuarray except ImportError: pass from .basic_ops import (as_gpuarray_variable, GpuKernelBase, Kernel...
StarcoderdataPython
1692837
from .AutomatonGenerators import generate_random_dfa, generate_random_mealy_machine, generate_random_moore_machine, generate_random_markov_chain from .AutomatonGenerators import generate_random_mdp, generate_random_ONFSM from .FileHandler import save_automaton_to_file, load_automaton_from_file, visualize_automaton from...
StarcoderdataPython
3280327
# Copyright (c) Microsoft Corporation. # Licensed under the MIT license. from typing import (Any, Iterable, List, Optional, Tuple) from .graph import Model, Mutation, ModelStatus __all__ = ['Sampler', 'Mutator', 'InvalidMutation'] Choice = Any class Sampler: """ Handles `Mutator.choice()` calls. """...
StarcoderdataPython
1783733
from abc import ABC, abstractmethod import os class Logger(ABC): @abstractmethod def log(self, obj): pass class FileLogger(Logger): def __init__(self, file_path): self.file_path = file_path def log(self, obj): with open(self.file_path, 'a') as file: file.write(ob...
StarcoderdataPython
1695545
# Generated by Django 3.2 on 2022-04-04 19:48 from django.conf import settings from django.db import migrations, models import django.db.models.deletion class Migration(migrations.Migration): initial = True dependencies = [ ("projects", "0001_initial"), migrations.swappable_dependency(setti...
StarcoderdataPython
3350357
########################################## # Semiconductor Calculations Package # Author: <NAME> # Date: 10/10/2021 ########################################## # Changelog: # 4/25/2021 - Started Package # 10/10/2021 - Started periodic table of elements (materials.py) # 10/19/2021 - Added more functionality #############...
StarcoderdataPython
100479
<filename>auto_yolo/models/object_layer.py<gh_stars>10-100 import tensorflow as tf import tensorflow_probability as tfp import numpy as np import sonnet as snt import itertools from dps import cfg from dps.utils import Param, AttrDict from dps.utils.tf import ( build_scheduled_value, FIXED_COLLECTION, ScopedFuncti...
StarcoderdataPython
186064
"""The ilightsln component."""
StarcoderdataPython
3284667
# Copyright 2019 The Oppia 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 applicable ...
StarcoderdataPython
1669598
<gh_stars>10-100 # -*- coding: utf-8 -*- # Copyright FMR LLC <<EMAIL>> # SPDX-License-Identifier: Apache-2.0 import warnings from typing import List, Union import numpy as np import pandas as pd from jurity.fairness.base import _BaseBinaryFairness from jurity.utils import check_and_convert_list_types from jurity.uti...
StarcoderdataPython
1767082
import numpy as np from _main_decision._helper_functions.log_sum_exp import log_sum_exp def update_log_prob_mask(obs, newobs_mask, recon, log_prob, distance_to_likelihood): dist_func = lambda x: np.sum(np.fabs(x)) # L1 distance function num_recon = recon.shape[0] assert num_recon == log_prob.size ne...
StarcoderdataPython
1706136
<reponame>therocktrading/py-therocktrading-api<filename>TheRockTrading/client_sync.py from .config_sync import ConfigSync class ClientSync(ConfigSync): def __init__(self, API='', API_SECRET='', staging=False): super().__init__(API, API_SECRET, staging) def balance(self, fund_id): """ ...
StarcoderdataPython
1605451
<reponame>yesanton/Comprehensive-Process-Drift-Detection-with-Visual-Analytics import subprocess import os def mine_minerful_for_declare_constraints(fileMngm,algoPrmts): env = dict(os.environ) env['JAVA_OPTS'] = 'foo' subprocess.call(['java', '-version']) file_input = str(fileMngm.get_path_input_sorted...
StarcoderdataPython
142428
import argparse import sys import zup @zup.command def config(args): args = zup, zup.commands.config(*args) @zup.command def ls(args): args = (getattr(args.cfg, 'index_url', args.index), args.remote, getattr(args.cfg, 'install_dir', zup.config.default_install_dir())) zup.com...
StarcoderdataPython
4805075
<reponame>abrar78/cheeserater from django.conf.urls.defaults import * from cheeserater.accounts.views import register from django.contrib.auth import views as authviews urlpatterns = patterns('', (r'^login/$', authviews.login), (r'^logout/$', authviews.logout, {'next_page' : "/"})...
StarcoderdataPython
1649049
<filename>strings/longest_palindromic_substring.py def get_longest_palindrome_substring(s): lps = "" for i in range(len(s)): for j in range(len(s), i, -1): if len(lps) > j - i: break elif s[i:j] == s[i:j][::-1]: lps = s[i:j] break ...
StarcoderdataPython
1603927
<reponame>IBMStreams/pypi.streamsx.geospatial # coding=utf-8 # Licensed Materials - Property of IBM # Copyright IBM Corp. 2019 """ """ __version__='1.1.4' __all__ = [ 'FlightPathEncounter', 'region_match' ] from streamsx.geospatial._geospatial import region_match, FlightPathEncounter
StarcoderdataPython
3246225
<filename>pyneval/metric/utils/config_utils.py<gh_stars>10-100 DINF = 999999999999.0 EPS = 0.0000001 SAME_POS_TH = 0.03 MIN_SIZE = 0.8 FLOAT_ERROR = 0.001 def get_avg_radius(gold_swc_tree, rate=0.1): total_length = gold_swc_tree.length() total_node = gold_swc_tree.size() if total_node <= 1: dis_th...
StarcoderdataPython
136536
<filename>detect.py import cv2 import numpy as np from mtcnn.mtcnn import MTCNN import utils.bbops as bbops import utils.helper as helper import utils.preprocess as preprocess import argparse import os # ArgParse parser = argparse.ArgumentParser(description = "Detect faces and five facial landmarks in given image.")...
StarcoderdataPython
3215402
<filename>openstack/orchestration/util/environment_format.py # 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 applicabl...
StarcoderdataPython
3226413
import torch import torch.nn as nn import torch.nn.functional as F import math def conv(in_planes, out_planes, kernel_size=3, stride=2, padding=1, dilation=1, bn_layer=False, bias=True): if bn_layer: return nn.Sequential( nn.Conv2d(in_planes, out_planes, kernel_size=kernel_size, padding=paddin...
StarcoderdataPython
4825623
#!/usr/bin/env python3 # -*- coding: utf-8 -*- from __future__ import division import numpy as np from gym import spaces import neurogym as ngym class MatchingPenny(ngym.TrialEnv): """Matching penny task. The agent is rewarded when it selects the same target as the computer. opponent_type: Type of oppon...
StarcoderdataPython
3244450
<reponame>2kodevs/cool-compiler-2020<filename>src/core/visitors/type_check/__init__.py from .checker import TypeChecker from .builder import TypeBuilder from .verifier import TypeVerifier from .collector import TypeCollector from .inferencer import InferenceVisitor from .ast_printer import FormatVisitor
StarcoderdataPython
1769447
<filename>appyratus/utils/url_utils.py<gh_stars>1-10 from typing import Text, List from urllib.parse import ( parse_qs, unquote, urlencode, urlparse, ) class UrlUtils(object): @classmethod def parse_url(cls, url: Text, relative=False): if not relative and '//' not in url: ...
StarcoderdataPython
156394
<gh_stars>0 t = int(input()) tests = [] def fact(n): if n == 1: return n else: return n * fact(n - 1) while t > 0: n = int(input()) tests.append(fact(n)) t -= 1 for x in tests: print(x % 10)
StarcoderdataPython
1789479
<filename>atomium/parse_mmcif.py # Benchmark the parsing of a mmCIF file given as an argument import sys import time import atomium mmcif_filepath = sys.argv[1] start = time.time() atomium.open(mmcif_filepath) end = time.time() print(end - start)
StarcoderdataPython
180382
<gh_stars>0 #!/usr/bin/env python3 # -*- coding: utf-8 -*- """ Created on Wed Oct 2 09:19:20 2019 @author: sebastian """ import os import sys import ast import psutil import logging import numpy as np import matplotlib.pyplot as plt #%% #Caiman importation import caiman as cm from caiman.utils.visualization import ...
StarcoderdataPython
1757568
from flask import Flask, render_template from flask_bootstrap import Bootstrap from stackoverflow import fetch_data app = Flask(__name__, static_url_path='', root_path='./') bootstrap = Bootstrap(app) @app.route('/') def index(): data = fetch_data.fetch_10_top_questions() answer_html = "<h2>this is an answer<...
StarcoderdataPython
3346633
<reponame>WeiXuanChan/heartFEM ######################################################################## import argparse from mpi4py import MPI as pyMPI import numpy as np #from thLib import quat import sys import os from dolfin import * from sympy import Symbol, nsolve import math from scipy import linalg ...
StarcoderdataPython
1766599
import re from lite_boolean_formulae import L from .utils import _test_str, _test_repr def test_repr_formula(): _test_repr(L("x") & L("y")) def test_repr_literal(): _test_repr(L("x")) def test_repr_negated_literal(): _test_repr(~L("x")) def test_literal_str(): _test_str(L("x"), u'L\\("x"\\)') ...
StarcoderdataPython
1753526
import tkinter from tkinter import ttk, messagebox def do_hello_world(): messagebox.showinfo("Important Message", "Hello World!") root = tkinter.Tk() big_frame = ttk.Frame(root) big_frame.pack(fill='both', expand=True) button = ttk.Button(big_frame, text="Click me", command=do_hello_world) button.pack() root.m...
StarcoderdataPython
1679488
ano = int(input('Qual ano de fabricação do seu carro? ')) tempo = 2020 - ano print('O seu carro tem {} anos'.format(tempo)) if tempo <=3: print('Carro Novo') else: print('Carro velho' ) print('--FIM--') tempox = int(input('Quantos anos tem seu carro?')) print('Carro Novo'if tempox<=3 else'Carro Velho') print (...
StarcoderdataPython
82719
<filename>src/holyshit/exceptions.py class ContentUnavailable(Exception): """Raises when fetching content fails or type is invalid.""" def __init__(self, *args, **kwargs) -> None: super().__init__(*args, **kwargs) class ClosedSessionError(Exception): """Raises when attempting to interact with a c...
StarcoderdataPython
3213298
<reponame>wondadeveloppe26/checklist-seo from setuptools import setup, find_packages from readme_renderer.markdown import render long_description = "" with open('README.md', encoding='utf-8') as file: long_description = file.read() setup( name='checklist-seo', version='0.0.7', license='MIT', author=...
StarcoderdataPython
114798
<filename>app/main/schema/http_status_schema.py from flask_restplus import Namespace, fields class HTTPStatus: """ Schema for showing messages related to various HTTP Statuses """ ns = Namespace('httpstatus', 'Schema for displaying http status') statusschema = ns.model('httpstatus', { ...
StarcoderdataPython
32575
<reponame>AlexandrePeBrito/CursoUdemyPython<gh_stars>0 #Faça um programa que calcule e escreva o valor de S # S=1/1+3/2+5/3+7/4...99/50 u=1 valores=[] for c in range(1,100): if(c%2==1): valores.append(round(c/u,2)) u+=1 print(valores) print(f"S = {sum(valores)}")
StarcoderdataPython
4828708
<reponame>edu-ai/aivle-gym<filename>example/multi_agent.py<gh_stars>0 import logging import sys import time import gym import ma_gym from aivle_gym.agent_env import AgentEnv from multi_judge import PongEnvSerializer class PongAgentEnv(AgentEnv): def __init__(self, uid, port): base_env = gym.make("PongDu...
StarcoderdataPython
1691506
<reponame>KOLANICH/pkgman_triggers.py<gh_stars>0 import typing import warnings from collections import OrderedDict import pkg_resources from pkg_resources import EntryPoint import json import re from .PackageInfo import PackageInfo from .triggers import Trigger, Module, TemporaryID from .matchers import * from .AuthDB...
StarcoderdataPython
157692
<filename>scripts/obix/get_obix_history_config.py # -*- coding: utf-8 -*- {{{ # vim: set fenc=utf-8 ft=python sw=4 ts=4 sts=4 et: # # Copyright 2020, Battelle Memorial Institute. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You ...
StarcoderdataPython
130331
from rvce_web_results import app,db from flask import render_template, flash, redirect,session from rvce_web_results.forms import * from rvce_web_results.models import * from fuzzywuzzy import fuzz from fuzzywuzzy import process import operator #download data into shelf file using rvresult.py,(status, sd) = scrape_s...
StarcoderdataPython
16127
<gh_stars>0 from django.utils import translation from olympia import amo from olympia.amo.tests import TestCase, ESTestCase from olympia.addons.models import Addon from olympia.reviews import tasks from olympia.reviews.models import ( check_spam, GroupedRating, Review, ReviewFlag, Spam) from olympia.users.models i...
StarcoderdataPython
1712621
import pytest import tensorflow as tf from tfsnippet.modules import Module, Sequential class SequentialTestCase(tf.test.TestCase): def test_scopes(self): def f(inputs): return tf.get_variable('v', shape=()) * inputs class C(Module): def __init__(self, flag): ...
StarcoderdataPython
104767
#!/usr/bin/env python from setuptools import find_packages, setup VERSION = "0.0.1" setup( name="My Node", version=VERSION, description="Bitcoin Node Manager", author="<NAME>", author_email="<EMAIL>", url="https://github.com/gnulnx/mynode", packages=find_packages(), entry_points={"con...
StarcoderdataPython
1643847
from fastapi import APIRouter, HTTPException import requests import json import os import logging from schemas import LedgerRequest, DidCreationResponse, InitWalletRequest import aries_cloudcontroller logger = logging.getLogger(__name__) router = APIRouter(prefix="/wallets", tags=["wallets"]) admin_url = os.gete...
StarcoderdataPython
3392260
<gh_stars>1-10 from django.test import TestCase from django.test.client import Client from django.core.exceptions import ObjectDoesNotExist, ValidationError from django.db import IntegrityError from teams.views import MakeTeamView from teams.models import Team from users.models import User from buildbuild import custo...
StarcoderdataPython
81939
from dsbox.template.template import DSBoxTemplate from d3m.metadata.problem import TaskKeyword from dsbox.template.template_steps import TemplateSteps from dsbox.schema import SpecializedProblem import typing import numpy as np # type: ignore class CMUacledProblemTemplate(DSBoxTemplate): # From primitives/v2...
StarcoderdataPython
1638557
""" Example sentences to test spaCy and its language models. >>> from spacy.lang.lt.examples import sentences >>> docs = nlp.pipe(sentences) """ sentences = [ "Jaunikis pirmąją vestuvinę naktį iškeitė į areštinės gultą", "Bepiločiai automobiliai išnaikins vairavimo mokyklas, autoservisus ir eismo nelaimes", ...
StarcoderdataPython
42013
<filename>webapp/models/mnist_model.py<gh_stars>100-1000 import tensorflow as tf from tensorflow.examples.tutorials.mnist import input_data def weight_variable(shape): initial = tf.truncated_normal(shape, stddev=0.1) return tf.Variable(initial) def bias_variable(shape): initial=tf.constant(0.1, shape=shape) r...
StarcoderdataPython
26562
<filename>python_marketman/__version__.py<gh_stars>0 """Version details for python-marketman This file shamelessly taken from the requests library""" __title__ = 'python-marketman' __description__ = 'A basic Marketman.com REST API client.' __url__ = 'https://github.com/LukasKlement/python-marketman' __version__ = '0.1...
StarcoderdataPython
3319560
''' INSTANCE SELECTION-BASED BINARY FIREFLY ALGORITHM ''' #IMPORT PACKAGES import numpy as np from numpy import linalg import csv import cvxopt import cvxopt.solvers #START OF FIREFLY ALGORITHM #DEFINE OBJECTIVE FUNCTION def objective_function(dataset, value): idx = np.array([np.linalg.norm(x+y) for (x,y) in da...
StarcoderdataPython
1638562
<gh_stars>0 import pytest class Args(): model = "shape_predictor_68_face_landmarks.dat" cam_id = 0 ratio = 0.2 test = True @pytest.fixture() def args(): result = Args() return result
StarcoderdataPython