code stringlengths 1 1.72M | language stringclasses 1
value |
|---|---|
import pygame, sys, threading
from pygame import font as pf
from pygame.locals import *
from vec2d import *
from math import sqrt, e, log
from random import uniform, normalvariate
from threading import Thread
#import psyco
#single node
class node:
def __init__(self, x, text="tag"):
self.x = x #position
... | Python |
"""
This code is currently broken
small changes are required to adapt it to the new pulsed measurements (without hardware API).
See rabi.py as example.
"""
class T1( PulsedTau ):
"""Defines a T1 measurement."""
laser = Range(low=1., high=100000., value=3000., desc='laser [ns]', ... | Python |
import numpy
import threading
import time
import logging
from traits.api import HasTraits, Trait, Instance, Property, Float, Range,\
Bool, Array, String, Str, Enum, Button, on_trait_change, cached_property, DelegatesTo
from traitsui.api import View, Item, Group, HGroup, VGroup, Tabbed, EnumEdito... | Python |
import numpy as np
from traits.api import Range, Array, Instance
from traitsui.api import View, Item, HGroup, VGroup
from enable.api import Component, ComponentEditor
from chaco.api import ArrayPlotData
from tools.chaco_addons import SavePlot as Plot, SaveTool
import logging
from tools.emod import ManagedJob
from to... | Python |
import numpy as np
from traits.api import Trait, Instance, Property, String, Range, Float, Int, Bool, Array, Enum, Button
from traitsui.api import View, Item, HGroup, VGroup, VSplit, Tabbed, EnumEditor, TextEditor, Group
from enable.api import Component, ComponentEditor
from chaco.api import ArrayPlotData, Plot, ... | Python |
import numpy as np
from traits.api import Range, Array, Instance, Enum, on_trait_change, Bool, Button, Float
from traitsui.api import View, Item, HGroup
from enable.api import ComponentEditor
from chaco.api import ArrayPlotData
from tools.chaco_addons import Sav... | Python |
"""
This code is currently broken
small changes are required to adapt it to the new pulsed measurements (without hardware API).
See rabi.py as example.
"""
class Hahn( Rabi ):
"""Defines a Hahn-Echo measurement."""
t_pi2 = Range(low=1., high=100000., value=1000., desc='pi/2 pulse... | Python |
"""
Provides basis for a pulsed measurement based on pulse_generator and time_tagger.
"""
import numpy as np
from traits.api import Range, Int, Float, Bool, Array, Instance, Enum, on_trait_change, Button
from traitsui.api import View, Item, Tabbed, HGroup, VGroup, VSplit, EnumEditor, TextEditor
import loggi... | Python |
"""
Auto focus tool.
"""
import numpy as np
from traits.api import SingletonHasTraits, Instance, Range, Bool, Array, Str, Enum, Button, on_trait_change, Trait
from traitsui.api import View, Item, Group, HGroup, VGroup, VSplit, Tabbed, EnumEditor
from enable.api import ComponentEditor
from chaco.api ... | Python |
import numpy
import threading
# enthought library imports
from traits.api import Instance, Int, Float, Range,\
Bool, Array, Enum, Button, on_trait_change
from traitsui.api import Handler, View, Item, Group, HGroup, VGroup, Tabbed, EnumEditor
from enable.api import ComponentEditor
fro... | Python |
"""
This code is currently broken
small changes are required to adapt it to the new pulsed measurements (without hardware API).
See rabi.py as example.
"""
class PulseCal( Pulsed ):
"""Pulse Calibration."""
frequency = Range(low=1, high=20e9, value=2.8705e9, desc='microwave frequenc... | Python |
"""
This code is currently broken
small changes are required to adapt it to the new pulsed measurements (without hardware API).
See rabi.py as example.
"""
class FID3pi2( Rabi ):
"""Defines a FID measurement with both pi/2 and 3pi/2 readout pulse."""
t_pi2 = Range(low=1., high=100000.... | Python |
import numpy as np
from pulsed import PulsedTau, sequence_remove_zeros, sequence_union
from traits.api import Range, Tuple, Int, Float, Bool, Array, Instance, Enum, on_trait_change, Button
from traitsui.api import View, Item, Group, Tabbed, HGroup, VGroup, VSplit, EnumEditor, TextEditor
class Rabi( PulsedTau ... | Python |
import numpy as np
import cPickle
# enthought library imports
from traits.api import SingletonHasTraits, HasTraits, Trait, Instance, Property, Int, Float, Range,\
Bool, Array, Str, Enum, Button, on_trait_change
from traitsui.api import View, Item, Group, HGroup, VGroup, Tabbed, E... | Python |
import numpy as np
from threading import currentThread
import logging
import time
from traits.api import Range, Array, Instance, Enum, on_trait_change, Bool, Button, Float
from traitsui.api import View, Item, HGroup #, EnumEditor
from enable.api import ComponentE... | Python |
"""
There are several distinct ways to go through different NVs and perform
certain measurement tasks.
1. using the queue and 'SwitchTarget' and 'SaveJob' and 'SetJob'
For each task, create a job and submit it to the queue.
Provide a 'special' job for switching the NV. I.e., a queue might
look like this: [ ODM... | Python |
"""
Provides NMR measurement based on pulsed measurement and step by step RF sweep.
"""
import numpy as np
from traits.api import Trait, Instance, Property, String, Range, Float, Int, Bool, Array, Enum
from traitsui.api import View, Item, HGroup, VGroup, VSplit, Tabbed, EnumEditor, TextEditor, Group, Label
... | Python |
"""
Determination of magnetic field from the Zeeman shift of several NVs
Problem statement
Suppose we have a single crystalline bulk diamond. Suppose the crystal
is placed in a homogeneous magnetic field B. NV centers can have 4 possible
orientations with respect to the crystal lattice. We consider N single NVs
who's... | Python |
import numpy as np
from scipy.optimize import leastsq
from fitting import baseline
def lorentzian(x0, g, a):
"""Lorentzian centered at x0, with amplitude a, and HWHM g."""
return lambda x: a / np.pi * ( g / ( (x-x0)**2 + g**2 ) )
def n_lorentzians(*p):
N = (len(p)-1)/3
def f(x):
y = p[0]*np... | Python |
"""
This module provides analysis of pulsed measurements.
The first part provides simple numeric functions.
The second part provides Trait GUIs
"""
import numpy as np
from fitting import find_edge
def spin_state(c, dt, T, t0=0.0, t1=-1.):
"""
Compute the spin state from a 2D array of count data.
... | Python |
"""
This file is part of Diamond. Diamond is a confocal scanner written
in python / Qt4. It combines an intuitive gui with flexible
hardware abstraction classes.
Diamond 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 Founda... | Python |
"""
Determination of magnetic field from the Zeeman shift of several NVs
Problem statement
Suppose we have a single crystalline bulk diamond. Suppose the crystal
is placed in a homogeneous magnetic field B. NV centers can have 4 possible
orientations with respect to the crystal lattice. We consider N single NVs
... | Python |
"""
Determination of magnetic field from the Zeeman shift of several NVs.
Problem statement
Suppose we have a single crystalline bulk diamond. Suppose the crystal
is placed in a homogeneous magnetic field B. NV centers can have 4 possible
orientations with respect to the crystal lattice. We consider N single NVs
who'... | Python |
import numpy
from scipy import ndimage
# Enthought library imports
from traits.api import Instance, Property, Range, Float, Array,\
Tuple, Button, on_trait_change, cached_property
from traitsui.api import View, Item, HGroup, Tabbed
from enable.api import ComponentEditor, Component
from... | Python |
"""
There are several distinct ways to go through different NVs and perform
certain measurement tasks.
1. using the queue and 'SwitchTarget' and 'SaveJob' and 'SetJob'
For each task, create a job and submit it to the queue.
Provide a 'special' job for switching the NV. I.e., a queue might
look like this: [ ODM... | Python |
"""
There are several distinct ways to go through different NVs and perform
certain measurement tasks.
1. using the queue and 'SwitchTarget' and 'SaveJob' and 'SetJob'
For each task, create a job and submit it to the queue.
Provide a 'special' job for switching the NV. I.e., a queue might
look like this: [ ODM... | Python |
import ctypes
import numpy
import traceback
map = {'laser':2, 'mw':1, 'microwave':1, 'trigger':3, 'SequenceTrigger':0, 'awgTrigger':0}
CLOCK = 400.0
DT = 2.5
dll = ctypes.cdll.LoadLibrary('spinapi.dll')
PULSE_PROGRAM = 0
CONTINUE = 0
STOP = 1
LOOP = 2
END_LOOP = 3
LONG_DELAY = 7... | Python |
# ToDo: convert to class
import numpy
from visa import instrument
import struct
import dtg_io
DTG = instrument('GPIB0::1::INSTR')
#DTG.chunk_size=2**20
DTG.timeout=100
ChunkSize = 1000000
# block_granularity and min_block_size: Constants of the DTG.
block_granularity = 4
min_block_si... | Python |
"""
This file is part of pi3diamond.
pi3diamond 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.
pi3diamond is distributed in the ho... | Python |
"""
This file is part of Diamond. Diamond is a confocal scanner written
in python / Qt4. It combines an intuitive gui with flexible
hardware abstraction classes.
Diamond 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... | Python |
'''
Created on 20.04.2012
author: Helmut Fedder
'''
import time
import numpy as np
# helper class to represent a visa instrument via a socket
class SocketInstrument():
def __init__(self, device):
import socket
host,port = device.split(':')
sock = socket.socket(socket.AF_INET, socket.SOCK_... | Python |
# -*- coding: utf-8 -*-
import logging
import ok
import os
bitfile = os.path.join(os.path.dirname(__file__),'pulser.bit')
class Pulser():
"""LOWLEVEL PULSER CONTROL"""
command_map = {'IDLE':0,'RUN':1,'LOAD':2,'RESET_READ':3,'RESET_SDRAM':4,'RESET_WRITE':5}
def __init__(self, serial=''):
xem = ok.... | Python |
import ctypes
import numpy, numpy.fft
import time
dll = ctypes.windll.LoadLibrary('dp7889.dll')
class ACQSETTING(ctypes.Structure):
_fields_ = [('range', ctypes.c_ulong),
('prena', ctypes.c_long),
('cftfak', ctypes.c_long),
('roimin', ... | Python |
"""
Dummy hardware classes for testing.
"""
import numpy as np
import logging
import time
class Scanner( ):
def getXRange(self):
return (0.,100.)
def getYRange(self):
return (0.,100.)
def getZRange(self):
return (-20.,20.)
def setx(self, x):
pass
def sety(self, y):... | Python |
"""
This file is part of pi3diamond.
pi3diamond 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.
pi3diamond is distributed in the ho... | Python |
import numpy as np
import time
from traits.api import HasTraits, Button
from traitsui.api import View, Item
from enthought.traits.ui.menu import Action, Menu, MenuBar
from nidaq import DOTask
class FlipMirror( HasTraits ):
flip = Button(desc="flip the mirror")
def __init__(self, trigger_... | Python |
import ctypes
import time
import struct
dll=ctypes.WinDLL('ftd2xx.dll')
class RotationStage():
"""Provide control over a thorlabs rotation stage."""
def __init__(self, serial='83838311'):
self._open_usb(serial)
def _open_usb(self, serial):
"""Open a USB connection to the con... | Python |
import numpy
import ctypes
import time
dll = ctypes.windll.LoadLibrary('nicaiu.dll')
import logging
DAQmx_Val_ContSamps = 10123
DAQmx_Val_FiniteSamps = 10178
DAQmx_Val_Hz = 10373
DAQmx_Val_Low = 10214
DAQmx_Val_MostRecentSamp = 10428
DAQmx_Val_Overwr... | Python |
#DTG_recids.py - definitions of binary codes for the .dtg file format. See the Tektronix Programmer's Manual for details
internal_node = 0x8000
leaf_node = 0x0000
recids = {
'DTG_ROOT_RECID':0x0001 | internal_node,
'DTG_MAGIC_RECID':0x0002 | leaf_node,
'DTG_TB_OPERATION_RECID':0x0003 | ... | Python |
import struct
import numpy
import binascii
import os
from dtg_recids import *
def read_tree(N, bytes):
"""
read N bytes from a string 'bytes' and build up a tree
"""
tree = []
while N>0 and len(bytes) > 0:
try:
recid = struct.unpack('<H', bytes[:2])[0]
e... | Python |
# -*- coding: utf-8 -*-
import numpy
import struct
from pulser import Pulser
import logging
class PulseGenerator():
def __init__(self, serial='', channel_map={'ch0':0,'ch1':1,'ch2':2,'ch3':3,'ch4':4,'ch5':5,'ch6':6,'ch7':7,'ch8':8,'ch9':9,'ch10':10,'ch11':11} ):
self.channel_map = channel_map
puls... | Python |
import numpy as np
from traits.api import HasTraits, Range
from traitsui.api import View, Item, RangeEditor
from hardware.nidaq import AOTask
class Laser( HasTraits ):
def __init__(self, AO_channel='/Dev1/ao3', voltage_range=(0.,5.), **kwargs):
self.AOTask = AOTask(Channels=AO_channel, range=v... | Python |
import visa
class DanFysik:
def __init__(self, device='GPIB0::7::INSTR', limit_current=10.0, maximum_current=20.0):
self.maximum_current=maximum_current
self.limit_current=limit_current
instr = visa.instrument(device)
instr.timeout=1.0
instr.term_chars='\r'
... | Python |
from nidaq import *
import TimeTagger
import numpy
import time
class PulsedAO(object):
"""Provides pulsed analog output. Provides two output forms: 1. set ao channels permanently to a given value.
2. Output N values along with a square wave with given seconds per point."""
def __init__(self, channels, ... | Python |
"""
This file is part of pi3diamond.
pi3diamond 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.
pi3diamond is distributed in the ho... | Python |
import time
import os
import cPickle
from exceptions import IOError
# Enthought library imports
from traits.api import Float, HasTraits, HasPrivateTraits, Str, Tuple, File, Button
from traitsui.api import Handler, View, Item, OKButton, CancelButton
from traitsui.file_dialog import open_file, save_file
fro... | Python |
"""
Implements a Cron Scheduler in python.
Taken from stackoverflow.com:
http://stackoverflow.com/questions/373335/suggestions-for-a-cron-like-scheduler-in-python
"""
# ToDo: maybe add auto_start functionality of the CronDaemon (e.g. self.start within submit() method)?
import threading
import logging
import time
fr... | Python |
"""
The execution model.
"""
import threading
import logging
from tools.utility import Singleton, StoppableThread, timestamp
from traits.api import HasTraits, Instance, Enum, Range, Button
from traitsui.api import View, Item, HGroup
# ToDo: maybe add auto_start functionality of the JobManager (e.g. self.start withi... | Python |
#rev 1.2
import pickle #works better than cPickle
import cPickle
_file_mode_map = {'asc':'', 'bin':'b'}
_pickle_mode_map = {'asc':0, 'bin':1}
def writeDictToFile(dict, filename):
if filename.find('.txt')!=-1 or filename.find('.asc')!=-1:
d=dictToAscii(dict)
stringToFile(d,filename)
elif filen... | Python |
# Enthought library imports
from traits.api import Float, HasTraits, HasPrivateTraits, Str, Tuple, File, Button
from traitsui.api import Handler, View, Item, OKButton, CancelButton
from exceptions import IOError
class ChacoSaveMixin:
"""
Provides a 'save' method, that saves the enable component as graphics f... | Python |
"""
pi3diamond example startup script
Please do not modify this file. Instead copy it to a new file -
e.g. named pi3diamond.py - that is not tracked in the repository
and modify it according to your needs.
"""
import logging, logging.handlers
import os
import inspect
path = os.path.dirname(inspect.getfile(inspect.cu... | Python |
#!/usr/bin/env python
#**** BEGIN LICENSE BLOCK *****
# Version: MPL 1.1/GPL 2.0/LGPL 2.1
#
# The contents of this file are subject to the Mozilla Public License
# Version 1.1 (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.mozil... | Python |
#!/usr/bin/env python
#**** BEGIN LICENSE BLOCK *****
# Version: MPL 1.1/GPL 2.0/LGPL 2.1
#
# The contents of this file are subject to the Mozilla Public License
# Version 1.1 (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.mozil... | Python |
#!/usr/bin/python
#
# Copyright (C) 2012 Google Inc.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law ... | Python |
#!/usr/bin/python
#
# Copyright (C) 2012 Google Inc.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law ... | Python |
#!/usr/bin/env python
#
# Copyright (c) 2002, Google Inc.
# All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions are
# met:
#
# * Redistributions of source code must retain the above copyright
# notice, this ... | Python |
#!/usr/bin/env python
# Copyright (c) 2010, Google Inc.
# All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions are
# met:
#
# * Redistributions of source code must retain the above copyright
# notice, this l... | Python |
# Copyright (C) 2010 Google Inc.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writ... | Python |
#!/usr/bin/python2.4
# -*- coding: utf-8 -*-
#
# Copyright (C) 2011 Google Inc.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless ... | Python |
# Copyright 2011 Google Inc. All Rights Reserved.
"""Locked file interface that should work on Unix and Windows pythons.
This module first tries to use fcntl locking to ensure serialized access
to a file, then falls back on a lock file if that is unavialable.
Usage:
f = LockedFile('filename', 'r+b', 'rb')
f.... | Python |
# Copyright 2011 Google Inc. All Rights Reserved.
"""Multi-credential file store with lock support.
This module implements a JSON credential store where multiple
credentials can be stored in one file. That file supports locking
both in a single process and across processes.
The credential themselves are keyed off o... | Python |
# Copyright (C) 2010 Google Inc.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writ... | Python |
# Copyright (C) 2010 Google Inc.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writ... | Python |
# Copyright (C) 2010 Google Inc.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writ... | Python |
# Copyright (C) 2011 Google Inc.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writ... | Python |
# Copyright (C) 2010 Google Inc.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writ... | Python |
__version__ = "1.0c2"
| Python |
# Copyright (C) 2010 Google Inc.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writ... | Python |
# Copyright (C) 2012 Google Inc.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writ... | Python |
# Copyright (C) 2007 Joe Gregorio
#
# Licensed under the MIT License
"""MIME-Type Parser
This module provides basic functions for handling mime-types. It can handle
matching mime-types against a list of media-ranges. See section 14.1 of the
HTTP specification [RFC 2616] for a complete explanation.
http://www.w3.o... | Python |
# Copyright (C) 2010 Google Inc.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writ... | Python |
# Copyright (C) 2010 Google Inc.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writ... | Python |
# Copyright (C) 2010 Google Inc.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writ... | Python |
# Copyright (C) 2010 Google Inc.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writ... | Python |
# Copyright (C) 2010 Google Inc.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writ... | Python |
# Copyright (C) 2010 Google Inc.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writ... | Python |
# Copyright (C) 2010 Google Inc.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writ... | Python |
# Copyright (C) 2010 Google Inc.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writ... | Python |
__version__ = "1.0c2"
| Python |
#!/usr/bin/python2.4
#
# Copyright (C) 2010 Google Inc.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable l... | Python |
#!/usr/bin/python2.4
#
# Copyright (C) 2010 Google Inc.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable l... | Python |
"""
iri2uri
Converts an IRI to a URI.
"""
__author__ = "Joe Gregorio (joe@bitworking.org)"
__copyright__ = "Copyright 2006, Joe Gregorio"
__contributors__ = []
__version__ = "1.0.0"
__license__ = "MIT"
__history__ = """
"""
import urlparse
# Convert an IRI to a URI following the rules in RFC 3987
#
# The characte... | Python |
from __future__ import generators
"""
httplib2
A caching http interface that supports ETags and gzip
to conserve bandwidth.
Requires Python 2.3 or later
Changelog:
2007-08-18, Rick: Modified so it's able to use a socks proxy if needed.
"""
__author__ = "Joe Gregorio (joe@bitworking.org)"
__copyright__ = "Copyright... | Python |
"""SocksiPy - Python SOCKS module.
Version 1.00
Copyright 2006 Dan-Haim. All rights reserved.
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
... | Python |
import Cookie
import datetime
import time
import email.utils
import calendar
import base64
import hashlib
import hmac
import re
import logging
# Ripped from the Tornado Framework's web.py
# http://github.com/facebook/tornado/commit/39ac6d169a36a54bb1f6b9bf1fdebb5c9da96e09
#
# Tornado is licensed under the Apache Licen... | Python |
# This is the version of this source code.
manual_verstr = "1.5"
auto_build_num = "211"
verstr = manual_verstr + "." + auto_build_num
try:
from pyutil.version_class import Version as pyutil_Version
__version__ = pyutil_Version(verstr)
except (ImportError, ValueError):
# Maybe there is no pyutil insta... | Python |
"""
The MIT License
Copyright (c) 2007-2010 Leah Culver, Joe Stump, Mark Paschal, Vic Fryzel
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 ... | Python |
"""
The MIT License
Copyright (c) 2007-2010 Leah Culver, Joe Stump, Mark Paschal, Vic Fryzel
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 ... | Python |
"""
The MIT License
Copyright (c) 2007-2010 Leah Culver, Joe Stump, Mark Paschal, Vic Fryzel
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 ... | Python |
# Early, and incomplete implementation of -04.
#
import re
import urllib
RESERVED = ":/?#[]@!$&'()*+,;="
OPERATOR = "+./;?|!@"
EXPLODE = "*+"
MODIFIER = ":^"
TEMPLATE = re.compile(r"{(?P<operator>[\+\./;\?|!@])?(?P<varlist>[^}]+)}", re.UNICODE)
VAR = re.compile(r"^(?P<varname>[^=\+\*:\^]+)((?P<explode>[\+\*])|(?P<part... | Python |
#!/usr/bin/python
# -*- coding: utf-8 -*-
################################################################################
import PyRSS2Gen
import sys
from datetime import date
from componentsource.classes.ComponentSourceFeedItem import ComponentSourceFeedItem
##########################################... | Python |
#!/usr/bin/python
# -*- coding: utf-8 -*-
################################################################################
import urllib
import logging
from componentsource.classes.CustomHTMLParser import CustomHTMLParser
################################################################################
... | Python |
from google.appengine.ext import db
"""
"""
class ComponentSourceFeedItem(db.Model):
title = db.StringProperty()
link = db.StringProperty()
description = db.TextProperty()
pubDate = db.DateTimeProperty(auto_now_add=True)
| Python |
import logging
import string
import re
from datetime import datetime
from HTMLParser import HTMLParser
from ComponentSourceFeedItem import ComponentSourceFeedItem
"""
"""
class CustomHTMLParser(HTMLParser):
"""
"""
def resetItemData(self):
self.isItemO... | Python |
#!/usr/bin/python
# -*- coding: utf-8 -*-
################################################################################
import urllib
import logging
from componentsource.classes.CustomHTMLParser import CustomHTMLParser
################################################################################
... | Python |
#!/usr/bin/python
# -*- coding: utf-8 -*-
################################################################################
import PyRSS2Gen
import sys
from datetime import date
from componentsource.classes.ComponentSourceFeedItem import ComponentSourceFeedItem
##########################################... | Python |
#!/usr/bin/python
# -*- coding: utf-8 -*-
################################################################################
import PyRSS2Gen
import sys
from datetime import date
from filehungry.classes.FileHungryFeedItem import FileHungryFeedItem
#########################################################... | Python |
#!/usr/bin/python
# -*- coding: utf-8 -*-
################################################################################
import urllib
import logging
from filehungry.classes.CustomHTMLParser import CustomHTMLParser
################################################################################
def s... | Python |
import logging
import string
import re
from datetime import datetime
from HTMLParser import HTMLParser
from FileHungryFeedItem import FileHungryFeedItem
"""
"""
class CustomHTMLParser(HTMLParser):
"""
"""
def resetItemData(self):
self.isItemOpened =... | Python |
from google.appengine.ext import db
"""
"""
class FileHungryFeedItem(db.Model):
title = db.StringProperty()
link = db.StringProperty()
description = db.TextProperty()
pubDate = db.DateTimeProperty(auto_now_add=True)
| Python |
Subsets and Splits
SQL Console for ajibawa-2023/Python-Code-Large
Provides a useful breakdown of language distribution in the training data, showing which languages have the most samples and helping identify potential imbalances across different language groups.