id
stringlengths
1
8
text
stringlengths
6
1.05M
dataset_id
stringclasses
1 value
5127062
#!/usr/bin/env python # -*- coding: utf-8 -*- """ 功能实现:返回列表中除第一个元素外的所有元素。 解读: 如果列表的长度大于1,则使用切片表示法返回最后一个元素。 否则,返回整个列表。 """ def tail(lst): return lst[1:] if len(lst) > 1 else lst # Examples print(tail([1, 2, 3])) print(tail([1])) # output: # [2, 3] # [1]
StarcoderdataPython
11268924
"""PyMC4.""" from . import utils from .coroutine_model import Model, model from .scopes import name_scope, variable_name from . import coroutine_model from . import distributions from . import flow from .flow import ( evaluate_model_transformed, evaluate_model, evaluate_model_posterior_predictive, evalu...
StarcoderdataPython
6495656
#!/usr/bin/env python from __future__ import print_function import sys, os, glob, operator, time if sys.version_info < (2, 7): sys.exit("ERROR: need python 2.7 or later for dep.py") if __name__ == "__main__": dt = float(sys.argv[3])-float(sys.argv[2]) hours, rem = divmod(dt, 3600) minutes, seconds = ...
StarcoderdataPython
6570909
<reponame>devkral/oscar-web-payments default_app_config = "demo.apps.OscarDemoConfig"
StarcoderdataPython
3455341
import os import sys import bioframe import click import cooler import cooltools import cooltools.expected import matplotlib.pyplot as plt import matplotlib.gridspec as gridspec from matplotlib.lines import Line2D import numpy as np import pandas as pd import pairlib import pairlib.scalings import pairtools from diskc...
StarcoderdataPython
5167637
<reponame>gmachadoads/mach556 import sqlite3 from sqlite3 import Error from tkinter import * from tkinter import messagebox import os c = os.path.dirname(__file__) nomeArquivo = c+'\\nomes.txt' def ConexaoBanco(): caminho = r'C:\Users\rjgug\OneDrive\Documentos\Python MACH556\MACH556.db' con = None try: ...
StarcoderdataPython
11398113
# Step 1 - Authenticate consumer_key= 'dNPO3EUKQLJSpofg5vm8oE1Mu' consumer_secret= '<KEY>' access_token='<KEY>' access_token_secret='<KEY>' from twitter import Api api = Api(consumer_key=consumer_key, consumer_secret=consumer_secret, access_token_key=access_token, access_token_secret=a...
StarcoderdataPython
9749555
<reponame>nishithshowri006/bonk-slaps from django.apps import AppConfig class BonkConfig(AppConfig): name = 'bonk'
StarcoderdataPython
1702789
# Lint as: python3 # Copyright 2020 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 ...
StarcoderdataPython
32840
# # See top-level LICENSE.rst file for Copyright information # # -*- coding: utf-8 -*- from __future__ import absolute_import, division, print_function from collections import OrderedDict from ..defs import (task_name_sep, task_state_to_int, task_int_to_state) from ...util import option_list from ...io import find...
StarcoderdataPython
4804463
<gh_stars>1-10 # coding=utf-8 from sentry_sdk import init as sentry_init from sentry_sdk.integrations import sqlalchemy as sentry_sqlalchemy from sqlalchemy.engine import create_engine from app import settings from ._base import ( Base, session, enable_time_logging, ) from .task import Task from .user impo...
StarcoderdataPython
6550053
<filename>lib/python/treadmill/traits.py<gh_stars>1-10 """Server traits. """ from __future__ import absolute_import from __future__ import division from __future__ import print_function from __future__ import unicode_literals import logging from treadmill import plugin_manager from treadmill import sysinfo _LOGGER ...
StarcoderdataPython
3412809
#!/usr/bin/env python3 import timeit import numpy as np from pwtools.crys import Trajectory from pwtools import crys, num, timer rand = np.random.rand # example session on 4-core box, _flob compiled w/ OpenMP (make gfortran-omp) # --------------------------------------------------------------------------- # # $ ex...
StarcoderdataPython
4990884
import os import sys from PIL import Image def jpg(filename: str, savename: str = "resized.jpg", width: int = 1024, height: int = 1024): if not(filename.lower().endswith(".jpg")): filename += ".jpg" if not(savename.lower().endswith(".jpg")): savename += ".jpg" try: imgjpg = Imag...
StarcoderdataPython
3446056
<reponame>UCBerkeley-SCET/DataX-Berkeley # -*- coding: utf-8 -*- """ Created on Mon Nov 23 11:59:55 2020 @author: tobias.grab """ from skimage.transform import rotate from skimage.transform import downscale_local_mean import keras from keras.layers import Input, Dense, Conv2D, MaxPooling2D, UpSampling2D, Ba...
StarcoderdataPython
8147087
from robpy import kw, test @test def foo(): bar() @kw def bar(): print 'bar'
StarcoderdataPython
6603595
<filename>reader.py # -*- coding: utf-8 -*- """ File Name: reader Description : 读取图像信息 Author : mick.yi date: 2018/12/26 """ import os import codecs import matplotlib.pyplot as plt def get_mslm_infos(annotation_file, img_dir): """ 读取mslm数据集信息 :param annotatio...
StarcoderdataPython
11375576
r"""Compute action detection performance for the AVA dataset. Please send any questions about this code to the Google Group ava-dataset-users: https://groups.google.com/forum/#!forum/ava-dataset-users Example usage: python -O get_ava_performance.py \ -l ava/ava_action_list_v2.1_for_activitynet_2018.pbtxt.txt \ -g...
StarcoderdataPython
4838949
import glob import logging import os import docker from tabulate import tabulate import yaml logging.basicConfig( format='%(asctime)s - %(message)s', level=logging.INFO, datefmt='%Y-%m-%d %H:%M:%S' ) SKIP_IMAGES = [ 'ceph-ansible', 'installer', 'kolla-ansible', 'osism-ansible', 'rally...
StarcoderdataPython
3406192
<reponame>CareBT/carebt # Copyright 2021 <NAME> (<EMAIL>) # # 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
119551
from gym_pcgrl.envs.pcgrl_env import PcgrlEnv from gym_pcgrl.envs.pcgrl_env_3D import PcgrlEnv3D
StarcoderdataPython
1932210
#!/usr/bin/python # -*- coding: utf-8 -*- """ 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 agre...
StarcoderdataPython
3476835
version = '1.0.0b5'
StarcoderdataPython
22251
# -*- coding: utf-8 -*- # Citations from flask import (Blueprint, request, render_template, flash, url_for, redirect, session) from flask.ext.login import login_required, current_user import logging, sys, re from sqlalchemy.exc import IntegrityError, InvalidRequestError from DictionaryOfNewZealandE...
StarcoderdataPython
4879493
<filename>engine/__init__.py from .celery import app as celery_app ____all___ = ('celery_app',)
StarcoderdataPython
3337335
from collections import defaultdict N, NUM_EDGES, Q = [int(x) for x in input().split()] edges = defaultdict(list) for i in range(NUM_EDGES): v1, v2 = [int(x) for x in input().split()] edges[v1].append(v2) edges[v2].append(v1) colors = [int(x) for x in input().split()] for i in range(Q): # print(colors)...
StarcoderdataPython
3451303
<reponame>santiagomvc/code2doc import pandas as pd import os import yaml from datetime import datetime from utils.transform_text_utils import create_vocab, transform_examples from utils.code2doc_utils import Code2DocTrain class ReadParams: def __init__(self, config): super().__init__() self.config...
StarcoderdataPython
3427177
import os,json import snakemake as smk from utils import * import pathlib channel_files = snakemake.input if isinstance(channel_files,str): if channel_files.split('.')[-1] == 'chanlist': with open(channel_files) as f: channel_files = f.read().splitlines() else: channel_files = [c...
StarcoderdataPython
11242472
<gh_stars>0 from django.urls import path from . import views urlpatterns = [ path("create_user/<slug:name>/<slug:email>", views.create_user, name="create_user"), path("get_user/<slug:name>", views.get_user, name="get user info"), path("transfer/<slug:src>/<slug:dst>/<int:amount>", views.transfer, name="tra...
StarcoderdataPython
9644405
<gh_stars>0 # Program to handle unique game IDs per player def new_game_id(): game_id = 0 # REIMPLEMENT TO GET UNIQUE VALUE NOT IN GLOBAL ARRAY return game_id
StarcoderdataPython
11207815
""" Implement atoi which converts a string to an integer. The function first discards as many whitespace characters as necessary until the first non-whitespace character is found. Then, starting from this character, takes an optional initial plus or minus sign followed by as many numerical digits as possible, and inte...
StarcoderdataPython
3307299
<reponame>begyy/PayMe from .methods_subscribe_api import PayComResponse class Paycom(PayComResponse): ORDER_FOUND = 200 ORDER_NOT_FOND = -31050 INVALID_AMOUNT = -31001 def check_order(self, amount, account, *args, **kwargs): """ >>> self.check_order(amount=amount, account=account) ...
StarcoderdataPython
11376515
#!/usr/bin/env python # -*- coding: utf-8 -*- import json from alipay.aop.api.response.AlipayResponse import AlipayResponse class AlipaySocialQuestionnareTaskPublishResponse(AlipayResponse): def __init__(self): super(AlipaySocialQuestionnareTaskPublishResponse, self).__init__() self._ext_info = ...
StarcoderdataPython
12831199
from chess_game.models.board import Board def test_board_init(): board = Board() assert 8 == len(board.board) for row in board.board: assert 8 == len(row) def test_game_board_has_pawns(): board = Board() board_white_pawn_row = board.board[1] for cell in board_white_pawn_row: ...
StarcoderdataPython
8114282
import math import random import obnlib as z APP_CODE = "#H02" APP_NAME = "<NAME>" APP_RELEASE = "2022" APP_VERSION = "V0.1" APP_FPS = 50 last_score = 0 #------------------------------------------------------------------------------ IMAGE_TITLE = z.Image(\ b"\xFF\xFF\xFF\x30\x30\x30\x30\xFF\xFF\xFF\x00\xE0\xF0\...
StarcoderdataPython
355198
<gh_stars>1-10 from __future__ import unicode_literals from django.apps import apps def handler_process_signal(sender, **kwargs): Quota = apps.get_model(app_label='quotas', model_name='Quota') for quota in Quota.objects.filter(enabled=True): backend_instance = quota.get_backend_instance() i...
StarcoderdataPython
6439159
<gh_stars>1-10 from abaqusConstants import * from .Constraint import Constraint from ..Region.Region import Region class MultipointConstraint(Constraint): """The MultipointConstraint object defines a constraint between a group of MultipointConstraint nodes located on a region and a reference point. The M...
StarcoderdataPython
3358294
# Copyright (C) 2010 by the Massachusetts Institute of Technology. # All rights reserved. # Export of this software from the United States of America may # require a specific license from the United States Government. # It is the responsibility of any person or organization contemplating # export to obtain such ...
StarcoderdataPython
369872
<gh_stars>0 import requests import contextlib from .path import Path from urllib.parse import urlparse from tqdm import tqdm from .pbar import file_proc_bar def download_bar(iterable, chunk_size = None, total_size = None, exist_size = 0): def bar(): with file_proc_bar(total=total_size) as pbar: ...
StarcoderdataPython
5041137
import torch import unittest from magic_vnet.nestvnet import * class NestVNetTest(unittest.TestCase): data = torch.rand((1, 1, 32, 32, 32)) target_size = torch.Size([1, 1, 32, 32, 32]) def test_nestvnet(self): model = NestVNet(1, 2) out = model(self.data) self.assertEqual(out.size...
StarcoderdataPython
5030351
import sys import random sys.path.append('../LU_model') import db sys.path.pop() sys.path.append('../data_resource') import CrawlerTimeTable DB_IP = "172.16.17.32" # doctorbot GCP ip DB_PORT = 27017 # default MongoDB port DB_NAME = "doctorbot" # use the collection class intent_slot_generator(object): def __ini...
StarcoderdataPython
5125788
# -*- coding: utf-8 -*- import scrapy import csv class WikiSpider(scrapy.Spider): name = 'wiki' start_urls = ['https://en.wikipedia.org/wiki/List_of_countries_by_intentional_homicide_rate'] def parse(self, response): country_names_pre = response.xpath('(//table)[2]//a/text()').getall() country_names = country...
StarcoderdataPython
3336545
import os import torch from torch.nn import functional as F from stft_core.modeling.utils import cat from stft_core.structures.bounding_box import BoxList #infer from stft_core.structures.boxlist_ops import boxlist_iou INF = 100000000 def get_num_gpus(): return int(os.environ["WORLD_SIZE"]) if "WORLD_SIZE" in...
StarcoderdataPython
6581524
<reponame>billyevans/prefix_storage<filename>fill.py #!/usr/bin/env python # -*- coding: utf-8 -*- import httplib2 import sys import md5 if __name__ == '__main__': count = 0 for line in sys.stdin: conn = httplib2.HTTPConnectionWithTimeout("localhost", int(sys.argv[1])) key = line.rstrip() ...
StarcoderdataPython
12823261
<filename>APPRoot/loveword/middleware/meipai_parse.py # -*- coding:utf-8 -*- import base64 import requests import json import re import execjs """ # 方法一: class MeiPai(object): def __init__(self, url): self.url = url self.session = requests.Session() with open("static/loveword/js/meipai_encr...
StarcoderdataPython
138699
<gh_stars>0 from collections import defaultdict from itertools import chain from .graphutils import * from .milltypes import (WordType, WordType, AtomicType, FunctorType, DiamondType, BoxType, EmptyType, ModalType, invariance_check) from functools import reduce from .transformations import majo...
StarcoderdataPython
5164917
# # Copyright 2020-2021 Xilinx, 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 ...
StarcoderdataPython
6655320
from marionette_driver import Wait, expected from marionette_harness import MarionetteTestCase class Test(MarionetteTestCase): # Starting 84, opening the security level panel by clicking the button # started to fail (the panel was not visible). Opening via JavaScript # seems to still work for 84 and 78. ...
StarcoderdataPython
8114183
<reponame>ikstream/Zeus-Scanner<gh_stars>100-1000 #!/usr/bin/env python import io import sys import time import shlex import warnings import subprocess from var import blackwidow from var.search import selenium_search from var.auto_issue.github import request_issue_creation from lib.header_check import main_header_ch...
StarcoderdataPython
3260485
# from app import ssp_app, mail from app.ssp_module.models import User from app.app import create_app, db from flask import render_template, request, flash, redirect, url_for from flask_login import current_user, login_user, login_required, logout_user from flask_mail import Message from flask import Blueprint from app...
StarcoderdataPython
3510018
#!/usr/bin/env python # -*- coding: UTF-8 -*- import pprint from collections import Counter from base import BaseObject from datadict import LoadStopWords from nlusvc import TextAPI class AddLanguageVariability(BaseObject): """ Service to Augment the Synonyms ('Language Variability') file with new entries ...
StarcoderdataPython
8185575
#!/usr/bin/python3 # -*- coding:utf-8 -*- import tensorflow as tf from tensorflow.contrib import rnn class Decoder(): def __init__(self, vocab_size, rnn_size, embeddings): self.vocab_size = vocab_size self.rnn_size = rnn_size self.embeddings = embeddings se...
StarcoderdataPython
9771399
# encoding: utf-8 import sys from setuptools import setup, find_packages from setuptools.command.test import test as TestCommand __version__ = '0.0.6' class PyTest(TestCommand): user_options = [('pytest-args=', 'a', 'Arguments to pass to py.test')] def initialize_options(self): TestCommand.initiali...
StarcoderdataPython
3258701
<filename>ppf/core/controller.py class controller(object): def __init__(self, trade, model, env, historical_df = 0): self.__trade = trade self.__model = model self.__env = env self.__historical_df = historical_df self.__symbol_table = {} self.__event = None def get_trade(self): return s...
StarcoderdataPython
4951512
from django.test import TestCase from .models import Location, Category, Image from unittest import skip class LocationTestClass(TestCase): ''' Class that tests the location ''' def setUp(self): ''' Creates new instances before a test ''' self.nairobi = Location(name = "...
StarcoderdataPython
5066663
#!/usr/bin/env python3 """ Module to contain the runtime options for the CCPP Framework. Function to parse arguments to the CCPP Framework and store them in an object which allows various framework functions to access CCPP Framework runtime information and parameter values. """ # Python library imports import argpars...
StarcoderdataPython
13125
<filename>asteroids/whatsobservable.py import datetime import ephem import os.path import os import numpy as np import pdb from pandas import DataFrame __version__ = '0.1.2' class Error(Exception): pass def _convert_datetime_to_pyephem_date_string(in_datetime): return in_datetime.strftime('%Y/%m/%d %H:%M:...
StarcoderdataPython
4994092
<reponame>axfontai/HermesServer #librairies indispensables : bokeh - pandas from bokeh.io import curdoc, show from bokeh.plotting import figure, output_file from bokeh.transform import jitter, factor_cmap, dodge from bokeh.models import (ColumnDataSource, Drag, PanTool, BoxZoomTool, LassoSelectTool, ...
StarcoderdataPython
6664400
import requests from api import http def test_adjust_paging_with_no_params(): target = http.Http(lambda: requests.Session()) url = "https://gitlab.com/api/v4/projects/14171783/jobs" expected = "https://gitlab.com/api/v4/projects/14171783/jobs?per_page=20" actual = target.__adjust_paging__(url, 20) ...
StarcoderdataPython
303701
<filename>solutions/week-1/ending.py<gh_stars>1-10 n = int(input()) if 0 <= n <= 1000: if n == 0: print(n, "программистов", sep=" ") elif n % 100 >= 10 and n % 100 <= 20: print(n, "программистов", sep=" ") elif n % 10 == 1: print(n, "программист", sep=" ") elif n % 10 >= 2 and n...
StarcoderdataPython
9685058
<reponame>eBertolina/toradocu import csv import sys # Check command line arguments. if len(sys.argv) < 2 or len(sys.argv) > 3: print("""\ This script must be invoked with the following arguments: 1. CSV file to parse; 2. (Optional) Number of missing translation to be considered to compute overall recall; Output wi...
StarcoderdataPython
5122743
<reponame>aletuf93/analogistics import pandas as pd import numpy as np import matplotlib.pyplot as plt def updateGlobalInventory(D_SKUs: pd.DataFrame, inventoryColumn: str): """ Update the global inventory of the warehouse Args: D_SKUs (pd.DataFrame): Input SKUs dataframe. inventoryColu...
StarcoderdataPython
3220581
#!/usr/bin/env python3 # -*- coding: utf-8 -*- # # PROGRAMMER: <NAME>. # DATE CREATED: 19 Nov 2020 # REVISED DATE: 13 dic 2020 # PURPOSE: A Class to analyze a dataset of numbers and apply the Benfords Law counting the frequency of the first digit # from 1 - 9 # # Usage: # ...
StarcoderdataPython
11243856
<gh_stars>0 import re import time from collections import Mapping from glob import glob from os import makedirs from os.path import dirname from os.path import exists as p_exists, join as p_join, isfile as p_isfile, isdir as p_isdir, getctime import numpy as np from torch import load as torch_load, save as torch_save ...
StarcoderdataPython
3422122
# -*- coding: utf-8 -*- """ PDF document reader. """ from __future__ import absolute_import from __future__ import division from __future__ import print_function from __future__ import unicode_literals from pdfminer.converter import PDFPageAggregator from pdfminer.layout import LAParams, LTTextLine, LTTextBox, LTFig...
StarcoderdataPython
122263
<filename>python/data_sutram/scraper/perform__.py<gh_stars>10-100 import json from selenium import webdriver from selenium.webdriver.common.desired_capabilities import DesiredCapabilities options = webdriver.ChromeOptions() #options.binary_location = "/Applications/Google Chrome.app/Contents/MacOS/Google Chrome" chrom...
StarcoderdataPython
8184965
<reponame>Belvarm/roguelike-tutorial from __future__ import annotations from typing import Optional, TYPE_CHECKING import graphic from actions import Impossible if TYPE_CHECKING: from actions import ActionWithItem from location import Location from inventory import Inventory class Item(graphic.Graphic...
StarcoderdataPython
366895
import pandas as pd old = pd.read_csv('user_reviews.csv') new = pd.read_csv('user_reviews.csv') # if then elif else (new) # create new column new['qualitative_rating'] = '' # assign 'qualitative_rating' based on 'grade' with .loc new.loc[new.grade < 5, 'qualitative_rating'] = 'bad' new.loc[new.grade == 5, 'qualitative...
StarcoderdataPython
294313
# -*- coding: utf-8 -*- """ Python Script Created on Sunday August 2017 10:17:41 @author: <NAME> [desc] Support vector machines (SVMs) are a set of supervised learning methods used for classification, regression and outliers detection. The advantages of support vector machines are: - Effective in ...
StarcoderdataPython
6626532
"""Module with all classes related to links. Links are low level abstractions representing connections between two interfaces. """ import hashlib import json import random from kytos.core.common import GenericEntity from kytos.core.exceptions import (KytosLinkCreationError, KytosNo...
StarcoderdataPython
12810237
import pytest from flask_controller_bundle import Controller from flask_controller_bundle.attr_constants import CONTROLLER_ROUTES_ATTR from flask_controller_bundle.route import Route class TestRoute: def test_should_register_defaults_to_true(self): route = Route('/path', lambda: 'view_func') asse...
StarcoderdataPython
3261681
<filename>pysnmp/CISCO-SYSLOG-CAPABILITY.py # # PySNMP MIB module CISCO-SYSLOG-CAPABILITY (http://snmplabs.com/pysmi) # ASN.1 source file:///Users/davwang4/Dev/mibs.snmplabs.com/asn1/CISCO-SYSLOG-CAPABILITY # Produced by pysmi-0.3.4 at Mon Apr 29 17:57:14 2019 # On host DAVWANG4-M-1475 platform Darwin version 18.5.0 by...
StarcoderdataPython
9620701
<reponame>HereIsANiceNickname/CAS19 import logging import os import matplotlib.pyplot as plt import networkx as nx import yaml from networkx import write_yaml from actors import Actor from fractories import Graphs, Actors, Distributions, Rules log = logging.getLogger(__name__) BASE_PATH_LAYOUT = "{}/{}.{}" class S...
StarcoderdataPython
3516271
EDA_URL = "https://eda.ru"
StarcoderdataPython
9663344
''' Todo list schemas ''' from pydantic import BaseModel class ListInput(BaseModel): ''' List model for input data ''' list_name: str def to_orm(self): return dict(name=self.list_name) class ListSchema(ListInput): ''' List model to represent data from base ''' list_id: ...
StarcoderdataPython
1935040
"""This solves problem #387 of Project Euler (https://projecteuler.net). Harshad Numbers Problem 387 A Harshad or Niven number is a number that is divisible by the sum of its digits. 201 is a Harshad number because it is divisible by 3 (the sum of its digits.) When we truncate the last digit from 201, we get 20, whic...
StarcoderdataPython
6465264
<reponame>BrentG-1849260/PyVoxelizer import sys import os import numpy as np from ctypes import cdll, Structure, c_float class Point3(Structure): _fields_ = [ ("x", c_float), ("y", c_float), ("z", c_float) ] class Triangle3(Structure): _fields_ = [ ("v1", Point3), ...
StarcoderdataPython
11236434
def reverse_number(x): """ :type x: int :rtype: reversed number """ reverse = 0 while(x != 0): remainder = x % 10 reverse = reverse * 10 + remainder x //= 10 return print(f'The reversed number is:{reverse}') reverse_num...
StarcoderdataPython
11306256
import unittest from evo_tests.examples import ExampleLOC, ExampleLOTC, ExampleConfigurations, ExampleDealers from evo_json.convert_py_json.convert_trait import convert_from_pj_loc from evo_json.process_json.process_configuration import convert_config_to_dealer, convert_dealer_to_config class TestConvert(unittest.Test...
StarcoderdataPython
12835310
#!/usr/bin/env python # coding: utf-8 # <a href="https://colab.research.google.com/github/nagi1995/sarcastic-comment-detection/blob/main/Sarcastic_Comments.ipynb" target="_parent"><img src="https://colab.research.google.com/assets/colab-badge.svg" alt="Open In Colab"/></a> # In[1]: from google.colab import drive dr...
StarcoderdataPython
9714724
<gh_stars>0 # Given n pairs of parentheses, write a function to generate all combinations of well-formed parentheses. # For example, given n = 3, a solution set is: # [ # "((()))", # "(()())", # "(())()", # "()(())", # "()()()" # ] # Backtracking - Problem solving approach that incrementally builds candida...
StarcoderdataPython
8173614
from __future__ import print_function, absolute_import, division from collections import abc from jinja2 import Template class VCSConfiguration(object): def __init__(self, name, options, global_variables, special_variables, commit_message=None, finish_release=True, include_fil...
StarcoderdataPython
3351201
<filename>rosbag_decode/bag-decode.py from rosbags.rosbag2 import Reader from rosbags.serde import deserialize_cdr from datetime import datetime path = "rosbag_decode/test-logs/rosbag2_2021_06_01-19_24_43" def list_topics_test(): with Reader(path) as reader: # topic and msgtype information is available on...
StarcoderdataPython
4924883
#!/usr/bin/env python # -*- coding: utf-8 -*- """ 同数のデータ点数を持つS, Tに対し、点ごとの対応が既知であるとして 点群間の平行移動・回転・スケーリングを推定する """ from typing import Tuple from dataclasses import dataclass import numpy as np __all__ = ["MatchingResult", "minL2"] @dataclass class MatchingResult: cost: float offsetX: float offsetY: float ...
StarcoderdataPython
187497
<reponame>debprakash/emr-view<filename>emr_mine_python_scipts/pq_tree/common_intervals.py ''' Created on Dec 29, 2010 @author: patnaik ''' #def naive_common_interval(pi_AB, C_prev = None): # n = len(pi_AB) # C = set() # for x in xrange(n-1): # l = u = pi_AB[x] # for y in xrange(x+1, n): # ...
StarcoderdataPython
221007
import os import sys import tempfile import subprocess def compute_metrics_from_files(path_to_reference, path_to_candidate, trec_eval_bin_path): trec_run_fd, trec_run_path = tempfile.mkstemp(text=True) try: with os.fdopen(trec_run_fd, 'w') as tmp: for line in open(path_to_candidate): ...
StarcoderdataPython
9632094
import os from werkzeug.utils import secure_filename from flask import( Flask, jsonify, send_from_directory, request, redirect, url_for ) from flask_sqlalchemy import SQLAlchemy app = Flask(__name__) app.config.from_object("project.config.Config") db = SQLAlchemy(app) class User(db.Model): ...
StarcoderdataPython
1701897
<gh_stars>1-10 """ Real time AEmotion (env: 'torch') """ # %% Import libs import pyaudio import numpy as np # import pickle # import librosa import keract import sys sys.path.append('..') from src.modeling.tcn.tcn import TCN import os import tensorflow as tf os.environ['CUDA_VISIBLE_DEVICES'] = '-1' from tensorflow...
StarcoderdataPython
4953290
"""add credits billing fields Revision ID: <KEY> Revises: <KEY> Create Date: 2021-02-17 18:42:21.656755 """ import sqlalchemy as sa from alembic import op # revision identifiers, used by Alembic. revision = "<KEY>" down_revision = "<KEY>" branch_labels = None depends_on = None def upgrade() -> None: op.create...
StarcoderdataPython
3384104
<filename>stats-backend/api2/migrations/0003_rename_offer_offer_properties.py # Generated by Django 3.2.12 on 2022-04-14 11:07 from django.db import migrations class Migration(migrations.Migration): dependencies = [ ('api2', '0002_auto_20220414_1143'), ] operations = [ migrations.Rename...
StarcoderdataPython
12855914
<gh_stars>1-10 from django.apps import AppConfig class NativeShortuuidConfig(AppConfig): name = 'native_shortuuid'
StarcoderdataPython
11300233
<filename>python codes/FizzBuzz.py i=0 n = int(input("Enter the number of lines : ")) while i<n:i+=1;print('FizzBuzz'[i%~2&4:12&8+i%~4]or i)
StarcoderdataPython
8084800
<gh_stars>0 def main(): import interactive_plotter as ip import itertools import numpy as np x = np.linspace(-1, 1, 31) y = np.linspace(-1, 1, 29) xc = x[:-1] + 0.5 * np.diff(x) yc = y[:-1] + 0.5 * np.diff(y) time_step = 0.03 delta_t = time_step X, Y = np.meshgrid(x, y) Xc...
StarcoderdataPython
6627998
<filename>swift_undelete/tests/test_middleware.py #!/usr/bin/env python # Copyright (c) 2014 SwiftStack, 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/lice...
StarcoderdataPython
263753
<gh_stars>1-10 # Generated by Django 2.0.2 on 2018-04-04 17:50 from django.db import migrations class Migration(migrations.Migration): dependencies = [ ('voter', '0018_convert_badlines'), ] operations = [ migrations.DeleteModel( name='BadLine', ), migrations....
StarcoderdataPython
5038721
<filename>src/modules/general.py<gh_stars>1-10 import datetime import typing import discord from discord.ext import commands import config import database import utils class GeneralCommands(commands.Cog, name="General"): def __init__(self, bot): self.bot = bot @commands.command(name="donate") a...
StarcoderdataPython
45449
<reponame>VictorAtPL/Pascal-VOC12_Class-segmentation_Tensorflow-2.0.0 from tensorflow import keras from tensorflow.keras.applications import VGG16 from tensorflow.keras.layers import Conv2D, Conv2DTranspose, Activation from AbstractModel import AbstractModel from common import load_sets_count, get_input_fn_and_steps_p...
StarcoderdataPython
1776055
<filename>examples/scripts/location/create_location_object.py<gh_stars>0 import pyaurorax def main(): loc = pyaurorax.Location(lat=51.0447, lon=-114.0719) print(loc) # ---------- if (__name__ == "__main__"): main()
StarcoderdataPython
1949618
import random import pygame pygame.init() screenx, screeny = 1000, 800 window = pygame.display.set_mode((screenx, screeny)) font = pygame.font.SysFont('Arial', 30) pygame.display.set_caption("Pong") # RGB black = (0, 0, 0) white = (255, 255, 255) red = (255, 0, 0) class Player: def __init__(sel...
StarcoderdataPython
1748304
from hypothesis import given from tests.utils import (BoundPortedEdgesPair, equivalence) from . import strategies @given(strategies.edges_pairs, strategies.edges_pairs) def test_basic(first_edges_pair: BoundPortedEdgesPair, second_edges_pair: BoundPortedEdgesPair) -> None: ...
StarcoderdataPython