id
stringlengths
1
265
text
stringlengths
6
5.19M
dataset_id
stringclasses
7 values
21762
<reponame>patrickgh3/iwjam<filename>iwjam_import.py from lxml import etree import os import sys import shutil import iwjam_util # Performs an import of a mod project into a base project given a # previously computed ProjectDiff between them, # and a list of folder names to prefix # ('%modname%' will be replaced with t...
StarcoderdataPython
1618464
<filename>code/design-patterns/decorator/encoder.py # src: https://gist.github.com/gowhari/fea9c559f08a310e5cfd62978bc86a1a def encode(key, string): encoded_chars = [] for i in range(len(string)): key_c = key[i % len(key)] encoded_c = chr(ord(string[i]) + ord(key_c) % 256) encoded_chars....
StarcoderdataPython
3237635
<filename>plugins/ml2/drivers/fortinet/common/config.py # Copyright 2015 Fortinet 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/LICE...
StarcoderdataPython
1749748
# -*- coding: utf-8 -*- # # Copyright (C) 2018 <NAME>imire]. # # thesuesnp is free software; you can redistribute it and/or modify it # under the terms of the MIT License; see LICENSE file for more details. """Views tests.""" from __future__ import absolute_import, print_function from flask import url_for def test...
StarcoderdataPython
3289627
<gh_stars>0 import sys import pytorch_lightning as pl import torch from torchvision import utils as vutils from two_stream_model import TwoStreamSlotAttentionModel from two_stream_params import SlotAttentionParams sys.path.append('../') from utils import to_rgb_from_tensor from method import SlotAttentionVideoLangua...
StarcoderdataPython
3303832
<reponame>cnlucas/fec-cms<filename>fec/fec/wagtail_hooks.py import json import wagtail.admin.rich_text.editors.draftail.features as draftail_features from wagtail.admin.rich_text.converters.html_to_contentstate import BlockElementHandler from wagtail.core import hooks from django.conf import settings from django.utils....
StarcoderdataPython
1669062
<reponame>icvntechstudio/django-salesman<gh_stars>100-1000 import pytest from django.urls import reverse from rest_framework.settings import api_settings from rest_framework.test import APIClient from salesman.basket.api import BasketViewSet from salesman.basket.models import BasketItem from shop.models import Product...
StarcoderdataPython
3269390
<reponame>smsubham/Data-Structure-Algorithms-Questions #https://leetcode.com/problems/substring-with-concatenation-of-all-words/
StarcoderdataPython
3281568
import torch from syft.frameworks.torch.tensors.interpreters.autograd import AutogradTensor from syft.frameworks.torch.tensors.decorators.logging import LoggingTensor from syft.frameworks.torch.tensors.interpreters.paillier import PaillierTensor from syft.frameworks.torch.tensors.interpreters.native import TorchTensor...
StarcoderdataPython
1673243
import json from pymatgen.matproj.rest import MPRester import os data = {} #structure_id is the ID of the structure in Materials Project raster = MPRester(os.environ(PMG_MAPI_KEY)) def name_in_mp(structure_id): material_name = raster.query(structure_id,['pretty_formula']) # mg_structure = raster.get_structure_...
StarcoderdataPython
182644
<reponame>ChiTimesChi/SYN-Tracker-API<gh_stars>0 #!/usr/bin/env python3 # -*- coding: utf-8 -*- """ Copyright Blaze 2021. Distributed under the Boost Software License, Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at https://www.boost.org/LICENSE_1_0.txt) """ from collections import defaultdict...
StarcoderdataPython
4819342
# The MIT License (MIT) # # Copyright (c) 2018-2022 <NAME> # # Use of this source code is governed by The MIT License (MIT) # that can be found in the LICENSE.txt file. """APIs for representing core project maps concepts: goals and arrows.""" import sys import re import datetime import operator import copy from enu...
StarcoderdataPython
1637397
<gh_stars>1-10 # Copyright (c) 2006,2007,2008 <NAME> http://garnaat.org/ # # 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 us...
StarcoderdataPython
1758685
<reponame>kharrigian/pitchers-and-pianists<gh_stars>0 ## In Stage 2 of proessing, we estimate tap initiations # Flag to create plots of output create_plots = False ############################### ### Imports ############################### # Warning Supression import warnings warnings.simplefilter("ignore") # Stand...
StarcoderdataPython
1678635
lsd_and_math.loc[7] = [6, 70] x, y = lsd_and_math.T.values b0, b1 = fmin(sum_of_squares, [0,1], args=(x,y)) b0_abs, b1_abs = fmin(sum_of_absval, [0,0], args=(x,y)) print('\nintercept: {0:.2}, slope: {1:.2}'.format(b0,b1)) ax = lsd_and_math.plot(x='Drugs', y='Score', style='ro', legend=False, xlim=(0,8)) ax.plot([0,10...
StarcoderdataPython
3264708
import numpy import structlog from gost.utils import evaluate, evaluate_themes, evaluate_nulls, FmaskThemes from gost.data_model import Measurement _LOG = structlog.get_logger("fmask") def test_evaluate_themes_identical( ref_fmask_measurement1: Measurement, test_fmask_measurement1: Measurement ): """Test th...
StarcoderdataPython
135006
<gh_stars>10-100 from collections import OrderedDict import numpy as np import tensorflow as tf from hypothesis import HealthCheck, assume, given, settings from hypothesis.extra.numpy import array_shapes, arrays, floating_dtypes from hypothesis.strategies import dictionaries, floats, integers, lists, sampled_from, tex...
StarcoderdataPython
73416
# Copyright 2020 DataStax, 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 writing,...
StarcoderdataPython
3206125
<gh_stars>10-100 from .autoencoder_trainer import AutoEncoderTrainer from .draftmodel_trainer import DraftModelTrainer from.colorization_trainer import ColorizationModelTrainer
StarcoderdataPython
1738524
<gh_stars>100-1000 import torch import torch.nn as nn import numpy as np from functools import partial import torch.nn.init as init import torch.nn.functional as F import math from timm.models.layers import DropPath, to_2tuple import torch import torch.nn as nn from timm.models.layers import trunc_normal_ import nump...
StarcoderdataPython
105893
<filename>brd.py #This file managers the board (matrix) from user import Printm def con(height,width,bad,ditch,player):#gets the height and width of the desired board, and with the location of the Badguys, ditches and the player - returns a matrix (the final board) brd = [] for r in range(height): ...
StarcoderdataPython
1644416
<gh_stars>0 import esphome.codegen as cg import esphome.config_validation as cv from esphome import core from esphome.components import i2c, sensor from esphome.const import CONF_DURATION, CONF_GAS_RESISTANCE, CONF_HEATER, \ CONF_HUMIDITY, CONF_ID, CONF_IIR_FILTER, CONF_OVERSAMPLING, CONF_PRESSURE, \ CONF_TEMPE...
StarcoderdataPython
1613680
<filename>examples/bids/bids_users.py """ BIDS directory parsing (user mode) ================================== Credit: <NAME> pycaravel is a Python package that enables you to parse various source of data. In this tutorial you will learn how to parse and search in a BIDS directory. First checks ------------ In ord...
StarcoderdataPython
4822430
import math, copy import numpy as np import gym from gym_minigrid import entities, render_text, encoding class Cell(object): def __init__(self): self.color = 'black' # at the moment, we restrict background color to black self.clear() def clear(self): self.entity = None def __...
StarcoderdataPython
3398484
<reponame>csun87/dworp<filename>examples/birth_rates.py<gh_stars>1-10 import argparse import collections import dworp import dworp.plot import logging import math import numpy as np class Person(dworp.SelfNamingAgent): """Person that can have children""" def __init__(self, color, fertility, rng): supe...
StarcoderdataPython
143931
<reponame>er432/Ranger from Ranger.src.Range.Cut import Cut class Range(object): """ Class used to represent a range along some 1-D domain. The range is represented by 2 cutpoints can can be unbounded by specifying an aboveAll or belowAll Cut. """ def __init__(self, lowerCut, upperCut): ...
StarcoderdataPython
3312579
from data.roomdata import RoomData from data.room_factory import RoomFactory from Rhino import RhinoDoc from distutils.util import strtobool ROOM_USER_KEY = "LPYT_AC_Enabled" ROOM_IDENTIFIER_KEY = "LPYT_AC_RoomIdentifier" ROOM_TARGET_AREA_KEY = "LPYT_AC_TargetArea" class _RoomAttributes(object): """ Helper cl...
StarcoderdataPython
3301651
<filename>src/posts/repository/keys.py """ """ def search_posts(q, page): return 'p:sepo:' + q + ':' + str(page) def get_post_id(slug): return 'p:gpid:' + slug def get_post(slug): return 'p:gepo:' + slug def list_comments(post_id, author_id): if author_id: return 'p:lico:' + str(post_id)...
StarcoderdataPython
1618361
from __future__ import absolute_import, print_function, unicode_literals try: from unittest.mock import patch, MagicMock except ImportError: from mock import MagicMock, patch from rest_framework_latex import renderers from tests.testrenderers.tests.test_latex import RendererTestCase class CallbackTestCase(R...
StarcoderdataPython
1687993
<reponame>peterkulik/ois_api_client<filename>ois_api_client/v3_0/dto/RequestStatus.py from enum import Enum class RequestStatus(Enum): """Processing status of the request""" RECEIVED = 'RECEIVED' """Received""" PROCESSING = 'PROCESSING' """Processing""" SAVED = 'SAVED' """Saved""" FINI...
StarcoderdataPython
52981
<reponame>Tiny-Snow/Project-Euler-Problem-Solutions<filename>PE-Python/P085/P085.py # -*- coding:UTF-8 -*- # Author:<NAME> # Date: Tue, 30 Mar 2021, 17:09 # Project Euler # 085 Counting rectangles #=============================================================Solution def get_rectangles(m, n): return m * (m + 1) * ...
StarcoderdataPython
29473
"""Uploaded data to nuuuwan/news_lk:data branch.""" from news_lk import scrape if __name__ == '__main__': scrape.scrape_and_dump()
StarcoderdataPython
120024
<reponame>hronecviktor/django-GDPR from decimal import Decimal from typing import Union from django.utils.translation import gettext as _ __all__ = ('encrypt_text', 'decrypt_text', 'encrypt_email_address', 'decrypt_email_address', 'numerize_key', 'NUMBERS', 'LETTERS_UPPER', 'LETTERS_ONLY', 'ALL_CHARS', 'SY...
StarcoderdataPython
199521
<gh_stars>0 # -*- coding: utf-8 -*- # ------------------------------------------------------------------------------ # # Copyright 2018-2020 Fetch.AI 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 ...
StarcoderdataPython
1768459
<gh_stars>0 # -*- coding: utf-8 -*- from Alread2y import Alread2y from flask import Flask, jsonify, request, abort import sys,os sys.path.append(os.path.dirname(os.path.abspath(__file__)) + '/../util') from settings import SettingManager api = Flask(__name__) api.config['JSON_AS_ASCII'] = False instance = {} @api....
StarcoderdataPython
1753623
from django.shortcuts import render, redirect from onlineLibrary.books.models import Book from onlineLibrary.profiles.forms import ProfileForm, DeleteProfileForm from onlineLibrary.profiles.models import Profile def show_profile(request): profile = Profile.objects.first() return render(request, 'profile.html...
StarcoderdataPython
4828717
import io import json import wget import pickle import os import torch import torch.nn as nn import torch.nn.functional as F import numpy as np import PIL.Image from transformers import LxmertForQuestionAnswering, LxmertForPreTraining, LxmertTokenizer, LxmertConfig from transformers import AutoModel from common.modu...
StarcoderdataPython
2476
import sqlite3 import subprocess, datetime from flask import Flask, request, session, g, redirect, url_for, \ abort, render_template, flash from contextlib import closing from tquery import get_latest_record from config import * app = Flask(__name__) app.config.from_object(__name__)...
StarcoderdataPython
87579
from __future__ import unicode_literals from django.db import models class Person(models.Model): name = models.CharField(max_length=20) age = models.CharField(max_length=2)
StarcoderdataPython
3285117
from itertools import chain from algoritmia.utils import infinity, min from algoritmia.problems.generalizedcoinchange.dynamicprogramming3 import IterativeDynamicCoinChanger class SpaceSavingDynamicCoinChanger2(IterativeDynamicCoinChanger):#[class def weight(self, Q: "int") -> "Real": mem = self.creat...
StarcoderdataPython
71079
from django.db import models class GlobalSetting(models.Model): """ A global setting is a key-value setting which can be set for a pretix instance. It will be inherited by all events and organizers. It is filled via the register_global_settings signal. """ key = models.CharField(max_length=255...
StarcoderdataPython
1792025
<gh_stars>1-10 """ Module containing customized antenna classes for ARA. Many of the methods here mirror methods used in the antennas in AraSim, to ensure that AraSim results can be matched. """ import logging import os.path import pickle import numpy as np import scipy.constants import scipy.signal from pyrex.inter...
StarcoderdataPython
3244214
<filename>resize.py # -*- coding: utf-8 -*- import argparse import pathlib import cv2 def get_commandline_args(): parser = argparse.ArgumentParser() parser.add_argument('--src-dir', type=str, required=True, help='A path of the source dir...
StarcoderdataPython
67701
from etl.loader.db.flight import Flight from etl.loader.db.base import ( engine, Session, Base ) Base.metadata.create_all(engine)
StarcoderdataPython
103458
<reponame>michaelscales88/charles_site import os import os.path as op from sqlalchemy.event import listens_for from sqlalchemy.ext.hybrid import hybrid_property from flask_admin import form from ..extensions import db from .. import server # Create directory for file fields to use file_path = op.join(server.config['...
StarcoderdataPython
3221607
# Copyright 2016 <NAME> # Copyright 2012-2014 Gentoo Foundation # Copyright 2012-2014 <NAME> <<EMAIL>> # Copyright 2012-2014 The Chromium OS Authors # Use of this source code is governed by a BSD-style license (BSD-3) # Original version available from: # https://sources.gentoo.org/cgi-bin/viewvc.cgi/gentoo-projects/p...
StarcoderdataPython
3322915
import os import re import calculate_anything from calculate_anything.utils import multi_re MAIN_DIR = os.path.dirname(os.path.dirname( os.path.realpath(calculate_anything.__file__))) FLAGS = {f.split('.')[0]: f for f in os.listdir( os.path.join(MAIN_DIR, 'images/flags'))} XDG_FALLBACK = os.getenv('HOME') if ...
StarcoderdataPython
28003
class Node: def __init__(self, value, index, next, previous): self.value = value self.next_value = value self.index = index self.next = next self.previous = previous def main(): input_data = read_input() initial_row = input_data.pop(0) # Extract the initial state...
StarcoderdataPython
1762419
<reponame>NTrevisani/cmssw import FWCore.ParameterSet.Config as cms process = cms.Process("TEST") process.load("HLTrigger.Configuration.HLT_GRun_cff")
StarcoderdataPython
3370253
<reponame>tnoumar/GenfaceDemo import numpy as np import os import pickle import streamlit as st import sys import tensorflow as tf import urllib import subprocess from PIL import Image import os import glob import time import random favicons_dir = "/content/GenfaceDemo/Favicon/" def clear_img_dir(): files = glob...
StarcoderdataPython
1739834
# Copyright 2018 University of Groningen # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to i...
StarcoderdataPython
111251
# 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 # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writi...
StarcoderdataPython
1675768
<reponame>onaio/mspray<filename>mspray/apps/main/exports.py # -*- coding: utf-8 -*- """Export functions.""" import csv from tempfile import TemporaryFile from django.core.files.base import File from django.core.files.storage import default_storage from mspray.apps.main.models import Location from mspray.apps.main.ser...
StarcoderdataPython
51064
<reponame>honsunrise/libveinmind from . import binding as binding from . import runtime as runtime from . import filesystem as filesystem from . import image as image import ctypes as C class Docker(runtime.Runtime): "Docker refers to a parsed docker application object." # Initialize the docker object, assuming it ...
StarcoderdataPython
1662020
""" ____ _ _ | __ ) _ _| |_| |_ ___ _ __ | _ \| | | | __| __/ _ \| '_ \ | |_) | |_| | |_| || (_) | | | | |____/ \__,_|\__|\__\___/|_| |_| @author: <NAME> @coding: utf-8 @environment: Manjaro 18.1.5 Juhraya + Python3.8.1 @date: 13th Jan., 2020 """ impo...
StarcoderdataPython
1616480
import random import uuid import time from . import simple_text def get_uuid(): """ uuid를 가져옵니다. **Example** ``` import simple_utils simple_utils.random.get_uuid() ``` **Returns** * **uuid.uuid4** (*string*) """ return str(uuid.uuid4()) def make_uuid_including_time(): ...
StarcoderdataPython
1747797
<reponame>joachimmetz/l2tdevtools # -*- coding: utf-8 -*- """Build helper related functions and classes for testing.""" import logging import os import tarfile from l2tdevtools import source_helper class TestSourceHelper(source_helper.SourceHelper): """Test helper to manage project source code.""" def __init__...
StarcoderdataPython
1742250
import angr import simuvex import cle import os import json # imports for graph handling import networkx as nx from networkx.readwrite import json_graph def generateCFG(binary, max_size, analysisType = 'Fast'): response = {} try: # Create the angr project for the binary project = angr.Project(...
StarcoderdataPython
3398995
# Import Modules import os import csv # Set variables monthly_change =[] month_count = [] increase = 0 decrease = 0 # Set path for file csvpath = '../git/python-challenge/PyBank/Resources/budget_data.csv' # Open and Read file with open (csvpath, newline="") as csvfile: # csvreader set variable and delimiter for...
StarcoderdataPython
73871
import pandas as pd import numpy as np import requests import json df = pd.read_csv('./ingredients.csv').iloc[:,1:] df.columns = ['banana', 'blueberries', 'apple', 'whole-wheat bread', 'brown rice', 'oatmeal', 'sweet potatoes', 'quinoa', 'greek yogurt', 'chicken breast', 'turkey breast', 'lean beef', 'br...
StarcoderdataPython
3326114
#!/bin/env python3 from setuptools import find_packages, setup setup( name="HatsPil", version="0.6", packages=find_packages(), python_requires=">=3.6", install_requires=[ "cutadapt", "rpy2", "pandas", "tables", "numpy", "PyVCF", "plotly", ...
StarcoderdataPython
3322426
import cv2 as cv import numpy as np image = cv.imread('spidy.jpg') gray = cv.cvtColor(image, cv.COLOR_BGR2GRAY) blur = cv.medianBlur(gray, 3) canny = cv.Canny(gray, 75, 75) cv.imshow('drawing', canny) cv.waitKey(0)
StarcoderdataPython
1657665
"""Utilities collection. """ from datetime import datetime import math import time import astropy.coordinates as coord from astropy.time import Time import astropy.units as u import numpy as np class Announce(object): def __init__(self, action, end, disable=False): self.action = action self.end...
StarcoderdataPython
1661846
<reponame>warcy/montagne import json import inspect from montagne.common import hub from montagne.common.log import getLogger from eventlet.green.urllib import request, error LOG = getLogger(__name__) _DEFAULT_TIME_OUT = 2 def encode(obj, charset='utf-8'): return json.dumps(obj).encode(charset) def decode(byt...
StarcoderdataPython
182436
# -------------------------------------------------------------------------- # Copyright (c) <2017> <<NAME>> # BE-BI-PM, CERN (European Organization for Nuclear Research) # # Permission is hereby granted, free of charge, to any person obtaining a copy # of this software and associated documentation files (the "S...
StarcoderdataPython
25597
<reponame>Niyy/monsterpedia # Generated by Django 2.2.8 on 2019-12-19 19:46 from django.db import migrations, models class Migration(migrations.Migration): dependencies = [ ('myapp', '0003_auto_20191218_0740'), ] operations = [ migrations.AlterField( model_name='monster', ...
StarcoderdataPython
1732427
__author__ = 'dishantrathi' class Credits: def Credits(self): print() print() print("Credits To:") print() print("<NAME>") print("Email : <EMAIL>") print("twitter : @techiedishant") print("Github : dishantrathi") print() print() ...
StarcoderdataPython
4810034
""" FCN16 class. Library: Tensowflow 2.2.0, pyTorch 1.5.1 Author: <NAME> Email: <EMAIL> """ from __future__ import absolute_import, division, print_function import torch from ..encoders.squeeze_extractor import * class FCN16(torch.nn.Module): def __init__(self, n_classes, pretrained_model: SqueezeExtractor): s...
StarcoderdataPython
10198
from math import sqrt def stream_primes(num): primes = [] candidate = 2 for i in range(num): prime = next_prime(primes, candidate) primes.append(prime) candidate = prime + 1 yield prime def next_prime(primes, candidate): while True: for prime in primes: ...
StarcoderdataPython
184131
<filename>giadog/src/GymEnvs/RewardFunctions/lopez_reward.py """ Authors: <NAME>, <NAME> Project: Graduation Thesis: GIAdog Custom reward function """ import numpy as np def lopez_reward(robot): """ Custom reward function. """ # We wat to reward the robot for moving forward fo...
StarcoderdataPython
1639136
import matplotlib.pyplot as plt import os import numpy as np from eratosthenes.generic.mapping_io import read_geo_image, make_geo_im from eratosthenes.input.read_sentinel2 import \ list_central_wavelength_msi from eratosthenes.preprocessing.image_transforms import mat_to_gray toi = 15 boi = ['red', 'green', 'b...
StarcoderdataPython
3203978
#!/usr/bin/env python # -*- coding: utf-8 -*- from cleep.libs.internals.profileformatter import ProfileFormatter from cleep.profiles.messageprofile import MessageProfile class TimeToMessageFormatter(ProfileFormatter): """ parameters.time.now event to message profile formatter """ def __init__(self, pa...
StarcoderdataPython
1625106
from django.conf.urls import url, include from server.riders.views import RidersList, RiderProfile, RiderRides urlpatterns = [ url(r'^(?P<id>\d+)/rides', RiderRides.as_view(), name='rider-rides'), url(r'^(?P<id>\d+)', RiderProfile.as_view(), name='rider-profile'), url(r'^$', RidersList.as_view(), name='r...
StarcoderdataPython
1727129
<gh_stars>0 import warnings import numpy as np import pandas as pd from astropy.time import Time from numba import jit from numba.core.errors import NumbaPerformanceWarning from ..constants import Constants as c from ..coordinates import transformCoordinates from ..utils import _checkTime from .stumpff import calcStum...
StarcoderdataPython
93196
import pandas as pd from enum import Enum class EQUI(Enum): EQUIVALENT = 1 DIF_CARDINALITY = 2 DIF_SCHEMA = 3 DIF_VALUES = 4 """ UTILS """ def most_likely_key(df): res = uniqueness(df) res = sorted(res.items(), key=lambda x: x[1], reverse=True) return res[0] def uniqueness(df): r...
StarcoderdataPython
3393117
<gh_stars>0 import pandas as pd from sklearn.feature_extraction.text import TfidfVectorizer from collections import namedtuple import numpy as np # Set up named tuple for easy access of data class Preprocessor(): """ Creates a class that consumes a csv file and produces an dictionary that can be consu...
StarcoderdataPython
86080
import torch from torch.autograd import Variable from ptstat.core import RandomVariable, _to_v # TODO: Implement Uniform(a, b) constructor. class Uniform(RandomVariable): """ Uniform(0, 1) iid rv. """ def __init__(self, size, cuda=False): super(Uniform, self).__init__() assert len(size...
StarcoderdataPython
3280475
<reponame>raychangCode/Python-projects """ Name: <NAME>, 2020, 09 stanCode Breakout Project Adapted from <NAME>'s Breakout by <NAME>, <NAME>, <NAME>, and <NAME> YOUR DESCRIPTION HERE """ from campy.gui.events.timer import pause from breakoutgraphics import BreakoutGraphics from breakout_extention import Breakout_Exte...
StarcoderdataPython
18408
# Copyright 2019-2022 The University of Manchester, UK # Copyright 2020-2022 Vlaams Instituut voor Biotechnologie (VIB), BE # Copyright 2020-2022 Barcelona Supercomputing Center (BSC), ES # Copyright 2020-2022 Center for Advanced Studies, Research and Development in Sardinia (CRS4), IT # Copyright 2022 École Polytechni...
StarcoderdataPython
1607229
def fetchallClean(curr): """ for every entry for every row checks if entry is string and strips it :param curr: (self.cur) :return: the fetched thing with stripped strings """ data = curr.fetchall() if data: return [[i.strip() if isinstance(i, str) else i for i in j] for j in data] ...
StarcoderdataPython
1727810
<gh_stars>10-100 """This submodule implements the `OptimadeQuery` class, which enables filtering on any crystal structure database that implements an [OPTIMADE API](https://optimade.org). """ import logging import os from pathlib import Path from typing import List, Union import requests from Xerus.settings.settings ...
StarcoderdataPython
1768647
from Bio.SubsMat import MatrixInfo from Bio.Alphabet import IUPAC from collections import OrderedDict import numpy as np import pandas as pd import re import os import pickle def Embed_Seq_Num(seq,aa_idx,maxlength): seq_embed = np.zeros((1, maxlength)).astype('int64') if seq != 'null': n = 0 fo...
StarcoderdataPython
3362497
from unittest import TestCase from aws_network_tap.models.aws_tag import AWSTag class TestAWSTag(TestCase): def test_to_dict(self): key = { 'Key': 'Foo', 'Value': 'Bar' } key_dict = AWSTag.to_dict([key]) self.assertEqual({'Foo': 'Bar'}, key_dict) def t...
StarcoderdataPython
104900
import pyodbc as pyodbc import sys def connect(): print('Conectando ao prod...') server = '19.360.30.105\NAME' database = 'name' username = 'data' password = '<PASSWORD>' try: connection = pyodbc.connect('DRIVER={ODBC Driver 17 for SQL Server};SERVER='+server+';DATABASE='+database+';U...
StarcoderdataPython
124521
<filename>task 2 filename extension.py<gh_stars>1-10 print("Enter the name of the file along with it's extension:-") a=str(input()) if('.py' in a): print("The extension of the file is : python") else: print("The extension of the file is not python")
StarcoderdataPython
3260879
<reponame>jraylan/aiotdlib<filename>aiotdlib/api/types/message_sending_state.py<gh_stars>0 # =============================================================================== # # # # This file has been generated automatically!! Do not chan...
StarcoderdataPython
3313487
<reponame>windstamp/PaddleRec<filename>models/recall/ensfm/dygraph_model.py # 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 # #...
StarcoderdataPython
15615
import numpy def layer_method(): return {"pi": "{0:.2f}".format(numpy.pi)}
StarcoderdataPython
1615978
<reponame>MahmudX/Algorithms import GCD as GCD def GetLcm(a, b): return int(a*b/GCD.EuclidGCD(a, b)) print(GetLcm(21, 6)) MAXN = 10 spf = [0 for i in range(MAXN)] print(spf)
StarcoderdataPython
1687016
<gh_stars>0 from youtrack.connection import Connection connection = Connection('some url', 'root', 'root') for user in connection.getUsers(): print("yet another") if (user.login != 'root') and (user.login != 'guest'): connection._reqXml('DELETE', '/admin/user/' + user.login, '')
StarcoderdataPython
1628791
#!/usr/bin/env python # -*- coding: utf-8 -*- #------------------------------------------------------------------------------- # Name: navitia2OSM.py # # Author: @nlehuby - noemie.lehuby(at)gmail.com # # Created: 04/06/2014 # Licence: WTFPL #---------------------------------------------------------...
StarcoderdataPython
3376877
<reponame>oliveiralecca/cursoemvideo-python3 def contador(* num): # print(num) ELE CRIA UMA TUPLA COM OS VALORES PASSADOS, ENTÃO POSSO FAZER TUDO QUE FAÇO COM UMA TUPLA for valor in num: print(f'{valor} ', end='') print('FIM!') contador(2, 1, 7) contador(8, 0) contador(4, 4, 6, 2)
StarcoderdataPython
3301363
import sys from collections import Counter MOD = 10**9 + 7 n, *a = map(int, sys.stdin.read().split()) def main(): c = Counter(a) ans = 0 if n & 1: for i in range(2, n, 2): if c[i] != 2: break else: if c[0] == 1: ans =...
StarcoderdataPython
3224779
'''mensagem .txt''' texto=open("mensagem.txt",'r') cripto=open("cripto.txt",'w') for linha in texto.readlines(): for letra in linha: if letra in 'aeiouãõáê': cripto.write('*') else: cripto.write(letra) texto.close() cripto.close()
StarcoderdataPython
1774509
<gh_stars>0 # file: runme.py # This file illustrates the cross language polymorphism using directors. import example # CEO class, which overrides Employee::getPosition(). class CEO(example.Manager): def __init__(self, name): example.Manager.__init__(self, name) def getPosition(self): retu...
StarcoderdataPython
1651351
<filename>tests/parser_test.py """unit tests for Parser class""" import unittest import sys sys.path.insert(0, "./") import dmarcap from datetime import datetime class ParserTestFixture(unittest.TestCase): """Parser class test fixture""" def setUp(self): self.report_xml = "./tests/sample_report.xml" ...
StarcoderdataPython
3263999
<filename>tests/test_resourcegroupstaggingapi/test_resourcegroupstaggingapi.py from __future__ import unicode_literals import boto3 import sure # noqa from moto import mock_resourcegroupstaggingapi, mock_s3, mock_ec2 @mock_s3 @mock_resourcegroupstaggingapi def test_get_resources_s3(): # Tests pagination s3_...
StarcoderdataPython
1628504
<gh_stars>0 from fishy.__main__ import main __version__ = "0.3.5"
StarcoderdataPython
3252687
<filename>sharpy/solvers/nonlineardynamic.py """ @modified <NAME> """ import ctypes as ct import numpy as np import sharpy.structure.utils.xbeamlib as xbeamlib from sharpy.utils.settings import str2bool from sharpy.utils.solver_interface import solver, BaseSolver, solver_from_string import sharpy.utils.settings as ...
StarcoderdataPython
1632188
# Copyright 2009-2017 <NAME> # Copyright 2009-2020 PyUSB contributors # # Redistribution and use in source and binary forms, with or without # modification, are permitted provided that the following conditions are # met: # # 1. Redistributions of source code must retain the above copyright # notice, this list of condit...
StarcoderdataPython